Skip to content

Commit 4736696

Browse files
committed
bump react
1 parent 1c3da4a commit 4736696

File tree

7 files changed

+129
-73
lines changed

7 files changed

+129
-73
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@
177177
"react-17": "npm:react@17.0.2",
178178
"react-dom": "18.2.0",
179179
"react-dom-17": "npm:react-dom@17.0.2",
180-
"react-dom-exp": "npm:react-dom@0.0.0-experimental-c8b778b7f-20220825",
181-
"react-exp": "npm:react@0.0.0-experimental-c8b778b7f-20220825",
180+
"react-dom-exp": "npm:react-dom@0.0.0-experimental-0de3ddf56-20220825",
181+
"react-exp": "npm:react@0.0.0-experimental-0de3ddf56-20220825",
182182
"react-ssr-prepass": "1.0.8",
183183
"react-virtualized": "9.22.3",
184184
"relay-compiler": "13.0.2",

packages/next/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,24 @@ function processSymbolChunk(request, id, name) {
189189
// eslint-disable-next-line no-unused-vars
190190
var MODULE_TAG = Symbol.for('react.module.reference');
191191
function getModuleKey(reference) {
192-
return reference.filepath + '#' + reference.name;
192+
return reference.filepath + '#' + reference.name + (reference.async ? '#async' : '');
193193
}
194194
function isModuleReference(reference) {
195195
return reference.$$typeof === MODULE_TAG;
196196
}
197197
function resolveModuleMetaData(config, moduleReference) {
198-
return config[moduleReference.filepath][moduleReference.name];
198+
var resolvedModuleData = config[moduleReference.filepath][moduleReference.name];
199+
200+
if (moduleReference.async) {
201+
return {
202+
id: resolvedModuleData.id,
203+
chunks: resolvedModuleData.chunks,
204+
name: resolvedModuleData.name,
205+
async: true
206+
};
207+
} else {
208+
return resolvedModuleData;
209+
}
199210
}
200211

201212
// ATTENTION

packages/next/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,18 @@ function parseModel(response, json) {
3636
// eslint-disable-next-line no-unused-vars
3737
function resolveModuleReference(bundlerConfig, moduleData) {
3838
if (bundlerConfig) {
39-
return bundlerConfig[moduleData.id][moduleData.name];
39+
var resolvedModuleData = bundlerConfig[moduleData.id][moduleData.name];
40+
41+
if (moduleData.async) {
42+
return {
43+
id: resolvedModuleData.id,
44+
chunks: resolvedModuleData.chunks,
45+
name: resolvedModuleData.name,
46+
async: true
47+
};
48+
} else {
49+
return resolvedModuleData;
50+
}
4051
}
4152

4253
return moduleData;
@@ -45,11 +56,13 @@ function resolveModuleReference(bundlerConfig, moduleData) {
4556
// in Webpack but unfortunately it's not exposed so we have to
4657
// replicate it in user space. null means that it has already loaded.
4758

48-
var chunkCache = new Map(); // Start preloading the modules since we might need them soon.
59+
var chunkCache = new Map();
60+
var asyncModuleCache = new Map(); // Start preloading the modules since we might need them soon.
4961
// This function doesn't suspend.
5062

5163
function preloadModule(moduleData) {
5264
var chunks = moduleData.chunks;
65+
var promises = [];
5366

5467
for (var i = 0; i < chunks.length; i++) {
5568
var chunkId = chunks[i];
@@ -58,31 +71,62 @@ function preloadModule(moduleData) {
5871
if (entry === undefined) {
5972
var thenable = globalThis.__next_chunk_load__(chunkId);
6073

74+
promises.push(thenable);
6175
var resolve = chunkCache.set.bind(chunkCache, chunkId, null);
6276
var reject = chunkCache.set.bind(chunkCache, chunkId);
6377
thenable.then(resolve, reject);
6478
chunkCache.set(chunkId, thenable);
6579
}
6680
}
81+
82+
if (moduleData.async) {
83+
var modulePromise = Promise.all(promises).then(function () {
84+
return globalThis.__next_require__(moduleData.id);
85+
});
86+
modulePromise.then(function (value) {
87+
modulePromise.status = 'fulfilled';
88+
modulePromise.value = value;
89+
}, function (reason) {
90+
modulePromise.status = 'rejected';
91+
modulePromise.reason = reason;
92+
});
93+
asyncModuleCache.set(moduleData.id, modulePromise);
94+
}
6795
} // Actually require the module or suspend if it's not yet ready.
6896
// Increase priority if necessary.
6997

7098
function requireModule(moduleData) {
71-
var chunks = moduleData.chunks;
99+
var moduleExports;
100+
101+
if (moduleData.async) {
102+
// We assume that preloadModule has been called before, which
103+
// should have added something to the module cache.
104+
var promise = asyncModuleCache.get(moduleData.id);
105+
106+
if (promise.status === 'fulfilled') {
107+
moduleExports = promise.value;
108+
} else if (promise.status === 'rejected') {
109+
throw promise.reason;
110+
} else {
111+
throw promise;
112+
}
113+
} else {
114+
var chunks = moduleData.chunks;
72115

73-
for (var i = 0; i < chunks.length; i++) {
74-
var chunkId = chunks[i];
75-
var entry = chunkCache.get(chunkId);
116+
for (var i = 0; i < chunks.length; i++) {
117+
var chunkId = chunks[i];
118+
var entry = chunkCache.get(chunkId);
76119

77-
if (entry !== null) {
78-
// We assume that preloadModule has been called before.
79-
// So we don't expect to see entry being undefined here, that's an error.
80-
// Let's throw either an error or the Promise.
81-
throw entry;
120+
if (entry !== null) {
121+
// We assume that preloadModule has been called before.
122+
// So we don't expect to see entry being undefined here, that's an error.
123+
// Let's throw either an error or the Promise.
124+
throw entry;
125+
}
82126
}
83-
}
84127

85-
var moduleExports = globalThis.__next_require__(moduleData.id);
128+
moduleExports = globalThis.__next_require__(moduleData.id);
129+
}
86130

87131
if (moduleData.name === '*') {
88132
// This is a placeholder value that represents that the caller imported this

packages/next/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
"raw-body": "2.4.1",
245245
"react-is": "17.0.2",
246246
"react-refresh": "0.12.0",
247-
"react-server-dom-webpack": "0.0.0-experimental-c8b778b7f-20220825",
247+
"react-server-dom-webpack": "0.0.0-experimental-0de3ddf56-20220825",
248248
"regenerator-runtime": "0.13.4",
249249
"sass-loader": "12.4.0",
250250
"schema-utils2": "npm:schema-utils@2.7.1",

pnpm-lock.yaml

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)