react-server-dom-webpack 18.3.0-canary-a870b2d54-20240314 → 18.3.0-canary-4b84f1161-20240318
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react-server-dom-webpack-client.browser.development.js +176 -272
- package/cjs/react-server-dom-webpack-client.browser.production.js +146 -127
- package/cjs/react-server-dom-webpack-client.browser.production.min.js +25 -24
- package/cjs/react-server-dom-webpack-client.browser.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.edge.development.js +181 -324
- package/cjs/react-server-dom-webpack-client.edge.production.js +151 -168
- package/cjs/react-server-dom-webpack-client.edge.production.min.js +30 -30
- package/cjs/react-server-dom-webpack-client.edge.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.node.development.js +181 -324
- package/cjs/react-server-dom-webpack-client.node.production.js +151 -168
- package/cjs/react-server-dom-webpack-client.node.production.min.js +29 -28
- package/cjs/react-server-dom-webpack-client.node.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +181 -324
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +151 -168
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +30 -30
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-node-register.js.map +1 -1
- package/cjs/react-server-dom-webpack-plugin.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.browser.development.js +424 -587
- package/cjs/react-server-dom-webpack-server.browser.production.js +368 -403
- package/cjs/react-server-dom-webpack-server.browser.production.min.js +68 -65
- package/cjs/react-server-dom-webpack-server.browser.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.edge.development.js +424 -590
- package/cjs/react-server-dom-webpack-server.edge.production.js +369 -407
- package/cjs/react-server-dom-webpack-server.edge.production.min.js +69 -67
- package/cjs/react-server-dom-webpack-server.edge.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.node.development.js +423 -586
- package/cjs/react-server-dom-webpack-server.node.production.js +368 -403
- package/cjs/react-server-dom-webpack-server.node.production.min.js +72 -70
- package/cjs/react-server-dom-webpack-server.node.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +423 -586
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +368 -403
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +69 -67
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js.map +1 -1
- package/package.json +11 -5
- package/umd/react-server-dom-webpack-client.browser.development.js +176 -272
- package/umd/react-server-dom-webpack-client.browser.production.min.js +23 -22
- package/umd/react-server-dom-webpack-server.browser.development.js +424 -587
- package/umd/react-server-dom-webpack-server.browser.production.min.js +52 -52
@@ -34,49 +34,6 @@ function readFinalStringChunk(decoder, buffer) {
|
|
34
34
|
return decoder.decode(buffer);
|
35
35
|
}
|
36
36
|
|
37
|
-
// This flips color using ANSI, then sets a color styling, then resets.
|
38
|
-
var badgeFormat = '\x1b[0m\x1b[7m%c%s\x1b[0m%c '; // Same badge styling as DevTools.
|
39
|
-
|
40
|
-
var badgeStyle = // We use a fixed background if light-dark is not supported, otherwise
|
41
|
-
// we use a transparent background.
|
42
|
-
'background: #e6e6e6;' + 'background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));' + 'color: #000000;' + 'color: light-dark(#000000, #ffffff);' + 'border-radius: 2px';
|
43
|
-
var resetStyle = '';
|
44
|
-
var pad = ' ';
|
45
|
-
function printToConsole(methodName, args, badgeName) {
|
46
|
-
var offset = 0;
|
47
|
-
|
48
|
-
switch (methodName) {
|
49
|
-
case 'dir':
|
50
|
-
case 'dirxml':
|
51
|
-
case 'groupEnd':
|
52
|
-
case 'table':
|
53
|
-
{
|
54
|
-
// These methods cannot be colorized because they don't take a formatting string.
|
55
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
56
|
-
console[methodName].apply(console, args);
|
57
|
-
return;
|
58
|
-
}
|
59
|
-
|
60
|
-
case 'assert':
|
61
|
-
{
|
62
|
-
// assert takes formatting options as the second argument.
|
63
|
-
offset = 1;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
var newArgs = args.slice(0);
|
68
|
-
|
69
|
-
if (typeof newArgs[offset] === 'string') {
|
70
|
-
newArgs.splice(offset, 1, badgeFormat + newArgs[offset], badgeStyle, pad + badgeName + pad, resetStyle);
|
71
|
-
} else {
|
72
|
-
newArgs.splice(offset, 0, badgeFormat, badgeStyle, pad + badgeName + pad, resetStyle);
|
73
|
-
} // eslint-disable-next-line react-internal/no-production-logging
|
74
|
-
|
75
|
-
|
76
|
-
console[methodName].apply(console, newArgs);
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
|
80
37
|
// This is the parsed shape of the wire format which is why it is
|
81
38
|
// condensed to only the essentialy information
|
82
39
|
var ID = 0;
|
@@ -257,118 +214,120 @@ function getCrossOriginString(input) {
|
|
257
214
|
}
|
258
215
|
|
259
216
|
// This client file is in the shared folder because it applies to both SSR and browser contexts.
|
260
|
-
var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.
|
217
|
+
var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher;
|
261
218
|
function dispatchHint(code, model) {
|
262
219
|
var dispatcher = ReactDOMCurrentDispatcher.current;
|
263
220
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
221
|
+
if (dispatcher) {
|
222
|
+
switch (code) {
|
223
|
+
case 'D':
|
224
|
+
{
|
225
|
+
var refined = refineModel(code, model);
|
226
|
+
var href = refined;
|
227
|
+
dispatcher.prefetchDNS(href);
|
228
|
+
return;
|
229
|
+
}
|
272
230
|
|
273
|
-
|
274
|
-
|
275
|
-
|
231
|
+
case 'C':
|
232
|
+
{
|
233
|
+
var _refined = refineModel(code, model);
|
276
234
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
235
|
+
if (typeof _refined === 'string') {
|
236
|
+
var _href = _refined;
|
237
|
+
dispatcher.preconnect(_href);
|
238
|
+
} else {
|
239
|
+
var _href2 = _refined[0];
|
240
|
+
var crossOrigin = _refined[1];
|
241
|
+
dispatcher.preconnect(_href2, crossOrigin);
|
242
|
+
}
|
243
|
+
|
244
|
+
return;
|
284
245
|
}
|
285
246
|
|
286
|
-
|
287
|
-
|
247
|
+
case 'L':
|
248
|
+
{
|
249
|
+
var _refined2 = refineModel(code, model);
|
288
250
|
|
289
|
-
|
290
|
-
|
291
|
-
var _refined2 = refineModel(code, model);
|
251
|
+
var _href3 = _refined2[0];
|
252
|
+
var as = _refined2[1];
|
292
253
|
|
293
|
-
|
294
|
-
|
254
|
+
if (_refined2.length === 3) {
|
255
|
+
var options = _refined2[2];
|
256
|
+
dispatcher.preload(_href3, as, options);
|
257
|
+
} else {
|
258
|
+
dispatcher.preload(_href3, as);
|
259
|
+
}
|
295
260
|
|
296
|
-
|
297
|
-
var options = _refined2[2];
|
298
|
-
dispatcher.preload(_href3, as, options);
|
299
|
-
} else {
|
300
|
-
dispatcher.preload(_href3, as);
|
261
|
+
return;
|
301
262
|
}
|
302
263
|
|
303
|
-
|
304
|
-
|
264
|
+
case 'm':
|
265
|
+
{
|
266
|
+
var _refined3 = refineModel(code, model);
|
305
267
|
|
306
|
-
|
307
|
-
|
308
|
-
|
268
|
+
if (typeof _refined3 === 'string') {
|
269
|
+
var _href4 = _refined3;
|
270
|
+
dispatcher.preloadModule(_href4);
|
271
|
+
} else {
|
272
|
+
var _href5 = _refined3[0];
|
273
|
+
var _options = _refined3[1];
|
274
|
+
dispatcher.preloadModule(_href5, _options);
|
275
|
+
}
|
309
276
|
|
310
|
-
|
311
|
-
var _href4 = _refined3;
|
312
|
-
dispatcher.preloadModule(_href4);
|
313
|
-
} else {
|
314
|
-
var _href5 = _refined3[0];
|
315
|
-
var _options = _refined3[1];
|
316
|
-
dispatcher.preloadModule(_href5, _options);
|
277
|
+
return;
|
317
278
|
}
|
318
279
|
|
319
|
-
|
320
|
-
|
280
|
+
case 'S':
|
281
|
+
{
|
282
|
+
var _refined4 = refineModel(code, model);
|
321
283
|
|
322
|
-
|
323
|
-
|
324
|
-
|
284
|
+
if (typeof _refined4 === 'string') {
|
285
|
+
var _href6 = _refined4;
|
286
|
+
dispatcher.preinitStyle(_href6);
|
287
|
+
} else {
|
288
|
+
var _href7 = _refined4[0];
|
289
|
+
var precedence = _refined4[1] === 0 ? undefined : _refined4[1];
|
325
290
|
|
326
|
-
|
327
|
-
var _href6 = _refined4;
|
328
|
-
dispatcher.preinitStyle(_href6);
|
329
|
-
} else {
|
330
|
-
var _href7 = _refined4[0];
|
331
|
-
var precedence = _refined4[1] === 0 ? undefined : _refined4[1];
|
291
|
+
var _options2 = _refined4.length === 3 ? _refined4[2] : undefined;
|
332
292
|
|
333
|
-
|
293
|
+
dispatcher.preinitStyle(_href7, precedence, _options2);
|
294
|
+
}
|
334
295
|
|
335
|
-
|
296
|
+
return;
|
336
297
|
}
|
337
298
|
|
338
|
-
|
339
|
-
|
299
|
+
case 'X':
|
300
|
+
{
|
301
|
+
var _refined5 = refineModel(code, model);
|
340
302
|
|
341
|
-
|
342
|
-
|
343
|
-
|
303
|
+
if (typeof _refined5 === 'string') {
|
304
|
+
var _href8 = _refined5;
|
305
|
+
dispatcher.preinitScript(_href8);
|
306
|
+
} else {
|
307
|
+
var _href9 = _refined5[0];
|
308
|
+
var _options3 = _refined5[1];
|
309
|
+
dispatcher.preinitScript(_href9, _options3);
|
310
|
+
}
|
344
311
|
|
345
|
-
|
346
|
-
var _href8 = _refined5;
|
347
|
-
dispatcher.preinitScript(_href8);
|
348
|
-
} else {
|
349
|
-
var _href9 = _refined5[0];
|
350
|
-
var _options3 = _refined5[1];
|
351
|
-
dispatcher.preinitScript(_href9, _options3);
|
312
|
+
return;
|
352
313
|
}
|
353
314
|
|
354
|
-
|
355
|
-
|
315
|
+
case 'M':
|
316
|
+
{
|
317
|
+
var _refined6 = refineModel(code, model);
|
356
318
|
|
357
|
-
|
358
|
-
|
359
|
-
|
319
|
+
if (typeof _refined6 === 'string') {
|
320
|
+
var _href10 = _refined6;
|
321
|
+
dispatcher.preinitModuleScript(_href10);
|
322
|
+
} else {
|
323
|
+
var _href11 = _refined6[0];
|
324
|
+
var _options4 = _refined6[1];
|
325
|
+
dispatcher.preinitModuleScript(_href11, _options4);
|
326
|
+
}
|
360
327
|
|
361
|
-
|
362
|
-
var _href10 = _refined6;
|
363
|
-
dispatcher.preinitModuleScript(_href10);
|
364
|
-
} else {
|
365
|
-
var _href11 = _refined6[0];
|
366
|
-
var _options4 = _refined6[1];
|
367
|
-
dispatcher.preinitModuleScript(_href11, _options4);
|
328
|
+
return;
|
368
329
|
}
|
369
|
-
|
370
|
-
return;
|
371
|
-
}
|
330
|
+
}
|
372
331
|
}
|
373
332
|
} // Flow is having trouble refining the HintModels so we help it a bit.
|
374
333
|
// This should be compiled out in the production build.
|
@@ -431,12 +390,14 @@ function printWarning(level, format, args) {
|
|
431
390
|
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
432
391
|
// The Symbol used to tag the ReactElement-like types.
|
433
392
|
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
434
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
393
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
394
|
+
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
435
395
|
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
436
396
|
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
437
397
|
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
438
398
|
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
439
399
|
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
400
|
+
var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
|
440
401
|
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
441
402
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
442
403
|
function getIteratorFn(maybeIterable) {
|
@@ -548,10 +509,6 @@ function describeValueForErrorMessage(value) {
|
|
548
509
|
return '[...]';
|
549
510
|
}
|
550
511
|
|
551
|
-
if (value !== null && value.$$typeof === CLIENT_REFERENCE_TAG) {
|
552
|
-
return describeClientReference();
|
553
|
-
}
|
554
|
-
|
555
512
|
var name = objectName(value);
|
556
513
|
|
557
514
|
if (name === 'Object') {
|
@@ -562,15 +519,7 @@ function describeValueForErrorMessage(value) {
|
|
562
519
|
}
|
563
520
|
|
564
521
|
case 'function':
|
565
|
-
|
566
|
-
if (value.$$typeof === CLIENT_REFERENCE_TAG) {
|
567
|
-
return describeClientReference();
|
568
|
-
}
|
569
|
-
|
570
|
-
var _name = value.displayName || value.name;
|
571
|
-
|
572
|
-
return _name ? 'function ' + _name : 'function';
|
573
|
-
}
|
522
|
+
return 'function';
|
574
523
|
|
575
524
|
default:
|
576
525
|
// eslint-disable-next-line react-internal/safe-string-coercion
|
@@ -616,12 +565,6 @@ function describeElementType(type) {
|
|
616
565
|
return '';
|
617
566
|
}
|
618
567
|
|
619
|
-
var CLIENT_REFERENCE_TAG = Symbol.for('react.client.reference');
|
620
|
-
|
621
|
-
function describeClientReference(ref) {
|
622
|
-
return 'client';
|
623
|
-
}
|
624
|
-
|
625
568
|
function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
626
569
|
var objKind = objectName(objectOrArray);
|
627
570
|
|
@@ -700,8 +643,6 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
|
700
643
|
} else {
|
701
644
|
if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) {
|
702
645
|
str = '<' + describeElementType(objectOrArray.type) + '/>';
|
703
|
-
} else if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) {
|
704
|
-
return describeClientReference();
|
705
646
|
} else if (jsxPropsParents.has(objectOrArray)) {
|
706
647
|
// Print JSX
|
707
648
|
var _type = jsxPropsParents.get(objectOrArray);
|
@@ -752,9 +693,9 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
|
752
693
|
str += ', ';
|
753
694
|
}
|
754
695
|
|
755
|
-
var
|
756
|
-
str += describeKeyForErrorMessage(
|
757
|
-
var _value3 = _object[
|
696
|
+
var _name = _names[_i3];
|
697
|
+
str += describeKeyForErrorMessage(_name) + ': ';
|
698
|
+
var _value3 = _object[_name];
|
758
699
|
|
759
700
|
var _substr3 = void 0;
|
760
701
|
|
@@ -764,7 +705,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
|
764
705
|
_substr3 = describeValueForErrorMessage(_value3);
|
765
706
|
}
|
766
707
|
|
767
|
-
if (
|
708
|
+
if (_name === expandedName) {
|
768
709
|
start = str.length;
|
769
710
|
length = _substr3.length;
|
770
711
|
str += _substr3;
|
@@ -989,7 +930,7 @@ function processReply(root, formFieldPrefix, resolve, reject) {
|
|
989
930
|
error('React Element cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
|
990
931
|
} else if (value.$$typeof === REACT_LAZY_TYPE) {
|
991
932
|
error('React Lazy cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
|
992
|
-
} else if (value.$$typeof ===
|
933
|
+
} else if (value.$$typeof === REACT_PROVIDER_TYPE) {
|
993
934
|
error('React Context Providers cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
|
994
935
|
} else if (objectName(value) !== 'Object') {
|
995
936
|
error('Only plain objects can be passed to Server Functions from the Client. ' + '%s objects are not supported.%s', objectName(value), describeObjectForErrorMessage(parent, key));
|
@@ -1122,7 +1063,7 @@ function encodeFormData(reference) {
|
|
1122
1063
|
return thenable;
|
1123
1064
|
}
|
1124
1065
|
|
1125
|
-
function
|
1066
|
+
function encodeFormAction(identifierPrefix) {
|
1126
1067
|
var reference = knownServerReferences.get(this);
|
1127
1068
|
|
1128
1069
|
if (!reference) {
|
@@ -1172,22 +1113,6 @@ function defaultEncodeFormAction(identifierPrefix) {
|
|
1172
1113
|
};
|
1173
1114
|
}
|
1174
1115
|
|
1175
|
-
function customEncodeFormAction(proxy, identifierPrefix, encodeFormAction) {
|
1176
|
-
var reference = knownServerReferences.get(proxy);
|
1177
|
-
|
1178
|
-
if (!reference) {
|
1179
|
-
throw new Error('Tried to encode a Server Action from a different instance than the encoder is from. ' + 'This is a bug in React.');
|
1180
|
-
}
|
1181
|
-
|
1182
|
-
var boundPromise = reference.bound;
|
1183
|
-
|
1184
|
-
if (boundPromise === null) {
|
1185
|
-
boundPromise = Promise.resolve([]);
|
1186
|
-
}
|
1187
|
-
|
1188
|
-
return encodeFormAction(reference.id, boundPromise);
|
1189
|
-
}
|
1190
|
-
|
1191
1116
|
function isSignatureEqual(referenceId, numberOfBoundArgs) {
|
1192
1117
|
var reference = knownServerReferences.get(this);
|
1193
1118
|
|
@@ -1249,17 +1174,14 @@ function isSignatureEqual(referenceId, numberOfBoundArgs) {
|
|
1249
1174
|
}
|
1250
1175
|
}
|
1251
1176
|
|
1252
|
-
function registerServerReference(proxy, reference
|
1177
|
+
function registerServerReference(proxy, reference) {
|
1253
1178
|
// Expose encoder for use by SSR, as well as a special bind that can be used to
|
1254
1179
|
// keep server capabilities.
|
1255
1180
|
{
|
1256
1181
|
// Only expose this in builds that would actually use it. Not needed on the client.
|
1257
|
-
var $$FORM_ACTION = encodeFormAction === undefined ? defaultEncodeFormAction : function (identifierPrefix) {
|
1258
|
-
return customEncodeFormAction(this, identifierPrefix, encodeFormAction);
|
1259
|
-
};
|
1260
1182
|
Object.defineProperties(proxy, {
|
1261
1183
|
$$FORM_ACTION: {
|
1262
|
-
value:
|
1184
|
+
value: encodeFormAction
|
1263
1185
|
},
|
1264
1186
|
$$IS_SIGNATURE_EQUAL: {
|
1265
1187
|
value: isSignatureEqual
|
@@ -1283,17 +1205,6 @@ function bind() {
|
|
1283
1205
|
var reference = knownServerReferences.get(this);
|
1284
1206
|
|
1285
1207
|
if (reference) {
|
1286
|
-
{
|
1287
|
-
var thisBind = arguments[0];
|
1288
|
-
|
1289
|
-
if (thisBind != null) {
|
1290
|
-
// This doesn't warn in browser environments since it's not instrumented outside
|
1291
|
-
// usedWithSSR. This makes this an SSR only warning which we don't generally do.
|
1292
|
-
// TODO: Consider a DEV only instrumentation in the browser.
|
1293
|
-
error('Cannot bind "this" of a Server Action. Pass null or undefined as the first argument to .bind().');
|
1294
|
-
}
|
1295
|
-
}
|
1296
|
-
|
1297
1208
|
var args = ArraySlice.call(arguments, 1);
|
1298
1209
|
var boundPromise = null;
|
1299
1210
|
|
@@ -1303,26 +1214,9 @@ function bind() {
|
|
1303
1214
|
});
|
1304
1215
|
} else {
|
1305
1216
|
boundPromise = Promise.resolve(args);
|
1306
|
-
} // Expose encoder for use by SSR, as well as a special bind that can be used to
|
1307
|
-
// keep server capabilities.
|
1308
|
-
|
1309
|
-
|
1310
|
-
{
|
1311
|
-
// Only expose this in builds that would actually use it. Not needed on the client.
|
1312
|
-
Object.defineProperties(newFn, {
|
1313
|
-
$$FORM_ACTION: {
|
1314
|
-
value: this.$$FORM_ACTION
|
1315
|
-
},
|
1316
|
-
$$IS_SIGNATURE_EQUAL: {
|
1317
|
-
value: isSignatureEqual
|
1318
|
-
},
|
1319
|
-
bind: {
|
1320
|
-
value: bind
|
1321
|
-
}
|
1322
|
-
});
|
1323
1217
|
}
|
1324
1218
|
|
1325
|
-
|
1219
|
+
registerServerReference(newFn, {
|
1326
1220
|
id: reference.id,
|
1327
1221
|
bound: boundPromise
|
1328
1222
|
});
|
@@ -1331,7 +1225,7 @@ function bind() {
|
|
1331
1225
|
return newFn;
|
1332
1226
|
}
|
1333
1227
|
|
1334
|
-
function createServerReference$1(id, callServer
|
1228
|
+
function createServerReference$1(id, callServer) {
|
1335
1229
|
var proxy = function () {
|
1336
1230
|
// $FlowFixMe[method-unbinding]
|
1337
1231
|
var args = Array.prototype.slice.call(arguments);
|
@@ -1341,10 +1235,61 @@ function createServerReference$1(id, callServer, encodeFormAction) {
|
|
1341
1235
|
registerServerReference(proxy, {
|
1342
1236
|
id: id,
|
1343
1237
|
bound: null
|
1344
|
-
}
|
1238
|
+
});
|
1345
1239
|
return proxy;
|
1346
1240
|
}
|
1347
1241
|
|
1242
|
+
var ContextRegistry = ReactSharedInternals.ContextRegistry;
|
1243
|
+
function getOrCreateServerContext(globalName) {
|
1244
|
+
if (!ContextRegistry[globalName]) {
|
1245
|
+
var context = {
|
1246
|
+
$$typeof: REACT_SERVER_CONTEXT_TYPE,
|
1247
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
1248
|
+
// some renderers as primary and others as secondary. We only expect
|
1249
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
1250
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
1251
|
+
// Secondary renderers store their context values on separate fields.
|
1252
|
+
_currentValue: REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED,
|
1253
|
+
_currentValue2: REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED,
|
1254
|
+
_defaultValue: REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED,
|
1255
|
+
// Used to track how many concurrent renderers this context currently
|
1256
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
1257
|
+
_threadCount: 0,
|
1258
|
+
// These are circular
|
1259
|
+
Provider: null,
|
1260
|
+
Consumer: null,
|
1261
|
+
_globalName: globalName
|
1262
|
+
};
|
1263
|
+
context.Provider = {
|
1264
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
1265
|
+
_context: context
|
1266
|
+
};
|
1267
|
+
|
1268
|
+
{
|
1269
|
+
var hasWarnedAboutUsingConsumer;
|
1270
|
+
context._currentRenderer = null;
|
1271
|
+
context._currentRenderer2 = null;
|
1272
|
+
Object.defineProperties(context, {
|
1273
|
+
Consumer: {
|
1274
|
+
get: function () {
|
1275
|
+
if (!hasWarnedAboutUsingConsumer) {
|
1276
|
+
error('Consumer pattern is not supported by ReactServerContext');
|
1277
|
+
|
1278
|
+
hasWarnedAboutUsingConsumer = true;
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
return null;
|
1282
|
+
}
|
1283
|
+
}
|
1284
|
+
});
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
ContextRegistry[globalName] = context;
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
return ContextRegistry[globalName];
|
1291
|
+
}
|
1292
|
+
|
1348
1293
|
var ROW_ID = 0;
|
1349
1294
|
var ROW_TAG = 1;
|
1350
1295
|
var ROW_LENGTH = 2;
|
@@ -1363,10 +1308,6 @@ function Chunk(status, value, reason, response) {
|
|
1363
1308
|
this.value = value;
|
1364
1309
|
this.reason = reason;
|
1365
1310
|
this._response = response;
|
1366
|
-
|
1367
|
-
{
|
1368
|
-
this._debugInfo = null;
|
1369
|
-
}
|
1370
1311
|
} // We subclass Promise.prototype so that we get other methods like .catch
|
1371
1312
|
|
1372
1313
|
|
@@ -1643,20 +1584,17 @@ function reportGlobalError(response, error) {
|
|
1643
1584
|
}
|
1644
1585
|
|
1645
1586
|
function createElement(type, key, props) {
|
1646
|
-
var element
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
_owner: null
|
1658
|
-
};
|
1659
|
-
}
|
1587
|
+
var element = {
|
1588
|
+
// This tag allows us to uniquely identify this as a React Element
|
1589
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
1590
|
+
// Built-in properties that belong on the element
|
1591
|
+
type: type,
|
1592
|
+
key: key,
|
1593
|
+
ref: null,
|
1594
|
+
props: props,
|
1595
|
+
// Record the component responsible for creating this element.
|
1596
|
+
_owner: null
|
1597
|
+
};
|
1660
1598
|
|
1661
1599
|
{
|
1662
1600
|
// We don't really need to add any of these but keeping them for good measure.
|
@@ -1669,12 +1607,17 @@ function createElement(type, key, props) {
|
|
1669
1607
|
writable: true,
|
1670
1608
|
value: true // This element has already been validated on the server.
|
1671
1609
|
|
1672
|
-
});
|
1673
|
-
|
1674
|
-
Object.defineProperty(element, '_debugInfo', {
|
1610
|
+
});
|
1611
|
+
Object.defineProperty(element, '_self', {
|
1675
1612
|
configurable: false,
|
1676
1613
|
enumerable: false,
|
1677
|
-
writable:
|
1614
|
+
writable: false,
|
1615
|
+
value: null
|
1616
|
+
});
|
1617
|
+
Object.defineProperty(element, '_source', {
|
1618
|
+
configurable: false,
|
1619
|
+
enumerable: false,
|
1620
|
+
writable: false,
|
1678
1621
|
value: null
|
1679
1622
|
});
|
1680
1623
|
}
|
@@ -1688,13 +1631,6 @@ function createLazyChunkWrapper(chunk) {
|
|
1688
1631
|
_payload: chunk,
|
1689
1632
|
_init: readChunk
|
1690
1633
|
};
|
1691
|
-
|
1692
|
-
{
|
1693
|
-
// Ensure we have a live array to track future debug info.
|
1694
|
-
var chunkDebugInfo = chunk._debugInfo || (chunk._debugInfo = []);
|
1695
|
-
lazyType._debugInfo = chunkDebugInfo;
|
1696
|
-
}
|
1697
|
-
|
1698
1634
|
return lazyType;
|
1699
1635
|
}
|
1700
1636
|
|
@@ -1777,7 +1713,7 @@ function createServerReferenceProxy(response, metaData) {
|
|
1777
1713
|
});
|
1778
1714
|
};
|
1779
1715
|
|
1780
|
-
registerServerReference(proxy, metaData
|
1716
|
+
registerServerReference(proxy, metaData);
|
1781
1717
|
return proxy;
|
1782
1718
|
}
|
1783
1719
|
|
@@ -1830,11 +1766,6 @@ function parseModelString(response, parentObject, key, value) {
|
|
1830
1766
|
case '@':
|
1831
1767
|
{
|
1832
1768
|
// Promise
|
1833
|
-
if (value.length === 2) {
|
1834
|
-
// Infinite promise that never resolves.
|
1835
|
-
return new Promise(function () {});
|
1836
|
-
}
|
1837
|
-
|
1838
1769
|
var _id = parseInt(value.slice(2), 16);
|
1839
1770
|
|
1840
1771
|
var _chunk = getChunk(response, _id);
|
@@ -1848,6 +1779,12 @@ function parseModelString(response, parentObject, key, value) {
|
|
1848
1779
|
return Symbol.for(value.slice(2));
|
1849
1780
|
}
|
1850
1781
|
|
1782
|
+
case 'P':
|
1783
|
+
{
|
1784
|
+
// Server Context Provider
|
1785
|
+
return getOrCreateServerContext(value.slice(2)).Provider;
|
1786
|
+
}
|
1787
|
+
|
1851
1788
|
case 'F':
|
1852
1789
|
{
|
1853
1790
|
// Server Reference
|
@@ -1917,23 +1854,6 @@ function parseModelString(response, parentObject, key, value) {
|
|
1917
1854
|
return BigInt(value.slice(2));
|
1918
1855
|
}
|
1919
1856
|
|
1920
|
-
case 'E':
|
1921
|
-
{
|
1922
|
-
{
|
1923
|
-
// In DEV mode we allow indirect eval to produce functions for logging.
|
1924
|
-
// This should not compile to eval() because then it has local scope access.
|
1925
|
-
try {
|
1926
|
-
// eslint-disable-next-line no-eval
|
1927
|
-
return (0, eval)(value.slice(2));
|
1928
|
-
} catch (x) {
|
1929
|
-
// We currently use this to express functions so we fail parsing it,
|
1930
|
-
// let's just return a blank function as a place holder.
|
1931
|
-
return function () {};
|
1932
|
-
}
|
1933
|
-
} // Fallthrough
|
1934
|
-
|
1935
|
-
}
|
1936
|
-
|
1937
1857
|
default:
|
1938
1858
|
{
|
1939
1859
|
// We assume that anything else is a reference ID.
|
@@ -1954,29 +1874,7 @@ function parseModelString(response, parentObject, key, value) {
|
|
1954
1874
|
|
1955
1875
|
switch (_chunk2.status) {
|
1956
1876
|
case INITIALIZED:
|
1957
|
-
|
1958
|
-
|
1959
|
-
if (_chunk2._debugInfo) {
|
1960
|
-
// If we have a direct reference to an object that was rendered by a synchronous
|
1961
|
-
// server component, it might have some debug info about how it was rendered.
|
1962
|
-
// We forward this to the underlying object. This might be a React Element or
|
1963
|
-
// an Array fragment.
|
1964
|
-
// If this was a string / number return value we lose the debug info. We choose
|
1965
|
-
// that tradeoff to allow sync server components to return plain values and not
|
1966
|
-
// use them as React Nodes necessarily. We could otherwise wrap them in a Lazy.
|
1967
|
-
if (typeof chunkValue === 'object' && chunkValue !== null && (Array.isArray(chunkValue) || chunkValue.$$typeof === REACT_ELEMENT_TYPE) && !chunkValue._debugInfo) {
|
1968
|
-
// We should maybe use a unique symbol for arrays but this is a React owned array.
|
1969
|
-
// $FlowFixMe[prop-missing]: This should be added to elements.
|
1970
|
-
Object.defineProperty(chunkValue, '_debugInfo', {
|
1971
|
-
configurable: false,
|
1972
|
-
enumerable: false,
|
1973
|
-
writable: true,
|
1974
|
-
value: _chunk2._debugInfo
|
1975
|
-
});
|
1976
|
-
}
|
1977
|
-
}
|
1978
|
-
|
1979
|
-
return chunkValue;
|
1877
|
+
return _chunk2.value;
|
1980
1878
|
|
1981
1879
|
case PENDING:
|
1982
1880
|
case BLOCKED:
|
@@ -2013,13 +1911,12 @@ function missingCall() {
|
|
2013
1911
|
throw new Error('Trying to call a function from "use server" but the callServer option ' + 'was not implemented in your router runtime.');
|
2014
1912
|
}
|
2015
1913
|
|
2016
|
-
function createResponse(bundlerConfig, moduleLoading, callServer,
|
1914
|
+
function createResponse(bundlerConfig, moduleLoading, callServer, nonce) {
|
2017
1915
|
var chunks = new Map();
|
2018
1916
|
var response = {
|
2019
1917
|
_bundlerConfig: bundlerConfig,
|
2020
1918
|
_moduleLoading: moduleLoading,
|
2021
1919
|
_callServer: callServer !== undefined ? callServer : missingCall,
|
2022
|
-
_encodeFormAction: encodeFormAction,
|
2023
1920
|
_nonce: nonce,
|
2024
1921
|
_chunks: chunks,
|
2025
1922
|
_stringDecoder: createStringDecoder(),
|
@@ -2117,24 +2014,6 @@ function resolveHint(response, code, model) {
|
|
2117
2014
|
dispatchHint(code, hintModel);
|
2118
2015
|
}
|
2119
2016
|
|
2120
|
-
function resolveDebugInfo(response, id, debugInfo) {
|
2121
|
-
|
2122
|
-
var chunk = getChunk(response, id);
|
2123
|
-
var chunkDebugInfo = chunk._debugInfo || (chunk._debugInfo = []);
|
2124
|
-
chunkDebugInfo.push(debugInfo);
|
2125
|
-
}
|
2126
|
-
|
2127
|
-
function resolveConsoleEntry(response, value) {
|
2128
|
-
|
2129
|
-
var payload = parseModel(response, value);
|
2130
|
-
var methodName = payload[0]; // TODO: Restore the fake stack before logging.
|
2131
|
-
// const stackTrace = payload[1];
|
2132
|
-
|
2133
|
-
var env = payload[2];
|
2134
|
-
var args = payload.slice(3);
|
2135
|
-
printToConsole(methodName, args, env);
|
2136
|
-
}
|
2137
|
-
|
2138
2017
|
function processFullRow(response, id, tag, buffer, chunk) {
|
2139
2018
|
|
2140
2019
|
var stringDecoder = response._stringDecoder;
|
@@ -2185,28 +2064,6 @@ function processFullRow(response, id, tag, buffer, chunk) {
|
|
2185
2064
|
return;
|
2186
2065
|
}
|
2187
2066
|
|
2188
|
-
case 68
|
2189
|
-
/* "D" */
|
2190
|
-
:
|
2191
|
-
{
|
2192
|
-
{
|
2193
|
-
var debugInfo = JSON.parse(row);
|
2194
|
-
resolveDebugInfo(response, id, debugInfo);
|
2195
|
-
return;
|
2196
|
-
} // Fallthrough to share the error with Console entries.
|
2197
|
-
|
2198
|
-
}
|
2199
|
-
|
2200
|
-
case 87
|
2201
|
-
/* "W" */
|
2202
|
-
:
|
2203
|
-
{
|
2204
|
-
{
|
2205
|
-
resolveConsoleEntry(response, row);
|
2206
|
-
return;
|
2207
|
-
}
|
2208
|
-
}
|
2209
|
-
|
2210
2067
|
case 80
|
2211
2068
|
/* "P" */
|
2212
2069
|
:
|
@@ -2392,7 +2249,7 @@ function createServerReference(id, callServer) {
|
|
2392
2249
|
}
|
2393
2250
|
|
2394
2251
|
function createFromNodeStream(stream, ssrManifest, options) {
|
2395
|
-
var response = createResponse(ssrManifest.moduleMap, ssrManifest.moduleLoading, noServerCall, options
|
2252
|
+
var response = createResponse(ssrManifest.moduleMap, ssrManifest.moduleLoading, noServerCall, options && typeof options.nonce === 'string' ? options.nonce : undefined);
|
2396
2253
|
stream.on('data', function (chunk) {
|
2397
2254
|
processBinaryChunk(response, chunk);
|
2398
2255
|
});
|