react-server-dom-webpack 19.0.0-beta-04b058868c-20240508 → 19.0.0-beta-9d76c954cf-20240510
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 +933 -63
- package/cjs/react-server-dom-webpack-client.browser.production.js +715 -217
- package/cjs/react-server-dom-webpack-client.edge.development.js +933 -63
- package/cjs/react-server-dom-webpack-client.edge.production.js +715 -217
- package/cjs/react-server-dom-webpack-client.node.development.js +932 -62
- package/cjs/react-server-dom-webpack-client.node.production.js +700 -207
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +932 -62
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +700 -207
- package/cjs/react-server-dom-webpack-server.browser.development.js +1279 -199
- package/cjs/react-server-dom-webpack-server.browser.production.js +808 -162
- package/cjs/react-server-dom-webpack-server.edge.development.js +1280 -200
- package/cjs/react-server-dom-webpack-server.edge.production.js +808 -162
- package/cjs/react-server-dom-webpack-server.node.development.js +1235 -204
- package/cjs/react-server-dom-webpack-server.node.production.js +803 -183
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +1235 -204
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +803 -183
- package/package.json +3 -3
@@ -385,10 +385,6 @@ var requestStorage = new async_hooks.AsyncLocalStorage(),
|
|
385
385
|
switch (name) {
|
386
386
|
case "$$typeof":
|
387
387
|
return target.$$typeof;
|
388
|
-
case "$$id":
|
389
|
-
return target.$$id;
|
390
|
-
case "$$async":
|
391
|
-
return target.$$async;
|
392
388
|
case "name":
|
393
389
|
return;
|
394
390
|
case "displayName":
|
@@ -418,18 +414,21 @@ var requestStorage = new async_hooks.AsyncLocalStorage(),
|
|
418
414
|
);
|
419
415
|
}
|
420
416
|
};
|
421
|
-
function createTemporaryReference(id) {
|
422
|
-
|
417
|
+
function createTemporaryReference(temporaryReferences, id) {
|
418
|
+
var reference = Object.defineProperties(
|
423
419
|
function () {
|
424
420
|
throw Error(
|
425
421
|
"Attempted to call a temporary Client Reference from the server but it is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
|
426
422
|
);
|
427
423
|
},
|
428
|
-
{ $$typeof: { value: TEMPORARY_REFERENCE_TAG }
|
424
|
+
{ $$typeof: { value: TEMPORARY_REFERENCE_TAG } }
|
429
425
|
);
|
430
|
-
|
426
|
+
reference = new Proxy(reference, proxyHandlers);
|
427
|
+
temporaryReferences.set(reference, id);
|
428
|
+
return reference;
|
431
429
|
}
|
432
|
-
var
|
430
|
+
var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
|
431
|
+
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
433
432
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
434
433
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
435
434
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
@@ -447,9 +446,10 @@ function getIteratorFn(maybeIterable) {
|
|
447
446
|
maybeIterable["@@iterator"];
|
448
447
|
return "function" === typeof maybeIterable ? maybeIterable : null;
|
449
448
|
}
|
450
|
-
var
|
451
|
-
|
452
|
-
|
449
|
+
var ASYNC_ITERATOR = Symbol.asyncIterator,
|
450
|
+
SuspenseException = Error(
|
451
|
+
"Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`"
|
452
|
+
);
|
453
453
|
function noop() {}
|
454
454
|
function trackUsedThenable(thenableState, thenable, index) {
|
455
455
|
index = thenableState[index];
|
@@ -717,7 +717,9 @@ function createRequest(
|
|
717
717
|
bundlerConfig,
|
718
718
|
onError,
|
719
719
|
identifierPrefix,
|
720
|
-
onPostpone
|
720
|
+
onPostpone,
|
721
|
+
environmentName,
|
722
|
+
temporaryReferences
|
721
723
|
) {
|
722
724
|
if (
|
723
725
|
null !== ReactSharedInternalsServer.A &&
|
@@ -725,9 +727,9 @@ function createRequest(
|
|
725
727
|
)
|
726
728
|
throw Error("Currently React only supports one RSC renderer at a time.");
|
727
729
|
ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
|
728
|
-
var abortSet = new Set()
|
729
|
-
|
730
|
-
|
730
|
+
var abortSet = new Set();
|
731
|
+
environmentName = [];
|
732
|
+
var hints = new Set();
|
731
733
|
bundlerConfig = {
|
732
734
|
status: 0,
|
733
735
|
flushScheduled: !1,
|
@@ -740,7 +742,7 @@ function createRequest(
|
|
740
742
|
hints: hints,
|
741
743
|
abortListeners: new Set(),
|
742
744
|
abortableTasks: abortSet,
|
743
|
-
pingedTasks:
|
745
|
+
pingedTasks: environmentName,
|
744
746
|
completedImportChunks: [],
|
745
747
|
completedHintChunks: [],
|
746
748
|
completedRegularChunks: [],
|
@@ -749,6 +751,7 @@ function createRequest(
|
|
749
751
|
writtenClientReferences: new Map(),
|
750
752
|
writtenServerReferences: new Map(),
|
751
753
|
writtenObjects: new WeakMap(),
|
754
|
+
temporaryReferences: temporaryReferences,
|
752
755
|
identifierPrefix: identifierPrefix || "",
|
753
756
|
identifierCount: 1,
|
754
757
|
taintCleanupQueue: [],
|
@@ -756,7 +759,7 @@ function createRequest(
|
|
756
759
|
onPostpone: void 0 === onPostpone ? defaultPostponeHandler : onPostpone
|
757
760
|
};
|
758
761
|
model = createTask(bundlerConfig, model, null, !1, abortSet);
|
759
|
-
|
762
|
+
environmentName.push(model);
|
760
763
|
return bundlerConfig;
|
761
764
|
}
|
762
765
|
var currentRequest = null;
|
@@ -814,6 +817,121 @@ function serializeThenable(request, task, thenable) {
|
|
814
817
|
);
|
815
818
|
return newTask.id;
|
816
819
|
}
|
820
|
+
function serializeReadableStream(request, task, stream) {
|
821
|
+
function progress(entry) {
|
822
|
+
if (!aborted)
|
823
|
+
if (entry.done)
|
824
|
+
request.abortListeners.delete(error),
|
825
|
+
(entry = streamTask.id.toString(16) + ":C\n"),
|
826
|
+
request.completedRegularChunks.push(entry),
|
827
|
+
enqueueFlush(request),
|
828
|
+
(aborted = !0);
|
829
|
+
else
|
830
|
+
try {
|
831
|
+
(streamTask.model = entry.value),
|
832
|
+
request.pendingChunks++,
|
833
|
+
emitChunk(request, streamTask, streamTask.model),
|
834
|
+
enqueueFlush(request),
|
835
|
+
reader.read().then(progress, error);
|
836
|
+
} catch (x$8) {
|
837
|
+
error(x$8);
|
838
|
+
}
|
839
|
+
}
|
840
|
+
function error(reason) {
|
841
|
+
if (!aborted) {
|
842
|
+
aborted = !0;
|
843
|
+
request.abortListeners.delete(error);
|
844
|
+
var digest = logRecoverableError(request, reason);
|
845
|
+
emitErrorChunk(request, streamTask.id, digest);
|
846
|
+
enqueueFlush(request);
|
847
|
+
reader.cancel(reason).then(error, error);
|
848
|
+
}
|
849
|
+
}
|
850
|
+
var supportsBYOB = stream.supportsBYOB;
|
851
|
+
if (void 0 === supportsBYOB)
|
852
|
+
try {
|
853
|
+
stream.getReader({ mode: "byob" }).releaseLock(), (supportsBYOB = !0);
|
854
|
+
} catch (x) {
|
855
|
+
supportsBYOB = !1;
|
856
|
+
}
|
857
|
+
var reader = stream.getReader(),
|
858
|
+
streamTask = createTask(
|
859
|
+
request,
|
860
|
+
task.model,
|
861
|
+
task.keyPath,
|
862
|
+
task.implicitSlot,
|
863
|
+
request.abortableTasks
|
864
|
+
);
|
865
|
+
request.abortableTasks.delete(streamTask);
|
866
|
+
request.pendingChunks++;
|
867
|
+
task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
|
868
|
+
request.completedRegularChunks.push(task);
|
869
|
+
var aborted = !1;
|
870
|
+
request.abortListeners.add(error);
|
871
|
+
reader.read().then(progress, error);
|
872
|
+
return serializeByValueID(streamTask.id);
|
873
|
+
}
|
874
|
+
function serializeAsyncIterable(request, task, iterable, iterator) {
|
875
|
+
function progress(entry) {
|
876
|
+
if (!aborted)
|
877
|
+
if (entry.done) {
|
878
|
+
request.abortListeners.delete(error);
|
879
|
+
if (void 0 === entry.value)
|
880
|
+
var endStreamRow = streamTask.id.toString(16) + ":C\n";
|
881
|
+
else
|
882
|
+
try {
|
883
|
+
var chunkId = outlineModel(request, entry.value);
|
884
|
+
endStreamRow =
|
885
|
+
streamTask.id.toString(16) +
|
886
|
+
":C" +
|
887
|
+
stringify(serializeByValueID(chunkId)) +
|
888
|
+
"\n";
|
889
|
+
} catch (x) {
|
890
|
+
error(x);
|
891
|
+
return;
|
892
|
+
}
|
893
|
+
request.completedRegularChunks.push(endStreamRow);
|
894
|
+
enqueueFlush(request);
|
895
|
+
aborted = !0;
|
896
|
+
} else
|
897
|
+
try {
|
898
|
+
(streamTask.model = entry.value),
|
899
|
+
request.pendingChunks++,
|
900
|
+
emitChunk(request, streamTask, streamTask.model),
|
901
|
+
enqueueFlush(request),
|
902
|
+
iterator.next().then(progress, error);
|
903
|
+
} catch (x$9) {
|
904
|
+
error(x$9);
|
905
|
+
}
|
906
|
+
}
|
907
|
+
function error(reason) {
|
908
|
+
if (!aborted) {
|
909
|
+
aborted = !0;
|
910
|
+
request.abortListeners.delete(error);
|
911
|
+
var digest = logRecoverableError(request, reason);
|
912
|
+
emitErrorChunk(request, streamTask.id, digest);
|
913
|
+
enqueueFlush(request);
|
914
|
+
"function" === typeof iterator.throw &&
|
915
|
+
iterator.throw(reason).then(error, error);
|
916
|
+
}
|
917
|
+
}
|
918
|
+
iterable = iterable === iterator;
|
919
|
+
var streamTask = createTask(
|
920
|
+
request,
|
921
|
+
task.model,
|
922
|
+
task.keyPath,
|
923
|
+
task.implicitSlot,
|
924
|
+
request.abortableTasks
|
925
|
+
);
|
926
|
+
request.abortableTasks.delete(streamTask);
|
927
|
+
request.pendingChunks++;
|
928
|
+
task = streamTask.id.toString(16) + ":" + (iterable ? "x" : "X") + "\n";
|
929
|
+
request.completedRegularChunks.push(task);
|
930
|
+
var aborted = !1;
|
931
|
+
request.abortListeners.add(error);
|
932
|
+
iterator.next().then(progress, error);
|
933
|
+
return serializeByValueID(streamTask.id);
|
934
|
+
}
|
817
935
|
function emitHint(request, code, model) {
|
818
936
|
model = stringify(model);
|
819
937
|
var id = request.nextChunkId++;
|
@@ -870,6 +988,20 @@ function renderFunctionComponent(request, task, key, Component, props) {
|
|
870
988
|
return iteratorFn.call(iterableChild);
|
871
989
|
}),
|
872
990
|
Component);
|
991
|
+
} else if (
|
992
|
+
!(
|
993
|
+
"function" !== typeof Component[ASYNC_ITERATOR] ||
|
994
|
+
("function" === typeof ReadableStream &&
|
995
|
+
Component instanceof ReadableStream)
|
996
|
+
)
|
997
|
+
) {
|
998
|
+
var iterableChild$10 = Component;
|
999
|
+
Component = {};
|
1000
|
+
Component =
|
1001
|
+
((Component[ASYNC_ITERATOR] = function () {
|
1002
|
+
return iterableChild$10[ASYNC_ITERATOR]();
|
1003
|
+
}),
|
1004
|
+
Component);
|
873
1005
|
}
|
874
1006
|
}
|
875
1007
|
props = task.keyPath;
|
@@ -961,7 +1093,7 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
|
961
1093
|
null === model ||
|
962
1094
|
null !== keyPath ||
|
963
1095
|
implicitSlot ||
|
964
|
-
request.writtenObjects.set(model, id);
|
1096
|
+
request.writtenObjects.set(model, serializeByValueID(id));
|
965
1097
|
var task = {
|
966
1098
|
id: id,
|
967
1099
|
status: 0,
|
@@ -1104,6 +1236,43 @@ function outlineModel(request, value) {
|
|
1104
1236
|
retryTask(request, value);
|
1105
1237
|
return value.id;
|
1106
1238
|
}
|
1239
|
+
function serializeTypedArray(request, tag, typedArray) {
|
1240
|
+
request.pendingChunks++;
|
1241
|
+
var bufferId = request.nextChunkId++;
|
1242
|
+
emitTypedArrayChunk(request, bufferId, tag, typedArray);
|
1243
|
+
return serializeByValueID(bufferId);
|
1244
|
+
}
|
1245
|
+
function serializeBlob(request, blob) {
|
1246
|
+
function progress(entry) {
|
1247
|
+
if (!aborted)
|
1248
|
+
if (entry.done)
|
1249
|
+
request.abortListeners.delete(error),
|
1250
|
+
(aborted = !0),
|
1251
|
+
pingTask(request, newTask);
|
1252
|
+
else
|
1253
|
+
return (
|
1254
|
+
model.push(entry.value), reader.read().then(progress).catch(error)
|
1255
|
+
);
|
1256
|
+
}
|
1257
|
+
function error(reason) {
|
1258
|
+
if (!aborted) {
|
1259
|
+
aborted = !0;
|
1260
|
+
request.abortListeners.delete(error);
|
1261
|
+
var digest = logRecoverableError(request, reason);
|
1262
|
+
emitErrorChunk(request, newTask.id, digest);
|
1263
|
+
request.abortableTasks.delete(newTask);
|
1264
|
+
enqueueFlush(request);
|
1265
|
+
reader.cancel(reason).then(error, error);
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
var model = [blob.type],
|
1269
|
+
newTask = createTask(request, model, null, !1, request.abortableTasks),
|
1270
|
+
reader = blob.stream().getReader(),
|
1271
|
+
aborted = !1;
|
1272
|
+
request.abortListeners.add(error);
|
1273
|
+
reader.read().then(progress).catch(error);
|
1274
|
+
return "$B" + newTask.id.toString(16);
|
1275
|
+
}
|
1107
1276
|
var modelRoot = !1;
|
1108
1277
|
function renderModelDestructive(
|
1109
1278
|
request,
|
@@ -1118,34 +1287,39 @@ function renderModelDestructive(
|
|
1118
1287
|
if ("object" === typeof value) {
|
1119
1288
|
switch (value.$$typeof) {
|
1120
1289
|
case REACT_ELEMENT_TYPE:
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
if (
|
1290
|
+
var writtenObjects = request.writtenObjects;
|
1291
|
+
if (null === task.keyPath && !task.implicitSlot) {
|
1292
|
+
var existingReference = writtenObjects.get(value);
|
1293
|
+
if (void 0 !== existingReference)
|
1125
1294
|
if (modelRoot === value) modelRoot = null;
|
1126
|
-
else
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
parentPropertyName =
|
1295
|
+
else return existingReference;
|
1296
|
+
else
|
1297
|
+
-1 === parentPropertyName.indexOf(":") &&
|
1298
|
+
((parent = writtenObjects.get(parent)),
|
1299
|
+
void 0 !== parent &&
|
1300
|
+
writtenObjects.set(value, parent + ":" + parentPropertyName));
|
1301
|
+
}
|
1302
|
+
parentPropertyName = value.props;
|
1303
|
+
parent = parentPropertyName.ref;
|
1134
1304
|
return renderElement(
|
1135
1305
|
request,
|
1136
1306
|
task,
|
1137
1307
|
value.type,
|
1138
1308
|
value.key,
|
1139
|
-
void 0 !==
|
1140
|
-
|
1309
|
+
void 0 !== parent ? parent : null,
|
1310
|
+
parentPropertyName
|
1141
1311
|
);
|
1142
1312
|
case REACT_LAZY_TYPE:
|
1143
1313
|
return (
|
1144
1314
|
(task.thenableState = null),
|
1145
|
-
(
|
1146
|
-
(value =
|
1315
|
+
(parentPropertyName = value._init),
|
1316
|
+
(value = parentPropertyName(value._payload)),
|
1147
1317
|
renderModelDestructive(request, task, emptyRoot, "", value)
|
1148
1318
|
);
|
1319
|
+
case REACT_LEGACY_ELEMENT_TYPE:
|
1320
|
+
throw Error(
|
1321
|
+
'A React Element from an older version of React was rendered. This is not supported. It can happen if:\n- Multiple copies of the "react" package is used.\n- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n- A compiler tries to "inline" JSX instead of using the runtime.'
|
1322
|
+
);
|
1149
1323
|
}
|
1150
1324
|
if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
|
1151
1325
|
return serializeClientReference(
|
@@ -1154,65 +1328,120 @@ function renderModelDestructive(
|
|
1154
1328
|
parentPropertyName,
|
1155
1329
|
value
|
1156
1330
|
);
|
1157
|
-
|
1158
|
-
|
1331
|
+
if (
|
1332
|
+
void 0 !== request.temporaryReferences &&
|
1333
|
+
((writtenObjects = request.temporaryReferences.get(value)),
|
1334
|
+
void 0 !== writtenObjects)
|
1335
|
+
)
|
1336
|
+
return "$T" + writtenObjects;
|
1337
|
+
writtenObjects = request.writtenObjects;
|
1338
|
+
existingReference = writtenObjects.get(value);
|
1159
1339
|
if ("function" === typeof value.then) {
|
1160
|
-
if (void 0 !==
|
1340
|
+
if (void 0 !== existingReference) {
|
1161
1341
|
if (null !== task.keyPath || task.implicitSlot)
|
1162
1342
|
return "$@" + serializeThenable(request, task, value).toString(16);
|
1163
1343
|
if (modelRoot === value) modelRoot = null;
|
1164
|
-
else return
|
1344
|
+
else return existingReference;
|
1165
1345
|
}
|
1166
|
-
request = serializeThenable(request, task, value);
|
1167
|
-
|
1168
|
-
return
|
1346
|
+
request = "$@" + serializeThenable(request, task, value).toString(16);
|
1347
|
+
writtenObjects.set(value, request);
|
1348
|
+
return request;
|
1169
1349
|
}
|
1170
|
-
if (void 0 !==
|
1350
|
+
if (void 0 !== existingReference)
|
1171
1351
|
if (modelRoot === value) modelRoot = null;
|
1172
|
-
else
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
"
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
parentPropertyName.set(parent, -1));
|
1192
|
-
return "$Q" + outlineModel(request, value).toString(16);
|
1193
|
-
}
|
1194
|
-
if (value instanceof Set) {
|
1195
|
-
value = Array.from(value);
|
1196
|
-
for (task = 0; task < value.length; task++)
|
1197
|
-
(parent = value[task]),
|
1198
|
-
"object" === typeof parent &&
|
1199
|
-
null !== parent &&
|
1200
|
-
((parentPropertyName = request.writtenObjects),
|
1201
|
-
void 0 === parentPropertyName.get(parent) &&
|
1202
|
-
parentPropertyName.set(parent, -1));
|
1203
|
-
return "$W" + outlineModel(request, value).toString(16);
|
1352
|
+
else return existingReference;
|
1353
|
+
else if (
|
1354
|
+
-1 === parentPropertyName.indexOf(":") &&
|
1355
|
+
((existingReference = writtenObjects.get(parent)),
|
1356
|
+
void 0 !== existingReference)
|
1357
|
+
) {
|
1358
|
+
var propertyName = parentPropertyName;
|
1359
|
+
if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
|
1360
|
+
switch (parentPropertyName) {
|
1361
|
+
case "1":
|
1362
|
+
propertyName = "type";
|
1363
|
+
break;
|
1364
|
+
case "2":
|
1365
|
+
propertyName = "key";
|
1366
|
+
break;
|
1367
|
+
case "3":
|
1368
|
+
propertyName = "props";
|
1369
|
+
}
|
1370
|
+
writtenObjects.set(value, existingReference + ":" + propertyName);
|
1204
1371
|
}
|
1372
|
+
if (isArrayImpl(value)) return renderFragment(request, task, value);
|
1373
|
+
if (value instanceof Map)
|
1374
|
+
return (
|
1375
|
+
(value = Array.from(value)),
|
1376
|
+
"$Q" + outlineModel(request, value).toString(16)
|
1377
|
+
);
|
1378
|
+
if (value instanceof Set)
|
1379
|
+
return (
|
1380
|
+
(value = Array.from(value)),
|
1381
|
+
"$W" + outlineModel(request, value).toString(16)
|
1382
|
+
);
|
1205
1383
|
if ("function" === typeof FormData && value instanceof FormData)
|
1206
1384
|
return (
|
1207
1385
|
(value = Array.from(value.entries())),
|
1208
1386
|
"$K" + outlineModel(request, value).toString(16)
|
1209
1387
|
);
|
1210
|
-
if (
|
1388
|
+
if (value instanceof ArrayBuffer)
|
1389
|
+
return serializeTypedArray(request, "A", new Uint8Array(value));
|
1390
|
+
if (value instanceof Int8Array)
|
1391
|
+
return serializeTypedArray(request, "O", value);
|
1392
|
+
if (value instanceof Uint8Array)
|
1393
|
+
return serializeTypedArray(request, "o", value);
|
1394
|
+
if (value instanceof Uint8ClampedArray)
|
1395
|
+
return serializeTypedArray(request, "U", value);
|
1396
|
+
if (value instanceof Int16Array)
|
1397
|
+
return serializeTypedArray(request, "S", value);
|
1398
|
+
if (value instanceof Uint16Array)
|
1399
|
+
return serializeTypedArray(request, "s", value);
|
1400
|
+
if (value instanceof Int32Array)
|
1401
|
+
return serializeTypedArray(request, "L", value);
|
1402
|
+
if (value instanceof Uint32Array)
|
1403
|
+
return serializeTypedArray(request, "l", value);
|
1404
|
+
if (value instanceof Float32Array)
|
1405
|
+
return serializeTypedArray(request, "G", value);
|
1406
|
+
if (value instanceof Float64Array)
|
1407
|
+
return serializeTypedArray(request, "g", value);
|
1408
|
+
if (value instanceof BigInt64Array)
|
1409
|
+
return serializeTypedArray(request, "M", value);
|
1410
|
+
if (value instanceof BigUint64Array)
|
1411
|
+
return serializeTypedArray(request, "m", value);
|
1412
|
+
if (value instanceof DataView)
|
1413
|
+
return serializeTypedArray(request, "V", value);
|
1414
|
+
if ("function" === typeof Blob && value instanceof Blob)
|
1415
|
+
return serializeBlob(request, value);
|
1416
|
+
if ((parentPropertyName = getIteratorFn(value)))
|
1211
1417
|
return (
|
1212
|
-
(
|
1213
|
-
|
1214
|
-
? "$i" +
|
1215
|
-
|
1418
|
+
(parentPropertyName = parentPropertyName.call(value)),
|
1419
|
+
parentPropertyName === value
|
1420
|
+
? "$i" +
|
1421
|
+
outlineModel(request, Array.from(parentPropertyName)).toString(16)
|
1422
|
+
: renderFragment(request, task, Array.from(parentPropertyName))
|
1423
|
+
);
|
1424
|
+
if ("function" === typeof ReadableStream && value instanceof ReadableStream)
|
1425
|
+
return serializeReadableStream(request, task, value);
|
1426
|
+
parentPropertyName = value[ASYNC_ITERATOR];
|
1427
|
+
if ("function" === typeof parentPropertyName)
|
1428
|
+
return (
|
1429
|
+
null !== task.keyPath
|
1430
|
+
? ((request = [
|
1431
|
+
REACT_ELEMENT_TYPE,
|
1432
|
+
REACT_FRAGMENT_TYPE,
|
1433
|
+
task.keyPath,
|
1434
|
+
{ children: value }
|
1435
|
+
]),
|
1436
|
+
(request = task.implicitSlot ? [request] : request))
|
1437
|
+
: ((parentPropertyName = parentPropertyName.call(value)),
|
1438
|
+
(request = serializeAsyncIterable(
|
1439
|
+
request,
|
1440
|
+
task,
|
1441
|
+
value,
|
1442
|
+
parentPropertyName
|
1443
|
+
))),
|
1444
|
+
request
|
1216
1445
|
);
|
1217
1446
|
request = getPrototypeOf(value);
|
1218
1447
|
if (
|
@@ -1263,20 +1492,30 @@ function renderModelDestructive(
|
|
1263
1492
|
if (value.$$typeof === SERVER_REFERENCE_TAG)
|
1264
1493
|
return (
|
1265
1494
|
(task = request.writtenServerReferences),
|
1266
|
-
(
|
1267
|
-
void 0 !==
|
1268
|
-
? (request = "$F" +
|
1269
|
-
: ((
|
1270
|
-
(
|
1495
|
+
(parentPropertyName = task.get(value)),
|
1496
|
+
void 0 !== parentPropertyName
|
1497
|
+
? (request = "$F" + parentPropertyName.toString(16))
|
1498
|
+
: ((parentPropertyName = value.$$bound),
|
1499
|
+
(parentPropertyName = {
|
1271
1500
|
id: value.$$id,
|
1272
|
-
bound:
|
1501
|
+
bound: parentPropertyName
|
1502
|
+
? Promise.resolve(parentPropertyName)
|
1503
|
+
: null
|
1273
1504
|
}),
|
1274
|
-
(request = outlineModel(request,
|
1505
|
+
(request = outlineModel(request, parentPropertyName)),
|
1275
1506
|
task.set(value, request),
|
1276
1507
|
(request = "$F" + request.toString(16))),
|
1277
1508
|
request
|
1278
1509
|
);
|
1279
|
-
if (
|
1510
|
+
if (
|
1511
|
+
void 0 !== request.temporaryReferences &&
|
1512
|
+
((request = request.temporaryReferences.get(value)), void 0 !== request)
|
1513
|
+
)
|
1514
|
+
return "$T" + request;
|
1515
|
+
if (value.$$typeof === TEMPORARY_REFERENCE_TAG)
|
1516
|
+
throw Error(
|
1517
|
+
"Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
|
1518
|
+
);
|
1280
1519
|
if (/^on[A-Z]/.test(parentPropertyName))
|
1281
1520
|
throw Error(
|
1282
1521
|
"Event handlers cannot be passed to Client Component props." +
|
@@ -1290,25 +1529,25 @@ function renderModelDestructive(
|
|
1290
1529
|
}
|
1291
1530
|
if ("symbol" === typeof value) {
|
1292
1531
|
task = request.writtenSymbols;
|
1293
|
-
|
1294
|
-
if (void 0 !==
|
1295
|
-
|
1296
|
-
if (Symbol.for(
|
1532
|
+
writtenObjects = task.get(value);
|
1533
|
+
if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects);
|
1534
|
+
writtenObjects = value.description;
|
1535
|
+
if (Symbol.for(writtenObjects) !== value)
|
1297
1536
|
throw Error(
|
1298
1537
|
"Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
|
1299
1538
|
(value.description + ") cannot be found among global symbols.") +
|
1300
1539
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1301
1540
|
);
|
1302
1541
|
request.pendingChunks++;
|
1303
|
-
|
1304
|
-
|
1542
|
+
parentPropertyName = request.nextChunkId++;
|
1543
|
+
parent = encodeReferenceChunk(
|
1305
1544
|
request,
|
1306
|
-
|
1307
|
-
"$S" +
|
1545
|
+
parentPropertyName,
|
1546
|
+
"$S" + writtenObjects
|
1308
1547
|
);
|
1309
|
-
request.completedImportChunks.push(
|
1310
|
-
task.set(value,
|
1311
|
-
return serializeByValueID(
|
1548
|
+
request.completedImportChunks.push(parent);
|
1549
|
+
task.set(value, parentPropertyName);
|
1550
|
+
return serializeByValueID(parentPropertyName);
|
1312
1551
|
}
|
1313
1552
|
if ("bigint" === typeof value) return "$n" + value.toString(10);
|
1314
1553
|
throw Error(
|
@@ -1344,6 +1583,17 @@ function emitErrorChunk(request, id, digest) {
|
|
1344
1583
|
id = id.toString(16) + ":E" + stringify(digest) + "\n";
|
1345
1584
|
request.completedErrorChunks.push(id);
|
1346
1585
|
}
|
1586
|
+
function emitTypedArrayChunk(request, id, tag, typedArray) {
|
1587
|
+
request.pendingChunks++;
|
1588
|
+
typedArray = new Uint8Array(
|
1589
|
+
typedArray.buffer,
|
1590
|
+
typedArray.byteOffset,
|
1591
|
+
typedArray.byteLength
|
1592
|
+
);
|
1593
|
+
var binaryLength = typedArray.byteLength;
|
1594
|
+
id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ",";
|
1595
|
+
request.completedRegularChunks.push(id, typedArray);
|
1596
|
+
}
|
1347
1597
|
function emitTextChunk(request, id, text) {
|
1348
1598
|
request.pendingChunks++;
|
1349
1599
|
var binaryLength =
|
@@ -1353,6 +1603,40 @@ function emitTextChunk(request, id, text) {
|
|
1353
1603
|
id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
|
1354
1604
|
request.completedRegularChunks.push(id, text);
|
1355
1605
|
}
|
1606
|
+
function emitChunk(request, task, value) {
|
1607
|
+
var id = task.id;
|
1608
|
+
"string" === typeof value
|
1609
|
+
? emitTextChunk(request, id, value)
|
1610
|
+
: value instanceof ArrayBuffer
|
1611
|
+
? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
|
1612
|
+
: value instanceof Int8Array
|
1613
|
+
? emitTypedArrayChunk(request, id, "O", value)
|
1614
|
+
: value instanceof Uint8Array
|
1615
|
+
? emitTypedArrayChunk(request, id, "o", value)
|
1616
|
+
: value instanceof Uint8ClampedArray
|
1617
|
+
? emitTypedArrayChunk(request, id, "U", value)
|
1618
|
+
: value instanceof Int16Array
|
1619
|
+
? emitTypedArrayChunk(request, id, "S", value)
|
1620
|
+
: value instanceof Uint16Array
|
1621
|
+
? emitTypedArrayChunk(request, id, "s", value)
|
1622
|
+
: value instanceof Int32Array
|
1623
|
+
? emitTypedArrayChunk(request, id, "L", value)
|
1624
|
+
: value instanceof Uint32Array
|
1625
|
+
? emitTypedArrayChunk(request, id, "l", value)
|
1626
|
+
: value instanceof Float32Array
|
1627
|
+
? emitTypedArrayChunk(request, id, "G", value)
|
1628
|
+
: value instanceof Float64Array
|
1629
|
+
? emitTypedArrayChunk(request, id, "g", value)
|
1630
|
+
: value instanceof BigInt64Array
|
1631
|
+
? emitTypedArrayChunk(request, id, "M", value)
|
1632
|
+
: value instanceof BigUint64Array
|
1633
|
+
? emitTypedArrayChunk(request, id, "m", value)
|
1634
|
+
: value instanceof DataView
|
1635
|
+
? emitTypedArrayChunk(request, id, "V", value)
|
1636
|
+
: ((value = stringify(value, task.toJSON)),
|
1637
|
+
(task = task.id.toString(16) + ":" + value + "\n"),
|
1638
|
+
request.completedRegularChunks.push(task));
|
1639
|
+
}
|
1356
1640
|
var emptyRoot = {};
|
1357
1641
|
function retryTask(request, task) {
|
1358
1642
|
if (0 === task.status)
|
@@ -1368,20 +1652,13 @@ function retryTask(request, task) {
|
|
1368
1652
|
modelRoot = resolvedModel;
|
1369
1653
|
task.keyPath = null;
|
1370
1654
|
task.implicitSlot = !1;
|
1371
|
-
if ("object" === typeof resolvedModel && null !== resolvedModel)
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
request.completedRegularChunks.push(processedChunk);
|
1379
|
-
}
|
1380
|
-
} else {
|
1381
|
-
var json$jscomp$0 = stringify(resolvedModel),
|
1382
|
-
processedChunk$jscomp$0 =
|
1383
|
-
task.id.toString(16) + ":" + json$jscomp$0 + "\n";
|
1384
|
-
request.completedRegularChunks.push(processedChunk$jscomp$0);
|
1655
|
+
if ("object" === typeof resolvedModel && null !== resolvedModel)
|
1656
|
+
request.writtenObjects.set(resolvedModel, serializeByValueID(task.id)),
|
1657
|
+
emitChunk(request, task, resolvedModel);
|
1658
|
+
else {
|
1659
|
+
var json = stringify(resolvedModel),
|
1660
|
+
processedChunk = task.id.toString(16) + ":" + json + "\n";
|
1661
|
+
request.completedRegularChunks.push(processedChunk);
|
1385
1662
|
}
|
1386
1663
|
request.abortableTasks.delete(task);
|
1387
1664
|
task.status = 1;
|
@@ -1538,19 +1815,19 @@ function abort(request, reason) {
|
|
1538
1815
|
}
|
1539
1816
|
var abortListeners = request.abortListeners;
|
1540
1817
|
if (0 < abortListeners.size) {
|
1541
|
-
var error$
|
1818
|
+
var error$22 =
|
1542
1819
|
void 0 === reason
|
1543
1820
|
? Error("The render was aborted by the server without a reason.")
|
1544
1821
|
: reason;
|
1545
1822
|
abortListeners.forEach(function (callback) {
|
1546
|
-
return callback(error$
|
1823
|
+
return callback(error$22);
|
1547
1824
|
});
|
1548
1825
|
abortListeners.clear();
|
1549
1826
|
}
|
1550
1827
|
null !== request.destination &&
|
1551
1828
|
flushCompletedChunks(request, request.destination);
|
1552
|
-
} catch (error$
|
1553
|
-
logRecoverableError(request, error$
|
1829
|
+
} catch (error$23) {
|
1830
|
+
logRecoverableError(request, error$23), fatalError(request, error$23);
|
1554
1831
|
}
|
1555
1832
|
}
|
1556
1833
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -1594,6 +1871,7 @@ function requireModule(metadata) {
|
|
1594
1871
|
? moduleExports.default
|
1595
1872
|
: moduleExports[metadata.name];
|
1596
1873
|
}
|
1874
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1597
1875
|
function Chunk(status, value, reason, response) {
|
1598
1876
|
this.status = status;
|
1599
1877
|
this.value = value;
|
@@ -1612,6 +1890,7 @@ Chunk.prototype.then = function (resolve, reject) {
|
|
1612
1890
|
break;
|
1613
1891
|
case "pending":
|
1614
1892
|
case "blocked":
|
1893
|
+
case "cyclic":
|
1615
1894
|
resolve &&
|
1616
1895
|
(null === this.value && (this.value = []), this.value.push(resolve));
|
1617
1896
|
reject &&
|
@@ -1621,17 +1900,65 @@ Chunk.prototype.then = function (resolve, reject) {
|
|
1621
1900
|
reject(this.reason);
|
1622
1901
|
}
|
1623
1902
|
};
|
1903
|
+
function createPendingChunk(response) {
|
1904
|
+
return new Chunk("pending", null, null, response);
|
1905
|
+
}
|
1624
1906
|
function wakeChunk(listeners, value) {
|
1625
1907
|
for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
|
1626
1908
|
}
|
1627
1909
|
function triggerErrorOnChunk(chunk, error) {
|
1628
|
-
if ("pending"
|
1910
|
+
if ("pending" !== chunk.status && "blocked" !== chunk.status)
|
1911
|
+
chunk.reason.error(error);
|
1912
|
+
else {
|
1629
1913
|
var listeners = chunk.reason;
|
1630
1914
|
chunk.status = "rejected";
|
1631
1915
|
chunk.reason = error;
|
1632
1916
|
null !== listeners && wakeChunk(listeners, error);
|
1633
1917
|
}
|
1634
1918
|
}
|
1919
|
+
function resolveModelChunk(chunk, value, id) {
|
1920
|
+
if ("pending" !== chunk.status)
|
1921
|
+
(chunk = chunk.reason),
|
1922
|
+
"C" === value[0]
|
1923
|
+
? chunk.close("C" === value ? '"$undefined"' : value.slice(1))
|
1924
|
+
: chunk.enqueueModel(value);
|
1925
|
+
else {
|
1926
|
+
var resolveListeners = chunk.value,
|
1927
|
+
rejectListeners = chunk.reason;
|
1928
|
+
chunk.status = "resolved_model";
|
1929
|
+
chunk.value = value;
|
1930
|
+
chunk.reason = id;
|
1931
|
+
if (null !== resolveListeners)
|
1932
|
+
switch ((initializeModelChunk(chunk), chunk.status)) {
|
1933
|
+
case "fulfilled":
|
1934
|
+
wakeChunk(resolveListeners, chunk.value);
|
1935
|
+
break;
|
1936
|
+
case "pending":
|
1937
|
+
case "blocked":
|
1938
|
+
case "cyclic":
|
1939
|
+
chunk.value = resolveListeners;
|
1940
|
+
chunk.reason = rejectListeners;
|
1941
|
+
break;
|
1942
|
+
case "rejected":
|
1943
|
+
rejectListeners && wakeChunk(rejectListeners, chunk.reason);
|
1944
|
+
}
|
1945
|
+
}
|
1946
|
+
}
|
1947
|
+
function createResolvedIteratorResultChunk(response, value, done) {
|
1948
|
+
return new Chunk(
|
1949
|
+
"resolved_model",
|
1950
|
+
(done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
|
1951
|
+
-1,
|
1952
|
+
response
|
1953
|
+
);
|
1954
|
+
}
|
1955
|
+
function resolveIteratorResultChunk(chunk, value, done) {
|
1956
|
+
resolveModelChunk(
|
1957
|
+
chunk,
|
1958
|
+
(done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
|
1959
|
+
-1
|
1960
|
+
);
|
1961
|
+
}
|
1635
1962
|
function loadServerReference$1(
|
1636
1963
|
response,
|
1637
1964
|
id,
|
@@ -1660,12 +1987,42 @@ function loadServerReference$1(
|
|
1660
1987
|
key,
|
1661
1988
|
!1,
|
1662
1989
|
response,
|
1663
|
-
createModel
|
1990
|
+
createModel,
|
1991
|
+
[]
|
1664
1992
|
),
|
1665
1993
|
createModelReject(parentChunk)
|
1666
1994
|
);
|
1667
1995
|
return null;
|
1668
1996
|
}
|
1997
|
+
function reviveModel(response, parentObj, parentKey, value, reference) {
|
1998
|
+
if ("string" === typeof value)
|
1999
|
+
return parseModelString(response, parentObj, parentKey, value, reference);
|
2000
|
+
if ("object" === typeof value && null !== value)
|
2001
|
+
if (
|
2002
|
+
(void 0 !== reference &&
|
2003
|
+
void 0 !== response._temporaryReferences &&
|
2004
|
+
response._temporaryReferences.set(value, reference),
|
2005
|
+
Array.isArray(value))
|
2006
|
+
)
|
2007
|
+
for (var i = 0; i < value.length; i++)
|
2008
|
+
value[i] = reviveModel(
|
2009
|
+
response,
|
2010
|
+
value,
|
2011
|
+
"" + i,
|
2012
|
+
value[i],
|
2013
|
+
void 0 !== reference ? reference + ":" + i : void 0
|
2014
|
+
);
|
2015
|
+
else
|
2016
|
+
for (i in value)
|
2017
|
+
hasOwnProperty.call(value, i) &&
|
2018
|
+
((parentObj =
|
2019
|
+
void 0 !== reference && -1 === i.indexOf(":")
|
2020
|
+
? reference + ":" + i
|
2021
|
+
: void 0),
|
2022
|
+
(parentObj = reviveModel(response, value, i, value[i], parentObj)),
|
2023
|
+
void 0 !== parentObj ? (value[i] = parentObj) : delete value[i]);
|
2024
|
+
return value;
|
2025
|
+
}
|
1669
2026
|
var initializingChunk = null,
|
1670
2027
|
initializingChunkBlockedModel = null;
|
1671
2028
|
function initializeModelChunk(chunk) {
|
@@ -1673,15 +2030,34 @@ function initializeModelChunk(chunk) {
|
|
1673
2030
|
prevBlocked = initializingChunkBlockedModel;
|
1674
2031
|
initializingChunk = chunk;
|
1675
2032
|
initializingChunkBlockedModel = null;
|
2033
|
+
var rootReference = -1 === chunk.reason ? void 0 : chunk.reason.toString(16),
|
2034
|
+
resolvedModel = chunk.value;
|
2035
|
+
chunk.status = "cyclic";
|
2036
|
+
chunk.value = null;
|
2037
|
+
chunk.reason = null;
|
1676
2038
|
try {
|
1677
|
-
var
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
2039
|
+
var rawModel = JSON.parse(resolvedModel),
|
2040
|
+
value = reviveModel(
|
2041
|
+
chunk._response,
|
2042
|
+
{ "": rawModel },
|
2043
|
+
"",
|
2044
|
+
rawModel,
|
2045
|
+
rootReference
|
2046
|
+
);
|
2047
|
+
if (
|
2048
|
+
null !== initializingChunkBlockedModel &&
|
2049
|
+
0 < initializingChunkBlockedModel.deps
|
2050
|
+
)
|
2051
|
+
(initializingChunkBlockedModel.value = value),
|
1681
2052
|
(chunk.status = "blocked"),
|
1682
2053
|
(chunk.value = null),
|
1683
|
-
(chunk.reason = null)
|
1684
|
-
|
2054
|
+
(chunk.reason = null);
|
2055
|
+
else {
|
2056
|
+
var resolveListeners = chunk.value;
|
2057
|
+
chunk.status = "fulfilled";
|
2058
|
+
chunk.value = value;
|
2059
|
+
null !== resolveListeners && wakeChunk(resolveListeners, value);
|
2060
|
+
}
|
1685
2061
|
} catch (error) {
|
1686
2062
|
(chunk.status = "rejected"), (chunk.reason = error);
|
1687
2063
|
} finally {
|
@@ -1701,12 +2077,20 @@ function getChunk(response, id) {
|
|
1701
2077
|
((chunk = response._formData.get(response._prefix + id)),
|
1702
2078
|
(chunk =
|
1703
2079
|
null != chunk
|
1704
|
-
? new Chunk("resolved_model", chunk,
|
1705
|
-
:
|
2080
|
+
? new Chunk("resolved_model", chunk, id, response)
|
2081
|
+
: createPendingChunk(response)),
|
1706
2082
|
chunks.set(id, chunk));
|
1707
2083
|
return chunk;
|
1708
2084
|
}
|
1709
|
-
function createModelResolver(
|
2085
|
+
function createModelResolver(
|
2086
|
+
chunk,
|
2087
|
+
parentObject,
|
2088
|
+
key,
|
2089
|
+
cyclic,
|
2090
|
+
response,
|
2091
|
+
map,
|
2092
|
+
path
|
2093
|
+
) {
|
1710
2094
|
if (initializingChunkBlockedModel) {
|
1711
2095
|
var blocked = initializingChunkBlockedModel;
|
1712
2096
|
cyclic || blocked.deps++;
|
@@ -1716,6 +2100,7 @@ function createModelResolver(chunk, parentObject, key, cyclic, response, map) {
|
|
1716
2100
|
value: null
|
1717
2101
|
};
|
1718
2102
|
return function (value) {
|
2103
|
+
for (var i = 1; i < path.length; i++) value = value[path[i]];
|
1719
2104
|
parentObject[key] = map(response, value);
|
1720
2105
|
"" === key && null === blocked.value && (blocked.value = parentObject[key]);
|
1721
2106
|
blocked.deps--;
|
@@ -1732,7 +2117,9 @@ function createModelReject(chunk) {
|
|
1732
2117
|
return triggerErrorOnChunk(chunk, error);
|
1733
2118
|
};
|
1734
2119
|
}
|
1735
|
-
function getOutlinedModel(response,
|
2120
|
+
function getOutlinedModel(response, reference, parentObject, key, map) {
|
2121
|
+
reference = reference.split(":");
|
2122
|
+
var id = parseInt(reference[0], 16);
|
1736
2123
|
id = getChunk(response, id);
|
1737
2124
|
switch (id.status) {
|
1738
2125
|
case "resolved_model":
|
@@ -1740,12 +2127,24 @@ function getOutlinedModel(response, id, parentObject, key, map) {
|
|
1740
2127
|
}
|
1741
2128
|
switch (id.status) {
|
1742
2129
|
case "fulfilled":
|
1743
|
-
|
2130
|
+
parentObject = id.value;
|
2131
|
+
for (key = 1; key < reference.length; key++)
|
2132
|
+
parentObject = parentObject[reference[key]];
|
2133
|
+
return map(response, parentObject);
|
1744
2134
|
case "pending":
|
1745
2135
|
case "blocked":
|
2136
|
+
case "cyclic":
|
1746
2137
|
var parentChunk = initializingChunk;
|
1747
2138
|
id.then(
|
1748
|
-
createModelResolver(
|
2139
|
+
createModelResolver(
|
2140
|
+
parentChunk,
|
2141
|
+
parentObject,
|
2142
|
+
key,
|
2143
|
+
"cyclic" === id.status,
|
2144
|
+
response,
|
2145
|
+
map,
|
2146
|
+
reference
|
2147
|
+
),
|
1749
2148
|
createModelReject(parentChunk)
|
1750
2149
|
);
|
1751
2150
|
return null;
|
@@ -1765,7 +2164,193 @@ function extractIterator(response, model) {
|
|
1765
2164
|
function createModel(response, model) {
|
1766
2165
|
return model;
|
1767
2166
|
}
|
1768
|
-
function
|
2167
|
+
function parseTypedArray(
|
2168
|
+
response,
|
2169
|
+
reference,
|
2170
|
+
constructor,
|
2171
|
+
bytesPerElement,
|
2172
|
+
parentObject,
|
2173
|
+
parentKey
|
2174
|
+
) {
|
2175
|
+
reference = parseInt(reference.slice(2), 16);
|
2176
|
+
reference = response._formData.get(response._prefix + reference);
|
2177
|
+
reference =
|
2178
|
+
constructor === ArrayBuffer
|
2179
|
+
? reference.arrayBuffer()
|
2180
|
+
: reference.arrayBuffer().then(function (buffer) {
|
2181
|
+
return new constructor(buffer);
|
2182
|
+
});
|
2183
|
+
bytesPerElement = initializingChunk;
|
2184
|
+
reference.then(
|
2185
|
+
createModelResolver(
|
2186
|
+
bytesPerElement,
|
2187
|
+
parentObject,
|
2188
|
+
parentKey,
|
2189
|
+
!1,
|
2190
|
+
response,
|
2191
|
+
createModel,
|
2192
|
+
[]
|
2193
|
+
),
|
2194
|
+
createModelReject(bytesPerElement)
|
2195
|
+
);
|
2196
|
+
return null;
|
2197
|
+
}
|
2198
|
+
function resolveStream(response, id, stream, controller) {
|
2199
|
+
var chunks = response._chunks;
|
2200
|
+
stream = new Chunk("fulfilled", stream, controller, response);
|
2201
|
+
chunks.set(id, stream);
|
2202
|
+
response = response._formData.getAll(response._prefix + id);
|
2203
|
+
for (id = 0; id < response.length; id++)
|
2204
|
+
(chunks = response[id]),
|
2205
|
+
"C" === chunks[0]
|
2206
|
+
? controller.close("C" === chunks ? '"$undefined"' : chunks.slice(1))
|
2207
|
+
: controller.enqueueModel(chunks);
|
2208
|
+
}
|
2209
|
+
function parseReadableStream(response, reference, type) {
|
2210
|
+
reference = parseInt(reference.slice(2), 16);
|
2211
|
+
var controller = null;
|
2212
|
+
type = new ReadableStream({
|
2213
|
+
type: type,
|
2214
|
+
start: function (c) {
|
2215
|
+
controller = c;
|
2216
|
+
}
|
2217
|
+
});
|
2218
|
+
var previousBlockedChunk = null;
|
2219
|
+
resolveStream(response, reference, type, {
|
2220
|
+
enqueueModel: function (json) {
|
2221
|
+
if (null === previousBlockedChunk) {
|
2222
|
+
var chunk = new Chunk("resolved_model", json, -1, response);
|
2223
|
+
initializeModelChunk(chunk);
|
2224
|
+
"fulfilled" === chunk.status
|
2225
|
+
? controller.enqueue(chunk.value)
|
2226
|
+
: (chunk.then(
|
2227
|
+
function (v) {
|
2228
|
+
return controller.enqueue(v);
|
2229
|
+
},
|
2230
|
+
function (e) {
|
2231
|
+
return controller.error(e);
|
2232
|
+
}
|
2233
|
+
),
|
2234
|
+
(previousBlockedChunk = chunk));
|
2235
|
+
} else {
|
2236
|
+
chunk = previousBlockedChunk;
|
2237
|
+
var chunk$25 = createPendingChunk(response);
|
2238
|
+
chunk$25.then(
|
2239
|
+
function (v) {
|
2240
|
+
return controller.enqueue(v);
|
2241
|
+
},
|
2242
|
+
function (e) {
|
2243
|
+
return controller.error(e);
|
2244
|
+
}
|
2245
|
+
);
|
2246
|
+
previousBlockedChunk = chunk$25;
|
2247
|
+
chunk.then(function () {
|
2248
|
+
previousBlockedChunk === chunk$25 && (previousBlockedChunk = null);
|
2249
|
+
resolveModelChunk(chunk$25, json, -1);
|
2250
|
+
});
|
2251
|
+
}
|
2252
|
+
},
|
2253
|
+
close: function () {
|
2254
|
+
if (null === previousBlockedChunk) controller.close();
|
2255
|
+
else {
|
2256
|
+
var blockedChunk = previousBlockedChunk;
|
2257
|
+
previousBlockedChunk = null;
|
2258
|
+
blockedChunk.then(function () {
|
2259
|
+
return controller.close();
|
2260
|
+
});
|
2261
|
+
}
|
2262
|
+
},
|
2263
|
+
error: function (error) {
|
2264
|
+
if (null === previousBlockedChunk) controller.error(error);
|
2265
|
+
else {
|
2266
|
+
var blockedChunk = previousBlockedChunk;
|
2267
|
+
previousBlockedChunk = null;
|
2268
|
+
blockedChunk.then(function () {
|
2269
|
+
return controller.error(error);
|
2270
|
+
});
|
2271
|
+
}
|
2272
|
+
}
|
2273
|
+
});
|
2274
|
+
return type;
|
2275
|
+
}
|
2276
|
+
function asyncIterator() {
|
2277
|
+
return this;
|
2278
|
+
}
|
2279
|
+
function createIterator(next) {
|
2280
|
+
next = { next: next };
|
2281
|
+
next[ASYNC_ITERATOR] = asyncIterator;
|
2282
|
+
return next;
|
2283
|
+
}
|
2284
|
+
function parseAsyncIterable(response, reference, iterator) {
|
2285
|
+
reference = parseInt(reference.slice(2), 16);
|
2286
|
+
var buffer = [],
|
2287
|
+
closed = !1,
|
2288
|
+
nextWriteIndex = 0,
|
2289
|
+
$jscomp$compprop2 = {};
|
2290
|
+
$jscomp$compprop2 =
|
2291
|
+
(($jscomp$compprop2[ASYNC_ITERATOR] = function () {
|
2292
|
+
var nextReadIndex = 0;
|
2293
|
+
return createIterator(function (arg) {
|
2294
|
+
if (void 0 !== arg)
|
2295
|
+
throw Error(
|
2296
|
+
"Values cannot be passed to next() of AsyncIterables passed to Client Components."
|
2297
|
+
);
|
2298
|
+
if (nextReadIndex === buffer.length) {
|
2299
|
+
if (closed)
|
2300
|
+
return new Chunk(
|
2301
|
+
"fulfilled",
|
2302
|
+
{ done: !0, value: void 0 },
|
2303
|
+
null,
|
2304
|
+
response
|
2305
|
+
);
|
2306
|
+
buffer[nextReadIndex] = createPendingChunk(response);
|
2307
|
+
}
|
2308
|
+
return buffer[nextReadIndex++];
|
2309
|
+
});
|
2310
|
+
}),
|
2311
|
+
$jscomp$compprop2);
|
2312
|
+
iterator = iterator ? $jscomp$compprop2[ASYNC_ITERATOR]() : $jscomp$compprop2;
|
2313
|
+
resolveStream(response, reference, iterator, {
|
2314
|
+
enqueueModel: function (value) {
|
2315
|
+
nextWriteIndex === buffer.length
|
2316
|
+
? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
|
2317
|
+
response,
|
2318
|
+
value,
|
2319
|
+
!1
|
2320
|
+
))
|
2321
|
+
: resolveIteratorResultChunk(buffer[nextWriteIndex], value, !1);
|
2322
|
+
nextWriteIndex++;
|
2323
|
+
},
|
2324
|
+
close: function (value) {
|
2325
|
+
closed = !0;
|
2326
|
+
nextWriteIndex === buffer.length
|
2327
|
+
? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
|
2328
|
+
response,
|
2329
|
+
value,
|
2330
|
+
!0
|
2331
|
+
))
|
2332
|
+
: resolveIteratorResultChunk(buffer[nextWriteIndex], value, !0);
|
2333
|
+
for (nextWriteIndex++; nextWriteIndex < buffer.length; )
|
2334
|
+
resolveIteratorResultChunk(
|
2335
|
+
buffer[nextWriteIndex++],
|
2336
|
+
'"$undefined"',
|
2337
|
+
!0
|
2338
|
+
);
|
2339
|
+
},
|
2340
|
+
error: function (error) {
|
2341
|
+
closed = !0;
|
2342
|
+
for (
|
2343
|
+
nextWriteIndex === buffer.length &&
|
2344
|
+
(buffer[nextWriteIndex] = createPendingChunk(response));
|
2345
|
+
nextWriteIndex < buffer.length;
|
2346
|
+
|
2347
|
+
)
|
2348
|
+
triggerErrorOnChunk(buffer[nextWriteIndex++], error);
|
2349
|
+
}
|
2350
|
+
});
|
2351
|
+
return iterator;
|
2352
|
+
}
|
2353
|
+
function parseModelString(response, obj, key, value, reference) {
|
1769
2354
|
if ("$" === value[0]) {
|
1770
2355
|
switch (value[1]) {
|
1771
2356
|
case "$":
|
@@ -1774,7 +2359,7 @@ function parseModelString(response, obj, key, value) {
|
|
1774
2359
|
return (obj = parseInt(value.slice(2), 16)), getChunk(response, obj);
|
1775
2360
|
case "F":
|
1776
2361
|
return (
|
1777
|
-
(value =
|
2362
|
+
(value = value.slice(2)),
|
1778
2363
|
(value = getOutlinedModel(response, value, obj, key, createModel)),
|
1779
2364
|
loadServerReference$1(
|
1780
2365
|
response,
|
@@ -1786,15 +2371,22 @@ function parseModelString(response, obj, key, value) {
|
|
1786
2371
|
)
|
1787
2372
|
);
|
1788
2373
|
case "T":
|
1789
|
-
|
2374
|
+
if (void 0 === reference || void 0 === response._temporaryReferences)
|
2375
|
+
throw Error(
|
2376
|
+
"Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
|
2377
|
+
);
|
2378
|
+
return createTemporaryReference(
|
2379
|
+
response._temporaryReferences,
|
2380
|
+
reference
|
2381
|
+
);
|
1790
2382
|
case "Q":
|
1791
2383
|
return (
|
1792
|
-
(value =
|
2384
|
+
(value = value.slice(2)),
|
1793
2385
|
getOutlinedModel(response, value, obj, key, createMap)
|
1794
2386
|
);
|
1795
2387
|
case "W":
|
1796
2388
|
return (
|
1797
|
-
(value =
|
2389
|
+
(value = value.slice(2)),
|
1798
2390
|
getOutlinedModel(response, value, obj, key, createSet)
|
1799
2391
|
);
|
1800
2392
|
case "K":
|
@@ -1808,7 +2400,7 @@ function parseModelString(response, obj, key, value) {
|
|
1808
2400
|
return data;
|
1809
2401
|
case "i":
|
1810
2402
|
return (
|
1811
|
-
(value =
|
2403
|
+
(value = value.slice(2)),
|
1812
2404
|
getOutlinedModel(response, value, obj, key, extractIterator)
|
1813
2405
|
);
|
1814
2406
|
case "I":
|
@@ -1824,57 +2416,75 @@ function parseModelString(response, obj, key, value) {
|
|
1824
2416
|
case "n":
|
1825
2417
|
return BigInt(value.slice(2));
|
1826
2418
|
}
|
1827
|
-
|
2419
|
+
switch (value[1]) {
|
2420
|
+
case "A":
|
2421
|
+
return parseTypedArray(response, value, ArrayBuffer, 1, obj, key);
|
2422
|
+
case "O":
|
2423
|
+
return parseTypedArray(response, value, Int8Array, 1, obj, key);
|
2424
|
+
case "o":
|
2425
|
+
return parseTypedArray(response, value, Uint8Array, 1, obj, key);
|
2426
|
+
case "U":
|
2427
|
+
return parseTypedArray(response, value, Uint8ClampedArray, 1, obj, key);
|
2428
|
+
case "S":
|
2429
|
+
return parseTypedArray(response, value, Int16Array, 2, obj, key);
|
2430
|
+
case "s":
|
2431
|
+
return parseTypedArray(response, value, Uint16Array, 2, obj, key);
|
2432
|
+
case "L":
|
2433
|
+
return parseTypedArray(response, value, Int32Array, 4, obj, key);
|
2434
|
+
case "l":
|
2435
|
+
return parseTypedArray(response, value, Uint32Array, 4, obj, key);
|
2436
|
+
case "G":
|
2437
|
+
return parseTypedArray(response, value, Float32Array, 4, obj, key);
|
2438
|
+
case "g":
|
2439
|
+
return parseTypedArray(response, value, Float64Array, 8, obj, key);
|
2440
|
+
case "M":
|
2441
|
+
return parseTypedArray(response, value, BigInt64Array, 8, obj, key);
|
2442
|
+
case "m":
|
2443
|
+
return parseTypedArray(response, value, BigUint64Array, 8, obj, key);
|
2444
|
+
case "V":
|
2445
|
+
return parseTypedArray(response, value, DataView, 1, obj, key);
|
2446
|
+
case "B":
|
2447
|
+
return (
|
2448
|
+
(obj = parseInt(value.slice(2), 16)),
|
2449
|
+
response._formData.get(response._prefix + obj)
|
2450
|
+
);
|
2451
|
+
}
|
2452
|
+
switch (value[1]) {
|
2453
|
+
case "R":
|
2454
|
+
return parseReadableStream(response, value, void 0);
|
2455
|
+
case "r":
|
2456
|
+
return parseReadableStream(response, value, "bytes");
|
2457
|
+
case "X":
|
2458
|
+
return parseAsyncIterable(response, value, !1);
|
2459
|
+
case "x":
|
2460
|
+
return parseAsyncIterable(response, value, !0);
|
2461
|
+
}
|
2462
|
+
value = value.slice(1);
|
1828
2463
|
return getOutlinedModel(response, value, obj, key, createModel);
|
1829
2464
|
}
|
1830
2465
|
return value;
|
1831
2466
|
}
|
1832
|
-
function createResponse(bundlerConfig, formFieldPrefix) {
|
2467
|
+
function createResponse(bundlerConfig, formFieldPrefix, temporaryReferences) {
|
1833
2468
|
var backingFormData =
|
1834
|
-
|
1835
|
-
? arguments[
|
2469
|
+
3 < arguments.length && void 0 !== arguments[3]
|
2470
|
+
? arguments[3]
|
1836
2471
|
: new FormData(),
|
1837
|
-
chunks = new Map()
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
? parseModelString(response, this, key, value)
|
1846
|
-
: value;
|
1847
|
-
}
|
1848
|
-
};
|
1849
|
-
return response;
|
2472
|
+
chunks = new Map();
|
2473
|
+
return {
|
2474
|
+
_bundlerConfig: bundlerConfig,
|
2475
|
+
_prefix: formFieldPrefix,
|
2476
|
+
_formData: backingFormData,
|
2477
|
+
_chunks: chunks,
|
2478
|
+
_temporaryReferences: temporaryReferences
|
2479
|
+
};
|
1850
2480
|
}
|
1851
2481
|
function resolveField(response, key, value) {
|
1852
2482
|
response._formData.append(key, value);
|
1853
2483
|
var prefix = response._prefix;
|
1854
|
-
|
1855
|
-
key.startsWith(prefix) &&
|
2484
|
+
key.startsWith(prefix) &&
|
1856
2485
|
((response = response._chunks),
|
1857
2486
|
(key = +key.slice(prefix.length)),
|
1858
|
-
(
|
1859
|
-
"pending" === key.status &&
|
1860
|
-
((prefix = key.value),
|
1861
|
-
(response = key.reason),
|
1862
|
-
(key.status = "resolved_model"),
|
1863
|
-
(key.value = value),
|
1864
|
-
null !== prefix))
|
1865
|
-
)
|
1866
|
-
switch ((initializeModelChunk(key), key.status)) {
|
1867
|
-
case "fulfilled":
|
1868
|
-
wakeChunk(prefix, key.value);
|
1869
|
-
break;
|
1870
|
-
case "pending":
|
1871
|
-
case "blocked":
|
1872
|
-
key.value = prefix;
|
1873
|
-
key.reason = response;
|
1874
|
-
break;
|
1875
|
-
case "rejected":
|
1876
|
-
response && wakeChunk(response, key.reason);
|
1877
|
-
}
|
2487
|
+
(prefix = response.get(key)) && resolveModelChunk(prefix, value, key));
|
1878
2488
|
}
|
1879
2489
|
function close(response) {
|
1880
2490
|
reportGlobalError(response, Error("Connection closed."));
|
@@ -1895,7 +2505,7 @@ function loadServerReference(bundlerConfig, id, bound) {
|
|
1895
2505
|
: Promise.resolve(requireModule(serverReference));
|
1896
2506
|
}
|
1897
2507
|
function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
|
1898
|
-
body = createResponse(serverManifest, formFieldPrefix, body);
|
2508
|
+
body = createResponse(serverManifest, formFieldPrefix, void 0, body);
|
1899
2509
|
close(body);
|
1900
2510
|
body = getChunk(body, 0);
|
1901
2511
|
body.then(function () {});
|
@@ -1917,6 +2527,9 @@ exports.createClientModuleProxy = function (moduleId) {
|
|
1917
2527
|
moduleId = registerClientReferenceImpl({}, moduleId, !1);
|
1918
2528
|
return new Proxy(moduleId, proxyHandlers$1);
|
1919
2529
|
};
|
2530
|
+
exports.createTemporaryReferenceSet = function () {
|
2531
|
+
return new WeakMap();
|
2532
|
+
};
|
1920
2533
|
exports.decodeAction = function (body, serverManifest) {
|
1921
2534
|
var formData = new FormData(),
|
1922
2535
|
action = null;
|
@@ -1954,13 +2567,18 @@ exports.decodeFormState = function (actionResult, body, serverManifest) {
|
|
1954
2567
|
: [actionResult, keyPath, referenceId, bound.length - 1];
|
1955
2568
|
});
|
1956
2569
|
};
|
1957
|
-
exports.decodeReply = function (body, webpackMap) {
|
2570
|
+
exports.decodeReply = function (body, webpackMap, options) {
|
1958
2571
|
if ("string" === typeof body) {
|
1959
2572
|
var form = new FormData();
|
1960
2573
|
form.append("0", body);
|
1961
2574
|
body = form;
|
1962
2575
|
}
|
1963
|
-
body = createResponse(
|
2576
|
+
body = createResponse(
|
2577
|
+
webpackMap,
|
2578
|
+
"",
|
2579
|
+
options ? options.temporaryReferences : void 0,
|
2580
|
+
body
|
2581
|
+
);
|
1964
2582
|
webpackMap = getChunk(body, 0);
|
1965
2583
|
close(body);
|
1966
2584
|
return webpackMap;
|
@@ -1982,12 +2600,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap) {
|
|
1982
2600
|
"React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it."
|
1983
2601
|
);
|
1984
2602
|
pendingFiles++;
|
1985
|
-
var
|
2603
|
+
var JSCompiler_object_inline_chunks_213 = [];
|
1986
2604
|
value.on("data", function (chunk) {
|
1987
|
-
|
2605
|
+
JSCompiler_object_inline_chunks_213.push(chunk);
|
1988
2606
|
});
|
1989
2607
|
value.on("end", function () {
|
1990
|
-
var blob = new Blob(
|
2608
|
+
var blob = new Blob(JSCompiler_object_inline_chunks_213, {
|
1991
2609
|
type: mimeType
|
1992
2610
|
});
|
1993
2611
|
response._formData.append(name, blob, filename);
|
@@ -2035,7 +2653,9 @@ exports.renderToPipeableStream = function (model, webpackMap, options) {
|
|
2035
2653
|
webpackMap,
|
2036
2654
|
options ? options.onError : void 0,
|
2037
2655
|
options ? options.identifierPrefix : void 0,
|
2038
|
-
options ? options.onPostpone : void 0
|
2656
|
+
options ? options.onPostpone : void 0,
|
2657
|
+
options ? options.environmentName : void 0,
|
2658
|
+
options ? options.temporaryReferences : void 0
|
2039
2659
|
),
|
2040
2660
|
hasStartedFlowing = !1;
|
2041
2661
|
startWork(request);
|