react-markup 0.0.0-experimental-d46b04a2-20250117 → 0.0.0-experimental-18eaf51b-20250118

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.
@@ -793,27 +793,27 @@
793
793
  "React expected a positive non-zero `maxHeadersLength` option but found %s instead. When using the `onHeaders` option you may supply an optional `maxHeadersLength` option as well however, when setting this value to zero or less no headers will be captured.",
794
794
  0 === maxHeadersLength ? "zero" : maxHeadersLength
795
795
  );
796
- importMap = {
796
+ importMap = onHeaders
797
+ ? {
798
+ preconnects: "",
799
+ fontPreloads: "",
800
+ highImagePreloads: "",
801
+ remainingCapacity:
802
+ 2 +
803
+ ("number" === typeof maxHeadersLength ? maxHeadersLength : 2e3)
804
+ }
805
+ : null;
806
+ onHeaders = {
797
807
  placeholderPrefix: idPrefix + "P:",
798
808
  segmentPrefix: idPrefix + "S:",
799
809
  boundaryPrefix: idPrefix + "B:",
800
810
  startInlineScript: inlineScriptWithNonce,
801
- htmlChunks: null,
802
- headChunks: null,
811
+ preamble: createPreambleState(),
803
812
  externalRuntimeScript: externalRuntimeScript,
804
813
  bootstrapChunks: bootstrapChunks,
805
814
  importMapChunks: externalRuntimeConfig,
806
815
  onHeaders: onHeaders,
807
- headers: onHeaders
808
- ? {
809
- preconnects: "",
810
- fontPreloads: "",
811
- highImagePreloads: "",
812
- remainingCapacity:
813
- 2 +
814
- ("number" === typeof maxHeadersLength ? maxHeadersLength : 2e3)
815
- }
816
- : null,
816
+ headers: importMap,
817
817
  resets: {
818
818
  font: {},
819
819
  dns: {},
@@ -842,52 +842,54 @@
842
842
  stylesToHoist: !1
843
843
  };
844
844
  if (void 0 !== bootstrapScripts)
845
- for (onHeaders = 0; onHeaders < bootstrapScripts.length; onHeaders++)
846
- (maxHeadersLength = bootstrapScripts[onHeaders]),
847
- (externalRuntimeScript = idPrefix = void 0),
845
+ for (
846
+ inlineScriptWithNonce = 0;
847
+ inlineScriptWithNonce < bootstrapScripts.length;
848
+ inlineScriptWithNonce++
849
+ )
850
+ (idPrefix = bootstrapScripts[inlineScriptWithNonce]),
851
+ (maxHeadersLength = importMap = void 0),
848
852
  (externalRuntimeConfig = {
849
853
  rel: "preload",
850
854
  as: "script",
851
855
  fetchPriority: "low",
852
856
  nonce: nonce
853
857
  }),
854
- "string" === typeof maxHeadersLength
855
- ? (externalRuntimeConfig.href = inlineScriptWithNonce =
856
- maxHeadersLength)
857
- : ((externalRuntimeConfig.href = inlineScriptWithNonce =
858
- maxHeadersLength.src),
859
- (externalRuntimeConfig.integrity = externalRuntimeScript =
860
- "string" === typeof maxHeadersLength.integrity
861
- ? maxHeadersLength.integrity
858
+ "string" === typeof idPrefix
859
+ ? (externalRuntimeConfig.href = externalRuntimeScript = idPrefix)
860
+ : ((externalRuntimeConfig.href = externalRuntimeScript =
861
+ idPrefix.src),
862
+ (externalRuntimeConfig.integrity = maxHeadersLength =
863
+ "string" === typeof idPrefix.integrity
864
+ ? idPrefix.integrity
862
865
  : void 0),
863
- (externalRuntimeConfig.crossOrigin = idPrefix =
864
- "string" === typeof maxHeadersLength ||
865
- null == maxHeadersLength.crossOrigin
866
+ (externalRuntimeConfig.crossOrigin = importMap =
867
+ "string" === typeof idPrefix || null == idPrefix.crossOrigin
866
868
  ? void 0
867
- : "use-credentials" === maxHeadersLength.crossOrigin
869
+ : "use-credentials" === idPrefix.crossOrigin
868
870
  ? "use-credentials"
869
871
  : "")),
870
872
  preloadBootstrapScriptOrModule(
871
873
  resumableState,
872
- importMap,
873
- inlineScriptWithNonce,
874
+ onHeaders,
875
+ externalRuntimeScript,
874
876
  externalRuntimeConfig
875
877
  ),
876
878
  bootstrapChunks.push(
877
879
  '<script src="',
878
- escapeTextForBrowser(inlineScriptWithNonce)
880
+ escapeTextForBrowser(externalRuntimeScript)
879
881
  ),
880
882
  nonce &&
881
883
  bootstrapChunks.push('" nonce="', escapeTextForBrowser(nonce)),
882
- "string" === typeof externalRuntimeScript &&
884
+ "string" === typeof maxHeadersLength &&
883
885
  bootstrapChunks.push(
884
886
  '" integrity="',
885
- escapeTextForBrowser(externalRuntimeScript)
887
+ escapeTextForBrowser(maxHeadersLength)
886
888
  ),
887
- "string" === typeof idPrefix &&
889
+ "string" === typeof importMap &&
888
890
  bootstrapChunks.push(
889
891
  '" crossorigin="',
890
- escapeTextForBrowser(idPrefix)
892
+ escapeTextForBrowser(importMap)
891
893
  ),
892
894
  bootstrapChunks.push('" async="">\x3c/script>');
893
895
  if (void 0 !== bootstrapModules)
@@ -896,51 +898,51 @@
896
898
  bootstrapScripts < bootstrapModules.length;
897
899
  bootstrapScripts++
898
900
  )
899
- (onHeaders = bootstrapModules[bootstrapScripts]),
900
- (idPrefix = inlineScriptWithNonce = void 0),
901
- (externalRuntimeScript = {
901
+ (inlineScriptWithNonce = bootstrapModules[bootstrapScripts]),
902
+ (importMap = externalRuntimeScript = void 0),
903
+ (maxHeadersLength = {
902
904
  rel: "modulepreload",
903
905
  fetchPriority: "low",
904
906
  nonce: nonce
905
907
  }),
906
- "string" === typeof onHeaders
907
- ? (externalRuntimeScript.href = maxHeadersLength = onHeaders)
908
- : ((externalRuntimeScript.href = maxHeadersLength =
909
- onHeaders.src),
910
- (externalRuntimeScript.integrity = idPrefix =
911
- "string" === typeof onHeaders.integrity
912
- ? onHeaders.integrity
908
+ "string" === typeof inlineScriptWithNonce
909
+ ? (maxHeadersLength.href = idPrefix = inlineScriptWithNonce)
910
+ : ((maxHeadersLength.href = idPrefix = inlineScriptWithNonce.src),
911
+ (maxHeadersLength.integrity = importMap =
912
+ "string" === typeof inlineScriptWithNonce.integrity
913
+ ? inlineScriptWithNonce.integrity
913
914
  : void 0),
914
- (externalRuntimeScript.crossOrigin = inlineScriptWithNonce =
915
- "string" === typeof onHeaders || null == onHeaders.crossOrigin
915
+ (maxHeadersLength.crossOrigin = externalRuntimeScript =
916
+ "string" === typeof inlineScriptWithNonce ||
917
+ null == inlineScriptWithNonce.crossOrigin
916
918
  ? void 0
917
- : "use-credentials" === onHeaders.crossOrigin
919
+ : "use-credentials" === inlineScriptWithNonce.crossOrigin
918
920
  ? "use-credentials"
919
921
  : "")),
920
922
  preloadBootstrapScriptOrModule(
921
923
  resumableState,
922
- importMap,
923
- maxHeadersLength,
924
- externalRuntimeScript
924
+ onHeaders,
925
+ idPrefix,
926
+ maxHeadersLength
925
927
  ),
926
928
  bootstrapChunks.push(
927
929
  '<script type="module" src="',
928
- escapeTextForBrowser(maxHeadersLength)
930
+ escapeTextForBrowser(idPrefix)
929
931
  ),
930
932
  nonce &&
931
933
  bootstrapChunks.push('" nonce="', escapeTextForBrowser(nonce)),
932
- "string" === typeof idPrefix &&
934
+ "string" === typeof importMap &&
933
935
  bootstrapChunks.push(
934
936
  '" integrity="',
935
- escapeTextForBrowser(idPrefix)
937
+ escapeTextForBrowser(importMap)
936
938
  ),
937
- "string" === typeof inlineScriptWithNonce &&
939
+ "string" === typeof externalRuntimeScript &&
938
940
  bootstrapChunks.push(
939
941
  '" crossorigin="',
940
- escapeTextForBrowser(inlineScriptWithNonce)
942
+ escapeTextForBrowser(externalRuntimeScript)
941
943
  ),
942
944
  bootstrapChunks.push('" async="">\x3c/script>');
943
- return importMap;
945
+ return onHeaders;
944
946
  }
945
947
  function createResumableState(
946
948
  identifierPrefix,
@@ -971,6 +973,9 @@
971
973
  moduleScriptResources: {}
972
974
  };
973
975
  }
976
+ function createPreambleState() {
977
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
978
+ }
974
979
  function createFormatContext(insertionMode, selectedValue, tagScope) {
975
980
  return {
976
981
  insertionMode: insertionMode,
@@ -989,33 +994,34 @@
989
994
  parentContext.tagScope
990
995
  );
991
996
  case "svg":
992
- return createFormatContext(3, null, parentContext.tagScope);
997
+ return createFormatContext(4, null, parentContext.tagScope);
993
998
  case "picture":
994
999
  return createFormatContext(2, null, parentContext.tagScope | 2);
995
1000
  case "math":
996
- return createFormatContext(4, null, parentContext.tagScope);
1001
+ return createFormatContext(5, null, parentContext.tagScope);
997
1002
  case "foreignObject":
998
1003
  return createFormatContext(2, null, parentContext.tagScope);
999
1004
  case "table":
1000
- return createFormatContext(5, null, parentContext.tagScope);
1005
+ return createFormatContext(6, null, parentContext.tagScope);
1001
1006
  case "thead":
1002
1007
  case "tbody":
1003
1008
  case "tfoot":
1004
- return createFormatContext(6, null, parentContext.tagScope);
1009
+ return createFormatContext(7, null, parentContext.tagScope);
1005
1010
  case "colgroup":
1006
- return createFormatContext(8, null, parentContext.tagScope);
1011
+ return createFormatContext(9, null, parentContext.tagScope);
1007
1012
  case "tr":
1008
- return createFormatContext(7, null, parentContext.tagScope);
1013
+ return createFormatContext(8, null, parentContext.tagScope);
1014
+ case "head":
1015
+ if (2 > parentContext.insertionMode)
1016
+ return createFormatContext(3, null, parentContext.tagScope);
1017
+ break;
1018
+ case "html":
1019
+ if (0 === parentContext.insertionMode)
1020
+ return createFormatContext(1, null, parentContext.tagScope);
1009
1021
  }
1010
- return 5 <= parentContext.insertionMode
1022
+ return 6 <= parentContext.insertionMode || 2 > parentContext.insertionMode
1011
1023
  ? createFormatContext(2, null, parentContext.tagScope)
1012
- : 0 === parentContext.insertionMode
1013
- ? "html" === type
1014
- ? createFormatContext(1, null, parentContext.tagScope)
1015
- : createFormatContext(2, null, parentContext.tagScope)
1016
- : 1 === parentContext.insertionMode
1017
- ? createFormatContext(2, null, parentContext.tagScope)
1018
- : parentContext;
1024
+ : parentContext;
1019
1025
  }
1020
1026
  function pushStyleAttribute(target, style) {
1021
1027
  if ("object" !== typeof style)
@@ -1684,6 +1690,7 @@
1684
1690
  props,
1685
1691
  resumableState,
1686
1692
  renderState,
1693
+ preambleState,
1687
1694
  hoistableState,
1688
1695
  formatContext,
1689
1696
  textEmbedded,
@@ -1729,8 +1736,8 @@
1729
1736
  console.error(
1730
1737
  "A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional."
1731
1738
  );
1732
- 3 !== formatContext.insertionMode &&
1733
- 4 !== formatContext.insertionMode &&
1739
+ 4 !== formatContext.insertionMode &&
1740
+ 5 !== formatContext.insertionMode &&
1734
1741
  -1 === type.indexOf("-") &&
1735
1742
  type.toLowerCase() !== type &&
1736
1743
  console.error(
@@ -2338,7 +2345,7 @@
2338
2345
  ));
2339
2346
  }
2340
2347
  if (
2341
- 3 === insertionMode ||
2348
+ 4 === insertionMode ||
2342
2349
  noscriptTagInScope ||
2343
2350
  null != props.itemProp
2344
2351
  )
@@ -2357,7 +2364,7 @@
2357
2364
  href = props.href,
2358
2365
  precedence = props.precedence;
2359
2366
  if (
2360
- 3 === formatContext.insertionMode ||
2367
+ 4 === formatContext.insertionMode ||
2361
2368
  formatContext.tagScope & 1 ||
2362
2369
  null != props.itemProp ||
2363
2370
  "string" !== typeof rel ||
@@ -2473,7 +2480,7 @@
2473
2480
  "symbol" === typeof asyncProp ||
2474
2481
  props.onLoad ||
2475
2482
  props.onError ||
2476
- 3 === formatContext.insertionMode ||
2483
+ 4 === formatContext.insertionMode ||
2477
2484
  formatContext.tagScope & 1 ||
2478
2485
  null != props.itemProp
2479
2486
  )
@@ -2536,7 +2543,7 @@
2536
2543
  var precedence$jscomp$0 = props.precedence,
2537
2544
  href$jscomp$0 = props.href;
2538
2545
  if (
2539
- 3 === insertionMode$jscomp$0 ||
2546
+ 4 === insertionMode$jscomp$0 ||
2540
2547
  noscriptTagInScope$jscomp$0 ||
2541
2548
  null != props.itemProp ||
2542
2549
  "string" !== typeof precedence$jscomp$0 ||
@@ -2654,7 +2661,7 @@
2654
2661
  return JSCompiler_inline_result$jscomp$7;
2655
2662
  case "meta":
2656
2663
  if (
2657
- 3 === formatContext.insertionMode ||
2664
+ 4 === formatContext.insertionMode ||
2658
2665
  formatContext.tagScope & 1 ||
2659
2666
  null != props.itemProp
2660
2667
  )
@@ -2838,13 +2845,13 @@
2838
2845
  case "missing-glyph":
2839
2846
  break;
2840
2847
  case "head":
2841
- if (
2842
- 2 > formatContext.insertionMode &&
2843
- null === renderState.headChunks
2844
- ) {
2845
- renderState.headChunks = [];
2848
+ if (2 > formatContext.insertionMode) {
2849
+ var preamble = preambleState || renderState.preamble;
2850
+ if (preamble.headChunks)
2851
+ throw Error("The `<head>` tag may only be rendered once.");
2852
+ preamble.headChunks = [];
2846
2853
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
2847
- renderState.headChunks,
2854
+ preamble.headChunks,
2848
2855
  props,
2849
2856
  "head"
2850
2857
  );
@@ -2855,24 +2862,42 @@
2855
2862
  "head"
2856
2863
  );
2857
2864
  return JSCompiler_inline_result$jscomp$9;
2858
- case "html":
2859
- if (
2860
- 0 === formatContext.insertionMode &&
2861
- null === renderState.htmlChunks
2862
- ) {
2863
- renderState.htmlChunks = [doctypeChunk];
2865
+ case "body":
2866
+ if (2 > formatContext.insertionMode) {
2867
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
2868
+ if (preamble$jscomp$0.bodyChunks)
2869
+ throw Error("The `<body>` tag may only be rendered once.");
2870
+ preamble$jscomp$0.bodyChunks = [];
2864
2871
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2865
- renderState.htmlChunks,
2872
+ preamble$jscomp$0.bodyChunks,
2866
2873
  props,
2867
- "html"
2874
+ "body"
2868
2875
  );
2869
2876
  } else
2870
2877
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2871
2878
  target$jscomp$0,
2872
2879
  props,
2873
- "html"
2880
+ "body"
2874
2881
  );
2875
2882
  return JSCompiler_inline_result$jscomp$10;
2883
+ case "html":
2884
+ if (0 === formatContext.insertionMode) {
2885
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
2886
+ if (preamble$jscomp$1.htmlChunks)
2887
+ throw Error("The `<html>` tag may only be rendered once.");
2888
+ preamble$jscomp$1.htmlChunks = [doctypeChunk];
2889
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
2890
+ preamble$jscomp$1.htmlChunks,
2891
+ props,
2892
+ "html"
2893
+ );
2894
+ } else
2895
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
2896
+ target$jscomp$0,
2897
+ props,
2898
+ "html"
2899
+ );
2900
+ return JSCompiler_inline_result$jscomp$11;
2876
2901
  default:
2877
2902
  if (-1 !== type.indexOf("-")) {
2878
2903
  target$jscomp$0.push(startChunkForTag(type));
@@ -2939,6 +2964,15 @@
2939
2964
  ((chunk = "</" + tag + ">"), endTagCache.set(tag, chunk));
2940
2965
  return chunk;
2941
2966
  }
2967
+ function hoistPreambleState(renderState, preambleState) {
2968
+ renderState = renderState.preamble;
2969
+ null === renderState.htmlChunks &&
2970
+ (renderState.htmlChunks = preambleState.htmlChunks);
2971
+ null === renderState.headChunks &&
2972
+ (renderState.headChunks = preambleState.headChunks);
2973
+ null === renderState.bodyChunks &&
2974
+ (renderState.bodyChunks = preambleState.bodyChunks);
2975
+ }
2942
2976
  function writeBootstrap(destination, renderState) {
2943
2977
  renderState = renderState.bootstrapChunks;
2944
2978
  for (var i = 0; i < renderState.length - 1; i++)
@@ -2962,6 +2996,7 @@
2962
2996
  switch (formatContext.insertionMode) {
2963
2997
  case 0:
2964
2998
  case 1:
2999
+ case 3:
2965
3000
  case 2:
2966
3001
  return (
2967
3002
  destination.push('<div hidden id="'),
@@ -2970,7 +3005,7 @@
2970
3005
  destination.push(renderState),
2971
3006
  destination.push('">')
2972
3007
  );
2973
- case 3:
3008
+ case 4:
2974
3009
  return (
2975
3010
  destination.push(
2976
3011
  '<svg aria-hidden="true" style="display:none" id="'
@@ -2980,7 +3015,7 @@
2980
3015
  destination.push(renderState),
2981
3016
  destination.push('">')
2982
3017
  );
2983
- case 4:
3018
+ case 5:
2984
3019
  return (
2985
3020
  destination.push(
2986
3021
  '<math aria-hidden="true" style="display:none" id="'
@@ -2990,7 +3025,7 @@
2990
3025
  destination.push(renderState),
2991
3026
  destination.push('">')
2992
3027
  );
2993
- case 5:
3028
+ case 6:
2994
3029
  return (
2995
3030
  destination.push('<table hidden id="'),
2996
3031
  destination.push(renderState.segmentPrefix),
@@ -2998,7 +3033,7 @@
2998
3033
  destination.push(renderState),
2999
3034
  destination.push('">')
3000
3035
  );
3001
- case 6:
3036
+ case 7:
3002
3037
  return (
3003
3038
  destination.push('<table hidden><tbody id="'),
3004
3039
  destination.push(renderState.segmentPrefix),
@@ -3006,7 +3041,7 @@
3006
3041
  destination.push(renderState),
3007
3042
  destination.push('">')
3008
3043
  );
3009
- case 7:
3044
+ case 8:
3010
3045
  return (
3011
3046
  destination.push('<table hidden><tr id="'),
3012
3047
  destination.push(renderState.segmentPrefix),
@@ -3014,7 +3049,7 @@
3014
3049
  destination.push(renderState),
3015
3050
  destination.push('">')
3016
3051
  );
3017
- case 8:
3052
+ case 9:
3018
3053
  return (
3019
3054
  destination.push('<table hidden><colgroup id="'),
3020
3055
  destination.push(renderState.segmentPrefix),
@@ -3030,19 +3065,20 @@
3030
3065
  switch (formatContext.insertionMode) {
3031
3066
  case 0:
3032
3067
  case 1:
3068
+ case 3:
3033
3069
  case 2:
3034
3070
  return destination.push("</div>");
3035
- case 3:
3036
- return destination.push("</svg>");
3037
3071
  case 4:
3038
- return destination.push("</math>");
3072
+ return destination.push("</svg>");
3039
3073
  case 5:
3040
- return destination.push("</table>");
3074
+ return destination.push("</math>");
3041
3075
  case 6:
3042
- return destination.push("</tbody></table>");
3076
+ return destination.push("</table>");
3043
3077
  case 7:
3044
- return destination.push("</tr></table>");
3078
+ return destination.push("</tbody></table>");
3045
3079
  case 8:
3080
+ return destination.push("</tr></table>");
3081
+ case 9:
3046
3082
  return destination.push("</colgroup></table>");
3047
3083
  default:
3048
3084
  throw Error("Unknown insertion mode. This is a bug in React.");
@@ -4267,7 +4303,7 @@
4267
4303
  this.status = 10;
4268
4304
  this.fatalError = null;
4269
4305
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
4270
- this.completedRootSegment = null;
4306
+ this.completedPreambleSegments = this.completedRootSegment = null;
4271
4307
  this.abortableTasks = abortSet;
4272
4308
  this.pingedTasks = [];
4273
4309
  this.clientRenderedBoundaries = [];
@@ -4327,6 +4363,7 @@
4327
4363
  null,
4328
4364
  renderState,
4329
4365
  null,
4366
+ null,
4330
4367
  resumableState.abortableTasks,
4331
4368
  null,
4332
4369
  rootFormatContext,
@@ -4347,7 +4384,12 @@
4347
4384
  ((request.flushScheduled = null !== request.destination),
4348
4385
  performWork(request));
4349
4386
  }
4350
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
4387
+ function createSuspenseBoundary(
4388
+ request,
4389
+ fallbackAbortableTasks,
4390
+ contentPreamble,
4391
+ fallbackPreamble
4392
+ ) {
4351
4393
  return {
4352
4394
  status: 0,
4353
4395
  rootSegmentID: -1,
@@ -4359,6 +4401,8 @@
4359
4401
  errorDigest: null,
4360
4402
  contentState: createHoistableState(),
4361
4403
  fallbackState: createHoistableState(),
4404
+ contentPreamble: contentPreamble,
4405
+ fallbackPreamble: fallbackPreamble,
4362
4406
  trackedContentKeyPath: null,
4363
4407
  trackedFallbackNode: null,
4364
4408
  errorMessage: null,
@@ -4373,6 +4417,7 @@
4373
4417
  childIndex,
4374
4418
  blockedBoundary,
4375
4419
  blockedSegment,
4420
+ blockedPreamble,
4376
4421
  hoistableState,
4377
4422
  abortSet,
4378
4423
  keyPath,
@@ -4397,6 +4442,7 @@
4397
4442
  },
4398
4443
  blockedBoundary: blockedBoundary,
4399
4444
  blockedSegment: blockedSegment,
4445
+ blockedPreamble: blockedPreamble,
4400
4446
  hoistableState: hoistableState,
4401
4447
  abortSet: abortSet,
4402
4448
  keyPath: keyPath,
@@ -4443,6 +4489,7 @@
4443
4489
  },
4444
4490
  blockedBoundary: blockedBoundary,
4445
4491
  blockedSegment: null,
4492
+ blockedPreamble: null,
4446
4493
  hoistableState: hoistableState,
4447
4494
  abortSet: abortSet,
4448
4495
  keyPath: keyPath,
@@ -4467,11 +4514,12 @@
4467
4514
  ) {
4468
4515
  return {
4469
4516
  status: 0,
4517
+ parentFlushed: !1,
4470
4518
  id: -1,
4471
4519
  index: index,
4472
- parentFlushed: !1,
4473
4520
  chunks: [],
4474
4521
  children: [],
4522
+ preambleChildren: [],
4475
4523
  parentFormatContext: parentFormatContext,
4476
4524
  boundary: boundary,
4477
4525
  lastPushedText: lastPushedText,
@@ -5171,6 +5219,7 @@
5171
5219
  var target = segment.chunks,
5172
5220
  resumableState = request.resumableState,
5173
5221
  renderState = request.renderState,
5222
+ preambleState = task.blockedPreamble,
5174
5223
  hoistableState = task.hoistableState,
5175
5224
  formatContext = task.formatContext,
5176
5225
  textEmbedded = segment.lastPushedText,
@@ -5196,6 +5245,7 @@
5196
5245
  props,
5197
5246
  resumableState,
5198
5247
  renderState,
5248
+ preambleState,
5199
5249
  hoistableState,
5200
5250
  formatContext,
5201
5251
  textEmbedded,
@@ -5204,9 +5254,46 @@
5204
5254
  segment.lastPushedText = !1;
5205
5255
  var _prevContext = task.formatContext,
5206
5256
  _prevKeyPath2 = task.keyPath;
5207
- task.formatContext = getChildFormatContext(_prevContext, type, props);
5208
5257
  task.keyPath = keyPath;
5209
- renderNode(request, task, _children, -1);
5258
+ if (
5259
+ 3 ===
5260
+ (task.formatContext = getChildFormatContext(
5261
+ _prevContext,
5262
+ type,
5263
+ props
5264
+ )).insertionMode
5265
+ ) {
5266
+ var preambleSegment = createPendingSegment(
5267
+ request,
5268
+ 0,
5269
+ null,
5270
+ task.formatContext,
5271
+ !1,
5272
+ !1
5273
+ );
5274
+ segment.preambleChildren.push(preambleSegment);
5275
+ var preambleTask = createRenderTask(
5276
+ request,
5277
+ null,
5278
+ _children,
5279
+ -1,
5280
+ task.blockedBoundary,
5281
+ preambleSegment,
5282
+ task.blockedPreamble,
5283
+ task.hoistableState,
5284
+ request.abortableTasks,
5285
+ task.keyPath,
5286
+ task.formatContext,
5287
+ task.context,
5288
+ task.treeContext,
5289
+ task.componentStack,
5290
+ task.isFallback,
5291
+ emptyContextObject,
5292
+ task.debugTask
5293
+ );
5294
+ pushComponentStack(preambleTask);
5295
+ request.pingedTasks.push(preambleTask);
5296
+ } else renderNode(request, task, _children, -1);
5210
5297
  task.formatContext = _prevContext;
5211
5298
  task.keyPath = _prevKeyPath2;
5212
5299
  a: {
@@ -5243,6 +5330,9 @@
5243
5330
  resumableState$jscomp$0.hasHtml = !0;
5244
5331
  break a;
5245
5332
  }
5333
+ break;
5334
+ case "head":
5335
+ if (1 >= _prevContext.insertionMode) break a;
5246
5336
  }
5247
5337
  target$jscomp$0.push(endChunkForTag(type));
5248
5338
  }
@@ -5296,12 +5386,26 @@
5296
5386
  } else {
5297
5387
  var prevKeyPath$jscomp$3 = task.keyPath,
5298
5388
  parentBoundary = task.blockedBoundary,
5389
+ parentPreamble = task.blockedPreamble,
5299
5390
  parentHoistableState = task.hoistableState,
5300
5391
  parentSegment = task.blockedSegment,
5301
5392
  fallback = props.fallback,
5302
5393
  content = props.children,
5303
- fallbackAbortSet = new Set(),
5304
- newBoundary = createSuspenseBoundary(request, fallbackAbortSet);
5394
+ fallbackAbortSet = new Set();
5395
+ var newBoundary =
5396
+ 2 > task.formatContext.insertionMode
5397
+ ? createSuspenseBoundary(
5398
+ request,
5399
+ fallbackAbortSet,
5400
+ createPreambleState(),
5401
+ createPreambleState()
5402
+ )
5403
+ : createSuspenseBoundary(
5404
+ request,
5405
+ fallbackAbortSet,
5406
+ null,
5407
+ null
5408
+ );
5305
5409
  null !== request.trackedPostpones &&
5306
5410
  (newBoundary.trackedContentKeyPath = keyPath);
5307
5411
  var boundarySegment = createPendingSegment(
@@ -5341,6 +5445,7 @@
5341
5445
  );
5342
5446
  newBoundary.trackedFallbackNode = fallbackReplayNode;
5343
5447
  task.blockedSegment = boundarySegment;
5448
+ task.blockedPreamble = newBoundary.fallbackPreamble;
5344
5449
  task.keyPath = fallbackKeyPath;
5345
5450
  boundarySegment.status = 6;
5346
5451
  try {
@@ -5353,6 +5458,7 @@
5353
5458
  );
5354
5459
  } finally {
5355
5460
  (task.blockedSegment = parentSegment),
5461
+ (task.blockedPreamble = parentPreamble),
5356
5462
  (task.keyPath = prevKeyPath$jscomp$3);
5357
5463
  }
5358
5464
  var suspendedPrimaryTask = createRenderTask(
@@ -5362,6 +5468,7 @@
5362
5468
  -1,
5363
5469
  newBoundary,
5364
5470
  contentRootSegment,
5471
+ newBoundary.contentPreamble,
5365
5472
  newBoundary.contentState,
5366
5473
  task.abortSet,
5367
5474
  keyPath,
@@ -5377,6 +5484,7 @@
5377
5484
  request.pingedTasks.push(suspendedPrimaryTask);
5378
5485
  } else {
5379
5486
  task.blockedBoundary = newBoundary;
5487
+ task.blockedPreamble = newBoundary.contentPreamble;
5380
5488
  task.hoistableState = newBoundary.contentState;
5381
5489
  task.blockedSegment = contentRootSegment;
5382
5490
  task.keyPath = keyPath;
@@ -5389,6 +5497,9 @@
5389
5497
  0 === newBoundary.pendingTasks && 0 === newBoundary.status)
5390
5498
  ) {
5391
5499
  newBoundary.status = 1;
5500
+ 0 === request.pendingRootTasks &&
5501
+ task.blockedPreamble &&
5502
+ preparePreamble(request);
5392
5503
  break a;
5393
5504
  }
5394
5505
  } catch (thrownValue$2) {
@@ -5428,6 +5539,7 @@
5428
5539
  untrackBoundary(request, newBoundary);
5429
5540
  } finally {
5430
5541
  (task.blockedBoundary = parentBoundary),
5542
+ (task.blockedPreamble = parentPreamble),
5431
5543
  (task.hoistableState = parentHoistableState),
5432
5544
  (task.blockedSegment = parentSegment),
5433
5545
  (task.keyPath = prevKeyPath$jscomp$3);
@@ -5439,6 +5551,7 @@
5439
5551
  -1,
5440
5552
  parentBoundary,
5441
5553
  boundarySegment,
5554
+ newBoundary.fallbackPreamble,
5442
5555
  newBoundary.fallbackState,
5443
5556
  fallbackAbortSet,
5444
5557
  [keyPath[0], "Suspense Fallback", keyPath[2]],
@@ -5677,17 +5790,27 @@
5677
5790
  previousReplaySet = task.replay,
5678
5791
  parentBoundary = task.blockedBoundary,
5679
5792
  parentHoistableState = task.hoistableState,
5680
- content = props.children;
5681
- props = props.fallback;
5682
- var fallbackAbortSet = new Set(),
5683
- resumedBoundary = createSuspenseBoundary(
5684
- request,
5685
- fallbackAbortSet
5686
- );
5687
- resumedBoundary.parentFlushed = !0;
5688
- resumedBoundary.rootSegmentID = type;
5689
- task.blockedBoundary = resumedBoundary;
5690
- task.hoistableState = resumedBoundary.contentState;
5793
+ content = props.children,
5794
+ fallback = props.fallback,
5795
+ fallbackAbortSet = new Set();
5796
+ props =
5797
+ 2 > task.formatContext.insertionMode
5798
+ ? createSuspenseBoundary(
5799
+ request,
5800
+ fallbackAbortSet,
5801
+ createPreambleState(),
5802
+ createPreambleState()
5803
+ )
5804
+ : createSuspenseBoundary(
5805
+ request,
5806
+ fallbackAbortSet,
5807
+ null,
5808
+ null
5809
+ );
5810
+ props.parentFlushed = !0;
5811
+ props.rootSegmentID = type;
5812
+ task.blockedBoundary = props;
5813
+ task.hoistableState = props.contentState;
5691
5814
  task.keyPath = keyPath;
5692
5815
  task.replay = { nodes: ref, slots: name, pendingTasks: 1 };
5693
5816
  try {
@@ -5700,16 +5823,13 @@
5700
5823
  "Couldn't find all resumable slots by key/index during replaying. The tree doesn't match so React will fallback to client rendering."
5701
5824
  );
5702
5825
  task.replay.pendingTasks--;
5703
- if (
5704
- 0 === resumedBoundary.pendingTasks &&
5705
- 0 === resumedBoundary.status
5706
- ) {
5707
- resumedBoundary.status = 1;
5708
- request.completedBoundaries.push(resumedBoundary);
5826
+ if (0 === props.pendingTasks && 0 === props.status) {
5827
+ props.status = 1;
5828
+ request.completedBoundaries.push(props);
5709
5829
  break a;
5710
5830
  }
5711
5831
  } catch (error) {
5712
- (resumedBoundary.status = 4),
5832
+ (props.status = 4),
5713
5833
  (childNodes = getThrownInfo(task.componentStack)),
5714
5834
  "object" === typeof error &&
5715
5835
  null !== error &&
@@ -5727,15 +5847,9 @@
5727
5847
  childNodes,
5728
5848
  task.debugTask
5729
5849
  )),
5730
- encodeErrorForBoundary(
5731
- resumedBoundary,
5732
- replay,
5733
- error,
5734
- childNodes,
5735
- !1
5736
- ),
5850
+ encodeErrorForBoundary(props, replay, error, childNodes, !1),
5737
5851
  task.replay.pendingTasks--,
5738
- request.clientRenderedBoundaries.push(resumedBoundary);
5852
+ request.clientRenderedBoundaries.push(props);
5739
5853
  } finally {
5740
5854
  (task.blockedBoundary = parentBoundary),
5741
5855
  (task.hoistableState = parentHoistableState),
@@ -5746,10 +5860,10 @@
5746
5860
  request,
5747
5861
  null,
5748
5862
  { nodes: keyOrIndex, slots: node, pendingTasks: 0 },
5749
- props,
5863
+ fallback,
5750
5864
  -1,
5751
5865
  parentBoundary,
5752
- resumedBoundary.fallbackState,
5866
+ props.fallbackState,
5753
5867
  fallbackAbortSet,
5754
5868
  [keyPath[0], "Suspense Fallback", keyPath[2]],
5755
5869
  task.formatContext,
@@ -6286,6 +6400,7 @@
6286
6400
  task.childIndex,
6287
6401
  task.blockedBoundary,
6288
6402
  newSegment,
6403
+ task.blockedPreamble,
6289
6404
  task.hoistableState,
6290
6405
  task.abortSet,
6291
6406
  task.keyPath,
@@ -6503,7 +6618,12 @@
6503
6618
  errorDigest = errorDigest$jscomp$0,
6504
6619
  errorInfo = errorInfo$jscomp$0,
6505
6620
  wasAborted = aborted,
6506
- resumedBoundary = createSuspenseBoundary(request, new Set());
6621
+ resumedBoundary = createSuspenseBoundary(
6622
+ request,
6623
+ new Set(),
6624
+ null,
6625
+ null
6626
+ );
6507
6627
  resumedBoundary.parentFlushed = !0;
6508
6628
  resumedBoundary.rootSegmentID = node;
6509
6629
  resumedBoundary.status = 4;
@@ -6713,6 +6833,7 @@
6713
6833
  }
6714
6834
  function completeShell(request) {
6715
6835
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
6836
+ null === request.trackedPostpones && preparePreamble(request);
6716
6837
  request.onShellError = noop;
6717
6838
  request = request.onShellReady;
6718
6839
  request();
@@ -6725,6 +6846,7 @@
6725
6846
  : null === request.completedRootSegment ||
6726
6847
  5 !== request.completedRootSegment.status
6727
6848
  );
6849
+ preparePreamble(request);
6728
6850
  request = request.onAllReady;
6729
6851
  request();
6730
6852
  }
@@ -6769,7 +6891,11 @@
6769
6891
  abortTaskSoft,
6770
6892
  request
6771
6893
  ),
6772
- boundary.fallbackAbortableTasks.clear()))
6894
+ boundary.fallbackAbortableTasks.clear(),
6895
+ 0 === request.pendingRootTasks &&
6896
+ null === request.trackedPostpones &&
6897
+ null !== boundary.contentPreamble &&
6898
+ preparePreamble(request)))
6773
6899
  : null !== segment &&
