octane 0.2.2 → 0.2.3

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 (50) hide show
  1. package/dist/cjs/compatibility.cjs +35 -0
  2. package/dist/cjs/component-flags.cjs +8 -1
  3. package/dist/cjs/dom-tables.cjs +2 -0
  4. package/dist/cjs/error-codes.client.generated.cjs +15 -2
  5. package/dist/cjs/error-codes.server.generated.cjs +5 -0
  6. package/dist/cjs/event-names.cjs +39 -0
  7. package/dist/cjs/index.cjs +13 -0
  8. package/dist/cjs/runtime.cjs +1223 -332
  9. package/dist/cjs/runtime.server.cjs +362 -120
  10. package/dist/cjs/server/index.cjs +22 -0
  11. package/dist/cjs/version.cjs +1 -1
  12. package/dist/compatibility.d.ts +7 -0
  13. package/dist/compatibility.js +10 -0
  14. package/dist/compiler/bundler.js +13 -30
  15. package/dist/compiler/compile-renderer-boundaries.js +1 -0
  16. package/dist/compiler/compile-universal.js +3 -0
  17. package/dist/compiler/compile.js +619 -99
  18. package/dist/compiler/hook-deps.js +100 -3
  19. package/dist/compiler/hook-names.js +1 -0
  20. package/dist/compiler/manual-hooks.js +171 -0
  21. package/dist/compiler/plain-hook-memo.js +54 -5
  22. package/dist/compiler/slot-hooks.d.ts +43 -0
  23. package/dist/compiler/slot-hooks.js +154 -35
  24. package/dist/component-flags.d.ts +1 -1
  25. package/dist/component-flags.js +8 -1
  26. package/dist/dom-tables.js +2 -0
  27. package/dist/error-codes.client.generated.d.ts +3 -1
  28. package/dist/error-codes.client.generated.js +15 -2
  29. package/dist/error-codes.server.generated.d.ts +1 -0
  30. package/dist/error-codes.server.generated.js +5 -0
  31. package/dist/event-names.d.ts +1 -0
  32. package/dist/event-names.js +15 -0
  33. package/dist/html-tree-validation.d.ts +17 -34
  34. package/dist/index.d.ts +3 -1
  35. package/dist/index.js +12 -1
  36. package/dist/jsx-runtime.d.ts +6 -1
  37. package/dist/public-types.d.ts +188 -0
  38. package/dist/public-types.js +0 -0
  39. package/dist/runtime.d.ts +109 -66
  40. package/dist/runtime.js +1220 -332
  41. package/dist/runtime.server.d.ts +39 -14
  42. package/dist/runtime.server.js +356 -120
  43. package/dist/server/index.d.ts +4 -2
  44. package/dist/server/index.js +19 -0
  45. package/dist/static/index.d.ts +2 -1
  46. package/dist/static/index.js +3 -1
  47. package/dist/universal-core.d.ts +8 -1
  48. package/dist/universal-core.js +95 -9
  49. package/dist/version.js +1 -1
  50. package/package.json +2 -1
