Skip to content

Commit 4dbbbcb

Browse files
committed
add jsx-runtime and jsx-dev-runtime
1 parent 0705b72 commit 4dbbbcb

File tree

12 files changed

+912
-57
lines changed

12 files changed

+912
-57
lines changed

packages/react/jsx-dev-runtime.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
export {Fragment, jsxDEV} from './src/jsx/ReactJSX';

packages/react/jsx-runtime.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
export {Fragment, jsx, jsxs} from './src/jsx/ReactJSX';

packages/react/npm/jsx-dev-runtime.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-jsx-dev-runtime.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-jsx-dev-runtime.development.js');
7+
}

packages/react/npm/jsx-runtime.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react-jsx-runtime.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react-jsx-runtime.development.js');
7+
}

packages/react/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"build-info.json",
1515
"index.js",
1616
"cjs/",
17-
"umd/"
17+
"umd/",
18+
"jsx-runtime.js",
19+
"jsx-dev-runtime.js"
1820
],
1921
"main": "index.js",
2022
"repository": {
@@ -29,6 +31,9 @@
2931
"loose-envify": "^1.1.0",
3032
"object-assign": "^4.1.1"
3133
},
34+
"peerDependencies": {
35+
"react": "^16.0.0"
36+
},
3237
"browserify": {
3338
"transform": [
3439
"loose-envify"

packages/react/src/ReactDebugCurrentFrame.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ export function setCurrentlyValidatingElement(element: null | ReactElement) {
2323
}
2424

2525
if (__DEV__) {
26+
ReactDebugCurrentFrame.setCurrentlyValidatingElement = function(
27+
element: null | ReactElement,
28+
) {
29+
if (__DEV__) {
30+
currentlyValidatingElement = element;
31+
}
32+
};
2633
// Stack implementation injected by the current renderer.
2734
ReactDebugCurrentFrame.getCurrentStack = (null: null | (() => string));
2835

0 commit comments

Comments
 (0)