Remove ReactFlightFB bundles (#28864)
Remove ReactFlightFB bundles
Jan Kassens committed
Apr 18, 2024 at 16:41 UTC
1cd77a4ff7a2189003965246a3cfc475d2d9857d
12 files changed
+2
-878
packages/react-client/src/forks/ReactFlightClientConfig.dom-fb-experimental.js
deleted
-15
@@ -1,15 +0,0 @@
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 'react-client/src/ReactFlightClientStreamConfigWeb';
11
-export * from 'react-client/src/ReactFlightClientConsoleConfigPlain';
12
-export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
13
-export * from 'react-server-dom-fb/src/ReactFlightClientConfigFBBundler';
14
-
15
-export const usedWithSSR = false;
packages/react-server-dom-fb/src/ReactFlightClientConfigFBBundler.js
deleted
-112
@@ -1,112 +0,0 @@
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
-import type {
11
- Thenable,
12
- FulfilledThenable,
13
- RejectedThenable,
14
-} from 'shared/ReactTypes';
15
-
16
-export type ModuleLoading = mixed;
17
-
18
-type ResolveClientReferenceFn<T> =
19
- ClientReferenceMetadata => ClientReference<T>;
20
-
21
-export type SSRModuleMap = {
22
- resolveClientReference?: ResolveClientReferenceFn<any>,
23
-};
24
-export type ServerManifest = string;
25
-export type {
26
- ClientManifest,
27
- ServerReferenceId,
28
- ClientReferenceMetadata,
29
-} from './ReactFlightReferencesFB';
30
-
31
-import type {
32
- ServerReferenceId,
33
- ClientReferenceMetadata,
34
-} from './ReactFlightReferencesFB';
35
-
36
-export type ClientReference<T> = {
37
- getModuleId: () => string,
38
- load: () => Thenable<T>,
39
-};
40
-
41
-export function prepareDestinationForModule(
42
- moduleLoading: ModuleLoading,
43
- nonce: ?string,
44
- metadata: ClientReferenceMetadata,
45
-) {
46
- return;
47
-}
48
-
49
-export function resolveClientReference<T>(
50
- moduleMap: SSRModuleMap,
51
- metadata: ClientReferenceMetadata,
52
-): ClientReference<T> {
53
- if (typeof moduleMap.resolveClientReference === 'function') {
54
- return moduleMap.resolveClientReference(metadata);
55
- } else {
56
- throw new Error(
57
- 'Expected `resolveClientReference` to be defined on the moduleMap.',
58
- );
59
- }
60
-}
61
-
62
-export function resolveServerReference<T>(
63
- config: ServerManifest,
64
- id: ServerReferenceId,
65
-): ClientReference<T> {
66
- throw new Error('Not implemented');
67
-}
68
-
69
-const asyncModuleCache: Map<string, Thenable<any>> = new Map();
70
-
71
-export function preloadModule<T>(
72
- clientReference: ClientReference<T>,
73
-): null | Thenable<any> {
74
- const existingPromise = asyncModuleCache.get(clientReference.getModuleId());
75
- if (existingPromise) {
76
- if (existingPromise.status === 'fulfilled') {
77
- return null;
78
- }
79
- return existingPromise;
80
- } else {
81
- const modulePromise: Thenable<T> = clientReference.load();
82
- modulePromise.then(
83
- value => {
84
- const fulfilledThenable: FulfilledThenable<mixed> =
85
- (modulePromise: any);
86
- fulfilledThenable.status = 'fulfilled';
87
- fulfilledThenable.value = value;
88
- },
89
- reason => {
90
- const rejectedThenable: RejectedThenable<mixed> = (modulePromise: any);
91
- rejectedThenable.status = 'rejected';
92
- rejectedThenable.reason = reason;
93
- },
94
- );
95
- asyncModuleCache.set(clientReference.getModuleId(), modulePromise);
96
- return modulePromise;
97
- }
98
-}
99
-
100
-export function requireModule<T>(clientReference: ClientReference<T>): T {
101
- let module;
102
- // We assume that preloadModule has been called before, which
103
- // should have added something to the module cache.
104
- const promise: any = asyncModuleCache.get(clientReference.getModuleId());
105
- if (promise.status === 'fulfilled') {
106
- module = promise.value;
107
- } else {
108
- throw promise.reason;
109
- }
110
- // We are currently only support default exports for client components
111
- return module;
112
-}
packages/react-server-dom-fb/src/ReactFlightDOMClientFB.js
deleted
-91
@@ -1,91 +0,0 @@
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
-import {enableBinaryFlight} from 'shared/ReactFeatureFlags';
11
-import type {Thenable} from 'shared/ReactTypes';
12
-import type {Response as FlightResponse} from 'react-client/src/ReactFlightClient';
13
-
14
-import {
15
- createResponse,
16
- getRoot,
17
- reportGlobalError,
18
- processBinaryChunk,
19
- close,
20
-} from 'react-client/src/ReactFlightClient';
21
-
22
-import type {SSRModuleMap} from './ReactFlightClientConfigFBBundler';
23
-
24
-type Options = {
25
- moduleMap: SSRModuleMap,
26
-};
27
-
28
-function createResponseFromOptions(options: void | Options) {
29
- const moduleMap = options && options.moduleMap;
30
- if (moduleMap == null) {
31
- throw new Error('Expected `moduleMap` to be defined.');
32
- }
33
-
34
- return createResponse(moduleMap, null, undefined, undefined);
35
-}
36
-
37
-function processChunk(response: FlightResponse, chunk: string | Uint8Array) {
38
- if (enableBinaryFlight) {
39
- if (typeof chunk === 'string') {
40
- throw new Error(
41
- '`enableBinaryFlight` flag is enabled, expected a Uint8Array as input, got string.',
42
- );
43
- }
44
- }
45
- const buffer = typeof chunk !== 'string' ? chunk : encodeString(chunk);
46
-
47
- processBinaryChunk(response, buffer);
48
-}
49
-
50
-function encodeString(string: string) {
51
- const textEncoder = new TextEncoder();
52
- return textEncoder.encode(string);
53
-}
54
-
55
-function startReadingFromStream(
56
- response: FlightResponse,
57
- stream: ReadableStream,
58
-): void {
59
- const reader = stream.getReader();
60
- function progress({
61
- done,
62
- value,
63
- }: {
64
- done: boolean,
65
- value: ?any,
66
- ...
67
- }): void | Promise<void> {
68
- if (done) {
69
- close(response);
70
- return;
71
- }
72
- const buffer: Uint8Array = (value: any);
73
- processChunk(response, buffer);
74
- return reader.read().then(progress).catch(error);
75
- }
76
- function error(e: any) {
77
- reportGlobalError(response, e);
78
- }
79
- reader.read().then(progress).catch(error);
80
-}
81
-
82
-function createFromReadableStream<T>(
83
- stream: ReadableStream,
84
- options?: Options,
85
-): Thenable<T> {
86
- const response: FlightResponse = createResponseFromOptions(options);
87
- startReadingFromStream(response, stream);
88
- return getRoot(response);
89
-}
90
-
91
-export {createFromReadableStream};
packages/react-server-dom-fb/src/ReactFlightDOMServerFB.js
deleted
-73
@@ -1,73 +0,0 @@
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
-import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
11
-import type {
12
- Destination,
13
- Chunk,
14
- PrecomputedChunk,
15
-} from 'react-server/src/ReactServerStreamConfig';
16
-
17
-import {setCheckIsClientReference} from './ReactFlightReferencesFB';
18
-
19
-import {
20
- createRequest,
21
- startWork,
22
- startFlowing,
23
-} from 'react-server/src/ReactFlightServer';
24
-
25
-import {setByteLengthOfChunkImplementation} from 'react-server/src/ReactServerStreamConfig';
26
-
27
-export {
28
- registerClientReference,
29
- registerServerReference,
30
- getRequestedClientReferencesKeys,
31
- clearRequestedClientReferencesKeysSet,
32
- setCheckIsClientReference,
33
-} from './ReactFlightReferencesFB';
34
-
35
-type Options = {
36
- onError?: (error: mixed) => void,
37
-};
38
-
39
-function renderToDestination(
40
- destination: Destination,
41
- model: ReactClientValue,
42
- options?: Options,
43
-): void {
44
- if (!configured) {
45
- throw new Error(
46
- 'Please make sure to call `setConfig(...)` before calling `renderToDestination`.',
47
- );
48
- }
49
- const request = createRequest(
50
- model,
51
- null,
52
- options ? options.onError : undefined,
53
- undefined,
54
- undefined,
55
- );
56
- startWork(request);
57
- startFlowing(request, destination);
58
-}
59
-
60
-type Config = {
61
- byteLength: (chunk: Chunk | PrecomputedChunk) => number,
62
- isClientReference: (reference: mixed) => boolean,
63
-};
64
-
65
-let configured = false;
66
-
67
-function setConfig(config: Config): void {
68
- setByteLengthOfChunkImplementation(config.byteLength);
69
- setCheckIsClientReference(config.isClientReference);
70
- configured = true;
71
-}
72
-
73
-export {renderToDestination, setConfig};
packages/react-server-dom-fb/src/ReactFlightReferencesFB.js
deleted
-90
@@ -1,90 +0,0 @@
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 type ClientManifest = null;
11
-
12
-// eslint-disable-next-line no-unused-vars
13
-export type ServerReference<T> = string;
14
-
15
-// eslint-disable-next-line no-unused-vars
16
-export type ClientReference<T> = {
17
- getModuleId(): ClientReferenceKey,
18
-};
19
-
20
-const requestedClientReferencesKeys = new Set<ClientReferenceKey>();
21
-
22
-export type ClientReferenceKey = string;
23
-export type ClientReferenceMetadata = {
24
- moduleId: ClientReferenceKey,
25
- exportName: string,
26
-};
27
-
28
-export type ServerReferenceId = string;
29
-
30
-let checkIsClientReference: (clientReference: mixed) => boolean;
31
-
32
-export function setCheckIsClientReference(
33
- impl: (clientReference: mixed) => boolean,
34
-): void {
35
- checkIsClientReference = impl;
36
-}
37
-
38
-export function registerClientReference<T>(
39
- clientReference: ClientReference<T>,
40
-): void {}
41
-
42
-export function isClientReference(reference: mixed): boolean {
43
- if (checkIsClientReference == null) {
44
- throw new Error('Expected implementation for checkIsClientReference.');
45
- }
46
- return checkIsClientReference(reference);
47
-}
48
-
49
-export function getClientReferenceKey<T>(
50
- clientReference: ClientReference<T>,
51
-): ClientReferenceKey {
52
- const moduleId = clientReference.getModuleId();
53
- requestedClientReferencesKeys.add(moduleId);
54
-
55
- return clientReference.getModuleId();
56
-}
57
-
58
-export function resolveClientReferenceMetadata<T>(
59
- config: ClientManifest,
60
- clientReference: ClientReference<T>,
61
-): ClientReferenceMetadata {
62
- return {moduleId: clientReference.getModuleId(), exportName: 'default'};
63
-}
64
-
65
-export function registerServerReference<T>(
66
- serverReference: ServerReference<T>,
67
- id: string,
68
- exportName: null | string,
69
-): ServerReference<T> {
70
- throw new Error('registerServerReference: Not Implemented.');
71
-}
72
-
73
-export function isServerReference<T>(reference: T): boolean {
74
- throw new Error('isServerReference: Not Implemented.');
75
-}
76
-
77
-export function getServerReferenceId<T>(
78
- config: ClientManifest,
79
- serverReference: ServerReference<T>,
80
-): ServerReferenceId {
81
- throw new Error('getServerReferenceId: Not Implemented.');
82
-}
83
-
84
-export function getRequestedClientReferencesKeys(): $ReadOnlyArray<ClientReferenceKey> {
85
- return Array.from(requestedClientReferencesKeys);
86
-}
87
-
88
-export function clearRequestedClientReferencesKeysSet(): void {
89
- requestedClientReferencesKeys.clear();
90
-}
packages/react-server-dom-fb/src/ReactFlightServerConfigFBBundler.js
deleted
-36
@@ -1,36 +0,0 @@
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
-import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
11
-
12
-import type {ClientManifest, ServerReference} from './ReactFlightReferencesFB';
13
-
14
-export type {
15
- ClientManifest,
16
- ClientReference,
17
- ClientReferenceKey,
18
- ClientReferenceMetadata,
19
- ServerReference,
20
- ServerReferenceId,
21
-} from './ReactFlightReferencesFB';
22
-
23
-export {
24
- getClientReferenceKey,
25
- isClientReference,
26
- resolveClientReferenceMetadata,
27
- isServerReference,
28
- getServerReferenceId,
29
-} from './ReactFlightReferencesFB';
30
-
31
-export function getServerReferenceBoundArguments<T>(
32
- config: ClientManifest,
33
- serverReference: ServerReference<T>,
34
-): null | Array<ReactClientValue> {
35
- throw new Error('getServerReferenceBoundArguments: Not Implemented.');
36
-}
packages/react-server-dom-fb/src/__tests__/ReactFlightDOMServerFB-test.internal.js
deleted
-371
@@ -1,371 +0,0 @@
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
- * @emails react-core
8
- */
9
-
10
-'use strict';
11
-
12
-// Polyfills for test environment
13
-global.ReadableStream =
14
- require('web-streams-polyfill/ponyfill/es6').ReadableStream;
15
-global.TextEncoder = require('util').TextEncoder;
16
-global.TextDecoder = require('util').TextDecoder;
17
-
18
-// Don't wait before processing work on the server.
19
-// TODO: we can replace this with FlightServer.act().
20
-global.setImmediate = cb => cb();
21
-
22
-let act;
23
-let use;
24
-let clientExports;
25
-let moduleMap;
26
-let React;
27
-let ReactDOMClient;
28
-let ReactServerDOMServer;
29
-let ReactServerDOMClient;
30
-let Suspense;
31
-
32
-class Destination {
33
- #buffer = '';
34
- #controller = null;
35
- constructor() {
36
- const self = this;
37
- this.stream = new ReadableStream({
38
- start(controller) {
39
- self.#controller = controller;
40
- },
41
- });
42
- }
43
- write(chunk) {
44
- this.#buffer += chunk;
45
- }
46
- beginWriting() {}
47
- completeWriting() {}
48
- flushBuffered() {
49
- if (!this.#controller) {
50
- throw new Error('Expected a controller.');
51
- }
52
- this.#controller.enqueue(this.#buffer);
53
- this.#buffer = '';
54
- }
55
- close() {}
56
- onError() {}
57
-}
58
-
59
-class ClientReferenceImpl {
60
- constructor(moduleId) {
61
- this.moduleId = moduleId;
62
- }
63
-
64
- getModuleId() {
65
- return this.moduleId;
66
- }
67
-}
68
-
69
-describe('ReactFlightDOM for FB', () => {
70
- beforeEach(() => {
71
- // For this first reset we are going to load the dom-node version of react-server-dom-turbopack/server
72
- // This can be thought of as essentially being the React Server Components scope with react-server
73
- // condition
74
- jest.resetModules();
75
-
76
- jest.mock('react', () => require('react/src/ReactServerFB'));
77
-
78
- jest.mock('shared/ReactFeatureFlags', () => {
79
- jest.mock(
80
- 'ReactFeatureFlags',
81
- () => jest.requireActual('shared/forks/ReactFeatureFlags.www-dynamic'),
82
- {virtual: true},
83
- );
84
- return jest.requireActual('shared/forks/ReactFeatureFlags.www');
85
- });
86
-
87
- clientExports = value => {
88
- return new ClientReferenceImpl(value.name);
89
- };
90
-
91
- moduleMap = {
92
- resolveClientReference(metadata) {
93
- throw new Error('Do not expect to load client components.');
94
- },
95
- };
96
-
97
- ReactServerDOMServer = require('../ReactFlightDOMServerFB');
98
- ReactServerDOMServer.setConfig({
99
- byteLength: str => Buffer.byteLength(str),
100
- isClientReference: reference => reference instanceof ClientReferenceImpl,
101
- });
102
-
103
- // This reset is to load modules for the SSR/Browser scope.
104
- jest.resetModules();
105
- __unmockReact();
106
- act = require('internal-test-utils').act;
107
- React = require('react');
108
- use = React.use;
109
- Suspense = React.Suspense;
110
- ReactDOMClient = require('react-dom/client');
111
- ReactServerDOMClient = require('../ReactFlightDOMClientFB');
112
- });
113
-
114
- it('should resolve HTML with renderToDestination', async () => {
115
- function Text({children}) {
116
- return <span>{children}</span>;
117
- }
118
- function HTML() {
119
- return (
120
- <div>
121
- <Text>hello</Text>
122
- <Text>world</Text>
123
- </div>
124
- );
125
- }
126
-
127
- function App() {
128
- const model = {
129
- html: <HTML />,
130
- };
131
- return model;
132
- }
133
- const destination = new Destination();
134
- ReactServerDOMServer.renderToDestination(destination, <App />);
135
- const response = ReactServerDOMClient.createFromReadableStream(
136
- destination.stream,
137
- {
138
- moduleMap,
139
- },
140
- );
141
- const model = await response;
142
- expect(model).toEqual({
143
- html: (
144
- <div>
145
- <span>hello</span>
146
- <span>world</span>
147
- </div>
148
- ),
149
- });
150
- });
151
-
152
- it('should resolve the root', async () => {
153
- // Model
154
- function Text({children}) {
155
- return <span>{children}</span>;
156
- }
157
- function HTML() {
158
- return (
159
- <div>
160
- <Text>hello</Text>
161
- <Text>world</Text>
162
- </div>
163
- );
164
- }
165
- function RootModel() {
166
- return {
167
- html: <HTML />,
168
- };
169
- }
170
-
171
- // View
172
- function Message({response}) {
173
- return <section>{use(response).html}</section>;
174
- }
175
- function App({response}) {
176
- return (
177
- <Suspense fallback={<h1>Loading...</h1>}>
178
- <Message response={response} />
179
- </Suspense>
180
- );
181
- }
182
-
183
- const destination = new Destination();
184
- ReactServerDOMServer.renderToDestination(destination, <RootModel />);
185
- const response = ReactServerDOMClient.createFromReadableStream(
186
- destination.stream,
187
- {
188
- moduleMap,
189
- },
190
- );
191
-
192
- const container = document.createElement('div');
193
- const root = ReactDOMClient.createRoot(container);
194
- await act(() => {
195
- root.render(<App response={response} />);
196
- });
197
- expect(container.innerHTML).toBe(
198
- '<section><div><span>hello</span><span>world</span></div></section>',
199
- );
200
- });
201
-
202
- it('should not get confused by $', async () => {
203
- // Model
204
- function RootModel() {
205
- return {text: '$1'};
206
- }
207
-
208
- // View
209
- function Message({response}) {
210
- return <p>{use(response).text}</p>;
211
- }
212
- function App({response}) {
213
- return (
214
- <Suspense fallback={<h1>Loading...</h1>}>
215
- <Message response={response} />
216
- </Suspense>
217
- );
218
- }
219
- const destination = new Destination();
220
- ReactServerDOMServer.renderToDestination(destination, <RootModel />);
221
- const response = ReactServerDOMClient.createFromReadableStream(
222
- destination.stream,
223
- {
224
- moduleMap,
225
- },
226
- );
227
-
228
- const container = document.createElement('div');
229
- const root = ReactDOMClient.createRoot(container);
230
- await act(() => {
231
- root.render(<App response={response} />);
232
- });
233
- expect(container.innerHTML).toBe('<p>$1</p>');
234
- });
235
-
236
- it('should not get confused by @', async () => {
237
- // Model
238
- function RootModel() {
239
- return {text: '@div'};
240
- }
241
-
242
- // View
243
- function Message({response}) {
244
- return <p>{use(response).text}</p>;
245
- }
246
- function App({response}) {
247
- return (
248
- <Suspense fallback={<h1>Loading...</h1>}>
249
- <Message response={response} />
250
- </Suspense>
251
- );
252
- }
253
- const destination = new Destination();
254
- ReactServerDOMServer.renderToDestination(destination, <RootModel />);
255
- const response = ReactServerDOMClient.createFromReadableStream(
256
- destination.stream,
257
- {
258
- moduleMap,
259
- },
260
- );
261
-
262
- const container = document.createElement('div');
263
- const root = ReactDOMClient.createRoot(container);
264
- await act(() => {
265
- root.render(<App response={response} />);
266
- });
267
- expect(container.innerHTML).toBe('<p>@div</p>');
268
- });
269
-
270
- it('should be able to render a client component', async () => {
271
- const Component = function ({greeting}) {
272
- return greeting + ' World';
273
- };
274
-
275
- function Print({response}) {
276
- return <p>{use(response)}</p>;
277
- }
278
-
279
- function App({response}) {
280
- return (
281
- <Suspense fallback={<h1>Loading...</h1>}>
282
- <Print response={response} />
283
- </Suspense>
284
- );
285
- }
286
-
287
- const ClientComponent = clientExports(Component);
288
-
289
- const destination = new Destination();
290
- ReactServerDOMServer.renderToDestination(
291
- destination,
292
- <ClientComponent greeting={'Hello'} />,
293
- moduleMap,
294
- );
295
- const response = ReactServerDOMClient.createFromReadableStream(
296
- destination.stream,
297
- {
298
- moduleMap: {
299
- resolveClientReference(metadata) {
300
- return {
301
- getModuleId() {
302
- return metadata.moduleId;
303
- },
304
- load() {
305
- return Promise.resolve(Component);
306
- },
307
- };
308
- },
309
- },
310
- },
311
- );
312
-
313
- const container = document.createElement('div');
314
- const root = ReactDOMClient.createRoot(container);
315
- await act(() => {
316
- root.render(<App response={response} />);
317
- });
318
- expect(container.innerHTML).toBe('<p>Hello World</p>');
319
- });
320
-
321
- it('should render long strings', async () => {
322
- // Model
323
- const longString = 'Lorem Ipsum ❤️ '.repeat(100);
324
-
325
- function RootModel() {
326
- return {text: longString};
327
- }
328
-
329
- // View
330
- function Message({response}) {
331
- return <p>{use(response).text}</p>;
332
- }
333
- function App({response}) {
334
- return (
335
- <Suspense fallback={<h1>Loading...</h1>}>
336
- <Message response={response} />
337
- </Suspense>
338
- );
339
- }
340
- const destination = new Destination();
341
- ReactServerDOMServer.renderToDestination(destination, <RootModel />);
342
- const response = ReactServerDOMClient.createFromReadableStream(
343
- destination.stream,
344
- {
345
- moduleMap,
346
- },
347
- );
348
-
349
- const container = document.createElement('div');
350
- const root = ReactDOMClient.createRoot(container);
351
- await act(() => {
352
- root.render(<App response={response} />);
353
- });
354
- expect(container.innerHTML).toBe('<p>' + longString + '</p>');
355
- });
356
-
357
- // TODO: `registerClientComponent` need to be able to support this
358
- it.skip('throws when accessing a member below the client exports', () => {
359
- const ClientModule = clientExports({
360
- Component: {deep: 'thing'},
361
- });
362
- function dotting() {
363
- return ClientModule.Component.deep;
364
- }
365
- expect(dotting).toThrowError(
366
- 'Cannot access Component.deep on the server. ' +
367
- 'You cannot dot into a client module from a server component. ' +
368
- 'You can only pass the imported name through.',
369
- );
370
- });
371
-});
packages/react-server/src/forks/ReactFlightServerConfig.dom-fb-experimental.js
deleted
-18
@@ -1,18 +0,0 @@
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
-import type {Request} from 'react-server/src/ReactFlightServer';
11
-
12
-export * from 'react-server-dom-fb/src/ReactFlightServerConfigFBBundler';
13
-export * from 'react-dom-bindings/src/server/ReactFlightServerConfigDOM';
14
-
15
-export const supportsRequestStorage = false;
16
-export const requestStorage: AsyncLocalStorage<Request | void> = (null: any);
17
-
18
-export * from '../ReactFlightServerConfigDebugNoop';
packages/react/src/ReactServerFB.js
deleted
-11
@@ -1,11 +0,0 @@
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 './ReactServer';
11
-export {jsx, jsxs, jsxDEV} from './jsx/ReactJSX';
scripts/rollup/bundles.js
-35
@@ -96,18 +96,6 @@ const bundles = [
96
externals: [],
97
},
98
99
- /******* Isomorphic Shared Subset for FB *******/
100
- {
101
- bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [],
102
- moduleType: ISOMORPHIC,
103
- entry: 'react/src/ReactServerFB.js',
104
- condition: 'react-server',
105
- global: 'ReactServer',
106
- minifyWithProdErrorCodes: true,
107
- wrapWithModuleBoundaries: false,
108
- externals: [],
109
- },
110
-
99
/******* React JSX Runtime *******/
100
{
101
bundleTypes: [
@@ -596,29 +584,6 @@ const bundles = [
584
externals: ['acorn'],
585
},
586
599
- /******* React Server DOM FB Server *******/
600
- {
601
- bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [],
602
- moduleType: RENDERER,
603
- entry: 'react-server-dom-fb/src/ReactFlightDOMServerFB.js',
604
- condition: 'react-server',
605
- global: 'ReactFlightDOMServer',
606
- minifyWithProdErrorCodes: false,
607
- wrapWithModuleBoundaries: false,
608
- externals: ['react', 'react-dom'],
609
- },
610
-
611
- /******* React Server DOM FB Client *******/
612
- {
613
- bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [],
614
- moduleType: RENDERER,
615
- entry: 'react-server-dom-fb/src/ReactFlightDOMClientFB.js',
616
- global: 'ReactFlightDOMClient',
617
- minifyWithProdErrorCodes: false,
618
- wrapWithModuleBoundaries: false,
619
- externals: ['react', 'react-dom'],
620
- },
621
-
587
/******* React Suspense Test Utils *******/
588
{
589
bundleTypes: [NODE_ES2015],
scripts/rollup/forks.js
+1
-4
@@ -62,10 +62,7 @@ const forks = Object.freeze({
62
if (entry === 'react') {
63
return './packages/react/src/ReactSharedInternalsClient.js';
64
}
65
- if (
66
- entry === 'react/src/ReactServer.js' ||
67
- entry === 'react/src/ReactServerFB.js'
68
- ) {
65
+ if (entry === 'react/src/ReactServer.js') {
66
return './packages/react/src/ReactSharedInternalsServer.js';
67
}
68
if (bundle.condition === 'react-server') {
scripts/shared/inlinedHostConfigs.js
+1
-22
@@ -405,34 +405,13 @@ module.exports = [
405
'react-dom',
406
'react-dom/src/ReactDOMServer.js',
407
'react-dom-bindings',
408
- 'react-server-dom-fb/src/ReactDOMServerFB.js',
408
+ 'react-server-dom-fb',
409
'shared/ReactDOMSharedInternals',
410
],
411
isFlowTyped: true,
412
isServerSupported: true,
413
isFlightSupported: false,
414
},
415
- {
416
- shortName: 'dom-fb-experimental',
417
- entryPoints: [
418
- 'react-server-dom-fb/src/ReactFlightDOMClientFB.js',
419
- 'react-server-dom-fb/src/ReactFlightDOMServerFB.js',
420
- ],
421
- paths: [
422
- 'react-dom',
423
- 'react-dom-bindings',
424
- 'react-server-dom-fb/src/ReactFlightClientConfigFBBundler.js',
425
- 'react-server-dom-fb/src/ReactFlightClientConfigFBBundler.js',
426
- 'react-server-dom-fb/src/ReactFlightReferencesFB.js',
427
- 'react-server-dom-fb/src/ReactFlightServerConfigFBBundler.js',
428
- 'react-server-dom-fb/src/ReactFlightDOMClientFB.js',
429
- 'react-server-dom-fb/src/ReactFlightDOMServerFB.js',
430
- 'shared/ReactDOMSharedInternals',
431
- ],
432
- isFlowTyped: true,
433
- isServerSupported: true,
434
- isFlightSupported: true,
435
- },
415
{
416
shortName: 'native',
417
entryPoints: ['react-native-renderer'],