FB-specific builds of Flight Server, Flight Client, and React Shared Subset (#27579)

This PR adds a new FB-specific configuration of Flight. We also need to
bundle a version of ReactSharedSubset that will be used for running
Flight on the server.

This initial implementation does not support server actions yet.

The FB-Flight still uses the text protocol on the server (the flag
`enableBinaryFlight` is set to false). It looks like we need some
changes in Hermes to properly support this binary format.
This commit is contained in:
Andrey Lunyov
2023-11-27 18:34:58 -05:00
committed by GitHub
parent 6c7b41da3d
commit c17a27ef49
18 changed files with 960 additions and 9 deletions
+33
View File
@@ -104,6 +104,17 @@ const bundles = [
externals: [],
},
/******* Isomorphic Shared Subset for FB *******/
{
bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [],
moduleType: ISOMORPHIC,
entry: 'react/src/ReactSharedSubsetFB.js',
global: 'ReactSharedSubset',
minifyWithProdErrorCodes: true,
wrapWithModuleBoundaries: false,
externals: [],
},
/******* React JSX Runtime *******/
{
bundleTypes: [
@@ -574,6 +585,28 @@ const bundles = [
externals: ['acorn'],
},
/******* React Server DOM FB Server *******/
{
bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [],
moduleType: RENDERER,
entry: 'react-server-dom-fb/src/ReactFlightDOMServerFB.js',
global: 'ReactFlightDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'react-dom'],
},
/******* React Server DOM FB Client *******/
{
bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [],
moduleType: RENDERER,
entry: 'react-server-dom-fb/src/ReactFlightDOMClientFB.js',
global: 'ReactFlightDOMClient',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'react-dom'],
},
/******* React Suspense Test Utils *******/
{
bundleTypes: [NODE_ES2015],
+4 -1
View File
@@ -63,7 +63,10 @@ const forks = Object.freeze({
if (entry === 'react') {
return './packages/react/src/ReactSharedInternalsClient.js';
}
if (entry === 'react/src/ReactSharedSubset.js') {
if (
entry === 'react/src/ReactSharedSubset.js' ||
entry === 'react/src/ReactSharedSubsetFB.js'
) {
return './packages/react/src/ReactSharedInternalsServer.js';
}
if (!entry.startsWith('react/') && dependencies.indexOf('react') === -1) {
+22 -1
View File
@@ -396,13 +396,34 @@ module.exports = [
'react-dom',
'react-dom/src/ReactDOMSharedSubset.js',
'react-dom-bindings',
'react-server-dom-fb',
'react-server-dom-fb/src/ReactDOMServerFB.js',
'shared/ReactDOMSharedInternals',
],
isFlowTyped: true,
isServerSupported: true,
isFlightSupported: false,
},
{
shortName: 'dom-fb-experimental',
entryPoints: [
'react-server-dom-fb/src/ReactFlightDOMClientFB.js',
'react-server-dom-fb/src/ReactFlightDOMServerFB.js',
],
paths: [
'react-dom',
'react-dom-bindings',
'react-server-dom-fb/src/ReactFlightClientConfigFBBundler.js',
'react-server-dom-fb/src/ReactFlightClientConfigFBBundler.js',
'react-server-dom-fb/src/ReactFlightReferencesFB.js',
'react-server-dom-fb/src/ReactFlightServerConfigFBBundler.js',
'react-server-dom-fb/src/ReactFlightDOMClientFB.js',
'react-server-dom-fb/src/ReactFlightDOMServerFB.js',
'shared/ReactDOMSharedInternals',
],
isFlowTyped: true,
isServerSupported: true,
isFlightSupported: true,
},
{
shortName: 'native',
entryPoints: ['react-native-renderer'],