Skip to content

Commit dd05198

Browse files
sebmarkbageunstubbableeps1lon
committed
Patch Promise cycles and toString on Server Functions
[Flight] Move `react-server-dom-webpack/*.unbundled` to private `react-server-dom-unbundled` (#35290) Co-authored-by: Hendrik Liebau <[email protected]> Co-authored-by: Sebastian "Sebbie" Silbermann <[email protected]>
1 parent 0eeded6 commit dd05198

File tree

58 files changed

+3388
-368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3388
-368
lines changed

.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-server-dom-unbundled/**/*.js',
334335
'packages/react-test-renderer/**/*.js',
335336
'packages/react-debug-tools/**/*.js',
336337
'packages/react-devtools-extensions/**/*.js',

.github/workflows/runtime_build_and_test.yml

Lines changed: 30 additions & 54 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-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
48+
key: runtime-node_modules-v7-${{ 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,10 +59,8 @@ jobs:
5959
with:
6060
path: |
6161
**/node_modules
62-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
63-
restore-keys: |
64-
runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
65-
runtime-node_modules-v6-
62+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
63+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
6664
- run: yarn install --frozen-lockfile
6765
if: steps.node_modules.outputs.cache-hit != 'true'
6866
- name: Save cache
@@ -71,7 +69,7 @@ jobs:
7169
with:
7270
path: |
7371
**/node_modules
74-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
72+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
7573

7674
runtime_compiler_node_modules_cache:
7775
name: Cache Runtime, Compiler node_modules
@@ -86,7 +84,7 @@ jobs:
8684
with:
8785
path: |
8886
**/node_modules
89-
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
87+
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
9088
lookup-only: true
9189
- uses: actions/setup-node@v4
9290
if: steps.node_modules.outputs.cache-hit != 'true'
@@ -102,10 +100,8 @@ jobs:
102100
with:
103101
path: |
104102
**/node_modules
105-
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
106-
restore-keys: |
107-
runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
108-
runtime-and-compiler-node_modules-v6-
103+
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
104+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
109105
- run: yarn install --frozen-lockfile
110106
if: steps.node_modules.outputs.cache-hit != 'true'
111107
- run: yarn --cwd compiler install --frozen-lockfile
@@ -116,7 +112,7 @@ jobs:
116112
with:
117113
path: |
118114
**/node_modules
119-
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
115+
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
120116

121117
# ----- FLOW -----
122118
discover_flow_inline_configs:
@@ -158,10 +154,8 @@ jobs:
158154
with:
159155
path: |
160156
**/node_modules
161-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
162-
restore-keys: |
163-
runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
164-
runtime-node_modules-v6-
157+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
158+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
165159
- name: Ensure clean build directory
166160
run: rm -rf build
167161
- run: yarn install --frozen-lockfile
@@ -188,10 +182,8 @@ jobs:
188182
with:
189183
path: |
190184
**/node_modules
191-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
192-
restore-keys: |
193-
runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
194-
runtime-node_modules-v6-
185+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
186+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
195187
- name: Ensure clean build directory
196188
run: rm -rf build
197189
- run: yarn install --frozen-lockfile
@@ -220,7 +212,7 @@ jobs:
220212
with:
221213
path: |
222214
**/node_modules
223-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
215+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
224216
- name: Ensure clean build directory
225217
run: rm -rf build
226218
- run: yarn install --frozen-lockfile
@@ -278,10 +270,8 @@ jobs:
278270
with:
279271
path: |
280272
**/node_modules
281-
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
282-
restore-keys: |
283-
runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
284-
runtime-and-compiler-node_modules-v6-
273+
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
274+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
285275
- name: Ensure clean build directory
286276
run: rm -rf build
287277
- run: yarn install --frozen-lockfile
@@ -310,7 +300,7 @@ jobs:
310300
with:
311301
path: |
312302
**/node_modules
313-
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
303+
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
314304
- name: Install runtime dependencies
315305
run: yarn install --frozen-lockfile
316306
if: steps.node_modules.outputs.cache-hit != 'true'
@@ -353,10 +343,8 @@ jobs:
353343
with:
354344
path: |
355345
**/node_modules
356-
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
357-
restore-keys: |
358-
runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
359-
runtime-and-compiler-node_modules-v6-
346+
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
347+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
360348
- name: Ensure clean build directory
361349
run: rm -rf build
362350
- run: yarn install --frozen-lockfile
@@ -444,10 +432,8 @@ jobs:
444432
with:
445433
path: |
446434
**/node_modules
447-
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
448-
restore-keys: |
449-
runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
450-
runtime-and-compiler-node_modules-v6-
435+
key: runtime-and-compiler-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
436+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
451437
- name: Ensure clean build directory
452438
run: rm -rf build
453439
- run: yarn install --frozen-lockfile
@@ -487,10 +473,8 @@ jobs:
487473
with:
488474
path: |
489475
**/node_modules
490-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
491-
restore-keys: |
492-
runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
493-
runtime-node_modules-v6-
476+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
477+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
494478
- name: Ensure clean build directory
495479
run: rm -rf build
496480
- run: yarn install --frozen-lockfile
@@ -552,10 +536,8 @@ jobs:
552536
with:
553537
path: |
554538
**/node_modules
555-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
556-
restore-keys: |
557-
runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
558-
runtime-node_modules-v6-
539+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
540+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
559541
- name: Ensure clean build directory
560542
run: rm -rf build
561543
- run: yarn install --frozen-lockfile
@@ -592,10 +574,8 @@ jobs:
592574
with:
593575
path: |
594576
**/node_modules
595-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
596-
restore-keys: |
597-
runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
598-
runtime-node_modules-v6-
577+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
578+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
599579
- name: Ensure clean build directory
600580
run: rm -rf build
601581
- run: yarn install --frozen-lockfile
@@ -744,10 +724,8 @@ jobs:
744724
with:
745725
path: |
746726
**/node_modules
747-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
748-
restore-keys: |
749-
runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
750-
runtime-node_modules-v6-
727+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
728+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
751729
- name: Ensure clean build directory
752730
run: rm -rf build
753731
- run: yarn install --frozen-lockfile
@@ -806,10 +784,8 @@ jobs:
806784
with:
807785
path: |
808786
**/node_modules
809-
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
810-
restore-keys: |
811-
runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-
812-
runtime-node_modules-v6-
787+
key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
788+
# Don't use restore-keys here. Otherwise the cache grows indefinitely.
813789
- name: Ensure clean build directory
814790
run: rm -rf build
815791
- run: yarn install --frozen-lockfile

fixtures/flight/loader/region.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
load as reactLoad,
44
getSource as getSourceImpl,
55
transformSource as reactTransformSource,
6-
} from 'react-server-dom-webpack/node-loader';
6+
} from 'react-server-dom-unbundled/node-loader';
77

88
export {resolve};
99

fixtures/flight/server/global.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const http = require('http');
3636
const React = require('react');
3737

3838
const {renderToPipeableStream} = require('react-dom/server');
39-
const {createFromNodeStream} = require('react-server-dom-webpack/client');
39+
const {createFromNodeStream} = require('react-server-dom-unbundled/client');
4040
const {PassThrough} = require('stream');
4141

4242
const app = express();

fixtures/flight/server/region.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
const path = require('path');
66
const url = require('url');
77

8-
const register = require('react-server-dom-webpack/node-register');
8+
const register = require('react-server-dom-unbundled/node-register');
9+
// TODO: This seems to have no effect anymore. Remove?
910
register();
1011

1112
const babelRegister = require('@babel/register');
@@ -76,7 +77,7 @@ function getDebugChannel(req) {
7677

7778
async function renderApp(res, returnValue, formState, noCache, debugChannel) {
7879
const {renderToPipeableStream} = await import(
79-
'react-server-dom-webpack/server'
80+
'react-server-dom-unbundled/server'
8081
);
8182
// const m = require('../src/App.js');
8283
const m = await import('../src/App.js');
@@ -134,7 +135,7 @@ async function renderApp(res, returnValue, formState, noCache, debugChannel) {
134135

135136
async function prerenderApp(res, returnValue, formState, noCache) {
136137
const {prerenderToNodeStream} = await import(
137-
'react-server-dom-webpack/static'
138+
'react-server-dom-unbundled/static'
138139
);
139140
// const m = require('../src/App.js');
140141
const m = await import('../src/App.js');
@@ -202,7 +203,7 @@ app.get('/', async function (req, res) {
202203
app.post('/', bodyParser.text(), async function (req, res) {
203204
const noCache = req.headers['cache-control'] === 'no-cache';
204205
const {decodeReply, decodeReplyFromBusboy, decodeAction, decodeFormState} =
205-
await import('react-server-dom-webpack/server');
206+
await import('react-server-dom-unbundled/server');
206207
const serverReference = req.get('rsc-action');
207208
if (serverReference) {
208209
// This is the client-side case

fixtures/flight/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import {renderToReadableStream} from 'react-server-dom-webpack/server';
2+
import {renderToReadableStream} from 'react-server-dom-unbundled/server';
33
import {createFromReadableStream} from 'react-server-dom-webpack/client';
44
import {PassThrough, Readable} from 'stream';
55

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"build-for-devtools": "cross-env yarn build react/index,react/jsx,react/compiler-runtime,react-dom/index,react-dom/client,react-dom/unstable_testing,react-dom/test-utils,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh,react-art --type=NODE --release-channel=experimental",
127127
"build-for-devtools-dev": "yarn build-for-devtools --type=NODE_DEV",
128128
"build-for-devtools-prod": "yarn build-for-devtools --type=NODE_PROD",
129-
"build-for-flight-dev": "cross-env RELEASE_CHANNEL=experimental node ./scripts/rollup/build.js react/index,react/jsx,react.react-server,react-dom/index,react-dom/client,react-dom/server,react-dom.react-server,react-dom-server.node,react-dom-server-legacy.node,scheduler,react-server-dom-webpack/ --type=NODE_DEV,ESM_PROD,NODE_ES2015 && mv ./build/node_modules ./build/oss-experimental",
129+
"build-for-flight-dev": "cross-env RELEASE_CHANNEL=experimental node ./scripts/rollup/build.js react/index,react/jsx,react.react-server,react-dom/index,react-dom/client,react-dom/server,react-dom.react-server,react-dom-server.node,react-dom-server-legacy.node,scheduler,react-server-dom-webpack/,react-server-dom-unbundled/ --type=NODE_DEV,ESM_PROD,NODE_ES2015 && mv ./build/node_modules ./build/oss-experimental",
130130
"build-for-vt-dev": "cross-env RELEASE_CHANNEL=experimental node ./scripts/rollup/build.js react/index,react/jsx,react-dom/index,react-dom/client,react-dom/server,react-dom-server.node,react-dom-server-legacy.node,scheduler --type=NODE_DEV && mv ./build/node_modules ./build/oss-experimental",
131131
"flow-typed-install": "yarn flow-typed install --skip --skipFlowRestart --ignore-deps=dev",
132132
"linc": "node ./scripts/tasks/linc.js",

0 commit comments

Comments
 (0)