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.
- package/dist/cjs/compatibility.cjs +35 -0
- package/dist/cjs/component-flags.cjs +8 -1
- package/dist/cjs/dom-tables.cjs +2 -0
- package/dist/cjs/error-codes.client.generated.cjs +15 -2
- package/dist/cjs/error-codes.server.generated.cjs +5 -0
- package/dist/cjs/event-names.cjs +39 -0
- package/dist/cjs/index.cjs +13 -0
- package/dist/cjs/runtime.cjs +1223 -332
- package/dist/cjs/runtime.server.cjs +362 -120
- package/dist/cjs/server/index.cjs +22 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/compatibility.d.ts +7 -0
- package/dist/compatibility.js +10 -0
- package/dist/compiler/bundler.js +13 -30
- package/dist/compiler/compile-renderer-boundaries.js +1 -0
- package/dist/compiler/compile-universal.js +3 -0
- package/dist/compiler/compile.js +619 -99
- package/dist/compiler/hook-deps.js +100 -3
- package/dist/compiler/hook-names.js +1 -0
- package/dist/compiler/manual-hooks.js +171 -0
- package/dist/compiler/plain-hook-memo.js +54 -5
- package/dist/compiler/slot-hooks.d.ts +43 -0
- package/dist/compiler/slot-hooks.js +154 -35
- package/dist/component-flags.d.ts +1 -1
- package/dist/component-flags.js +8 -1
- package/dist/dom-tables.js +2 -0
- package/dist/error-codes.client.generated.d.ts +3 -1
- package/dist/error-codes.client.generated.js +15 -2
- package/dist/error-codes.server.generated.d.ts +1 -0
- package/dist/error-codes.server.generated.js +5 -0
- package/dist/event-names.d.ts +1 -0
- package/dist/event-names.js +15 -0
- package/dist/html-tree-validation.d.ts +17 -34
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -1
- package/dist/jsx-runtime.d.ts +6 -1
- package/dist/public-types.d.ts +188 -0
- package/dist/public-types.js +0 -0
- package/dist/runtime.d.ts +109 -66
- package/dist/runtime.js +1220 -332
- package/dist/runtime.server.d.ts +39 -14
- package/dist/runtime.server.js +356 -120
- package/dist/server/index.d.ts +4 -2
- package/dist/server/index.js +19 -0
- package/dist/static/index.d.ts +2 -1
- package/dist/static/index.js +3 -1
- package/dist/universal-core.d.ts +8 -1
- package/dist/universal-core.js +95 -9
- package/dist/version.js +1 -1
- package/package.json +2 -1
package/dist/runtime.server.js
CHANGED
|
@@ -508,7 +508,9 @@ function fragmentRefDescriptor(value) {
|
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
510
|
function renderFragmentRefDescriptor(descriptor, scope) {
|
|
511
|
-
return
|
|
511
|
+
return ssrHtml(
|
|
512
|
+
ssrFragmentMarker(true, descriptor.ref) + ssrChild(descriptor.children, scope) + ssrFragmentMarker(false)
|
|
513
|
+
);
|
|
512
514
|
}
|
|
513
515
|
function ssrDeoptWrapperKind(value) {
|
|
514
516
|
return POSITIONAL_CHILDREN.has(value) ? "fragment" : "array";
|
|
@@ -805,9 +807,29 @@ const Children = {
|
|
|
805
807
|
}
|
|
806
808
|
};
|
|
807
809
|
function createPortal(body, target, props = void 0) {
|
|
808
|
-
|
|
810
|
+
const key = typeof props === "string" || typeof props === "number" ? String(props) : null;
|
|
811
|
+
return { $$kind: PORTAL_TAG, body, target, key, props: key === null ? props : void 0 };
|
|
809
812
|
}
|
|
810
813
|
const HTML_ESCAPE_RE = /[&<>]/g;
|
|
814
|
+
const SERVER_HTML = /* @__PURE__ */ Symbol.for("octane.serverHtml");
|
|
815
|
+
class ServerHtml {
|
|
816
|
+
[SERVER_HTML];
|
|
817
|
+
constructor(html) {
|
|
818
|
+
this[SERVER_HTML] = html;
|
|
819
|
+
}
|
|
820
|
+
toString() {
|
|
821
|
+
return this[SERVER_HTML];
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
function ssrHtml(html) {
|
|
825
|
+
return typeof html === "string" ? new ServerHtml(html) : html;
|
|
826
|
+
}
|
|
827
|
+
function serverComponentOutput(out, scope) {
|
|
828
|
+
if (out == null) return "";
|
|
829
|
+
if (typeof out === "string") return escapeHtml(out);
|
|
830
|
+
if (typeof out === "object" && SERVER_HTML in out) return out[SERVER_HTML];
|
|
831
|
+
return ssrChild(out, scope);
|
|
832
|
+
}
|
|
811
833
|
function escapeHtml(v) {
|
|
812
834
|
const s = typeof v === "string" ? v : String(v);
|
|
813
835
|
HTML_ESCAPE_RE.lastIndex = 0;
|
|
@@ -852,6 +874,9 @@ function ssrChild(v, scope) {
|
|
|
852
874
|
return ssrChildValue(v, scope, true);
|
|
853
875
|
}
|
|
854
876
|
function ssrChildValue(v, scope, includeKeyedSingle, selfMarkItem = false) {
|
|
877
|
+
if (v !== null && typeof v === "object" && SERVER_HTML in v) {
|
|
878
|
+
return v[SERVER_HTML];
|
|
879
|
+
}
|
|
855
880
|
if (v == null || v === false || v === true) return ssrBlock("");
|
|
856
881
|
if ((typeof v === "object" || typeof v === "function") && (v.$$kind === CONTEXT_TAG || typeof v.then === "function")) {
|
|
857
882
|
return ssrChildValue(
|
|
@@ -903,6 +928,14 @@ function ssrChildText(v, scope) {
|
|
|
903
928
|
if (typeof v === "object" || typeof v === "function") return ssrChild(v, scope);
|
|
904
929
|
return escapeHtml(v);
|
|
905
930
|
}
|
|
931
|
+
function ssrChildTextPre(v, scope) {
|
|
932
|
+
const content = ssrChildText(v, scope);
|
|
933
|
+
return content.charCodeAt(0) === 10 ? "\n" + content : content;
|
|
934
|
+
}
|
|
935
|
+
function ssrChildPre(v, scope) {
|
|
936
|
+
const content = ssrChild(v, scope);
|
|
937
|
+
return content.charCodeAt(0) === 10 ? "\n" + content : content;
|
|
938
|
+
}
|
|
906
939
|
function ssrHostElement(tag, props, children, scope, rawInner) {
|
|
907
940
|
if (!VALID_TAG_NAME.test(tag)) {
|
|
908
941
|
throw new Error(formatServerError(30, tag));
|
|
@@ -977,9 +1010,9 @@ function ssrHostElement(tag, props, children, scope, rawInner) {
|
|
|
977
1010
|
} else if (rawInner !== void 0) {
|
|
978
1011
|
inner = rawInner;
|
|
979
1012
|
} else if (hasChildren) {
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
inner = escapeEntireInlineScriptContent(
|
|
1013
|
+
const rawText = semanticTag === "script" || semanticTag === "style" ? scriptDescriptorText(children) : null;
|
|
1014
|
+
if (rawText !== null) {
|
|
1015
|
+
inner = semanticTag === "script" ? escapeEntireInlineScriptContent(rawText) : escapeEntireInlineStyleContent(rawText);
|
|
983
1016
|
} else {
|
|
984
1017
|
const build = () => ssrInNamespace(
|
|
985
1018
|
childrenNamespace,
|
|
@@ -995,6 +1028,9 @@ function ssrHostElement(tag, props, children, scope, rawInner) {
|
|
|
995
1028
|
inner
|
|
996
1029
|
);
|
|
997
1030
|
}
|
|
1031
|
+
if ((semanticTag === "pre" || semanticTag === "textarea" || semanticTag === "listing") && inner.charCodeAt(0) === 10) {
|
|
1032
|
+
inner = "\n" + inner;
|
|
1033
|
+
}
|
|
998
1034
|
return "<" + tag + attrs + ">" + inner + "</" + tag + ">";
|
|
999
1035
|
} finally {
|
|
1000
1036
|
CURRENT_SSR_ELEMENT = parentElement;
|
|
@@ -1021,6 +1057,7 @@ function ssrDeoptBlockChildren(children, scope) {
|
|
|
1021
1057
|
}
|
|
1022
1058
|
function serverDescNeedsBlocks(v) {
|
|
1023
1059
|
if (v == null || typeof v !== "object") return false;
|
|
1060
|
+
if (v.$$kind === CONTEXT_TAG || typeof v.then === "function") return true;
|
|
1024
1061
|
if (Array.isArray(v)) {
|
|
1025
1062
|
for (let i = 0; i < v.length; i++) if (serverDescNeedsBlocks(v[i])) return true;
|
|
1026
1063
|
return false;
|
|
@@ -1065,6 +1102,7 @@ function ssrDeoptItemContent(value, scope) {
|
|
|
1065
1102
|
}
|
|
1066
1103
|
function ssrDescriptorContent(v, scope) {
|
|
1067
1104
|
if (v == null || v === false || v === true || v === "") return "";
|
|
1105
|
+
if (typeof v === "object" && SERVER_HTML in v) return v[SERVER_HTML];
|
|
1068
1106
|
if (Array.isArray(v)) {
|
|
1069
1107
|
let out = "";
|
|
1070
1108
|
for (let i = 0; i < v.length; i++) out += ssrDescriptorContent(v[i], scope);
|
|
@@ -1082,7 +1120,7 @@ function ssrDescriptorContent(v, scope) {
|
|
|
1082
1120
|
return escapeHtml(v);
|
|
1083
1121
|
}
|
|
1084
1122
|
function ssrBlock(content) {
|
|
1085
|
-
return MARKERS ? BLOCK_OPEN + content + BLOCK_CLOSE : content;
|
|
1123
|
+
return MARKERS ? BLOCK_OPEN + content + BLOCK_CLOSE : String(content);
|
|
1086
1124
|
}
|
|
1087
1125
|
function ssrFragmentMarker(open, _ref) {
|
|
1088
1126
|
return MARKERS ? open ? "<!--frag-->" : "<!--/frag-->" : "";
|
|
@@ -1091,10 +1129,10 @@ function ssrActivity(mode, render) {
|
|
|
1091
1129
|
return ssrBlock(mode === "hidden" ? "" : render());
|
|
1092
1130
|
}
|
|
1093
1131
|
function renderActivityDescriptor(props, scope) {
|
|
1094
|
-
return ssrActivity(props.mode ?? "visible", () => ssrChild(props.children, scope));
|
|
1132
|
+
return ssrHtml(ssrActivity(props.mode ?? "visible", () => ssrChild(props.children, scope)));
|
|
1095
1133
|
}
|
|
1096
1134
|
function ssrForBlock(content, hasItems) {
|
|
1097
|
-
return MARKERS ? (hasItems ? FOR_BLOCK_OPEN_ITEMS : FOR_BLOCK_OPEN_EMPTY) + content + BLOCK_CLOSE : content;
|
|
1135
|
+
return MARKERS ? (hasItems ? FOR_BLOCK_OPEN_ITEMS : FOR_BLOCK_OPEN_EMPTY) + content + BLOCK_CLOSE : String(content);
|
|
1098
1136
|
}
|
|
1099
1137
|
const ASCII_ASYNC_IDENTITY_UNITS = [];
|
|
1100
1138
|
for (let code = 0; code < 128; code++) {
|
|
@@ -1275,10 +1313,10 @@ function ssrAttr(name, v, tag, namespace = "html") {
|
|
|
1275
1313
|
return ' class="' + escapeAttr(normalizeClass(v)) + '"';
|
|
1276
1314
|
}
|
|
1277
1315
|
if (name.charCodeAt(0) === 97 && name.startsWith("aria-")) {
|
|
1278
|
-
if (v == null) return "";
|
|
1316
|
+
if (v == null || typeof v === "function" || typeof v === "symbol") return "";
|
|
1279
1317
|
return " " + name + '="' + escapeAttr(String(v)) + '"';
|
|
1280
1318
|
}
|
|
1281
|
-
if (name === "suppressContentEditableWarning" || name === "suppressHydrationWarning" || name === "suppressNativeChangeWarning" || name === "__octaneNativeChangeDiagnostic")
|
|
1319
|
+
if (name === "innerText" || name === "textContent" || name === "suppressContentEditableWarning" || name === "suppressHydrationWarning" || name === "suppressNativeChangeWarning" || name === "__octaneNativeChangeDiagnostic")
|
|
1282
1320
|
return "";
|
|
1283
1321
|
const t = typeof v;
|
|
1284
1322
|
if (t === "boolean" && isEnumeratedBooleanAttr(name)) {
|
|
@@ -1334,6 +1372,7 @@ function ssrAttr(name, v, tag, namespace = "html") {
|
|
|
1334
1372
|
return "";
|
|
1335
1373
|
}
|
|
1336
1374
|
if (POSITIVE_NUMERIC_ATTR_PROPS.has(lower) && !(Number(v) >= 1)) return "";
|
|
1375
|
+
if ((lower === "rowspan" || lower === "start") && Number.isNaN(Number(v))) return "";
|
|
1337
1376
|
}
|
|
1338
1377
|
if (v == null || v === false) return "";
|
|
1339
1378
|
if (process.env.NODE_ENV !== "production" && !isCustomTag && tag !== void 0 && t === "object" && v.toString === Object.prototype.toString) {
|
|
@@ -1660,7 +1699,7 @@ function ssrFormAuthoringDiagnostics(tag, sources) {
|
|
|
1660
1699
|
return "";
|
|
1661
1700
|
}
|
|
1662
1701
|
function ssrValueAttr(v) {
|
|
1663
|
-
if (v == null) return "";
|
|
1702
|
+
if (v == null || typeof v === "function" || typeof v === "symbol") return "";
|
|
1664
1703
|
return ' value="' + escapeAttr(typeof v === "string" ? v : String(v)) + '"';
|
|
1665
1704
|
}
|
|
1666
1705
|
function ssrCheckedAttr(v) {
|
|
@@ -2141,7 +2180,7 @@ function renderComponentFramed(comp, props, parent, frame, inherit) {
|
|
|
2141
2180
|
ACTIVE_PU_WARM_PLANS.length = warmPlanCheckpoint;
|
|
2142
2181
|
HOOK_PASS = previousHookPass;
|
|
2143
2182
|
}
|
|
2144
|
-
const inner =
|
|
2183
|
+
const inner = serverComponentOutput(out, scope);
|
|
2145
2184
|
nativeCompleted = true;
|
|
2146
2185
|
return MARKERS && !inherit ? BLOCK_OPEN + inner + BLOCK_CLOSE : inner;
|
|
2147
2186
|
} catch (error) {
|
|
@@ -2183,7 +2222,7 @@ function ssrComponent(parent, comp, props, inherit, key, identityScoped) {
|
|
|
2183
2222
|
const kids = props?.children;
|
|
2184
2223
|
if (typeof kids === "function") {
|
|
2185
2224
|
const out = kids(void 0, parent);
|
|
2186
|
-
const inner =
|
|
2225
|
+
const inner = serverComponentOutput(out, parent);
|
|
2187
2226
|
const html2 = ssrHostElement(tag, props, null, parent, inner);
|
|
2188
2227
|
return inherit ? html2 : ssrBlock(html2);
|
|
2189
2228
|
}
|
|
@@ -2239,7 +2278,8 @@ function ssrInNamespace(namespace, render) {
|
|
|
2239
2278
|
}
|
|
2240
2279
|
}
|
|
2241
2280
|
function ssrChildrenHtml(children, scope) {
|
|
2242
|
-
if (typeof children === "function")
|
|
2281
|
+
if (typeof children === "function")
|
|
2282
|
+
return serverComponentOutput(children(void 0, scope), scope);
|
|
2243
2283
|
return ssrChild(children, scope);
|
|
2244
2284
|
}
|
|
2245
2285
|
function streamTokenForPendingHtml(html) {
|
|
@@ -2273,7 +2313,8 @@ const PermanentStaticHydrate = /* @__PURE__ */ markComponentFlags(
|
|
|
2273
2313
|
if (nativeCapture < 0) NATIVE_SERVER_READS = null;
|
|
2274
2314
|
PERMANENT_STATIC_HYDRATE_DEPTH++;
|
|
2275
2315
|
try {
|
|
2276
|
-
if (inheritedPermanentStatic || !MARKERS)
|
|
2316
|
+
if (inheritedPermanentStatic || !MARKERS)
|
|
2317
|
+
return ssrHtml(ssrChildrenHtml(props.children, scope));
|
|
2277
2318
|
const childIdStart = ID_COUNTER;
|
|
2278
2319
|
const serialStart = SERIAL?.length ?? 0;
|
|
2279
2320
|
const children = ssrBlock(
|
|
@@ -2290,7 +2331,9 @@ const PermanentStaticHydrate = /* @__PURE__ */ markComponentFlags(
|
|
|
2290
2331
|
const streamToken = streamTokenForPendingHtml(children);
|
|
2291
2332
|
const markerToken = streamToken === null ? "" : streamToken + ":";
|
|
2292
2333
|
const endToken = streamToken === null ? "" : ":" + streamToken;
|
|
2293
|
-
return
|
|
2334
|
+
return ssrHtml(
|
|
2335
|
+
`<!--${HYDRATE_STATIC_ID_COUNT_PREFIX}${markerToken}${idCount}-->` + children + `<!--${HYDRATE_STATIC_END}${endToken}-->`
|
|
2336
|
+
);
|
|
2294
2337
|
} finally {
|
|
2295
2338
|
finishNativeSeedCapture(nativeCapture, previousNativeReads, false);
|
|
2296
2339
|
PERMANENT_STATIC_HYDRATE_DEPTH--;
|
|
@@ -2302,51 +2345,53 @@ const PermanentStaticHydrate = /* @__PURE__ */ markComponentFlags(
|
|
|
2302
2345
|
const hydrate = /* @__PURE__ */ markComponentFlags(
|
|
2303
2346
|
function Hydrate(props, scope) {
|
|
2304
2347
|
const id = useId();
|
|
2305
|
-
return
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2348
|
+
return ssrHtml(
|
|
2349
|
+
withSsrElementContext(
|
|
2350
|
+
"div",
|
|
2351
|
+
void 0,
|
|
2352
|
+
() => ssrInNamespace("html", () => {
|
|
2353
|
+
if (!MARKERS) {
|
|
2354
|
+
return "<div>" + ssrChildrenHtml(props.children, scope) + "</div>";
|
|
2355
|
+
}
|
|
2356
|
+
const childIdStart = ID_COUNTER;
|
|
2357
|
+
const serialStart = SERIAL?.length ?? 0;
|
|
2358
|
+
const nativeCapture = NATIVE_READ_COLLECTOR?.beginCapture() ?? -1;
|
|
2359
|
+
const previousNativeReads = NATIVE_SERVER_READS;
|
|
2360
|
+
if (nativeCapture < 0) NATIVE_SERVER_READS = null;
|
|
2361
|
+
let children;
|
|
2362
|
+
let nativeReads = null;
|
|
2363
|
+
try {
|
|
2364
|
+
children = ssrBlock(
|
|
2365
|
+
ssrTry(
|
|
2366
|
+
scope,
|
|
2367
|
+
"jsx-hydrate",
|
|
2368
|
+
(_arg, childScope) => ssrChildrenHtml(props.children, childScope),
|
|
2369
|
+
null,
|
|
2370
|
+
null,
|
|
2371
|
+
"html"
|
|
2372
|
+
)
|
|
2373
|
+
);
|
|
2374
|
+
} finally {
|
|
2375
|
+
nativeReads = finishNativeSeedCapture(nativeCapture, previousNativeReads, false);
|
|
2376
|
+
}
|
|
2377
|
+
const idCount = ID_COUNTER - childIdStart;
|
|
2378
|
+
const childSeeds = SERIAL === null ? [] : SERIAL.splice(serialStart);
|
|
2379
|
+
const permanentStaticAncestor = PERMANENT_STATIC_HYDRATE_DEPTH !== 0;
|
|
2380
|
+
const attrs = ssrHydrateAttrs(
|
|
2381
|
+
id,
|
|
2382
|
+
props.when,
|
|
2383
|
+
idCount,
|
|
2384
|
+
permanentStaticAncestor,
|
|
2385
|
+
streamTokenForPendingHtml(children)
|
|
2329
2386
|
);
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
props.when,
|
|
2339
|
-
idCount,
|
|
2340
|
-
permanentStaticAncestor,
|
|
2341
|
-
streamTokenForPendingHtml(children)
|
|
2342
|
-
);
|
|
2343
|
-
const seedJson = permanentStaticAncestor || childSeeds.length === 0 ? null : serializeSuspenseSeedJson(childSeeds);
|
|
2344
|
-
const seedSidecar = seedJson === null || seedJson === "[]" ? "" : '<script type="application/json" ' + HYDRATE_SEED_ATTR + NONCE_ATTR + ">" + seedJson + "</script>";
|
|
2345
|
-
const nativeSeeds = permanentStaticAncestor ? void 0 : NATIVE_READ_COLLECTOR?.serialize(nativeReads);
|
|
2346
|
-
const nativeSidecar = nativeSeeds === void 0 ? "" : serializeNativeSignalSeeds(nativeSeeds, NONCE_ATTR);
|
|
2347
|
-
return "<div" + attrs + ">" + children + seedSidecar + nativeSidecar + "</div>";
|
|
2348
|
-
}),
|
|
2349
|
-
"html"
|
|
2387
|
+
const seedJson = permanentStaticAncestor || childSeeds.length === 0 ? null : serializeSuspenseSeedJson(childSeeds);
|
|
2388
|
+
const seedSidecar = seedJson === null || seedJson === "[]" ? "" : '<script type="application/json" ' + HYDRATE_SEED_ATTR + NONCE_ATTR + ">" + seedJson + "</script>";
|
|
2389
|
+
const nativeSeeds = permanentStaticAncestor ? void 0 : NATIVE_READ_COLLECTOR?.serialize(nativeReads);
|
|
2390
|
+
const nativeSidecar = nativeSeeds === void 0 ? "" : serializeNativeSignalSeeds(nativeSeeds, NONCE_ATTR);
|
|
2391
|
+
return "<div" + attrs + ">" + children + seedSidecar + nativeSidecar + "</div>";
|
|
2392
|
+
}),
|
|
2393
|
+
"html"
|
|
2394
|
+
)
|
|
2350
2395
|
);
|
|
2351
2396
|
},
|
|
2352
2397
|
COMPONENT_FLAG_BOUNDARY,
|
|
@@ -2359,17 +2404,22 @@ function initializeHydrateComponent() {
|
|
|
2359
2404
|
const Hydrate2 = /* @__PURE__ */ initializeHydrateComponent();
|
|
2360
2405
|
const Suspense = /* @__PURE__ */ markComponentFlags(
|
|
2361
2406
|
function Suspense2(props, scope) {
|
|
2362
|
-
return
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2407
|
+
return ssrHtml(
|
|
2408
|
+
ssrTry(
|
|
2409
|
+
scope,
|
|
2410
|
+
"jsx-suspense",
|
|
2411
|
+
(_arg, s) => ssrChildrenHtml(props.children, s),
|
|
2412
|
+
(_arg, s) => ssrChild(props.fallback, s),
|
|
2413
|
+
null,
|
|
2414
|
+
FRAME?.namespace ?? "html",
|
|
2415
|
+
false,
|
|
2416
|
+
true
|
|
2417
|
+
)
|
|
2369
2418
|
);
|
|
2370
2419
|
},
|
|
2371
2420
|
COMPONENT_FLAG_BOUNDARY,
|
|
2372
|
-
"Suspense"
|
|
2421
|
+
"Suspense",
|
|
2422
|
+
/* @__PURE__ */ Symbol.for("octane.suspense")
|
|
2373
2423
|
);
|
|
2374
2424
|
let VT_SSR_TRY_SEQ = 0;
|
|
2375
2425
|
let VT_SSR_HAS_CANDIDATES = false;
|
|
@@ -2482,7 +2532,7 @@ const ViewTransition = /* @__PURE__ */ markComponentFlags(
|
|
|
2482
2532
|
attrs.push(["vt-enter-x", vtSsrResolve(props, "enter")]);
|
|
2483
2533
|
attrs.push(["vt-exit-x", vtSsrResolve(props, "exit")]);
|
|
2484
2534
|
if (named) attrs.push(["vt-share", cand.share]);
|
|
2485
|
-
return ssrBlock(vtSsrAnnotate(inner, attrs));
|
|
2535
|
+
return ssrHtml(ssrBlock(vtSsrAnnotate(inner, attrs)));
|
|
2486
2536
|
},
|
|
2487
2537
|
COMPONENT_FLAG_BOUNDARY,
|
|
2488
2538
|
"ViewTransition"
|
|
@@ -2491,21 +2541,27 @@ function addTransitionType(_type) {
|
|
|
2491
2541
|
}
|
|
2492
2542
|
const ErrorBoundary = /* @__PURE__ */ markComponentFlags(
|
|
2493
2543
|
function ErrorBoundary2(props, scope) {
|
|
2494
|
-
return
|
|
2495
|
-
(
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2544
|
+
return ssrHtml(
|
|
2545
|
+
ssrBlock(
|
|
2546
|
+
(() => {
|
|
2547
|
+
try {
|
|
2548
|
+
return withAsyncIdentity(
|
|
2549
|
+
"error-boundary",
|
|
2550
|
+
"content",
|
|
2551
|
+
() => ssrBlock(ssrChildrenHtml(props.children, scope))
|
|
2552
|
+
);
|
|
2553
|
+
} catch (e) {
|
|
2554
|
+
e = normalizeThrownServerThenable(e);
|
|
2555
|
+
if (ssrIsSuspense(e)) throw e;
|
|
2556
|
+
const fb = typeof props.fallback === "function" ? props.fallback(e, NOOP) : props.fallback;
|
|
2557
|
+
return withAsyncIdentity(
|
|
2558
|
+
"error-boundary",
|
|
2559
|
+
"catch",
|
|
2560
|
+
() => ssrBlock(ssrChild(fb, scope))
|
|
2561
|
+
);
|
|
2562
|
+
}
|
|
2563
|
+
})()
|
|
2564
|
+
)
|
|
2509
2565
|
);
|
|
2510
2566
|
},
|
|
2511
2567
|
COMPONENT_FLAG_BOUNDARY,
|
|
@@ -2514,7 +2570,7 @@ const ErrorBoundary = /* @__PURE__ */ markComponentFlags(
|
|
|
2514
2570
|
const CONTEXT_TAG = /* @__PURE__ */ Symbol.for("octane.context");
|
|
2515
2571
|
function createContext(defaultValue) {
|
|
2516
2572
|
const ctx = function ProviderBody(props, scope) {
|
|
2517
|
-
return renderServerContextProvider(ctx, props, scope);
|
|
2573
|
+
return ssrHtml(renderServerContextProvider(ctx, props, scope));
|
|
2518
2574
|
};
|
|
2519
2575
|
ctx.$$kind = CONTEXT_TAG;
|
|
2520
2576
|
ctx.defaultValue = defaultValue;
|
|
@@ -2542,7 +2598,7 @@ function renderServerContextProvider(context, props, renderScope) {
|
|
|
2542
2598
|
scope.$$ctxValues.set(context, props.value);
|
|
2543
2599
|
const children = props.children;
|
|
2544
2600
|
if (children == null) return "";
|
|
2545
|
-
return
|
|
2601
|
+
return ssrHtml(ssrChildrenHtml(children, scope));
|
|
2546
2602
|
}
|
|
2547
2603
|
function readContext(ctx) {
|
|
2548
2604
|
for (let s = CURRENT_SCOPE; s !== null; s = s.parent) {
|
|
@@ -2737,6 +2793,11 @@ function hasExternalHydrationOwner(thenable) {
|
|
|
2737
2793
|
}
|
|
2738
2794
|
}
|
|
2739
2795
|
function use(usable, siteKey, directSite) {
|
|
2796
|
+
if (process.env.NODE_ENV !== "production" && devMemoComputeDepth !== 0) {
|
|
2797
|
+
console.error(
|
|
2798
|
+
"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."
|
|
2799
|
+
);
|
|
2800
|
+
}
|
|
2740
2801
|
if (usable && usable.$$kind === CONTEXT_TAG) {
|
|
2741
2802
|
recordSkippedHydrationSite(SERIAL, directSite);
|
|
2742
2803
|
return readContext(usable);
|
|
@@ -3119,18 +3180,21 @@ function resolveLazyModule(mod) {
|
|
|
3119
3180
|
}
|
|
3120
3181
|
return comp;
|
|
3121
3182
|
}
|
|
3122
|
-
function callLazyComponent(mod, props, scope, extra) {
|
|
3123
|
-
const comp = resolveLazyModule(mod);
|
|
3124
|
-
return comp(lazyResolvedProps(comp, props), scope, extra);
|
|
3125
|
-
}
|
|
3126
3183
|
function lazy(load) {
|
|
3127
3184
|
let status = "uninitialized";
|
|
3128
3185
|
let result = null;
|
|
3129
3186
|
let promise = null;
|
|
3130
3187
|
const key = "|lazy#" + LAZY_ID++;
|
|
3188
|
+
let displayName;
|
|
3189
|
+
let resolvedName = "Lazy";
|
|
3190
|
+
const callResolved = (props, scope, extra) => {
|
|
3191
|
+
const comp = resolveLazyModule(result);
|
|
3192
|
+
resolvedName = comp.displayName || comp.name || "Lazy";
|
|
3193
|
+
return comp(lazyResolvedProps(comp, props), scope, extra);
|
|
3194
|
+
};
|
|
3131
3195
|
const lazyWrapper = (props, scope, extra) => {
|
|
3132
3196
|
if (status === "fulfilled") {
|
|
3133
|
-
return
|
|
3197
|
+
return callResolved(props, scope, extra);
|
|
3134
3198
|
}
|
|
3135
3199
|
if (status === "rejected") throw result;
|
|
3136
3200
|
if (status === "uninitialized") {
|
|
@@ -3158,7 +3222,7 @@ function lazy(load) {
|
|
|
3158
3222
|
if (status === "uninitialized") status = "pending";
|
|
3159
3223
|
const settledStatus = status;
|
|
3160
3224
|
if (settledStatus === "fulfilled") {
|
|
3161
|
-
return
|
|
3225
|
+
return callResolved(props, scope, extra);
|
|
3162
3226
|
}
|
|
3163
3227
|
if (settledStatus === "rejected") throw result;
|
|
3164
3228
|
}
|
|
@@ -3175,11 +3239,22 @@ function lazy(load) {
|
|
|
3175
3239
|
}
|
|
3176
3240
|
throw SSR_SUSPENSE;
|
|
3177
3241
|
};
|
|
3178
|
-
Object.defineProperty(lazyWrapper, LAZY_COMPONENT, {
|
|
3242
|
+
Object.defineProperty(lazyWrapper, LAZY_COMPONENT, {
|
|
3243
|
+
get() {
|
|
3244
|
+
return this === lazyWrapper;
|
|
3245
|
+
}
|
|
3246
|
+
});
|
|
3247
|
+
Object.defineProperty(lazyWrapper, "displayName", {
|
|
3248
|
+
configurable: true,
|
|
3249
|
+
get: () => displayName ?? resolvedName,
|
|
3250
|
+
set: (value) => {
|
|
3251
|
+
displayName = value;
|
|
3252
|
+
}
|
|
3253
|
+
});
|
|
3179
3254
|
return lazyWrapper;
|
|
3180
3255
|
}
|
|
3181
3256
|
function useState(initial, slot) {
|
|
3182
|
-
if (slot === void 0 && typeof initial === "symbol") {
|
|
3257
|
+
if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && (HOOK_SLOT_PATH.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
|
|
3183
3258
|
slot = initial;
|
|
3184
3259
|
initial = void 0;
|
|
3185
3260
|
}
|
|
@@ -3190,7 +3265,7 @@ function useState(initial, slot) {
|
|
|
3190
3265
|
);
|
|
3191
3266
|
}
|
|
3192
3267
|
function __useStateWithGetter(initial, slot) {
|
|
3193
|
-
if (slot === void 0 && typeof initial === "symbol") {
|
|
3268
|
+
if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && (HOOK_SLOT_PATH.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
|
|
3194
3269
|
slot = initial;
|
|
3195
3270
|
initial = void 0;
|
|
3196
3271
|
}
|
|
@@ -3282,30 +3357,43 @@ const useLayoutEffect = useEffect;
|
|
|
3282
3357
|
const useInsertionEffect = useEffect;
|
|
3283
3358
|
function useImperativeHandle() {
|
|
3284
3359
|
}
|
|
3360
|
+
let devMemoComputeDepth = 0;
|
|
3285
3361
|
function memoHookValue(input, compute, depsOrSlot, maybeSlot) {
|
|
3286
3362
|
const deps = Array.isArray(depsOrSlot) ? depsOrSlot : null;
|
|
3287
3363
|
const slot = maybeSlot ?? (Array.isArray(depsOrSlot) || depsOrSlot === null ? void 0 : depsOrSlot);
|
|
3288
3364
|
if (deps === null) return compute ? input() : input;
|
|
3289
3365
|
const position = hookPosition(slot);
|
|
3290
|
-
if (position === null)
|
|
3366
|
+
if (position === null)
|
|
3367
|
+
return compute ? input(...deps) : input;
|
|
3291
3368
|
let rec = position.list[position.index];
|
|
3292
3369
|
if (rec === void 0) {
|
|
3293
|
-
rec = {
|
|
3370
|
+
rec = {
|
|
3371
|
+
value: compute ? input(...deps) : input,
|
|
3372
|
+
deps: deps.slice()
|
|
3373
|
+
};
|
|
3294
3374
|
position.list[position.index] = rec;
|
|
3295
3375
|
} else if (!serverDepsEqual(rec.deps, deps)) {
|
|
3296
|
-
rec.value = compute ? input() : input;
|
|
3376
|
+
rec.value = compute ? input(...deps) : input;
|
|
3297
3377
|
rec.deps = deps.slice();
|
|
3298
3378
|
}
|
|
3299
3379
|
return rec.value;
|
|
3300
3380
|
}
|
|
3301
3381
|
function useMemo(compute, depsOrSlot, maybeSlot) {
|
|
3382
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3383
|
+
devMemoComputeDepth++;
|
|
3384
|
+
try {
|
|
3385
|
+
return memoHookValue(compute, true, depsOrSlot, maybeSlot);
|
|
3386
|
+
} finally {
|
|
3387
|
+
devMemoComputeDepth--;
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3302
3390
|
return memoHookValue(compute, true, depsOrSlot, maybeSlot);
|
|
3303
3391
|
}
|
|
3304
3392
|
function useCallback(fn, depsOrSlot, maybeSlot) {
|
|
3305
3393
|
return memoHookValue(fn, false, depsOrSlot, maybeSlot);
|
|
3306
3394
|
}
|
|
3307
3395
|
function useRef(initial, slot) {
|
|
3308
|
-
if (slot === void 0 && typeof initial === "symbol") {
|
|
3396
|
+
if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && (HOOK_SLOT_PATH.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
|
|
3309
3397
|
slot = initial;
|
|
3310
3398
|
initial = void 0;
|
|
3311
3399
|
}
|
|
@@ -3345,20 +3433,102 @@ function useActionState(_action, initialState) {
|
|
|
3345
3433
|
return [initialState, NOOP, false];
|
|
3346
3434
|
}
|
|
3347
3435
|
function useFormStatus() {
|
|
3348
|
-
return { pending: false, data: null, method:
|
|
3436
|
+
return { pending: false, data: null, method: null, action: null };
|
|
3349
3437
|
}
|
|
3350
3438
|
function useOptimistic(state) {
|
|
3351
3439
|
return [state, NOOP];
|
|
3352
3440
|
}
|
|
3353
3441
|
function memo(component) {
|
|
3442
|
+
const memoWrapper = (props, scope, extra) => component(props, scope, extra);
|
|
3443
|
+
Object.defineProperty(memoWrapper, "type", { value: component });
|
|
3444
|
+
Object.defineProperty(memoWrapper, "displayName", {
|
|
3445
|
+
configurable: true,
|
|
3446
|
+
writable: true,
|
|
3447
|
+
value: component.displayName || component.name || "Memo"
|
|
3448
|
+
});
|
|
3449
|
+
Object.defineProperty(memoWrapper, "__memo", {
|
|
3450
|
+
get() {
|
|
3451
|
+
return this === memoWrapper;
|
|
3452
|
+
}
|
|
3453
|
+
});
|
|
3454
|
+
Object.defineProperty(memoWrapper, "defaultProps", {
|
|
3455
|
+
configurable: true,
|
|
3456
|
+
get: () => component.defaultProps,
|
|
3457
|
+
set: (value) => {
|
|
3458
|
+
component.defaultProps = value;
|
|
3459
|
+
}
|
|
3460
|
+
});
|
|
3461
|
+
return memoWrapper;
|
|
3462
|
+
}
|
|
3463
|
+
function markWarm(component, plan) {
|
|
3464
|
+
Object.defineProperty(component, "__warm", {
|
|
3465
|
+
configurable: true,
|
|
3466
|
+
get() {
|
|
3467
|
+
return this === component ? plan : void 0;
|
|
3468
|
+
}
|
|
3469
|
+
});
|
|
3354
3470
|
return component;
|
|
3355
3471
|
}
|
|
3472
|
+
let MANUAL_HOOK_DRIVER = null;
|
|
3473
|
+
function invokeManualHook(fn, receiver, args) {
|
|
3474
|
+
const driver = MANUAL_HOOK_DRIVER ??= {
|
|
3475
|
+
pending: HOOK_SLOT_PATH[HOOK_SLOT_PATH.length - 1],
|
|
3476
|
+
active: false
|
|
3477
|
+
};
|
|
3478
|
+
const pending = driver.pending;
|
|
3479
|
+
const active = driver.active;
|
|
3480
|
+
driver.pending = void 0;
|
|
3481
|
+
driver.active = true;
|
|
3482
|
+
try {
|
|
3483
|
+
if (pending === void 0) return Reflect.apply(fn, receiver, args);
|
|
3484
|
+
switch (args.length) {
|
|
3485
|
+
case 0:
|
|
3486
|
+
return fn.call(receiver, pending);
|
|
3487
|
+
case 1:
|
|
3488
|
+
return fn.call(receiver, args[0], pending);
|
|
3489
|
+
case 2:
|
|
3490
|
+
return fn.call(receiver, args[0], args[1], pending);
|
|
3491
|
+
case 3:
|
|
3492
|
+
return fn.call(receiver, args[0], args[1], args[2], pending);
|
|
3493
|
+
case 4:
|
|
3494
|
+
return fn.call(receiver, args[0], args[1], args[2], args[3], pending);
|
|
3495
|
+
default: {
|
|
3496
|
+
const forwarded = new Array(args.length + 1);
|
|
3497
|
+
for (let index = 0; index < args.length; index++) forwarded[index] = args[index];
|
|
3498
|
+
forwarded[args.length] = pending;
|
|
3499
|
+
return fn.apply(receiver, forwarded);
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
} finally {
|
|
3503
|
+
driver.pending = pending;
|
|
3504
|
+
driver.active = active;
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
function manualHook(fn, name) {
|
|
3508
|
+
function provider() {
|
|
3509
|
+
return invokeManualHook(fn, this, arguments);
|
|
3510
|
+
}
|
|
3511
|
+
Object.defineProperty(provider, "name", { value: name ?? fn.name, configurable: true });
|
|
3512
|
+
Object.defineProperty(provider, "length", { value: fn.length, configurable: true });
|
|
3513
|
+
return provider;
|
|
3514
|
+
}
|
|
3356
3515
|
function withSlot(sym, fn, ...args) {
|
|
3516
|
+
const driver = MANUAL_HOOK_DRIVER;
|
|
3517
|
+
const pending = driver?.pending;
|
|
3518
|
+
const active = driver?.active ?? false;
|
|
3519
|
+
if (driver !== null) {
|
|
3520
|
+
driver.pending = sym;
|
|
3521
|
+
driver.active = false;
|
|
3522
|
+
}
|
|
3357
3523
|
HOOK_SLOT_PATH.push(sym);
|
|
3358
3524
|
try {
|
|
3359
3525
|
return fn(...args);
|
|
3360
3526
|
} finally {
|
|
3361
3527
|
HOOK_SLOT_PATH.pop();
|
|
3528
|
+
if (MANUAL_HOOK_DRIVER !== null) {
|
|
3529
|
+
MANUAL_HOOK_DRIVER.pending = driver === null ? HOOK_SLOT_PATH[HOOK_SLOT_PATH.length - 1] : pending;
|
|
3530
|
+
MANUAL_HOOK_DRIVER.active = active;
|
|
3531
|
+
}
|
|
3362
3532
|
}
|
|
3363
3533
|
}
|
|
3364
3534
|
function startTransition(fn) {
|
|
@@ -3435,11 +3605,20 @@ function namespaceHeadElement(headKey, tag, attrs, text, authoredKey) {
|
|
|
3435
3605
|
return createElement(namespaceHead, config);
|
|
3436
3606
|
}
|
|
3437
3607
|
function spliceHead(body, head) {
|
|
3438
|
-
if (head === "") return body;
|
|
3608
|
+
if (head === "" && !isDocumentRoot(body)) return body;
|
|
3439
3609
|
const headClose = body.indexOf("</head>");
|
|
3440
3610
|
if (headClose !== -1) return body.slice(0, headClose) + head + body.slice(headClose);
|
|
3611
|
+
if (isDocumentRoot(body)) {
|
|
3612
|
+
const openingEnd = documentTagEnd(body, body.indexOf("<html") + 5);
|
|
3613
|
+
if (openingEnd !== -1)
|
|
3614
|
+
return body.slice(0, openingEnd) + "<head>" + head + "</head>" + body.slice(openingEnd);
|
|
3615
|
+
}
|
|
3616
|
+
if (head === "") return body;
|
|
3441
3617
|
return head + body;
|
|
3442
3618
|
}
|
|
3619
|
+
function renderEntryValue(props, scope) {
|
|
3620
|
+
return ssrHtml(ssrChild(props.value, scope));
|
|
3621
|
+
}
|
|
3443
3622
|
const MAX_SUSPENSE_PASSES = 50;
|
|
3444
3623
|
let SUSPENSE_TIMEOUT_MS = 1e4;
|
|
3445
3624
|
function setSsrSuspenseTimeout(ms) {
|
|
@@ -3706,7 +3885,7 @@ function runFullFramedPass(component, props, resolved, nonceAttr = "", identifie
|
|
|
3706
3885
|
const nativeToken = NATIVE_READ_COLLECTOR === null ? -1 : beginActiveNativeReadScope(root);
|
|
3707
3886
|
try {
|
|
3708
3887
|
const out = invokeComponentBody(component, props, root, FRAME);
|
|
3709
|
-
body =
|
|
3888
|
+
body = serverComponentOutput(out, root);
|
|
3710
3889
|
nativePassCompleted = true;
|
|
3711
3890
|
} catch (err) {
|
|
3712
3891
|
err = normalizeThrownServerThenable(err);
|
|
@@ -3722,6 +3901,14 @@ function runFullFramedPass(component, props, resolved, nonceAttr = "", identifie
|
|
|
3722
3901
|
restoreAmbient(saved);
|
|
3723
3902
|
}
|
|
3724
3903
|
}
|
|
3904
|
+
if (resolved.bufferedErrors !== void 0) {
|
|
3905
|
+
for (const report of resolved.bufferedErrors.values()) {
|
|
3906
|
+
if (!report.reported) {
|
|
3907
|
+
report.reported = true;
|
|
3908
|
+
resolved.resourceOptions?.onError?.(report.error);
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3725
3912
|
let css = "";
|
|
3726
3913
|
for (const [hash, sheet] of cssMap) {
|
|
3727
3914
|
css += '<style data-octane="' + hash + '"' + (sheet.nonce === void 0 ? nonceAttr : ' nonce="' + escapeAttr(sheet.nonce) + '"') + ">" + escapeEntireInlineStyleContent(sheet.css) + "</style>";
|
|
@@ -3999,7 +4186,11 @@ function passToResult(pass, nonceAttr, separateHead = false) {
|
|
|
3999
4186
|
return result;
|
|
4000
4187
|
}
|
|
4001
4188
|
async function prerender(entryComponent, props, options) {
|
|
4002
|
-
const component = entryComponent;
|
|
4189
|
+
const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
|
|
4190
|
+
if (typeof entryComponent !== "function") {
|
|
4191
|
+
options ??= props;
|
|
4192
|
+
props = { value: entryComponent };
|
|
4193
|
+
}
|
|
4003
4194
|
const nonceAttr = nonceAttrOf(options);
|
|
4004
4195
|
const resolved = newResolvedMap(options ?? null);
|
|
4005
4196
|
try {
|
|
@@ -4013,6 +4204,10 @@ async function prerender(entryComponent, props, options) {
|
|
|
4013
4204
|
}
|
|
4014
4205
|
}
|
|
4015
4206
|
async function prerenderToNodeStream(entryComponent, props, options) {
|
|
4207
|
+
if (typeof entryComponent !== "function" && options === void 0) {
|
|
4208
|
+
options = props;
|
|
4209
|
+
props = void 0;
|
|
4210
|
+
}
|
|
4016
4211
|
let resolved = options;
|
|
4017
4212
|
if (options?.headChannel === "separate") {
|
|
4018
4213
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -4097,7 +4292,11 @@ function renderHostedAttempt(session, component, props, options) {
|
|
|
4097
4292
|
return { status: "complete", html: body, head: pass.head, cssEntries: pass.cssEntries };
|
|
4098
4293
|
}
|
|
4099
4294
|
function renderToString(entryComponent, props, options) {
|
|
4100
|
-
const component = entryComponent;
|
|
4295
|
+
const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
|
|
4296
|
+
if (typeof entryComponent !== "function") {
|
|
4297
|
+
options ??= props;
|
|
4298
|
+
props = { value: entryComponent };
|
|
4299
|
+
}
|
|
4101
4300
|
options?.signal?.throwIfAborted();
|
|
4102
4301
|
const nonceAttr = nonceAttrOf(options);
|
|
4103
4302
|
const resolved = newResolvedMap(options ?? null);
|
|
@@ -4107,6 +4306,7 @@ function renderToString(entryComponent, props, options) {
|
|
|
4107
4306
|
null,
|
|
4108
4307
|
() => runFullFramedPass(component, props, resolved, nonceAttr, options?.identifierPrefix ?? "")
|
|
4109
4308
|
);
|
|
4309
|
+
if (pass.rootSuspended) throw new Error(formatServerError(60));
|
|
4110
4310
|
} catch (err) {
|
|
4111
4311
|
options?.onError?.(err);
|
|
4112
4312
|
throw err;
|
|
@@ -4116,7 +4316,11 @@ function renderToString(entryComponent, props, options) {
|
|
|
4116
4316
|
return passToResult(pass, nonceAttr, options?.headChannel === "separate");
|
|
4117
4317
|
}
|
|
4118
4318
|
function renderToStaticMarkup(entryComponent, props, options) {
|
|
4119
|
-
const component = entryComponent;
|
|
4319
|
+
const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
|
|
4320
|
+
if (typeof entryComponent !== "function") {
|
|
4321
|
+
options ??= props;
|
|
4322
|
+
props = { value: entryComponent };
|
|
4323
|
+
}
|
|
4120
4324
|
options?.signal?.throwIfAborted();
|
|
4121
4325
|
const nonceAttr = nonceAttrOf(options);
|
|
4122
4326
|
const resolved = newResolvedMap(options ?? null);
|
|
@@ -4133,6 +4337,7 @@ function renderToStaticMarkup(entryComponent, props, options) {
|
|
|
4133
4337
|
false
|
|
4134
4338
|
)
|
|
4135
4339
|
);
|
|
4340
|
+
if (pass.rootSuspended) throw new Error(formatServerError(60));
|
|
4136
4341
|
} catch (err) {
|
|
4137
4342
|
options?.onError?.(err);
|
|
4138
4343
|
throw err;
|
|
@@ -4226,7 +4431,7 @@ function pruneStreamBoundariesAbsentFromShell(stream, shellBoundaryKeys) {
|
|
|
4226
4431
|
if (!shellBoundaryKeys.has(key)) stream.boundaries.delete(key);
|
|
4227
4432
|
}
|
|
4228
4433
|
}
|
|
4229
|
-
function ssrTry(scope, siteKey, tryFn, pendFn, catchFn, namespace = FRAME?.namespace ?? "html", propagateSuspense = false) {
|
|
4434
|
+
function ssrTry(scope, siteKey, tryFn, pendFn, catchFn, namespace = FRAME?.namespace ?? "html", propagateSuspense = false, recoverErrors = false) {
|
|
4230
4435
|
VT_SSR_TRY_SEQ++;
|
|
4231
4436
|
let vtOuter = null;
|
|
4232
4437
|
if (VT_SSR_STACK.length > 0) {
|
|
@@ -4579,6 +4784,13 @@ function ssrTry(scope, siteKey, tryFn, pendFn, catchFn, namespace = FRAME?.names
|
|
|
4579
4784
|
pruneUnrepresentedStreamDescendants(stream, key, fallback);
|
|
4580
4785
|
return fallback;
|
|
4581
4786
|
}
|
|
4787
|
+
if (recoverErrors && pendFn !== null && PERMANENT_STATIC_HYDRATE_DEPTH === 0) {
|
|
4788
|
+
if (SERIAL !== null) SERIAL.length = serialStart;
|
|
4789
|
+
const reports = RESOLVED?.bufferedErrors ?? (RESOLVED.bufferedErrors = /* @__PURE__ */ new Map());
|
|
4790
|
+
if (!reports.has(key)) reports.set(key, { error: e, reported: false });
|
|
4791
|
+
nativeFresh = true;
|
|
4792
|
+
return pendingForm();
|
|
4793
|
+
}
|
|
4582
4794
|
throw e;
|
|
4583
4795
|
}
|
|
4584
4796
|
} finally {
|
|
@@ -4620,19 +4832,22 @@ function documentHeadInsertionPoint(body) {
|
|
|
4620
4832
|
const next = body.charCodeAt(start + 5);
|
|
4621
4833
|
if (next === 62) return start + 6;
|
|
4622
4834
|
if (next === 32 || next === 9 || next === 10 || next === 13) {
|
|
4623
|
-
|
|
4624
|
-
for (let i = start + 6; i < body.length; i++) {
|
|
4625
|
-
const code = body.charCodeAt(i);
|
|
4626
|
-
if (quote !== 0) {
|
|
4627
|
-
if (code === quote) quote = 0;
|
|
4628
|
-
} else if (code === 34 || code === 39) quote = code;
|
|
4629
|
-
else if (code === 62) return i + 1;
|
|
4630
|
-
}
|
|
4631
|
-
return -1;
|
|
4835
|
+
return documentTagEnd(body, start + 6);
|
|
4632
4836
|
}
|
|
4633
4837
|
searchFrom = start + 5;
|
|
4634
4838
|
}
|
|
4635
4839
|
}
|
|
4840
|
+
function documentTagEnd(body, from) {
|
|
4841
|
+
let quote = 0;
|
|
4842
|
+
for (let i = from; i < body.length; i++) {
|
|
4843
|
+
const code = body.charCodeAt(i);
|
|
4844
|
+
if (quote !== 0) {
|
|
4845
|
+
if (code === quote) quote = 0;
|
|
4846
|
+
} else if (code === 34 || code === 39) quote = code;
|
|
4847
|
+
else if (code === 62) return i + 1;
|
|
4848
|
+
}
|
|
4849
|
+
return -1;
|
|
4850
|
+
}
|
|
4636
4851
|
function segmentChunk(b, nonceAttr) {
|
|
4637
4852
|
let seedScript = "";
|
|
4638
4853
|
if (b.seeds.length > 0) {
|
|
@@ -4846,14 +5061,14 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
4846
5061
|
const tailStart = documentTailStart(pass.body);
|
|
4847
5062
|
if (tailStart !== -1) {
|
|
4848
5063
|
heldDocumentTail = pass.body.slice(tailStart);
|
|
4849
|
-
const bodyHtml = pass.body.slice(0, tailStart);
|
|
5064
|
+
const bodyHtml = spliceHead(pass.body.slice(0, tailStart), "");
|
|
4850
5065
|
const headInsert = documentHeadInsertionPoint(bodyHtml);
|
|
4851
5066
|
shell += headInsert !== -1 ? bodyHtml.slice(0, headInsert) + leadingStyles + shellHead + bodyHtml.slice(headInsert) : leadingStyles + shellHead + bodyHtml;
|
|
4852
5067
|
} else {
|
|
4853
|
-
shell += leadingStyles + shellHead
|
|
5068
|
+
shell += spliceHead(pass.body, leadingStyles + shellHead);
|
|
4854
5069
|
}
|
|
4855
5070
|
} else {
|
|
4856
|
-
shell += leadingStyles + shellHead + pass.body;
|
|
5071
|
+
shell += documentRoot ? spliceHead(pass.body, leadingStyles + shellHead) : leadingStyles + shellHead + pass.body;
|
|
4857
5072
|
}
|
|
4858
5073
|
if (pass.serial.length > 0) shell += serializeSuspenseSeeds(pass.serial, nonceAttr);
|
|
4859
5074
|
if (pass.signals !== void 0) shell += serializeNativeSignalSeeds(pass.signals, nonceAttr);
|
|
@@ -5027,7 +5242,11 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
5027
5242
|
sink.allReady();
|
|
5028
5243
|
}
|
|
5029
5244
|
function renderToPipeableStream(entryComponent, props, options) {
|
|
5030
|
-
const component = entryComponent;
|
|
5245
|
+
const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
|
|
5246
|
+
if (typeof entryComponent !== "function") {
|
|
5247
|
+
options ??= props;
|
|
5248
|
+
props = { value: entryComponent };
|
|
5249
|
+
}
|
|
5031
5250
|
const controller = new AbortController();
|
|
5032
5251
|
let removeOuterAbort;
|
|
5033
5252
|
if (options?.signal) {
|
|
@@ -5046,6 +5265,7 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5046
5265
|
let endCalled = false;
|
|
5047
5266
|
let pipeCalled = false;
|
|
5048
5267
|
let writeGate = null;
|
|
5268
|
+
let shellFailure = null;
|
|
5049
5269
|
const destinationFailure = (reason) => {
|
|
5050
5270
|
if (closed) return;
|
|
5051
5271
|
closed = true;
|
|
@@ -5059,6 +5279,11 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5059
5279
|
if (!ended || destination === null || writeGate !== null || endCalled || closed) return;
|
|
5060
5280
|
endCalled = true;
|
|
5061
5281
|
try {
|
|
5282
|
+
if (shellFailure !== null && destination.destroy !== void 0) {
|
|
5283
|
+
closed = true;
|
|
5284
|
+
destination.destroy(shellFailure.error);
|
|
5285
|
+
return;
|
|
5286
|
+
}
|
|
5062
5287
|
destination.end();
|
|
5063
5288
|
} catch (err) {
|
|
5064
5289
|
destinationFailure(err);
|
|
@@ -5175,6 +5400,7 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5175
5400
|
},
|
|
5176
5401
|
shellError(err) {
|
|
5177
5402
|
releaseServerRenderResources(resolved);
|
|
5403
|
+
shellFailure = { error: err };
|
|
5178
5404
|
options?.onShellError?.(err);
|
|
5179
5405
|
flushEnd();
|
|
5180
5406
|
},
|
|
@@ -5223,7 +5449,11 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5223
5449
|
};
|
|
5224
5450
|
}
|
|
5225
5451
|
function renderToReadableStream(entryComponent, props, options) {
|
|
5226
|
-
const component = entryComponent;
|
|
5452
|
+
const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
|
|
5453
|
+
if (typeof entryComponent !== "function") {
|
|
5454
|
+
options ??= props;
|
|
5455
|
+
props = { value: entryComponent };
|
|
5456
|
+
}
|
|
5227
5457
|
return new Promise((resolveShell, rejectShell) => {
|
|
5228
5458
|
const encoder = new TextEncoder();
|
|
5229
5459
|
const renderController = new AbortController();
|
|
@@ -5672,11 +5902,14 @@ export {
|
|
|
5672
5902
|
getSsrSuspenseTimeout,
|
|
5673
5903
|
hookSlots,
|
|
5674
5904
|
injectStyle,
|
|
5905
|
+
invokeManualHook,
|
|
5675
5906
|
isChildrenBlock,
|
|
5676
5907
|
isValidElement,
|
|
5677
5908
|
lazy,
|
|
5909
|
+
manualHook,
|
|
5678
5910
|
mapSlot,
|
|
5679
5911
|
markChildrenBlock,
|
|
5912
|
+
markWarm,
|
|
5680
5913
|
memo,
|
|
5681
5914
|
namespaceHead,
|
|
5682
5915
|
namespaceHeadElement,
|
|
@@ -5712,7 +5945,9 @@ export {
|
|
|
5712
5945
|
ssrBlock,
|
|
5713
5946
|
ssrCheckedAttr,
|
|
5714
5947
|
ssrChild,
|
|
5948
|
+
ssrChildPre,
|
|
5715
5949
|
ssrChildText,
|
|
5950
|
+
ssrChildTextPre,
|
|
5716
5951
|
ssrChildrenSources,
|
|
5717
5952
|
ssrClass,
|
|
5718
5953
|
ssrComponent,
|
|
@@ -5723,6 +5958,7 @@ export {
|
|
|
5723
5958
|
ssrFormAuthoringDiagnostics,
|
|
5724
5959
|
ssrFragmentMarker,
|
|
5725
5960
|
ssrHeadEl,
|
|
5961
|
+
ssrHtml,
|
|
5726
5962
|
ssrInNamespace,
|
|
5727
5963
|
ssrInnerHtml,
|
|
5728
5964
|
ssrInputAttrs,
|