Skip to content

Commit 4bf2113

Browse files
authored
Revert "Move the Webpack manifest config to one level deeper (#26083)" (#26111)
Just kidding. We're not going to need any other fields afaik after all.
1 parent 855b77c commit 4bf2113

File tree

8 files changed

+21
-24
lines changed

8 files changed

+21
-24
lines changed

fixtures/flight/server/handler.server.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ module.exports = function (req, res) {
2020
const App = m.default.default || m.default;
2121
res.setHeader('Access-Control-Allow-Origin', '*');
2222
const moduleMap = JSON.parse(data);
23-
const {pipe} = renderToPipeableStream(React.createElement(App), {
24-
clientManifest: moduleMap,
25-
});
23+
const {pipe} = renderToPipeableStream(
24+
React.createElement(App),
25+
moduleMap
26+
);
2627
pipe(res);
2728
}
2829
);

packages/react-server-dom-webpack/src/ReactFlightDOMServerBrowser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ type Options = {
2727

2828
function renderToReadableStream(
2929
model: ReactModel,
30-
webpackMaps: BundlerConfig,
30+
webpackMap: BundlerConfig,
3131
options?: Options,
3232
): ReadableStream {
3333
const request = createRequest(
3434
model,
35-
webpackMaps,
35+
webpackMap,
3636
options ? options.onError : undefined,
3737
options ? options.context : undefined,
3838
options ? options.identifierPrefix : undefined,

packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ type PipeableStream = {
3737

3838
function renderToPipeableStream(
3939
model: ReactModel,
40-
webpackMaps: BundlerConfig,
40+
webpackMap: BundlerConfig,
4141
options?: Options,
4242
): PipeableStream {
4343
const request = createRequest(
4444
model,
45-
webpackMaps,
45+
webpackMap,
4646
options ? options.onError : undefined,
4747
options ? options.context : undefined,
4848
options ? options.identifierPrefix : undefined,

packages/react-server-dom-webpack/src/ReactFlightServerWebpackBundlerConfig.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ type WebpackMap = {
1313
},
1414
};
1515

16-
export type BundlerConfig = {
17-
clientManifest: WebpackMap,
18-
};
16+
export type BundlerConfig = WebpackMap;
1917

2018
// eslint-disable-next-line no-unused-vars
2119
export type ClientReference<T> = {
@@ -56,7 +54,7 @@ export function resolveModuleMetaData<T>(
5654
clientReference: ClientReference<T>,
5755
): ModuleMetaData {
5856
const resolvedModuleData =
59-
config.clientManifest[clientReference.filepath][clientReference.name];
57+
config[clientReference.filepath][clientReference.name];
6058
if (clientReference.async) {
6159
return {
6260
id: resolvedModuleData.id,

packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ module.exports = function register() {
102102
target.default = Object.defineProperties(
103103
(function () {
104104
throw new Error(
105-
`Attempted to call the default export of ${moduleId} from the server` +
105+
`Attempted to call the default export of ${moduleId} from the server ` +
106106
`but it's on the client. It's not possible to invoke a client function from ` +
107-
`the server, it can only be rendered as a Component or passed to props of a` +
107+
`the server, it can only be rendered as a Component or passed to props of a ` +
108108
`Client Component.`,
109109
);
110110
}: any),

packages/react-server-dom-webpack/src/__tests__/ReactFlightDOM-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,8 +936,8 @@ describe('ReactFlightDOM', () => {
936936
});
937937

938938
// We simulate a bug in the Webpack bundler which causes an error on the server.
939-
for (const id in webpackMap.clientManifest) {
940-
Object.defineProperty(webpackMap.clientManifest, id, {
939+
for (const id in webpackMap) {
940+
Object.defineProperty(webpackMap, id, {
941941
get: () => {
942942
throw new Error('bug in the bundler');
943943
},

packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,14 +473,12 @@ describe('ReactFlightDOMBrowser', () => {
473473
const ClientComponentOnTheServer = clientExports(ClientComponent);
474474

475475
// In the SSR bundle this module won't exist. We simulate this by deleting it.
476-
const clientId =
477-
webpackMap.clientManifest[ClientComponentOnTheClient.filepath]['*'].id;
476+
const clientId = webpackMap[ClientComponentOnTheClient.filepath]['*'].id;
478477
delete webpackModules[clientId];
479478

480479
// Instead, we have to provide a translation from the client meta data to the SSR
481480
// meta data.
482-
const ssrMetaData =
483-
webpackMap.clientManifest[ClientComponentOnTheServer.filepath]['*'];
481+
const ssrMetaData = webpackMap[ClientComponentOnTheServer.filepath]['*'];
484482
const translationMap = {
485483
[clientId]: {
486484
'*': ssrMetaData,

packages/react-server-dom-webpack/src/__tests__/utils/WebpackMock.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const Module = require('module');
1313
let webpackModuleIdx = 0;
1414
const webpackModules = {};
1515
const webpackErroredModules = {};
16-
const webpackMap = {clientManifest: {}};
16+
const webpackMap = {};
1717
global.__webpack_require__ = function (id) {
1818
if (webpackErroredModules[id]) {
1919
throw webpackErroredModules[id];
@@ -44,7 +44,7 @@ exports.clientModuleError = function clientModuleError(moduleError) {
4444
const idx = '' + webpackModuleIdx++;
4545
webpackErroredModules[idx] = moduleError;
4646
const path = url.pathToFileURL(idx).href;
47-
webpackMap.clientManifest[path] = {
47+
webpackMap[path] = {
4848
'': {
4949
id: idx,
5050
chunks: [],
@@ -65,7 +65,7 @@ exports.clientExports = function clientExports(moduleExports) {
6565
const idx = '' + webpackModuleIdx++;
6666
webpackModules[idx] = moduleExports;
6767
const path = url.pathToFileURL(idx).href;
68-
webpackMap.clientManifest[path] = {
68+
webpackMap[path] = {
6969
'': {
7070
id: idx,
7171
chunks: [],
@@ -81,7 +81,7 @@ exports.clientExports = function clientExports(moduleExports) {
8181
moduleExports.then(
8282
asyncModuleExports => {
8383
for (const name in asyncModuleExports) {
84-
webpackMap.clientManifest[path][name] = {
84+
webpackMap[path][name] = {
8585
id: idx,
8686
chunks: [],
8787
name: name,
@@ -92,7 +92,7 @@ exports.clientExports = function clientExports(moduleExports) {
9292
);
9393
}
9494
for (const name in moduleExports) {
95-
webpackMap.clientManifest[path][name] = {
95+
webpackMap[path][name] = {
9696
id: idx,
9797
chunks: [],
9898
name: name,

0 commit comments

Comments
 (0)