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) {
|
@@ -1626,6 +1903,7 @@ function requireModule(metadata) {
|
|
1626
1903
|
: moduleExports
|
1627
1904
|
: moduleExports[metadata[2]];
|
1628
1905
|
}
|
1906
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1629
1907
|
function Chunk(status, value, reason, response) {
|
1630
1908
|
this.status = status;
|
1631
1909
|
this.value = value;
|
@@ -1644,6 +1922,7 @@ Chunk.prototype.then = function (resolve, reject) {
|
|
1644
1922
|
break;
|
1645
1923
|
case "pending":
|
1646
1924
|
case "blocked":
|
1925
|
+
case "cyclic":
|
1647
1926
|
resolve &&
|
1648
1927
|
(null === this.value && (this.value = []), this.value.push(resolve));
|
1649
1928
|
reject &&
|
@@ -1653,17 +1932,65 @@ Chunk.prototype.then = function (resolve, reject) {
|
|
1653
1932
|
reject(this.reason);
|
1654
1933
|
}
|
1655
1934
|
};
|
1935
|
+
function createPendingChunk(response) {
|
1936
|
+
return new Chunk("pending", null, null, response);
|
1937
|
+
}
|
1656
1938
|
function wakeChunk(listeners, value) {
|
1657
1939
|
for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
|
1658
1940
|
}
|
1659
1941
|
function triggerErrorOnChunk(chunk, error) {
|
1660
|
-
if ("pending"
|
1942
|
+
if ("pending" !== chunk.status && "blocked" !== chunk.status)
|
1943
|
+
chunk.reason.error(error);
|
1944
|
+
else {
|
1661
1945
|
var listeners = chunk.reason;
|
1662
1946
|
chunk.status = "rejected";
|
1663
1947
|
chunk.reason = error;
|
1664
1948
|
null !== listeners && wakeChunk(listeners, error);
|
1665
1949
|
}
|
1666
1950
|
}
|
1951
|
+
function resolveModelChunk(chunk, value, id) {
|
1952
|
+
if ("pending" !== chunk.status)
|
1953
|
+
(chunk = chunk.reason),
|
1954
|
+
"C" === value[0]
|
1955
|
+
? chunk.close("C" === value ? '"$undefined"' : value.slice(1))
|
1956
|
+
: chunk.enqueueModel(value);
|
1957
|
+
else {
|
1958
|
+
var resolveListeners = chunk.value,
|
1959
|
+
rejectListeners = chunk.reason;
|
1960
|
+
chunk.status = "resolved_model";
|
1961
|
+
chunk.value = value;
|
1962
|
+
chunk.reason = id;
|
1963
|
+
if (null !== resolveListeners)
|
1964
|
+
switch ((initializeModelChunk(chunk), chunk.status)) {
|
1965
|
+
case "fulfilled":
|
1966
|
+
wakeChunk(resolveListeners, chunk.value);
|
1967
|
+
break;
|
1968
|
+
case "pending":
|
1969
|
+
case "blocked":
|
1970
|
+
case "cyclic":
|
1971
|
+
chunk.value = resolveListeners;
|
1972
|
+
chunk.reason = rejectListeners;
|
1973
|
+
break;
|
1974
|
+
case "rejected":
|
1975
|
+
rejectListeners && wakeChunk(rejectListeners, chunk.reason);
|
1976
|
+
}
|
1977
|
+
}
|
1978
|
+
}
|
1979
|
+
function createResolvedIteratorResultChunk(response, value, done) {
|
1980
|
+
return new Chunk(
|
1981
|
+
"resolved_model",
|
1982
|
+
(done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
|
1983
|
+
-1,
|
1984
|
+
response
|
1985
|
+
);
|
1986
|
+
}
|
1987
|
+
function resolveIteratorResultChunk(chunk, value, done) {
|
1988
|
+
resolveModelChunk(
|
1989
|
+
chunk,
|
1990
|
+
(done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
|
1991
|
+
-1
|
1992
|
+
);
|
1993
|
+
}
|
1667
1994
|
function loadServerReference$1(
|
1668
1995
|
response,
|
1669
1996
|
id,
|
@@ -1692,12 +2019,42 @@ function loadServerReference$1(
|
|
1692
2019
|
key,
|
1693
2020
|
!1,
|
1694
2021
|
response,
|
1695
|
-
createModel
|
2022
|
+
createModel,
|
2023
|
+
[]
|
1696
2024
|
),
|
1697
2025
|
createModelReject(parentChunk)
|
1698
2026
|
);
|
1699
2027
|
return null;
|
1700
2028
|
}
|
2029
|
+
function reviveModel(response, parentObj, parentKey, value, reference) {
|
2030
|
+
if ("string" === typeof value)
|
2031
|
+
return parseModelString(response, parentObj, parentKey, value, reference);
|
2032
|
+
if ("object" === typeof value && null !== value)
|
2033
|
+
if (
|
2034
|
+
(void 0 !== reference &&
|
2035
|
+
void 0 !== response._temporaryReferences &&
|
2036
|
+
response._temporaryReferences.set(value, reference),
|
2037
|
+
Array.isArray(value))
|
2038
|
+
)
|
2039
|
+
for (var i = 0; i < value.length; i++)
|
2040
|
+
value[i] = reviveModel(
|
2041
|
+
response,
|
2042
|
+
value,
|
2043
|
+
"" + i,
|
2044
|
+
value[i],
|
2045
|
+
void 0 !== reference ? reference + ":" + i : void 0
|
2046
|
+
);
|
2047
|
+
else
|
2048
|
+
for (i in value)
|
2049
|
+
hasOwnProperty.call(value, i) &&
|
2050
|
+
((parentObj =
|
2051
|
+
void 0 !== reference && -1 === i.indexOf(":")
|
2052
|
+
? reference + ":" + i
|
2053
|
+
: void 0),
|
2054
|
+
(parentObj = reviveModel(response, value, i, value[i], parentObj)),
|
2055
|
+
void 0 !== parentObj ? (value[i] = parentObj) : delete value[i]);
|
2056
|
+
return value;
|
2057
|
+
}
|
1701
2058
|
var initializingChunk = null,
|
1702
2059
|
initializingChunkBlockedModel = null;
|
1703
2060
|
function initializeModelChunk(chunk) {
|
@@ -1705,15 +2062,34 @@ function initializeModelChunk(chunk) {
|
|
1705
2062
|
prevBlocked = initializingChunkBlockedModel;
|
1706
2063
|
initializingChunk = chunk;
|
1707
2064
|
initializingChunkBlockedModel = null;
|
2065
|
+
var rootReference = -1 === chunk.reason ? void 0 : chunk.reason.toString(16),
|
2066
|
+
resolvedModel = chunk.value;
|
2067
|
+
chunk.status = "cyclic";
|
2068
|
+
chunk.value = null;
|
2069
|
+
chunk.reason = null;
|
1708
2070
|
try {
|
1709
|
-
var
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
2071
|
+
var rawModel = JSON.parse(resolvedModel),
|
2072
|
+
value = reviveModel(
|
2073
|
+
chunk._response,
|
2074
|
+
{ "": rawModel },
|
2075
|
+
"",
|
2076
|
+
rawModel,
|
2077
|
+
rootReference
|
2078
|
+
);
|
2079
|
+
if (
|
2080
|
+
null !== initializingChunkBlockedModel &&
|
2081
|
+
0 < initializingChunkBlockedModel.deps
|
2082
|
+
)
|
2083
|
+
(initializingChunkBlockedModel.value = value),
|
1713
2084
|
(chunk.status = "blocked"),
|
1714
2085
|
(chunk.value = null),
|
1715
|
-
(chunk.reason = null)
|
1716
|
-
|
2086
|
+
(chunk.reason = null);
|
2087
|
+
else {
|
2088
|
+
var resolveListeners = chunk.value;
|
2089
|
+
chunk.status = "fulfilled";
|
2090
|
+
chunk.value = value;
|
2091
|
+
null !== resolveListeners && wakeChunk(resolveListeners, value);
|
2092
|
+
}
|
1717
2093
|
} catch (error) {
|
1718
2094
|
(chunk.status = "rejected"), (chunk.reason = error);
|
1719
2095
|
} finally {
|
@@ -1733,12 +2109,20 @@ function getChunk(response, id) {
|
|
1733
2109
|
((chunk = response._formData.get(response._prefix + id)),
|
1734
2110
|
(chunk =
|
1735
2111
|
null != chunk
|
1736
|
-
? new Chunk("resolved_model", chunk,
|
1737
|
-
:
|
2112
|
+
? new Chunk("resolved_model", chunk, id, response)
|
2113
|
+
: createPendingChunk(response)),
|
1738
2114
|
chunks.set(id, chunk));
|
1739
2115
|
return chunk;
|
1740
2116
|
}
|
1741
|
-
function createModelResolver(
|
2117
|
+
function createModelResolver(
|
2118
|
+
chunk,
|
2119
|
+
parentObject,
|
2120
|
+
key,
|
2121
|
+
cyclic,
|
2122
|
+
response,
|
2123
|
+
map,
|
2124
|
+
path
|
2125
|
+
) {
|
1742
2126
|
if (initializingChunkBlockedModel) {
|
1743
2127
|
var blocked = initializingChunkBlockedModel;
|
1744
2128
|
cyclic || blocked.deps++;
|
@@ -1748,6 +2132,7 @@ function createModelResolver(chunk, parentObject, key, cyclic, response, map) {
|
|
1748
2132
|
value: null
|
1749
2133
|
};
|
1750
2134
|
return function (value) {
|
2135
|
+
for (var i = 1; i < path.length; i++) value = value[path[i]];
|
1751
2136
|
parentObject[key] = map(response, value);
|
1752
2137
|
"" === key && null === blocked.value && (blocked.value = parentObject[key]);
|
1753
2138
|
blocked.deps--;
|
@@ -1764,7 +2149,9 @@ function createModelReject(chunk) {
|
|
1764
2149
|
return triggerErrorOnChunk(chunk, error);
|
1765
2150
|
};
|
1766
2151
|
}
|
1767
|
-
function getOutlinedModel(response,
|
2152
|
+
function getOutlinedModel(response, reference, parentObject, key, map) {
|
2153
|
+
reference = reference.split(":");
|
2154
|
+
var id = parseInt(reference[0], 16);
|
1768
2155
|
id = getChunk(response, id);
|
1769
2156
|
switch (id.status) {
|
1770
2157
|
case "resolved_model":
|
@@ -1772,12 +2159,24 @@ function getOutlinedModel(response, id, parentObject, key, map) {
|
|
1772
2159
|
}
|
1773
2160
|
switch (id.status) {
|
1774
2161
|
case "fulfilled":
|
1775
|
-
|
2162
|
+
parentObject = id.value;
|
2163
|
+
for (key = 1; key < reference.length; key++)
|
2164
|
+
parentObject = parentObject[reference[key]];
|
2165
|
+
return map(response, parentObject);
|
1776
2166
|
case "pending":
|
1777
2167
|
case "blocked":
|
2168
|
+
case "cyclic":
|
1778
2169
|
var parentChunk = initializingChunk;
|
1779
2170
|
id.then(
|
1780
|
-
createModelResolver(
|
2171
|
+
createModelResolver(
|
2172
|
+
parentChunk,
|
2173
|
+
parentObject,
|
2174
|
+
key,
|
2175
|
+
"cyclic" === id.status,
|
2176
|
+
response,
|
2177
|
+
map,
|
2178
|
+
reference
|
2179
|
+
),
|
1781
2180
|
createModelReject(parentChunk)
|
1782
2181
|
);
|
1783
2182
|
return null;
|
@@ -1797,7 +2196,193 @@ function extractIterator(response, model) {
|
|
1797
2196
|
function createModel(response, model) {
|
1798
2197
|
return model;
|
1799
2198
|
}
|
1800
|
-
function
|
2199
|
+
function parseTypedArray(
|
2200
|
+
response,
|
2201
|
+
reference,
|
2202
|
+
constructor,
|
2203
|
+
bytesPerElement,
|
2204
|
+
parentObject,
|
2205
|
+
parentKey
|
2206
|
+
) {
|
2207
|
+
reference = parseInt(reference.slice(2), 16);
|
2208
|
+
reference = response._formData.get(response._prefix + reference);
|
2209
|
+
reference =
|
2210
|
+
constructor === ArrayBuffer
|
2211
|
+
? reference.arrayBuffer()
|
2212
|
+
: reference.arrayBuffer().then(function (buffer) {
|
2213
|
+
return new constructor(buffer);
|
2214
|
+
});
|
2215
|
+
bytesPerElement = initializingChunk;
|
2216
|
+
reference.then(
|
2217
|
+
createModelResolver(
|
2218
|
+
bytesPerElement,
|
2219
|
+
parentObject,
|
2220
|
+
parentKey,
|
2221
|
+
!1,
|
2222
|
+
response,
|
2223
|
+
createModel,
|
2224
|
+
[]
|
2225
|
+
),
|
2226
|
+
createModelReject(bytesPerElement)
|
2227
|
+
);
|
2228
|
+
return null;
|
2229
|
+
}
|
2230
|
+
function resolveStream(response, id, stream, controller) {
|
2231
|
+
var chunks = response._chunks;
|
2232
|
+
stream = new Chunk("fulfilled", stream, controller, response);
|
2233
|
+
chunks.set(id, stream);
|
2234
|
+
response = response._formData.getAll(response._prefix + id);
|
2235
|
+
for (id = 0; id < response.length; id++)
|
2236
|
+
(chunks = response[id]),
|
2237
|
+
"C" === chunks[0]
|
2238
|
+
? controller.close("C" === chunks ? '"$undefined"' : chunks.slice(1))
|
2239
|
+
: controller.enqueueModel(chunks);
|
2240
|
+
}
|
2241
|
+
function parseReadableStream(response, reference, type) {
|
2242
|
+
reference = parseInt(reference.slice(2), 16);
|
2243
|
+
var controller = null;
|
2244
|
+
type = new ReadableStream({
|
2245
|
+
type: type,
|
2246
|
+
start: function (c) {
|
2247
|
+
controller = c;
|
2248
|
+
}
|
2249
|
+
});
|
2250
|
+
var previousBlockedChunk = null;
|
2251
|
+
resolveStream(response, reference, type, {
|
2252
|
+
enqueueModel: function (json) {
|
2253
|
+
if (null === previousBlockedChunk) {
|
2254
|
+
var chunk = new Chunk("resolved_model", json, -1, response);
|
2255
|
+
initializeModelChunk(chunk);
|
2256
|
+
"fulfilled" === chunk.status
|
2257
|
+
? controller.enqueue(chunk.value)
|
2258
|
+
: (chunk.then(
|
2259
|
+
function (v) {
|
2260
|
+
return controller.enqueue(v);
|
2261
|
+
},
|
2262
|
+
function (e) {
|
2263
|
+
return controller.error(e);
|
2264
|
+
}
|
2265
|
+
),
|
2266
|
+
(previousBlockedChunk = chunk));
|
2267
|
+
} else {
|
2268
|
+
chunk = previousBlockedChunk;
|
2269
|
+
var chunk$25 = createPendingChunk(response);
|
2270
|
+
chunk$25.then(
|
2271
|
+
function (v) {
|
2272
|
+
return controller.enqueue(v);
|
2273
|
+
},
|
2274
|
+
function (e) {
|
2275
|
+
return controller.error(e);
|
2276
|
+
}
|
2277
|
+
);
|
2278
|
+
previousBlockedChunk = chunk$25;
|
2279
|
+
chunk.then(function () {
|
2280
|
+
previousBlockedChunk === chunk$25 && (previousBlockedChunk = null);
|
2281
|
+
resolveModelChunk(chunk$25, json, -1);
|
2282
|
+
});
|
2283
|
+
}
|
2284
|
+
},
|
2285
|
+
close: function () {
|
2286
|
+
if (null === previousBlockedChunk) controller.close();
|
2287
|
+
else {
|
2288
|
+
var blockedChunk = previousBlockedChunk;
|
2289
|
+
previousBlockedChunk = null;
|
2290
|
+
blockedChunk.then(function () {
|
2291
|
+
return controller.close();
|
2292
|
+
});
|
2293
|
+
}
|
2294
|
+
},
|
2295
|
+
error: function (error) {
|
2296
|
+
if (null === previousBlockedChunk) controller.error(error);
|
2297
|
+
else {
|
2298
|
+
var blockedChunk = previousBlockedChunk;
|
2299
|
+
previousBlockedChunk = null;
|
2300
|
+
blockedChunk.then(function () {
|
2301
|
+
return controller.error(error);
|
2302
|
+
});
|
2303
|
+
}
|
2304
|
+
}
|
2305
|
+
});
|
2306
|
+
return type;
|
2307
|
+
}
|
2308
|
+
function asyncIterator() {
|
2309
|
+
return this;
|
2310
|
+
}
|
2311
|
+
function createIterator(next) {
|
2312
|
+
next = { next: next };
|
2313
|
+
next[ASYNC_ITERATOR] = asyncIterator;
|
2314
|
+
return next;
|
2315
|
+
}
|
2316
|
+
function parseAsyncIterable(response, reference, iterator) {
|
2317
|
+
reference = parseInt(reference.slice(2), 16);
|
2318
|
+
var buffer = [],
|
2319
|
+
closed = !1,
|
2320
|
+
nextWriteIndex = 0,
|
2321
|
+
$jscomp$compprop2 = {};
|
2322
|
+
$jscomp$compprop2 =
|
2323
|
+
(($jscomp$compprop2[ASYNC_ITERATOR] = function () {
|
2324
|
+
var nextReadIndex = 0;
|
2325
|
+
return createIterator(function (arg) {
|
2326
|
+
if (void 0 !== arg)
|
2327
|
+
throw Error(
|
2328
|
+
"Values cannot be passed to next() of AsyncIterables passed to Client Components."
|
2329
|
+
);
|
2330
|
+
if (nextReadIndex === buffer.length) {
|
2331
|
+
if (closed)
|
2332
|
+
return new Chunk(
|
2333
|
+
"fulfilled",
|
2334
|
+
{ done: !0, value: void 0 },
|
2335
|
+
null,
|
2336
|
+
response
|
2337
|
+
);
|
2338
|
+
buffer[nextReadIndex] = createPendingChunk(response);
|
2339
|
+
}
|
2340
|
+
return buffer[nextReadIndex++];
|
2341
|
+
});
|
2342
|
+
}),
|
2343
|
+
$jscomp$compprop2);
|
2344
|
+
iterator = iterator ? $jscomp$compprop2[ASYNC_ITERATOR]() : $jscomp$compprop2;
|
2345
|
+
resolveStream(response, reference, iterator, {
|
2346
|
+
enqueueModel: function (value) {
|
2347
|
+
nextWriteIndex === buffer.length
|
2348
|
+
? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
|
2349
|
+
response,
|
2350
|
+
value,
|
2351
|
+
!1
|
2352
|
+
))
|
2353
|
+
: resolveIteratorResultChunk(buffer[nextWriteIndex], value, !1);
|
2354
|
+
nextWriteIndex++;
|
2355
|
+
},
|
2356
|
+
close: function (value) {
|
2357
|
+
closed = !0;
|
2358
|
+
nextWriteIndex === buffer.length
|
2359
|
+
? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
|
2360
|
+
response,
|
2361
|
+
value,
|
2362
|
+
!0
|
2363
|
+
))
|
2364
|
+
: resolveIteratorResultChunk(buffer[nextWriteIndex], value, !0);
|
2365
|
+
for (nextWriteIndex++; nextWriteIndex < buffer.length; )
|
2366
|
+
resolveIteratorResultChunk(
|
2367
|
+
buffer[nextWriteIndex++],
|
2368
|
+
'"$undefined"',
|
2369
|
+
!0
|
2370
|
+
);
|
2371
|
+
},
|
2372
|
+
error: function (error) {
|
2373
|
+
closed = !0;
|
2374
|
+
for (
|
2375
|
+
nextWriteIndex === buffer.length &&
|
2376
|
+
(buffer[nextWriteIndex] = createPendingChunk(response));
|
2377
|
+
nextWriteIndex < buffer.length;
|
2378
|
+
|
2379
|
+
)
|
2380
|
+
triggerErrorOnChunk(buffer[nextWriteIndex++], error);
|
2381
|
+
}
|
2382
|
+
});
|
2383
|
+
return iterator;
|
2384
|
+
}
|
2385
|
+
function parseModelString(response, obj, key, value, reference) {
|
1801
2386
|
if ("$" === value[0]) {
|
1802
2387
|
switch (value[1]) {
|
1803
2388
|
case "$":
|
@@ -1806,7 +2391,7 @@ function parseModelString(response, obj, key, value) {
|
|
1806
2391
|
return (obj = parseInt(value.slice(2), 16)), getChunk(response, obj);
|
1807
2392
|
case "F":
|
1808
2393
|
return (
|
1809
|
-
(value =
|
2394
|
+
(value = value.slice(2)),
|
1810
2395
|
(value = getOutlinedModel(response, value, obj, key, createModel)),
|
1811
2396
|
loadServerReference$1(
|
1812
2397
|
response,
|
@@ -1818,15 +2403,22 @@ function parseModelString(response, obj, key, value) {
|
|
1818
2403
|
)
|
1819
2404
|
);
|
1820
2405
|
case "T":
|
1821
|
-
|
2406
|
+
if (void 0 === reference || void 0 === response._temporaryReferences)
|
2407
|
+
throw Error(
|
2408
|
+
"Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
|
2409
|
+
);
|
2410
|
+
return createTemporaryReference(
|
2411
|
+
response._temporaryReferences,
|
2412
|
+
reference
|
2413
|
+
);
|
1822
2414
|
case "Q":
|
1823
2415
|
return (
|
1824
|
-
(value =
|
2416
|
+
(value = value.slice(2)),
|
1825
2417
|
getOutlinedModel(response, value, obj, key, createMap)
|
1826
2418
|
);
|
1827
2419
|
case "W":
|
1828
2420
|
return (
|
1829
|
-
(value =
|
2421
|
+
(value = value.slice(2)),
|
1830
2422
|
getOutlinedModel(response, value, obj, key, createSet)
|
1831
2423
|
);
|
1832
2424
|
case "K":
|
@@ -1840,7 +2432,7 @@ function parseModelString(response, obj, key, value) {
|
|
1840
2432
|
return data;
|
1841
2433
|
case "i":
|
1842
2434
|
return (
|
1843
|
-
(value =
|
2435
|
+
(value = value.slice(2)),
|
1844
2436
|
getOutlinedModel(response, value, obj, key, extractIterator)
|
1845
2437
|
);
|
1846
2438
|
case "I":
|
@@ -1856,57 +2448,75 @@ function parseModelString(response, obj, key, value) {
|
|
1856
2448
|
case "n":
|
1857
2449
|
return BigInt(value.slice(2));
|
1858
2450
|
}
|
1859
|
-
|
2451
|
+
switch (value[1]) {
|
2452
|
+
case "A":
|
2453
|
+
return parseTypedArray(response, value, ArrayBuffer, 1, obj, key);
|
2454
|
+
case "O":
|
2455
|
+
return parseTypedArray(response, value, Int8Array, 1, obj, key);
|
2456
|
+
case "o":
|
2457
|
+
return parseTypedArray(response, value, Uint8Array, 1, obj, key);
|
2458
|
+
case "U":
|
2459
|
+
return parseTypedArray(response, value, Uint8ClampedArray, 1, obj, key);
|
2460
|
+
case "S":
|
2461
|
+
return parseTypedArray(response, value, Int16Array, 2, obj, key);
|
2462
|
+
case "s":
|
2463
|
+
return parseTypedArray(response, value, Uint16Array, 2, obj, key);
|
2464
|
+
case "L":
|
2465
|
+
return parseTypedArray(response, value, Int32Array, 4, obj, key);
|
2466
|
+
case "l":
|
2467
|
+
return parseTypedArray(response, value, Uint32Array, 4, obj, key);
|
2468
|
+
case "G":
|
2469
|
+
return parseTypedArray(response, value, Float32Array, 4, obj, key);
|
2470
|
+
case "g":
|
2471
|
+
return parseTypedArray(response, value, Float64Array, 8, obj, key);
|
2472
|
+
case "M":
|
2473
|
+
return parseTypedArray(response, value, BigInt64Array, 8, obj, key);
|
2474
|
+
case "m":
|
2475
|
+
return parseTypedArray(response, value, BigUint64Array, 8, obj, key);
|
2476
|
+
case "V":
|
2477
|
+
return parseTypedArray(response, value, DataView, 1, obj, key);
|
2478
|
+
case "B":
|
2479
|
+
return (
|
2480
|
+
(obj = parseInt(value.slice(2), 16)),
|
2481
|
+
response._formData.get(response._prefix + obj)
|
2482
|
+
);
|
2483
|
+
}
|
2484
|
+
switch (value[1]) {
|
2485
|
+
case "R":
|
2486
|
+
return parseReadableStream(response, value, void 0);
|
2487
|
+
case "r":
|
2488
|
+
return parseReadableStream(response, value, "bytes");
|
2489
|
+
case "X":
|
2490
|
+
return parseAsyncIterable(response, value, !1);
|
2491
|
+
case "x":
|
2492
|
+
return parseAsyncIterable(response, value, !0);
|
2493
|
+
}
|
2494
|
+
value = value.slice(1);
|
1860
2495
|
return getOutlinedModel(response, value, obj, key, createModel);
|
1861
2496
|
}
|
1862
2497
|
return value;
|
1863
2498
|
}
|
1864
|
-
function createResponse(bundlerConfig, formFieldPrefix) {
|
2499
|
+
function createResponse(bundlerConfig, formFieldPrefix, temporaryReferences) {
|
1865
2500
|
var backingFormData =
|
1866
|
-
|
1867
|
-
? arguments[
|
2501
|
+
3 < arguments.length && void 0 !== arguments[3]
|
2502
|
+
? arguments[3]
|
1868
2503
|
: new FormData(),
|
1869
|
-
chunks = new Map()
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
? parseModelString(response, this, key, value)
|
1878
|
-
: value;
|
1879
|
-
}
|
1880
|
-
};
|
1881
|
-
return response;
|
2504
|
+
chunks = new Map();
|
2505
|
+
return {
|
2506
|
+
_bundlerConfig: bundlerConfig,
|
2507
|
+
_prefix: formFieldPrefix,
|
2508
|
+
_formData: backingFormData,
|
2509
|
+
_chunks: chunks,
|
2510
|
+
_temporaryReferences: temporaryReferences
|
2511
|
+
};
|
1882
2512
|
}
|
1883
2513
|
function resolveField(response, key, value) {
|
1884
2514
|
response._formData.append(key, value);
|
1885
2515
|
var prefix = response._prefix;
|
1886
|
-
|
1887
|
-
key.startsWith(prefix) &&
|
2516
|
+
key.startsWith(prefix) &&
|
1888
2517
|
((response = response._chunks),
|
1889
2518
|
(key = +key.slice(prefix.length)),
|
1890
|
-
(
|
1891
|
-
"pending" === key.status &&
|
1892
|
-
((prefix = key.value),
|
1893
|
-
(response = key.reason),
|
1894
|
-
(key.status = "resolved_model"),
|
1895
|
-
(key.value = value),
|
1896
|
-
null !== prefix))
|
1897
|
-
)
|
1898
|
-
switch ((initializeModelChunk(key), key.status)) {
|
1899
|
-
case "fulfilled":
|
1900
|
-
wakeChunk(prefix, key.value);
|
1901
|
-
break;
|
1902
|
-
case "pending":
|
1903
|
-
case "blocked":
|
1904
|
-
key.value = prefix;
|
1905
|
-
key.reason = response;
|
1906
|
-
break;
|
1907
|
-
case "rejected":
|
1908
|
-
response && wakeChunk(response, key.reason);
|
1909
|
-
}
|
2519
|
+
(prefix = response.get(key)) && resolveModelChunk(prefix, value, key));
|
1910
2520
|
}
|
1911
2521
|
function close(response) {
|
1912
2522
|
reportGlobalError(response, Error("Connection closed."));
|
@@ -1927,7 +2537,7 @@ function loadServerReference(bundlerConfig, id, bound) {
|
|
1927
2537
|
: Promise.resolve(requireModule(serverReference));
|
1928
2538
|
}
|
1929
2539
|
function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
|
1930
|
-
body = createResponse(serverManifest, formFieldPrefix, body);
|
2540
|
+
body = createResponse(serverManifest, formFieldPrefix, void 0, body);
|
1931
2541
|
close(body);
|
1932
2542
|
body = getChunk(body, 0);
|
1933
2543
|
body.then(function () {});
|
@@ -1949,6 +2559,9 @@ exports.createClientModuleProxy = function (moduleId) {
|
|
1949
2559
|
moduleId = registerClientReferenceImpl({}, moduleId, !1);
|
1950
2560
|
return new Proxy(moduleId, proxyHandlers$1);
|
1951
2561
|
};
|
2562
|
+
exports.createTemporaryReferenceSet = function () {
|
2563
|
+
return new WeakMap();
|
2564
|
+
};
|
1952
2565
|
exports.decodeAction = function (body, serverManifest) {
|
1953
2566
|
var formData = new FormData(),
|
1954
2567
|
action = null;
|
@@ -1986,13 +2599,18 @@ exports.decodeFormState = function (actionResult, body, serverManifest) {
|
|
1986
2599
|
: [actionResult, keyPath, referenceId, bound.length - 1];
|
1987
2600
|
});
|
1988
2601
|
};
|
1989
|
-
exports.decodeReply = function (body, webpackMap) {
|
2602
|
+
exports.decodeReply = function (body, webpackMap, options) {
|
1990
2603
|
if ("string" === typeof body) {
|
1991
2604
|
var form = new FormData();
|
1992
2605
|
form.append("0", body);
|
1993
2606
|
body = form;
|
1994
2607
|
}
|
1995
|
-
body = createResponse(
|
2608
|
+
body = createResponse(
|
2609
|
+
webpackMap,
|
2610
|
+
"",
|
2611
|
+
options ? options.temporaryReferences : void 0,
|
2612
|
+
body
|
2613
|
+
);
|
1996
2614
|
webpackMap = getChunk(body, 0);
|
1997
2615
|
close(body);
|
1998
2616
|
return webpackMap;
|
@@ -2014,12 +2632,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap) {
|
|
2014
2632
|
"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."
|
2015
2633
|
);
|
2016
2634
|
pendingFiles++;
|
2017
|
-
var
|
2635
|
+
var JSCompiler_object_inline_chunks_213 = [];
|
2018
2636
|
value.on("data", function (chunk) {
|
2019
|
-
|
2637
|
+
JSCompiler_object_inline_chunks_213.push(chunk);
|
2020
2638
|
});
|
2021
2639
|
value.on("end", function () {
|
2022
|
-
var blob = new Blob(
|
2640
|
+
var blob = new Blob(JSCompiler_object_inline_chunks_213, {
|
2023
2641
|
type: mimeType
|
2024
2642
|
});
|
2025
2643
|
response._formData.append(name, blob, filename);
|
@@ -2067,7 +2685,9 @@ exports.renderToPipeableStream = function (model, webpackMap, options) {
|
|
2067
2685
|
webpackMap,
|
2068
2686
|
options ? options.onError : void 0,
|
2069
2687
|
options ? options.identifierPrefix : void 0,
|
2070
|
-
options ? options.onPostpone : void 0
|
2688
|
+
options ? options.onPostpone : void 0,
|
2689
|
+
options ? options.environmentName : void 0,
|
2690
|
+
options ? options.temporaryReferences : void 0
|
2071
2691
|
),
|
2072
2692
|
hasStartedFlowing = !1;
|
2073
2693
|
startWork(request);
|