6774
6900
  segment.parentFlushed &&
6775
6901
  1 === segment.status &&
@@ -7016,7 +7142,11 @@
7016
7142
  ),
7017
7143
  untrackBoundary(request, boundary),
7018
7144
  boundary.parentFlushed &&
7019
- request.clientRenderedBoundaries.push(boundary)));
7145
+ request.clientRenderedBoundaries.push(boundary),
7146
+ 0 === request.pendingRootTasks &&
7147
+ null === request.trackedPostpones &&
7148
+ null !== boundary.contentPreamble &&
7149
+ preparePreamble(request)));
7020
7150
  request.allPendingTasks--;
7021
7151
  0 === request.allPendingTasks && completeAll(request);
7022
7152
  }
@@ -7045,6 +7175,85 @@
7045
7175
  }
7046
7176
  }
7047
7177
  }
7178
+ function preparePreambleFromSubtree(
7179
+ request,
7180
+ segment,
7181
+ collectedPreambleSegments
7182
+ ) {
7183
+ segment.preambleChildren.length &&
7184
+ collectedPreambleSegments.push(segment.preambleChildren);
7185
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
7186
+ pendingPreambles =
7187
+ preparePreambleFromSegment(
7188
+ request,
7189
+ segment.children[i],
7190
+ collectedPreambleSegments
7191
+ ) || pendingPreambles;
7192
+ return pendingPreambles;
7193
+ }
7194
+ function preparePreambleFromSegment(
7195
+ request,
7196
+ segment,
7197
+ collectedPreambleSegments
7198
+ ) {
7199
+ var boundary = segment.boundary;
7200
+ if (null === boundary)
7201
+ return preparePreambleFromSubtree(
7202
+ request,
7203
+ segment,
7204
+ collectedPreambleSegments
7205
+ );
7206
+ var preamble = boundary.contentPreamble,
7207
+ fallbackPreamble = boundary.fallbackPreamble;
7208
+ if (null === preamble || null === fallbackPreamble) return !1;
7209
+ switch (boundary.status) {
7210
+ case 1:
7211
+ hoistPreambleState(request.renderState, preamble);
7212
+ segment = boundary.completedSegments[0];
7213
+ if (!segment)
7214
+ throw Error(
7215
+ "A previously unvisited boundary must have exactly one root segment. This is a bug in React."
7216
+ );
7217
+ return preparePreambleFromSubtree(
7218
+ request,
7219
+ segment,
7220
+ collectedPreambleSegments
7221
+ );
7222
+ case 5:
7223
+ if (null !== request.trackedPostpones) return !0;
7224
+ case 4:
7225
+ if (1 === segment.status)
7226
+ return (
7227
+ hoistPreambleState(request.renderState, fallbackPreamble),
7228
+ preparePreambleFromSubtree(
7229
+ request,
7230
+ segment,
7231
+ collectedPreambleSegments
7232
+ )
7233
+ );
7234
+ default:
7235
+ return !0;
7236
+ }
7237
+ }
7238
+ function preparePreamble(request) {
7239
+ if (
7240
+ request.completedRootSegment &&
7241
+ null === request.completedPreambleSegments
7242
+ ) {
7243
+ var collectedPreambleSegments = [],
7244
+ hasPendingPreambles = preparePreambleFromSegment(
7245
+ request,
7246
+ request.completedRootSegment,
7247
+ collectedPreambleSegments
7248
+ ),
7249
+ preamble = request.renderState.preamble;
7250
+ if (
7251
+ !1 === hasPendingPreambles ||
7252
+ (preamble.headChunks && preamble.bodyChunks)
7253
+ )
7254
+ request.completedPreambleSegments = collectedPreambleSegments;
7255
+ }
7256
+ }
7048
7257
  function flushSubtree(request, destination, segment, hoistableState) {
7049
7258
  segment.parentFlushed = !0;
7050
7259
  switch (segment.status) {
@@ -7274,6 +7483,8 @@
7274
7483
  completedRootSegment = request.completedRootSegment;
7275
7484
  if (null !== completedRootSegment) {
7276
7485
  if (5 === completedRootSegment.status) return;
7486
+ var completedPreambleSegments = request.completedPreambleSegments;
7487
+ if (null === completedPreambleSegments) return;
7277
7488
  var renderState = request.renderState;
7278
7489
  if (
7279
7490
  (0 !== request.allPendingTasks ||
@@ -7288,8 +7499,9 @@
7288
7499
  ((resumableState.scriptResources[src] = null),
7289
7500
  renderState.scripts.add(chunks));
7290
7501
  }
7291
- var htmlChunks = renderState.htmlChunks,
7292
- headChunks = renderState.headChunks,
7502
+ var preamble = renderState.preamble,
7503
+ htmlChunks = preamble.htmlChunks,
7504
+ headChunks = preamble.headChunks,
7293
7505
  i$jscomp$0;
7294
7506
  if (htmlChunks) {
7295
7507
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -7352,11 +7564,38 @@
7352
7564
  i$jscomp$0++
7353
7565
  )
7354
7566
  destination.push(hoistableChunks[i$jscomp$0]);
7355
- hoistableChunks.length = 0;
7356
- if (htmlChunks && null === headChunks) {
7567
+ for (
7568
+ renderState = hoistableChunks.length = 0;
7569
+ renderState < completedPreambleSegments.length;
7570
+ renderState++
7571
+ ) {
7572
+ var segments = completedPreambleSegments[renderState];
7573
+ for (
7574
+ _renderState$external = 0;
7575
+ _renderState$external < segments.length;
7576
+ _renderState$external++
7577
+ )
7578
+ flushSegment(
7579
+ request,
7580
+ destination,
7581
+ segments[_renderState$external],
7582
+ null
7583
+ );
7584
+ }
7585
+ var preamble$jscomp$0 = request.renderState.preamble,
7586
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
7587
+ if (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) {
7357
7588
  var chunk$jscomp$0 = endChunkForTag("head");
7358
7589
  destination.push(chunk$jscomp$0);
7359
7590
  }
7591
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
7592
+ if (bodyChunks)
7593
+ for (
7594
+ completedPreambleSegments = 0;
7595
+ completedPreambleSegments < bodyChunks.length;
7596
+ completedPreambleSegments++
7597
+ )
7598
+ destination.push(bodyChunks[completedPreambleSegments]);
7360
7599
  flushSegment(request, destination, completedRootSegment, null);
7361
7600
  request.completedRootSegment = null;
7362
7601
  writeBootstrap(destination, request.renderState);
@@ -8643,5 +8882,5 @@
8643
8882
  });
8644
8883
  });
8645
8884
  };
8646
- exports.version = "19.1.0-experimental-d46b04a2-20250117";
8885
+ exports.version = "19.1.0-experimental-18eaf51b-20250118";
8647
8886
  })();