Skip to content

Commit

Permalink
[Flight] reorganize code for forked entrypoints
Browse files Browse the repository at this point in the history
This commit updates the file locations and bulid configurations for flight in preparation for new static entrypoints. This follows a structure similar to Fizz which has a unified build but exports methods from different top level entrypoints. This PR doesn't actually add the new top level entrypoints however, that will arrive in a later update.
  • Loading branch information
gnoff committed Aug 14, 2024
1 parent 2a54019 commit 986778e
Show file tree
Hide file tree
Showing 90 changed files with 526 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from 'react-client/src/ReactClientConsoleConfigBrowser';
export * from 'react-server-dom-esm/src/ReactFlightClientConfigBundlerESM';
export * from 'react-server-dom-esm/src/ReactFlightClientConfigTargetESMBrowser';
export * from 'react-server-dom-esm/src/client/ReactFlightClientConfigBundlerESM';
export * from 'react-server-dom-esm/src/client/ReactFlightClientConfigTargetESMBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = false;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from 'react-client/src/ReactClientConsoleConfigBrowser';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopack';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopackBrowser';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigTargetTurbopackBrowser';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopack';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopackBrowser';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigTargetTurbopackBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = false;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from 'react-client/src/ReactClientConsoleConfigBrowser';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigBundlerWebpack';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigBundlerWebpackBrowser';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigTargetWebpackBrowser';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpack';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackBrowser';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigTargetWebpackBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = false;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopack';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopackServer';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigTargetTurbopackServer';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopack';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopackServer';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigTargetTurbopackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigBundlerWebpack';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigBundlerWebpackServer';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigTargetWebpackServer';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpack';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackServer';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigTargetWebpackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

export * from 'react-client/src/ReactFlightClientStreamConfigNode';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-esm/src/ReactFlightClientConfigBundlerESM';
export * from 'react-server-dom-esm/src/ReactFlightClientConfigTargetESMServer';
export * from 'react-server-dom-esm/src/client/ReactFlightClientConfigBundlerESM';
export * from 'react-server-dom-esm/src/client/ReactFlightClientConfigTargetESMServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

export * from 'react-client/src/ReactFlightClientStreamConfigNode';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopack';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerTurbopackServer';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigTargetTurbopackServer';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopack';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopackServer';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigTargetTurbopackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

export * from 'react-client/src/ReactFlightClientStreamConfigNode';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigBundlerNode';
export * from 'react-server-dom-turbopack/src/ReactFlightClientConfigTargetTurbopackServer';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerNode';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigTargetTurbopackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

export * from 'react-client/src/ReactFlightClientStreamConfigNode';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigBundlerWebpack';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigBundlerWebpackServer';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigTargetWebpackServer';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpack';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackServer';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigTargetWebpackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

export * from 'react-client/src/ReactFlightClientStreamConfigNode';
export * from 'react-client/src/ReactClientConsoleConfigServer';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigBundlerNode';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigTargetWebpackServer';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerNode';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigTargetWebpackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
2 changes: 1 addition & 1 deletion packages/react-server-dom-esm/client.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from './src/ReactFlightDOMClientBrowser';
export * from './src/client/ReactFlightDOMClientBrowser';
2 changes: 1 addition & 1 deletion packages/react-server-dom-esm/client.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from './src/ReactFlightDOMClientNode';
export * from './src/client/ReactFlightDOMClientNode';
14 changes: 12 additions & 2 deletions packages/react-server-dom-esm/npm/server.node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
'use strict';

var s;
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-esm-server.node.production.js');
s = require('./cjs/react-server-dom-esm-server.node.production.js');
} else {
module.exports = require('./cjs/react-server-dom-esm-server.node.development.js');
s = require('./cjs/react-server-dom-esm-server.node.development.js');
}

exports.renderToPipeableStream = s.renderToPipeableStream;
exports.decodeReplyFromBusboy = s.decodeReplyFromBusboy;
exports.decodeReply = s.decodeReply;
exports.decodeAction = s.decodeAction;
exports.decodeFormState = s.decodeFormState;
exports.registerServerReference = s.registerServerReference;
exports.registerClientReference = s.registerClientReference;
exports.createTemporaryReferenceSet = s.createTemporaryReferenceSet;
11 changes: 10 additions & 1 deletion packages/react-server-dom-esm/server.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@
* @flow
*/

