Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* 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 {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-webpack';

export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from 'react-client/src/ReactClientConsoleConfigServer';
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;
25 changes: 23 additions & 2 deletions packages/react-server-dom-webpack/npm/client.node.unbundled.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
'use strict';

var n, w;
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-webpack-client.node.unbundled.production.js');
n = require('./cjs/react-server-dom-webpack-client.node.unbundled.production.js');
w = require('./cjs/react-server-dom-webpack-client.node-webstreams.unbundled.production.js');
} else {
module.exports = require('./cjs/react-server-dom-webpack-client.node.unbundled.development.js');
n = require('./cjs/react-server-dom-webpack-client.node.unbundled.development.js');
w = require('./cjs/react-server-dom-webpack-client.node-webstreams.unbundled.development.js');
}

exports.registerServerReference = function (r, i, e) {
return w.registerServerReference(n.registerServerReference(r, i, e), i, e);
};
exports.createServerReference = function (i, c, e, d, f) {
return w.registerServerReference(
n.createServerReference(i, c, e, d, f),
i,
e
);
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ones are stateful registers so we need to register with both bundles since each has its own map.


exports.createFromNodeStream = n.createFromNodeStream;
exports.createFromFetch = w.createFromFetch;
exports.createFromReadableStream = w.createFromReadableStream;

exports.createTemporaryReferenceSet = w.createTemporaryReferenceSet;
exports.encodeReply = w.encodeReply;
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict';

var s;
var s, w;
if (process.env.NODE_ENV === 'production') {
s = require('./cjs/react-server-dom-webpack-server.node.unbundled.production.js');
w = require('./cjs/react-server-dom-webpack-server.node-webstreams.unbundled.production.js');
} else {
s = require('./cjs/react-server-dom-webpack-server.node.unbundled.development.js');
w = require('./cjs/react-server-dom-webpack-server.node-webstreams.unbundled.development.js');
}

exports.renderToPipeableStream = s.renderToPipeableStream;
Expand All @@ -16,3 +18,6 @@ exports.registerServerReference = s.registerServerReference;
exports.registerClientReference = s.registerClientReference;
exports.createClientModuleProxy = s.createClientModuleProxy;
exports.createTemporaryReferenceSet = s.createTemporaryReferenceSet;

exports.renderToReadableStream = w.renderToReadableStream;
exports.decodeReplyFromAsyncIterable = w.decodeReplyFromAsyncIterable;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* 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 * from './ReactFlightDOMClientBrowser';
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* 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 * from './ReactFlightDOMClientEdge';
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* 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 * from './ReactFlightDOMClientEdge';
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* 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 * from './ReactFlightDOMClientNode';
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* 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 * from './ReactFlightDOMClientNode';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* 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 {
renderToReadableStream,
prerender as unstable_prerender,
decodeReply,
decodeReplyFromAsyncIterable,
decodeAction,
decodeFormState,
registerServerReference,
registerClientReference,
createClientModuleProxy,
createTemporaryReferenceSet,
} from './ReactFlightDOMServerEdge';
37 changes: 33 additions & 4 deletions scripts/rollup/bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,18 @@ const bundles = [
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
},
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: RENDERER,
entry:
'react-server-dom-webpack/src/server/react-flight-dom-server.node-webstreams.unbundled',
name: 'react-server-dom-webpack-server.node-webstreams.unbundled',
condition: 'react-server',
global: 'ReactServerDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
},
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: RENDERER,
Expand All @@ -500,7 +512,9 @@ const bundles = [
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: RENDERER,
entry: 'react-server-dom-webpack/client.browser',
entry:
'react-server-dom-webpack/src/client/react-flight-dom-client.browser',
name: 'react-server-dom-webpack-client.browser',
global: 'ReactServerDOMClient',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
Expand All @@ -509,7 +523,8 @@ const bundles = [
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: RENDERER,
entry: 'react-server-dom-webpack/client.node',
entry: 'react-server-dom-webpack/src/client/react-flight-dom-client.node',
name: 'react-server-dom-webpack-client.node',
global: 'ReactServerDOMClient',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
Expand All @@ -518,7 +533,20 @@ const bundles = [
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: RENDERER,
entry: 'react-server-dom-webpack/client.node.unbundled',
entry:
'react-server-dom-webpack/src/client/react-flight-dom-client.node.unbundled',
name: 'react-server-dom-webpack-client.node.unbundled',
global: 'ReactServerDOMClient',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'react-dom', 'util', 'crypto'],
},
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: RENDERER,
entry:
'react-server-dom-webpack/src/client/react-flight-dom-client.node-webstreams.unbundled',
name: 'react-server-dom-webpack-client.node-webstreams.unbundled',
global: 'ReactServerDOMClient',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
Expand All @@ -527,7 +555,8 @@ const bundles = [
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: RENDERER,
entry: 'react-server-dom-webpack/client.edge',
entry: 'react-server-dom-webpack/src/client/react-flight-dom-client.edge',
name: 'react-server-dom-webpack-client.edge',
global: 'ReactServerDOMClient',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
Expand Down
22 changes: 16 additions & 6 deletions scripts/shared/inlinedHostConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = [
'react-dom/src/server/react-dom-server.browser.js',
'react-dom/static.browser',
'react-dom/unstable_server-external-runtime',
'react-server-dom-webpack/client.browser',
'react-server-dom-webpack/src/client/react-flight-dom-client.browser',
'react-server-dom-webpack/src/server/react-flight-dom-server.browser',
],
paths: [
Expand All @@ -43,6 +43,7 @@ module.exports = [
'react-server-dom-webpack/src/client/ReactFlightDOMClientBrowser.js', // react-server-dom-webpack/client.browser
'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpack.js',
'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackBrowser.js',
'react-server-dom-webpack/src/client/react-flight-dom-client.browser',
'react-server-dom-webpack/src/server/react-flight-dom-server.browser',
'react-server-dom-webpack/src/server/ReactFlightDOMServerBrowser.js', // react-server-dom-webpack/src/server/react-flight-dom-server.browser
'react-devtools',
Expand All @@ -62,7 +63,7 @@ module.exports = [
'react-dom/src/server/react-dom-server.node.js',
'react-dom/test-utils',
'react-dom/unstable_server-external-runtime',
'react-server-dom-webpack/client.node.unbundled',
'react-server-dom-webpack/src/client/react-flight-dom-client.node.unbundled',
'react-server-dom-webpack/src/server/react-flight-dom-server.node.unbundled',
],
paths: [
Expand Down Expand Up @@ -90,6 +91,7 @@ module.exports = [
'react-server-dom-webpack/static.node.unbundled',
'react-server-dom-webpack/src/client/ReactFlightDOMClientNode.js', // react-server-dom-webpack/client.node
'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerNode.js',
'react-server-dom-webpack/src/client/react-flight-dom-client.node.unbundled',
'react-server-dom-webpack/src/server/react-flight-dom-server.node.unbundled',
'react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js', // react-server-dom-webpack/src/server/react-flight-dom-server.node
'react-devtools',
Expand All @@ -104,7 +106,11 @@ module.exports = [
},
{
shortName: 'dom-node-webstreams',
entryPoints: ['react-dom/src/server/react-dom-server.node-webstreams.js'],
entryPoints: [
'react-dom/src/server/react-dom-server.node-webstreams.js',
'react-server-dom-webpack/src/client/react-flight-dom-client.node-webstreams.unbundled',
'react-server-dom-webpack/src/server/react-flight-dom-server.node-webstreams.unbundled',
],
paths: [
'react-dom',
'react-dom/src/ReactDOMReactServer.js',
Expand All @@ -130,7 +136,8 @@ module.exports = [
'react-server-dom-webpack/static.node.unbundled',
'react-server-dom-webpack/src/client/ReactFlightDOMClientEdge.js', // react-server-dom-webpack/client.node
'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerNode.js',
'react-server-dom-webpack/src/server/react-flight-dom-server.node.unbundled',
'react-server-dom-webpack/src/client/react-flight-dom-client.node-webstreams.unbundled',
'react-server-dom-webpack/src/server/react-flight-dom-server.node-webstreams.unbundled',
'react-server-dom-webpack/src/server/ReactFlightDOMServerEdge.js', // react-server-dom-webpack/src/server/react-flight-dom-server.node
'shared/ReactDOMSharedInternals',
'react-server/src/ReactFlightServerConfigDebugNode.js',
Expand All @@ -141,7 +148,7 @@ module.exports = [
{
shortName: 'dom-node-webpack',
entryPoints: [
'react-server-dom-webpack/client.node',
'react-server-dom-webpack/src/client/react-flight-dom-client.node',
'react-server-dom-webpack/src/server/react-flight-dom-server.node',
],
paths: [
Expand All @@ -165,8 +172,10 @@ module.exports = [
'react-server-dom-webpack/server.node',
'react-server-dom-webpack/static',
'react-server-dom-webpack/static.node',
'react-server-dom-webpack/src/client/ReactFlightDOMClientNode.js', // react-server-dom-turbopack/client.node
'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpack.js',
'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackServer.js',
'react-server-dom-webpack/src/client/react-flight-dom-client.node',
'react-server-dom-webpack/src/server/react-flight-dom-server.node',
'react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js', // react-server-dom-webpack/src/server/react-flight-dom-server.node
'react-server-dom-webpack/node-register',
Expand Down Expand Up @@ -390,7 +399,7 @@ module.exports = [
entryPoints: [
'react-dom/src/server/react-dom-server.edge.js',
'react-dom/static.edge',
'react-server-dom-webpack/client.edge',
'react-server-dom-webpack/src/client/react-flight-dom-client.edge',
'react-server-dom-webpack/src/server/react-flight-dom-server.edge',
],
paths: [
Expand All @@ -415,6 +424,7 @@ module.exports = [
'react-server-dom-webpack/src/client/ReactFlightDOMClientEdge.js', // react-server-dom-webpack/client.edge
'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpack.js',
'react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackServer.js',
'react-server-dom-webpack/src/client/react-flight-dom-client.edge',
'react-server-dom-webpack/src/server/react-flight-dom-server.edge',
'react-server-dom-webpack/src/server/ReactFlightDOMServerEdge.js', // react-server-dom-webpack/src/server/react-flight-dom-server.edge
'react-devtools',
Expand Down