@vitejs/plugin-rsc 0.5.34 → 0.5.35

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.
Files changed (81) hide show
  1. package/README.md +15 -0
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/{cjs-AWVWfddx.js → cjs-DhDj_zQT.js} +2 -2
  4. package/dist/client-Dq3oGLRS.d.ts +8 -0
  5. package/dist/{client-reference-DEZtXTv1.d.ts → client-reference-Bk5pzNGN.d.ts} +1 -1
  6. package/dist/client.node-BEQT2PT-.d.ts +9 -0
  7. package/dist/client.shared-D1HxyClg.js +10 -0
  8. package/dist/client.shared-VT232QCM.d.ts +16 -0
  9. package/dist/core/browser.js +1 -1
  10. package/dist/core/plugin.d.ts +2 -3
  11. package/dist/core/rsc.d.ts +1 -1
  12. package/dist/core/rsc.js +1 -1
  13. package/dist/core/ssr.d.ts +1 -7
  14. package/dist/core/ssr.js +1 -1
  15. package/dist/{index-C5IY2S-e.d.ts → index-CROaL0MT.d.ts} +34 -8
  16. package/dist/index.js +1 -1
  17. package/dist/{picocolors-391UXIDd.js → picocolors-DCTC64Zv.js} +1 -1
  18. package/dist/{plugin-Cbs9j6lP.js → plugin-CLvIS10V.js} +37 -27
  19. package/dist/plugin.js +1 -1
  20. package/dist/plugins/cjs.d.ts +2 -3
  21. package/dist/plugins/cjs.js +1 -1
  22. package/dist/react/browser.d.ts +10 -10
  23. package/dist/react/rsc/client.d.ts +1 -1
  24. package/dist/react/rsc/client.js +2 -5
  25. package/dist/react/rsc/client.node.d.ts +2 -0
  26. package/dist/react/rsc/client.node.js +16 -0
  27. package/dist/react/rsc/server.d.ts +2 -2
  28. package/dist/react/rsc/server.node.d.ts +3 -0
  29. package/dist/react/rsc/server.node.js +24 -0
  30. package/dist/react/rsc/static.d.ts +4 -5
  31. package/dist/react/rsc/static.node.d.ts +6 -0
  32. package/dist/react/rsc/static.node.js +11 -0
  33. package/dist/react/rsc.d.ts +3 -3
  34. package/dist/react/ssr.d.ts +9 -9
  35. package/dist/react/ssr.node.d.ts +12 -0
  36. package/dist/react/ssr.node.js +21 -0
  37. package/dist/rsc/client.d.ts +1 -1
  38. package/dist/rsc/client.node.d.ts +2 -0
  39. package/dist/rsc/client.node.js +3 -0
  40. package/dist/rsc/server.d.ts +5 -5
  41. package/dist/rsc/server.node.d.ts +19 -0
  42. package/dist/rsc/server.node.js +13 -0
  43. package/dist/rsc/static.d.ts +4 -5
  44. package/dist/rsc/static.node.d.ts +16 -0
  45. package/dist/rsc/static.node.js +12 -0
  46. package/dist/{rsc-C3UdJLOW.d.ts → rsc-D8UlANI2.d.ts} +1 -1
  47. package/dist/rsc.d.ts +3 -3
  48. package/dist/rsc.node.d.ts +6 -0
  49. package/dist/rsc.node.js +7 -0
  50. package/dist/{scope-Bdx33sQv.js → scope-Ck0n25my.js} +2 -4
  51. package/dist/{server-ZBjqNTqU.d.ts → server-YwgjVtsE.d.ts} +2 -2
  52. package/dist/server.node-DU77AeKU.d.ts +15 -0
  53. package/dist/shared-BWJvctW6.js +34 -0
  54. package/dist/shared-CXQb6hk9.js +89 -0
  55. package/dist/shared-DJBuYpZL.d.ts +20 -0
  56. package/dist/ssr-C-U7jY5S.d.ts +8 -0
  57. package/dist/ssr.d.ts +3 -21
  58. package/dist/ssr.js +1 -87
  59. package/dist/ssr.node.d.ts +5 -0
  60. package/dist/ssr.node.js +4 -0
  61. package/dist/transforms/index.js +67 -60
  62. package/dist/utils/encryption-runtime.d.ts +3 -4
  63. package/dist/utils/encryption-runtime.js +4 -2
  64. package/dist/utils/rpc.d.ts +3 -4
  65. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.development.js +909 -495
  66. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.production.js +399 -265
  67. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.development.js +901 -477
  68. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.production.js +380 -219
  69. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.development.js +925 -484
  70. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.production.js +385 -221
  71. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.development.js +726 -388
  72. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.production.js +566 -397
  73. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.development.js +734 -397
  74. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.production.js +477 -238
  75. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.development.js +1029 -620
  76. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.production.js +481 -261
  77. package/dist/vendor/react-server-dom/esm/react-server-dom-webpack-node-loader.production.js +2 -2
  78. package/dist/vendor/react-server-dom/package.json +3 -3
  79. package/package.json +15 -15
  80. package/dist/client-Bhch3O41.d.ts +0 -19
  81. package/dist/dist-uqdtSkzK.js +0 -64
@@ -25,9 +25,9 @@ var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
25
25
  REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
26
26
  REACT_MEMO_TYPE = Symbol.for("react.memo"),
27
27
  REACT_LAZY_TYPE = Symbol.for("react.lazy"),
