@vitejs/plugin-rsc 0.4.34 → 0.5.1

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 (100) hide show
  1. package/dist/{browser-D8OPzpF5.js → browser-B4C0Zb4m.js} +1 -1
  2. package/dist/{browser-CQv7Z3J4.d.ts → browser-C8KlM-b7.d.ts} +2 -2
  3. package/dist/{browser-DwWQeoll.d.ts → browser-CDBRiZjk.d.ts} +1 -1
  4. package/dist/{browser-7NhxQxuk.js → browser-U86erGOy.js} +3 -3
  5. package/dist/browser.d.ts +3 -3
  6. package/dist/browser.js +23 -5
  7. package/dist/chunk-Cdb3zUqJ.js +30 -0
  8. package/dist/{cjs-BamOAUgw.js → cjs-zUv66MZg.js} +3 -3
  9. package/dist/core/browser.d.ts +1 -1
  10. package/dist/core/browser.js +3 -3
  11. package/dist/core/plugin.js +1 -1
  12. package/dist/core/rsc.d.ts +2 -2
  13. package/dist/core/rsc.js +3 -3
  14. package/dist/core/ssr.d.ts +2 -2
  15. package/dist/core/ssr.js +3 -3
  16. package/dist/{dist-DiJnRA1C.js → dist-CNbFy2EZ.js} +1 -1
  17. package/dist/{encryption-runtime-B8xcnJoN.d.ts → encryption-runtime-BDgc4dBr.d.ts} +1 -1
  18. package/dist/{encryption-runtime-DT6dtlC5.js → encryption-runtime-D5_PLt4C.js} +4 -4
  19. package/dist/{encryption-utils-BDwwcMVT.js → encryption-utils-DdqSKS_O.js} +1 -1
  20. package/dist/{index-CPkExgij.d.ts → index-BY8KUQhI.d.ts} +1 -1
  21. package/dist/{index-B04iFwO5.d.ts → index-DJ0AhQ9B.d.ts} +1 -1
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.js +8 -8
  24. package/dist/picocolors-BRKobevN.js +74 -0
  25. package/dist/{plugin-CZbI4rhS.js → plugin-4UFT-s0w.js} +1 -1
  26. package/dist/{plugin-BLedJFh7.js → plugin-DNwmUjn4.js} +32 -22
  27. package/dist/{plugin-DCLI7Wh8.d.ts → plugin-fbbM1muv.d.ts} +2 -6
  28. package/dist/plugin.d.ts +2 -2
  29. package/dist/plugin.js +8 -8
  30. package/dist/plugins/cjs.js +3 -3
  31. package/dist/react/browser.d.ts +3 -3
  32. package/dist/react/browser.js +4 -4
  33. package/dist/react/rsc.d.ts +3 -3
  34. package/dist/react/rsc.js +4 -4
  35. package/dist/react/ssr.d.ts +3 -3
  36. package/dist/react/ssr.js +4 -4
  37. package/dist/{rpc-CUvSZurk.js → rpc-nwJuNojy.js} +1 -1
  38. package/dist/{rsc-JJjz3Z0i.d.ts → rsc-03j1e3xp.d.ts} +4 -4
  39. package/dist/{rsc-BdCB3621.js → rsc-B_DQ_Sju.js} +2 -2
  40. package/dist/{rsc-3bkzqdsJ.d.ts → rsc-OCbFObYE.d.ts} +2 -2
  41. package/dist/{rsc-GFzFWyhT.js → rsc-bL1QvQCm.js} +3 -3
  42. package/dist/rsc.d.ts +4 -4
  43. package/dist/rsc.js +24 -7
  44. package/dist/{shared-CXg_u-4h.js → shared-C8PSRwR2.js} +1 -1
  45. package/dist/{shared-n-ykEs15.js → shared-DlspEItJ.js} +1 -1
  46. package/dist/{ssr-BrSGyrxe.d.ts → ssr-Dgbl_mOS.d.ts} +1 -1
  47. package/dist/{ssr-Cd4SbAaO.js → ssr-DzY6rnEv.js} +2 -2
  48. package/dist/{ssr-Cm2FP2zD.js → ssr-EH7rBPkK.js} +3 -3
  49. package/dist/{ssr-CMjeQ9AS.d.ts → ssr-fBV4xXen.d.ts} +2 -2
  50. package/dist/ssr.d.ts +3 -3
  51. package/dist/ssr.js +54 -6
  52. package/dist/transforms/index.d.ts +1 -1
  53. package/dist/transforms/index.js +2 -2
  54. package/dist/{transforms-CpF3zNE0.js → transforms-CSPqW3RX.js} +3 -2
  55. package/dist/utils/encryption-runtime.d.ts +1 -1
  56. package/dist/utils/encryption-runtime.js +6 -6
  57. package/dist/utils/rpc.js +1 -1
  58. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.development.js +2964 -774
  59. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.production.js +554 -312
  60. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.development.js +2721 -724
  61. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.production.js +541 -300
  62. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.development.js +2955 -858
  63. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.production.js +652 -332
  64. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.unbundled.development.js +2956 -861
  65. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.unbundled.production.js +652 -332
  66. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-plugin.js +6 -2
  67. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.development.js +1931 -713
  68. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.production.js +544 -295
  69. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.development.js +1926 -715
  70. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.production.js +542 -299
  71. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.development.js +2719 -743
  72. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.production.js +725 -338
  73. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2703 -727
  74. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.unbundled.production.js +725 -338
  75. package/dist/vendor/react-server-dom/package.json +3 -3
  76. package/dist/vendor/react-server-dom/server.node.js +3 -1
  77. package/dist/vendor/react-server-dom/server.node.unbundled.js +3 -1
  78. package/dist/vendor/react-server-dom/static.browser.js +1 -3
  79. package/dist/vendor/react-server-dom/static.edge.js +1 -3
  80. package/dist/vendor/react-server-dom/static.node.js +2 -3
  81. package/dist/vendor/react-server-dom/static.node.unbundled.js +1 -3
  82. package/package.json +11 -10
  83. package/types/index.d.ts +0 -4
  84. package/dist/browser--ZREVnM9.js +0 -22
  85. package/dist/client-C7Eok9hc.js +0 -23
  86. package/dist/extra/browser.d.ts +0 -14
  87. package/dist/extra/browser.js +0 -88
  88. package/dist/extra/rsc.d.ts +0 -2
  89. package/dist/extra/rsc.js +0 -56
  90. package/dist/extra/ssr.d.ts +0 -14
  91. package/dist/extra/ssr.js +0 -37
  92. package/dist/rsc-CiAoLCx8.js +0 -21
  93. package/dist/rsc-c22DF1A7.d.ts +0 -16
  94. package/dist/rsc-html-stream/browser.d.ts +0 -5
  95. package/dist/rsc-html-stream/browser.js +0 -8
  96. package/dist/rsc-html-stream/ssr.d.ts +0 -7
  97. package/dist/rsc-html-stream/ssr.js +0 -8
  98. package/dist/server-DMhFuTz_.js +0 -72
  99. package/dist/ssr-BQwZitKq.js +0 -53
  100. package/types/virtual.d.ts +0 -5
@@ -15,6 +15,26 @@ require("crypto");
15
15
  var async_hooks = require("async_hooks"),
16
16
  ReactDOM = require("react-dom"),
17
17
  React = require("react"),
18
+ REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
19
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
20
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
21
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
22
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
23
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
24
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
25
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
26
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
27
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
28
+ Symbol.for("react.postpone");
29
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
30
+ function getIteratorFn(maybeIterable) {
31
+ if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
32
+ maybeIterable =
33
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
34
+ maybeIterable["@@iterator"];
35
+ return "function" === typeof maybeIterable ? maybeIterable : null;
36
+ }
37
+ var ASYNC_ITERATOR = Symbol.asyncIterator,
18
38
  scheduleMicrotask = queueMicrotask,
19
39
  currentView = null,
20
40
  writtenBytes = 0,
@@ -134,6 +154,8 @@ var PROMISE_PROTOTYPE = Promise.prototype,
134
154
  return;
135
155
  case "defaultProps":
136
156
  return;
157
+ case "_debugInfo":
158
+ return;
137
159
  case "toJSON":
138
160
  return;
139
161
  case Symbol.toPrimitive:
@@ -171,6 +193,8 @@ function getReference(target, name) {
171
193
  return target.name;
172
194
  case "defaultProps":
173
195
  return;
196
+ case "_debugInfo":
197
+ return;
174
198
  case "toJSON":
175
199
  return;
176
200
  case Symbol.toPrimitive:
@@ -392,6 +416,105 @@ function trimOptions(options) {
392
416
  ((hasProperties = !0), (trimmed[key] = options[key]));
393
417
  return hasProperties ? trimmed : null;
394
418
  }
419
+ function getChildFormatContext(parentContext, type, props) {
420
+ switch (type) {
421
+ case "img":
422
+ type = props.src;
423
+ var srcSet = props.srcSet;
424
+ if (
425
+ !(
426
+ "lazy" === props.loading ||
427
+ (!type && !srcSet) ||
428
+ ("string" !== typeof type && null != type) ||
429
+ ("string" !== typeof srcSet && null != srcSet) ||
430
+ "low" === props.fetchPriority ||
431
+ parentContext & 3
432
+ ) &&
433
+ ("string" !== typeof type ||
434
+ ":" !== type[4] ||
435
+ ("d" !== type[0] && "D" !== type[0]) ||
436
+ ("a" !== type[1] && "A" !== type[1]) ||
437
+ ("t" !== type[2] && "T" !== type[2]) ||
438
+ ("a" !== type[3] && "A" !== type[3])) &&
439
+ ("string" !== typeof srcSet ||
440
+ ":" !== srcSet[4] ||
441
+ ("d" !== srcSet[0] && "D" !== srcSet[0]) ||
442
+ ("a" !== srcSet[1] && "A" !== srcSet[1]) ||
443
+ ("t" !== srcSet[2] && "T" !== srcSet[2]) ||
444
+ ("a" !== srcSet[3] && "A" !== srcSet[3]))
445
+ ) {
446
+ var sizes = "string" === typeof props.sizes ? props.sizes : void 0;
447
+ var input = props.crossOrigin;
448
+ preload(type || "", "image", {
449
+ imageSrcSet: srcSet,
450
+ imageSizes: sizes,
451
+ crossOrigin:
452
+ "string" === typeof input
453
+ ? "use-credentials" === input
454
+ ? input
455
+ : ""
456
+ : void 0,
457
+ integrity: props.integrity,
458
+ type: props.type,
459
+ fetchPriority: props.fetchPriority,
460
+ referrerPolicy: props.referrerPolicy
461
+ });
462
+ }
463
+ return parentContext;
464
+ case "link":
465
+ type = props.rel;
466
+ srcSet = props.href;
467
+ if (
468
+ !(
469
+ parentContext & 1 ||
470
+ null != props.itemProp ||
471
+ "string" !== typeof type ||
472
+ "string" !== typeof srcSet ||
473
+ "" === srcSet
474
+ )
475
+ )
476
+ switch (type) {
477
+ case "preload":
478
+ preload(srcSet, props.as, {
479
+ crossOrigin: props.crossOrigin,
480
+ integrity: props.integrity,
481
+ nonce: props.nonce,
482
+ type: props.type,
483
+ fetchPriority: props.fetchPriority,
484
+ referrerPolicy: props.referrerPolicy,
485
+ imageSrcSet: props.imageSrcSet,
486
+ imageSizes: props.imageSizes,
487
+ media: props.media
488
+ });
489
+ break;
490
+ case "modulepreload":
491
+ preloadModule$1(srcSet, {
492
+ as: props.as,
493
+ crossOrigin: props.crossOrigin,
494
+ integrity: props.integrity,
495
+ nonce: props.nonce
496
+ });
497
+ break;
498
+ case "stylesheet":
499
+ preload(srcSet, "stylesheet", {
500
+ crossOrigin: props.crossOrigin,
501
+ integrity: props.integrity,
502
+ nonce: props.nonce,
503
+ type: props.type,
504
+ fetchPriority: props.fetchPriority,
505
+ referrerPolicy: props.referrerPolicy,
506
+ media: props.media
507
+ });
508
+ }
509
+ return parentContext;
510
+ case "picture":
511
+ return parentContext | 2;
512
+ case "noscript":
513
+ return parentContext | 1;
514
+ default:
515
+ return parentContext;
516
+ }
517
+ }
395
518
  var requestStorage = new async_hooks.AsyncLocalStorage(),
396
519
  TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
397
520
  proxyHandlers = {
@@ -405,6 +528,8 @@ var requestStorage = new async_hooks.AsyncLocalStorage(),
405
528
  return;
406
529
  case "defaultProps":
407
530
  return;
531
+ case "_debugInfo":
532
+ return;
408
533
  case "toJSON":
409
534
  return;
410
535
  case Symbol.toPrimitive:
@@ -415,6 +540,8 @@ var requestStorage = new async_hooks.AsyncLocalStorage(),
415
540
  throw Error(
416
541
  "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
417
542
  );
543
+ case "then":
544
+ return;
418
545
  }
419
546
  throw Error(
420
547
  "Cannot access " +
@@ -441,35 +568,15 @@ function createTemporaryReference(temporaryReferences, id) {
441
568
  temporaryReferences.set(reference, id);
442
569
  return reference;
443
570
  }
444
- var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
445
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
446
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
447
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
448
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
449
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
450
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
451
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
452
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
453
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
454
- Symbol.for("react.postpone");
455
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
456
- function getIteratorFn(maybeIterable) {
457
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
458
- maybeIterable =
459
- (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
460
- maybeIterable["@@iterator"];
461
- return "function" === typeof maybeIterable ? maybeIterable : null;
462
- }
463
- var ASYNC_ITERATOR = Symbol.asyncIterator,
464
- SuspenseException = Error(
465
- "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`."
466
- );
467
- function noop$1() {}
571
+ function noop() {}
572
+ var SuspenseException = Error(
573
+ "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`."
574
+ );
468
575
  function trackUsedThenable(thenableState, thenable, index) {
469
576
  index = thenableState[index];
470
577
  void 0 === index
471
578
  ? thenableState.push(thenable)
472
- : index !== thenable && (thenable.then(noop$1, noop$1), (thenable = index));
579
+ : index !== thenable && (thenable.then(noop, noop), (thenable = index));
473
580
  switch (thenable.status) {
474
581
  case "fulfilled":
475
582
  return thenable.value;
@@ -477,7 +584,7 @@ function trackUsedThenable(thenableState, thenable, index) {
477
584
  throw thenable.reason;
478
585
  default:
479
586
  "string" === typeof thenable.status
480
- ? thenable.then(noop$1, noop$1)
587
+ ? thenable.then(noop, noop)
481
588
  : ((thenableState = thenable),
482
589
  (thenableState.status = "pending"),
483
590
  thenableState.then(
@@ -559,6 +666,7 @@ var HooksDispatcher = {
559
666
  return unsupportedRefresh;
560
667
  }
561
668
  };
669
+ HooksDispatcher.useEffectEvent = unsupportedHook;
562
670
  function unsupportedHook() {
563
671
  throw Error("This Hook is not supported in Server Components.");
564
672
  }
@@ -572,7 +680,7 @@ function useId() {
572
680
  if (null === currentRequest$1)
573
681
  throw Error("useId can only be used while React is rendering");
574
682
  var id = currentRequest$1.identifierCount++;
575
- return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":";
683
+ return "_" + currentRequest$1.identifierPrefix + "S_" + id.toString(32) + "_";
576
684
  }
577
685
  function use(usable) {
578
686
  if (
@@ -605,6 +713,10 @@ var DefaultAsyncDispatcher = {
605
713
  ((entry = resourceType()),
606
714
  JSCompiler_inline_result.set(resourceType, entry));
607
715
  return entry;
716
+ },
717
+ cacheSignal: function () {
718
+ var request = resolveRequest();
719
+ return request ? request.cacheController.signal : null;
608
720
  }
609
721
  },
610
722
  ReactSharedInternalsServer =
@@ -616,11 +728,8 @@ if (!ReactSharedInternalsServer)
616
728
  var isArrayImpl = Array.isArray,
617
729
  getPrototypeOf = Object.getPrototypeOf;
618
730
  function objectName(object) {
619
- return Object.prototype.toString
620
- .call(object)
621
- .replace(/^\[object (.*)\]$/, function (m, p0) {
622
- return p0;
623
- });
731
+ object = Object.prototype.toString.call(object);
732
+ return object.slice(8, object.length - 1);
624
733
  }
625
734
  function describeValueForErrorMessage(value) {
626
735
  switch (typeof value) {
@@ -724,24 +833,22 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
724
833
  "\n " + str + "\n " + objectOrArray)
725
834
  : "\n " + str;
726
835
  }
727
- var ObjectPrototype = Object.prototype,
836
+ var hasOwnProperty = Object.prototype.hasOwnProperty,
837
+ ObjectPrototype = Object.prototype,
728
838
  stringify = JSON.stringify;
729
839
  function defaultErrorHandler(error) {
730
840
  console.error(error);
731
841
  }
732
- function defaultPostponeHandler() {}
733
842
  function RequestInstance(
734
843
  type,
735
844
  model,
736
845
  bundlerConfig,
737
846
  onError,
738
- identifierPrefix,
739
847
  onPostpone,
740
- temporaryReferences,
741
- environmentName,
742
- filterStackFrame,
743
848
  onAllReady,
744
- onFatalError
849
+ onFatalError,
850
+ identifierPrefix,
851
+ temporaryReferences
745
852
  ) {
746
853
  if (
747
854
  null !== ReactSharedInternalsServer.A &&
@@ -749,20 +856,20 @@ function RequestInstance(
749
856
  )
750
857
  throw Error("Currently React only supports one RSC renderer at a time.");
751
858
  ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
752
- filterStackFrame = new Set();
753
- environmentName = [];
754
- var hints = new Set();
859
+ var abortSet = new Set(),
860
+ pingedTasks = [],
861
+ hints = new Set();
755
862
  this.type = type;
756
863
  this.status = 10;
757
864
  this.flushScheduled = !1;
758
865
  this.destination = this.fatalError = null;
759
866
  this.bundlerConfig = bundlerConfig;
760
867
  this.cache = new Map();
868
+ this.cacheController = new AbortController();
761
869
  this.pendingChunks = this.nextChunkId = 0;
762
870
  this.hints = hints;
763
- this.abortListeners = new Set();
764
- this.abortableTasks = filterStackFrame;
765
- this.pingedTasks = environmentName;
871
+ this.abortableTasks = abortSet;
872
+ this.pingedTasks = pingedTasks;
766
873
  this.completedImportChunks = [];
767
874
  this.completedHintChunks = [];
768
875
  this.completedRegularChunks = [];
@@ -776,13 +883,12 @@ function RequestInstance(
776
883
  this.identifierCount = 1;
777
884
  this.taintCleanupQueue = [];
778
885
  this.onError = void 0 === onError ? defaultErrorHandler : onError;
779
- this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
886
+ this.onPostpone = void 0 === onPostpone ? noop : onPostpone;
780
887
  this.onAllReady = onAllReady;
781
888
  this.onFatalError = onFatalError;
782
- type = createTask(this, model, null, !1, filterStackFrame);
783
- environmentName.push(type);
889
+ type = createTask(this, model, null, !1, 0, abortSet);
890
+ pingedTasks.push(type);
784
891
  }
785
- function noop() {}
786
892
  var currentRequest = null;
787
893
  function resolveRequest() {
788
894
  if (currentRequest) return currentRequest;
@@ -792,9 +898,10 @@ function resolveRequest() {
792
898
  function serializeThenable(request, task, thenable) {
793
899
  var newTask = createTask(
794
900
  request,
795
- null,
901
+ thenable,
796
902
  task.keyPath,
797
903
  task.implicitSlot,
904
+ task.formatContext,
798
905
  request.abortableTasks
799
906
  );
800
907
  switch (thenable.status) {
@@ -808,9 +915,11 @@ function serializeThenable(request, task, thenable) {
808
915
  if (12 === request.status)
809
916
  return (
810
917
  request.abortableTasks.delete(newTask),
811
- (newTask.status = 3),
812
- (task = stringify(serializeByValueID(request.fatalError))),
813
- emitModelChunk(request, newTask.id, task),
918
+ 21 === request.type
919
+ ? (haltTask(newTask), finishHaltedTask(newTask, request))
920
+ : ((task = request.fatalError),
921
+ abortTask(newTask),
922
+ finishAbortedTask(newTask, request, task)),
814
923
  newTask.id
815
924
  );
816
925
  "string" !== typeof thenable.status &&
@@ -841,39 +950,48 @@ function serializeThenable(request, task, thenable) {
841
950
  }
842
951
  function serializeReadableStream(request, task, stream) {
843
952
  function progress(entry) {
844
- if (!aborted)
953
+ if (0 === streamTask.status)
845
954
  if (entry.done)
846
- request.abortListeners.delete(abortStream),
955
+ (streamTask.status = 1),
847
956
  (entry = streamTask.id.toString(16) + ":C\n"),
848
957
  request.completedRegularChunks.push(entry),
958
+ request.abortableTasks.delete(streamTask),
959
+ request.cacheController.signal.removeEventListener(
960
+ "abort",
961
+ abortStream
962
+ ),
849
963
  enqueueFlush(request),
850
- (aborted = !0);
964
+ callOnAllReadyIfReady(request);
851
965
  else
852
966
  try {
853
967
  (streamTask.model = entry.value),
854
968
  request.pendingChunks++,
855
- emitChunk(request, streamTask, streamTask.model),
969
+ tryStreamTask(request, streamTask),
856
970
  enqueueFlush(request),
857
971
  reader.read().then(progress, error);
858
- } catch (x$7) {
859
- error(x$7);
972
+ } catch (x$8) {
973
+ error(x$8);
860
974
  }
861
975
  }
862
976
  function error(reason) {
863
- aborted ||
864
- ((aborted = !0),
865
- request.abortListeners.delete(abortStream),
977
+ 0 === streamTask.status &&
978
+ (request.cacheController.signal.removeEventListener("abort", abortStream),
866
979
  erroredTask(request, streamTask, reason),
867
980
  enqueueFlush(request),
868
981
  reader.cancel(reason).then(error, error));
869
982
  }
870
- function abortStream(reason) {
871
- aborted ||
872
- ((aborted = !0),
873
- request.abortListeners.delete(abortStream),
874
- erroredTask(request, streamTask, reason),
875
- enqueueFlush(request),
876
- reader.cancel(reason).then(error, error));
983
+ function abortStream() {
984
+ if (0 === streamTask.status) {
985
+ var signal = request.cacheController.signal;
986
+ signal.removeEventListener("abort", abortStream);
987
+ signal = signal.reason;
988
+ 21 === request.type
989
+ ? (request.abortableTasks.delete(streamTask),
990
+ haltTask(streamTask),
991
+ finishHaltedTask(streamTask, request))
992
+ : (erroredTask(request, streamTask, signal), enqueueFlush(request));
993
+ reader.cancel(signal).then(error, error);
994
+ }
877
995
  }
878
996
  var supportsBYOB = stream.supportsBYOB;
879
997
  if (void 0 === supportsBYOB)
@@ -888,27 +1006,30 @@ function serializeReadableStream(request, task, stream) {
888
1006
  task.model,
889
1007
  task.keyPath,
890
1008
  task.implicitSlot,
1009
+ task.formatContext,
891
1010
  request.abortableTasks
892
1011
  );
893
- request.abortableTasks.delete(streamTask);
894
1012
  request.pendingChunks++;
895
1013
  task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
896
1014
  request.completedRegularChunks.push(task);
897
- var aborted = !1;
898
- request.abortListeners.add(abortStream);
1015
+ request.cacheController.signal.addEventListener("abort", abortStream);
899
1016
  reader.read().then(progress, error);
900
1017
  return serializeByValueID(streamTask.id);
901
1018
  }
902
1019
  function serializeAsyncIterable(request, task, iterable, iterator) {
903
1020
  function progress(entry) {
904
- if (!aborted)
1021
+ if (0 === streamTask.status)
905
1022
  if (entry.done) {
906
- request.abortListeners.delete(abortIterable);
1023
+ streamTask.status = 1;
907
1024
  if (void 0 === entry.value)
908
1025
  var endStreamRow = streamTask.id.toString(16) + ":C\n";
909
1026
  else
910
1027
  try {
911
- var chunkId = outlineModel(request, entry.value);
1028
+ var chunkId = outlineModelWithFormatContext(
1029
+ request,
1030
+ entry.value,
1031
+ 0
1032
+ );
912
1033
  endStreamRow =
913
1034
  streamTask.id.toString(16) +
914
1035
  ":C" +
@@ -919,36 +1040,49 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
919
1040
  return;
920
1041
  }
921
1042
  request.completedRegularChunks.push(endStreamRow);
1043
+ request.abortableTasks.delete(streamTask);
1044
+ request.cacheController.signal.removeEventListener(
1045
+ "abort",
1046
+ abortIterable
1047
+ );
922
1048
  enqueueFlush(request);
923
- aborted = !0;
1049
+ callOnAllReadyIfReady(request);
924
1050
  } else
925
1051
  try {
926
1052
  (streamTask.model = entry.value),
927
1053
  request.pendingChunks++,
928
- emitChunk(request, streamTask, streamTask.model),
1054
+ tryStreamTask(request, streamTask),
929
1055
  enqueueFlush(request),
930
1056
  iterator.next().then(progress, error);
931
- } catch (x$8) {
932
- error(x$8);
1057
+ } catch (x$9) {
1058
+ error(x$9);
933
1059
  }
934
1060
  }
935
1061
  function error(reason) {
936
- aborted ||
937
- ((aborted = !0),
938
- request.abortListeners.delete(abortIterable),
1062
+ 0 === streamTask.status &&
1063
+ (request.cacheController.signal.removeEventListener(
1064
+ "abort",
1065
+ abortIterable
1066
+ ),
939
1067
  erroredTask(request, streamTask, reason),
940
1068
  enqueueFlush(request),
941
1069
  "function" === typeof iterator.throw &&
942
1070
  iterator.throw(reason).then(error, error));
943
1071
  }
944
- function abortIterable(reason) {
945
- aborted ||
946
- ((aborted = !0),
947
- request.abortListeners.delete(abortIterable),
948
- erroredTask(request, streamTask, reason),
949
- enqueueFlush(request),
1072
+ function abortIterable() {
1073
+ if (0 === streamTask.status) {
1074
+ var signal = request.cacheController.signal;
1075
+ signal.removeEventListener("abort", abortIterable);
1076
+ var reason = signal.reason;
1077
+ 21 === request.type
1078
+ ? (request.abortableTasks.delete(streamTask),
1079
+ haltTask(streamTask),
1080
+ finishHaltedTask(streamTask, request))
1081
+ : (erroredTask(request, streamTask, signal.reason),
1082
+ enqueueFlush(request));
950
1083
  "function" === typeof iterator.throw &&
951
- iterator.throw(reason).then(error, error));
1084
+ iterator.throw(reason).then(error, error);
1085
+ }
952
1086
  }
953
1087
  iterable = iterable === iterator;
954
1088
  var streamTask = createTask(
@@ -956,14 +1090,13 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
956
1090
  task.model,
957
1091
  task.keyPath,
958
1092
  task.implicitSlot,
1093
+ task.formatContext,
959
1094
  request.abortableTasks
960
1095
  );
961
- request.abortableTasks.delete(streamTask);
962
1096
  request.pendingChunks++;
963
1097
  task = streamTask.id.toString(16) + ":" + (iterable ? "x" : "X") + "\n";
964
1098
  request.completedRegularChunks.push(task);
965
- var aborted = !1;
966
- request.abortListeners.add(abortIterable);
1099
+ request.cacheController.signal.addEventListener("abort", abortIterable);
967
1100
  iterator.next().then(progress, error);
968
1101
  return serializeByValueID(streamTask.id);
969
1102
  }
@@ -977,9 +1110,10 @@ function readThenable(thenable) {
977
1110
  if ("rejected" === thenable.status) throw thenable.reason;
978
1111
  throw thenable;
979
1112
  }
980
- function createLazyWrapperAroundWakeable(wakeable) {
1113
+ function createLazyWrapperAroundWakeable(request, task, wakeable) {
981
1114
  switch (wakeable.status) {
982
1115
  case "fulfilled":
1116
+ return wakeable.value;
983
1117
  case "rejected":
984
1118
  break;
985
1119
  default:
@@ -1008,9 +1142,7 @@ function processServerComponentReturnValue(request, task, Component, result) {
1008
1142
  )
1009
1143
  return result;
1010
1144
  if ("function" === typeof result.then)
1011
- return "fulfilled" === result.status
1012
- ? result.value
1013
- : createLazyWrapperAroundWakeable(result);
1145
+ return createLazyWrapperAroundWakeable(request, task, result);
1014
1146
  var iteratorFn = getIteratorFn(result);
1015
1147
  return iteratorFn
1016
1148
  ? ((request = {}),
@@ -1065,6 +1197,19 @@ function renderFragment(request, task, children) {
1065
1197
  task.implicitSlot ? [request] : request)
1066
1198
  : children;
1067
1199
  }
1200
+ var serializedSize = 0;
1201
+ function deferTask(request, task) {
1202
+ task = createTask(
1203
+ request,
1204
+ task.model,
1205
+ task.keyPath,
1206
+ task.implicitSlot,
1207
+ task.formatContext,
1208
+ request.abortableTasks
1209
+ );
1210
+ pingTask(request, task);
1211
+ return serializeLazyID(task.id);
1212
+ }
1068
1213
  function renderElement(request, task, type, key, ref, props) {
1069
1214
  if (null !== ref && void 0 !== ref)
1070
1215
  throw Error(
@@ -1106,6 +1251,13 @@ function renderElement(request, task, type, key, ref, props) {
1106
1251
  case REACT_MEMO_TYPE:
1107
1252
  return renderElement(request, task, type.type, key, ref, props);
1108
1253
  }
1254
+ else
1255
+ "string" === typeof type &&
1256
+ ((ref = task.formatContext),
1257
+ (init = getChildFormatContext(ref, type, props)),
1258
+ ref !== init &&
1259
+ null != props.children &&
1260
+ outlineModelWithFormatContext(request, props.children, init));
1109
1261
  request = key;
1110
1262
  key = task.keyPath;
1111
1263
  null === request
@@ -1128,7 +1280,14 @@ function pingTask(request, task) {
1128
1280
  return performWork(request);
1129
1281
  }));
1130
1282
  }
1131
- function createTask(request, model, keyPath, implicitSlot, abortSet) {
1283
+ function createTask(
1284
+ request,
1285
+ model,
1286
+ keyPath,
1287
+ implicitSlot,
1288
+ formatContext,
1289
+ abortSet
1290
+ ) {
1132
1291
  request.pendingChunks++;
1133
1292
  var id = request.nextChunkId++;
1134
1293
  "object" !== typeof model ||
@@ -1142,10 +1301,12 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1142
1301
  model: model,
1143
1302
  keyPath: keyPath,
1144
1303
  implicitSlot: implicitSlot,
1304
+ formatContext: formatContext,
1145
1305
  ping: function () {
1146
1306
  return pingTask(request, task);
1147
1307
  },
1148
1308
  toJSON: function (parentPropertyName, value) {
1309
+ serializedSize += parentPropertyName.length;
1149
1310
  var prevKeyPath = task.keyPath,
1150
1311
  prevImplicitSlot = task.implicitSlot;
1151
1312
  try {
@@ -1167,10 +1328,16 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1167
1328
  12 === request.status)
1168
1329
  )
1169
1330
  (task.status = 3),
1170
- (prevKeyPath = request.fatalError),
1171
- (JSCompiler_inline_result = parentPropertyName
1172
- ? "$L" + prevKeyPath.toString(16)
1173
- : serializeByValueID(prevKeyPath));
1331
+ 21 === request.type
1332
+ ? ((prevKeyPath = request.nextChunkId++),
1333
+ (prevKeyPath = parentPropertyName
1334
+ ? serializeLazyID(prevKeyPath)
1335
+ : serializeByValueID(prevKeyPath)),
1336
+ (JSCompiler_inline_result = prevKeyPath))
1337
+ : ((prevKeyPath = request.fatalError),
1338
+ (JSCompiler_inline_result = parentPropertyName
1339
+ ? serializeLazyID(prevKeyPath)
1340
+ : serializeByValueID(prevKeyPath)));
1174
1341
  else if (
1175
1342
  ((value =
1176
1343
  thrownValue === SuspenseException
@@ -1185,6 +1352,7 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1185
1352
  task.model,
1186
1353
  task.keyPath,
1187
1354
  task.implicitSlot,
1355
+ task.formatContext,
1188
1356
  request.abortableTasks
1189
1357
  );
1190
1358
  var ping = JSCompiler_inline_result.ping;
@@ -1194,7 +1362,7 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1194
1362
  task.keyPath = prevKeyPath;
1195
1363
  task.implicitSlot = prevImplicitSlot;
1196
1364
  JSCompiler_inline_result = parentPropertyName
1197
- ? "$L" + JSCompiler_inline_result.id.toString(16)
1365
+ ? serializeLazyID(JSCompiler_inline_result.id)
1198
1366
  : serializeByValueID(JSCompiler_inline_result.id);
1199
1367
  } else
1200
1368
  (task.keyPath = prevKeyPath),
@@ -1204,7 +1372,7 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1204
1372
  (prevImplicitSlot = logRecoverableError(request, value, task)),
1205
1373
  emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1206
1374
  (JSCompiler_inline_result = parentPropertyName
1207
- ? "$L" + prevKeyPath.toString(16)
1375
+ ? serializeLazyID(prevKeyPath)
1208
1376
  : serializeByValueID(prevKeyPath));
1209
1377
  }
1210
1378
  return JSCompiler_inline_result;
@@ -1217,6 +1385,9 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1217
1385
  function serializeByValueID(id) {
1218
1386
  return "$" + id.toString(16);
1219
1387
  }
1388
+ function serializeLazyID(id) {
1389
+ return "$L" + id.toString(16);
1390
+ }
1220
1391
  function encodeReferenceChunk(request, id, reference) {
1221
1392
  request = stringify(reference);
1222
1393
  return id.toString(16) + ":" + request + "\n";
@@ -1234,7 +1405,7 @@ function serializeClientReference(
1234
1405
  existingId = writtenClientReferences.get(clientReferenceKey);
1235
1406
  if (void 0 !== existingId)
1236
1407
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1237
- ? "$L" + existingId.toString(16)
1408
+ ? serializeLazyID(existingId)
1238
1409
  : serializeByValueID(existingId);
1239
1410
  try {
1240
1411
  var config = request.bundlerConfig,
@@ -1271,7 +1442,7 @@ function serializeClientReference(
1271
1442
  request.completedImportChunks.push(processedChunk);
1272
1443
  writtenClientReferences.set(clientReferenceKey, importId);
1273
1444
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1274
- ? "$L" + importId.toString(16)
1445
+ ? serializeLazyID(importId)
1275
1446
  : serializeByValueID(importId);
1276
1447
  } catch (x) {
1277
1448
  return (
@@ -1283,23 +1454,29 @@ function serializeClientReference(
1283
1454
  );
1284
1455
  }
1285
1456
  }
1286
- function outlineModel(request, value) {
1287
- value = createTask(request, value, null, !1, request.abortableTasks);
1457
+ function outlineModelWithFormatContext(request, value, formatContext) {
1458
+ value = createTask(
1459
+ request,
1460
+ value,
1461
+ null,
1462
+ !1,
1463
+ formatContext,
1464
+ request.abortableTasks
1465
+ );
1288
1466
  retryTask(request, value);
1289
1467
  return value.id;
1290
1468
  }
1291
1469
  function serializeTypedArray(request, tag, typedArray) {
1292
1470
  request.pendingChunks++;
1293
1471
  var bufferId = request.nextChunkId++;
1294
- emitTypedArrayChunk(request, bufferId, tag, typedArray);
1472
+ emitTypedArrayChunk(request, bufferId, tag, typedArray, !1);
1295
1473
  return serializeByValueID(bufferId);
1296
1474
  }
1297
1475
  function serializeBlob(request, blob) {
1298
1476
  function progress(entry) {
1299
- if (!aborted)
1477
+ if (0 === newTask.status)
1300
1478
  if (entry.done)
1301
- request.abortListeners.delete(abortBlob),
1302
- (aborted = !0),
1479
+ request.cacheController.signal.removeEventListener("abort", abortBlob),
1303
1480
  pingTask(request, newTask);
1304
1481
  else
1305
1482
  return (
@@ -1307,26 +1484,29 @@ function serializeBlob(request, blob) {
1307
1484
  );
1308
1485
  }
1309
1486
  function error(reason) {
1310
- aborted ||
1311
- ((aborted = !0),
1312
- request.abortListeners.delete(abortBlob),
1487
+ 0 === newTask.status &&
1488
+ (request.cacheController.signal.removeEventListener("abort", abortBlob),
1313
1489
  erroredTask(request, newTask, reason),
1314
1490
  enqueueFlush(request),
1315
1491
  reader.cancel(reason).then(error, error));
1316
1492
  }
1317
- function abortBlob(reason) {
1318
- aborted ||
1319
- ((aborted = !0),
1320
- request.abortListeners.delete(abortBlob),
1321
- erroredTask(request, newTask, reason),
1322
- enqueueFlush(request),
1323
- reader.cancel(reason).then(error, error));
1493
+ function abortBlob() {
1494
+ if (0 === newTask.status) {
1495
+ var signal = request.cacheController.signal;
1496
+ signal.removeEventListener("abort", abortBlob);
1497
+ signal = signal.reason;
1498
+ 21 === request.type
1499
+ ? (request.abortableTasks.delete(newTask),
1500
+ haltTask(newTask),
1501
+ finishHaltedTask(newTask, request))
1502
+ : (erroredTask(request, newTask, signal), enqueueFlush(request));
1503
+ reader.cancel(signal).then(error, error);
1504
+ }
1324
1505
  }
1325
1506
  var model = [blob.type],
1326
- newTask = createTask(request, model, null, !1, request.abortableTasks),
1327
- reader = blob.stream().getReader(),
1328
- aborted = !1;
1329
- request.abortListeners.add(abortBlob);
1507
+ newTask = createTask(request, model, null, !1, 0, request.abortableTasks),
1508
+ reader = blob.stream().getReader();
1509
+ request.cacheController.signal.addEventListener("abort", abortBlob);
1330
1510
  reader.read().then(progress).catch(error);
1331
1511
  return "$B" + newTask.id.toString(16);
1332
1512
  }
@@ -1358,6 +1538,7 @@ function renderModelDestructive(
1358
1538
  ((elementReference = parent + ":" + parentPropertyName),
1359
1539
  writtenObjects.set(value, elementReference)));
1360
1540
  }
1541
+ if (3200 < serializedSize) return deferTask(request, task);
1361
1542
  parentPropertyName = value.props;
1362
1543
  parent = parentPropertyName.ref;
1363
1544
  request = renderElement(
@@ -1375,6 +1556,7 @@ function renderModelDestructive(
1375
1556
  writtenObjects.set(request, elementReference));
1376
1557
  return request;
1377
1558
  case REACT_LAZY_TYPE:
1559
+ if (3200 < serializedSize) return deferTask(request, task);
1378
1560
  task.thenableState = null;
1379
1561
  parentPropertyName = value._init;
1380
1562
  value = parentPropertyName(value._payload);
@@ -1412,8 +1594,11 @@ function renderModelDestructive(
1412
1594
  return request;
1413
1595
  }
1414
1596
  if (void 0 !== writtenObjects)
1415
- if (modelRoot === value) modelRoot = null;
1416
- else return writtenObjects;
1597
+ if (modelRoot === value) {
1598
+ if (writtenObjects !== serializeByValueID(task.id))
1599
+ return writtenObjects;
1600
+ modelRoot = null;
1601
+ } else return writtenObjects;
1417
1602
  else if (
1418
1603
  -1 === parentPropertyName.indexOf(":") &&
1419
1604
  ((writtenObjects = elementReference.get(parent)),
@@ -1440,17 +1625,17 @@ function renderModelDestructive(
1440
1625
  if (value instanceof Map)
1441
1626
  return (
1442
1627
  (value = Array.from(value)),
1443
- "$Q" + outlineModel(request, value).toString(16)
1628
+ "$Q" + outlineModelWithFormatContext(request, value, 0).toString(16)
1444
1629
  );
1445
1630
  if (value instanceof Set)
1446
1631
  return (
1447
1632
  (value = Array.from(value)),
1448
- "$W" + outlineModel(request, value).toString(16)
1633
+ "$W" + outlineModelWithFormatContext(request, value, 0).toString(16)
1449
1634
  );
1450
1635
  if ("function" === typeof FormData && value instanceof FormData)
1451
1636
  return (
1452
1637
  (value = Array.from(value.entries())),
1453
- "$K" + outlineModel(request, value).toString(16)
1638
+ "$K" + outlineModelWithFormatContext(request, value, 0).toString(16)
1454
1639
  );
1455
1640
  if (value instanceof Error) return "$Z";
1456
1641
  if (value instanceof ArrayBuffer)
@@ -1485,8 +1670,9 @@ function renderModelDestructive(
1485
1670
  return (
1486
1671
  (parentPropertyName = elementReference.call(value)),
1487
1672
  parentPropertyName === value
1488
- ? "$i" +
1489
- outlineModel(request, Array.from(parentPropertyName)).toString(16)
1673
+ ? ((value = Array.from(parentPropertyName)),
1674
+ "$i" +
1675
+ outlineModelWithFormatContext(request, value, 0).toString(16))
1490
1676
  : renderFragment(request, task, Array.from(parentPropertyName))
1491
1677
  );
1492
1678
  if ("function" === typeof ReadableStream && value instanceof ReadableStream)
@@ -1524,6 +1710,7 @@ function renderModelDestructive(
1524
1710
  return value;
1525
1711
  }
1526
1712
  if ("string" === typeof value) {
1713
+ serializedSize += value.length;
1527
1714
  if (
1528
1715
  "Z" === value[value.length - 1] &&
1529
1716
  parent[parentPropertyName] instanceof Date
@@ -1533,7 +1720,7 @@ function renderModelDestructive(
1533
1720
  return (
1534
1721
  request.pendingChunks++,
1535
1722
  (task = request.nextChunkId++),
1536
- emitTextChunk(request, task, value),
1723
+ emitTextChunk(request, task, value, !1),
1537
1724
  serializeByValueID(task)
1538
1725
  );
1539
1726
  request = "$" === value[0] ? "$" + value : value;
@@ -1570,10 +1757,11 @@ function renderModelDestructive(
1570
1757
  null === parentPropertyName
1571
1758
  ? null
1572
1759
  : Promise.resolve(parentPropertyName)),
1573
- (request = outlineModel(request, {
1574
- id: value.$$id,
1575
- bound: parentPropertyName
1576
- })),
1760
+ (request = outlineModelWithFormatContext(
1761
+ request,
1762
+ { id: value.$$id, bound: parentPropertyName },
1763
+ 0
1764
+ )),
1577
1765
  task.set(value, request),
1578
1766
  (request = "$F" + request.toString(16))),
1579
1767
  request
@@ -1651,80 +1839,83 @@ function fatalError(request, error) {
1651
1839
  null !== request.destination
1652
1840
  ? ((request.status = 14), request.destination.destroy(error))
1653
1841
  : ((request.status = 13), (request.fatalError = error));
1842
+ request.cacheController.abort(
1843
+ Error("The render was aborted due to a fatal error.", { cause: error })
1844
+ );
1654
1845
  }
1655
1846
  function emitErrorChunk(request, id, digest) {
1656
1847
  digest = { digest: digest };
1657
1848
  id = id.toString(16) + ":E" + stringify(digest) + "\n";
1658
1849
  request.completedErrorChunks.push(id);
1659
1850
  }
1660
- function emitModelChunk(request, id, json) {
1661
- id = id.toString(16) + ":" + json + "\n";
1662
- request.completedRegularChunks.push(id);
1663
- }
1664
- function emitTypedArrayChunk(request, id, tag, typedArray) {
1665
- request.pendingChunks++;
1851
+ function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
1852
+ debug ? request.pendingDebugChunks++ : request.pendingChunks++;
1666
1853
  typedArray = new Uint8Array(
1667
1854
  typedArray.buffer,
1668
1855
  typedArray.byteOffset,
1669
1856
  typedArray.byteLength
1670
1857
  );
1671
- var binaryLength = typedArray.byteLength;
1672
- id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ",";
1858
+ debug = typedArray.byteLength;
1859
+ id = id.toString(16) + ":" + tag + debug.toString(16) + ",";
1673
1860
  request.completedRegularChunks.push(id, typedArray);
1674
1861
  }
1675
- function emitTextChunk(request, id, text) {
1862
+ function emitTextChunk(request, id, text, debug) {
1676
1863
  if (null === byteLengthOfChunk)
1677
1864
  throw Error(
1678
1865
  "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1679
1866
  );
1680
- request.pendingChunks++;
1681
- var binaryLength = byteLengthOfChunk(text);
1682
- id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1867
+ debug ? request.pendingDebugChunks++ : request.pendingChunks++;
1868
+ debug = byteLengthOfChunk(text);
1869
+ id = id.toString(16) + ":T" + debug.toString(16) + ",";
1683
1870
  request.completedRegularChunks.push(id, text);
1684
1871
  }
1685
1872
  function emitChunk(request, task, value) {
1686
1873
  var id = task.id;
1687
1874
  "string" === typeof value && null !== byteLengthOfChunk
1688
- ? emitTextChunk(request, id, value)
1875
+ ? emitTextChunk(request, id, value, !1)
1689
1876
  : value instanceof ArrayBuffer
1690
- ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
1877
+ ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1)
1691
1878
  : value instanceof Int8Array
1692
- ? emitTypedArrayChunk(request, id, "O", value)
1879
+ ? emitTypedArrayChunk(request, id, "O", value, !1)
1693
1880
  : value instanceof Uint8Array
1694
- ? emitTypedArrayChunk(request, id, "o", value)
1881
+ ? emitTypedArrayChunk(request, id, "o", value, !1)
1695
1882
  : value instanceof Uint8ClampedArray
1696
- ? emitTypedArrayChunk(request, id, "U", value)
1883
+ ? emitTypedArrayChunk(request, id, "U", value, !1)
1697
1884
  : value instanceof Int16Array
1698
- ? emitTypedArrayChunk(request, id, "S", value)
1885
+ ? emitTypedArrayChunk(request, id, "S", value, !1)
1699
1886
  : value instanceof Uint16Array
1700
- ? emitTypedArrayChunk(request, id, "s", value)
1887
+ ? emitTypedArrayChunk(request, id, "s", value, !1)
1701
1888
  : value instanceof Int32Array
1702
- ? emitTypedArrayChunk(request, id, "L", value)
1889
+ ? emitTypedArrayChunk(request, id, "L", value, !1)
1703
1890
  : value instanceof Uint32Array
1704
- ? emitTypedArrayChunk(request, id, "l", value)
1891
+ ? emitTypedArrayChunk(request, id, "l", value, !1)
1705
1892
  : value instanceof Float32Array
1706
- ? emitTypedArrayChunk(request, id, "G", value)
1893
+ ? emitTypedArrayChunk(request, id, "G", value, !1)
1707
1894
  : value instanceof Float64Array
1708
- ? emitTypedArrayChunk(request, id, "g", value)
1895
+ ? emitTypedArrayChunk(request, id, "g", value, !1)
1709
1896
  : value instanceof BigInt64Array
1710
- ? emitTypedArrayChunk(request, id, "M", value)
1897
+ ? emitTypedArrayChunk(request, id, "M", value, !1)
1711
1898
  : value instanceof BigUint64Array
1712
- ? emitTypedArrayChunk(request, id, "m", value)
1899
+ ? emitTypedArrayChunk(request, id, "m", value, !1)
1713
1900
  : value instanceof DataView
1714
- ? emitTypedArrayChunk(request, id, "V", value)
1901
+ ? emitTypedArrayChunk(request, id, "V", value, !1)
1715
1902
  : ((value = stringify(value, task.toJSON)),
1716
- emitModelChunk(request, task.id, value));
1903
+ (task =
1904
+ task.id.toString(16) + ":" + value + "\n"),
1905
+ request.completedRegularChunks.push(task));
1717
1906
  }
1718
1907
  function erroredTask(request, task, error) {
1719
- request.abortableTasks.delete(task);
1720
1908
  task.status = 4;
1721
1909
  error = logRecoverableError(request, error, task);
1722
1910
  emitErrorChunk(request, task.id, error);
1911
+ request.abortableTasks.delete(task);
1912
+ callOnAllReadyIfReady(request);
1723
1913
  }
1724
1914
  var emptyRoot = {};
1725
1915
  function retryTask(request, task) {
1726
1916
  if (0 === task.status) {
1727
1917
  task.status = 5;
1918
+ var parentSerializedSize = serializedSize;
1728
1919
  try {
1729
1920
  modelRoot = task.model;
1730
1921
  var resolvedModel = renderModelDestructive(
@@ -1741,18 +1932,27 @@ function retryTask(request, task) {
1741
1932
  request.writtenObjects.set(resolvedModel, serializeByValueID(task.id)),
1742
1933
  emitChunk(request, task, resolvedModel);
1743
1934
  else {
1744
- var json = stringify(resolvedModel);
1745
- emitModelChunk(request, task.id, json);
1935
+ var json = stringify(resolvedModel),
1936
+ processedChunk = task.id.toString(16) + ":" + json + "\n";
1937
+ request.completedRegularChunks.push(processedChunk);
1746
1938
  }
1747
- request.abortableTasks.delete(task);
1748
1939
  task.status = 1;
1940
+ request.abortableTasks.delete(task);
1941
+ callOnAllReadyIfReady(request);
1749
1942
  } catch (thrownValue) {
1750
- if (12 === request.status) {
1751
- request.abortableTasks.delete(task);
1752
- task.status = 3;
1753
- var model = stringify(serializeByValueID(request.fatalError));
1754
- emitModelChunk(request, task.id, model);
1755
- } else {
1943
+ if (12 === request.status)
1944
+ if (
1945
+ (request.abortableTasks.delete(task),
1946
+ (task.status = 0),
1947
+ 21 === request.type)
1948
+ )
1949
+ haltTask(task), finishHaltedTask(task, request);
1950
+ else {
1951
+ var errorId = request.fatalError;
1952
+ abortTask(task);
1953
+ finishAbortedTask(task, request, errorId);
1954
+ }
1955
+ else {
1756
1956
  var x =
1757
1957
  thrownValue === SuspenseException
1758
1958
  ? getSuspendedThenable()
@@ -1769,26 +1969,29 @@ function retryTask(request, task) {
1769
1969
  } else erroredTask(request, task, x);
1770
1970
  }
1771
1971
  } finally {
1972
+ serializedSize = parentSerializedSize;
1772
1973
  }
1773
1974
  }
1774
1975
  }
1976
+ function tryStreamTask(request, task) {
1977
+ var parentSerializedSize = serializedSize;
1978
+ try {
1979
+ emitChunk(request, task, task.model);
1980
+ } finally {
1981
+ serializedSize = parentSerializedSize;
1982
+ }
1983
+ }
1775
1984
  function performWork(request) {
1776
1985
  var prevDispatcher = ReactSharedInternalsServer.H;
1777
1986
  ReactSharedInternalsServer.H = HooksDispatcher;
1778
1987
  var prevRequest = currentRequest;
1779
1988
  currentRequest$1 = currentRequest = request;
1780
- var hadAbortableTasks = 0 < request.abortableTasks.size;
1781
1989
  try {
1782
1990
  var pingedTasks = request.pingedTasks;
1783
1991
  request.pingedTasks = [];
1784
1992
  for (var i = 0; i < pingedTasks.length; i++)
1785
1993
  retryTask(request, pingedTasks[i]);
1786
- null !== request.destination &&
1787
- flushCompletedChunks(request, request.destination);
1788
- if (hadAbortableTasks && 0 === request.abortableTasks.size) {
1789
- var onAllReady = request.onAllReady;
1790
- onAllReady();
1791
- }
1994
+ flushCompletedChunks(request);
1792
1995
  } catch (error) {
1793
1996
  logRecoverableError(request, error, null), fatalError(request, error);
1794
1997
  } finally {
@@ -1797,67 +2000,94 @@ function performWork(request) {
1797
2000
  (currentRequest = prevRequest);
1798
2001
  }
1799
2002
  }
1800
- function flushCompletedChunks(request, destination) {
1801
- currentView = new Uint8Array(2048);
1802
- writtenBytes = 0;
1803
- destinationHasCapacity = !0;
1804
- try {
1805
- for (
1806
- var importsChunks = request.completedImportChunks, i = 0;
1807
- i < importsChunks.length;
1808
- i++
1809
- )
1810
- if (
1811
- (request.pendingChunks--,
1812
- !writeChunkAndReturn(destination, importsChunks[i]))
1813
- ) {
1814
- request.destination = null;
1815
- i++;
1816
- break;
1817
- }
1818
- importsChunks.splice(0, i);
1819
- var hintChunks = request.completedHintChunks;
1820
- for (i = 0; i < hintChunks.length; i++)
1821
- if (!writeChunkAndReturn(destination, hintChunks[i])) {
1822
- request.destination = null;
1823
- i++;
1824
- break;
1825
- }
1826
- hintChunks.splice(0, i);
1827
- var regularChunks = request.completedRegularChunks;
1828
- for (i = 0; i < regularChunks.length; i++)
1829
- if (
1830
- (request.pendingChunks--,
1831
- !writeChunkAndReturn(destination, regularChunks[i]))
1832
- ) {
1833
- request.destination = null;
1834
- i++;
1835
- break;
1836
- }
1837
- regularChunks.splice(0, i);
1838
- var errorChunks = request.completedErrorChunks;
1839
- for (i = 0; i < errorChunks.length; i++)
1840
- if (
1841
- (request.pendingChunks--,
1842
- !writeChunkAndReturn(destination, errorChunks[i]))
1843
- ) {
1844
- request.destination = null;
1845
- i++;
1846
- break;
1847
- }
1848
- errorChunks.splice(0, i);
1849
- } finally {
1850
- (request.flushScheduled = !1),
1851
- currentView &&
1852
- 0 < writtenBytes &&
1853
- destination.write(currentView.subarray(0, writtenBytes)),
1854
- (currentView = null),
1855
- (writtenBytes = 0),
1856
- (destinationHasCapacity = !0);
2003
+ function abortTask(task) {
2004
+ 0 === task.status && (task.status = 3);
2005
+ }
2006
+ function finishAbortedTask(task, request, errorId) {
2007
+ 3 === task.status &&
2008
+ ((errorId = serializeByValueID(errorId)),
2009
+ (task = encodeReferenceChunk(request, task.id, errorId)),
2010
+ request.completedErrorChunks.push(task));
2011
+ }
2012
+ function haltTask(task) {
2013
+ 0 === task.status && (task.status = 3);
2014
+ }
2015
+ function finishHaltedTask(task, request) {
2016
+ 3 === task.status && request.pendingChunks--;
2017
+ }
2018
+ function flushCompletedChunks(request) {
2019
+ var destination = request.destination;
2020
+ if (null !== destination) {
2021
+ currentView = new Uint8Array(2048);
2022
+ writtenBytes = 0;
2023
+ destinationHasCapacity = !0;
2024
+ try {
2025
+ for (
2026
+ var importsChunks = request.completedImportChunks, i = 0;
2027
+ i < importsChunks.length;
2028
+ i++
2029
+ )
2030
+ if (
2031
+ (request.pendingChunks--,
2032
+ !writeChunkAndReturn(destination, importsChunks[i]))
2033
+ ) {
2034
+ request.destination = null;
2035
+ i++;
2036
+ break;
2037
+ }
2038
+ importsChunks.splice(0, i);
2039
+ var hintChunks = request.completedHintChunks;
2040
+ for (i = 0; i < hintChunks.length; i++)
2041
+ if (!writeChunkAndReturn(destination, hintChunks[i])) {
2042
+ request.destination = null;
2043
+ i++;
2044
+ break;
2045
+ }
2046
+ hintChunks.splice(0, i);
2047
+ var regularChunks = request.completedRegularChunks;
2048
+ for (i = 0; i < regularChunks.length; i++)
2049
+ if (
2050
+ (request.pendingChunks--,
2051
+ !writeChunkAndReturn(destination, regularChunks[i]))
2052
+ ) {
2053
+ request.destination = null;
2054
+ i++;
2055
+ break;
2056
+ }
2057
+ regularChunks.splice(0, i);
2058
+ var errorChunks = request.completedErrorChunks;
2059
+ for (i = 0; i < errorChunks.length; i++)
2060
+ if (
2061
+ (request.pendingChunks--,
2062
+ !writeChunkAndReturn(destination, errorChunks[i]))
2063
+ ) {
2064
+ request.destination = null;
2065
+ i++;
2066
+ break;
2067
+ }
2068
+ errorChunks.splice(0, i);
2069
+ } finally {
2070
+ (request.flushScheduled = !1),
2071
+ currentView &&
2072
+ 0 < writtenBytes &&
2073
+ destination.write(currentView.subarray(0, writtenBytes)),
2074
+ (currentView = null),
2075
+ (writtenBytes = 0),
2076
+ (destinationHasCapacity = !0);
2077
+ }
2078
+ "function" === typeof destination.flush && destination.flush();
1857
2079
  }
1858
- "function" === typeof destination.flush && destination.flush();
1859
2080
  0 === request.pendingChunks &&
1860
- ((request.status = 14), destination.end(), (request.destination = null));
2081
+ (12 > request.status &&
2082
+ request.cacheController.abort(
2083
+ Error(
2084
+ "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources."
2085
+ )
2086
+ ),
2087
+ null !== request.destination &&
2088
+ ((request.status = 14),
2089
+ request.destination.end(),
2090
+ (request.destination = null)));
1861
2091
  }
1862
2092
  function startWork(request) {
1863
2093
  request.flushScheduled = null !== request.destination;
@@ -1875,72 +2105,97 @@ function enqueueFlush(request) {
1875
2105
  ((request.flushScheduled = !0),
1876
2106
  setImmediate(function () {
1877
2107
  request.flushScheduled = !1;
1878
- var destination = request.destination;
1879
- destination && flushCompletedChunks(request, destination);
2108
+ flushCompletedChunks(request);
1880
2109
  }));
1881
2110
  }
2111
+ function callOnAllReadyIfReady(request) {
2112
+ 0 === request.abortableTasks.size &&
2113
+ ((request = request.onAllReady), request());
2114
+ }
1882
2115
  function startFlowing(request, destination) {
1883
2116
  if (13 === request.status)
1884
2117
  (request.status = 14), destination.destroy(request.fatalError);
1885
2118
  else if (14 !== request.status && null === request.destination) {
1886
2119
  request.destination = destination;
1887
2120
  try {
1888
- flushCompletedChunks(request, destination);
2121
+ flushCompletedChunks(request);
1889
2122
  } catch (error) {
1890
2123
  logRecoverableError(request, error, null), fatalError(request, error);
1891
2124
  }
1892
2125
  }
1893
2126
  }
1894
- function abort(request, reason) {
2127
+ function finishHalt(request, abortedTasks) {
2128
+ try {
2129
+ abortedTasks.forEach(function (task) {
2130
+ return finishHaltedTask(task, request);
2131
+ });
2132
+ var onAllReady = request.onAllReady;
2133
+ onAllReady();
2134
+ flushCompletedChunks(request);
2135
+ } catch (error) {
2136
+ logRecoverableError(request, error, null), fatalError(request, error);
2137
+ }
2138
+ }
2139
+ function finishAbort(request, abortedTasks, errorId) {
1895
2140
  try {
1896
- 11 >= request.status && (request.status = 12);
1897
- var abortableTasks = request.abortableTasks;
1898
- if (0 < abortableTasks.size) {
1899
- var error =
1900
- void 0 === reason
1901
- ? Error("The render was aborted by the server without a reason.")
1902
- : "object" === typeof reason &&
1903
- null !== reason &&
1904
- "function" === typeof reason.then
1905
- ? Error("The render was aborted by the server with a promise.")
1906
- : reason,
1907
- digest = logRecoverableError(request, error, null),
1908
- errorId = request.nextChunkId++;
1909
- request.fatalError = errorId;
1910
- request.pendingChunks++;
1911
- emitErrorChunk(request, errorId, digest, error);
1912
- abortableTasks.forEach(function (task) {
1913
- if (5 !== task.status) {
1914
- task.status = 3;
1915
- var ref = serializeByValueID(errorId);
1916
- task = encodeReferenceChunk(request, task.id, ref);
1917
- request.completedErrorChunks.push(task);
2141
+ abortedTasks.forEach(function (task) {
2142
+ return finishAbortedTask(task, request, errorId);
2143
+ });
2144
+ var onAllReady = request.onAllReady;
2145
+ onAllReady();
2146
+ flushCompletedChunks(request);
2147
+ } catch (error) {
2148
+ logRecoverableError(request, error, null), fatalError(request, error);
2149
+ }
2150
+ }
2151
+ function abort(request, reason) {
2152
+ if (!(11 < request.status))
2153
+ try {
2154
+ request.status = 12;
2155
+ request.cacheController.abort(reason);
2156
+ var abortableTasks = request.abortableTasks;
2157
+ if (0 < abortableTasks.size)
2158
+ if (21 === request.type)
2159
+ abortableTasks.forEach(function (task) {
2160
+ return haltTask(task, request);
2161
+ }),
2162
+ setImmediate(function () {
2163
+ return finishHalt(request, abortableTasks);
2164
+ });
2165
+ else {
2166
+ var error =
2167
+ void 0 === reason
2168
+ ? Error(
2169
+ "The render was aborted by the server without a reason."
2170
+ )
2171
+ : "object" === typeof reason &&
2172
+ null !== reason &&
2173
+ "function" === typeof reason.then
2174
+ ? Error(
2175
+ "The render was aborted by the server with a promise."
2176
+ )
2177
+ : reason,
2178
+ digest = logRecoverableError(request, error, null),
2179
+ errorId = request.nextChunkId++;
2180
+ request.fatalError = errorId;
2181
+ request.pendingChunks++;
2182
+ emitErrorChunk(request, errorId, digest, error, !1, null);
2183
+ abortableTasks.forEach(function (task) {
2184
+ return abortTask(task, request, errorId);
2185
+ });
2186
+ setImmediate(function () {
2187
+ return finishAbort(request, abortableTasks, errorId);
2188
+ });
1918
2189
  }
1919
- });
1920
- abortableTasks.clear();
1921
- var onAllReady = request.onAllReady;
1922
- onAllReady();
1923
- }
1924
- var abortListeners = request.abortListeners;
1925
- if (0 < abortListeners.size) {
1926
- var error$22 =
1927
- void 0 === reason
1928
- ? Error("The render was aborted by the server without a reason.")
1929
- : "object" === typeof reason &&
1930
- null !== reason &&
1931
- "function" === typeof reason.then
1932
- ? Error("The render was aborted by the server with a promise.")
1933
- : reason;
1934
- abortListeners.forEach(function (callback) {
1935
- return callback(error$22);
1936
- });
1937
- abortListeners.clear();
2190
+ else {
2191
+ var onAllReady = request.onAllReady;
2192
+ onAllReady();
2193
+ flushCompletedChunks(request);
2194
+ }
2195
+ } catch (error$23) {
2196
+ logRecoverableError(request, error$23, null),
2197
+ fatalError(request, error$23);
1938
2198
  }
1939
- null !== request.destination &&
1940
- flushCompletedChunks(request, request.destination);
1941
- } catch (error$23) {
1942
- logRecoverableError(request, error$23, null), fatalError(request, error$23);
1943
- }
1944
2199
  }
1945
2200
  function resolveServerReference(bundlerConfig, id) {
1946
2201
  var idx = id.lastIndexOf("#");
@@ -1983,7 +2238,6 @@ function requireModule(metadata) {
1983
2238
  ? moduleExports.default
1984
2239
  : moduleExports[metadata.name];
1985
2240
  }
1986
- var hasOwnProperty = Object.prototype.hasOwnProperty;
1987
2241
  function Chunk(status, value, reason, response) {
1988
2242
  this.status = status;
1989
2243
  this.value = value;
@@ -2645,7 +2899,24 @@ function createCancelHandler(request, reason) {
2645
2899
  abort(request, Error(reason));
2646
2900
  };
2647
2901
  }
2648
- function createFakeWritable(readable) {
2902
+ function createFakeWritableFromReadableStreamController(controller) {
2903
+ return {
2904
+ write: function (chunk) {
2905
+ "string" === typeof chunk && (chunk = textEncoder.encode(chunk));
2906
+ controller.enqueue(chunk);
2907
+ return !0;
2908
+ },
2909
+ end: function () {
2910
+ controller.close();
2911
+ },
2912
+ destroy: function (error) {
2913
+ "function" === typeof controller.error
2914
+ ? controller.error(error)
2915
+ : controller.close();
2916
+ }
2917
+ };
2918
+ }
2919
+ function createFakeWritableFromNodeReadable(readable) {
2649
2920
  return {
2650
2921
  write: function (chunk) {
2651
2922
  return readable.push(chunk);
@@ -2718,6 +2989,37 @@ exports.decodeReply = function (body, webpackMap, options) {
2718
2989
  close(body);
2719
2990
  return webpackMap;
2720
2991
  };
2992
+ exports.decodeReplyFromAsyncIterable = function (
2993
+ iterable,
2994
+ webpackMap,
2995
+ options
2996
+ ) {
2997
+ function progress(entry) {
2998
+ if (entry.done) close(response);
2999
+ else {
3000
+ var _entry$value = entry.value;
3001
+ entry = _entry$value[0];
3002
+ _entry$value = _entry$value[1];
3003
+ "string" === typeof _entry$value
3004
+ ? resolveField(response, entry, _entry$value)
3005
+ : response._formData.append(entry, _entry$value);
3006
+ iterator.next().then(progress, error);
3007
+ }
3008
+ }
3009
+ function error(reason) {
3010
+ reportGlobalError(response, reason);
3011
+ "function" === typeof iterator.throw &&
3012
+ iterator.throw(reason).then(error, error);
3013
+ }
3014
+ var iterator = iterable[ASYNC_ITERATOR](),
3015
+ response = createResponse(
3016
+ webpackMap,
3017
+ "",
3018
+ options ? options.temporaryReferences : void 0
3019
+ );
3020
+ iterator.next().then(progress, error);
3021
+ return getChunk(response, 0);
3022
+ };
2721
3023
  exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) {
2722
3024
  var response = createResponse(
2723
3025
  webpackMap,
@@ -2731,20 +3033,20 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) {
2731
3033
  ? queuedFields.push(name, value)
2732
3034
  : resolveField(response, name, value);
2733
3035
  });
2734
- busboyStream.on("file", function (name, value, _ref) {
2735
- var filename = _ref.filename,
2736
- mimeType = _ref.mimeType;
2737
- if ("base64" === _ref.encoding.toLowerCase())
3036
+ busboyStream.on("file", function (name, value, _ref2) {
3037
+ var filename = _ref2.filename,
3038
+ mimeType = _ref2.mimeType;
3039
+ if ("base64" === _ref2.encoding.toLowerCase())
2738
3040
  throw Error(
2739
3041
  "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."
2740
3042
  );
2741
3043
  pendingFiles++;
2742
- var JSCompiler_object_inline_chunks_227 = [];
3044
+ var JSCompiler_object_inline_chunks_274 = [];
2743
3045
  value.on("data", function (chunk) {
2744
- JSCompiler_object_inline_chunks_227.push(chunk);
3046
+ JSCompiler_object_inline_chunks_274.push(chunk);
2745
3047
  });
2746
3048
  value.on("end", function () {
2747
- var blob = new Blob(JSCompiler_object_inline_chunks_227, {
3049
+ var blob = new Blob(JSCompiler_object_inline_chunks_274, {
2748
3050
  type: mimeType
2749
3051
  });
2750
3052
  response._formData.append(name, blob, filename);
@@ -2764,6 +3066,88 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) {
2764
3066
  });
2765
3067
  return getChunk(response, 0);
2766
3068
  };
3069
+ exports.prerender = function (model, webpackMap, options) {
3070
+ return new Promise(function (resolve, reject) {
3071
+ var request = new RequestInstance(
3072
+ 21,
3073
+ model,
3074
+ webpackMap,
3075
+ options ? options.onError : void 0,
3076
+ options ? options.onPostpone : void 0,
3077
+ function () {
3078
+ var writable,
3079
+ stream = new ReadableStream(
3080
+ {
3081
+ type: "bytes",
3082
+ start: function (controller) {
3083
+ writable =
3084
+ createFakeWritableFromReadableStreamController(controller);
3085
+ },
3086
+ pull: function () {
3087
+ startFlowing(request, writable);
3088
+ },
3089
+ cancel: function (reason) {
3090
+ request.destination = null;
3091
+ abort(request, reason);
3092
+ }
3093
+ },
3094
+ { highWaterMark: 0 }
3095
+ );
3096
+ resolve({ prelude: stream });
3097
+ },
3098
+ reject,
3099
+ options ? options.identifierPrefix : void 0,
3100
+ options ? options.temporaryReferences : void 0
3101
+ );
3102
+ if (options && options.signal) {
3103
+ var signal = options.signal;
3104
+ if (signal.aborted) abort(request, signal.reason);
3105
+ else {
3106
+ var listener = function () {
3107
+ abort(request, signal.reason);
3108
+ signal.removeEventListener("abort", listener);
3109
+ };
3110
+ signal.addEventListener("abort", listener);
3111
+ }
3112
+ }
3113
+ startWork(request);
3114
+ });
3115
+ };
3116
+ exports.prerenderToNodeStream = function (model, webpackMap, options) {
3117
+ return new Promise(function (resolve, reject) {
3118
+ var request = new RequestInstance(
3119
+ 21,
3120
+ model,
3121
+ webpackMap,
3122
+ options ? options.onError : void 0,
3123
+ options ? options.onPostpone : void 0,
3124
+ function () {
3125
+ var readable = new stream.Readable({
3126
+ read: function () {
3127
+ startFlowing(request, writable);
3128
+ }
3129
+ }),
3130
+ writable = createFakeWritableFromNodeReadable(readable);
3131
+ resolve({ prelude: readable });
3132
+ },
3133
+ reject,
3134
+ options ? options.identifierPrefix : void 0,
3135
+ options ? options.temporaryReferences : void 0
3136
+ );
3137
+ if (options && options.signal) {
3138
+ var signal = options.signal;
3139
+ if (signal.aborted) abort(request, signal.reason);
3140
+ else {
3141
+ var listener = function () {
3142
+ abort(request, signal.reason);
3143
+ signal.removeEventListener("abort", listener);
3144
+ };
3145
+ signal.addEventListener("abort", listener);
3146
+ }
3147
+ }
3148
+ startWork(request);
3149
+ });
3150
+ };
2767
3151
  exports.registerClientReference = function (
2768
3152
  proxyImplementation,
2769
3153
  id,
@@ -2792,13 +3176,11 @@ exports.renderToPipeableStream = function (model, webpackMap, options) {
2792
3176
  model,
2793
3177
  webpackMap,
2794
3178
  options ? options.onError : void 0,
2795
- options ? options.identifierPrefix : void 0,
2796
3179
  options ? options.onPostpone : void 0,
2797
- options ? options.temporaryReferences : void 0,
2798
- void 0,
2799
- void 0,
2800
3180
  noop,
2801
- noop
3181
+ noop,
3182
+ options ? options.identifierPrefix : void 0,
3183
+ options ? options.temporaryReferences : void 0
2802
3184
  ),
2803
3185
  hasStartedFlowing = !1;
2804
3186
  startWork(request);
@@ -2829,40 +3211,45 @@ exports.renderToPipeableStream = function (model, webpackMap, options) {
2829
3211
  }
2830
3212
  };
2831
3213
  };
2832
- exports.unstable_prerenderToNodeStream = function (model, webpackMap, options) {
2833
- return new Promise(function (resolve, reject) {
2834
- var request = new RequestInstance(
2835
- 21,
2836
- model,
2837
- webpackMap,
2838
- options ? options.onError : void 0,
2839
- options ? options.identifierPrefix : void 0,
2840
- options ? options.onPostpone : void 0,
2841
- options ? options.temporaryReferences : void 0,
2842
- void 0,
2843
- void 0,
2844
- function () {
2845
- var readable = new stream.Readable({
2846
- read: function () {
2847
- startFlowing(request, writable);
2848
- }
2849
- }),
2850
- writable = createFakeWritable(readable);
2851
- resolve({ prelude: readable });
3214
+ exports.renderToReadableStream = function (model, webpackMap, options) {
3215
+ var request = new RequestInstance(
3216
+ 20,
3217
+ model,
3218
+ webpackMap,
3219
+ options ? options.onError : void 0,
3220
+ options ? options.onPostpone : void 0,
3221
+ noop,
3222
+ noop,
3223
+ options ? options.identifierPrefix : void 0,
3224
+ options ? options.temporaryReferences : void 0
3225
+ );
3226
+ if (options && options.signal) {
3227
+ var signal = options.signal;
3228
+ if (signal.aborted) abort(request, signal.reason);
3229
+ else {
3230
+ var listener = function () {
3231
+ abort(request, signal.reason);
3232
+ signal.removeEventListener("abort", listener);
3233
+ };
3234
+ signal.addEventListener("abort", listener);
3235
+ }
3236
+ }
3237
+ var writable;
3238
+ return new ReadableStream(
3239
+ {
3240
+ type: "bytes",
3241
+ start: function (controller) {
3242
+ writable = createFakeWritableFromReadableStreamController(controller);
3243
+ startWork(request);
2852
3244
  },
2853
- reject
2854
- );
2855
- if (options && options.signal) {
2856
- var signal = options.signal;
2857
- if (signal.aborted) abort(request, signal.reason);
2858
- else {
2859
- var listener = function () {
2860
- abort(request, signal.reason);
2861
- signal.removeEventListener("abort", listener);
2862
- };
2863
- signal.addEventListener("abort", listener);
3245
+ pull: function () {
3246
+ startFlowing(request, writable);
3247
+ },
3248
+ cancel: function (reason) {
3249
+ request.destination = null;
3250
+ abort(request, reason);
2864
3251
  }
2865
- }
2866
- startWork(request);
2867
- });
3252
+ },
3253
+ { highWaterMark: 0 }
3254
+ );
2868
3255
  };