export * from './src/ReactFlightDOMServerNode';
export {
renderToPipeableStream,
decodeReplyFromBusboy,
decodeReply,
decodeAction,
decodeFormState,
registerServerReference,
registerClientReference,
createTemporaryReferenceSet,
} from './src/server/react-flight-dom-server.node';
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
export {
registerServerReference,
registerClientReference,
} from './ReactFlightESMReferences';
} from '../ReactFlightESMReferences';

import type {TemporaryReferenceSet} from 'react-server/src/ReactFlightServerTemporaryReferences';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
import type {
ClientReference,
ServerReference,
} from './ReactFlightESMReferences';
} from '../ReactFlightESMReferences';

export type {ClientReference, ServerReference};

Expand All @@ -27,7 +27,10 @@ export type ClientReferenceMetadata = [

export type ClientReferenceKey = string;

export {isClientReference, isServerReference} from './ReactFlightESMReferences';
export {
isClientReference,
isServerReference,
} from '../ReactFlightESMReferences';

export function getClientReferenceKey(
reference: ClientReference<any>,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export {
renderToPipeableStream,
decodeReplyFromBusboy,
decodeReply,
decodeAction,
decodeFormState,
registerServerReference,
registerClientReference,
createTemporaryReferenceSet,
} from './ReactFlightDOMServerNode';
2 changes: 1 addition & 1 deletion packages/react-server-dom-turbopack/client.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from './src/ReactFlightDOMClientBrowser';
export * from './src/client/ReactFlightDOMClientBrowser';
2 changes: 1 addition & 1 deletion packages/react-server-dom-turbopack/client.edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from './src/ReactFlightDOMClientEdge';
export * from './src/client/ReactFlightDOMClientEdge';
2 changes: 1 addition & 1 deletion packages/react-server-dom-turbopack/client.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from './src/ReactFlightDOMClientNode';
export * from './src/client/ReactFlightDOMClientNode';
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from './src/ReactFlightDOMClientNode';
export * from './src/client/ReactFlightDOMClientNode';
14 changes: 12 additions & 2 deletions packages/react-server-dom-turbopack/npm/server.browser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
'use strict';

var s;
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-turbopack-server.browser.production.js');
s = require('./cjs/react-server-dom-turbopack-server.browser.production.js');
} else {
module.exports = require('./cjs/react-server-dom-turbopack-server.browser.development.js');
s = require('./cjs/react-server-dom-turbopack-server.browser.development.js');
}

exports.renderToReadableStream = s.renderToReadableStream;
exports.decodeReply = s.decodeReply;
exports.decodeAction = s.decodeAction;
exports.decodeFormState = s.decodeFormState;
exports.registerServerReference = s.registerServerReference;
exports.registerClientReference = s.registerClientReference;
exports.createClientModuleProxy = s.createClientModuleProxy;
exports.createTemporaryReferenceSet = s.createTemporaryReferenceSet;
14 changes: 12 additions & 2 deletions packages/react-server-dom-turbopack/npm/server.edge.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
'use strict';

var s;
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-turbopack-server.edge.production.js');
s = require('./cjs/react-server-dom-turbopack-server.edge.production.js');
} else {
module.exports = require('./cjs/react-server-dom-turbopack-server.edge.development.js');
s = require('./cjs/react-server-dom-turbopack-server.edge.development.js');
}

exports.renderToReadableStream = s.renderToReadableStream;
exports.decodeReply = s.decodeReply;
exports.decodeAction = s.decodeAction;
exports.decodeFormState = s.decodeFormState;
exports.registerServerReference = s.registerServerReference;
exports.registerClientReference = s.registerClientReference;
exports.createClientModuleProxy = s.createClientModuleProxy;
exports.createTemporaryReferenceSet = s.createTemporaryReferenceSet;
15 changes: 13 additions & 2 deletions packages/react-server-dom-turbopack/npm/server.node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
'use strict';