@@ -52,11 +52,14 @@ __export(runtime_server_exports, {
52
52
  getSsrSuspenseTimeout: () => getSsrSuspenseTimeout,
53
53
  hookSlots: () => hookSlots,
54
54
  injectStyle: () => injectStyle,
55
+ invokeManualHook: () => invokeManualHook,
55
56
  isChildrenBlock: () => isChildrenBlock,
56
57
  isValidElement: () => isValidElement,
57
58
  lazy: () => lazy,
59
+ manualHook: () => manualHook,
58
60
  mapSlot: () => mapSlot,
59
61
  markChildrenBlock: () => markChildrenBlock,
62
+ markWarm: () => markWarm,
60
63
  memo: () => memo,
61
64
  namespaceHead: () => namespaceHead,
62
65
  namespaceHeadElement: () => namespaceHeadElement,
@@ -92,7 +95,9 @@ __export(runtime_server_exports, {
92
95
  ssrBlock: () => ssrBlock,
93
96
  ssrCheckedAttr: () => ssrCheckedAttr,
94
97
  ssrChild: () => ssrChild,
98
+ ssrChildPre: () => ssrChildPre,
95
99
  ssrChildText: () => ssrChildText,
100
+ ssrChildTextPre: () => ssrChildTextPre,
96
101
  ssrChildrenSources: () => ssrChildrenSources,
97
102
  ssrClass: () => ssrClass,
98
103
  ssrComponent: () => ssrComponent,
@@ -103,6 +108,7 @@ __export(runtime_server_exports, {
103
108
  ssrFormAuthoringDiagnostics: () => ssrFormAuthoringDiagnostics,
104
109
  ssrFragmentMarker: () => ssrFragmentMarker,
105
110
  ssrHeadEl: () => ssrHeadEl,
111
+ ssrHtml: () => ssrHtml,
106
112
  ssrInNamespace: () => ssrInNamespace,
107
113
  ssrInnerHtml: () => ssrInnerHtml,
108
114
  ssrInputAttrs: () => ssrInputAttrs,
@@ -603,7 +609,9 @@ function fragmentRefDescriptor(value) {
603
609
  };
604
610
  }
605
611
  function renderFragmentRefDescriptor(descriptor, scope) {
606
- return ssrFragmentMarker(true, descriptor.ref) + ssrChild(descriptor.children, scope) + ssrFragmentMarker(false);
612
+ return ssrHtml(
613
+ ssrFragmentMarker(true, descriptor.ref) + ssrChild(descriptor.children, scope) + ssrFragmentMarker(false)
614
+ );
607
615
  }
608
616
  function ssrDeoptWrapperKind(value) {
609
617
  return POSITIONAL_CHILDREN.has(value) ? "fragment" : "array";
@@ -900,9 +908,29 @@ const Children = {
900
908
  }
901
909
  };
902
910
  function createPortal(body, target, props = void 0) {
903
- return { $$kind: PORTAL_TAG, body, target, props };
911
+ const key = typeof props === "string" || typeof props === "number" ? String(props) : null;
912
+ return { $$kind: PORTAL_TAG, body, target, key, props: key === null ? props : void 0 };
904
913
  }
905
914
  const HTML_ESCAPE_RE = /[&<>]/g;
915
+ const SERVER_HTML = /* @__PURE__ */ Symbol.for("octane.serverHtml");
916
+ class ServerHtml {
917
+ [SERVER_HTML];
918
+ constructor(html) {
919
+ this[SERVER_HTML] = html;
920
+ }
921
+ toString() {
922
+ return this[SERVER_HTML];
923
+ }
924
+ }
925
+ function ssrHtml(html) {
926
+ return typeof html === "string" ? new ServerHtml(html) : html;
927
+ }
928
+ function serverComponentOutput(out, scope) {
929
+ if (out == null) return "";
930
+ if (typeof out === "string") return escapeHtml(out);
931
+ if (typeof out === "object" && SERVER_HTML in out) return out[SERVER_HTML];
932
+ return ssrChild(out, scope);
933
+ }
906
934
  function escapeHtml(v) {
907
935
  const s = typeof v === "string" ? v : String(v);
908
936
  HTML_ESCAPE_RE.lastIndex = 0;
@@ -947,6 +975,9 @@ function ssrChild(v, scope) {
947
975
  return ssrChildValue(v, scope, true);
948
976
  }
949
977
  function ssrChildValue(v, scope, includeKeyedSingle, selfMarkItem = false) {
978
+ if (v !== null && typeof v === "object" && SERVER_HTML in v) {
979
+ return v[SERVER_HTML];
980
+ }
950
981
  if (v == null || v === false || v === true) return ssrBlock("");
951
982
  if ((typeof v === "object" || typeof v === "function") && (v.$$kind === CONTEXT_TAG || typeof v.then === "function")) {
952
983
  return ssrChildValue(
@@ -998,6 +1029,14 @@ function ssrChildText(v, scope) {
998
1029
  if (typeof v === "object" || typeof v === "function") return ssrChild(v, scope);
999
1030
  return escapeHtml(v);
1000
1031
  }
1032
+ function ssrChildTextPre(v, scope) {
1033
+ const content = ssrChildText(v, scope);
1034
+ return content.charCodeAt(0) === 10 ? "\n" + content : content;
1035
+ }
1036
+ function ssrChildPre(v, scope) {
1037
+ const content = ssrChild(v, scope);
1038
+ return content.charCodeAt(0) === 10 ? "\n" + content : content;
1039
+ }
1001
1040
  function ssrHostElement(tag, props, children, scope, rawInner) {
1002
1041
  if (!VALID_TAG_NAME.test(tag)) {
1003
1042
  throw new Error((0, import_error_codes_server_generated.formatServerError)(30, tag));
@@ -1072,9 +1111,9 @@ function ssrHostElement(tag, props, children, scope, rawInner) {
1072
1111
  } else if (rawInner !== void 0) {
1073
1112
  inner = rawInner;
1074
1113
  } else if (hasChildren) {
1075
- const scriptText = semanticTag === "script" ? scriptDescriptorText(children) : null;
1076
- if (scriptText !== null) {
1077
- inner = escapeEntireInlineScriptContent(scriptText);
1114
+ const rawText = semanticTag === "script" || semanticTag === "style" ? scriptDescriptorText(children) : null;
1115
+ if (rawText !== null) {
1116
+ inner = semanticTag === "script" ? escapeEntireInlineScriptContent(rawText) : escapeEntireInlineStyleContent(rawText);
1078
1117
  } else {
1079
1118
  const build = () => ssrInNamespace(
1080
1119
  childrenNamespace,
@@ -1090,6 +1129,9 @@ function ssrHostElement(tag, props, children, scope, rawInner) {
1090
1129
  inner
1091
1130
  );
1092
1131
  }
1132
+ if ((semanticTag === "pre" || semanticTag === "textarea" || semanticTag === "listing") && inner.charCodeAt(0) === 10) {
1133
+ inner = "\n" + inner;
1134
+ }
1093
1135
  return "<" + tag + attrs + ">" + inner + "</" + tag + ">";
1094
1136
  } finally {
1095
1137
  CURRENT_SSR_ELEMENT = parentElement;
@@ -1116,6 +1158,7 @@ function ssrDeoptBlockChildren(children, scope) {
1116
1158
  }
1117
1159
  function serverDescNeedsBlocks(v) {
1118
1160
  if (v == null || typeof v !== "object") return false;
1161
+ if (v.$$kind === CONTEXT_TAG || typeof v.then === "function") return true;
1119
1162
  if (Array.isArray(v)) {
1120
1163
  for (let i = 0; i < v.length; i++) if (serverDescNeedsBlocks(v[i])) return true;
1121
1164
  return false;
@@ -1160,6 +1203,7 @@ function ssrDeoptItemContent(value, scope) {
1160
1203
  }
1161
1204
  function ssrDescriptorContent(v, scope) {
1162
1205
  if (v == null || v === false || v === true || v === "") return "";
1206
+ if (typeof v === "object" && SERVER_HTML in v) return v[SERVER_HTML];
1163
1207
  if (Array.isArray(v)) {
1164
1208
  let out = "";
1165
1209
  for (let i = 0; i < v.length; i++) out += ssrDescriptorContent(v[i], scope);
@@ -1177,7 +1221,7 @@ function ssrDescriptorContent(v, scope) {
1177
1221
  return escapeHtml(v);
1178
1222
  }
1179
1223
  function ssrBlock(content) {
1180
- return MARKERS ? import_constants.BLOCK_OPEN + content + import_constants.BLOCK_CLOSE : content;
1224
+ return MARKERS ? import_constants.BLOCK_OPEN + content + import_constants.BLOCK_CLOSE : String(content);
1181
1225
  }
1182
1226
  function ssrFragmentMarker(open, _ref) {
1183
1227
  return MARKERS ? open ? "<!--frag-->" : "<!--/frag-->" : "";
@@ -1186,10 +1230,10 @@ function ssrActivity(mode, render) {
1186
1230
  return ssrBlock(mode === "hidden" ? "" : render());
1187
1231
  }
1188
1232
  function renderActivityDescriptor(props, scope) {
1189
- return ssrActivity(props.mode ?? "visible", () => ssrChild(props.children, scope));
1233
+ return ssrHtml(ssrActivity(props.mode ?? "visible", () => ssrChild(props.children, scope)));
1190
1234
  }
1191
1235
  function ssrForBlock(content, hasItems) {
1192
- return MARKERS ? (hasItems ? import_constants.FOR_BLOCK_OPEN_ITEMS : import_constants.FOR_BLOCK_OPEN_EMPTY) + content + import_constants.BLOCK_CLOSE : content;
1236
+ return MARKERS ? (hasItems ? import_constants.FOR_BLOCK_OPEN_ITEMS : import_constants.FOR_BLOCK_OPEN_EMPTY) + content + import_constants.BLOCK_CLOSE : String(content);
1193
1237
  }
1194
1238
  const ASCII_ASYNC_IDENTITY_UNITS = [];
1195
1239
  for (let code = 0; code < 128; code++) {
@@ -1370,10 +1414,10 @@ function ssrAttr(name, v, tag, namespace = "html") {
1370
1414
  return ' class="' + escapeAttr((0, import_css.normalizeClass)(v)) + '"';
1371
1415
  }
1372
1416
  if (name.charCodeAt(0) === 97 && name.startsWith("aria-")) {
1373
- if (v == null) return "";
1417
+ if (v == null || typeof v === "function" || typeof v === "symbol") return "";
1374
1418
  return " " + name + '="' + escapeAttr(String(v)) + '"';
1375
1419
  }
1376
- if (name === "suppressContentEditableWarning" || name === "suppressHydrationWarning" || name === "suppressNativeChangeWarning" || name === "__octaneNativeChangeDiagnostic")
1420
+ if (name === "innerText" || name === "textContent" || name === "suppressContentEditableWarning" || name === "suppressHydrationWarning" || name === "suppressNativeChangeWarning" || name === "__octaneNativeChangeDiagnostic")
1377
1421
  return "";
1378
1422
  const t = typeof v;
1379
1423
  if (t === "boolean" && (0, import_constants.isEnumeratedBooleanAttr)(name)) {
@@ -1429,6 +1473,7 @@ function ssrAttr(name, v, tag, namespace = "html") {
1429
1473
  return "";
1430
1474
  }
1431
1475
  if (import_constants.POSITIVE_NUMERIC_ATTR_PROPS.has(lower) && !(Number(v) >= 1)) return "";
1476
+ if ((lower === "rowspan" || lower === "start") && Number.isNaN(Number(v))) return "";
1432
1477
  }
1433
1478
  if (v == null || v === false) return "";
1434
1479
  if (process.env.NODE_ENV !== "production" && !isCustomTag && tag !== void 0 && t === "object" && v.toString === Object.prototype.toString) {
@@ -1755,7 +1800,7 @@ function ssrFormAuthoringDiagnostics(tag, sources) {
1755
1800
  return "";
1756
1801
  }
1757
1802
  function ssrValueAttr(v) {
1758
- if (v == null) return "";
1803
+ if (v == null || typeof v === "function" || typeof v === "symbol") return "";
1759
1804
  return ' value="' + escapeAttr(typeof v === "string" ? v : String(v)) + '"';
1760
1805
  }
1761
1806
  function ssrCheckedAttr(v) {
@@ -2236,7 +2281,7 @@ function renderComponentFramed(comp, props, parent, frame, inherit) {
2236
2281
  ACTIVE_PU_WARM_PLANS.length = warmPlanCheckpoint;
2237
2282
  HOOK_PASS = previousHookPass;
2238
2283
  }
2239
- const inner = typeof out === "string" ? out : out == null ? "" : ssrChild(out, scope);
2284
+ const inner = serverComponentOutput(out, scope);
2240
2285
  nativeCompleted = true;
2241
2286
  return MARKERS && !inherit ? import_constants.BLOCK_OPEN + inner + import_constants.BLOCK_CLOSE : inner;
2242
2287
  } catch (error) {
@@ -2278,7 +2323,7 @@ function ssrComponent(parent, comp, props, inherit, key, identityScoped) {
2278
2323
  const kids = props?.children;
2279
2324
  if (typeof kids === "function") {
2280
2325
  const out = kids(void 0, parent);
2281
- const inner = typeof out === "string" ? out : out == null ? "" : ssrChild(out, parent);
2326
+ const inner = serverComponentOutput(out, parent);
2282
2327
  const html2 = ssrHostElement(tag, props, null, parent, inner);
2283
2328
  return inherit ? html2 : ssrBlock(html2);
2284
2329
  }
@@ -2334,7 +2379,8 @@ function ssrInNamespace(namespace, render) {
2334
2379
  }
2335
2380
  }
2336
2381
  function ssrChildrenHtml(children, scope) {
2337
- if (typeof children === "function") return children(void 0, scope) ?? "";
2382
+ if (typeof children === "function")
2383
+ return serverComponentOutput(children(void 0, scope), scope);
2338
2384
  return ssrChild(children, scope);
2339
2385
  }
2340
2386
  function streamTokenForPendingHtml(html) {
@@ -2368,7 +2414,8 @@ const PermanentStaticHydrate = /* @__PURE__ */ (0, import_component_flags.markCo
2368
2414
  if (nativeCapture < 0) NATIVE_SERVER_READS = null;
2369
2415
  PERMANENT_STATIC_HYDRATE_DEPTH++;
2370
2416
  try {
2371
- if (inheritedPermanentStatic || !MARKERS) return ssrChildrenHtml(props.children, scope);
2417
+ if (inheritedPermanentStatic || !MARKERS)
2418
+ return ssrHtml(ssrChildrenHtml(props.children, scope));
2372
2419
  const childIdStart = ID_COUNTER;
2373
2420
  const serialStart = SERIAL?.length ?? 0;
2374
2421
  const children = ssrBlock(
@@ -2385,7 +2432,9 @@ const PermanentStaticHydrate = /* @__PURE__ */ (0, import_component_flags.markCo
2385
2432
  const streamToken = streamTokenForPendingHtml(children);
2386
2433
  const markerToken = streamToken === null ? "" : streamToken + ":";
2387
2434
  const endToken = streamToken === null ? "" : ":" + streamToken;
2388
- return `<!--${import_constants.HYDRATE_STATIC_ID_COUNT_PREFIX}${markerToken}${idCount}-->` + children + `<!--${import_constants.HYDRATE_STATIC_END}${endToken}-->`;
2435
+ return ssrHtml(
2436
+ `<!--${import_constants.HYDRATE_STATIC_ID_COUNT_PREFIX}${markerToken}${idCount}-->` + children + `<!--${import_constants.HYDRATE_STATIC_END}${endToken}-->`
2437
+ );
2389
2438
  } finally {
2390
2439
  finishNativeSeedCapture(nativeCapture, previousNativeReads, false);
2391
2440
  PERMANENT_STATIC_HYDRATE_DEPTH--;
@@ -2397,51 +2446,53 @@ const PermanentStaticHydrate = /* @__PURE__ */ (0, import_component_flags.markCo
2397
2446
  const hydrate = /* @__PURE__ */ (0, import_component_flags.markComponentFlags)(
2398
2447
  function Hydrate(props, scope) {
2399
2448
  const id = useId();
2400
- return withSsrElementContext(
2401
- "div",
2402
- void 0,
2403
- () => ssrInNamespace("html", () => {
2404
- if (!MARKERS) {
2405
- return "<div>" + ssrChildrenHtml(props.children, scope) + "</div>";
2406
- }
2407
- const childIdStart = ID_COUNTER;
2408
- const serialStart = SERIAL?.length ?? 0;
2409
- const nativeCapture = NATIVE_READ_COLLECTOR?.beginCapture() ?? -1;
2410
- const previousNativeReads = NATIVE_SERVER_READS;
2411
- if (nativeCapture < 0) NATIVE_SERVER_READS = null;
2412
- let children;
2413
- let nativeReads = null;
2414
- try {
2415
- children = ssrBlock(
2416
- ssrTry(
2417
- scope,
2418
- "jsx-hydrate",
2419
- (_arg, childScope) => ssrChildrenHtml(props.children, childScope),
2420
- null,
2421
- null,
2422
- "html"
2423
- )
2449
+ return ssrHtml(
2450
+ withSsrElementContext(
2451
+ "div",
2452
+ void 0,
2453
+ () => ssrInNamespace("html", () => {
2454
+ if (!MARKERS) {
2455
+ return "<div>" + ssrChildrenHtml(props.children, scope) + "</div>";
2456
+ }
2457
+ const childIdStart = ID_COUNTER;
2458
+ const serialStart = SERIAL?.length ?? 0;
2459
+ const nativeCapture = NATIVE_READ_COLLECTOR?.beginCapture() ?? -1;
2460
+ const previousNativeReads = NATIVE_SERVER_READS;
2461
+ if (nativeCapture < 0) NATIVE_SERVER_READS = null;
2462
+ let children;
2463
+ let nativeReads = null;
2464
+ try {
2465
+ children = ssrBlock(
2466
+ ssrTry(
2467
+ scope,
2468
+ "jsx-hydrate",
2469
+ (_arg, childScope) => ssrChildrenHtml(props.children, childScope),
2470
+ null,
2471
+ null,
2472
+ "html"
2473
+ )
2474
+ );
2475
+ } finally {
2476
+ nativeReads = finishNativeSeedCapture(nativeCapture, previousNativeReads, false);
2477
+ }
2478
+ const idCount = ID_COUNTER - childIdStart;
2479
+ const childSeeds = SERIAL === null ? [] : SERIAL.splice(serialStart);
2480
+ const permanentStaticAncestor = PERMANENT_STATIC_HYDRATE_DEPTH !== 0;
2481
+ const attrs = ssrHydrateAttrs(
2482
+ id,
2483
+ props.when,
2484
+ idCount,
2485
+ permanentStaticAncestor,
2486
+ streamTokenForPendingHtml(children)
2424
2487
  );
2425
- } finally {
2426
- nativeReads = finishNativeSeedCapture(nativeCapture, previousNativeReads, false);
2427
- }
2428
- const idCount = ID_COUNTER - childIdStart;
2429
- const childSeeds = SERIAL === null ? [] : SERIAL.splice(serialStart);
2430
- const permanentStaticAncestor = PERMANENT_STATIC_HYDRATE_DEPTH !== 0;
2431
- const attrs = ssrHydrateAttrs(
2432
- id,
2433
- props.when,
2434
- idCount,
2435
- permanentStaticAncestor,
2436
- streamTokenForPendingHtml(children)
2437
- );
2438
- const seedJson = permanentStaticAncestor || childSeeds.length === 0 ? null : serializeSuspenseSeedJson(childSeeds);
2439
- const seedSidecar = seedJson === null || seedJson === "[]" ? "" : '<script type="application/json" ' + import_constants.HYDRATE_SEED_ATTR + NONCE_ATTR + ">" + seedJson + "</script>";
2440
- const nativeSeeds = permanentStaticAncestor ? void 0 : NATIVE_READ_COLLECTOR?.serialize(nativeReads);
2441
- const nativeSidecar = nativeSeeds === void 0 ? "" : serializeNativeSignalSeeds(nativeSeeds, NONCE_ATTR);
2442
- return "<div" + attrs + ">" + children + seedSidecar + nativeSidecar + "</div>";
2443
- }),
2444
- "html"
2488
+ const seedJson = permanentStaticAncestor || childSeeds.length === 0 ? null : serializeSuspenseSeedJson(childSeeds);
2489
+ const seedSidecar = seedJson === null || seedJson === "[]" ? "" : '<script type="application/json" ' + import_constants.HYDRATE_SEED_ATTR + NONCE_ATTR + ">" + seedJson + "</script>";
2490
+ const nativeSeeds = permanentStaticAncestor ? void 0 : NATIVE_READ_COLLECTOR?.serialize(nativeReads);
2491
+ const nativeSidecar = nativeSeeds === void 0 ? "" : serializeNativeSignalSeeds(nativeSeeds, NONCE_ATTR);
2492
+ return "<div" + attrs + ">" + children + seedSidecar + nativeSidecar + "</div>";
2493
+ }),
2494
+ "html"
2495
+ )
2445
2496
  );
2446
2497
  },
2447
2498
  import_component_flags.COMPONENT_FLAG_BOUNDARY,
@@ -2454,17 +2505,22 @@ function initializeHydrateComponent() {
2454
2505
  const Hydrate2 = /* @__PURE__ */ initializeHydrateComponent();
2455
2506
  const Suspense = /* @__PURE__ */ (0, import_component_flags.markComponentFlags)(
2456
2507
  function Suspense2(props, scope) {
2457
- return ssrTry(
2458
- scope,
2459
- "jsx-suspense",
2460
- (_arg, s) => ssrChildrenHtml(props.children, s),
2461
- (_arg, s) => ssrChild(props.fallback, s),
2462
- null,
2463
- FRAME?.namespace ?? "html"
2508
+ return ssrHtml(
2509
+ ssrTry(
2510
+ scope,
2511
+ "jsx-suspense",
2512
+ (_arg, s) => ssrChildrenHtml(props.children, s),
2513
+ (_arg, s) => ssrChild(props.fallback, s),
2514
+ null,
2515
+ FRAME?.namespace ?? "html",
2516
+ false,
2517
+ true
2518
+ )
2464
2519
  );
2465
2520
  },
2466
2521
  import_component_flags.COMPONENT_FLAG_BOUNDARY,
2467
- "Suspense"
2522
+ "Suspense",
2523
+ /* @__PURE__ */ Symbol.for("octane.suspense")
2468
2524
  );
2469
2525
  let VT_SSR_TRY_SEQ = 0;
2470
2526
  let VT_SSR_HAS_CANDIDATES = false;
@@ -2577,7 +2633,7 @@ const ViewTransition = /* @__PURE__ */ (0, import_component_flags.markComponentF
2577
2633
  attrs.push(["vt-enter-x", vtSsrResolve(props, "enter")]);
2578
2634
  attrs.push(["vt-exit-x", vtSsrResolve(props, "exit")]);
2579
2635
  if (named) attrs.push(["vt-share", cand.share]);
2580
- return ssrBlock(vtSsrAnnotate(inner, attrs));
2636
+ return ssrHtml(ssrBlock(vtSsrAnnotate(inner, attrs)));
2581
2637
  },
2582
2638
  import_component_flags.COMPONENT_FLAG_BOUNDARY,
2583
2639
  "ViewTransition"
@@ -2586,21 +2642,27 @@ function addTransitionType(_type) {
2586
2642
  }
2587
2643
  const ErrorBoundary = /* @__PURE__ */ (0, import_component_flags.markComponentFlags)(
2588
2644
  function ErrorBoundary2(props, scope) {
2589
- return ssrBlock(
2590
- (() => {
2591
- try {
2592
- return withAsyncIdentity(
2593
- "error-boundary",
2594
- "content",
2595
- () => ssrBlock(ssrChildrenHtml(props.children, scope))
2596
- );
2597
- } catch (e) {
2598
- e = normalizeThrownServerThenable(e);
2599
- if (ssrIsSuspense(e)) throw e;
2600
- const fb = typeof props.fallback === "function" ? props.fallback(e, NOOP) : props.fallback;
2601
- return withAsyncIdentity("error-boundary", "catch", () => ssrBlock(ssrChild(fb, scope)));
2602
- }
2603
- })()
2645
+ return ssrHtml(
2646
+ ssrBlock(
2647
+ (() => {
2648
+ try {
2649
+ return withAsyncIdentity(
2650
+ "error-boundary",
2651
+ "content",
2652
+ () => ssrBlock(ssrChildrenHtml(props.children, scope))
2653
+ );
2654
+ } catch (e) {
2655
+ e = normalizeThrownServerThenable(e);
2656
+ if (ssrIsSuspense(e)) throw e;
2657
+ const fb = typeof props.fallback === "function" ? props.fallback(e, NOOP) : props.fallback;
2658
+ return withAsyncIdentity(
2659
+ "error-boundary",
2660
+ "catch",
2661
+ () => ssrBlock(ssrChild(fb, scope))
2662
+ );
2663
+ }
2664
+ })()
2665
+ )
2604
2666
  );
2605
2667
  },
2606
2668
  import_component_flags.COMPONENT_FLAG_BOUNDARY,
@@ -2609,7 +2671,7 @@ const ErrorBoundary = /* @__PURE__ */ (0, import_component_flags.markComponentFl
2609
2671
  const CONTEXT_TAG = /* @__PURE__ */ Symbol.for("octane.context");
2610
2672
  function createContext(defaultValue) {
2611
2673
  const ctx = function ProviderBody(props, scope) {
2612
- return renderServerContextProvider(ctx, props, scope);
2674
+ return ssrHtml(renderServerContextProvider(ctx, props, scope));
2613
2675
  };
2614
2676
  ctx.$$kind = CONTEXT_TAG;
2615
2677
  ctx.defaultValue = defaultValue;
@@ -2637,7 +2699,7 @@ function renderServerContextProvider(context, props, renderScope) {
2637
2699
  scope.$$ctxValues.set(context, props.value);
2638
2700
  const children = props.children;
2639
2701
  if (children == null) return "";
2640
- return typeof children === "function" ? children(void 0, scope) ?? "" : ssrChild(children, scope);
2702
+ return ssrHtml(ssrChildrenHtml(children, scope));
2641
2703
  }
2642
2704
  function readContext(ctx) {
2643
2705
  for (let s = CURRENT_SCOPE; s !== null; s = s.parent) {
@@ -2832,6 +2894,11 @@ function hasExternalHydrationOwner(thenable) {
2832
2894
  }
2833
2895
  }
2834
2896
  function use(usable, siteKey, directSite) {
2897
+ if (process.env.NODE_ENV !== "production" && devMemoComputeDepth !== 0) {
2898
+ console.error(
2899
+ "Do not call use() inside a useMemo() factory. Cached factories can skip context or promise reads; call use() before useMemo() and memoize the returned value instead."
2900
+ );
2901
+ }
2835
2902
  if (usable && usable.$$kind === CONTEXT_TAG) {
2836
2903
  recordSkippedHydrationSite(SERIAL, directSite);
2837
2904
  return readContext(usable);
@@ -3214,18 +3281,21 @@ function resolveLazyModule(mod) {
3214
3281
  }
3215
3282
  return comp;
3216
3283
  }
3217
- function callLazyComponent(mod, props, scope, extra) {
3218
- const comp = resolveLazyModule(mod);
3219
- return comp((0, import_shared_value_helpers.resolveLazyDefaultProps)(comp, props), scope, extra);
3220
- }
3221
3284
  function lazy(load) {
3222
3285
  let status = "uninitialized";
3223
3286
  let result = null;
3224
3287
  let promise = null;
3225
3288
  const key = "|lazy#" + LAZY_ID++;
3289
+ let displayName;
3290
+ let resolvedName = "Lazy";
3291
+ const callResolved = (props, scope, extra) => {
3292
+ const comp = resolveLazyModule(result);
3293
+ resolvedName = comp.displayName || comp.name || "Lazy";
3294
+ return comp((0, import_shared_value_helpers.resolveLazyDefaultProps)(comp, props), scope, extra);
3295
+ };
3226
3296
  const lazyWrapper = (props, scope, extra) => {
3227
3297
  if (status === "fulfilled") {
3228
- return callLazyComponent(result, props, scope, extra);
3298
+ return callResolved(props, scope, extra);
3229
3299
  }
3230
3300
  if (status === "rejected") throw result;
3231
3301
  if (status === "uninitialized") {
@@ -3253,7 +3323,7 @@ function lazy(load) {
3253
3323
  if (status === "uninitialized") status = "pending";
3254
3324
  const settledStatus = status;
3255
3325
  if (settledStatus === "fulfilled") {
3256
- return callLazyComponent(result, props, scope, extra);
3326
+ return callResolved(props, scope, extra);
3257
3327
  }
3258
3328
  if (settledStatus === "rejected") throw result;
3259
3329
  }
@@ -3270,11 +3340,22 @@ function lazy(load) {
3270
3340
  }
3271
3341
  throw SSR_SUSPENSE;
3272
3342
  };
3273
- Object.defineProperty(lazyWrapper, LAZY_COMPONENT, { value: true });
3343
+ Object.defineProperty(lazyWrapper, LAZY_COMPONENT, {
3344
+ get() {
3345
+ return this === lazyWrapper;
3346
+ }
3347
+ });
3348
+ Object.defineProperty(lazyWrapper, "displayName", {
3349
+ configurable: true,
3350
+ get: () => displayName ?? resolvedName,
3351
+ set: (value) => {
3352
+ displayName = value;
3353
+ }
3354
+ });
3274
3355
  return lazyWrapper;
3275
3356
  }
3276
3357
  function useState(initial, slot) {
3277
- if (slot === void 0 && typeof initial === "symbol") {
3358
+ if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && (HOOK_SLOT_PATH.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
3278
3359
  slot = initial;
3279
3360
  initial = void 0;
3280
3361
  }
@@ -3285,7 +3366,7 @@ function useState(initial, slot) {
3285
3366
  );
3286
3367
  }
3287
3368
  function __useStateWithGetter(initial, slot) {
3288
- if (slot === void 0 && typeof initial === "symbol") {
3369
+ if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && (HOOK_SLOT_PATH.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
3289
3370
  slot = initial;
3290
3371
  initial = void 0;
3291
3372
  }
@@ -3377,30 +3458,43 @@ const useLayoutEffect = useEffect;
3377
3458
  const useInsertionEffect = useEffect;
3378
3459
  function useImperativeHandle() {
3379
3460
  }
3461
+ let devMemoComputeDepth = 0;
3380
3462
  function memoHookValue(input, compute, depsOrSlot, maybeSlot) {
3381
3463
  const deps = Array.isArray(depsOrSlot) ? depsOrSlot : null;
3382
3464
  const slot = maybeSlot ?? (Array.isArray(depsOrSlot) || depsOrSlot === null ? void 0 : depsOrSlot);
3383
3465
  if (deps === null) return compute ? input() : input;
3384
3466
  const position = hookPosition(slot);
3385
- if (position === null) return compute ? input() : input;
3467
+ if (position === null)
3468
+ return compute ? input(...deps) : input;
3386
3469
  let rec = position.list[position.index];
3387
3470
  if (rec === void 0) {
3388
- rec = { value: compute ? input() : input, deps: deps.slice() };
3471
+ rec = {
3472
+ value: compute ? input(...deps) : input,
3473
+ deps: deps.slice()
3474
+ };
3389
3475
  position.list[position.index] = rec;
3390
3476
  } else if (!serverDepsEqual(rec.deps, deps)) {
3391
- rec.value = compute ? input() : input;
3477
+ rec.value = compute ? input(...deps) : input;
3392
3478
  rec.deps = deps.slice();
3393
3479
  }
3394
3480
  return rec.value;
3395
3481
  }
3396
3482
  function useMemo(compute, depsOrSlot, maybeSlot) {
3483
+ if (process.env.NODE_ENV !== "production") {
3484
+ devMemoComputeDepth++;
3485
+ try {
3486
+ return memoHookValue(compute, true, depsOrSlot, maybeSlot);
3487
+ } finally {
3488
+ devMemoComputeDepth--;
3489
+ }
3490
+ }
3397
3491
  return memoHookValue(compute, true, depsOrSlot, maybeSlot);
3398
3492
  }
3399
3493
  function useCallback(fn, depsOrSlot, maybeSlot) {
3400
3494
  return memoHookValue(fn, false, depsOrSlot, maybeSlot);
3401
3495
  }
3402
3496
  function useRef(initial, slot) {
3403
- if (slot === void 0 && typeof initial === "symbol") {
3497
+ if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && (HOOK_SLOT_PATH.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
3404
3498
  slot = initial;
3405
3499
  initial = void 0;
3406
3500
  }
@@ -3440,20 +3534,102 @@ function useActionState(_action, initialState) {
3440
3534
  return [initialState, NOOP, false];
3441
3535
  }
3442
3536
  function useFormStatus() {
3443
- return { pending: false, data: null, method: "get", action: null };
3537
+ return { pending: false, data: null, method: null, action: null };
3444
3538
  }
3445
3539
  function useOptimistic(state) {
3446
3540
  return [state, NOOP];
3447
3541
  }
3448
3542
  function memo(component) {
3543
+ const memoWrapper = (props, scope, extra) => component(props, scope, extra);
3544
+ Object.defineProperty(memoWrapper, "type", { value: component });
3545
+ Object.defineProperty(memoWrapper, "displayName", {
3546
+ configurable: true,
3547
+ writable: true,
3548
+ value: component.displayName || component.name || "Memo"
3549
+ });
3550
+ Object.defineProperty(memoWrapper, "__memo", {
3551
+ get() {
3552
+ return this === memoWrapper;
3553
+ }
3554
+ });
3555
+ Object.defineProperty(memoWrapper, "defaultProps", {
3556
+ configurable: true,
3557
+ get: () => component.defaultProps,
3558
+ set: (value) => {
3559
+ component.defaultProps = value;
3560
+ }
3561
+ });
3562
+ return memoWrapper;
3563
+ }
3564
+ function markWarm(component, plan) {
3565
+ Object.defineProperty(component, "__warm", {
3566
+ configurable: true,
3567
+ get() {
3568
+ return this === component ? plan : void 0;
3569
+ }
3570
+ });
3449
3571
  return component;
3450
3572
  }
3573
+ let MANUAL_HOOK_DRIVER = null;
3574
+ function invokeManualHook(fn, receiver, args) {
3575
+ const driver = MANUAL_HOOK_DRIVER ??= {
3576
+ pending: HOOK_SLOT_PATH[HOOK_SLOT_PATH.length - 1],
3577
+ active: false
3578
+ };
3579
+ const pending = driver.pending;
3580
+ const active = driver.active;
3581
+ driver.pending = void 0;
3582
+ driver.active = true;
3583
+ try {
3584
+ if (pending === void 0) return Reflect.apply(fn, receiver, args);
3585
+ switch (args.length) {
3586
+ case 0:
3587
+ return fn.call(receiver, pending);
3588
+ case 1:
3589
+ return fn.call(receiver, args[0], pending);
3590
+ case 2:
3591
+ return fn.call(receiver, args[0], args[1], pending);
3592
+ case 3:
3593
+ return fn.call(receiver, args[0], args[1], args[2], pending);
3594
+ case 4:
3595
+ return fn.call(receiver, args[0], args[1], args[2], args[3], pending);
3596
+ default: {
3597
+ const forwarded = new Array(args.length + 1);
3598
+ for (let index = 0; index < args.length; index++) forwarded[index] = args[index];
3599
+ forwarded[args.length] = pending;
3600
+ return fn.apply(receiver, forwarded);
3601
+ }
3602
+ }
3603
+ } finally {
3604
+ driver.pending = pending;
3605
+ driver.active = active;
3606
+ }
3607
+ }
3608
+ function manualHook(fn, name) {
3609
+ function provider() {
3610
+ return invokeManualHook(fn, this, arguments);
3611
+ }
3612
+ Object.defineProperty(provider, "name", { value: name ?? fn.name, configurable: true });
3613
+ Object.defineProperty(provider, "length", { value: fn.length, configurable: true });
3614
+ return provider;
3615
+ }
3451
3616
  function withSlot(sym, fn, ...args) {
3617
+ const driver = MANUAL_HOOK_DRIVER;
3618
+ const pending = driver?.pending;
3619
+ const active = driver?.active ?? false;
3620
+ if (driver !== null) {
3621
+ driver.pending = sym;
3622
+ driver.active = false;
3623
+ }
3452
3624
  HOOK_SLOT_PATH.push(sym);
3453
3625
  try {
3454
3626
  return fn(...args);
3455
3627
  } finally {
3456
3628
  HOOK_SLOT_PATH.pop();
3629
+ if (MANUAL_HOOK_DRIVER !== null) {
3630
+ MANUAL_HOOK_DRIVER.pending = driver === null ? HOOK_SLOT_PATH[HOOK_SLOT_PATH.length - 1] : pending;
3631
+ MANUAL_HOOK_DRIVER.active = active;
3632
+ }
3457
3633
  }
3458
3634
  }
3459
3635
  function startTransition(fn) {
@@ -3530,11 +3706,20 @@ function namespaceHeadElement(headKey, tag, attrs, text, authoredKey) {
3530
3706
  return createElement(namespaceHead, config);
3531
3707
  }
3532
3708
  function spliceHead(body, head) {
3533
- if (head === "") return body;
3709
+ if (head === "" && !isDocumentRoot(body)) return body;
3534
3710
  const headClose = body.indexOf("</head>");
3535
3711
  if (headClose !== -1) return body.slice(0, headClose) + head + body.slice(headClose);
3712
+ if (isDocumentRoot(body)) {
3713
+ const openingEnd = documentTagEnd(body, body.indexOf("<html") + 5);
3714
+ if (openingEnd !== -1)
3715
+ return body.slice(0, openingEnd) + "<head>" + head + "</head>" + body.slice(openingEnd);
3716
+ }
3717
+ if (head === "") return body;
3536
3718
  return head + body;
3537
3719
  }
3720
+ function renderEntryValue(props, scope) {
3721
+ return ssrHtml(ssrChild(props.value, scope));
3722
+ }
3538
3723
  const MAX_SUSPENSE_PASSES = 50;
3539
3724
  let SUSPENSE_TIMEOUT_MS = 1e4;
3540
3725
  function setSsrSuspenseTimeout(ms) {
@@ -3801,7 +3986,7 @@ function runFullFramedPass(component, props, resolved, nonceAttr = "", identifie
3801
3986
  const nativeToken = NATIVE_READ_COLLECTOR === null ? -1 : beginActiveNativeReadScope(root);
3802
3987
  try {
3803
3988
  const out = invokeComponentBody(component, props, root, FRAME);
3804
- body = typeof out === "string" ? out : out == null ? "" : ssrChild(out, root);
3989
+ body = serverComponentOutput(out, root);
3805
3990
  nativePassCompleted = true;
3806
3991
  } catch (err) {
3807
3992
  err = normalizeThrownServerThenable(err);
@@ -3817,6 +4002,14 @@ function runFullFramedPass(component, props, resolved, nonceAttr = "", identifie
3817
4002
  restoreAmbient(saved);
3818
4003
  }
3819
4004
  }
4005
+ if (resolved.bufferedErrors !== void 0) {
4006
+ for (const report of resolved.bufferedErrors.values()) {
4007
+ if (!report.reported) {
4008
+ report.reported = true;
4009
+ resolved.resourceOptions?.onError?.(report.error);
4010
+ }
4011
+ }
4012
+ }
3820
4013
  let css = "";
3821
4014
  for (const [hash, sheet] of cssMap) {
3822
4015
  css += '<style data-octane="' + hash + '"' + (sheet.nonce === void 0 ? nonceAttr : ' nonce="' + escapeAttr(sheet.nonce) + '"') + ">" + escapeEntireInlineStyleContent(sheet.css) + "</style>";
@@ -4094,7 +4287,11 @@ function passToResult(pass, nonceAttr, separateHead = false) {
4094
4287
  return result;
4095
4288
  }
4096
4289
  async function prerender(entryComponent, props, options) {
4097
- const component = entryComponent;
4290
+ const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
4291
+ if (typeof entryComponent !== "function") {
4292
+ options ??= props;
4293
+ props = { value: entryComponent };
4294
+ }
4098
4295
  const nonceAttr = nonceAttrOf(options);
4099
4296
  const resolved = newResolvedMap(options ?? null);
4100
4297
  try {
@@ -4108,6 +4305,10 @@ async function prerender(entryComponent, props, options) {
4108
4305
  }
4109
4306
  }
4110
4307
  async function prerenderToNodeStream(entryComponent, props, options) {
4308
+ if (typeof entryComponent !== "function" && options === void 0) {
4309
+ options = props;
4310
+ props = void 0;
4311
+ }
4111
4312
  let resolved = options;
4112
4313
  if (options?.headChannel === "separate") {
4113
4314
  if (process.env.NODE_ENV !== "production") {
@@ -4192,7 +4393,11 @@ function renderHostedAttempt(session, component, props, options) {
4192
4393
  return { status: "complete", html: body, head: pass.head, cssEntries: pass.cssEntries };
4193
4394
  }
4194
4395
  function renderToString(entryComponent, props, options) {
4195
- const component = entryComponent;
4396
+ const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
4397
+ if (typeof entryComponent !== "function") {
4398
+ options ??= props;
4399
+ props = { value: entryComponent };
4400
+ }
4196
4401
  options?.signal?.throwIfAborted();
4197
4402
  const nonceAttr = nonceAttrOf(options);
4198
4403
  const resolved = newResolvedMap(options ?? null);
@@ -4202,6 +4407,7 @@ function renderToString(entryComponent, props, options) {
4202
4407
  null,
4203
4408
  () => runFullFramedPass(component, props, resolved, nonceAttr, options?.identifierPrefix ?? "")
4204
4409
  );
4410
+ if (pass.rootSuspended) throw new Error((0, import_error_codes_server_generated.formatServerError)(60));
4205
4411
  } catch (err) {
4206
4412
  options?.onError?.(err);
4207
4413
  throw err;
@@ -4211,7 +4417,11 @@ function renderToString(entryComponent, props, options) {
4211
4417
  return passToResult(pass, nonceAttr, options?.headChannel === "separate");
4212
4418
  }
4213
4419
  function renderToStaticMarkup(entryComponent, props, options) {
4214
- const component = entryComponent;
4420
+ const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
4421
+ if (typeof entryComponent !== "function") {
4422
+ options ??= props;
4423
+ props = { value: entryComponent };
4424
+ }
4215
4425
  options?.signal?.throwIfAborted();
4216
4426
  const nonceAttr = nonceAttrOf(options);
4217
4427
  const resolved = newResolvedMap(options ?? null);
@@ -4228,6 +4438,7 @@ function renderToStaticMarkup(entryComponent, props, options) {
4228
4438
  false
4229
4439
  )
4230
4440
  );
4441
+ if (pass.rootSuspended) throw new Error((0, import_error_codes_server_generated.formatServerError)(60));
4231
4442
  } catch (err) {
4232
4443
  options?.onError?.(err);
4233
4444
  throw err;
@@ -4321,7 +4532,7 @@ function pruneStreamBoundariesAbsentFromShell(stream, shellBoundaryKeys) {
4321
4532
  if (!shellBoundaryKeys.has(key)) stream.boundaries.delete(key);
4322
4533
  }
4323
4534
  }
4324
- function ssrTry(scope, siteKey, tryFn, pendFn, catchFn, namespace = FRAME?.namespace ?? "html", propagateSuspense = false) {
4535
+ function ssrTry(scope, siteKey, tryFn, pendFn, catchFn, namespace = FRAME?.namespace ?? "html", propagateSuspense = false, recoverErrors = false) {
4325
4536
  VT_SSR_TRY_SEQ++;
4326
4537
  let vtOuter = null;
4327
4538
  if (VT_SSR_STACK.length > 0) {
@@ -4674,6 +4885,13 @@ function ssrTry(scope, siteKey, tryFn, pendFn, catchFn, namespace = FRAME?.names
4674
4885
  pruneUnrepresentedStreamDescendants(stream, key, fallback);
4675
4886
  return fallback;
4676
4887
  }
4888
+ if (recoverErrors && pendFn !== null && PERMANENT_STATIC_HYDRATE_DEPTH === 0) {
4889
+ if (SERIAL !== null) SERIAL.length = serialStart;
4890
+ const reports = RESOLVED?.bufferedErrors ?? (RESOLVED.bufferedErrors = /* @__PURE__ */ new Map());
4891
+ if (!reports.has(key)) reports.set(key, { error: e, reported: false });
4892
+ nativeFresh = true;
4893
+ return pendingForm();
4894
+ }
4677
4895
  throw e;
4678
4896
  }
4679
4897
  } finally {
@@ -4715,19 +4933,22 @@ function documentHeadInsertionPoint(body) {
4715
4933
  const next = body.charCodeAt(start + 5);
4716
4934
  if (next === 62) return start + 6;
4717
4935
  if (next === 32 || next === 9 || next === 10 || next === 13) {
4718
- let quote = 0;
4719
- for (let i = start + 6; i < body.length; i++) {
4720
- const code = body.charCodeAt(i);
4721
- if (quote !== 0) {
4722
- if (code === quote) quote = 0;
4723
- } else if (code === 34 || code === 39) quote = code;
4724
- else if (code === 62) return i + 1;
4725
- }
4726
- return -1;
4936
+ return documentTagEnd(body, start + 6);
4727
4937
  }
4728
4938
  searchFrom = start + 5;
4729
4939
  }
4730
4940
  }
4941
+ function documentTagEnd(body, from) {
4942
+ let quote = 0;
4943
+ for (let i = from; i < body.length; i++) {
4944
+ const code = body.charCodeAt(i);
4945
+ if (quote !== 0) {
4946
+ if (code === quote) quote = 0;
4947
+ } else if (code === 34 || code === 39) quote = code;
4948
+ else if (code === 62) return i + 1;
4949
+ }
4950
+ return -1;
4951
+ }
4731
4952
  function segmentChunk(b, nonceAttr) {
4732
4953
  let seedScript = "";
4733
4954
  if (b.seeds.length > 0) {
@@ -4941,14 +5162,14 @@ async function runStream(component, props, options, sink, resolved) {
4941
5162
  const tailStart = documentTailStart(pass.body);
4942
5163
  if (tailStart !== -1) {
4943
5164
  heldDocumentTail = pass.body.slice(tailStart);
4944
- const bodyHtml = pass.body.slice(0, tailStart);
5165
+ const bodyHtml = spliceHead(pass.body.slice(0, tailStart), "");
4945
5166
  const headInsert = documentHeadInsertionPoint(bodyHtml);
4946
5167
  shell += headInsert !== -1 ? bodyHtml.slice(0, headInsert) + leadingStyles + shellHead + bodyHtml.slice(headInsert) : leadingStyles + shellHead + bodyHtml;
4947
5168
  } else {
4948
- shell += leadingStyles + shellHead + pass.body;
5169
+ shell += spliceHead(pass.body, leadingStyles + shellHead);
4949
5170
  }
4950
5171
  } else {
4951
- shell += leadingStyles + shellHead + pass.body;
5172
+ shell += documentRoot ? spliceHead(pass.body, leadingStyles + shellHead) : leadingStyles + shellHead + pass.body;
4952
5173
  }
4953
5174
  if (pass.serial.length > 0) shell += serializeSuspenseSeeds(pass.serial, nonceAttr);
4954
5175
  if (pass.signals !== void 0) shell += serializeNativeSignalSeeds(pass.signals, nonceAttr);
@@ -5122,7 +5343,11 @@ async function runStream(component, props, options, sink, resolved) {
5122
5343
  sink.allReady();
5123
5344
  }
5124
5345
  function renderToPipeableStream(entryComponent, props, options) {
5125
- const component = entryComponent;
5346
+ const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
5347
+ if (typeof entryComponent !== "function") {
5348
+ options ??= props;
5349
+ props = { value: entryComponent };
5350
+ }
5126
5351
  const controller = new AbortController();
5127
5352
  let removeOuterAbort;
5128
5353
  if (options?.signal) {
@@ -5141,6 +5366,7 @@ function renderToPipeableStream(entryComponent, props, options) {
5141
5366
  let endCalled = false;
5142
5367
  let pipeCalled = false;
5143
5368
  let writeGate = null;
5369
+ let shellFailure = null;
5144
5370
  const destinationFailure = (reason) => {
5145
5371
  if (closed) return;
5146
5372
  closed = true;
@@ -5154,6 +5380,11 @@ function renderToPipeableStream(entryComponent, props, options) {
5154
5380
  if (!ended || destination === null || writeGate !== null || endCalled || closed) return;
5155
5381
  endCalled = true;
5156
5382
  try {
5383
+ if (shellFailure !== null && destination.destroy !== void 0) {
5384
+ closed = true;
5385
+ destination.destroy(shellFailure.error);
5386
+ return;
5387
+ }
5157
5388
  destination.end();
5158
5389
  } catch (err) {
5159
5390
  destinationFailure(err);
@@ -5270,6 +5501,7 @@ function renderToPipeableStream(entryComponent, props, options) {
5270
5501
  },
5271
5502
  shellError(err) {
5272
5503
  releaseServerRenderResources(resolved);
5504
+ shellFailure = { error: err };
5273
5505
  options?.onShellError?.(err);
5274
5506
  flushEnd();
5275
5507
  },
@@ -5318,7 +5550,11 @@ function renderToPipeableStream(entryComponent, props, options) {
5318
5550
  };
5319
5551
  }
5320
5552
  function renderToReadableStream(entryComponent, props, options) {
5321
- const component = entryComponent;
5553
+ const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
5554
+ if (typeof entryComponent !== "function") {
5555
+ options ??= props;
5556
+ props = { value: entryComponent };
5557
+ }
5322
5558
  return new Promise((resolveShell, rejectShell) => {
5323
5559
  const encoder = new TextEncoder();
5324
5560
  const renderController = new AbortController();
@@ -5768,11 +6004,14 @@ function preinitModule(href, options) {
5768
6004
  getSsrSuspenseTimeout,
5769
6005
  hookSlots,
5770
6006
  injectStyle,
6007
+ invokeManualHook,
5771
6008
  isChildrenBlock,
5772
6009
  isValidElement,
5773
6010
  lazy,
6011
+ manualHook,
5774
6012
  mapSlot,
5775
6013
  markChildrenBlock,
6014
+ markWarm,
5776
6015
  memo,
5777
6016
  namespaceHead,
5778
6017
  namespaceHeadElement,
@@ -5808,7 +6047,9 @@ function preinitModule(href, options) {
5808
6047
  ssrBlock,
5809
6048
  ssrCheckedAttr,
5810
6049
  ssrChild,
6050
+ ssrChildPre,
5811
6051
  ssrChildText,
6052
+ ssrChildTextPre,
5812
6053
  ssrChildrenSources,
5813
6054
  ssrClass,
5814
6055
  ssrComponent,
@@ -5819,6 +6060,7 @@ function preinitModule(href, options) {
5819
6060
  ssrFormAuthoringDiagnostics,
5820
6061
  ssrFragmentMarker,
5821
6062
  ssrHeadEl,
6063
+ ssrHtml,
5822
6064
  ssrInNamespace,
5823
6065
  ssrInnerHtml,
5824
6066
  ssrInputAttrs,