Skip to content

Commit de12cc7

Browse files
committed
[Flight] Fallback to importing the whole module instead of encoding every name (#26624)
We currently don't just "require" a module by its module id/path. We encode the pair of module id/path AND its export name. That's because with module splitting, a single original module can end up in two or more separate modules by name. Therefore the manifest files need to encode how to require the whole module as well as how to require each export name. In practice, we don't currently use this because we end up forcing Webpack to deopt and keep it together as a single module, and we don't even have the code in the Webpack plugin to write separate values for each export name. The problem is with CJS we don't statically know what all the export names will be. Since these cases will never be module split, we don't really need to know. This changes the Flight requires to first look for the specific name we're loading and then if that name doesn't exist in the manifest we fallback to looking for the `"*"` name containing the entire module and look for the name in there at runtime. We could probably optimize this a bit if we assume that CJS modules on the server never get built with a name. That way we don't have to do the failed lookup. Additionally, since we've recently merged filepath + name into a single string instead of two values, we now have to split those back out by parsing the string. This is especially unfortunate for server references since those should really not reveal what they are but be a hash or something. The solution might just be to split them back out into two separate fields again. cc @shuding DiffTrain build for commit da6c23a.
1 parent c36f62f commit de12cc7

File tree

13 files changed

+19
-19
lines changed

13 files changed

+19
-19
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23745,7 +23745,7 @@ function createFiberRoot(
2374523745
return root;
2374623746
}
2374723747

23748-
var ReactVersion = "18.3.0-next-2bfe4b246-20230414";
23748+
var ReactVersion = "18.3.0-next-da6c23a45-20230414";
2374923749

2375023750
// Might add PROFILE later.
2375123751

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8587,7 +8587,7 @@ var devToolsConfig$jscomp$inline_1023 = {
85878587
throw Error("TestRenderer does not support findFiberByHostInstance()");
85888588
},
85898589
bundleType: 0,
8590-
version: "18.3.0-next-2bfe4b246-20230414",
8590+
version: "18.3.0-next-da6c23a45-20230414",
85918591
rendererPackageName: "react-test-renderer"
85928592
};
85938593
var internals$jscomp$inline_1206 = {
@@ -8618,7 +8618,7 @@ var internals$jscomp$inline_1206 = {
86188618
scheduleRoot: null,
86198619
setRefreshHandler: null,
86208620
getCurrentFiber: null,
8621-
reconcilerVersion: "18.3.0-next-2bfe4b246-20230414"
8621+
reconcilerVersion: "18.3.0-next-da6c23a45-20230414"
86228622
};
86238623
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
86248624
var hook$jscomp$inline_1207 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9013,7 +9013,7 @@ var devToolsConfig$jscomp$inline_1065 = {
90139013
throw Error("TestRenderer does not support findFiberByHostInstance()");
90149014
},
90159015
bundleType: 0,
9016-
version: "18.3.0-next-2bfe4b246-20230414",
9016+
version: "18.3.0-next-da6c23a45-20230414",
90179017
rendererPackageName: "react-test-renderer"
90189018
};
90199019
var internals$jscomp$inline_1247 = {
@@ -9044,7 +9044,7 @@ var internals$jscomp$inline_1247 = {
90449044
scheduleRoot: null,
90459045
setRefreshHandler: null,
90469046
getCurrentFiber: null,
9047-
reconcilerVersion: "18.3.0-next-2bfe4b246-20230414"
9047+
reconcilerVersion: "18.3.0-next-da6c23a45-20230414"
90489048
};
90499049
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
90509050
var hook$jscomp$inline_1248 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-next-2bfe4b246-20230414";
30+
var ReactVersion = "18.3.0-next-da6c23a45-20230414";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
639639
);
640640
};
641641
exports.useTransition = useTransition;
642-
exports.version = "18.3.0-next-2bfe4b246-20230414";
642+
exports.version = "18.3.0-next-da6c23a45-20230414";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ exports.useSyncExternalStore = function (
642642
);
643643
};
644644
exports.useTransition = useTransition;
645-
exports.version = "18.3.0-next-2bfe4b246-20230414";
645+
exports.version = "18.3.0-next-da6c23a45-20230414";
646646

647647
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
648648
if (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2bfe4b246f58d1f8d357f984fba9a8aa1fa79c73
1+
da6c23a45c62ac3edabae9b7145b14e35a470480

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27052,7 +27052,7 @@ function createFiberRoot(
2705227052
return root;
2705327053
}
2705427054

27055-
var ReactVersion = "18.3.0-next-2bfe4b246-20230414";
27055+
var ReactVersion = "18.3.0-next-da6c23a45-20230414";
2705627056

2705727057
function createPortal$1(
2705827058
children,

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9456,7 +9456,7 @@ var roots = new Map(),
94569456
devToolsConfig$jscomp$inline_1047 = {
94579457
findFiberByHostInstance: getInstanceFromNode,
94589458
bundleType: 0,
9459-
version: "18.3.0-next-2bfe4b246-20230414",
9459+
version: "18.3.0-next-da6c23a45-20230414",
94609460
rendererPackageName: "react-native-renderer",
94619461
rendererConfig: {
94629462
getInspectorDataForViewTag: function () {
@@ -9498,7 +9498,7 @@ var internals$jscomp$inline_1276 = {
94989498
scheduleRoot: null,
94999499
setRefreshHandler: null,
95009500
getCurrentFiber: null,
9501-
reconcilerVersion: "18.3.0-next-2bfe4b246-20230414"
9501+
reconcilerVersion: "18.3.0-next-da6c23a45-20230414"
95029502
};
95039503
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95049504
var hook$jscomp$inline_1277 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10165,7 +10165,7 @@ var roots = new Map(),
1016510165
devToolsConfig$jscomp$inline_1125 = {
1016610166
findFiberByHostInstance: getInstanceFromNode,
1016710167
bundleType: 0,
10168-
version: "18.3.0-next-2bfe4b246-20230414",
10168+
version: "18.3.0-next-da6c23a45-20230414",
1016910169
rendererPackageName: "react-native-renderer",
1017010170
rendererConfig: {
1017110171
getInspectorDataForViewTag: function () {
@@ -10220,7 +10220,7 @@ var roots = new Map(),
1022010220
scheduleRoot: null,
1022110221
setRefreshHandler: null,
1022210222
getCurrentFiber: null,
10223-
reconcilerVersion: "18.3.0-next-2bfe4b246-20230414"
10223+
reconcilerVersion: "18.3.0-next-da6c23a45-20230414"
1022410224
});
1022510225
exports.createPortal = function (children, containerTag) {
1022610226
return createPortal$1(

0 commit comments

Comments
 (0)