28
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
29
- Symbol.for("react.postpone");
30
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
28
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
29
+ REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
30
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
31
31
  function getIteratorFn(maybeIterable) {
32
32
  if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
33
33
  maybeIterable =
@@ -36,24 +36,21 @@ function getIteratorFn(maybeIterable) {
36
36
  return "function" === typeof maybeIterable ? maybeIterable : null;
37
37
  }
38
38
  var ASYNC_ITERATOR = Symbol.asyncIterator,
39
+ REACT_OPTIMISTIC_KEY = Symbol.for("react.optimistic_key"),
39
40
  scheduleMicrotask = queueMicrotask,
40
41
  currentView = null,
41
42
  writtenBytes = 0,
42
43
  destinationHasCapacity = !0;
43
- function writeToDestination(destination, view) {
44
- destination = destination.write(view);
45
- destinationHasCapacity = destinationHasCapacity && destination;
46
- }
47
- function writeChunkAndReturn(destination, chunk) {
44
+ function writeChunk(destination, chunk) {
48
45
  if ("string" === typeof chunk) {
49
46
  if (0 !== chunk.length)
50
- if (2048 < 3 * chunk.length)
47
+ if (4096 < 3 * chunk.length)
51
48
  0 < writtenBytes &&
52
49
  (writeToDestination(
53
50
  destination,
54
51
  currentView.subarray(0, writtenBytes)
55
52
  ),
56
- (currentView = new Uint8Array(2048)),
53
+ (currentView = new Uint8Array(4096)),
57
54
  (writtenBytes = 0)),
58
55
  writeToDestination(destination, chunk);
59
56
  else {
@@ -67,25 +64,25 @@ function writeChunkAndReturn(destination, chunk) {
67
64
  destination,
68
65
  currentView.subarray(0, writtenBytes)
69
66
  ),
70
- (currentView = new Uint8Array(2048)),
67
+ (currentView = new Uint8Array(4096)),
71
68
  (writtenBytes = textEncoder.encodeInto(
72
69
  chunk.slice(read),
73
70
  currentView
74
71
  ).written));
75
- 2048 === writtenBytes &&
72
+ 4096 === writtenBytes &&
76
73
  (writeToDestination(destination, currentView),
77
- (currentView = new Uint8Array(2048)),
74
+ (currentView = new Uint8Array(4096)),
78
75
  (writtenBytes = 0));
79
76
  }
80
77
  } else
81
78
  0 !== chunk.byteLength &&
82
- (2048 < chunk.byteLength
79
+ (4096 < chunk.byteLength
83
80
  ? (0 < writtenBytes &&
84
81
  (writeToDestination(
85
82
  destination,
86
83
  currentView.subarray(0, writtenBytes)
87
84
  ),
88
- (currentView = new Uint8Array(2048)),
85
+ (currentView = new Uint8Array(4096)),
89
86
  (writtenBytes = 0)),
90
87
  writeToDestination(destination, chunk))
91
88
  : ((target = currentView.length - writtenBytes),
@@ -96,14 +93,21 @@ function writeChunkAndReturn(destination, chunk) {
96
93
  (writtenBytes += target),
97
94
  writeToDestination(destination, currentView),
98
95
  (chunk = chunk.subarray(target))),
99
- (currentView = new Uint8Array(2048)),
96
+ (currentView = new Uint8Array(4096)),
100
97
  (writtenBytes = 0)),
101
98
  currentView.set(chunk, writtenBytes),
102
99
  (writtenBytes += chunk.byteLength),
103
- 2048 === writtenBytes &&
100
+ 4096 === writtenBytes &&
104
101
  (writeToDestination(destination, currentView),
105
- (currentView = new Uint8Array(2048)),
102
+ (currentView = new Uint8Array(4096)),
106
103
  (writtenBytes = 0))));
104
+ }
105
+ function writeToDestination(destination, view) {
106
+ destination = destination.write(view);
107
+ destinationHasCapacity = destinationHasCapacity && destination;
108
+ }
109
+ function writeChunkAndReturn(destination, chunk) {
110
+ writeChunk(destination, chunk);
107
111
  return destinationHasCapacity;
108
112
  }
109
113
  var textEncoder = new util.TextEncoder();
@@ -148,7 +152,7 @@ var serverReferenceToString = {
148
152
  },
149
153
  PROMISE_PROTOTYPE = Promise.prototype,
150
154
  deepProxyHandlers = {
151
- get: function (target, name) {
155
+ get: function (target, name, receiver) {
152
156
  switch (name) {
153
157
  case "$$typeof":
154
158
  return target.$$typeof;
@@ -171,9 +175,7 @@ var serverReferenceToString = {
171
175
  case Symbol.toStringTag:
172
176
  return Object.prototype[Symbol.toStringTag];
173
177
  case "Provider":
174
- throw Error(
175
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
176
- );
178
+ return receiver;
177
179
  case "then":
178
180
  throw Error(
179
181
  "Cannot await or return from a thenable. You cannot await a client module from a server component."
@@ -504,7 +506,7 @@ function getChildFormatContext(parentContext, type, props) {
504
506
  });
505
507
  break;
506
508
  case "stylesheet":
507
- preload(srcSet, "stylesheet", {
509
+ preload(srcSet, "style", {
508
510
  crossOrigin: props.crossOrigin,
509
511
  integrity: props.integrity,
510
512
  nonce: props.nonce,
@@ -526,7 +528,7 @@ function getChildFormatContext(parentContext, type, props) {
526
528
  var requestStorage = new async_hooks.AsyncLocalStorage(),
527
529
  TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
528
530
  proxyHandlers = {
529
- get: function (target, name) {
531
+ get: function (target, name, receiver) {
530
532
  switch (name) {
531
533
  case "$$typeof":
532
534
  return target.$$typeof;
@@ -545,9 +547,7 @@ var requestStorage = new async_hooks.AsyncLocalStorage(),
545
547
  case Symbol.toStringTag:
546
548
  return Object.prototype[Symbol.toStringTag];
547
549
  case "Provider":
548
- throw Error(
549
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
550
- );
550
+ return receiver;
551
551
  case "then":
552
552
  return;
553
553
  }
@@ -588,7 +588,12 @@ function trackUsedThenable(thenableState, thenable, index) {
588
588
  case "fulfilled":
589
589
  return thenable.value;
590
590
  case "rejected":
591
- throw thenable.reason;
591
+ thenableState = thenable.reason;
592
+ if (void 0 === thenableState && !("reason" in thenable))
593
+ throw Error(
594
+ "A rejected Promise was passed to React without a `reason` property. React threw a generic error from where the Promise was used to assist in identifying the problematic Promise. Make sure that instrumented Promises correctly set the `reason` property when setting `status` to `'rejected'`."
595
+ );
596
+ throw thenableState;
592
597
  default:
593
598
  "string" === typeof thenable.status
594
599
  ? thenable.then(noop, noop)
@@ -671,9 +676,9 @@ var HooksDispatcher = {
671
676
  },
672
677
  useCacheRefresh: function () {
673
678
  return unsupportedRefresh;
674
- }
679
+ },
680
+ useEffectEvent: unsupportedHook
675
681
  };
676
- HooksDispatcher.useEffectEvent = unsupportedHook;
677
682
  function unsupportedHook() {
678
683
  throw Error("This Hook is not supported in Server Components.");
679
684
  }
@@ -767,6 +772,8 @@ function describeElementType(type) {
767
772
  return "Suspense";
768
773
  case REACT_SUSPENSE_LIST_TYPE:
769
774
  return "SuspenseList";
775
+ case REACT_VIEW_TRANSITION_TYPE:
776
+ return "ViewTransition";
770
777
  }
771
778
  if ("object" === typeof type)
772
779
  switch (type.$$typeof) {
@@ -842,7 +849,8 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
842
849
  }
843
850
  var hasOwnProperty = Object.prototype.hasOwnProperty,
844
851
  ObjectPrototype$1 = Object.prototype,
845
- stringify = JSON.stringify;
852
+ stringify = JSON.stringify,
853
+ NEXT_TWO_CHUNKS_ARE_ATOMIC = Symbol();
846
854
  function defaultErrorHandler(error) {
847
855
  console.error(error);
848
856
  }
@@ -851,7 +859,6 @@ function RequestInstance(
851
859
  model,
852
860
  bundlerConfig,
853
861
  onError,
854
- onPostpone,
855
862
  onAllReady,
856
863
  onFatalError,
857
864
  identifierPrefix,
@@ -885,12 +892,13 @@ function RequestInstance(
885
892
  this.writtenClientReferences = new Map();
886
893
  this.writtenServerReferences = new Map();
887
894
  this.writtenObjects = new WeakMap();
895
+ this.writtenImportStrings = new Map();
896
+ this.writtenImportStringsSize = 0;
888
897
  this.temporaryReferences = temporaryReferences;
889
898
  this.identifierPrefix = identifierPrefix || "";
890
899
  this.identifierCount = 1;
891
900
  this.taintCleanupQueue = [];
892
901
  this.onError = void 0 === onError ? defaultErrorHandler : onError;
893
- this.onPostpone = void 0 === onPostpone ? noop : onPostpone;
894
902
  this.onAllReady = onAllReady;
895
903
  this.onFatalError = onFatalError;
896
904
  type = createTask(this, model, null, !1, 0, abortSet);
@@ -903,31 +911,52 @@ function resolveRequest() {
903
911
  return store ? store : null;
904
912
  }
905
913
  function serializeThenable(request, task, thenable) {
906
- var newTask = createTask(
907
- request,
908
- thenable,
909
- task.keyPath,
910
- task.implicitSlot,
911
- task.formatContext,
912
- request.abortableTasks
913
- );
914
914
  switch (thenable.status) {
915
915
  case "fulfilled":
916
916
  return (
917
- (newTask.model = thenable.value), pingTask(request, newTask), newTask.id
917
+ (task = createTask(
918
+ request,
919
+ thenable,
920
+ task.keyPath,
921
+ task.implicitSlot,
922
+ task.formatContext,
923
+ request.abortableTasks
924
+ )),
925
+ (task.model = thenable.value),
926
+ pingTask(request, task),
927
+ task.id
918
928
  );
919
929
  case "rejected":
920
- return erroredTask(request, newTask, thenable.reason), newTask.id;
930
+ return (
931
+ (task = createTask(
932
+ request,
933
+ thenable,
934
+ task.keyPath,
935
+ task.implicitSlot,
936
+ task.formatContext,
937
+ request.abortableTasks
938
+ )),
939
+ erroredTask(request, task, thenable.reason),
940
+ task.id
941
+ );
921
942
  default:
943
+ var newTask$12 = createTask(
944
+ request,
945
+ thenable,
946
+ task.keyPath,
947
+ task.implicitSlot,
948
+ task.formatContext,
949
+ request.abortableTasks
950
+ );
922
951
  if (12 === request.status)
923
952
  return (
924
- request.abortableTasks.delete(newTask),
953
+ request.abortableTasks.delete(newTask$12),
925
954
  21 === request.type
926
- ? (haltTask(newTask), finishHaltedTask(newTask, request))
955
+ ? (haltTask(newTask$12), finishHaltedTask(newTask$12, request))
927
956
  : ((task = request.fatalError),
928
- abortTask(newTask),
929
- finishAbortedTask(newTask, request, task)),
930
- newTask.id
957
+ abortTask(newTask$12),
958
+ finishAbortedTask(newTask$12, request, task)),
959
+ newTask$12.id
931
960
  );
932
961
  "string" !== typeof thenable.status &&
933
962
  ((thenable.status = "pending"),
@@ -942,18 +971,18 @@ function serializeThenable(request, task, thenable) {
942
971
  ((thenable.status = "rejected"), (thenable.reason = error));
943
972
  }
944
973
  ));
974
+ thenable.then(
975
+ function (value) {
976
+ newTask$12.model = value;
977
+ pingTask(request, newTask$12);
978
+ },
979
+ function (reason) {
980
+ 0 === newTask$12.status &&
981
+ (erroredTask(request, newTask$12, reason), enqueueFlush(request));
982
+ }
983
+ );
984
+ return newTask$12.id;
945
985
  }
946
- thenable.then(
947
- function (value) {
948
- newTask.model = value;
949
- pingTask(request, newTask);
950
- },
951
- function (reason) {
952
- 0 === newTask.status &&
953
- (erroredTask(request, newTask, reason), enqueueFlush(request));
954
- }
955
- );
956
- return newTask.id;
957
986
  }
958
987
  function serializeReadableStream(request, task, stream) {
959
988
  function progress(entry) {
@@ -971,13 +1000,21 @@ function serializeReadableStream(request, task, stream) {
971
1000
  callOnAllReadyIfReady(request);
972
1001
  else
973
1002
  try {
974
- (streamTask.model = entry.value),
975
- request.pendingChunks++,
976
- tryStreamTask(request, streamTask),
1003
+ request.pendingChunks++,
1004
+ (streamTask.model = entry.value),
1005
+ isByteStream
1006
+ ? emitTypedArrayChunk(
1007
+ request,
1008
+ streamTask.id,
1009
+ "b",
1010
+ streamTask.model,
1011
+ !1
1012
+ )
1013
+ : tryStreamTask(request, streamTask),
977
1014
  enqueueFlush(request),
978
1015
  reader.read().then(progress, error);
979
- } catch (x$11) {
980
- error(x$11);
1016
+ } catch (x$13) {
1017
+ error(x$13);
981
1018
  }
982
1019
  }
983
1020
  function error(reason) {
@@ -1007,7 +1044,8 @@ function serializeReadableStream(request, task, stream) {
1007
1044
  } catch (x) {
1008
1045
  supportsBYOB = !1;
1009
1046
  }
1010
- var reader = stream.getReader(),
1047
+ var isByteStream = supportsBYOB,
1048
+ reader = stream.getReader(),
1011
1049
  streamTask = createTask(
1012
1050
  request,
1013
1051
  task.model,
@@ -1017,7 +1055,7 @@ function serializeReadableStream(request, task, stream) {
1017
1055
  request.abortableTasks
1018
1056
  );
1019
1057
  request.pendingChunks++;
1020
- task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
1058
+ task = streamTask.id.toString(16) + ":" + (isByteStream ? "r" : "R") + "\n";
1021
1059
  request.completedRegularChunks.push(task);
1022
1060
  request.cacheController.signal.addEventListener("abort", abortStream);
1023
1061
  reader.read().then(progress, error);
@@ -1061,8 +1099,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
1061
1099
  tryStreamTask(request, streamTask),
1062
1100
  enqueueFlush(request),
1063
1101
  iterator.next().then(progress, error);
1064
- } catch (x$12) {
1065
- error(x$12);
1102
+ } catch (x$14) {
1103
+ error(x$14);
1066
1104
  }
1067
1105
  }
1068
1106
  function error(reason) {
@@ -1186,7 +1224,12 @@ function renderFunctionComponent(request, task, key, Component, props) {
1186
1224
  Component = task.keyPath;
1187
1225
  prevThenableState = task.implicitSlot;
1188
1226
  null !== key
1189
- ? (task.keyPath = null === Component ? key : Component + "," + key)
1227
+ ? (task.keyPath =
1228
+ key === REACT_OPTIMISTIC_KEY || Component === REACT_OPTIMISTIC_KEY
1229
+ ? REACT_OPTIMISTIC_KEY
1230
+ : null === Component
1231
+ ? key
1232
+ : Component + "," + key)
1190
1233
  : null === Component && (task.implicitSlot = !0);
1191
1234
  request = renderModelDestructive(request, task, emptyRoot, "", props);
1192
1235
  task.keyPath = Component;
@@ -1269,7 +1312,11 @@ function renderElement(request, task, type, key, ref, props) {
1269
1312
  key = task.keyPath;
1270
1313
  null === request
1271
1314
  ? (request = key)
1272
- : null !== key && (request = key + "," + request);
1315
+ : null !== key &&
1316
+ (request =
1317
+ key === REACT_OPTIMISTIC_KEY || request === REACT_OPTIMISTIC_KEY
1318
+ ? REACT_OPTIMISTIC_KEY
1319
+ : key + "," + request);
1273
1320
  props = [REACT_ELEMENT_TYPE, type, request, props];
1274
1321
  task = task.implicitSlot && null !== request ? [props] : props;
1275
1322
  return task;
@@ -1294,9 +1341,27 @@ function createTask(
1294
1341
  implicitSlot,
1295
1342
  formatContext,
1296
1343
  abortSet
1344
+ ) {
1345
+ return createTaskWithID(
1346
+ request,
1347
+ request.nextChunkId++,
1348
+ model,
1349
+ keyPath,
1350
+ implicitSlot,
1351
+ formatContext,
1352
+ abortSet
1353
+ );
1354
+ }
1355
+ function createTaskWithID(
1356
+ request,
1357
+ id,
1358
+ model,
1359
+ keyPath,
1360
+ implicitSlot,
1361
+ formatContext,
1362
+ abortSet
1297
1363
  ) {
1298
1364
  request.pendingChunks++;
1299
- var id = request.nextChunkId++;
1300
1365
  "object" !== typeof model ||
1301
1366
  null === model ||
1302
1367
  null !== keyPath ||
@@ -1312,83 +1377,125 @@ function createTask(
1312
1377
  ping: function () {
1313
1378
  return pingTask(request, task);
1314
1379
  },
1315
- toJSON: function (parentPropertyName, value) {
1316
- serializedSize += parentPropertyName.length;
1317
- var prevKeyPath = task.keyPath,
1318
- prevImplicitSlot = task.implicitSlot;
1319
- try {
1320
- var JSCompiler_inline_result = renderModelDestructive(
1321
- request,
1322
- task,
1323
- this,
1324
- parentPropertyName,
1325
- value
1326
- );
1327
- } catch (thrownValue) {
1328
- if (
1329
- ((parentPropertyName = task.model),
1330
- (parentPropertyName =
1331
- "object" === typeof parentPropertyName &&
1332
- null !== parentPropertyName &&
1333
- (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
1334
- parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
1335
- 12 === request.status)
1336
- )
1337
- (task.status = 3),
1338
- 21 === request.type
1339
- ? ((prevKeyPath = request.nextChunkId++),
1340
- (prevKeyPath = parentPropertyName
1341
- ? serializeLazyID(prevKeyPath)
1342
- : serializeByValueID(prevKeyPath)),
1343
- (JSCompiler_inline_result = prevKeyPath))
1344
- : ((prevKeyPath = request.fatalError),
1345
- (JSCompiler_inline_result = parentPropertyName
1346
- ? serializeLazyID(prevKeyPath)
1347
- : serializeByValueID(prevKeyPath)));
1348
- else if (
1349
- ((value =
1350
- thrownValue === SuspenseException
1351
- ? getSuspendedThenable()
1352
- : thrownValue),
1353
- "object" === typeof value &&
1354
- null !== value &&
1355
- "function" === typeof value.then)
1356
- ) {
1357
- JSCompiler_inline_result = createTask(
1358
- request,
1359
- task.model,
1360
- task.keyPath,
1361
- task.implicitSlot,
1362
- task.formatContext,
1363
- request.abortableTasks
1364
- );
1365
- var ping = JSCompiler_inline_result.ping;
1366
- value.then(ping, ping);
1367
- JSCompiler_inline_result.thenableState =
1368
- getThenableStateAfterSuspending();
1369
- task.keyPath = prevKeyPath;
1370
- task.implicitSlot = prevImplicitSlot;
1371
- JSCompiler_inline_result = parentPropertyName
1372
- ? serializeLazyID(JSCompiler_inline_result.id)
1373
- : serializeByValueID(JSCompiler_inline_result.id);
1374
- } else
1375
- (task.keyPath = prevKeyPath),
1376
- (task.implicitSlot = prevImplicitSlot),
1377
- request.pendingChunks++,
1378
- (prevKeyPath = request.nextChunkId++),
1379
- (prevImplicitSlot = logRecoverableError(request, value, task)),
1380
- emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1381
- (JSCompiler_inline_result = parentPropertyName
1382
- ? serializeLazyID(prevKeyPath)
1383
- : serializeByValueID(prevKeyPath));
1384
- }
1385
- return JSCompiler_inline_result;
1386
- },
1387
1380
  thenableState: null
1388
1381
  };
1389
1382
  abortSet.add(task);
1390
1383
  return task;
1391
1384
  }
1385
+ function resolveModel(request, task, parent, parentPropertyName, value) {
1386
+ var jsonValue = value;
1387
+ null !== value &&
1388
+ "object" === typeof value &&
1389
+ "function" === typeof value.toJSON &&
1390
+ (jsonValue = value.toJSON(parentPropertyName));
1391
+ serializedSize += parentPropertyName.length;
1392
+ value = task.keyPath;
1393
+ var prevImplicitSlot = task.implicitSlot;
1394
+ try {
1395
+ var JSCompiler_inline_result = renderModelDestructive(
1396
+ request,
1397
+ task,
1398
+ parent,
1399
+ parentPropertyName,
1400
+ jsonValue
1401
+ );
1402
+ } catch (thrownValue) {
1403
+ (parent = task.model),
1404
+ (parent =
1405
+ "object" === typeof parent &&
1406
+ null !== parent &&
1407
+ (parent.$$typeof === REACT_ELEMENT_TYPE ||
1408
+ parent.$$typeof === REACT_LAZY_TYPE)),
1409
+ 12 === request.status
1410
+ ? ((task.status = 3),
1411
+ 21 === request.type
1412
+ ? ((value = request.nextChunkId++),
1413
+ (value = parent
1414
+ ? serializeLazyID(value)
1415
+ : serializeByValueID(value)),
1416
+ (JSCompiler_inline_result = value))
1417
+ : ((value = request.fatalError),
1418
+ (JSCompiler_inline_result = parent
1419
+ ? serializeLazyID(value)
1420
+ : serializeByValueID(value))))
1421
+ : ((parentPropertyName =
1422
+ thrownValue === SuspenseException
1423
+ ? getSuspendedThenable()
1424
+ : thrownValue),
1425
+ "object" === typeof parentPropertyName &&
1426
+ null !== parentPropertyName &&
1427
+ "function" === typeof parentPropertyName.then
1428
+ ? ((jsonValue = createTask(
1429
+ request,
1430
+ task.model,
1431
+ task.keyPath,
1432
+ task.implicitSlot,
1433
+ task.formatContext,
1434
+ request.abortableTasks
1435
+ )),
1436
+ (JSCompiler_inline_result = jsonValue.ping),
1437
+ parentPropertyName.then(
1438
+ JSCompiler_inline_result,
1439
+ JSCompiler_inline_result
1440
+ ),
1441
+ (jsonValue.thenableState = getThenableStateAfterSuspending()),
1442
+ (task.keyPath = value),
1443
+ (task.implicitSlot = prevImplicitSlot),
1444
+ (JSCompiler_inline_result = parent
1445
+ ? serializeLazyID(jsonValue.id)
1446
+ : serializeByValueID(jsonValue.id)))
1447
+ : ((task.keyPath = value),
1448
+ (task.implicitSlot = prevImplicitSlot),
1449
+ request.pendingChunks++,
1450
+ (value = request.nextChunkId++),
1451
+ (prevImplicitSlot = logRecoverableError(
1452
+ request,
1453
+ parentPropertyName,
1454
+ task
1455
+ )),
1456
+ emitErrorChunk(request, value, prevImplicitSlot),
1457
+ (JSCompiler_inline_result = parent
1458
+ ? serializeLazyID(value)
1459
+ : serializeByValueID(value))));
1460
+ }
1461
+ value = JSCompiler_inline_result;
1462
+ if (null === value || "object" !== typeof value) return value;
1463
+ if (isArrayImpl(value)) {
1464
+ var resolved$16 = [];
1465
+ for (
1466
+ prevImplicitSlot = 0;
1467
+ prevImplicitSlot < value.length;
1468
+ prevImplicitSlot++
1469
+ )
1470
+ resolved$16[prevImplicitSlot] = resolveModel(
1471
+ request,
1472
+ task,
1473
+ value,
1474
+ "" + prevImplicitSlot,
1475
+ value[prevImplicitSlot]
1476
+ );
1477
+ return resolved$16;
1478
+ }
1479
+ prevImplicitSlot = {};
1480
+ for (resolved$16 in value)
1481
+ hasOwnProperty.call(value, resolved$16) &&
1482
+ ((parent = resolveModel(
1483
+ request,
1484
+ task,
1485
+ value,
1486
+ resolved$16,
1487
+ value[resolved$16]
1488
+ )),
1489
+ "__proto__" === resolved$16
1490
+ ? Object.defineProperty(prevImplicitSlot, resolved$16, {
1491
+ value: parent,
1492
+ enumerable: !0,
1493
+ writable: !0,
1494
+ configurable: !0
1495
+ })
1496
+ : (prevImplicitSlot[resolved$16] = parent));
1497
+ return prevImplicitSlot;
1498
+ }
1392
1499
  function serializeByValueID(id) {
1393
1500
  return "$" + id.toString(16);
1394
1501
  }
@@ -1442,10 +1549,29 @@ function serializeClientReference(
1442
1549
  !0 === resolvedModuleData.async || !0 === clientReference.$$async
1443
1550
  ? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
1444
1551
  : [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
1552
+ var copy = transformImportMetadata(request, JSCompiler_inline_result, 0);
1553
+ if (copy !== NOT_PLAIN_IMPORT_METADATA)
1554
+ var JSCompiler_temp = stringify(copy);
1555
+ else
1556
+ b: {
1557
+ clientReference = importStringRequest;
1558
+ importStringRequest = request;
1559
+ try {
1560
+ JSCompiler_temp = stringify(
1561
+ JSCompiler_inline_result,
1562
+ importMetadataReplacer
1563
+ );
1564
+ break b;
1565
+ } finally {
1566
+ importStringRequest = clientReference;
1567
+ }
1568
+ JSCompiler_temp = void 0;
1569
+ }
1570
+ var JSCompiler_inline_result$jscomp$0 = JSCompiler_temp;
1445
1571
  request.pendingChunks++;
1446
1572
  var importId = request.nextChunkId++,
1447
- json = stringify(JSCompiler_inline_result),
1448
- processedChunk = importId.toString(16) + ":I" + json + "\n";
1573
+ processedChunk =
1574
+ importId.toString(16) + ":I" + JSCompiler_inline_result$jscomp$0 + "\n";
1449
1575
  request.completedImportChunks.push(processedChunk);
1450
1576
  writtenClientReferences.set(clientReferenceKey, importId);
1451
1577
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
@@ -1517,6 +1643,25 @@ function serializeBlob(request, blob) {
1517
1643
  reader.read().then(progress).catch(error);
1518
1644
  return "$B" + newTask.id.toString(16);
1519
1645
  }
1646
+ function escapeStringValue(value) {
1647
+ return "$" === value[0] ? "$" + value : value;
1648
+ }
1649
+ function serializeImportString(request, value) {
1650
+ if (16 > value.length) return escapeStringValue(value);
1651
+ var writtenStrings = request.writtenImportStrings,
1652
+ existing = writtenStrings.get(value);
1653
+ if (void 0 !== existing) return existing;
1654
+ existing = request.writtenImportStringsSize + value.length;
1655
+ if (32768 < existing) return escapeStringValue(value);
1656
+ request.writtenImportStringsSize = existing;
1657
+ request.pendingChunks++;
1658
+ existing = request.nextChunkId++;
1659
+ var json = stringify(escapeStringValue(value));
1660
+ request.completedImportChunks.push(existing.toString(16) + ":" + json + "\n");
1661
+ request = serializeByValueID(existing);
1662
+ writtenStrings.set(value, request);
1663
+ return request;
1664
+ }
1520
1665
  var modelRoot = !1;
1521
1666
  function renderModelDestructive(
1522
1667
  request,
@@ -1565,10 +1710,16 @@ function renderModelDestructive(
1565
1710
  case REACT_LAZY_TYPE:
1566
1711
  if (3200 < serializedSize) return deferTask(request, task);
1567
1712
  task.thenableState = null;
1568
- parentPropertyName = value._init;
1569
- value = parentPropertyName(value._payload);
1713
+ elementReference = value._init;
1714
+ value = elementReference(value._payload);
1570
1715
  if (12 === request.status) throw null;
1571
- return renderModelDestructive(request, task, emptyRoot, "", value);
1716
+ return renderModelDestructive(
1717
+ request,
1718
+ task,
1719
+ parent,
1720
+ parentPropertyName,
1721
+ value
1722
+ );
1572
1723
  case REACT_LEGACY_ELEMENT_TYPE:
1573
1724
  throw Error(
1574
1725
  '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.'
@@ -1716,23 +1867,19 @@ function renderModelDestructive(
1716
1867
  );
1717
1868
  return value;
1718
1869
  }
1719
- if ("string" === typeof value) {
1720
- serializedSize += value.length;
1721
- if (
1870
+ if ("string" === typeof value)
1871
+ return (
1872
+ (serializedSize += value.length),
1722
1873
  "Z" === value[value.length - 1] &&
1723
1874
  parent[parentPropertyName] instanceof Date
1724
- )
1725
- return "$D" + value;
1726
- if (1024 <= value.length && null !== byteLengthOfChunk)
1727
- return (
1728
- request.pendingChunks++,
1729
- (task = request.nextChunkId++),
1730
- emitTextChunk(request, task, value, !1),
1731
- serializeByValueID(task)
1732
- );
1733
- request = "$" === value[0] ? "$" + value : value;
1734
- return request;
1735
- }
1875
+ ? "$D" + value
1876
+ : 1024 <= value.length && null !== byteLengthOfChunk
1877
+ ? (request.pendingChunks++,
1878
+ (task = request.nextChunkId++),
1879
+ emitTextChunk(request, task, value, !1),
1880
+ serializeByValueID(task))
1881
+ : escapeStringValue(value)
1882
+ );
1736
1883
  if ("boolean" === typeof value) return value;
1737
1884
  if ("number" === typeof value)
1738
1885
  return Number.isFinite(value)
@@ -1855,6 +2002,69 @@ function emitErrorChunk(request, id, digest) {
1855
2002
  id = id.toString(16) + ":E" + stringify(digest) + "\n";
1856
2003
  request.completedErrorChunks.push(id);
1857
2004
  }
2005
+ var importStringRequest = null;
2006
+ function importMetadataReplacer(key, value) {
2007
+ return "string" === typeof value
2008
+ ? ((key = importStringRequest),
2009
+ null === key
2010
+ ? escapeStringValue(value)
2011
+ : serializeImportString(key, value))
2012
+ : value;
2013
+ }
2014
+ var NOT_PLAIN_IMPORT_METADATA = {};
2015
+ function transformImportMetadata(request, value, depth) {
2016
+ switch (typeof value) {
2017
+ case "string":
2018
+ return serializeImportString(request, value);
2019
+ case "number":
2020
+ case "boolean":
2021
+ case "undefined":
2022
+ return value;
2023
+ case "object":
2024
+ if (null === value) return null;
2025
+ if (16 < depth || "function" === typeof value.toJSON)
2026
+ return NOT_PLAIN_IMPORT_METADATA;
2027
+ if (isArrayImpl(value)) {
2028
+ for (
2029
+ var length = value.length, copy = Array(length), i = 0;
2030
+ i < length;
2031
+ i++
2032
+ ) {
2033
+ var element = value[i];
2034
+ if ("string" === typeof element)
2035
+ copy[i] = serializeImportString(request, element);
2036
+ else {
2037
+ element = transformImportMetadata(request, element, depth + 1);
2038
+ if (element === NOT_PLAIN_IMPORT_METADATA)
2039
+ return NOT_PLAIN_IMPORT_METADATA;
2040
+ copy[i] = element;
2041
+ }
2042
+ }
2043
+ return copy;
2044
+ }
2045
+ length = getPrototypeOf(value);
2046
+ if (length !== ObjectPrototype$1 && null !== length)
2047
+ return NOT_PLAIN_IMPORT_METADATA;
2048
+ length = Object.keys(value);
2049
+ copy = {};
2050
+ for (i = 0; i < length.length; i++) {
2051
+ element = length[i];
2052
+ if (element in ObjectPrototype$1) return NOT_PLAIN_IMPORT_METADATA;
2053
+ var element$25 = value[element];
2054
+ if ("string" === typeof element$25)
2055
+ copy[element] = serializeImportString(request, element$25);
2056
+ else {
2057
+ element$25 = transformImportMetadata(request, element$25, depth + 1);
2058
+ if (element$25 === NOT_PLAIN_IMPORT_METADATA)
2059
+ return NOT_PLAIN_IMPORT_METADATA;
2060
+ copy[element] = element$25;
2061
+ }
2062
+ }
2063
+ return copy;
2064
+ default:
2065
+ return NOT_PLAIN_IMPORT_METADATA;
2066
+ }
2067
+ }
1858
2068
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
1859
2069
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
1860
2070
  typedArray = new Uint8Array(
@@ -1864,7 +2074,11 @@ function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
1864
2074
  );
1865
2075
  debug = typedArray.byteLength;
1866
2076
  id = id.toString(16) + ":" + tag + debug.toString(16) + ",";
1867
- request.completedRegularChunks.push(id, typedArray);
2077
+ request.completedRegularChunks.push(
2078
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
2079
+ id,
2080
+ typedArray
2081
+ );
1868
2082
  }
1869
2083
  function emitTextChunk(request, id, text, debug) {
1870
2084
  if (null === byteLengthOfChunk)
@@ -1874,7 +2088,7 @@ function emitTextChunk(request, id, text, debug) {
1874
2088
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
1875
2089
  debug = byteLengthOfChunk(text);
1876
2090
  id = id.toString(16) + ":T" + debug.toString(16) + ",";
1877
- request.completedRegularChunks.push(id, text);
2091
+ request.completedRegularChunks.push(NEXT_TWO_CHUNKS_ARE_ATOMIC, id, text);
1878
2092
  }
1879
2093
  function emitChunk(request, task, value) {
1880
2094
  var id = task.id;
@@ -1906,7 +2120,14 @@ function emitChunk(request, task, value) {
1906
2120
  ? emitTypedArrayChunk(request, id, "m", value, !1)
1907
2121
  : value instanceof DataView
1908
2122
  ? emitTypedArrayChunk(request, id, "V", value, !1)
1909
- : ((value = stringify(value, task.toJSON)),
2123
+ : ((value = resolveModel(
2124
+ request,
2125
+ task,
2126
+ { "": value },
2127
+ "",
2128
+ value
2129
+ )),
2130
+ (value = stringify(value)),
1910
2131
  (task =
1911
2132
  task.id.toString(16) + ":" + value + "\n"),
1912
2133
  request.completedRegularChunks.push(task));
@@ -2025,7 +2246,7 @@ function finishHaltedTask(task, request) {
2025
2246
  function flushCompletedChunks(request) {
2026
2247
  var destination = request.destination;
2027
2248
  if (null !== destination) {
2028
- currentView = new Uint8Array(2048);
2249
+ currentView = new Uint8Array(4096);
2029
2250
  writtenBytes = 0;
2030
2251
  destinationHasCapacity = !0;
2031
2252
  try {
@@ -2052,15 +2273,28 @@ function flushCompletedChunks(request) {
2052
2273
  }
2053
2274
  hintChunks.splice(0, i);
2054
2275
  var regularChunks = request.completedRegularChunks;
2055
- for (i = 0; i < regularChunks.length; i++)
2056
- if (
2057
- (request.pendingChunks--,
2058
- !writeChunkAndReturn(destination, regularChunks[i]))
2059
- ) {
2276
+ for (i = 0; i < regularChunks.length; i++) {
2277
+ var item = regularChunks[i];
2278
+ importsChunks = void 0;
2279
+ if (item === NEXT_TWO_CHUNKS_ARE_ATOMIC) {
2280
+ if (i + 2 >= regularChunks.length)
2281
+ throw Error("A chunk pair is incomplete. This is a bug in React.");
2282
+ request.pendingChunks -= 2;
2283
+ writeChunk(destination, regularChunks[i + 1]);
2284
+ importsChunks = writeChunkAndReturn(
2285
+ destination,
2286
+ regularChunks[i + 2]
2287
+ );
2288
+ i += 2;
2289
+ } else
2290
+ request.pendingChunks--,
2291
+ (importsChunks = writeChunkAndReturn(destination, item));
2292
+ if (!importsChunks) {
2060
2293
  request.destination = null;
2061
2294
  i++;
2062
2295
  break;
2063
2296
  }
2297
+ }
2064
2298
  regularChunks.splice(0, i);
2065
2299
  var errorChunks = request.completedErrorChunks;
2066
2300
  for (i = 0; i < errorChunks.length; i++)
@@ -2155,6 +2389,17 @@ function finishAbort(request, abortedTasks, errorId) {
2155
2389
  logRecoverableError(request, error, null), fatalError(request, error);
2156
2390
  }
2157
2391
  }
2392
+ function attachAbortSignal(request, signal) {
2393
+ signal.aborted
2394
+ ? abort(request, signal.reason)
2395
+ : signal.addEventListener(
2396
+ "abort",
2397
+ function () {
2398
+ abort(request, signal.reason);
2399
+ },
2400
+ { signal: request.cacheController.signal }
2401
+ );
2402
+ }
2158
2403
  function abort(request, reason) {
2159
2404
  if (!(11 < request.status))
2160
2405
  try {
@@ -2199,9 +2444,9 @@ function abort(request, reason) {
2199
2444
  onAllReady();
2200
2445
  flushCompletedChunks(request);
2201
2446
  }
2202
- } catch (error$26) {
2203
- logRecoverableError(request, error$26, null),
2204
- fatalError(request, error$26);
2447
+ } catch (error$32) {
2448
+ logRecoverableError(request, error$32, null),
2449
+ fatalError(request, error$32);
2205
2450
  }
2206
2451
  }
2207
2452
  function resolveServerReference(bundlerConfig, id) {
@@ -2292,50 +2537,56 @@ function ReactPromise(status, value, reason) {
2292
2537
  this.reason = reason;
2293
2538
  }
2294
2539
  ReactPromise.prototype = Object.create(Promise.prototype);
2295
- ReactPromise.prototype.then = function (resolve, reject) {
2296
- switch (this.status) {
2297
- case "resolved_model":
2298
- initializeModelChunk(this);
2299
- }
2300
- switch (this.status) {
2301
- case "fulfilled":
2302
- if ("function" === typeof resolve) {
2303
- for (
2304
- var inspectedValue = this.value,
2305
- cycleProtection = 0,
2306
- visited = new Set();
2307
- inspectedValue instanceof ReactPromise;
2540
+ Object.defineProperty(ReactPromise.prototype, "then", {
2541
+ writable: !0,
2542
+ enumerable: !0,
2543
+ configurable: !0,
2544
+ value: function (resolve, reject) {
2545
+ switch (this.status) {
2546
+ case "resolved_model":
2547
+ initializeModelChunk(this);
2548
+ }
2549
+ switch (this.status) {
2550
+ case "fulfilled":
2551
+ if ("function" === typeof resolve) {
2552
+ for (
2553
+ var inspectedValue = this.value,
2554
+ cycleProtection = 0,
2555
+ visited = new Set();
2556
+ inspectedValue instanceof ReactPromise;
2308
2557
 
2309
- ) {
2310
- cycleProtection++;
2311
- if (
2312
- inspectedValue === this ||
2313
- visited.has(inspectedValue) ||
2314
- 1e3 < cycleProtection
2315
2558
  ) {
2316
- "function" === typeof reject &&
2317
- reject(Error("Cannot have cyclic thenables."));
2318
- return;
2559
+ cycleProtection++;
2560
+ if (
2561
+ inspectedValue === this ||
2562
+ visited.has(inspectedValue) ||
2563
+ 1e3 < cycleProtection
2564
+ ) {
2565
+ "function" === typeof reject &&
2566
+ reject(Error("Cannot have cyclic thenables."));
2567
+ return;
2568
+ }
2569
+ visited.add(inspectedValue);
2570
+ if ("fulfilled" === inspectedValue.status)
2571
+ inspectedValue = inspectedValue.value;
2572
+ else break;
2319
2573
  }
2320
- visited.add(inspectedValue);
2321
- if ("fulfilled" === inspectedValue.status)
2322
- inspectedValue = inspectedValue.value;
2323
- else break;
2574
+ resolve(this.value);
2324
2575
  }
2325
- resolve(this.value);
2326
- }
2327
- break;
2328
- case "pending":
2329
- case "blocked":
2330
- "function" === typeof resolve &&
2331
- (null === this.value && (this.value = []), this.value.push(resolve));
2332
- "function" === typeof reject &&
2333
- (null === this.reason && (this.reason = []), this.reason.push(reject));
2334
- break;
2335
- default:
2336
- "function" === typeof reject && reject(this.reason);
2576
+ break;
2577
+ case "pending":
2578
+ case "blocked":
2579
+ "function" === typeof resolve &&
2580
+ (null === this.value && (this.value = []), this.value.push(resolve));
2581
+ "function" === typeof reject &&
2582
+ (null === this.reason && (this.reason = []),
2583
+ this.reason.push(reject));
2584
+ break;
2585
+ default:
2586
+ "function" === typeof reject && reject(this.reason);
2587
+ }
2337
2588
  }
2338
- };
2589
+ });
2339
2590
  var ObjectPrototype = Object.prototype,
2340
2591
  ArrayPrototype = Array.prototype;
2341
2592
  function wakeChunk(response, listeners, value, chunk) {
@@ -2476,7 +2727,9 @@ function loadServerReference$1(response, metaData, parentObject, key) {
2476
2727
  (cachedPromise = requireModule(serverReference)),
2477
2728
  (id = blockedPromise),
2478
2729
  (id.status = "fulfilled"),
2479
- (id.value = cachedPromise)
2730
+ (id.value = cachedPromise),
2731
+ (id.reason = null),
2732
+ cachedPromise
2480
2733
  );
2481
2734
  if (initializingHandler) {
2482
2735
  var handler = initializingHandler;
@@ -2976,12 +3229,12 @@ function parseReadableStream(response, reference, type) {
2976
3229
  (previousBlockedChunk = chunk));
2977
3230
  } else {
2978
3231
  chunk = previousBlockedChunk;
2979
- var chunk$31 = new ReactPromise("pending", null, null);
2980
- chunk$31.then(enqueue, flightController.error);
2981
- previousBlockedChunk = chunk$31;
3232
+ var chunk$37 = new ReactPromise("pending", null, null);
3233
+ chunk$37.then(enqueue, flightController.error);
3234
+ previousBlockedChunk = chunk$37;
2982
3235
  chunk.then(function () {
2983
- previousBlockedChunk === chunk$31 && (previousBlockedChunk = null);
2984
- resolveModelChunk(response, chunk$31, json, -1);
3236
+ previousBlockedChunk === chunk$37 && (previousBlockedChunk = null);
3237
+ resolveModelChunk(response, chunk$37, json, -1);
2985
3238
  });
2986
3239
  }
2987
3240
  },
@@ -3335,10 +3588,11 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3335
3588
  arrayRoot
3336
3589
  );
3337
3590
  case "B":
3338
- return (
3339
- (obj = parseInt(value.slice(2), 16)),
3340
- response._formData.data.get(response._prefix + obj)
3341
- );
3591
+ obj = parseInt(value.slice(2), 16);
3592
+ response = response._formData.data.get(response._prefix + obj);
3593
+ if (!(response instanceof Blob))
3594
+ throw Error("Referenced Blob is not a Blob.");
3595
+ return response;
3342
3596
  case "R":
3343
3597
  return parseReadableStream(response, value, void 0);
3344
3598
  case "r":
@@ -3687,7 +3941,6 @@ exports.prerender = function (model, webpackMap, options) {
3687
3941
  model,
3688
3942
  webpackMap,
3689
3943
  options ? options.onError : void 0,
3690
- options ? options.onPostpone : void 0,
3691
3944
  function () {
3692
3945
  var writable,
3693
3946
  stream = new ReadableStream(
@@ -3713,17 +3966,7 @@ exports.prerender = function (model, webpackMap, options) {
3713
3966
  options ? options.identifierPrefix : void 0,
3714
3967
  options ? options.temporaryReferences : void 0
3715
3968
  );
3716
- if (options && options.signal) {
3717
- var signal = options.signal;
3718
- if (signal.aborted) abort(request, signal.reason);
3719
- else {
3720
- var listener = function () {
3721
- abort(request, signal.reason);
3722
- signal.removeEventListener("abort", listener);
3723
- };
3724
- signal.addEventListener("abort", listener);
3725
- }
3726
- }
3969
+ options && options.signal && attachAbortSignal(request, options.signal);
3727
3970
  startWork(request);
3728
3971
  });
3729
3972
  };
@@ -3734,7 +3977,6 @@ exports.prerenderToNodeStream = function (model, webpackMap, options) {
3734
3977
  model,
3735
3978
  webpackMap,
3736
3979
  options ? options.onError : void 0,
3737
- options ? options.onPostpone : void 0,
3738
3980
  function () {
3739
3981
  var readable = new stream.Readable({
3740
3982
  read: function () {
@@ -3748,17 +3990,7 @@ exports.prerenderToNodeStream = function (model, webpackMap, options) {
3748
3990
  options ? options.identifierPrefix : void 0,
3749
3991
  options ? options.temporaryReferences : void 0
3750
3992
  );
3751
- if (options && options.signal) {
3752
- var signal = options.signal;
3753
- if (signal.aborted) abort(request, signal.reason);
3754
- else {
3755
- var listener = function () {
3756
- abort(request, signal.reason);
3757
- signal.removeEventListener("abort", listener);
3758
- };
3759
- signal.addEventListener("abort", listener);
3760
- }
3761
- }
3993
+ options && options.signal && attachAbortSignal(request, options.signal);
3762
3994
  startWork(request);
3763
3995
  });
3764
3996
  };
@@ -3791,7 +4023,6 @@ exports.renderToPipeableStream = function (model, webpackMap, options) {
3791
4023
  model,
3792
4024
  webpackMap,
3793
4025
  options ? options.onError : void 0,
3794
- options ? options.onPostpone : void 0,
3795
4026
  noop,
3796
4027
  noop,
3797
4028
  options ? options.identifierPrefix : void 0,
@@ -3832,23 +4063,12 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
3832
4063
  model,
3833
4064
  webpackMap,
3834
4065
  options ? options.onError : void 0,
3835
- options ? options.onPostpone : void 0,
3836
4066
  noop,
3837
4067
  noop,
3838
4068
  options ? options.identifierPrefix : void 0,
3839
4069
  options ? options.temporaryReferences : void 0
3840
4070
  );
3841
- if (options && options.signal) {
3842
- var signal = options.signal;
3843
- if (signal.aborted) abort(request, signal.reason);
3844
- else {
3845
- var listener = function () {
3846
- abort(request, signal.reason);
3847
- signal.removeEventListener("abort", listener);
3848
- };
3849
- signal.addEventListener("abort", listener);
3850
- }
3851
- }
4071
+ options && options.signal && attachAbortSignal(request, options.signal);
3852
4072
  var writable;
3853
4073
  return new ReadableStream(
3854
4074
  {