Skip to content

Commit 3f81ef2

Browse files
committed
Combine createElement and JSX modules (#28320)
Depends on: - #28317 --- There's a ton of overlap between the createElement implementation and the JSX implementation, so I combined them into a single module. In the actual build output, the shared code between JSX and createElement will get duplicated anyway, because react/jsx-runtime and react (where createElement lives) are separate, flat build artifacts. So this is more about code organization — with a few key exceptions, the implementations of createElement and jsx are highly coupled. DiffTrain build for [5fb2c93](5fb2c93)
1 parent 3b13b94 commit 3f81ef2

13 files changed

+7007
-8347
lines changed

compiled/facebook-www/JSXDEVRuntime-dev.classic.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ if (__DEV__) {
252252
// $FlowFixMe[method-unbinding]
253253
var hasOwnProperty = Object.prototype.hasOwnProperty;
254254

255+
var assign = Object.assign;
256+
255257
/*
256258
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
257259
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
@@ -375,8 +377,6 @@ if (__DEV__) {
375377
return isArrayImpl(a);
376378
}
377379

378-
var assign = Object.assign;
379-
380380
// Helpers to patch console.logs to avoid logging during side-effect free
381381
// replaying on render function. This currently only patches the object
382382
// lazily which won't cover if the log function was extracted eagerly.
@@ -1389,13 +1389,11 @@ if (__DEV__) {
13891389
*/
13901390

13911391
function isValidElement(object) {
1392-
{
1393-
return (
1394-
typeof object === "object" &&
1395-
object !== null &&
1396-
object.$$typeof === REACT_ELEMENT_TYPE
1397-
);
1398-
}
1392+
return (
1393+
typeof object === "object" &&
1394+
object !== null &&
1395+
object.$$typeof === REACT_ELEMENT_TYPE
1396+
);
13991397
}
14001398
var ownerHasKeyUseWarning = {};
14011399
/**

compiled/facebook-www/JSXDEVRuntime-dev.modern.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ if (__DEV__) {
252252
// $FlowFixMe[method-unbinding]
253253
var hasOwnProperty = Object.prototype.hasOwnProperty;
254254

255+
var assign = Object.assign;
256+
255257
/*
256258
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
257259
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
@@ -375,8 +377,6 @@ if (__DEV__) {
375377
return isArrayImpl(a);
376378
}
377379

378-
var assign = Object.assign;
379-
380380
// Helpers to patch console.logs to avoid logging during side-effect free
381381
// replaying on render function. This currently only patches the object
382382
// lazily which won't cover if the log function was extracted eagerly.
@@ -1389,13 +1389,11 @@ if (__DEV__) {
13891389
*/
13901390

13911391
function isValidElement(object) {
1392-
{
1393-
return (
1394-
typeof object === "object" &&
1395-
object !== null &&
1396-
object.$$typeof === REACT_ELEMENT_TYPE
1397-
);
1398-
}
1392+
return (
1393+
typeof object === "object" &&
1394+
object !== null &&
1395+
object.$$typeof === REACT_ELEMENT_TYPE
1396+
);
13991397
}
14001398
var ownerHasKeyUseWarning = {};
14011399
/**

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ec160f32c28ccab798c73ecccbb36ce121e1640e
1+
5fb2c93f3924ba980444da5698f60651b5ef0689

0 commit comments

Comments
 (0)