var s;
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-turbopack-server.node.production.js');
s = require('./cjs/react-server-dom-turbopack-server.node.production.js');
} else {
module.exports = require('./cjs/react-server-dom-turbopack-server.node.development.js');
s = require('./cjs/react-server-dom-turbopack-server.node.development.js');
}

exports.renderToPipeableStream = s.renderToPipeableStream;
exports.decodeReplyFromBusboy = s.decodeReplyFromBusboy;
exports.decodeReply = s.decodeReply;
exports.decodeAction = s.decodeAction;
exports.decodeFormState = s.decodeFormState;
exports.registerServerReference = s.registerServerReference;
exports.registerClientReference = s.registerClientReference;
exports.createClientModuleProxy = s.createClientModuleProxy;
exports.createTemporaryReferenceSet = s.createTemporaryReferenceSet;
15 changes: 13 additions & 2 deletions packages/react-server-dom-turbopack/npm/server.node.unbundled.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
'use strict';

var s;
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-turbopack-server.node.unbundled.production.js');
s = require('./cjs/react-server-dom-turbopack-server.node.unbundled.production.js');
} else {
module.exports = require('./cjs/react-server-dom-turbopack-server.node.unbundled.development.js');
s = require('./cjs/react-server-dom-turbopack-server.node.unbundled.development.js');
}

exports.renderToPipeableStream = s.renderToPipeableStream;
exports.decodeReplyFromBusboy = s.decodeReplyFromBusboy;
exports.decodeReply = s.decodeReply;
exports.decodeAction = s.decodeAction;
exports.decodeFormState = s.decodeFormState;
exports.registerServerReference = s.registerServerReference;
exports.registerClientReference = s.registerClientReference;
exports.createClientModuleProxy = s.createClientModuleProxy;
exports.createTemporaryReferenceSet = s.createTemporaryReferenceSet;
11 changes: 10 additions & 1 deletion packages/react-server-dom-turbopack/server.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@
* @flow
*/

export * from './src/ReactFlightDOMServerBrowser';
export {
renderToReadableStream,
decodeReply,
decodeAction,
decodeFormState,
registerServerReference,
registerClientReference,
createClientModuleProxy,
createTemporaryReferenceSet,
} from './src/server/react-flight-dom-server.browser';
11 changes: 10 additions & 1 deletion packages/react-server-dom-turbopack/server.edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@
* @flow
*/

export * from './src/ReactFlightDOMServerEdge';
export {
renderToReadableStream,
decodeReply,
decodeAction,
decodeFormState,
registerServerReference,
registerClientReference,
createClientModuleProxy,
createTemporaryReferenceSet,
} from './src/server/react-flight-dom-server.edge';
12 changes: 11 additions & 1 deletion packages/react-server-dom-turbopack/server.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@
* @flow
*/

export * from './src/ReactFlightDOMServerNode';
export {
renderToPipeableStream,
decodeReplyFromBusboy,
decodeReply,
decodeAction,
decodeFormState,
registerServerReference,
registerClientReference,
createClientModuleProxy,
createTemporaryReferenceSet,
} from './src/server/react-flight-dom-server.node';
12 changes: 11 additions & 1 deletion packages/react-server-dom-turbopack/server.node.unbundled.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@
* @flow
*/

export * from './src/ReactFlightDOMServerNode';
export {
renderToPipeableStream,
decodeReplyFromBusboy,
decodeReply,
decodeAction,
decodeFormState,
registerServerReference,
registerClientReference,
createClientModuleProxy,
createTemporaryReferenceSet,
} from './src/server/react-flight-dom-server.node.unbundled';
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import type {
RejectedThenable,
} from 'shared/ReactTypes';

import type {ImportMetadata} from './shared/ReactFlightImportMetadata';
import type {ImportMetadata} from '../shared/ReactFlightImportMetadata';
import type {ModuleLoading} from 'react-client/src/ReactFlightClientConfig';

import {
ID,
CHUNKS,
NAME,
isAsyncImport,
} from './shared/ReactFlightImportMetadata';
} from '../shared/ReactFlightImportMetadata';
import {prepareDestinationWithChunks} from 'react-client/src/ReactFlightClientConfig';

export type SSRModuleMap = {
Expand Down
Loading

0 comments on commit 986778e

Please sign in to comment.