@solidjs/web 2.0.0-rc.14 → 2.0.0-rc.16
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/README.md +1 -1
- package/dist/server.dev.js +475 -591
- package/dist/server.js +459 -489
- package/dist/server.observe.js +459 -498
- package/dist/web.dev.js +206 -220
- package/dist/web.js +196 -208
- package/dist/web.observe.js +206 -213
- package/frames/dist/client.dev.js +664 -643
- package/frames/dist/client.js +593 -582
- package/frames/dist/client.observe.js +624 -589
- package/frames/dist/regions.js +43 -2
- package/frames/dist/server.dev.js +578 -450
- package/frames/dist/server.js +578 -397
- package/frames/dist/server.observe.js +578 -397
- package/frames/dist/trace.js +4 -1
- package/frames/dist/wire.js +371 -6
- package/package.json +13 -13
- package/serialization/dist/decode.js +11 -9
- package/serialization/dist/serialization.js +11 -9
- package/serialization/types/serializer-decode.d.ts +2 -2
- package/server-functions/dist/client.dev.js +5 -2
- package/server-functions/dist/client.js +3 -2
- package/server-functions/dist/client.observe.js +5 -2
- package/server-functions/dist/rich-args.js +33 -1
- package/server-functions/dist/server.dev.js +218 -35
- package/server-functions/dist/server.js +218 -35
- package/server-functions/dist/server.observe.js +218 -35
- package/skills/server-components/SKILL.md +74 -185
- package/types/client.d.ts +112 -10
- package/types/constants.d.ts +2 -1
- package/types/frames/assets-tier.d.ts +2 -2
- package/types/frames/client.d.ts +8 -3
- package/types/frames/frame-client.d.ts +121 -157
- package/types/frames/frame-morph.d.ts +28 -0
- package/types/frames/frame-sink.d.ts +13 -9
- package/types/frames/frame-transport.d.ts +30 -1
- package/types/frames/regions-tier.d.ts +15 -0
- package/types/frames/serializer-decode.d.ts +2 -2
- package/types/frames/server.d.ts +1 -53
- package/types/frames/wire-tier.d.ts +54 -1
- package/types/head.d.ts +1 -0
- package/types/index.d.ts +57 -50
- package/types/index.server.d.ts +3 -27
- package/types/jsx.d.ts +14 -17
- package/types/observe.d.ts +14 -7
- package/types/render.d.ts +3 -1
- package/types/response.d.ts +31 -8
- package/types/serializer-decode.d.ts +2 -2
- package/types/server-functions/argument-codec.d.ts +21 -0
- package/types/server-functions/client.d.ts +18 -5
- package/types/server-functions/server.d.ts +6 -2
- package/types/server-functions/shared.d.ts +19 -0
- package/types/server-mock.d.ts +9 -2
- package/types/server-observe.d.ts +3 -2
- package/types/server.d.ts +124 -67
- package/frames/dist/bind.dev.js +0 -326
- package/frames/dist/bind.js +0 -295
- package/types/frames/bind-tier.d.ts +0 -60
package/dist/server.observe.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import { sharedConfig, ssrSanitizeError, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
|
-
export { ssrScope as scope
|
|
1
|
+
import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
+
import { sharedConfig, ssrSanitizeError, beginEdgesRender, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
|
+
export { ssrScope as scope } from 'solid-js/internal';
|
|
5
5
|
import { createStream, Serializer, getCrossReferenceHeader, Feature } from 'seroval';
|
|
6
6
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
7
7
|
|
|
@@ -34,6 +34,7 @@ const DOMWithState = {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
37
|
+
const LinkAttributes = /*#__PURE__*/new Set(["href", "target", "rel", "download", "link", "aria-current"]);
|
|
37
38
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
38
39
|
const SVGElements = /*#__PURE__*/new Set([
|
|
39
40
|
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
@@ -116,11 +117,9 @@ function parseTraceparent(value) {
|
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
119
|
function randomHex(bytes) {
|
|
119
|
-
const buffer = new Uint8Array(bytes);
|
|
120
|
-
crypto.getRandomValues(buffer);
|
|
121
120
|
let out = "";
|
|
122
|
-
for (let i = 0; i <
|
|
123
|
-
return out;
|
|
121
|
+
for (let i = 0; i < bytes; i += 4) out += (Math.random() * 0x100000000 >>> 0).toString(16).padStart(8, "0");
|
|
122
|
+
return out.length === bytes * 2 ? out : out.slice(0, bytes * 2);
|
|
124
123
|
}
|
|
125
124
|
function randomTraceId() {
|
|
126
125
|
let id = randomHex(16);
|
|
@@ -457,9 +456,7 @@ function toBorderForm(value, envelopeContainers) {
|
|
|
457
456
|
}
|
|
458
457
|
function isShareableIterable(value) {
|
|
459
458
|
try {
|
|
460
|
-
|
|
461
|
-
if (typeof ReadableStream !== "undefined" && value instanceof ReadableStream) return false;
|
|
462
|
-
return typeof value[Symbol.asyncIterator] === "function";
|
|
459
|
+
return typeof value[Symbol.asyncIterator] === "function" && !(typeof ReadableStream !== "undefined" && value instanceof ReadableStream);
|
|
463
460
|
} catch {
|
|
464
461
|
return false;
|
|
465
462
|
}
|
|
@@ -564,17 +561,24 @@ function getLocalHeaderScript(id) {
|
|
|
564
561
|
}
|
|
565
562
|
|
|
566
563
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
567
|
-
|
|
568
|
-
const ResponseEnvelope =
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
564
|
+
let EnvelopeClass;
|
|
565
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
566
|
+
if (!EnvelopeClass) {
|
|
567
|
+
EnvelopeClass = class extends Response {
|
|
568
|
+
constructor(response, value) {
|
|
569
|
+
super(response ? response.body : null, response && {
|
|
570
|
+
status: response.status,
|
|
571
|
+
statusText: response.statusText,
|
|
572
|
+
headers: copyHeaders(response.headers)
|
|
573
|
+
});
|
|
574
|
+
this.response = response ? this : undefined;
|
|
575
|
+
this.value = value;
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
574
579
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
})();
|
|
580
|
+
return new EnvelopeClass(response, value);
|
|
581
|
+
};
|
|
578
582
|
function isResponseEnvelope(value) {
|
|
579
583
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
580
584
|
}
|
|
@@ -599,6 +603,16 @@ function isSafeError(value) {
|
|
|
599
603
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
600
604
|
const REVALIDATE_ALL = "*";
|
|
601
605
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
606
|
+
function copyHeaders(init) {
|
|
607
|
+
const source = init;
|
|
608
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
609
|
+
const headers = new Headers();
|
|
610
|
+
source.forEach((value, key) => {
|
|
611
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
612
|
+
});
|
|
613
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
614
|
+
return headers;
|
|
615
|
+
}
|
|
602
616
|
function initWithRevalidate(init = {}) {
|
|
603
617
|
const resolved = typeof init === "number" ? {
|
|
604
618
|
status: init
|
|
@@ -607,18 +621,7 @@ function initWithRevalidate(init = {}) {
|
|
|
607
621
|
revalidate,
|
|
608
622
|
...responseInit
|
|
609
623
|
} = resolved;
|
|
610
|
-
|
|
611
|
-
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
612
|
-
headers = new Headers();
|
|
613
|
-
responseInit.headers.forEach((value, key) => {
|
|
614
|
-
if (key !== "set-cookie") headers.append(key, value);
|
|
615
|
-
});
|
|
616
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
617
|
-
headers.append("Set-Cookie", cookie);
|
|
618
|
-
}
|
|
619
|
-
} else {
|
|
620
|
-
headers = new Headers(responseInit.headers);
|
|
621
|
-
}
|
|
624
|
+
const headers = copyHeaders(responseInit.headers);
|
|
622
625
|
if (revalidate !== undefined) {
|
|
623
626
|
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
624
627
|
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
@@ -682,7 +685,12 @@ function respond(value, init = {}) {
|
|
|
682
685
|
}), value);
|
|
683
686
|
}
|
|
684
687
|
headers.set("Content-Type", "application/json");
|
|
685
|
-
return new ResponseEnvelope(new Response(
|
|
688
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
689
|
+
pull(controller) {
|
|
690
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
691
|
+
controller.close();
|
|
692
|
+
}
|
|
693
|
+
}), {
|
|
686
694
|
...responseInit,
|
|
687
695
|
headers
|
|
688
696
|
}), value);
|
|
@@ -807,6 +815,10 @@ function qualifierValue(name, value) {
|
|
|
807
815
|
function asciiLowerCase(value) {
|
|
808
816
|
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
809
817
|
}
|
|
818
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
819
|
+
function headBodyText(tag, props, text) {
|
|
820
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
821
|
+
}
|
|
810
822
|
function resourceIdentity(tag, props) {
|
|
811
823
|
const url = String(props.href || props.src || "");
|
|
812
824
|
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
@@ -1391,6 +1403,7 @@ function renderShellHead(registry, nonce, isPendingFragment, noScripts, traceMet
|
|
|
1391
1403
|
noScripts
|
|
1392
1404
|
};
|
|
1393
1405
|
}
|
|
1406
|
+
let headBodyHook;
|
|
1394
1407
|
function flushHeadFragment(registry, boundary, nonce) {
|
|
1395
1408
|
const groups = commitHeadBoundary(registry, boundary);
|
|
1396
1409
|
if (!groups.length) return null;
|
|
@@ -1428,7 +1441,7 @@ function flushHeadFragment(registry, boundary, nonce) {
|
|
|
1428
1441
|
if (value) attrs.nonce = String(value);
|
|
1429
1442
|
}
|
|
1430
1443
|
const children = t.props.children;
|
|
1431
|
-
ops.push(["a", identity, t.tag, attrs, children == null ? null : String(children)]);
|
|
1444
|
+
ops.push(["a", identity, t.tag, attrs, children == null ? null : headBodyHook ? headBodyHook(t.tag, t.props, String(children)) : String(children)]);
|
|
1432
1445
|
}
|
|
1433
1446
|
}
|
|
1434
1447
|
return ops.length ? ops : null;
|
|
@@ -1456,16 +1469,9 @@ function normalizeNonce(nonce) {
|
|
|
1456
1469
|
}
|
|
1457
1470
|
function destinationNonce(nonce, destination) {
|
|
1458
1471
|
if (nonce == null) return undefined;
|
|
1459
|
-
|
|
1460
|
-
const value = nonce[destination];
|
|
1472
|
+
const value = typeof nonce === "string" ? nonce : nonce[destination];
|
|
1461
1473
|
return typeof value === "string" && value ? value : undefined;
|
|
1462
1474
|
}
|
|
1463
|
-
function scriptNonce(nonce) {
|
|
1464
|
-
return destinationNonce(nonce, "script");
|
|
1465
|
-
}
|
|
1466
|
-
function styleNonce(nonce) {
|
|
1467
|
-
return destinationNonce(nonce, "style");
|
|
1468
|
-
}
|
|
1469
1475
|
function hasNonceProp(props) {
|
|
1470
1476
|
for (const name in props) if (name.length === 5 && asciiLowerCase(name) === "nonce" && props[name] != null) return true;
|
|
1471
1477
|
return false;
|
|
@@ -1531,6 +1537,7 @@ function renderHeadTagMarkup(tag, props, identity, nonce) {
|
|
|
1531
1537
|
if (nonce && !hasNonceProp(props)) attrs += nonceAttr(nonce, nonceDestination(tag, props));
|
|
1532
1538
|
if (tag === "meta" || tag === "link" || tag === "base") return `<${tag}${attrs}>`;
|
|
1533
1539
|
let body = props.children == null ? "" : String(props.children);
|
|
1540
|
+
if (headBodyHook) body = headBodyHook(tag, props, body);
|
|
1534
1541
|
if (tag === "script") body = body.replace(/<\/(script)/gi, "<\\/$1");else if (tag === "style") body = escapeStyleContent(body);else body = escape(body);
|
|
1535
1542
|
return `<${tag}${attrs}>${body}</${tag}>`;
|
|
1536
1543
|
}
|
|
@@ -1539,6 +1546,7 @@ function useHead(tags) {
|
|
|
1539
1546
|
if (!ctx || !ctx.registerHeadTags) {
|
|
1540
1547
|
return;
|
|
1541
1548
|
}
|
|
1549
|
+
headBodyHook = headBodyText;
|
|
1542
1550
|
ctx.registerHeadTags(tags);
|
|
1543
1551
|
}
|
|
1544
1552
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
@@ -1549,12 +1557,27 @@ function tagInfo(tag) {
|
|
|
1549
1557
|
let info = tagInfos.get(tag);
|
|
1550
1558
|
if (info === undefined) {
|
|
1551
1559
|
if (!TAG_START.test(tag) || NOT_NAME.test(tag)) throw new Error(`"${tag}" is not a valid tag name`);
|
|
1560
|
+
let formDefaults, formAttributes;
|
|
1561
|
+
if (tag === "input" || tag === "option") {
|
|
1562
|
+
formDefaults = Object.create(null);
|
|
1563
|
+
formAttributes = Object.create(null);
|
|
1564
|
+
const state = DOMWithState[tag.toUpperCase()];
|
|
1565
|
+
for (const prop in state) {
|
|
1566
|
+
if (state[prop] === 2) {
|
|
1567
|
+
const attr = prop.slice(7).toLowerCase();
|
|
1568
|
+
formDefaults[attr] = prop;
|
|
1569
|
+
formAttributes[prop] = attr;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1552
1573
|
info = {
|
|
1553
1574
|
open: "<" + tag,
|
|
1554
1575
|
close: "</" + tag + ">",
|
|
1555
1576
|
isVoid: VOID_ELEMENTS.test(tag),
|
|
1556
1577
|
textarea: tag === "textarea",
|
|
1557
|
-
raw: tag === "script" || tag === "style"
|
|
1578
|
+
raw: tag === "script" || tag === "style",
|
|
1579
|
+
formDefaults,
|
|
1580
|
+
formAttributes
|
|
1558
1581
|
};
|
|
1559
1582
|
if (tagInfos.size < 512) tagInfos.set(tag, info);
|
|
1560
1583
|
}
|
|
@@ -1577,6 +1600,8 @@ function renderToString(code, options = {}) {
|
|
|
1577
1600
|
onHead
|
|
1578
1601
|
} = options;
|
|
1579
1602
|
const nonce = normalizeNonce(options.nonce);
|
|
1603
|
+
const requestEvent = peekRequestEvent();
|
|
1604
|
+
const errorScope = requestEvent || {};
|
|
1580
1605
|
let scripts = "";
|
|
1581
1606
|
const serializer = createHydrationSerializer({
|
|
1582
1607
|
scopeId: renderId,
|
|
@@ -1599,6 +1624,7 @@ function renderToString(code, options = {}) {
|
|
|
1599
1624
|
resolve: resolveSSRNode,
|
|
1600
1625
|
ssr: ssr,
|
|
1601
1626
|
errorPolicy: options.onError,
|
|
1627
|
+
_errorScope: errorScope,
|
|
1602
1628
|
registerHeadTags(tags) {
|
|
1603
1629
|
registerHeadTags(headRegistry, sharedConfig.context, tracking, null, nonce, tags);
|
|
1604
1630
|
},
|
|
@@ -1633,7 +1659,6 @@ function renderToString(code, options = {}) {
|
|
|
1633
1659
|
registerEntryAssets(manifest);
|
|
1634
1660
|
const context = sharedConfig.context;
|
|
1635
1661
|
context.writer = createHydrationWriter(context, () => !closed);
|
|
1636
|
-
const requestEvent = peekRequestEvent();
|
|
1637
1662
|
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1638
1663
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
1639
1664
|
const render = timeDocument(context, context.trace, "string", requestEvent);
|
|
@@ -1653,7 +1678,7 @@ function renderToString(code, options = {}) {
|
|
|
1653
1678
|
closed = true;
|
|
1654
1679
|
serializer.close();
|
|
1655
1680
|
const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
|
|
1656
|
-
const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
|
|
1681
|
+
const document = withShellEnd(assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead), context, renderId, nonce, noScripts);
|
|
1657
1682
|
if (render) render.shell();
|
|
1658
1683
|
if (requestEvent && requestEvent.response) {
|
|
1659
1684
|
commitResponseStub(requestEvent.response, {
|
|
@@ -1666,7 +1691,7 @@ function renderToString(code, options = {}) {
|
|
|
1666
1691
|
reportServerError(err, {
|
|
1667
1692
|
kind: "render",
|
|
1668
1693
|
handling: "failed"
|
|
1669
|
-
}, null, options.onError);
|
|
1694
|
+
}, null, options.onError, errorScope);
|
|
1670
1695
|
throw err;
|
|
1671
1696
|
} finally {
|
|
1672
1697
|
if (render) settleRender(render, rootOwner, rendered ? "complete" : "error");
|
|
@@ -1688,6 +1713,7 @@ function renderToStream(code, options = {}) {
|
|
|
1688
1713
|
const nonce = normalizeNonce(options.nonce);
|
|
1689
1714
|
const requestEvent = peekRequestEvent();
|
|
1690
1715
|
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1716
|
+
const errorScope = requestEvent || {};
|
|
1691
1717
|
let dispose;
|
|
1692
1718
|
let dead = false;
|
|
1693
1719
|
let render;
|
|
@@ -1742,7 +1768,15 @@ function renderToStream(code, options = {}) {
|
|
|
1742
1768
|
if (dispose) {
|
|
1743
1769
|
const d = dispose;
|
|
1744
1770
|
dispose = () => {};
|
|
1745
|
-
|
|
1771
|
+
try {
|
|
1772
|
+
d();
|
|
1773
|
+
} catch (err) {
|
|
1774
|
+
reportServerError(err, {
|
|
1775
|
+
kind: "render",
|
|
1776
|
+
handling: "failed"
|
|
1777
|
+
}, null, options.onError, errorScope);
|
|
1778
|
+
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1779
|
+
}
|
|
1746
1780
|
}
|
|
1747
1781
|
if (serializer && typeof serializer.close === "function") {
|
|
1748
1782
|
try {
|
|
@@ -1751,7 +1785,7 @@ function renderToStream(code, options = {}) {
|
|
|
1751
1785
|
reportServerError(err, {
|
|
1752
1786
|
kind: "render",
|
|
1753
1787
|
handling: "serialize"
|
|
1754
|
-
}, null, options.onError);
|
|
1788
|
+
}, null, options.onError, errorScope);
|
|
1755
1789
|
}
|
|
1756
1790
|
}
|
|
1757
1791
|
serializer = abandonedSerializer;
|
|
@@ -1768,7 +1802,7 @@ function renderToStream(code, options = {}) {
|
|
|
1768
1802
|
reportServerError(err, {
|
|
1769
1803
|
kind: "render",
|
|
1770
1804
|
handling: "failed"
|
|
1771
|
-
}, null, options.onError);
|
|
1805
|
+
}, null, options.onError, errorScope);
|
|
1772
1806
|
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1773
1807
|
abandon();
|
|
1774
1808
|
};
|
|
@@ -1833,6 +1867,18 @@ function renderToStream(code, options = {}) {
|
|
|
1833
1867
|
const canBatchStubs = !options.serializer && !options.sink;
|
|
1834
1868
|
let stubBatch = null;
|
|
1835
1869
|
const STUB_BATCH_KEY = "$B";
|
|
1870
|
+
let stableOrder = false;
|
|
1871
|
+
let parkedWrites = null;
|
|
1872
|
+
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
1873
|
+
const write = (id, value) => {
|
|
1874
|
+
if (stableOrder && !dead) (parkedWrites ||= []).push([id, value]);else serializer.write(id, value);
|
|
1875
|
+
};
|
|
1876
|
+
const flushParkedWrites = () => {
|
|
1877
|
+
if (!parkedWrites) return;
|
|
1878
|
+
const writes = parkedWrites.sort(byKey);
|
|
1879
|
+
parkedWrites = null;
|
|
1880
|
+
for (let i = 0; i < writes.length; i++) serializer.write(writes[i][0], writes[i][1]);
|
|
1881
|
+
};
|
|
1836
1882
|
const flushStubBatch = () => {
|
|
1837
1883
|
if (!stubBatch) return;
|
|
1838
1884
|
const batch = stubBatch;
|
|
@@ -1843,7 +1889,9 @@ function renderToStream(code, options = {}) {
|
|
|
1843
1889
|
return;
|
|
1844
1890
|
}
|
|
1845
1891
|
const obj = {};
|
|
1846
|
-
|
|
1892
|
+
const entries = [...batch];
|
|
1893
|
+
if (stableOrder) entries.sort(byKey);
|
|
1894
|
+
for (const [id, p] of entries) obj[id] = p;
|
|
1847
1895
|
serializer.write(STUB_BATCH_KEY, obj);
|
|
1848
1896
|
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
1849
1897
|
};
|
|
@@ -1915,7 +1963,7 @@ function renderToStream(code, options = {}) {
|
|
|
1915
1963
|
}
|
|
1916
1964
|
},
|
|
1917
1965
|
shell(shellHtml, meta) {
|
|
1918
|
-
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead));
|
|
1966
|
+
buffer.write(withShellEnd(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead), context, renderId, nonce, noScripts));
|
|
1919
1967
|
},
|
|
1920
1968
|
...options.sink
|
|
1921
1969
|
};
|
|
@@ -1943,6 +1991,7 @@ function renderToStream(code, options = {}) {
|
|
|
1943
1991
|
end();
|
|
1944
1992
|
}
|
|
1945
1993
|
flushStubBatch();
|
|
1994
|
+
flushParkedWrites();
|
|
1946
1995
|
serializer.flush();
|
|
1947
1996
|
}));
|
|
1948
1997
|
}
|
|
@@ -1951,7 +2000,7 @@ function renderToStream(code, options = {}) {
|
|
|
1951
2000
|
const pendingSerialized = new Map();
|
|
1952
2001
|
const guardedChannels = new WeakMap();
|
|
1953
2002
|
const verdictNow = error => {
|
|
1954
|
-
throw ssrSanitizeError(error, null);
|
|
2003
|
+
throw ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
1955
2004
|
};
|
|
1956
2005
|
const borderForm = value => toBorderForm(value);
|
|
1957
2006
|
const guardIterable = iterable => ({
|
|
@@ -2099,6 +2148,7 @@ function renderToStream(code, options = {}) {
|
|
|
2099
2148
|
async: true,
|
|
2100
2149
|
nonce: options.nonce,
|
|
2101
2150
|
document: !options.sink,
|
|
2151
|
+
edges: !!options.plugins && options.plugins.some(p => p.tag === "solid/server-component"),
|
|
2102
2152
|
live: {},
|
|
2103
2153
|
registerHeadTags(tags) {
|
|
2104
2154
|
registerHeadTags(headRegistry, context, tracking,
|
|
@@ -2164,7 +2214,7 @@ function renderToStream(code, options = {}) {
|
|
|
2164
2214
|
if (p && typeof p === "object" && typeof p.then === "function") {
|
|
2165
2215
|
if (!firstFlushed && deferStream) {
|
|
2166
2216
|
blockingPromises.add(p);
|
|
2167
|
-
p.then(d =>
|
|
2217
|
+
p.then(d => write(id, d)).catch(e => write(id, e));
|
|
2168
2218
|
return;
|
|
2169
2219
|
}
|
|
2170
2220
|
p = trackSerialized(id, p);
|
|
@@ -2173,7 +2223,7 @@ function renderToStream(code, options = {}) {
|
|
|
2173
2223
|
return;
|
|
2174
2224
|
}
|
|
2175
2225
|
}
|
|
2176
|
-
|
|
2226
|
+
write(id, p);
|
|
2177
2227
|
},
|
|
2178
2228
|
escape: escape,
|
|
2179
2229
|
resolve: resolveSSRNode,
|
|
@@ -2204,11 +2254,11 @@ function renderToStream(code, options = {}) {
|
|
|
2204
2254
|
defuse(p);
|
|
2205
2255
|
registry.set(key, {
|
|
2206
2256
|
resolve: err => queue(() => queue(() => {
|
|
2207
|
-
err ? reject(ssrSanitizeError(err, null)) : resolve(true);
|
|
2257
|
+
err ? reject(ssrSanitizeError(err, null, undefined, undefined, errorScope)) : resolve(true);
|
|
2208
2258
|
queue(flushEnd);
|
|
2209
2259
|
}))
|
|
2210
2260
|
});
|
|
2211
|
-
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else
|
|
2261
|
+
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else write(key + "_fr", p);
|
|
2212
2262
|
}
|
|
2213
2263
|
return (value, error, escaped) => {
|
|
2214
2264
|
if (registry.has(key)) {
|
|
@@ -2216,7 +2266,7 @@ function renderToStream(code, options = {}) {
|
|
|
2216
2266
|
registry.delete(key);
|
|
2217
2267
|
if (error) abandonSubtree(key, error);
|
|
2218
2268
|
if (error && escaped) {
|
|
2219
|
-
const wire = ssrSanitizeError(error, null);
|
|
2269
|
+
const wire = ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
2220
2270
|
const message = wire instanceof Error ? wire.message : String(wire);
|
|
2221
2271
|
if (sink.error) sink.error("", message);else if (context.live && context.live.error) context.live.error(escaped.frame, message);
|
|
2222
2272
|
}
|
|
@@ -2250,7 +2300,7 @@ function renderToStream(code, options = {}) {
|
|
|
2250
2300
|
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
2251
2301
|
styles,
|
|
2252
2302
|
revealGroup,
|
|
2253
|
-
error: error ? ssrSanitizeError(error, null) : error
|
|
2303
|
+
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
|
2254
2304
|
});
|
|
2255
2305
|
item.resolve(error);
|
|
2256
2306
|
}
|
|
@@ -2277,6 +2327,7 @@ function renderToStream(code, options = {}) {
|
|
|
2277
2327
|
applyAssetTracking(context, tracking, manifest, noScripts);
|
|
2278
2328
|
context.failRender = failRender;
|
|
2279
2329
|
context.errorPolicy = options.onError;
|
|
2330
|
+
context._errorScope = errorScope;
|
|
2280
2331
|
context.flushed = () => firstFlushed;
|
|
2281
2332
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
2282
2333
|
render = timeDocument(context, context.trace, "stream", requestEvent);
|
|
@@ -2284,40 +2335,48 @@ function renderToStream(code, options = {}) {
|
|
|
2284
2335
|
context.writer = createHydrationWriter(context, () => !completed);
|
|
2285
2336
|
const signal = options.signal;
|
|
2286
2337
|
const onAbort = signal ? () => abandon("signal", !!(signal.reason && signal.reason.quiet === true)) : undefined;
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
rootHoles
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2338
|
+
const endEdges = context.edges ? beginEdgesRender() : undefined;
|
|
2339
|
+
let html;
|
|
2340
|
+
try {
|
|
2341
|
+
html = createRoot(d => {
|
|
2342
|
+
dispose = () => {
|
|
2343
|
+
context.trace = undefined;
|
|
2344
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
2345
|
+
if (endEdges) endEdges();
|
|
2346
|
+
d();
|
|
2347
|
+
};
|
|
2348
|
+
rootOwner = claimRenderRoot(context);
|
|
2349
|
+
if (requestEvent) claimEventRender(requestEvent, context);
|
|
2350
|
+
let res;
|
|
2351
|
+
try {
|
|
2352
|
+
res = resolveSSRNode(escape(code()));
|
|
2353
|
+
} catch (err) {
|
|
2354
|
+
reportServerError(err, {
|
|
2355
|
+
kind: "render",
|
|
2356
|
+
handling: "failed"
|
|
2357
|
+
}, null, options.onError, errorScope);
|
|
2358
|
+
throw err;
|
|
2359
|
+
}
|
|
2360
|
+
if (!res.h.length) return res.t[0];
|
|
2361
|
+
rootHoles = [];
|
|
2362
|
+
let out = res.t[0];
|
|
2363
|
+
for (let i = 0; i < res.h.length; i++) {
|
|
2364
|
+
const id = nextHoleId++;
|
|
2365
|
+
rootHoles.push({
|
|
2366
|
+
id,
|
|
2367
|
+
fn: res.h[i]
|
|
2368
|
+
});
|
|
2369
|
+
out += `<!--rh${id}-->` + res.t[i + 1];
|
|
2370
|
+
}
|
|
2371
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
2372
|
+
return out;
|
|
2373
|
+
}, {
|
|
2374
|
+
id: renderId
|
|
2375
|
+
});
|
|
2376
|
+
} catch (err) {
|
|
2377
|
+
if (endEdges) endEdges();
|
|
2378
|
+
throw err;
|
|
2379
|
+
}
|
|
2321
2380
|
if (onAbort) {
|
|
2322
2381
|
if (signal.aborted) onAbort();else signal.addEventListener("abort", onAbort, {
|
|
2323
2382
|
once: true
|
|
@@ -2396,21 +2455,30 @@ function renderToStream(code, options = {}) {
|
|
|
2396
2455
|
let lastBlockingSize = -1;
|
|
2397
2456
|
let lastRegistrySize = -1;
|
|
2398
2457
|
let drainTurn = 0;
|
|
2458
|
+
let graced = false;
|
|
2399
2459
|
const scheduleFlush = (fn, awaited) => {
|
|
2400
2460
|
const attempt = () => {
|
|
2401
|
-
flushStubBatch();
|
|
2461
|
+
if (!stableOrder) flushStubBatch();
|
|
2402
2462
|
if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
|
|
2403
2463
|
if (registry.size !== lastRegistrySize) drainTurn = 0;
|
|
2404
2464
|
lastRegistrySize = registry.size;
|
|
2405
2465
|
queue(attempt);
|
|
2406
2466
|
return;
|
|
2407
2467
|
}
|
|
2468
|
+
if (!graced && registry.size) {
|
|
2469
|
+
graced = true;
|
|
2470
|
+
lastRegistrySize = -1;
|
|
2471
|
+
drainTurn = 0;
|
|
2472
|
+
deferFlush(attempt);
|
|
2473
|
+
return;
|
|
2474
|
+
}
|
|
2408
2475
|
fn();
|
|
2409
2476
|
};
|
|
2410
2477
|
const progressed = awaited !== lastBlockingSize;
|
|
2411
2478
|
lastBlockingSize = awaited;
|
|
2412
2479
|
lastRegistrySize = -1;
|
|
2413
2480
|
drainTurn = 0;
|
|
2481
|
+
graced = false;
|
|
2414
2482
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
2415
2483
|
};
|
|
2416
2484
|
let cachedReadable;
|
|
@@ -2477,6 +2545,7 @@ function renderToStream(code, options = {}) {
|
|
|
2477
2545
|
};
|
|
2478
2546
|
return {
|
|
2479
2547
|
then(onFulfilled, onRejected) {
|
|
2548
|
+
if (canBatchStubs) stableOrder = true;
|
|
2480
2549
|
const freezeHead = () => {
|
|
2481
2550
|
if (requestEvent && requestEvent.response) commitResponseStub(requestEvent.response, {
|
|
2482
2551
|
event: requestEvent
|
|
@@ -2567,11 +2636,15 @@ function renderToStream(code, options = {}) {
|
|
|
2567
2636
|
};
|
|
2568
2637
|
}
|
|
2569
2638
|
function HydrationScript(props) {
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2639
|
+
if (sharedConfig.context) sharedConfig.context.bootstrap = true;
|
|
2640
|
+
const {
|
|
2641
|
+
eventNames,
|
|
2642
|
+
nonce
|
|
2643
|
+
} = {
|
|
2644
|
+
nonce: sharedConfig.context && sharedConfig.context.nonce,
|
|
2573
2645
|
...props
|
|
2574
|
-
}
|
|
2646
|
+
};
|
|
2647
|
+
return ssr(hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), true));
|
|
2575
2648
|
}
|
|
2576
2649
|
function ssrGroup(fn, n) {
|
|
2577
2650
|
fn.$g = n;
|
|
@@ -2660,8 +2733,8 @@ function ssrGroupSlot(fn, idx) {
|
|
|
2660
2733
|
}
|
|
2661
2734
|
};
|
|
2662
2735
|
}
|
|
2663
|
-
function wireErrorMessage(err) {
|
|
2664
|
-
const wire = ssrSanitizeError(err, null);
|
|
2736
|
+
function wireErrorMessage(err, scope) {
|
|
2737
|
+
const wire = ssrSanitizeError(err, null, undefined, undefined, scope);
|
|
2665
2738
|
return String(wire && wire.message || wire);
|
|
2666
2739
|
}
|
|
2667
2740
|
const holePositionCache = new WeakMap();
|
|
@@ -2723,28 +2796,78 @@ function holeContentPositions(t) {
|
|
|
2723
2796
|
holePositionCache.set(t, cached);
|
|
2724
2797
|
return cached;
|
|
2725
2798
|
}
|
|
2726
|
-
function createLiveHoles(sink, scoped) {
|
|
2799
|
+
function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
2727
2800
|
let nextId = 0;
|
|
2728
2801
|
const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
|
|
2729
2802
|
const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
|
|
2730
|
-
const stripMarkers = html => html.replace(/<!--lh:\/?\d
|
|
2803
|
+
const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"/g, "");
|
|
2731
2804
|
const swept = (owner, ctx, fn) => {
|
|
2732
2805
|
const prev = sharedConfig.context;
|
|
2733
2806
|
sharedConfig.context = ctx;
|
|
2807
|
+
let dispose;
|
|
2808
|
+
let before;
|
|
2809
|
+
const run = () => createRoot(d => {
|
|
2810
|
+
dispose = d;
|
|
2811
|
+
before = stamp();
|
|
2812
|
+
return fn();
|
|
2813
|
+
}, {
|
|
2814
|
+
transparent: true
|
|
2815
|
+
});
|
|
2734
2816
|
try {
|
|
2735
|
-
return owner ? runWithOwner(owner,
|
|
2817
|
+
return owner ? runWithOwner(owner, run) : run();
|
|
2736
2818
|
} finally {
|
|
2737
2819
|
sharedConfig.context = prev;
|
|
2820
|
+
engine.sweptOwners = before !== undefined && stamp() !== before;
|
|
2821
|
+
if (dispose) dispose();
|
|
2738
2822
|
}
|
|
2739
2823
|
};
|
|
2824
|
+
const stripRow = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"|<!--lr-->/g, "");
|
|
2825
|
+
const rowsOf = v => Array.isArray(v) && v.$rows ? v : null;
|
|
2826
|
+
function holeValue(hole) {
|
|
2827
|
+
const b = hole.$lhBinding;
|
|
2828
|
+
if (b) {
|
|
2829
|
+
const v = hole();
|
|
2830
|
+
return b.fn && rowsOf(b.fn()) || v;
|
|
2831
|
+
}
|
|
2832
|
+
if (!hole.$fn) return hole();
|
|
2833
|
+
const v = hole.$fn();
|
|
2834
|
+
return rowsOf(v) || escape(v);
|
|
2835
|
+
}
|
|
2836
|
+
function resolveValue(value, res) {
|
|
2837
|
+
if (!Array.isArray(value) || !value.$rows) {
|
|
2838
|
+
resolveSSRNode(value, res);
|
|
2839
|
+
return null;
|
|
2840
|
+
}
|
|
2841
|
+
let rows = [];
|
|
2842
|
+
for (const row of value) {
|
|
2843
|
+
const r = resolveSSRNode(escape(row));
|
|
2844
|
+
res.t[res.t.length - 1] += "<!--lr-->" + r.t[0];
|
|
2845
|
+
if (r.h.length) {
|
|
2846
|
+
res.t.push(...r.t.slice(1));
|
|
2847
|
+
res.h.push(...r.h);
|
|
2848
|
+
res.p.push(...r.p);
|
|
2849
|
+
rows = null;
|
|
2850
|
+
} else if (rows) rows.push(engine.sweeping ? r.t[0] : stripRow(r.t[0]));
|
|
2851
|
+
}
|
|
2852
|
+
return rows;
|
|
2853
|
+
}
|
|
2854
|
+
function rowOps(last, rows) {
|
|
2855
|
+
const ops = [];
|
|
2856
|
+
for (let i = 0; i < rows.length; i++) if (i >= last.length || rows[i] !== last[i]) ops.push([i, rows[i]]);
|
|
2857
|
+
return ops.length < rows.length ? {
|
|
2858
|
+
n: rows.length,
|
|
2859
|
+
r: ops
|
|
2860
|
+
} : null;
|
|
2861
|
+
}
|
|
2740
2862
|
function resolveHoleValue(hole) {
|
|
2741
2863
|
const result = {
|
|
2742
2864
|
t: [""],
|
|
2743
2865
|
h: [],
|
|
2744
|
-
p: []
|
|
2866
|
+
p: [],
|
|
2867
|
+
rows: null
|
|
2745
2868
|
};
|
|
2746
2869
|
try {
|
|
2747
|
-
|
|
2870
|
+
result.rows = resolveValue(holeValue(hole), result);
|
|
2748
2871
|
} catch (err) {
|
|
2749
2872
|
const wrap = buildAsyncWrap(err, hole);
|
|
2750
2873
|
if (!wrap) throw err;
|
|
@@ -2762,12 +2885,88 @@ function createLiveHoles(sink, scoped) {
|
|
|
2762
2885
|
}
|
|
2763
2886
|
b.children.length = 0;
|
|
2764
2887
|
}
|
|
2888
|
+
let tops = 0;
|
|
2889
|
+
const ids = new Map();
|
|
2890
|
+
const scopeFor = hole => {
|
|
2891
|
+
const p = engine.scope;
|
|
2892
|
+
return {
|
|
2893
|
+
id: undefined,
|
|
2894
|
+
p,
|
|
2895
|
+
i: p ? p.c++ : tops++,
|
|
2896
|
+
n: null,
|
|
2897
|
+
c: 0,
|
|
2898
|
+
h: hole
|
|
2899
|
+
};
|
|
2900
|
+
};
|
|
2901
|
+
const scopeId = s => s.id !== undefined ? s.id : s.id = s.p ? scopeId(s.p) + "." + s.i : String(s.i);
|
|
2902
|
+
const collect = (v, id, forget) => (v.occ || (v.occ = new Map())).set(id, forget);
|
|
2903
|
+
function rescope(b, hole, fn) {
|
|
2904
|
+
const prevScope = engine.scope;
|
|
2905
|
+
const prevVisit = engine.visit;
|
|
2906
|
+
engine.scope = {
|
|
2907
|
+
id: scopeId(b.scope),
|
|
2908
|
+
p: null,
|
|
2909
|
+
i: 0,
|
|
2910
|
+
n: null,
|
|
2911
|
+
c: 0,
|
|
2912
|
+
h: hole
|
|
2913
|
+
};
|
|
2914
|
+
const visit = engine.visit = {
|
|
2915
|
+
occ: null
|
|
2916
|
+
};
|
|
2917
|
+
try {
|
|
2918
|
+
return fn();
|
|
2919
|
+
} finally {
|
|
2920
|
+
engine.scope = prevScope;
|
|
2921
|
+
engine.visit = prevVisit;
|
|
2922
|
+
b.next = visit.occ;
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
function settleOccurrences(b) {
|
|
2926
|
+
const occ = b.next;
|
|
2927
|
+
b.next = null;
|
|
2928
|
+
if (b.occ) for (const [id, forget] of b.occ) if (!occ || !occ.has(id)) forget();
|
|
2929
|
+
b.occ = occ;
|
|
2930
|
+
if (occ) for (let a = b.up; a; a = a.up) for (const [id, forget] of occ) collect(a, id, forget);
|
|
2931
|
+
}
|
|
2932
|
+
function leave(b, parent, scope, visit) {
|
|
2933
|
+
engine.parent = parent;
|
|
2934
|
+
engine.scope = scope;
|
|
2935
|
+
engine.visit = visit;
|
|
2936
|
+
if (visit && b.occ) for (const [id, forget] of b.occ) collect(visit, id, forget);
|
|
2937
|
+
}
|
|
2765
2938
|
const engine = {
|
|
2766
2939
|
suppressed: 0,
|
|
2767
2940
|
sweeping: false,
|
|
2768
2941
|
parent: null,
|
|
2769
|
-
recordStamp: 0,
|
|
2770
2942
|
gateHit: false,
|
|
2943
|
+
sweptOwners: false,
|
|
2944
|
+
scope: null,
|
|
2945
|
+
visit: null,
|
|
2946
|
+
dry: false,
|
|
2947
|
+
slotId(prop, given) {
|
|
2948
|
+
const s = engine.scope;
|
|
2949
|
+
if (!s) return given;
|
|
2950
|
+
const n = s.n || (s.n = Object.create(null));
|
|
2951
|
+
const i = n[prop] || 0;
|
|
2952
|
+
n[prop] = i + 1;
|
|
2953
|
+
const sid = scopeId(s);
|
|
2954
|
+
const at = sid + "." + i + "\0" + prop;
|
|
2955
|
+
if (given !== undefined) {
|
|
2956
|
+
ids.set(at, given);
|
|
2957
|
+
return given;
|
|
2958
|
+
}
|
|
2959
|
+
return ids.get(at) || `${prop}#~${sid}.${i}`;
|
|
2960
|
+
},
|
|
2961
|
+
seen(id, forget) {
|
|
2962
|
+
if (engine.visit) collect(engine.visit, id, forget);
|
|
2963
|
+
},
|
|
2964
|
+
nest(hole) {
|
|
2965
|
+
const s = engine.scope;
|
|
2966
|
+
if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
|
|
2967
|
+
engine.scope = scopeFor(hole);
|
|
2968
|
+
return s;
|
|
2969
|
+
},
|
|
2771
2970
|
content(hole) {
|
|
2772
2971
|
if (hole.$lhSuppress) {
|
|
2773
2972
|
const r = {
|
|
@@ -2775,10 +2974,12 @@ function createLiveHoles(sink, scoped) {
|
|
|
2775
2974
|
h: [],
|
|
2776
2975
|
p: []
|
|
2777
2976
|
};
|
|
2778
|
-
|
|
2779
|
-
|
|
2977
|
+
let rows = null;
|
|
2978
|
+
const b = hole.$lhBinding;
|
|
2979
|
+
const run = () => {
|
|
2980
|
+
engine.suppressed++;
|
|
2780
2981
|
try {
|
|
2781
|
-
|
|
2982
|
+
rows = resolveValue(holeValue(hole), r);
|
|
2782
2983
|
} catch (err) {
|
|
2783
2984
|
const wrap = buildAsyncWrap(err, hole);
|
|
2784
2985
|
if (wrap) {
|
|
@@ -2786,20 +2987,21 @@ function createLiveHoles(sink, scoped) {
|
|
|
2786
2987
|
r.p.push(wrap.p);
|
|
2787
2988
|
r.t.push("");
|
|
2788
2989
|
}
|
|
2990
|
+
} finally {
|
|
2991
|
+
engine.suppressed--;
|
|
2789
2992
|
}
|
|
2790
|
-
}
|
|
2791
|
-
|
|
2792
|
-
}
|
|
2793
|
-
const b = hole.$lhBinding;
|
|
2993
|
+
};
|
|
2994
|
+
b && !engine.sweeping ? rescope(b, hole, run) : run();
|
|
2794
2995
|
if (b && !b.closed && !r.h.length && !engine.sweeping) {
|
|
2795
2996
|
b.last = stripMarkers(r.t[0]);
|
|
2997
|
+
b.rows = rows;
|
|
2998
|
+
settleOccurrences(b);
|
|
2796
2999
|
}
|
|
2797
3000
|
return r.h.length ? r : r.t[0];
|
|
2798
3001
|
}
|
|
2799
3002
|
if (engine.suppressed || engine.sweeping) return null;
|
|
2800
3003
|
if (hole.$lhSkip) return null;
|
|
2801
3004
|
if (inScope && !inScope()) return null;
|
|
2802
|
-
const recordsBefore = engine.recordStamp;
|
|
2803
3005
|
const ownersBefore = stamp();
|
|
2804
3006
|
const owner = getOwner();
|
|
2805
3007
|
const holeCtx = sharedConfig.context;
|
|
@@ -2807,25 +3009,31 @@ function createLiveHoles(sink, scoped) {
|
|
|
2807
3009
|
key: null,
|
|
2808
3010
|
children: [],
|
|
2809
3011
|
last: null,
|
|
3012
|
+
rows: null,
|
|
3013
|
+
fn: hole.$fn,
|
|
2810
3014
|
closed: false,
|
|
3015
|
+
scope: undefined,
|
|
3016
|
+
occ: null,
|
|
3017
|
+
next: null,
|
|
3018
|
+
up: engine.parent,
|
|
2811
3019
|
sweep() {
|
|
2812
3020
|
if (b.closed) return;
|
|
2813
3021
|
const prevSweeping = engine.sweeping;
|
|
2814
3022
|
engine.sweeping = true;
|
|
2815
|
-
engine.
|
|
2816
|
-
const sweepOwnersBefore = stamp();
|
|
3023
|
+
engine.dry = b.last === null;
|
|
2817
3024
|
let res;
|
|
2818
3025
|
try {
|
|
2819
|
-
res = swept(owner, holeCtx, () => resolveHoleValue(hole));
|
|
3026
|
+
res = rescope(b, hole, () => swept(owner, holeCtx, () => resolveHoleValue(hole)));
|
|
2820
3027
|
} catch (err) {
|
|
2821
3028
|
b.closed = true;
|
|
2822
3029
|
sink.closeBinding(b.key);
|
|
2823
|
-
sink.error(b.key, wireErrorMessage(err));
|
|
3030
|
+
sink.error(b.key, wireErrorMessage(err, errorScope));
|
|
2824
3031
|
return;
|
|
2825
3032
|
} finally {
|
|
2826
3033
|
engine.sweeping = prevSweeping;
|
|
3034
|
+
engine.dry = false;
|
|
2827
3035
|
}
|
|
2828
|
-
if (engine.
|
|
3036
|
+
if (engine.sweptOwners && res.h.length) {
|
|
2829
3037
|
b.closed = true;
|
|
2830
3038
|
sink.closeBinding(b.key);
|
|
2831
3039
|
return;
|
|
@@ -2833,29 +3041,38 @@ function createLiveHoles(sink, scoped) {
|
|
|
2833
3041
|
if (res.h.length) return;
|
|
2834
3042
|
const html = res.t[0];
|
|
2835
3043
|
if (b.last === null || html === b.last) return;
|
|
3044
|
+
const ops = b.rows && res.rows && rowOps(b.rows, res.rows);
|
|
2836
3045
|
b.last = html;
|
|
3046
|
+
if (ops && !ops.r.length && ops.n === b.rows.length) return;
|
|
3047
|
+
b.rows = res.rows;
|
|
2837
3048
|
closeChildren(b);
|
|
2838
|
-
|
|
3049
|
+
settleOccurrences(b);
|
|
3050
|
+
sink.hole(b.key, html, ops && !html.includes("<!--slot:") ? ops : null);
|
|
2839
3051
|
}
|
|
2840
3052
|
};
|
|
2841
3053
|
if (engine.parent) engine.parent.children.push(b);
|
|
2842
3054
|
const prevParent = engine.parent;
|
|
3055
|
+
const prevScope = engine.scope;
|
|
3056
|
+
const prevVisit = engine.visit;
|
|
3057
|
+
const scope = b.scope = scopeFor(hole);
|
|
2843
3058
|
engine.parent = b;
|
|
3059
|
+
engine.scope = scope;
|
|
3060
|
+
engine.visit = b;
|
|
2844
3061
|
let value;
|
|
2845
3062
|
let escalated = null;
|
|
2846
3063
|
try {
|
|
2847
|
-
value = hole
|
|
3064
|
+
value = holeValue(hole);
|
|
2848
3065
|
} catch (err) {
|
|
2849
3066
|
const wrap = buildAsyncWrap(err, hole);
|
|
2850
3067
|
if (!wrap) {
|
|
2851
|
-
|
|
3068
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2852
3069
|
closeChildren(b);
|
|
2853
3070
|
return "";
|
|
2854
3071
|
}
|
|
2855
3072
|
escalated = wrap;
|
|
2856
3073
|
}
|
|
2857
3074
|
if (!escalated && (typeof value === "function" && value.$lhSkip || value !== null && typeof value === "object" && value.$slot)) {
|
|
2858
|
-
|
|
3075
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2859
3076
|
const r = {
|
|
2860
3077
|
t: [""],
|
|
2861
3078
|
h: [],
|
|
@@ -2870,6 +3087,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2870
3087
|
return r.h.length ? r : r.t[0];
|
|
2871
3088
|
}
|
|
2872
3089
|
let res;
|
|
3090
|
+
let rows = null;
|
|
2873
3091
|
if (escalated) {
|
|
2874
3092
|
closeChildren(b);
|
|
2875
3093
|
escalated.fn.$lhSuppress = true;
|
|
@@ -2886,23 +3104,25 @@ function createLiveHoles(sink, scoped) {
|
|
|
2886
3104
|
p: []
|
|
2887
3105
|
};
|
|
2888
3106
|
try {
|
|
2889
|
-
|
|
3107
|
+
rows = resolveValue(value, res);
|
|
2890
3108
|
} catch (_) {
|
|
2891
|
-
|
|
3109
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2892
3110
|
closeChildren(b);
|
|
2893
3111
|
return "";
|
|
2894
3112
|
}
|
|
2895
3113
|
}
|
|
2896
|
-
|
|
2897
|
-
if (
|
|
3114
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
3115
|
+
if (stamp() !== ownersBefore) {
|
|
2898
3116
|
return res.h.length ? res : res.t[0];
|
|
2899
3117
|
}
|
|
3118
|
+
if (!res.h.length && settled && settled()) return res.t[0];
|
|
2900
3119
|
const id = nextId++;
|
|
2901
3120
|
const key = b.key = "lh:" + id;
|
|
2902
3121
|
const open = `<!--lh:${id}-->`;
|
|
2903
3122
|
const close = `<!--lh:/${id}-->`;
|
|
2904
3123
|
if (!res.h.length) {
|
|
2905
3124
|
b.last = stripMarkers(res.t[0]);
|
|
3125
|
+
b.rows = rows;
|
|
2906
3126
|
sink.openBinding(key, b);
|
|
2907
3127
|
return open + res.t[0] + close;
|
|
2908
3128
|
}
|
|
@@ -2920,7 +3140,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2920
3140
|
return nextId++;
|
|
2921
3141
|
},
|
|
2922
3142
|
active() {
|
|
2923
|
-
return !inScope || inScope();
|
|
3143
|
+
return (!inScope || inScope()) && !(settled && settled());
|
|
2924
3144
|
},
|
|
2925
3145
|
attr(cap) {
|
|
2926
3146
|
const owner = getOwner();
|
|
@@ -2933,9 +3153,10 @@ function createLiveHoles(sink, scoped) {
|
|
|
2933
3153
|
sweep() {
|
|
2934
3154
|
if (b.closed) return;
|
|
2935
3155
|
const prevSweeping = engine.sweeping;
|
|
3156
|
+
const prevScope = engine.scope;
|
|
2936
3157
|
engine.sweeping = true;
|
|
3158
|
+
engine.scope = null;
|
|
2937
3159
|
engine.gateHit = false;
|
|
2938
|
-
const sweepOwnersBefore = stamp();
|
|
2939
3160
|
let html = "";
|
|
2940
3161
|
try {
|
|
2941
3162
|
let group = null;
|
|
@@ -2962,15 +3183,21 @@ function createLiveHoles(sink, scoped) {
|
|
|
2962
3183
|
};
|
|
2963
3184
|
swept(owner, holeCtx, run);
|
|
2964
3185
|
} catch (err) {
|
|
2965
|
-
if (ssrHandleError(err, true))
|
|
3186
|
+
if (ssrHandleError(err, true)) {
|
|
3187
|
+
if (!engine.sweptOwners) return;
|
|
3188
|
+
b.closed = true;
|
|
3189
|
+
sink.closeBinding(b.key);
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
2966
3192
|
b.closed = true;
|
|
2967
3193
|
sink.closeBinding(b.key);
|
|
2968
|
-
sink.error("lha:" + cap.id, wireErrorMessage(err));
|
|
3194
|
+
sink.error("lha:" + cap.id, wireErrorMessage(err, errorScope));
|
|
2969
3195
|
return;
|
|
2970
3196
|
} finally {
|
|
2971
3197
|
engine.sweeping = prevSweeping;
|
|
3198
|
+
engine.scope = prevScope;
|
|
2972
3199
|
}
|
|
2973
|
-
if (engine.gateHit
|
|
3200
|
+
if (engine.gateHit) {
|
|
2974
3201
|
b.closed = true;
|
|
2975
3202
|
sink.closeBinding(b.key);
|
|
2976
3203
|
return;
|
|
@@ -3035,7 +3262,9 @@ function ssr(t) {
|
|
|
3035
3262
|
cap = {
|
|
3036
3263
|
id,
|
|
3037
3264
|
parts: [prefix],
|
|
3038
|
-
base: prefix
|
|
3265
|
+
base: prefix,
|
|
3266
|
+
at: lastOpen.seg,
|
|
3267
|
+
inject
|
|
3039
3268
|
};
|
|
3040
3269
|
return true;
|
|
3041
3270
|
};
|
|
@@ -3084,7 +3313,10 @@ function ssr(t) {
|
|
|
3084
3313
|
});
|
|
3085
3314
|
}
|
|
3086
3315
|
} else {
|
|
3087
|
-
cap
|
|
3316
|
+
if (cap) {
|
|
3317
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3318
|
+
cap = null;
|
|
3319
|
+
}
|
|
3088
3320
|
result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
|
|
3089
3321
|
result.p.push(lastGroupVal.p);
|
|
3090
3322
|
result.t.push("");
|
|
@@ -3146,12 +3378,15 @@ function ssr(t) {
|
|
|
3146
3378
|
f: hole
|
|
3147
3379
|
});
|
|
3148
3380
|
} else {
|
|
3381
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3149
3382
|
cap = null;
|
|
3150
3383
|
}
|
|
3151
3384
|
}
|
|
3152
3385
|
} else {
|
|
3153
3386
|
const capturing = live && !hp.pos[i - 1] && captureStart();
|
|
3387
|
+
const scope = live && hp.pos[i - 1] && live.nest(hole);
|
|
3154
3388
|
const r = tryResolveFunctionHole(hole);
|
|
3389
|
+
if (scope) live.scope = scope;
|
|
3155
3390
|
if (typeof r === "string") {
|
|
3156
3391
|
s += r;
|
|
3157
3392
|
if (capturing) {
|
|
@@ -3161,7 +3396,10 @@ function ssr(t) {
|
|
|
3161
3396
|
});
|
|
3162
3397
|
}
|
|
3163
3398
|
} else {
|
|
3164
|
-
if (capturing)
|
|
3399
|
+
if (capturing) {
|
|
3400
|
+
s = s.replace(cap.inject, "");
|
|
3401
|
+
cap = null;
|
|
3402
|
+
}
|
|
3165
3403
|
result = {
|
|
3166
3404
|
t: [s],
|
|
3167
3405
|
h: [],
|
|
@@ -3225,14 +3463,12 @@ function ssrClassName(value) {
|
|
|
3225
3463
|
if (typeof value === "number") return "" + value;
|
|
3226
3464
|
if (!value) return "";
|
|
3227
3465
|
if (typeof value === "string") return escape(value, true);
|
|
3228
|
-
if (isSlotValue(value)) return "";
|
|
3229
3466
|
value = classListToObject(value);
|
|
3230
3467
|
let classKeys = Object.keys(value),
|
|
3231
3468
|
result = "";
|
|
3232
3469
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
3233
3470
|
const key = classKeys[i];
|
|
3234
|
-
|
|
3235
|
-
if (isSlotValue(classValue)) classValue = slotValueInline();
|
|
3471
|
+
const classValue = value[key];
|
|
3236
3472
|
if (!key || key === "undefined" || !classValue) continue;
|
|
3237
3473
|
result && (result += " ");
|
|
3238
3474
|
result += escape(key, true);
|
|
@@ -3242,13 +3478,11 @@ function ssrClassName(value) {
|
|
|
3242
3478
|
function ssrStyle(value) {
|
|
3243
3479
|
if (!value) return "";
|
|
3244
3480
|
if (typeof value === "string") return escape(value, true);
|
|
3245
|
-
if (isSlotValue(value)) return "";
|
|
3246
3481
|
let result = "";
|
|
3247
3482
|
const k = Object.keys(value);
|
|
3248
3483
|
for (let i = 0; i < k.length; i++) {
|
|
3249
3484
|
const s = escape(k[i], true);
|
|
3250
|
-
|
|
3251
|
-
if (isSlotValue(v)) v = slotValueInline();
|
|
3485
|
+
const v = value[k[i]];
|
|
3252
3486
|
if (v != undefined) {
|
|
3253
3487
|
const r = escape(v, true);
|
|
3254
3488
|
if (r != undefined && r !== "undefined") {
|
|
@@ -3260,7 +3494,6 @@ function ssrStyle(value) {
|
|
|
3260
3494
|
return result;
|
|
3261
3495
|
}
|
|
3262
3496
|
function ssrStyleProperty(name, value) {
|
|
3263
|
-
if (isSlotValue(value)) value = slotValueInline();
|
|
3264
3497
|
return value != null ? name + value : "";
|
|
3265
3498
|
}
|
|
3266
3499
|
function ssrStyleProperties(...entries) {
|
|
@@ -3271,29 +3504,25 @@ function ssrStyleProperties(...entries) {
|
|
|
3271
3504
|
}
|
|
3272
3505
|
return result;
|
|
3273
3506
|
}
|
|
3274
|
-
function ssrElement(tag, props, children, needsId, skip, attrs
|
|
3507
|
+
function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
3275
3508
|
const hk = needsId ? ssrHydrationKey() : "";
|
|
3276
3509
|
if (typeof props === "function") props = props();
|
|
3277
3510
|
let sources = null;
|
|
3278
3511
|
let proxy = false;
|
|
3279
3512
|
let viewKeys = null;
|
|
3280
3513
|
let owners = null;
|
|
3281
|
-
let ownerIndex = null;
|
|
3282
3514
|
const ctx = renderConfig.context;
|
|
3283
|
-
const
|
|
3515
|
+
const link = tag === "a" && ctx !== undefined && ctx.linkClaim !== undefined ? {} : null;
|
|
3284
3516
|
if (Array.isArray(props)) {
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
if (slots) ownerIndex = [];
|
|
3295
|
-
collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex);
|
|
3296
|
-
}
|
|
3517
|
+
let i = 0;
|
|
3518
|
+
for (; i < props.length; i++) {
|
|
3519
|
+
const s = props[i];
|
|
3520
|
+
if (s == null || typeof s === "function" || $PROXY in s) break;
|
|
3521
|
+
}
|
|
3522
|
+
if (i === props.length) sources = props;else {
|
|
3523
|
+
viewKeys = [];
|
|
3524
|
+
owners = [];
|
|
3525
|
+
collectSpreadSources(props, viewKeys, owners);
|
|
3297
3526
|
}
|
|
3298
3527
|
} else if (props == null) {
|
|
3299
3528
|
props = {};
|
|
@@ -3303,13 +3532,10 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3303
3532
|
owners = [];
|
|
3304
3533
|
sourceOwners(props, viewKeys, owners);
|
|
3305
3534
|
} else proxy = true;
|
|
3306
|
-
} else if (slots && props.$slot === true) {
|
|
3307
|
-
props = slotSpreadSource();
|
|
3308
3535
|
}
|
|
3309
3536
|
const info = tagInfo(tag);
|
|
3310
3537
|
const skipChildren = info.isVoid;
|
|
3311
3538
|
let result = info.open + hk;
|
|
3312
|
-
let behaviors = null;
|
|
3313
3539
|
let childOwner = null;
|
|
3314
3540
|
const last = sources === null ? 0 : sources.length - 1;
|
|
3315
3541
|
let keysOf = null;
|
|
@@ -3321,7 +3547,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3321
3547
|
const keys = owners !== null ? viewKeys : keysOf !== null ? keysOf[s] : proxy ? Reflect.ownKeys(props) : Object.keys(props);
|
|
3322
3548
|
if (sources !== null) props = sources[s];
|
|
3323
3549
|
nextKey: for (let i = 0; i < keys.length; i++) {
|
|
3324
|
-
|
|
3550
|
+
let prop = keys[i];
|
|
3325
3551
|
if (typeof prop !== "string" || skip !== undefined && skip(prop)) continue;
|
|
3326
3552
|
if (owners !== null) props = owners[i];
|
|
3327
3553
|
for (let j = s + 1; j <= last; j++) {
|
|
@@ -3338,21 +3564,15 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3338
3564
|
}
|
|
3339
3565
|
continue;
|
|
3340
3566
|
}
|
|
3341
|
-
const
|
|
3342
|
-
if (
|
|
3343
|
-
|
|
3344
|
-
continue;
|
|
3567
|
+
const key = prop;
|
|
3568
|
+
if (info.formAttributes !== undefined) {
|
|
3569
|
+
prop = spreadFormAttribute(prop, info, keys, keysOf, skip);
|
|
3570
|
+
if (prop === undefined) continue;
|
|
3345
3571
|
}
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
if (prop === "
|
|
3350
|
-
if (slots) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, claims !== undefined);
|
|
3351
|
-
continue;
|
|
3352
|
-
}
|
|
3353
|
-
if (slots && typeof value === "object") {
|
|
3354
|
-
result += spreadObjectAttribute(prop, value);
|
|
3355
|
-
} else if (prop === "style") {
|
|
3572
|
+
const value = props[key];
|
|
3573
|
+
if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
|
|
3574
|
+
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
3575
|
+
if (prop === "style") {
|
|
3356
3576
|
result += ` style="${ssrStyle(value)}"`;
|
|
3357
3577
|
} else if (prop === "class") {
|
|
3358
3578
|
result += ` class="${ssrClassName(value)}"`;
|
|
@@ -3363,8 +3583,8 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3363
3583
|
}
|
|
3364
3584
|
}
|
|
3365
3585
|
}
|
|
3366
|
-
if (slots && (behaviors !== null || claims !== undefined)) result += spreadBehaviorMarkers(behaviors, claims, ctx.claims);
|
|
3367
3586
|
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3587
|
+
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
3368
3588
|
if (skipChildren) return {
|
|
3369
3589
|
t: result + " />"
|
|
3370
3590
|
};
|
|
@@ -3382,21 +3602,36 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3382
3602
|
};
|
|
3383
3603
|
return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
3384
3604
|
}
|
|
3605
|
+
function collectSpreadSources(props, viewKeys, owners) {
|
|
3606
|
+
for (let i = 0; i < props.length; i++) {
|
|
3607
|
+
let s = props[i];
|
|
3608
|
+
if (typeof s === "function") s = s();
|
|
3609
|
+
if (s != null) sourceOwners(s, viewKeys, owners);
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
3613
|
+
const defaultProp = info.formDefaults[prop];
|
|
3614
|
+
if (defaultProp !== undefined && (skip === undefined || !skip(defaultProp))) {
|
|
3615
|
+
if (keysOf !== null) {
|
|
3616
|
+
for (let j = 0; j < keysOf.length; j++) {
|
|
3617
|
+
if (keysOf[j].includes(defaultProp)) return;
|
|
3618
|
+
}
|
|
3619
|
+
} else if (keys.includes(defaultProp)) return;
|
|
3620
|
+
}
|
|
3621
|
+
const attr = info.formAttributes[prop];
|
|
3622
|
+
if (attr !== undefined && skip !== undefined && skip(attr)) return;
|
|
3623
|
+
return attr === undefined ? prop : attr;
|
|
3624
|
+
}
|
|
3385
3625
|
function ssrElementAttribute(key, value) {
|
|
3386
3626
|
if (value == undefined) return "";
|
|
3387
|
-
if (key === "style" || key === "class") {
|
|
3388
|
-
return typeof value === "object" ? slotClassOrStyle(key, value) : ` ${key}="${key === "class" ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3389
|
-
}
|
|
3390
|
-
if (isSlotValue(value)) return slotAttribute(key, value);
|
|
3627
|
+
if (key === "style" || key === "class") return ` ${key}="${key === "class" ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3391
3628
|
if (typeof value === "boolean") return value ? ` ${key}` : "";
|
|
3392
3629
|
return value === "" ? ` ${key}` : ` ${key}="${escape(value, true)}"`;
|
|
3393
3630
|
}
|
|
3394
3631
|
function ssrAttribute(key, value) {
|
|
3395
3632
|
if (typeof value === "string") return ` ${key}="${value}"`;
|
|
3396
3633
|
if (value == null || value === false) return "";
|
|
3397
|
-
if (typeof value === "object") {
|
|
3398
|
-
return isSlotValue(value) ? slotAttribute(key, value) : ` ${key}="${escape(String(value), true)}"`;
|
|
3399
|
-
}
|
|
3634
|
+
if (typeof value === "object") return ` ${key}="${escape(String(value), true)}"`;
|
|
3400
3635
|
if (typeof value === "function") return ` ${key}="${escape(String(value), true)}"`;
|
|
3401
3636
|
return value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
3402
3637
|
}
|
|
@@ -3404,231 +3639,10 @@ function ssrHydrationKey() {
|
|
|
3404
3639
|
const hk = getHydrationKey();
|
|
3405
3640
|
return hk ? ` _hk=${hk}` : "";
|
|
3406
3641
|
}
|
|
3407
|
-
|
|
3408
|
-
const
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
const SLOT_FACE_STREAM = 0;
|
|
3412
|
-
const SLOT_FACE_DATA = 1;
|
|
3413
|
-
const SLOT_FACE_MARKUP = 2;
|
|
3414
|
-
function isSlotValue(value) {
|
|
3415
|
-
return value !== null && typeof value === "object" && value[SLOT_VALUE] !== undefined;
|
|
3416
|
-
}
|
|
3417
|
-
function slotValue(occurrence, key, value, face) {
|
|
3418
|
-
const sv = {
|
|
3419
|
-
[SLOT_VALUE]: occurrence,
|
|
3420
|
-
k: key,
|
|
3421
|
-
v: value,
|
|
3422
|
-
f: face
|
|
3423
|
-
};
|
|
3424
|
-
Object.defineProperty(sv, Symbol.toPrimitive, {
|
|
3425
|
-
value: hint => slotValueString()
|
|
3426
|
-
});
|
|
3427
|
-
Object.defineProperty(sv, "toString", {
|
|
3428
|
-
value: () => slotValueString()
|
|
3429
|
-
});
|
|
3430
|
-
Object.defineProperty(sv, "w", {
|
|
3431
|
-
value: () => slotText(sv)
|
|
3432
|
-
});
|
|
3433
|
-
return sv;
|
|
3434
|
-
}
|
|
3435
|
-
function slotValueString(sv, reason) {
|
|
3436
|
-
return "";
|
|
3437
|
-
}
|
|
3438
|
-
function slotText(sv) {
|
|
3439
|
-
const v = sv.f === SLOT_FACE_DATA ? sv.v : undefined;
|
|
3440
|
-
const text = typeof v === "string" || typeof v === "number" ? escape("" + v) : "";
|
|
3441
|
-
return `<!--${SLOT_MARKER}t=${slotEntry(sv)}-->${text}<!--/${SLOT_MARKER}t-->`;
|
|
3442
|
-
}
|
|
3443
|
-
function slotValueInline(kind, sv) {
|
|
3444
|
-
return undefined;
|
|
3445
|
-
}
|
|
3446
|
-
const SLOT_KEY_UNSAFE = /[^A-Za-z0-9_.!~*'()-]/g;
|
|
3447
|
-
function encodeSlotKey(key) {
|
|
3448
|
-
return String(key).replace(SLOT_KEY_UNSAFE, c => encodeURIComponent(c));
|
|
3449
|
-
}
|
|
3450
|
-
function slotEntry(sv, name) {
|
|
3451
|
-
return `${sv[SLOT_VALUE]}:${encodeSlotKey(sv.k)}${name !== undefined ? "=" + encodeSlotKey(name) : ""}`;
|
|
3452
|
-
}
|
|
3453
|
-
function slotMarker(position, entries) {
|
|
3454
|
-
return ` ${SLOT_MARKER}${position}="${entries}"`;
|
|
3455
|
-
}
|
|
3456
|
-
function eventSlotStamp(mode) {
|
|
3457
|
-
return mode === CLAIMS_DOCUMENT ? " _hk" : "";
|
|
3458
|
-
}
|
|
3459
|
-
function slotAttribute(key, sv) {
|
|
3460
|
-
let out = "";
|
|
3461
|
-
if (sv.f === SLOT_FACE_DATA) {
|
|
3462
|
-
const v = sv.v;
|
|
3463
|
-
if (v != null && v !== false) {
|
|
3464
|
-
out = v === true || v === "" ? ` ${key}` : ` ${key}="${escape(String(v), true)}"`;
|
|
3465
|
-
}
|
|
3466
|
-
}
|
|
3467
|
-
return out + slotMarker(key, slotEntry(sv));
|
|
3468
|
-
}
|
|
3469
|
-
function slotClassOrStyle(key, value) {
|
|
3470
|
-
const isClass = key === "class";
|
|
3471
|
-
if (isSlotValue(value)) {
|
|
3472
|
-
let out = "";
|
|
3473
|
-
if (value.f === SLOT_FACE_DATA && value.v != null) {
|
|
3474
|
-
out = ` ${key}="${isClass ? ssrClassName(value.v) : ssrStyle(value.v)}"`;
|
|
3475
|
-
}
|
|
3476
|
-
return out + slotMarker(key, slotEntry(value));
|
|
3477
|
-
}
|
|
3478
|
-
if (typeof value === "object" && value !== null) {
|
|
3479
|
-
const obj = isClass ? classListToObject(value) : value;
|
|
3480
|
-
let entries = "";
|
|
3481
|
-
let inner = "";
|
|
3482
|
-
for (const name of Object.keys(obj)) {
|
|
3483
|
-
let v = obj[name];
|
|
3484
|
-
if (isSlotValue(v)) {
|
|
3485
|
-
entries += (entries ? "," : "") + slotEntry(v, name);
|
|
3486
|
-
v = v.f === SLOT_FACE_DATA ? v.v : undefined;
|
|
3487
|
-
}
|
|
3488
|
-
if (isClass) {
|
|
3489
|
-
if (!name || name === "undefined" || !v) continue;
|
|
3490
|
-
inner += (inner ? " " : "") + escape(name, true);
|
|
3491
|
-
} else if (v != undefined) {
|
|
3492
|
-
const r = escape(v, true);
|
|
3493
|
-
if (r != undefined && r !== "undefined") {
|
|
3494
|
-
inner += (inner ? ";" : "") + `${escape(name, true)}:${r}`;
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
if (entries === "") return ` ${key}="${inner}"`;
|
|
3499
|
-
return (inner ? ` ${key}="${inner}"` : "") + slotMarker(key, entries);
|
|
3500
|
-
}
|
|
3501
|
-
return ` ${key}="${isClass ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3502
|
-
}
|
|
3503
|
-
function eventPosition(prop) {
|
|
3504
|
-
return prop.slice(2).toLowerCase();
|
|
3505
|
-
}
|
|
3506
|
-
function spreadBehaviorPosition(behaviors, prop, value, mode, index, settle) {
|
|
3507
|
-
if (!isAttrName(prop)) return behaviors;
|
|
3508
|
-
const pos = prop === "ref" ? "ref" : eventPosition(prop);
|
|
3509
|
-
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3510
|
-
if (!settle) {
|
|
3511
|
-
if (entries) (behaviors ||= new Map()).set(pos, entries);
|
|
3512
|
-
return behaviors;
|
|
3513
|
-
}
|
|
3514
|
-
behaviors ||= new Map();
|
|
3515
|
-
const b = behaviors.get(pos);
|
|
3516
|
-
if (b === undefined) behaviors.set(pos, {
|
|
3517
|
-
e: entries,
|
|
3518
|
-
at: index
|
|
3519
|
-
});else {
|
|
3520
|
-
b.e = entries;
|
|
3521
|
-
b.at = index;
|
|
3522
|
-
}
|
|
3523
|
-
return behaviors;
|
|
3524
|
-
}
|
|
3525
|
-
function spreadBehaviorMarkers(behaviors, claims, mode) {
|
|
3526
|
-
if (claims !== undefined) {
|
|
3527
|
-
const segments = claims();
|
|
3528
|
-
for (const k in segments) {
|
|
3529
|
-
const map = segments[k];
|
|
3530
|
-
for (const pos in map) {
|
|
3531
|
-
const value = map[pos];
|
|
3532
|
-
behaviors ||= new Map();
|
|
3533
|
-
const b = behaviors.get(pos);
|
|
3534
|
-
if (pos === "ref") {
|
|
3535
|
-
if (value == null) continue;
|
|
3536
|
-
const entries = claimEntries("ref", value);
|
|
3537
|
-
if (!entries) continue;
|
|
3538
|
-
if (b === undefined) behaviors.set("ref", {
|
|
3539
|
-
e: entries,
|
|
3540
|
-
at: -1
|
|
3541
|
-
});else b.e = b.e ? b.e + "," + entries : entries;
|
|
3542
|
-
continue;
|
|
3543
|
-
}
|
|
3544
|
-
if (b !== undefined && b.at >= +k) continue;
|
|
3545
|
-
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3546
|
-
if (b === undefined) behaviors.set(pos, {
|
|
3547
|
-
e: entries,
|
|
3548
|
-
at: -1
|
|
3549
|
-
});else b.e = entries;
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
}
|
|
3553
|
-
let out = "";
|
|
3554
|
-
let events = false;
|
|
3555
|
-
if (behaviors !== null) {
|
|
3556
|
-
for (const [pos, b] of behaviors) {
|
|
3557
|
-
const e = claims === undefined ? b : b.e;
|
|
3558
|
-
if (!e) continue;
|
|
3559
|
-
if (pos === "ref") out += slotMarker("ref", e);else {
|
|
3560
|
-
out += slotMarker("on:" + pos, e);
|
|
3561
|
-
events = true;
|
|
3562
|
-
}
|
|
3563
|
-
}
|
|
3564
|
-
}
|
|
3565
|
-
return events ? out + eventSlotStamp(mode) : out;
|
|
3566
|
-
}
|
|
3567
|
-
function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
3568
|
-
for (let i = 0; i < props.length; i++) {
|
|
3569
|
-
let s = props[i];
|
|
3570
|
-
if (typeof s === "function") s = s();
|
|
3571
|
-
if (s != null) {
|
|
3572
|
-
if (slots && !($PROXY in s) && s.$slot === true) s = slotSpreadSource();
|
|
3573
|
-
if (ownerIndex === null) sourceOwners(s, viewKeys, owners);else {
|
|
3574
|
-
const ks = [];
|
|
3575
|
-
const os = [];
|
|
3576
|
-
sourceOwners(s, ks, os);
|
|
3577
|
-
for (let j = 0; j < ks.length; j++) {
|
|
3578
|
-
const at = viewKeys.indexOf(ks[j]);
|
|
3579
|
-
if (at !== -1) {
|
|
3580
|
-
viewKeys.splice(at, 1);
|
|
3581
|
-
owners.splice(at, 1);
|
|
3582
|
-
ownerIndex.splice(at, 1);
|
|
3583
|
-
}
|
|
3584
|
-
viewKeys.push(ks[j]);
|
|
3585
|
-
owners.push(os[j]);
|
|
3586
|
-
ownerIndex.push(i);
|
|
3587
|
-
}
|
|
3588
|
-
}
|
|
3589
|
-
}
|
|
3590
|
-
}
|
|
3591
|
-
}
|
|
3592
|
-
function spreadObjectAttribute(prop, value) {
|
|
3593
|
-
if (prop === "style" || prop === "class") return slotClassOrStyle(prop, value);
|
|
3594
|
-
if (!isAttrName(prop)) return "";
|
|
3595
|
-
if (value[SLOT_VALUE] !== undefined) return slotAttribute(prop, value);
|
|
3596
|
-
return ` ${prop}="${escape(value, true)}"`;
|
|
3597
|
-
}
|
|
3598
|
-
function slotSpreadSource(tag, source) {
|
|
3599
|
-
return {};
|
|
3600
|
-
}
|
|
3601
|
-
function ssrClaim(map) {
|
|
3602
|
-
const mode = sharedConfig.context && sharedConfig.context.claims;
|
|
3603
|
-
if (!mode) return "";
|
|
3604
|
-
let out = "";
|
|
3605
|
-
let events = false;
|
|
3606
|
-
for (const pos in map) {
|
|
3607
|
-
const entries = claimEntries(pos, map[pos]);
|
|
3608
|
-
if (!entries) continue;
|
|
3609
|
-
if (pos === "ref") out += slotMarker("ref", entries);else {
|
|
3610
|
-
out += slotMarker("on:" + pos, entries);
|
|
3611
|
-
events = true;
|
|
3612
|
-
}
|
|
3613
|
-
}
|
|
3614
|
-
return events ? out + eventSlotStamp(mode) : out;
|
|
3615
|
-
}
|
|
3616
|
-
function claimEntries(pos, value, mode) {
|
|
3617
|
-
if (Array.isArray(value) && pos !== "ref") {
|
|
3618
|
-
return "";
|
|
3619
|
-
}
|
|
3620
|
-
if (Array.isArray(value)) {
|
|
3621
|
-
let entries = "";
|
|
3622
|
-
for (const v of value) {
|
|
3623
|
-
const inner = claimEntries(pos, v);
|
|
3624
|
-
if (inner) entries += (entries ? "," : "") + inner;
|
|
3625
|
-
}
|
|
3626
|
-
return entries;
|
|
3627
|
-
}
|
|
3628
|
-
if (isSlotValue(value)) {
|
|
3629
|
-
return slotEntry(value);
|
|
3630
|
-
}
|
|
3631
|
-
return "";
|
|
3642
|
+
function ssrLinkClaim(attrs) {
|
|
3643
|
+
const ctx = renderConfig.context;
|
|
3644
|
+
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
3645
|
+
return ctx.linkClaim(attrs);
|
|
3632
3646
|
}
|
|
3633
3647
|
function decodeSSREntities(s) {
|
|
3634
3648
|
return s.indexOf("&") < 0 ? s : s.replace(/"/g, '"').replace(/</g, "<").replace(/&/g, "&");
|
|
@@ -3750,7 +3764,6 @@ function escape(s, attr) {
|
|
|
3750
3764
|
if (!attr && t === "function") return escapeLate(s);
|
|
3751
3765
|
if (attr) {
|
|
3752
3766
|
if (s == null || t === "boolean" || t === "number") return s;
|
|
3753
|
-
if (t === "object" && s[SLOT_VALUE] !== undefined) return s;
|
|
3754
3767
|
return escape(String(s), attr);
|
|
3755
3768
|
}
|
|
3756
3769
|
return s;
|
|
@@ -3763,6 +3776,7 @@ function escapeLate(fn) {
|
|
|
3763
3776
|
if (fn.$esc) return fn;
|
|
3764
3777
|
const w = () => escape(fn());
|
|
3765
3778
|
w.$esc = true;
|
|
3779
|
+
w.$fn = fn;
|
|
3766
3780
|
if (fn.$lhSkip) w.$lhSkip = true;
|
|
3767
3781
|
if (fn.$lhSuppress) w.$lhSuppress = true;
|
|
3768
3782
|
if (fn.$lhBinding) w.$lhBinding = fn.$lhBinding;
|
|
@@ -3855,10 +3869,13 @@ function applyRef(r, element) {
|
|
|
3855
3869
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
3856
3870
|
}
|
|
3857
3871
|
function generateHydrationScript({
|
|
3858
|
-
eventNames
|
|
3872
|
+
eventNames,
|
|
3859
3873
|
nonce
|
|
3860
3874
|
} = {}) {
|
|
3861
|
-
return
|
|
3875
|
+
return hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), false);
|
|
3876
|
+
}
|
|
3877
|
+
function hydrationBootstrap(eventNames = ["click", "input"], nonce, ledger) {
|
|
3878
|
+
return `<script${nonce ? ` nonce="${escape(String(nonce), true)}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:new Proxy({},{set:(r,k,v)=>(v instanceof Promise&&v.catch(()=>{}),r[k]=v,!0)}),${ledger ? "s:{}," : ""}fe(){}});</script><!--xs-->`;
|
|
3862
3879
|
}
|
|
3863
3880
|
function queue(fn) {
|
|
3864
3881
|
return Promise.resolve().then(fn);
|
|
@@ -3871,6 +3888,13 @@ function allSettled(promises) {
|
|
|
3871
3888
|
return size;
|
|
3872
3889
|
});
|
|
3873
3890
|
}
|
|
3891
|
+
function withShellEnd(html, context, renderId, nonce, noScripts) {
|
|
3892
|
+
if (noScripts || !context || !context.bootstrap) return html;
|
|
3893
|
+
const id = JSON.stringify(renderId).replace(/</g, "\\u003C");
|
|
3894
|
+
const marker = `<script${nonceAttr(nonce, "script")}>_$HY.s[${id}]=1,_$HY.sw&&_$HY.sw(${id})</script>`;
|
|
3895
|
+
const at = html.indexOf("</body>", html.length - 512);
|
|
3896
|
+
return at < 0 ? html + marker : html.slice(0, at) + marker + html.slice(at);
|
|
3897
|
+
}
|
|
3874
3898
|
function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
|
|
3875
3899
|
const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
|
|
3876
3900
|
const title = headTags ? headTags.title : null;
|
|
@@ -4061,10 +4085,6 @@ function tryResolveString(node, nested) {
|
|
|
4061
4085
|
if (node.h && node.h.length > 0) return {
|
|
4062
4086
|
merge: node
|
|
4063
4087
|
};
|
|
4064
|
-
if (node[SLOT_VALUE] !== undefined) {
|
|
4065
|
-
ssrTextTail = false;
|
|
4066
|
-
return node.w();
|
|
4067
|
-
}
|
|
4068
4088
|
if (node.t === undefined) {
|
|
4069
4089
|
return "";
|
|
4070
4090
|
}
|
|
@@ -4117,9 +4137,6 @@ function resolveSSRNode(node, result = {
|
|
|
4117
4137
|
} else if (node.t !== undefined) {
|
|
4118
4138
|
result.t[result.t.length - 1] += node.t;
|
|
4119
4139
|
ssrTextTail = false;
|
|
4120
|
-
} else if (node[SLOT_VALUE] !== undefined) {
|
|
4121
|
-
result.t[result.t.length - 1] += node.w();
|
|
4122
|
-
ssrTextTail = false;
|
|
4123
4140
|
} else ;
|
|
4124
4141
|
} else if (t === "function") {
|
|
4125
4142
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
@@ -4130,6 +4147,7 @@ function resolveSSRNode(node, result = {
|
|
|
4130
4147
|
ssrTextTail = true;
|
|
4131
4148
|
} else resolveSSRNode(liveNode, result, false, true);
|
|
4132
4149
|
} else {
|
|
4150
|
+
const scope = live && live.nest(node);
|
|
4133
4151
|
try {
|
|
4134
4152
|
resolveSSRNode(node(), result, false, true);
|
|
4135
4153
|
} catch (err) {
|
|
@@ -4141,6 +4159,8 @@ function resolveSSRNode(node, result = {
|
|
|
4141
4159
|
result.t.push("");
|
|
4142
4160
|
ssrTextTail = true;
|
|
4143
4161
|
}
|
|
4162
|
+
} finally {
|
|
4163
|
+
if (scope) live.scope = scope;
|
|
4144
4164
|
}
|
|
4145
4165
|
}
|
|
4146
4166
|
}
|
|
@@ -4223,13 +4243,30 @@ function createHydrationWriter(context, isOpen) {
|
|
|
4223
4243
|
};
|
|
4224
4244
|
}
|
|
4225
4245
|
function getHydrationWriter() {
|
|
4246
|
+
const ctx = currentRenderContext();
|
|
4247
|
+
return ctx && ctx.writer;
|
|
4248
|
+
}
|
|
4249
|
+
function currentRenderContext() {
|
|
4226
4250
|
let ctx = renderContextOf(getOwner());
|
|
4227
4251
|
if (!ctx) {
|
|
4228
4252
|
const event = peekRequestEvent();
|
|
4229
4253
|
const renders = event && eventRenders.get(event);
|
|
4230
4254
|
if (renders && renders.size === 1) for (const c of renders) ctx = c;
|
|
4231
4255
|
}
|
|
4232
|
-
return ctx
|
|
4256
|
+
return ctx;
|
|
4257
|
+
}
|
|
4258
|
+
const LINK_STATE_RECORD = "links";
|
|
4259
|
+
function setLinkClaim(handler) {
|
|
4260
|
+
const ctx = currentRenderContext();
|
|
4261
|
+
if (!ctx) {
|
|
4262
|
+
return false;
|
|
4263
|
+
}
|
|
4264
|
+
ctx.linkClaim = handler;
|
|
4265
|
+
if (handler !== undefined) ctx.writer.write(LINK_STATE_RECORD, 1);
|
|
4266
|
+
return true;
|
|
4267
|
+
}
|
|
4268
|
+
function hasServerLinkState() {
|
|
4269
|
+
return false;
|
|
4233
4270
|
}
|
|
4234
4271
|
function takeHydrationValue(_key) {
|
|
4235
4272
|
return undefined;
|
|
@@ -4543,93 +4580,17 @@ function dispatchAsInteraction(_e, fn) {
|
|
|
4543
4580
|
return fn();
|
|
4544
4581
|
}
|
|
4545
4582
|
function notSup() {
|
|
4546
|
-
throw new Error("Client-only API called on the server side. Run client-only code in
|
|
4583
|
+
throw new Error("Client-only API called on the server side. Run client-only code in onSettled, or conditionally run client-only component with <Show>.");
|
|
4547
4584
|
}
|
|
4548
4585
|
|
|
4549
4586
|
setContainerTraceResolver(getProjectionTrace);
|
|
4550
4587
|
setAsyncIterableSharer(shareAsyncIterable);
|
|
4551
4588
|
const isServer = true;
|
|
4552
4589
|
const isDev = false;
|
|
4590
|
+
const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
|
|
4553
4591
|
function dynamic(source, options) {
|
|
4554
4592
|
return dynamicCore(source, options, ssrTag);
|
|
4555
4593
|
}
|
|
4556
|
-
function dynamicComponent(source, options) {
|
|
4557
|
-
return dynamicCore(source, options);
|
|
4558
|
-
}
|
|
4559
|
-
const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
|
|
4560
|
-
function dynamicCore(source, options, tagArm) {
|
|
4561
|
-
if (options?.static) {
|
|
4562
|
-
const component = untrack(source);
|
|
4563
|
-
if (typeof component === "function") return props => component(props);
|
|
4564
|
-
if (typeof component === "string" && tagArm) return props => tagArm(component, props);
|
|
4565
|
-
return () => undefined;
|
|
4566
|
-
}
|
|
4567
|
-
const cached = createMemo(() => {
|
|
4568
|
-
const next = source();
|
|
4569
|
-
if (!next || typeof next.then !== "function") return next;
|
|
4570
|
-
return {
|
|
4571
|
-
[FLIGHT]: next
|
|
4572
|
-
};
|
|
4573
|
-
});
|
|
4574
|
-
const deferStream = !!options?.deferStream;
|
|
4575
|
-
return props => {
|
|
4576
|
-
const ctx = sharedConfig.context;
|
|
4577
|
-
let gated = !deferStream || !ctx?.async;
|
|
4578
|
-
const value = createMemo(() => {
|
|
4579
|
-
let c;
|
|
4580
|
-
try {
|
|
4581
|
-
c = cached();
|
|
4582
|
-
} catch (err) {
|
|
4583
|
-
if (!gated && err instanceof NotReadyError && !err.source?.$clientHole) {
|
|
4584
|
-
gated = true;
|
|
4585
|
-
ctx.block(Promise.resolve(err.source).then(() => {}, () => {}));
|
|
4586
|
-
}
|
|
4587
|
-
throw err;
|
|
4588
|
-
}
|
|
4589
|
-
if (!c || !c[FLIGHT]) return c;
|
|
4590
|
-
const next = c[FLIGHT];
|
|
4591
|
-
return {
|
|
4592
|
-
then: (onFulfilled, onRejected) => next.then(resolved => {
|
|
4593
|
-
let landed;
|
|
4594
|
-
try {
|
|
4595
|
-
landed = classifyLanding(resolved);
|
|
4596
|
-
} catch (err) {
|
|
4597
|
-
if (onRejected) return onRejected(err);
|
|
4598
|
-
throw err;
|
|
4599
|
-
}
|
|
4600
|
-
return onFulfilled ? onFulfilled(landed) : landed;
|
|
4601
|
-
}, onRejected)
|
|
4602
|
-
};
|
|
4603
|
-
}, {
|
|
4604
|
-
deferStream
|
|
4605
|
-
});
|
|
4606
|
-
return createMemo(() => {
|
|
4607
|
-
const c = value();
|
|
4608
|
-
if (c) {
|
|
4609
|
-
if (typeof c === "function") return c(props);
|
|
4610
|
-
if (typeof c === "string" && tagArm) return tagArm(c, props);
|
|
4611
|
-
}
|
|
4612
|
-
}, {
|
|
4613
|
-
sync: true
|
|
4614
|
-
});
|
|
4615
|
-
};
|
|
4616
|
-
}
|
|
4617
|
-
const FLIGHT = Symbol("solid.dynamic-flight");
|
|
4618
|
-
const SERVER_COMPONENT = Symbol.for("solid.server-component");
|
|
4619
|
-
function classifyLanding(resolved) {
|
|
4620
|
-
if (typeof resolved !== "function" || SERVER_COMPONENT in resolved) return resolved;
|
|
4621
|
-
const message = "[DYNAMIC_ASYNC_COMPONENT] An async dynamic() source resolved to a client component function";
|
|
4622
|
-
recordFinding({
|
|
4623
|
-
code: "DYNAMIC_ASYNC_COMPONENT",
|
|
4624
|
-
kind: "ssr",
|
|
4625
|
-
severity: "error",
|
|
4626
|
-
message,
|
|
4627
|
-
data: {
|
|
4628
|
-
component: resolved.name || undefined
|
|
4629
|
-
}
|
|
4630
|
-
}, null);
|
|
4631
|
-
throw new Error(message);
|
|
4632
|
-
}
|
|
4633
4594
|
function Dynamic(props) {
|
|
4634
4595
|
const Comp = dynamic(() => props.component);
|
|
4635
4596
|
return createComponent(Comp, omit(props, "component"));
|
|
@@ -4758,4 +4719,4 @@ function httpHeader(name, value, options) {
|
|
|
4758
4719
|
}
|
|
4759
4720
|
}
|
|
4760
4721
|
|
|
4761
|
-
export {
|
|
4722
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|