react-server-dom-webpack 18.3.0-canary-14898b6a9-20240318 → 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 +91 -189
- package/cjs/react-server-dom-webpack-client.browser.production.js +60 -43
- package/cjs/react-server-dom-webpack-client.browser.production.min.js +24 -23
- package/cjs/react-server-dom-webpack-client.browser.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.edge.development.js +96 -241
- package/cjs/react-server-dom-webpack-client.edge.production.js +65 -84
- package/cjs/react-server-dom-webpack-client.edge.production.min.js +29 -29
- package/cjs/react-server-dom-webpack-client.edge.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.node.development.js +96 -241
- package/cjs/react-server-dom-webpack-client.node.production.js +65 -84
- 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 +96 -241
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +65 -84
- 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 +406 -550
- package/cjs/react-server-dom-webpack-server.browser.production.js +351 -373
- 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 +406 -553
- package/cjs/react-server-dom-webpack-server.edge.production.js +350 -375
- package/cjs/react-server-dom-webpack-server.edge.production.min.js +69 -66
- package/cjs/react-server-dom-webpack-server.edge.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.node.development.js +406 -550
- package/cjs/react-server-dom-webpack-server.node.production.js +350 -372
- 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 +406 -550
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +350 -372
- 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 +3 -3
- package/umd/react-server-dom-webpack-client.browser.development.js +91 -189
- package/umd/react-server-dom-webpack-client.browser.production.min.js +23 -22
- package/umd/react-server-dom-webpack-server.browser.development.js +406 -550
- 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;
|
@@ -433,12 +390,14 @@ function printWarning(level, format, args) {
|
|
433
390
|
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
434
391
|
// The Symbol used to tag the ReactElement-like types.
|
435
392
|
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
436
|
-
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');
|
437
395
|
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
438
396
|
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
439
397
|
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
440
398
|
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
441
399
|
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
400
|
+
var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
|
442
401
|
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
443
402
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
444
403
|
function getIteratorFn(maybeIterable) {
|
@@ -550,10 +509,6 @@ function describeValueForErrorMessage(value) {
|
|
550
509
|
return '[...]';
|
551
510
|
}
|
552
511
|
|
553
|
-
if (value !== null && value.$$typeof === CLIENT_REFERENCE_TAG) {
|
554
|
-
return describeClientReference();
|
555
|
-
}
|
556
|
-
|
557
512
|
var name = objectName(value);
|
558
513
|
|
559
514
|
if (name === 'Object') {
|
@@ -564,15 +519,7 @@ function describeValueForErrorMessage(value) {
|
|
564
519
|
}
|
565
520
|
|
566
521
|
case 'function':
|
567
|
-
|
568
|
-
if (value.$$typeof === CLIENT_REFERENCE_TAG) {
|
569
|
-
return describeClientReference();
|
570
|
-
}
|
571
|
-
|
572
|
-
var _name = value.displayName || value.name;
|
573
|
-
|
574
|
-
return _name ? 'function ' + _name : 'function';
|
575
|
-
}
|
522
|
+
return 'function';
|
576
523
|
|
577
524
|
default:
|
578
525
|
// eslint-disable-next-line react-internal/safe-string-coercion
|
@@ -618,12 +565,6 @@ function describeElementType(type) {
|
|
618
565
|
return '';
|
619
566
|
}
|
620
567
|
|
621
|
-
var CLIENT_REFERENCE_TAG = Symbol.for('react.client.reference');
|
622
|
-
|
623
|
-
function describeClientReference(ref) {
|
624
|
-
return 'client';
|
625
|
-
}
|
626
|
-
|
627
568
|
function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
628
569
|
var objKind = objectName(objectOrArray);
|
629
570
|
|
@@ -702,8 +643,6 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
|
702
643
|
} else {
|
703
644
|
if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) {
|
704
645
|
str = '<' + describeElementType(objectOrArray.type) + '/>';
|
705
|
-
} else if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) {
|
706
|
-
return describeClientReference();
|
707
646
|
} else if (jsxPropsParents.has(objectOrArray)) {
|
708
647
|
// Print JSX
|
709
648
|
var _type = jsxPropsParents.get(objectOrArray);
|
@@ -754,9 +693,9 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
|
754
693
|
str += ', ';
|
755
694
|
}
|
756
695
|
|
757
|
-
var
|
758
|
-
str += describeKeyForErrorMessage(
|
759
|
-
var _value3 = _object[
|
696
|
+
var _name = _names[_i3];
|
697
|
+
str += describeKeyForErrorMessage(_name) + ': ';
|
698
|
+
var _value3 = _object[_name];
|
760
699
|
|
761
700
|
var _substr3 = void 0;
|
762
701
|
|
@@ -766,7 +705,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
|
766
705
|
_substr3 = describeValueForErrorMessage(_value3);
|
767
706
|
}
|
768
707
|
|
769
|
-
if (
|
708
|
+
if (_name === expandedName) {
|
770
709
|
start = str.length;
|
771
710
|
length = _substr3.length;
|
772
711
|
str += _substr3;
|
@@ -991,7 +930,7 @@ function processReply(root, formFieldPrefix, resolve, reject) {
|
|
991
930
|
error('React Element cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
|
992
931
|
} else if (value.$$typeof === REACT_LAZY_TYPE) {
|
993
932
|
error('React Lazy cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
|
994
|
-
} else if (value.$$typeof ===
|
933
|
+
} else if (value.$$typeof === REACT_PROVIDER_TYPE) {
|
995
934
|
error('React Context Providers cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
|
996
935
|
} else if (objectName(value) !== 'Object') {
|
997
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));
|
@@ -1124,7 +1063,7 @@ function encodeFormData(reference) {
|
|
1124
1063
|
return thenable;
|
1125
1064
|
}
|
1126
1065
|
|
1127
|
-
function
|
1066
|
+
function encodeFormAction(identifierPrefix) {
|
1128
1067
|
var reference = knownServerReferences.get(this);
|
1129
1068
|
|
1130
1069
|
if (!reference) {
|
@@ -1174,22 +1113,6 @@ function defaultEncodeFormAction(identifierPrefix) {
|
|
1174
1113
|
};
|
1175
1114
|
}
|
1176
1115
|
|
1177
|
-
function customEncodeFormAction(proxy, identifierPrefix, encodeFormAction) {
|
1178
|
-
var reference = knownServerReferences.get(proxy);
|
1179
|
-
|
1180
|
-
if (!reference) {
|
1181
|
-
throw new Error('Tried to encode a Server Action from a different instance than the encoder is from. ' + 'This is a bug in React.');
|
1182
|
-
}
|
1183
|
-
|
1184
|
-
var boundPromise = reference.bound;
|
1185
|
-
|
1186
|
-
if (boundPromise === null) {
|
1187
|
-
boundPromise = Promise.resolve([]);
|
1188
|
-
}
|
1189
|
-
|
1190
|
-
return encodeFormAction(reference.id, boundPromise);
|
1191
|
-
}
|
1192
|
-
|
1193
1116
|
function isSignatureEqual(referenceId, numberOfBoundArgs) {
|
1194
1117
|
var reference = knownServerReferences.get(this);
|
1195
1118
|
|
@@ -1251,17 +1174,14 @@ function isSignatureEqual(referenceId, numberOfBoundArgs) {
|
|
1251
1174
|
}
|
1252
1175
|
}
|
1253
1176
|
|
1254
|
-
function registerServerReference(proxy, reference
|
1177
|
+
function registerServerReference(proxy, reference) {
|
1255
1178
|
// Expose encoder for use by SSR, as well as a special bind that can be used to
|
1256
1179
|
// keep server capabilities.
|
1257
1180
|
{
|
1258
1181
|
// Only expose this in builds that would actually use it. Not needed on the client.
|
1259
|
-
var $$FORM_ACTION = encodeFormAction === undefined ? defaultEncodeFormAction : function (identifierPrefix) {
|
1260
|
-
return customEncodeFormAction(this, identifierPrefix, encodeFormAction);
|
1261
|
-
};
|
1262
1182
|
Object.defineProperties(proxy, {
|
1263
1183
|
$$FORM_ACTION: {
|
1264
|
-
value:
|
1184
|
+
value: encodeFormAction
|
1265
1185
|
},
|
1266
1186
|
$$IS_SIGNATURE_EQUAL: {
|
1267
1187
|
value: isSignatureEqual
|
@@ -1285,17 +1205,6 @@ function bind() {
|
|
1285
1205
|
var reference = knownServerReferences.get(this);
|
1286
1206
|
|
1287
1207
|
if (reference) {
|
1288
|
-
{
|
1289
|
-
var thisBind = arguments[0];
|
1290
|
-
|
1291
|
-
if (thisBind != null) {
|
1292
|
-
// This doesn't warn in browser environments since it's not instrumented outside
|
1293
|
-
// usedWithSSR. This makes this an SSR only warning which we don't generally do.
|
1294
|
-
// TODO: Consider a DEV only instrumentation in the browser.
|
1295
|
-
error('Cannot bind "this" of a Server Action. Pass null or undefined as the first argument to .bind().');
|
1296
|
-
}
|
1297
|
-
}
|
1298
|
-
|
1299
1208
|
var args = ArraySlice.call(arguments, 1);
|
1300
1209
|
var boundPromise = null;
|
1301
1210
|
|
@@ -1305,26 +1214,9 @@ function bind() {
|
|
1305
1214
|
});
|
1306
1215
|
} else {
|
1307
1216
|
boundPromise = Promise.resolve(args);
|
1308
|
-
} // Expose encoder for use by SSR, as well as a special bind that can be used to
|
1309
|
-
// keep server capabilities.
|
1310
|
-
|
1311
|
-
|
1312
|
-
{
|
1313
|
-
// Only expose this in builds that would actually use it. Not needed on the client.
|
1314
|
-
Object.defineProperties(newFn, {
|
1315
|
-
$$FORM_ACTION: {
|
1316
|
-
value: this.$$FORM_ACTION
|
1317
|
-
},
|
1318
|
-
$$IS_SIGNATURE_EQUAL: {
|
1319
|
-
value: isSignatureEqual
|
1320
|
-
},
|
1321
|
-
bind: {
|
1322
|
-
value: bind
|
1323
|
-
}
|
1324
|
-
});
|
1325
1217
|
}
|
1326
1218
|
|
1327
|
-
|
1219
|
+
registerServerReference(newFn, {
|
1328
1220
|
id: reference.id,
|
1329
1221
|
bound: boundPromise
|
1330
1222
|
});
|
@@ -1333,7 +1225,7 @@ function bind() {
|
|
1333
1225
|
return newFn;
|
1334
1226
|
}
|
1335
1227
|
|
1336
|
-
function createServerReference$1(id, callServer
|
1228
|
+
function createServerReference$1(id, callServer) {
|
1337
1229
|
var proxy = function () {
|
1338
1230
|
// $FlowFixMe[method-unbinding]
|
1339
1231
|
var args = Array.prototype.slice.call(arguments);
|
@@ -1343,10 +1235,61 @@ function createServerReference$1(id, callServer, encodeFormAction) {
|
|
1343
1235
|
registerServerReference(proxy, {
|
1344
1236
|
id: id,
|
1345
1237
|
bound: null
|
1346
|
-
}
|
1238
|
+
});
|
1347
1239
|
return proxy;
|
1348
1240
|
}
|
1349
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
|
+
|
1350
1293
|
var ROW_ID = 0;
|
1351
1294
|
var ROW_TAG = 1;
|
1352
1295
|
var ROW_LENGTH = 2;
|
@@ -1365,10 +1308,6 @@ function Chunk(status, value, reason, response) {
|
|
1365
1308
|
this.value = value;
|
1366
1309
|
this.reason = reason;
|
1367
1310
|
this._response = response;
|
1368
|
-
|
1369
|
-
{
|
1370
|
-
this._debugInfo = null;
|
1371
|
-
}
|
1372
1311
|
} // We subclass Promise.prototype so that we get other methods like .catch
|
1373
1312
|
|
1374
1313
|
|
@@ -1645,20 +1584,17 @@ function reportGlobalError(response, error) {
|
|
1645
1584
|
}
|
1646
1585
|
|
1647
1586
|
function createElement(type, key, props) {
|
1648
|
-
var element
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
_owner: null
|
1660
|
-
};
|
1661
|
-
}
|
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
|
+
};
|
1662
1598
|
|
1663
1599
|
{
|
1664
1600
|
// We don't really need to add any of these but keeping them for good measure.
|
@@ -1671,12 +1607,17 @@ function createElement(type, key, props) {
|
|
1671
1607
|
writable: true,
|
1672
1608
|
value: true // This element has already been validated on the server.
|
1673
1609
|
|
1674
|
-
});
|
1675
|
-
|
1676
|
-
Object.defineProperty(element, '_debugInfo', {
|
1610
|
+
});
|
1611
|
+
Object.defineProperty(element, '_self', {
|
1677
1612
|
configurable: false,
|
1678
1613
|
enumerable: false,
|
1679
|
-
writable:
|
1614
|
+
writable: false,
|
1615
|
+
value: null
|
1616
|
+
});
|
1617
|
+
Object.defineProperty(element, '_source', {
|
1618
|
+
configurable: false,
|
1619
|
+
enumerable: false,
|
1620
|
+
writable: false,
|
1680
1621
|
value: null
|
1681
1622
|
});
|
1682
1623
|
}
|
@@ -1690,13 +1631,6 @@ function createLazyChunkWrapper(chunk) {
|
|
1690
1631
|
_payload: chunk,
|
1691
1632
|
_init: readChunk
|
1692
1633
|
};
|
1693
|
-
|
1694
|
-
{
|
1695
|
-
// Ensure we have a live array to track future debug info.
|
1696
|
-
var chunkDebugInfo = chunk._debugInfo || (chunk._debugInfo = []);
|
1697
|
-
lazyType._debugInfo = chunkDebugInfo;
|
1698
|
-
}
|
1699
|
-
|
1700
1634
|
return lazyType;
|
1701
1635
|
}
|
1702
1636
|
|
@@ -1779,7 +1713,7 @@ function createServerReferenceProxy(response, metaData) {
|
|
1779
1713
|
});
|
1780
1714
|
};
|
1781
1715
|
|
1782
|
-
registerServerReference(proxy, metaData
|
1716
|
+
registerServerReference(proxy, metaData);
|
1783
1717
|
return proxy;
|
1784
1718
|
}
|
1785
1719
|
|
@@ -1832,11 +1766,6 @@ function parseModelString(response, parentObject, key, value) {
|
|
1832
1766
|
case '@':
|
1833
1767
|
{
|
1834
1768
|
// Promise
|
1835
|
-
if (value.length === 2) {
|
1836
|
-
// Infinite promise that never resolves.
|
1837
|
-
return new Promise(function () {});
|
1838
|
-
}
|
1839
|
-
|
1840
1769
|
var _id = parseInt(value.slice(2), 16);
|
1841
1770
|
|
1842
1771
|
var _chunk = getChunk(response, _id);
|
@@ -1850,6 +1779,12 @@ function parseModelString(response, parentObject, key, value) {
|
|
1850
1779
|
return Symbol.for(value.slice(2));
|
1851
1780
|
}
|
1852
1781
|
|
1782
|
+
case 'P':
|
1783
|
+
{
|
1784
|
+
// Server Context Provider
|
1785
|
+
return getOrCreateServerContext(value.slice(2)).Provider;
|
1786
|
+
}
|
1787
|
+
|
1853
1788
|
case 'F':
|
1854
1789
|
{
|
1855
1790
|
// Server Reference
|
@@ -1919,23 +1854,6 @@ function parseModelString(response, parentObject, key, value) {
|
|
1919
1854
|
return BigInt(value.slice(2));
|
1920
1855
|
}
|
1921
1856
|
|
1922
|
-
case 'E':
|
1923
|
-
{
|
1924
|
-
{
|
1925
|
-
// In DEV mode we allow indirect eval to produce functions for logging.
|
1926
|
-
// This should not compile to eval() because then it has local scope access.
|
1927
|
-
try {
|
1928
|
-
// eslint-disable-next-line no-eval
|
1929
|
-
return (0, eval)(value.slice(2));
|
1930
|
-
} catch (x) {
|
1931
|
-
// We currently use this to express functions so we fail parsing it,
|
1932
|
-
// let's just return a blank function as a place holder.
|
1933
|
-
return function () {};
|
1934
|
-
}
|
1935
|
-
} // Fallthrough
|
1936
|
-
|
1937
|
-
}
|
1938
|
-
|
1939
1857
|
default:
|
1940
1858
|
{
|
1941
1859
|
// We assume that anything else is a reference ID.
|
@@ -1956,29 +1874,7 @@ function parseModelString(response, parentObject, key, value) {
|
|
1956
1874
|
|
1957
1875
|
switch (_chunk2.status) {
|
1958
1876
|
case INITIALIZED:
|
1959
|
-
|
1960
|
-
|
1961
|
-
if (_chunk2._debugInfo) {
|
1962
|
-
// If we have a direct reference to an object that was rendered by a synchronous
|
1963
|
-
// server component, it might have some debug info about how it was rendered.
|
1964
|
-
// We forward this to the underlying object. This might be a React Element or
|
1965
|
-
// an Array fragment.
|
1966
|
-
// If this was a string / number return value we lose the debug info. We choose
|
1967
|
-
// that tradeoff to allow sync server components to return plain values and not
|
1968
|
-
// use them as React Nodes necessarily. We could otherwise wrap them in a Lazy.
|
1969
|
-
if (typeof chunkValue === 'object' && chunkValue !== null && (Array.isArray(chunkValue) || chunkValue.$$typeof === REACT_ELEMENT_TYPE) && !chunkValue._debugInfo) {
|
1970
|
-
// We should maybe use a unique symbol for arrays but this is a React owned array.
|
1971
|
-
// $FlowFixMe[prop-missing]: This should be added to elements.
|
1972
|
-
Object.defineProperty(chunkValue, '_debugInfo', {
|
1973
|
-
configurable: false,
|
1974
|
-
enumerable: false,
|
1975
|
-
writable: true,
|
1976
|
-
value: _chunk2._debugInfo
|
1977
|
-
});
|
1978
|
-
}
|
1979
|
-
}
|
1980
|
-
|
1981
|
-
return chunkValue;
|
1877
|
+
return _chunk2.value;
|
1982
1878
|
|
1983
1879
|
case PENDING:
|
1984
1880
|
case BLOCKED:
|
@@ -2015,13 +1911,12 @@ function missingCall() {
|
|
2015
1911
|
throw new Error('Trying to call a function from "use server" but the callServer option ' + 'was not implemented in your router runtime.');
|
2016
1912
|
}
|
2017
1913
|
|
2018
|
-
function createResponse(bundlerConfig, moduleLoading, callServer,
|
1914
|
+
function createResponse(bundlerConfig, moduleLoading, callServer, nonce) {
|
2019
1915
|
var chunks = new Map();
|
2020
1916
|
var response = {
|
2021
1917
|
_bundlerConfig: bundlerConfig,
|
2022
1918
|
_moduleLoading: moduleLoading,
|
2023
1919
|
_callServer: callServer !== undefined ? callServer : missingCall,
|
2024
|
-
_encodeFormAction: encodeFormAction,
|
2025
1920
|
_nonce: nonce,
|
2026
1921
|
_chunks: chunks,
|
2027
1922
|
_stringDecoder: createStringDecoder(),
|
@@ -2119,24 +2014,6 @@ function resolveHint(response, code, model) {
|
|
2119
2014
|
dispatchHint(code, hintModel);
|
2120
2015
|
}
|
2121
2016
|
|
2122
|
-
function resolveDebugInfo(response, id, debugInfo) {
|
2123
|
-
|
2124
|
-
var chunk = getChunk(response, id);
|
2125
|
-
var chunkDebugInfo = chunk._debugInfo || (chunk._debugInfo = []);
|
2126
|
-
chunkDebugInfo.push(debugInfo);
|
2127
|
-
}
|
2128
|
-
|
2129
|
-
function resolveConsoleEntry(response, value) {
|
2130
|
-
|
2131
|
-
var payload = parseModel(response, value);
|
2132
|
-
var methodName = payload[0]; // TODO: Restore the fake stack before logging.
|
2133
|
-
// const stackTrace = payload[1];
|
2134
|
-
|
2135
|
-
var env = payload[2];
|
2136
|
-
var args = payload.slice(3);
|
2137
|
-
printToConsole(methodName, args, env);
|
2138
|
-
}
|
2139
|
-
|
2140
2017
|
function processFullRow(response, id, tag, buffer, chunk) {
|
2141
2018
|
|
2142
2019
|
var stringDecoder = response._stringDecoder;
|
@@ -2187,28 +2064,6 @@ function processFullRow(response, id, tag, buffer, chunk) {
|
|
2187
2064
|
return;
|
2188
2065
|
}
|
2189
2066
|
|
2190
|
-
case 68
|
2191
|
-
/* "D" */
|
2192
|
-
:
|
2193
|
-
{
|
2194
|
-
{
|
2195
|
-
var debugInfo = JSON.parse(row);
|
2196
|
-
resolveDebugInfo(response, id, debugInfo);
|
2197
|
-
return;
|
2198
|
-
} // Fallthrough to share the error with Console entries.
|
2199
|
-
|
2200
|
-
}
|
2201
|
-
|
2202
|
-
case 87
|
2203
|
-
/* "W" */
|
2204
|
-
:
|
2205
|
-
{
|
2206
|
-
{
|
2207
|
-
resolveConsoleEntry(response, row);
|
2208
|
-
return;
|
2209
|
-
}
|
2210
|
-
}
|
2211
|
-
|
2212
2067
|
case 80
|
2213
2068
|
/* "P" */
|
2214
2069
|
:
|
@@ -2394,7 +2249,7 @@ function createServerReference(id, callServer) {
|
|
2394
2249
|
}
|
2395
2250
|
|
2396
2251
|
function createFromNodeStream(stream, ssrManifest, options) {
|
2397
|
-
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);
|
2398
2253
|
stream.on('data', function (chunk) {
|
2399
2254
|
processBinaryChunk(response, chunk);
|
2400
2255
|
});
|