Skip to content

Commit

Permalink
add jsx-runtime and jsx-dev-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
lunaruan committed Mar 17, 2020
1 parent 0705b72 commit 4dbbbcb
Show file tree
Hide file tree
Showing 12 changed files with 912 additions and 57 deletions.
10 changes: 10 additions & 0 deletions packages/react/jsx-dev-runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {Fragment, jsxDEV} from './src/jsx/ReactJSX';
9 changes: 9 additions & 0 deletions packages/react/jsx-runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {Fragment, jsx, jsxs} from './src/jsx/ReactJSX';
7 changes: 7 additions & 0 deletions packages/react/npm/jsx-dev-runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-jsx-dev-runtime.production.min.js');
} else {
module.exports = require('./cjs/react-jsx-dev-runtime.development.js');
}
7 changes: 7 additions & 0 deletions packages/react/npm/jsx-runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-jsx-runtime.production.min.js');
} else {
module.exports = require('./cjs/react-jsx-runtime.development.js');
}
7 changes: 6 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"build-info.json",
"index.js",
"cjs/",
"umd/"
"umd/",
"jsx-runtime.js",
"jsx-dev-runtime.js"
],
"main": "index.js",
"repository": {
Expand All @@ -29,6 +31,9 @@
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
},
"peerDependencies": {
"react": "^16.0.0"
},
"browserify": {
"transform": [
"loose-envify"
Expand Down
7 changes: 7 additions & 0 deletions packages/react/src/ReactDebugCurrentFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ export function setCurrentlyValidatingElement(element: null | ReactElement) {
}

if (__DEV__) {
ReactDebugCurrentFrame.setCurrentlyValidatingElement = function(
element: null | ReactElement,
) {
if (__DEV__) {
currentlyValidatingElement = element;
}
};
// Stack implementation injected by the current renderer.
ReactDebugCurrentFrame.getCurrentStack = (null: null | (() => string));

Expand Down
Loading

0 comments on commit 4dbbbcb

Please sign in to comment.