Skip to content

Commit ad5dfc8

Browse files
Add react-flight-server-fb package for Meta's internal bundler (facebook#36309)
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. Before submitting a pull request, please make sure the following is done: 1. Fork [the repository](https://github.com/facebook/react) and create your branch from `main`. 2. Run `yarn` in the repository root. 3. If you've fixed a bug or added code that should be tested, add tests! 4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development. 5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`. 6. If you need a debugger, run `yarn test --debug --watch TestName`, open `chrome://inspect`, and press "Inspect". 7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`). 8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files. 9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`). 10. If you haven't already, complete the CLA. Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html --> ## Summary <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> - Adds a new react-flight-server-fb package providing RSC Flight bindings for Meta's internal bundler stack - Unlike webpack/turbopack integrations, this uses no manifest. Module metadata is self-contained in ClientReference objects and sent over the wire as-is - Registers dom-browser-fb and dom-node-fb host configs for Rollup builds targeting FB_WWW_DEV and FB_WWW_PROD Key design differences from other bundler - No build-time manifest - Module IDs use Haste module names (e.g. `"MyComponent"`), with named exports encoded as `"Module#export"`, rather than file paths resolved through a manifest - Client-side loading uses `Bootloader.handlePayload()` + `JSResource().load()` - `resolveClientReferenceMetadata` and `resolveClientReference` are pass-throughs ## How did you test this change? <!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. How exactly did you verify that your PR solves the issue you wanted to solve? If you leave this empty, your PR will very likely be closed. --> E2E integration test is set up on Meta's internal system.
1 parent 561ed52 commit ad5dfc8

24 files changed

Lines changed: 1733 additions & 23 deletions

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ module.exports = {
331331
'packages/react-server-dom-turbopack/**/*.js',
332332
'packages/react-server-dom-parcel/**/*.js',
333333
'packages/react-server-dom-fb/**/*.js',
334+
'packages/react-flight-server-fb/**/*.js',
334335
'packages/react-server-dom-unbundled/**/*.js',
335336
'packages/react-test-renderer/**/*.js',
336337
'packages/react-debug-tools/**/*.js',

.github/workflows/runtime_build_and_test.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
with:
4646
path: |
4747
**/node_modules
48-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
48+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
4949
lookup-only: true
5050
- uses: actions/setup-node@v4
5151
if: steps.node_modules.outputs.cache-hit != 'true'
@@ -59,7 +59,7 @@ jobs:
5959
with:
6060
path: |
6161
**/node_modules
62-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
62+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
6363
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
6464
- run: yarn install --frozen-lockfile
6565
if: steps.node_modules.outputs.cache-hit != 'true'
@@ -69,7 +69,7 @@ jobs:
6969
with:
7070
path: |
7171
**/node_modules
72-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
72+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
7373

7474
runtime_compiler_node_modules_cache:
7575
name: Cache Runtime, Compiler node_modules
@@ -84,7 +84,7 @@ jobs:
8484
with:
8585
path: |
8686
**/node_modules
87-
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
87+
key: runtime-and-compiler-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
8888
lookup-only: true
8989
- uses: actions/setup-node@v4
9090
if: steps.node_modules.outputs.cache-hit != 'true'
@@ -100,7 +100,7 @@ jobs:
100100
with:
101101
path: |
102102
**/node_modules
103-
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
103+
key: runtime-and-compiler-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
104104
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
105105
- run: yarn install --frozen-lockfile
106106
if: steps.node_modules.outputs.cache-hit != 'true'
@@ -112,7 +112,7 @@ jobs:
112112
with:
113113
path: |
114114
**/node_modules
115-
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
115+
key: runtime-and-compiler-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
116116

117117
# ----- FLOW -----
118118
discover_flow_inline_configs:
@@ -154,7 +154,7 @@ jobs:
154154
with:
155155
path: |
156156
**/node_modules
157-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
157+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
158158
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
159159
- name: Ensure clean build directory
160160
run: rm -rf build
@@ -182,7 +182,7 @@ jobs:
182182
with:
183183
path: |
184184
**/node_modules
185-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
185+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
186186
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
187187
- name: Ensure clean build directory
188188
run: rm -rf build
@@ -212,7 +212,7 @@ jobs:
212212
with:
213213
path: |
214214
**/node_modules
215-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
215+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
216216
- name: Ensure clean build directory
217217
run: rm -rf build
218218
- run: yarn install --frozen-lockfile
@@ -270,7 +270,7 @@ jobs:
270270
with:
271271
path: |
272272
**/node_modules
273-
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
273+
key: runtime-and-compiler-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
274274
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
275275
- name: Ensure clean build directory
276276
run: rm -rf build
@@ -301,7 +301,7 @@ jobs:
301301
with:
302302
path: |
303303
**/node_modules
304-
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
304+
key: runtime-and-compiler-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
305305
- name: Install runtime dependencies
306306
run: yarn install --frozen-lockfile
307307
if: steps.node_modules.outputs.cache-hit != 'true'
@@ -344,7 +344,7 @@ jobs:
344344
with:
345345
path: |
346346
**/node_modules
347-
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
347+
key: runtime-and-compiler-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
348348
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
349349
- name: Ensure clean build directory
350350
run: rm -rf build
@@ -430,7 +430,7 @@ jobs:
430430
with:
431431
path: |
432432
**/node_modules
433-
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
433+
key: runtime-and-compiler-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
434434
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
435435
- name: Ensure clean build directory
436436
run: rm -rf build
@@ -477,7 +477,7 @@ jobs:
477477
with:
478478
path: |
479479
**/node_modules
480-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
480+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
481481
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
482482
- name: Ensure clean build directory
483483
run: rm -rf build
@@ -517,7 +517,7 @@ jobs:
517517
with:
518518
path: |
519519
**/node_modules
520-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
520+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
521521
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
522522
- name: Ensure clean build directory
523523
run: rm -rf build
@@ -580,7 +580,7 @@ jobs:
580580
with:
581581
path: |
582582
**/node_modules
583-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
583+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
584584
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
585585
- name: Ensure clean build directory
586586
run: rm -rf build
@@ -618,7 +618,7 @@ jobs:
618618
with:
619619
path: |
620620
**/node_modules
621-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
621+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
622622
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
623623
- name: Ensure clean build directory
624624
run: rm -rf build
@@ -768,7 +768,7 @@ jobs:
768768
with:
769769
path: |
770770
**/node_modules
771-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
771+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
772772
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
773773
- name: Ensure clean build directory
774774
run: rm -rf build
@@ -828,7 +828,7 @@ jobs:
828828
with:
829829
path: |
830830
**/node_modules
831-
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
831+
key: runtime-node_modules-v8-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
832832
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
833833
- name: Ensure clean build directory
834834
run: rm -rf build

.github/workflows/shared_lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
path: |
3535
**/node_modules
36-
key: shared-lint-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
36+
key: shared-lint-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
3737
- name: Ensure clean build directory
3838
run: rm -rf build
3939
- run: yarn install --frozen-lockfile
@@ -56,7 +56,7 @@ jobs:
5656
with:
5757
path: |
5858
**/node_modules
59-
key: shared-lint-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
59+
key: shared-lint-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
6060
- name: Ensure clean build directory
6161
run: rm -rf build
6262
- run: yarn install --frozen-lockfile
@@ -79,7 +79,7 @@ jobs:
7979
with:
8080
path: |
8181
**/node_modules
82-
key: shared-lint-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
82+
key: shared-lint-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
8383
- name: Ensure clean build directory
8484
run: rm -rf build
8585
- run: yarn install --frozen-lockfile
@@ -102,7 +102,7 @@ jobs:
102102
with:
103103
path: |
104104
**/node_modules
105-
key: shared-lint-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
105+
key: shared-lint-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
106106
- name: Ensure clean build directory
107107
run: rm -rf build
108108
- run: yarn install --frozen-lockfile
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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 {default as rendererVersion} from 'shared/ReactVersion';
11+
export const rendererPackageName = 'react-flight-server-fb';
12+
13+
export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
14+
export * from 'react-client/src/ReactClientConsoleConfigBrowser';
15+
export * from 'react-client/src/ReactClientDebugConfigBrowser';
16+
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigBundlerFB';
17+
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigTargetFBBrowser';
18+
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigDOMFB';
19+
export const usedWithSSR = false;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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 {default as rendererVersion} from 'shared/ReactVersion';
11+
export const rendererPackageName = 'react-flight-server-fb';
12+
13+
export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
14+
export * from 'react-client/src/ReactClientConsoleConfigServer';
15+
export * from 'react-client/src/ReactClientDebugConfigNode';
16+
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigBundlerFB';
17+
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigTargetFBBrowser';
18+
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigDOMFB';
19+
export const usedWithSSR = false;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# react-flight-server-fb
2+
3+
React Flight bindings for DOM using Meta's internal bundler.
4+
5+
**Use it at your own risk.**
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and 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 * from './src/client/ReactFlightDOMClientBrowser';
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "react-flight-server-fb",
3+
"description": "React Server Components bindings for DOM using Meta's internal bundler. It is not intended to be imported directly.",
4+
"version": "19.3.0",
5+
"keywords": [
6+
"react"
7+
],
8+
"homepage": "https://react.dev/",
9+
"bugs": "https://github.com/facebook/react/issues",
10+
"license": "MIT",
11+
"files": [
12+
"LICENSE",
13+
"README.md",
14+
"client.browser.js"
15+
],
16+
"exports": {
17+
"./client": "./client.browser.js",
18+
"./client.browser": "./client.browser.js",
19+
"./src/*": "./src/*.js",
20+
"./package.json": "./package.json"
21+
},
22+
"repository": {
23+
"type" : "git",
24+
"url" : "https://github.com/facebook/react.git",
25+
"directory": "packages/react-flight-server-fb"
26+
},
27+
"engines": {
28+
"node": ">=0.10.0"
29+
},
30+
"peerDependencies": {
31+
"react": "^19.0.0",
32+
"react-dom": "^19.0.0"
33+
}
34+
}

0 commit comments

Comments
 (0)