react-dom 19.3.0-canary-408b38ef-20251023 → 19.3.0-canary-b4455a6e-20251027

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.
@@ -11,6 +11,9 @@
11
11
  "use strict";
12
12
  var React = require("react"),
13
13
  ReactDOM = require("react-dom"),
14
+ util = require("util");
15
+ require("crypto");
16
+ var stream = require("stream"),
14
17
  REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
15
18
  REACT_PORTAL_TYPE = Symbol.for("react.portal"),
16
19
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
@@ -50,7 +53,9 @@ function byteLengthOfChunk(chunk) {
50
53
  function closeWithError(destination, error) {
51
54
  "function" === typeof destination.error
52
55
  ? destination.error(error)
53
- : destination.close();
56
+ : "function" === typeof destination.destroy
57
+ ? destination.destroy(error)
58
+ : "function" === typeof destination.close && destination.close();
54
59
  }
55
60
  var assign = Object.assign,
56
61
  hasOwnProperty = Object.prototype.hasOwnProperty,
@@ -3877,6 +3882,150 @@ function createRequest(
3877
3882
  resumableState.pingedTasks.push(children);
3878
3883
  return resumableState;
3879
3884
  }
3885
+ function createPrerenderRequest(
3886
+ children,
3887
+ resumableState,
3888
+ renderState,
3889
+ rootFormatContext,
3890
+ progressiveChunkSize,
3891
+ onError,
3892
+ onAllReady,
3893
+ onShellReady,
3894
+ onShellError,
3895
+ onFatalError,
3896
+ onPostpone
3897
+ ) {
3898
+ children = createRequest(
3899
+ children,
3900
+ resumableState,
3901
+ renderState,
3902
+ rootFormatContext,
3903
+ progressiveChunkSize,
3904
+ onError,
3905
+ onAllReady,
3906
+ onShellReady,
3907
+ onShellError,
3908
+ onFatalError,
3909
+ onPostpone,
3910
+ void 0
3911
+ );
3912
+ children.trackedPostpones = {
3913
+ workingMap: new Map(),
3914
+ rootNodes: [],
3915
+ rootSlots: null
3916
+ };
3917
+ return children;
3918
+ }
3919
+ function resumeRequest(
3920
+ children,
3921
+ postponedState,
3922
+ renderState,
3923
+ onError,
3924
+ onAllReady,
3925
+ onShellReady,
3926
+ onShellError,
3927
+ onFatalError,
3928
+ onPostpone
3929
+ ) {
3930
+ renderState = new RequestInstance(
3931
+ postponedState.resumableState,
3932
+ renderState,
3933
+ postponedState.rootFormatContext,
3934
+ postponedState.progressiveChunkSize,
3935
+ onError,
3936
+ onAllReady,
3937
+ onShellReady,
3938
+ onShellError,
3939
+ onFatalError,
3940
+ onPostpone,
3941
+ null
3942
+ );
3943
+ renderState.nextSegmentId = postponedState.nextSegmentId;
3944
+ if ("number" === typeof postponedState.replaySlots)
3945
+ return (
3946
+ (onError = createPendingSegment(
3947
+ renderState,
3948
+ 0,
3949
+ null,
3950
+ postponedState.rootFormatContext,
3951
+ !1,
3952
+ !1
3953
+ )),
3954
+ (onError.parentFlushed = !0),
3955
+ (children = createRenderTask(
3956
+ renderState,
3957
+ null,
3958
+ children,
3959
+ -1,
3960
+ null,
3961
+ onError,
3962
+ null,
3963
+ null,
3964
+ renderState.abortableTasks,
3965
+ null,
3966
+ postponedState.rootFormatContext,
3967
+ null,
3968
+ emptyTreeContext,
3969
+ null,
3970
+ null
3971
+ )),
3972
+ pushComponentStack(children),
3973
+ renderState.pingedTasks.push(children),
3974
+ renderState
3975
+ );
3976
+ children = createReplayTask(
3977
+ renderState,
3978
+ null,
3979
+ {
3980
+ nodes: postponedState.replayNodes,
3981
+ slots: postponedState.replaySlots,
3982
+ pendingTasks: 0
3983
+ },
3984
+ children,
3985
+ -1,
3986
+ null,
3987
+ null,
3988
+ renderState.abortableTasks,
3989
+ null,
3990
+ postponedState.rootFormatContext,
3991
+ null,
3992
+ emptyTreeContext,
3993
+ null,
3994
+ null
3995
+ );
3996
+ pushComponentStack(children);
3997
+ renderState.pingedTasks.push(children);
3998
+ return renderState;
3999
+ }
4000
+ function resumeAndPrerenderRequest(
4001
+ children,
4002
+ postponedState,
4003
+ renderState,
4004
+ onError,
4005
+ onAllReady,
4006
+ onShellReady,
4007
+ onShellError,
4008
+ onFatalError,
4009
+ onPostpone
4010
+ ) {
4011
+ children = resumeRequest(
4012
+ children,
4013
+ postponedState,
4014
+ renderState,
4015
+ onError,
4016
+ onAllReady,
4017
+ onShellReady,
4018
+ onShellError,
4019
+ onFatalError,
4020
+ onPostpone
4021
+ );
4022
+ children.trackedPostpones = {
4023
+ workingMap: new Map(),
4024
+ rootNodes: [],
4025
+ rootSlots: null
4026
+ };
4027
+ return children;
4028
+ }
3880
4029
  var currentRequest = null;
3881
4030
  function pingTask(request, task) {
3882
4031
  request.pingedTasks.push(task);
@@ -4328,9 +4477,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4328
4477
  var defaultProps = type.defaultProps;
4329
4478
  if (defaultProps) {
4330
4479
  newProps === props && (newProps = assign({}, newProps, props));
4331
- for (var propName$43 in defaultProps)
4332
- void 0 === newProps[propName$43] &&
4333
- (newProps[propName$43] = defaultProps[propName$43]);
4480
+ for (var propName$44 in defaultProps)
4481
+ void 0 === newProps[propName$44] &&
4482
+ (newProps[propName$44] = defaultProps[propName$44]);
4334
4483
  }
4335
4484
  var JSCompiler_inline_result = newProps;
4336
4485
  var context = emptyContextObject,
@@ -4463,7 +4612,7 @@ function renderElement(request, task, keyPath, type, props, ref) {
4463
4612
  task.formatContext = prevContext;
4464
4613
  task.keyPath = prevKeyPath$jscomp$0;
4465
4614
  } else {
4466
- var children$40 = pushStartInstance(
4615
+ var children$41 = pushStartInstance(
4467
4616
  segment.chunks,
4468
4617
  type,
4469
4618
  props,
@@ -4475,13 +4624,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
4475
4624
  segment.lastPushedText
4476
4625
  );
4477
4626
  segment.lastPushedText = !1;
4478
- var prevContext$41 = task.formatContext,
4479
- prevKeyPath$42 = task.keyPath;
4627
+ var prevContext$42 = task.formatContext,
4628
+ prevKeyPath$43 = task.keyPath;
4480
4629
  task.keyPath = keyPath;
4481
4630
  if (
4482
4631
  3 ===
4483
4632
  (task.formatContext = getChildFormatContext(
4484
- prevContext$41,
4633
+ prevContext$42,
4485
4634
  type,
4486
4635
  props
4487
4636
  )).insertionMode
@@ -4498,7 +4647,7 @@ function renderElement(request, task, keyPath, type, props, ref) {
4498
4647
  task.blockedSegment = preambleSegment;
4499
4648
  try {
4500
4649
  (preambleSegment.status = 6),
4501
- renderNode(request, task, children$40, -1),
4650
+ renderNode(request, task, children$41, -1),
4502
4651
  pushSegmentFinale(
4503
4652
  preambleSegment.chunks,
4504
4653
  request.renderState,
@@ -4510,9 +4659,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4510
4659
  } finally {
4511
4660
  task.blockedSegment = segment;
4512
4661
  }
4513
- } else renderNode(request, task, children$40, -1);
4514
- task.formatContext = prevContext$41;
4515
- task.keyPath = prevKeyPath$42;
4662
+ } else renderNode(request, task, children$41, -1);
4663
+ task.formatContext = prevContext$42;
4664
+ task.keyPath = prevKeyPath$43;
4516
4665
  a: {
4517
4666
  var target = segment.chunks,
4518
4667
  resumableState = request.resumableState;
@@ -4537,19 +4686,19 @@ function renderElement(request, task, keyPath, type, props, ref) {
4537
4686
  case "wbr":
4538
4687
  break a;
4539
4688
  case "body":
4540
- if (1 >= prevContext$41.insertionMode) {
4689
+ if (1 >= prevContext$42.insertionMode) {
4541
4690
  resumableState.hasBody = !0;
4542
4691
  break a;
4543
4692
  }
4544
4693
  break;
4545
4694
  case "html":
4546
- if (0 === prevContext$41.insertionMode) {
4695
+ if (0 === prevContext$42.insertionMode) {
4547
4696
  resumableState.hasHtml = !0;
4548
4697
  break a;
4549
4698
  }
4550
4699
  break;
4551
4700
  case "head":
4552
- if (1 >= prevContext$41.insertionMode) break a;
4701
+ if (1 >= prevContext$42.insertionMode) break a;
4553
4702
  }
4554
4703
  target.push(endChunkForTag(type));
4555
4704
  }
@@ -4578,10 +4727,10 @@ function renderElement(request, task, keyPath, type, props, ref) {
4578
4727
  } else if ("hidden" !== props.mode) {
4579
4728
  segment$jscomp$0.chunks.push("\x3c!--&--\x3e");
4580
4729
  segment$jscomp$0.lastPushedText = !1;
4581
- var prevKeyPath$45 = task.keyPath;
4730
+ var prevKeyPath$46 = task.keyPath;
4582
4731
  task.keyPath = keyPath;
4583
4732
  renderNode(request, task, props.children, -1);
4584
- task.keyPath = prevKeyPath$45;
4733
+ task.keyPath = prevKeyPath$46;
4585
4734
  segment$jscomp$0.chunks.push("\x3c!--/&--\x3e");
4586
4735
  segment$jscomp$0.lastPushedText = !1;
4587
4736
  }
@@ -4626,7 +4775,7 @@ function renderElement(request, task, keyPath, type, props, ref) {
4626
4775
  }
4627
4776
  }
4628
4777
  if ("together" === revealOrder) {
4629
- var prevKeyPath$39 = task.keyPath,
4778
+ var prevKeyPath$40 = task.keyPath,
4630
4779
  prevRow = task.row,
4631
4780
  newRow = (task.row = createSuspenseListRow(null));
4632
4781
  newRow.boundaries = [];
@@ -4635,7 +4784,7 @@ function renderElement(request, task, keyPath, type, props, ref) {
4635
4784
  renderNodeDestructive(request, task, children$jscomp$0, -1);
4636
4785
  0 === --newRow.pendingTasks &&
4637
4786
  finishSuspenseListRow(request, newRow);
4638
- task.keyPath = prevKeyPath$39;
4787
+ task.keyPath = prevKeyPath$40;
4639
4788
  task.row = prevRow;
4640
4789
  null !== prevRow &&
4641
4790
  0 < newRow.pendingTasks &&
@@ -4724,22 +4873,22 @@ function renderElement(request, task, keyPath, type, props, ref) {
4724
4873
  throw Error("ReactDOMServer does not yet support scope components.");
4725
4874
  case REACT_SUSPENSE_TYPE:
4726
4875
  a: if (null !== task.replay) {
4727
- var prevKeyPath$26 = task.keyPath,
4728
- prevContext$27 = task.formatContext,
4729
- prevRow$28 = task.row;
4876
+ var prevKeyPath$27 = task.keyPath,
4877
+ prevContext$28 = task.formatContext,
4878
+ prevRow$29 = task.row;
4730
4879
  task.keyPath = keyPath;
4731
4880
  task.formatContext = getSuspenseContentFormatContext(
4732
4881
  request.resumableState,
4733
- prevContext$27
4882
+ prevContext$28
4734
4883
  );
4735
4884
  task.row = null;
4736
- var content$29 = props.children;
4885
+ var content$30 = props.children;
4737
4886
  try {
4738
- renderNode(request, task, content$29, -1);
4887
+ renderNode(request, task, content$30, -1);
4739
4888
  } finally {
4740
- (task.keyPath = prevKeyPath$26),
4741
- (task.formatContext = prevContext$27),
4742
- (task.row = prevRow$28);
4889
+ (task.keyPath = prevKeyPath$27),
4890
+ (task.formatContext = prevContext$28),
4891
+ (task.row = prevRow$29);
4743
4892
  }
4744
4893
  } else {
4745
4894
  var prevKeyPath$jscomp$5 = task.keyPath,
@@ -4900,12 +5049,12 @@ function renderElement(request, task, keyPath, type, props, ref) {
4900
5049
  null !== prevRow$jscomp$0 &&
4901
5050
  prevRow$jscomp$0.together &&
4902
5051
  tryToResolveTogetherRow(request, prevRow$jscomp$0);
4903
- } catch (thrownValue$30) {
5052
+ } catch (thrownValue$31) {
4904
5053
  newBoundary.status = 4;
4905
5054
  if (12 === request.status) {
4906
5055
  contentRootSegment.status = 3;
4907
5056
  var error = request.fatalError;
4908
- } else (contentRootSegment.status = 4), (error = thrownValue$30);
5057
+ } else (contentRootSegment.status = 4), (error = thrownValue$31);
4909
5058
  var thrownInfo = getThrownInfo(task.componentStack);
4910
5059
  var errorDigest = logRecoverableError(request, error, thrownInfo);
4911
5060
  newBoundary.errorDigest = errorDigest;
@@ -5629,21 +5778,21 @@ function renderNode(request, task, node, childIndex) {
5629
5778
  chunkLength = segment.chunks.length;
5630
5779
  try {
5631
5780
  return renderNodeDestructive(request, task, node, childIndex);
5632
- } catch (thrownValue$62) {
5781
+ } catch (thrownValue$63) {
5633
5782
  if (
5634
5783
  (resetHooksState(),
5635
5784
  (segment.children.length = childrenLength),
5636
5785
  (segment.chunks.length = chunkLength),
5637
5786
  (node =
5638
- thrownValue$62 === SuspenseException
5787
+ thrownValue$63 === SuspenseException
5639
5788
  ? getSuspendedThenable()
5640
- : thrownValue$62),
5789
+ : thrownValue$63),
5641
5790
  12 !== request.status && "object" === typeof node && null !== node)
5642
5791
  ) {
5643
5792
  if ("function" === typeof node.then) {
5644
5793
  segment = node;
5645
5794
  node =
5646
- thrownValue$62 === SuspenseException
5795
+ thrownValue$63 === SuspenseException
5647
5796
  ? getThenableStateAfterSuspending()
5648
5797
  : null;
5649
5798
  request = spawnNewSuspendedRenderTask(request, task, node).ping;
@@ -5658,7 +5807,7 @@ function renderNode(request, task, node, childIndex) {
5658
5807
  }
5659
5808
  if ("Maximum call stack size exceeded" === node.message) {
5660
5809
  segment =
5661
- thrownValue$62 === SuspenseException
5810
+ thrownValue$63 === SuspenseException
5662
5811
  ? getThenableStateAfterSuspending()
5663
5812
  : null;
5664
5813
  segment = spawnNewSuspendedRenderTask(request, task, segment);
@@ -5776,12 +5925,12 @@ function abortTask(task, request, error) {
5776
5925
  0 === request.pendingRootTasks && completeShell(request);
5777
5926
  }
5778
5927
  } else {
5779
- var trackedPostpones$63 = request.trackedPostpones;
5928
+ var trackedPostpones$64 = request.trackedPostpones;
5780
5929
  if (4 !== boundary.status) {
5781
- if (null !== trackedPostpones$63 && null !== segment)
5930
+ if (null !== trackedPostpones$64 && null !== segment)
5782
5931
  return (
5783
5932
  logRecoverableError(request, error, errorInfo),
5784
- trackPostpone(request, trackedPostpones$63, task, segment),
5933
+ trackPostpone(request, trackedPostpones$64, task, segment),
5785
5934
  boundary.fallbackAbortableTasks.forEach(function (fallbackTask) {
5786
5935
  return abortTask(fallbackTask, request, error);
5787
5936
  }),
@@ -6729,12 +6878,12 @@ function flushCompletedQueues(request, destination) {
6729
6878
  flushingPartialBoundaries = !0;
6730
6879
  var partialBoundaries = request.partialBoundaries;
6731
6880
  for (i = 0; i < partialBoundaries.length; i++) {
6732
- var boundary$69 = partialBoundaries[i];
6881
+ var boundary$70 = partialBoundaries[i];
6733
6882
  a: {
6734
6883
  clientRenderedBoundaries = request;
6735
6884
  boundary = destination;
6736
- flushedByteSize = boundary$69.byteSize;
6737
- var completedSegments = boundary$69.completedSegments;
6885
+ flushedByteSize = boundary$70.byteSize;
6886
+ var completedSegments = boundary$70.completedSegments;
6738
6887
  for (
6739
6888
  JSCompiler_inline_result = 0;
6740
6889
  JSCompiler_inline_result < completedSegments.length;
@@ -6744,7 +6893,7 @@ function flushCompletedQueues(request, destination) {
6744
6893
  !flushPartiallyCompletedSegment(
6745
6894
  clientRenderedBoundaries,
6746
6895
  boundary,
6747
- boundary$69,
6896
+ boundary$70,
6748
6897
  completedSegments[JSCompiler_inline_result]
6749
6898
  )
6750
6899
  ) {
@@ -6754,10 +6903,10 @@ function flushCompletedQueues(request, destination) {
6754
6903
  break a;
6755
6904
  }
6756
6905
  completedSegments.splice(0, JSCompiler_inline_result);
6757
- var row = boundary$69.row;
6906
+ var row = boundary$70.row;
6758
6907
  null !== row &&
6759
6908
  row.together &&
6760
- 1 === boundary$69.pendingTasks &&
6909
+ 1 === boundary$70.pendingTasks &&
6761
6910
  (1 === row.pendingTasks
6762
6911
  ? unblockSuspenseListRow(
6763
6912
  clientRenderedBoundaries,
@@ -6767,7 +6916,7 @@ function flushCompletedQueues(request, destination) {
6767
6916
  : row.pendingTasks--);
6768
6917
  JSCompiler_inline_result$jscomp$0 = writeHoistablesForBoundary(
6769
6918
  boundary,
6770
- boundary$69.contentState,
6919
+ boundary$70.contentState,
6771
6920
  clientRenderedBoundaries.renderState
6772
6921
  );
6773
6922
  }
@@ -6829,6 +6978,18 @@ function enqueueFlush(request) {
6829
6978
  : (request.flushScheduled = !1);
6830
6979
  }, 0));
6831
6980
  }
6981
+ function startFlowing(request, destination) {
6982
+ if (13 === request.status)
6983
+ (request.status = 14), closeWithError(destination, request.fatalError);
6984
+ else if (14 !== request.status && null === request.destination) {
6985
+ request.destination = destination;
6986
+ try {
6987
+ flushCompletedQueues(request, destination);
6988
+ } catch (error) {
6989
+ logRecoverableError(request, error, {}), fatalError(request, error);
6990
+ }
6991
+ }
6992
+ }
6832
6993
  function abort(request, reason) {
6833
6994
  if (11 === request.status || 10 === request.status) request.status = 12;
6834
6995
  try {
@@ -6850,8 +7011,8 @@ function abort(request, reason) {
6850
7011
  }
6851
7012
  null !== request.destination &&
6852
7013
  flushCompletedQueues(request, request.destination);
6853
- } catch (error$71) {
6854
- logRecoverableError(request, error$71, {}), fatalError(request, error$71);
7014
+ } catch (error$72) {
7015
+ logRecoverableError(request, error$72, {}), fatalError(request, error$72);
6855
7016
  }
6856
7017
  }
6857
7018
  function addToReplayParent(node, parentKeyPath, trackedPostpones) {
@@ -6866,16 +7027,337 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) {
6866
7027
  parentNode[2].push(node);
6867
7028
  }
6868
7029
  }
6869
- var isomorphicReactPackageVersion$jscomp$inline_820 = React.version;
6870
- if (
6871
- "19.3.0-canary-408b38ef-20251023" !==
6872
- isomorphicReactPackageVersion$jscomp$inline_820
6873
- )
6874
- throw Error(
6875
- 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
6876
- (isomorphicReactPackageVersion$jscomp$inline_820 +
6877
- "\n - react-dom: 19.3.0-canary-408b38ef-20251023\nLearn more: https://react.dev/warnings/version-mismatch")
7030
+ function getPostponedState(request) {
7031
+ var trackedPostpones = request.trackedPostpones;
7032
+ if (
7033
+ null === trackedPostpones ||
7034
+ (0 === trackedPostpones.rootNodes.length &&
7035
+ null === trackedPostpones.rootSlots)
7036
+ )
7037
+ return (request.trackedPostpones = null);
7038
+ if (
7039
+ null === request.completedRootSegment ||
7040
+ (5 !== request.completedRootSegment.status &&
7041
+ null !== request.completedPreambleSegments)
7042
+ ) {
7043
+ var nextSegmentId = request.nextSegmentId;
7044
+ var replaySlots = trackedPostpones.rootSlots;
7045
+ var resumableState = request.resumableState;
7046
+ resumableState.bootstrapScriptContent = void 0;
7047
+ resumableState.bootstrapScripts = void 0;
7048
+ resumableState.bootstrapModules = void 0;
7049
+ } else {
7050
+ nextSegmentId = 0;
7051
+ replaySlots = -1;
7052
+ resumableState = request.resumableState;
7053
+ var renderState = request.renderState;
7054
+ resumableState.nextFormID = 0;
7055
+ resumableState.hasBody = !1;
7056
+ resumableState.hasHtml = !1;
7057
+ resumableState.unknownResources = { font: renderState.resets.font };
7058
+ resumableState.dnsResources = renderState.resets.dns;
7059
+ resumableState.connectResources = renderState.resets.connect;
7060
+ resumableState.imageResources = renderState.resets.image;
7061
+ resumableState.styleResources = renderState.resets.style;
7062
+ resumableState.scriptResources = {};
7063
+ resumableState.moduleUnknownResources = {};
7064
+ resumableState.moduleScriptResources = {};
7065
+ resumableState.instructions = 0;
7066
+ }
7067
+ return {
7068
+ nextSegmentId: nextSegmentId,
7069
+ rootFormatContext: request.rootFormatContext,
7070
+ progressiveChunkSize: request.progressiveChunkSize,
7071
+ resumableState: request.resumableState,
7072
+ replayNodes: trackedPostpones.rootNodes,
7073
+ replaySlots: replaySlots
7074
+ };
7075
+ }
7076
+ function ensureCorrectIsomorphicReactVersion() {
7077
+ var isomorphicReactPackageVersion = React.version;
7078
+ if ("19.3.0-canary-b4455a6e-20251027" !== isomorphicReactPackageVersion)
7079
+ throw Error(
7080
+ 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
7081
+ (isomorphicReactPackageVersion +
7082
+ "\n - react-dom: 19.3.0-canary-b4455a6e-20251027\nLearn more: https://react.dev/warnings/version-mismatch")
7083
+ );
7084
+ }
7085
+ ensureCorrectIsomorphicReactVersion();
7086
+ var textEncoder = new util.TextEncoder();
7087
+ ensureCorrectIsomorphicReactVersion();
7088
+ function createDrainHandler(destination, request) {
7089
+ return function () {
7090
+ return startFlowing(request, destination);
7091
+ };
7092
+ }
7093
+ function createCancelHandler(request, reason) {
7094
+ return function () {
7095
+ request.destination = null;
7096
+ abort(request, Error(reason));
7097
+ };
7098
+ }
7099
+ function createRequestImpl(children, options) {
7100
+ var resumableState = createResumableState(
7101
+ options ? options.identifierPrefix : void 0,
7102
+ options ? options.unstable_externalRuntimeSrc : void 0,
7103
+ options ? options.bootstrapScriptContent : void 0,
7104
+ options ? options.bootstrapScripts : void 0,
7105
+ options ? options.bootstrapModules : void 0
7106
+ );
7107
+ return createRequest(
7108
+ children,
7109
+ resumableState,
7110
+ createRenderState(
7111
+ resumableState,
7112
+ options ? options.nonce : void 0,
7113
+ options ? options.unstable_externalRuntimeSrc : void 0,
7114
+ options ? options.importMap : void 0,
7115
+ options ? options.onHeaders : void 0,
7116
+ options ? options.maxHeadersLength : void 0
7117
+ ),
7118
+ createRootFormatContext(options ? options.namespaceURI : void 0),
7119
+ options ? options.progressiveChunkSize : void 0,
7120
+ options ? options.onError : void 0,
7121
+ options ? options.onAllReady : void 0,
7122
+ options ? options.onShellReady : void 0,
7123
+ options ? options.onShellError : void 0,
7124
+ void 0,
7125
+ options ? options.onPostpone : void 0,
7126
+ options ? options.formState : void 0
7127
+ );
7128
+ }
7129
+ function createFakeWritableFromReadableStreamController$1(controller) {
7130
+ return {
7131
+ write: function (chunk) {
7132
+ "string" === typeof chunk && (chunk = textEncoder.encode(chunk));
7133
+ controller.enqueue(chunk);
7134
+ return !0;
7135
+ },
7136
+ end: function () {
7137
+ controller.close();
7138
+ },
7139
+ destroy: function (error) {
7140
+ "function" === typeof controller.error
7141
+ ? controller.error(error)
7142
+ : controller.close();
7143
+ }
7144
+ };
7145
+ }
7146
+ function resumeRequestImpl(children, postponedState, options) {
7147
+ return resumeRequest(
7148
+ children,
7149
+ postponedState,
7150
+ createRenderState(
7151
+ postponedState.resumableState,
7152
+ options ? options.nonce : void 0,
7153
+ void 0,
7154
+ void 0,
7155
+ void 0,
7156
+ void 0
7157
+ ),
7158
+ options ? options.onError : void 0,
7159
+ options ? options.onAllReady : void 0,
7160
+ options ? options.onShellReady : void 0,
7161
+ options ? options.onShellError : void 0,
7162
+ void 0,
7163
+ options ? options.onPostpone : void 0
6878
7164
  );
7165
+ }
7166
+ ensureCorrectIsomorphicReactVersion();
7167
+ function createFakeWritableFromReadableStreamController(controller) {
7168
+ return {
7169
+ write: function (chunk) {
7170
+ "string" === typeof chunk && (chunk = textEncoder.encode(chunk));
7171
+ controller.enqueue(chunk);
7172
+ return !0;
7173
+ },
7174
+ end: function () {
7175
+ controller.close();
7176
+ },
7177
+ destroy: function (error) {
7178
+ "function" === typeof controller.error
7179
+ ? controller.error(error)
7180
+ : controller.close();
7181
+ }
7182
+ };
7183
+ }
7184
+ function createFakeWritableFromReadable(readable) {
7185
+ return {
7186
+ write: function (chunk) {
7187
+ return readable.push(chunk);
7188
+ },
7189
+ end: function () {
7190
+ readable.push(null);
7191
+ },
7192
+ destroy: function (error) {
7193
+ readable.destroy(error);
7194
+ }
7195
+ };
7196
+ }
7197
+ exports.prerender = function (children, options) {
7198
+ return new Promise(function (resolve, reject) {
7199
+ var onHeaders = options ? options.onHeaders : void 0,
7200
+ onHeadersImpl;
7201
+ onHeaders &&
7202
+ (onHeadersImpl = function (headersDescriptor) {
7203
+ onHeaders(new Headers(headersDescriptor));
7204
+ });
7205
+ var resources = createResumableState(
7206
+ options ? options.identifierPrefix : void 0,
7207
+ options ? options.unstable_externalRuntimeSrc : void 0,
7208
+ options ? options.bootstrapScriptContent : void 0,
7209
+ options ? options.bootstrapScripts : void 0,
7210
+ options ? options.bootstrapModules : void 0
7211
+ ),
7212
+ request = createPrerenderRequest(
7213
+ children,
7214
+ resources,
7215
+ createRenderState(
7216
+ resources,
7217
+ void 0,
7218
+ options ? options.unstable_externalRuntimeSrc : void 0,
7219
+ options ? options.importMap : void 0,
7220
+ onHeadersImpl,
7221
+ options ? options.maxHeadersLength : void 0
7222
+ ),
7223
+ createRootFormatContext(options ? options.namespaceURI : void 0),
7224
+ options ? options.progressiveChunkSize : void 0,
7225
+ options ? options.onError : void 0,
7226
+ function () {
7227
+ var writable,
7228
+ stream = new ReadableStream(
7229
+ {
7230
+ type: "bytes",
7231
+ start: function (controller) {
7232
+ writable =
7233
+ createFakeWritableFromReadableStreamController(controller);
7234
+ },
7235
+ pull: function () {
7236
+ startFlowing(request, writable);
7237
+ },
7238
+ cancel: function (reason) {
7239
+ request.destination = null;
7240
+ abort(request, reason);
7241
+ }
7242
+ },
7243
+ { highWaterMark: 0 }
7244
+ );
7245
+ stream = { postponed: getPostponedState(request), prelude: stream };
7246
+ resolve(stream);
7247
+ },
7248
+ void 0,
7249
+ void 0,
7250
+ reject,
7251
+ options ? options.onPostpone : void 0
7252
+ );
7253
+ if (options && options.signal) {
7254
+ var signal = options.signal;
7255
+ if (signal.aborted) abort(request, signal.reason);
7256
+ else {
7257
+ var listener = function () {
7258
+ abort(request, signal.reason);
7259
+ signal.removeEventListener("abort", listener);
7260
+ };
7261
+ signal.addEventListener("abort", listener);
7262
+ }
7263
+ }
7264
+ startWork(request);
7265
+ });
7266
+ };
7267
+ exports.prerenderToNodeStream = function (children, options) {
7268
+ return new Promise(function (resolve, reject) {
7269
+ var resumableState = createResumableState(
7270
+ options ? options.identifierPrefix : void 0,
7271
+ options ? options.unstable_externalRuntimeSrc : void 0,
7272
+ options ? options.bootstrapScriptContent : void 0,
7273
+ options ? options.bootstrapScripts : void 0,
7274
+ options ? options.bootstrapModules : void 0
7275
+ ),
7276
+ request = createPrerenderRequest(
7277
+ children,
7278
+ resumableState,
7279
+ createRenderState(
7280
+ resumableState,
7281
+ void 0,
7282
+ options ? options.unstable_externalRuntimeSrc : void 0,
7283
+ options ? options.importMap : void 0,
7284
+ options ? options.onHeaders : void 0,
7285
+ options ? options.maxHeadersLength : void 0
7286
+ ),
7287
+ createRootFormatContext(options ? options.namespaceURI : void 0),
7288
+ options ? options.progressiveChunkSize : void 0,
7289
+ options ? options.onError : void 0,
7290
+ function () {
7291
+ var readable = new stream.Readable({
7292
+ read: function () {
7293
+ startFlowing(request, writable);
7294
+ }
7295
+ }),
7296
+ writable = createFakeWritableFromReadable(readable);
7297
+ readable = {
7298
+ postponed: getPostponedState(request),
7299
+ prelude: readable
7300
+ };
7301
+ resolve(readable);
7302
+ },
7303
+ void 0,
7304
+ void 0,
7305
+ reject,
7306
+ options ? options.onPostpone : void 0
7307
+ );
7308
+ if (options && options.signal) {
7309
+ var signal = options.signal;
7310
+ if (signal.aborted) abort(request, signal.reason);
7311
+ else {
7312
+ var listener = function () {
7313
+ abort(request, signal.reason);
7314
+ signal.removeEventListener("abort", listener);
7315
+ };
7316
+ signal.addEventListener("abort", listener);
7317
+ }
7318
+ }
7319
+ startWork(request);
7320
+ });
7321
+ };
7322
+ exports.renderToPipeableStream = function (children, options) {
7323
+ var request = createRequestImpl(children, options),
7324
+ hasStartedFlowing = !1;
7325
+ startWork(request);
7326
+ return {
7327
+ pipe: function (destination) {
7328
+ if (hasStartedFlowing)
7329
+ throw Error(
7330
+ "React currently only supports piping to one writable stream."
7331
+ );
7332
+ hasStartedFlowing = !0;
7333
+ safelyEmitEarlyPreloads(
7334
+ request,
7335
+ null === request.trackedPostpones
7336
+ ? 0 === request.pendingRootTasks
7337
+ : null === request.completedRootSegment
7338
+ ? 0 === request.pendingRootTasks
7339
+ : 5 !== request.completedRootSegment.status
7340
+ );
7341
+ startFlowing(request, destination);
7342
+ destination.on("drain", createDrainHandler(destination, request));
7343
+ destination.on(
7344
+ "error",
7345
+ createCancelHandler(
7346
+ request,
7347
+ "The destination stream errored while writing data."
7348
+ )
7349
+ );
7350
+ destination.on(
7351
+ "close",
7352
+ createCancelHandler(request, "The destination stream closed early.")
7353
+ );
7354
+ return destination;
7355
+ },
7356
+ abort: function (reason) {
7357
+ abort(request, reason);
7358
+ }
7359
+ };
7360
+ };
6879
7361
  exports.renderToReadableStream = function (children, options) {
6880
7362
  return new Promise(function (resolve, reject) {
6881
7363
  var onFatalError,
@@ -6917,21 +7399,7 @@ exports.renderToReadableStream = function (children, options) {
6917
7399
  {
6918
7400
  type: "direct",
6919
7401
  pull: function (controller) {
6920
- if (13 === request.status)
6921
- (request.status = 14),
6922
- closeWithError(controller, request.fatalError);
6923
- else if (
6924
- 14 !== request.status &&
6925
- null === request.destination
6926
- ) {
6927
- request.destination = controller;
6928
- try {
6929
- flushCompletedQueues(request, controller);
6930
- } catch (error) {
6931
- logRecoverableError(request, error, {}),
6932
- fatalError(request, error);
6933
- }
6934
- }
7402
+ startFlowing(request, controller);
6935
7403
  },
6936
7404
  cancel: function (reason) {
6937
7405
  request.destination = null;
@@ -6965,4 +7433,203 @@ exports.renderToReadableStream = function (children, options) {
6965
7433
  startWork(request);
6966
7434
  });
6967
7435
  };
6968
- exports.version = "19.3.0-canary-408b38ef-20251023";
7436
+ exports.resume = function (children, postponedState, options) {
7437
+ return new Promise(function (resolve, reject) {
7438
+ var onFatalError,
7439
+ onAllReady,
7440
+ allReady = new Promise(function (res, rej) {
7441
+ onAllReady = res;
7442
+ onFatalError = rej;
7443
+ }),
7444
+ request = resumeRequest(
7445
+ children,
7446
+ postponedState,
7447
+ createRenderState(
7448
+ postponedState.resumableState,
7449
+ options ? options.nonce : void 0,
7450
+ void 0,
7451
+ void 0,
7452
+ void 0,
7453
+ void 0
7454
+ ),
7455
+ options ? options.onError : void 0,
7456
+ onAllReady,
7457
+ function () {
7458
+ var writable,
7459
+ stream = new ReadableStream(
7460
+ {
7461
+ type: "bytes",
7462
+ start: function (controller) {
7463
+ writable =
7464
+ createFakeWritableFromReadableStreamController$1(
7465
+ controller
7466
+ );
7467
+ },
7468
+ pull: function () {
7469
+ startFlowing(request, writable);
7470
+ },
7471
+ cancel: function (reason) {
7472
+ request.destination = null;
7473
+ abort(request, reason);
7474
+ }
7475
+ },
7476
+ { highWaterMark: 0 }
7477
+ );
7478
+ stream.allReady = allReady;
7479
+ resolve(stream);
7480
+ },
7481
+ function (error) {
7482
+ allReady.catch(function () {});
7483
+ reject(error);
7484
+ },
7485
+ onFatalError,
7486
+ options ? options.onPostpone : void 0
7487
+ );
7488
+ if (options && options.signal) {
7489
+ var signal = options.signal;
7490
+ if (signal.aborted) abort(request, signal.reason);
7491
+ else {
7492
+ var listener = function () {
7493
+ abort(request, signal.reason);
7494
+ signal.removeEventListener("abort", listener);
7495
+ };
7496
+ signal.addEventListener("abort", listener);
7497
+ }
7498
+ }
7499
+ startWork(request);
7500
+ });
7501
+ };
7502
+ exports.resumeAndPrerender = function (children, postponedState, options) {
7503
+ return new Promise(function (resolve, reject) {
7504
+ var request = resumeAndPrerenderRequest(
7505
+ children,
7506
+ postponedState,
7507
+ createRenderState(
7508
+ postponedState.resumableState,
7509
+ void 0,
7510
+ void 0,
7511
+ void 0,
7512
+ void 0,
7513
+ void 0
7514
+ ),
7515
+ options ? options.onError : void 0,
7516
+ function () {
7517
+ var writable,
7518
+ stream = new ReadableStream(
7519
+ {
7520
+ type: "bytes",
7521
+ start: function (controller) {
7522
+ writable =
7523
+ createFakeWritableFromReadableStreamController(controller);
7524
+ },
7525
+ pull: function () {
7526
+ startFlowing(request, writable);
7527
+ },
7528
+ cancel: function (reason) {
7529
+ request.destination = null;
7530
+ abort(request, reason);
7531
+ }
7532
+ },
7533
+ { highWaterMark: 0 }
7534
+ );
7535
+ stream = { postponed: getPostponedState(request), prelude: stream };
7536
+ resolve(stream);
7537
+ },
7538
+ void 0,
7539
+ void 0,
7540
+ reject,
7541
+ options ? options.onPostpone : void 0
7542
+ );
7543
+ if (options && options.signal) {
7544
+ var signal = options.signal;
7545
+ if (signal.aborted) abort(request, signal.reason);
7546
+ else {
7547
+ var listener = function () {
7548
+ abort(request, signal.reason);
7549
+ signal.removeEventListener("abort", listener);
7550
+ };
7551
+ signal.addEventListener("abort", listener);
7552
+ }
7553
+ }
7554
+ startWork(request);
7555
+ });
7556
+ };
7557
+ exports.resumeAndPrerenderToNodeStream = function (
7558
+ children,
7559
+ postponedState,
7560
+ options
7561
+ ) {
7562
+ return new Promise(function (resolve, reject) {
7563
+ var request = resumeAndPrerenderRequest(
7564
+ children,
7565
+ postponedState,
7566
+ createRenderState(
7567
+ postponedState.resumableState,
7568
+ void 0,
7569
+ void 0,
7570
+ void 0,
7571
+ void 0,
7572
+ void 0
7573
+ ),
7574
+ options ? options.onError : void 0,
7575
+ function () {
7576
+ var readable = new stream.Readable({
7577
+ read: function () {
7578
+ startFlowing(request, writable);
7579
+ }
7580
+ }),
7581
+ writable = createFakeWritableFromReadable(readable);
7582
+ readable = { postponed: getPostponedState(request), prelude: readable };
7583
+ resolve(readable);
7584
+ },
7585
+ void 0,
7586
+ void 0,
7587
+ reject,
7588
+ options ? options.onPostpone : void 0
7589
+ );
7590
+ if (options && options.signal) {
7591
+ var signal = options.signal;
7592
+ if (signal.aborted) abort(request, signal.reason);
7593
+ else {
7594
+ var listener = function () {
7595
+ abort(request, signal.reason);
7596
+ signal.removeEventListener("abort", listener);
7597
+ };
7598
+ signal.addEventListener("abort", listener);
7599
+ }
7600
+ }
7601
+ startWork(request);
7602
+ });
7603
+ };
7604
+ exports.resumeToPipeableStream = function (children, postponedState, options) {
7605
+ var request = resumeRequestImpl(children, postponedState, options),
7606
+ hasStartedFlowing = !1;
7607
+ startWork(request);
7608
+ return {
7609
+ pipe: function (destination) {
7610
+ if (hasStartedFlowing)
7611
+ throw Error(
7612
+ "React currently only supports piping to one writable stream."
7613
+ );
7614
+ hasStartedFlowing = !0;
7615
+ startFlowing(request, destination);
7616
+ destination.on("drain", createDrainHandler(destination, request));
7617
+ destination.on(
7618
+ "error",
7619
+ createCancelHandler(
7620
+ request,
7621
+ "The destination stream errored while writing data."
7622
+ )
7623
+ );
7624
+ destination.on(
7625
+ "close",
7626
+ createCancelHandler(request, "The destination stream closed early.")
7627
+ );
7628
+ return destination;
7629
+ },
7630
+ abort: function (reason) {
7631
+ abort(request, reason);
7632
+ }
7633
+ };
7634
+ };
7635
+ exports.version = "19.3.0-canary-b4455a6e-20251027";