@solidjs/web 2.0.0-rc.13 → 2.0.0-rc.15
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/server.dev.js +317 -185
- package/dist/server.js +298 -161
- package/dist/server.observe.js +299 -171
- package/dist/web.dev.js +207 -189
- package/dist/web.js +180 -178
- package/dist/web.observe.js +180 -180
- package/frames/dist/assets.js +92 -0
- package/frames/dist/bind.dev.js +326 -0
- package/frames/dist/bind.js +295 -0
- package/frames/dist/client.dev.js +665 -1114
- package/frames/dist/client.js +630 -1087
- package/frames/dist/client.observe.js +629 -1087
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +400 -201
- package/frames/dist/server.js +397 -198
- package/frames/dist/server.observe.js +397 -198
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +30 -4
- package/performance-tracks/dist/performance-tracks.dev.js +2 -1
- package/performance-tracks/dist/performance-tracks.observe.js +2 -1
- package/performance-tracks/types/index.d.ts +8 -6
- package/serialization/dist/decode.js +38 -9
- package/serialization/dist/serialization.js +40 -11
- package/serialization/types/serializer-decode.d.ts +24 -2
- package/server-functions/dist/client.dev.js +101 -62
- package/server-functions/dist/client.js +101 -62
- package/server-functions/dist/client.observe.js +101 -62
- package/server-functions/dist/server.dev.js +178 -67
- package/server-functions/dist/server.js +178 -67
- package/server-functions/dist/server.observe.js +178 -67
- package/skills/server-components/SKILL.md +65 -43
- package/types/client.d.ts +120 -8
- package/types/constants.d.ts +3 -1
- package/types/diagnostics.d.ts +8 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/bind-tier.d.ts +60 -0
- package/types/frames/client.d.ts +37 -3
- package/types/frames/frame-client.d.ts +249 -78
- package/types/frames/frame-container-plugin.d.ts +2 -2
- package/types/frames/frame-sink.d.ts +33 -0
- package/types/frames/frame-transport.d.ts +66 -18
- package/types/frames/regions-tier.d.ts +45 -0
- package/types/frames/serializer-decode.d.ts +24 -2
- package/types/frames/server.d.ts +33 -9
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/wire-tier.d.ts +116 -0
- package/types/head.d.ts +1 -0
- package/types/index.d.ts +61 -16
- package/types/index.server.d.ts +3 -18
- package/types/jsx.d.ts +4 -13
- package/types/observe.d.ts +4 -2
- package/types/response.d.ts +26 -4
- package/types/serializer-decode.d.ts +24 -2
- package/types/server-functions/client.d.ts +30 -0
- package/types/server-functions/registry.d.ts +4 -1
- package/types/server-functions/shared.d.ts +12 -8
- package/types/server-mock.d.ts +22 -3
- package/types/server.d.ts +119 -17
package/dist/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, 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, viewOf, sourceOwners,
|
|
1
|
+
import { createRenderEffect, createMemo, 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, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
4
|
export { ssrScope as scope, sharedConfig } from 'solid-js/internal';
|
|
5
|
-
import {
|
|
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
|
|
|
8
8
|
const DOMWithState = {
|
|
@@ -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",
|
|
@@ -59,6 +60,10 @@ function isHttpNavigationTarget(target) {
|
|
|
59
60
|
return false;
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
function isEventName(name) {
|
|
64
|
+
let c;
|
|
65
|
+
return name.startsWith("on") && (c = name.charCodeAt(2)) > 64 && c < 91;
|
|
66
|
+
}
|
|
62
67
|
|
|
63
68
|
const transparentOptions = {
|
|
64
69
|
transparent: true,
|
|
@@ -369,17 +374,15 @@ function toBorderForm(value, envelopeContainers) {
|
|
|
369
374
|
}
|
|
370
375
|
function isShareableIterable(value) {
|
|
371
376
|
try {
|
|
372
|
-
|
|
373
|
-
if (typeof ReadableStream !== "undefined" && value instanceof ReadableStream) return false;
|
|
374
|
-
return typeof value[Symbol.asyncIterator] === "function";
|
|
377
|
+
return typeof value[Symbol.asyncIterator] === "function" && !(typeof ReadableStream !== "undefined" && value instanceof ReadableStream);
|
|
375
378
|
} catch {
|
|
376
379
|
return false;
|
|
377
380
|
}
|
|
378
381
|
}
|
|
379
|
-
function materialize(marker) {
|
|
382
|
+
function materialize(marker, claiming) {
|
|
380
383
|
let value = state.materialized.get(marker.$tr);
|
|
381
384
|
if (value === undefined) {
|
|
382
|
-
value = state.materializeTrace(marker);
|
|
385
|
+
value = state.materializeTrace(marker, claiming);
|
|
383
386
|
state.materialized.set(marker.$tr, value);
|
|
384
387
|
if (value !== null && typeof value === "object") state.materializedValues.add(value);
|
|
385
388
|
}
|
|
@@ -437,23 +440,22 @@ setContainerTraceStreamMint(iterable => {
|
|
|
437
440
|
})();
|
|
438
441
|
return stream;
|
|
439
442
|
});
|
|
440
|
-
const DEFAULT_WEB_PLUGINS = Object.freeze([AbortSignalPlugin,
|
|
443
|
+
const DEFAULT_WEB_PLUGINS = /* @__PURE__ */Object.freeze([AbortSignalPlugin,
|
|
441
444
|
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
442
445
|
FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin,
|
|
443
446
|
ContainerTracePlugin]);
|
|
444
447
|
function resolveSerializerPlugins(customPlugins) {
|
|
445
448
|
return customPlugins ? [...customPlugins, ...DEFAULT_WEB_PLUGINS] : [...DEFAULT_WEB_PLUGINS];
|
|
446
449
|
}
|
|
447
|
-
Feature.RegExp;
|
|
448
450
|
|
|
449
|
-
const
|
|
451
|
+
const defaultDisabledFeatures = () => Feature.AggregateError | Feature.BigIntTypedArray;
|
|
450
452
|
const serializeOnlyDisabledFeatures = serializeErrorStacks => (serializeErrorStacks === undefined ? process.env.NODE_ENV === "development" : serializeErrorStacks) ? 0 : Feature.ErrorPrototypeStack;
|
|
451
453
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
452
454
|
function createSerializer(options) {
|
|
453
455
|
return new Serializer({
|
|
454
456
|
...options,
|
|
455
457
|
plugins: resolveSerializerPlugins(options.plugins),
|
|
456
|
-
disabledFeatures: (options.disabledFeatures === undefined ?
|
|
458
|
+
disabledFeatures: (options.disabledFeatures === undefined ? defaultDisabledFeatures() : options.disabledFeatures) | serializeOnlyDisabledFeatures(options.serializeErrorStacks)
|
|
457
459
|
});
|
|
458
460
|
}
|
|
459
461
|
function createHydrationSerializer({
|
|
@@ -477,17 +479,24 @@ function getLocalHeaderScript(id) {
|
|
|
477
479
|
}
|
|
478
480
|
|
|
479
481
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
480
|
-
|
|
481
|
-
const ResponseEnvelope =
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
482
|
+
let EnvelopeClass;
|
|
483
|
+
const ResponseEnvelope = function ResponseEnvelope(response, value) {
|
|
484
|
+
if (!EnvelopeClass) {
|
|
485
|
+
EnvelopeClass = class extends Response {
|
|
486
|
+
constructor(response, value) {
|
|
487
|
+
super(response ? response.body : null, response && {
|
|
488
|
+
status: response.status,
|
|
489
|
+
statusText: response.statusText,
|
|
490
|
+
headers: copyHeaders(response.headers)
|
|
491
|
+
});
|
|
492
|
+
this.response = response ? this : undefined;
|
|
493
|
+
this.value = value;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
EnvelopeClass.prototype[ENVELOPE] = true;
|
|
487
497
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
})();
|
|
498
|
+
return new EnvelopeClass(response, value);
|
|
499
|
+
};
|
|
491
500
|
function isResponseEnvelope(value) {
|
|
492
501
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
493
502
|
}
|
|
@@ -512,6 +521,16 @@ function isSafeError(value) {
|
|
|
512
521
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
513
522
|
const REVALIDATE_ALL = "*";
|
|
514
523
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
524
|
+
function copyHeaders(init) {
|
|
525
|
+
const source = init;
|
|
526
|
+
if (!source || !source.getSetCookie) return new Headers(init);
|
|
527
|
+
const headers = new Headers();
|
|
528
|
+
source.forEach((value, key) => {
|
|
529
|
+
if (key !== "set-cookie") headers.append(key, value);
|
|
530
|
+
});
|
|
531
|
+
for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
532
|
+
return headers;
|
|
533
|
+
}
|
|
515
534
|
function initWithRevalidate(init = {}) {
|
|
516
535
|
const resolved = typeof init === "number" ? {
|
|
517
536
|
status: init
|
|
@@ -520,18 +539,7 @@ function initWithRevalidate(init = {}) {
|
|
|
520
539
|
revalidate,
|
|
521
540
|
...responseInit
|
|
522
541
|
} = resolved;
|
|
523
|
-
|
|
524
|
-
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
525
|
-
headers = new Headers();
|
|
526
|
-
responseInit.headers.forEach((value, key) => {
|
|
527
|
-
if (key !== "set-cookie") headers.append(key, value);
|
|
528
|
-
});
|
|
529
|
-
for (const cookie of responseInit.headers.getSetCookie()) {
|
|
530
|
-
headers.append("Set-Cookie", cookie);
|
|
531
|
-
}
|
|
532
|
-
} else {
|
|
533
|
-
headers = new Headers(responseInit.headers);
|
|
534
|
-
}
|
|
542
|
+
const headers = copyHeaders(responseInit.headers);
|
|
535
543
|
if (revalidate !== undefined) {
|
|
536
544
|
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
537
545
|
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
@@ -652,7 +660,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
652
660
|
return cookie;
|
|
653
661
|
}
|
|
654
662
|
const FLASH_COOKIE = "flash";
|
|
655
|
-
const FLASH_MATCHER =
|
|
663
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
656
664
|
function hasFlashCookie(cookieHeader) {
|
|
657
665
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
658
666
|
}
|
|
@@ -664,7 +672,6 @@ const ERROR_HEADER = "X-Server-Function-Error";
|
|
|
664
672
|
const BODY_FORMAT_HEADER = "X-Server-Function-Format";
|
|
665
673
|
const REDIRECT_HEADER = "X-Server-Function-Redirect";
|
|
666
674
|
const SINGLE_FLIGHT_HEADER = "X-Single-Flight";
|
|
667
|
-
new TextEncoder().encode(":\n\n");
|
|
668
675
|
|
|
669
676
|
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
670
677
|
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
@@ -709,6 +716,10 @@ function qualifierValue(name, value) {
|
|
|
709
716
|
function asciiLowerCase(value) {
|
|
710
717
|
return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
711
718
|
}
|
|
719
|
+
const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
|
|
720
|
+
function headBodyText(tag, props, text) {
|
|
721
|
+
return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
|
|
722
|
+
}
|
|
712
723
|
function resourceIdentity(tag, props) {
|
|
713
724
|
const url = String(props.href || props.src || "");
|
|
714
725
|
let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
|
|
@@ -1293,6 +1304,7 @@ function renderShellHead(registry, nonce, isPendingFragment, noScripts, traceMet
|
|
|
1293
1304
|
noScripts
|
|
1294
1305
|
};
|
|
1295
1306
|
}
|
|
1307
|
+
let headBodyHook;
|
|
1296
1308
|
function flushHeadFragment(registry, boundary, nonce) {
|
|
1297
1309
|
const groups = commitHeadBoundary(registry, boundary);
|
|
1298
1310
|
if (!groups.length) return null;
|
|
@@ -1316,7 +1328,7 @@ function flushHeadFragment(registry, boundary, nonce) {
|
|
|
1316
1328
|
const t = winner.tags[i];
|
|
1317
1329
|
const attrs = {};
|
|
1318
1330
|
for (const name in t.props) {
|
|
1319
|
-
if (name === "children" || name === "ref" || name
|
|
1331
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1320
1332
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1321
1333
|
continue;
|
|
1322
1334
|
}
|
|
@@ -1330,7 +1342,7 @@ function flushHeadFragment(registry, boundary, nonce) {
|
|
|
1330
1342
|
if (value) attrs.nonce = String(value);
|
|
1331
1343
|
}
|
|
1332
1344
|
const children = t.props.children;
|
|
1333
|
-
ops.push(["a", identity, t.tag, attrs, children == null ? null : String(children)]);
|
|
1345
|
+
ops.push(["a", identity, t.tag, attrs, children == null ? null : headBodyHook ? headBodyHook(t.tag, t.props, String(children)) : String(children)]);
|
|
1334
1346
|
}
|
|
1335
1347
|
}
|
|
1336
1348
|
return ops.length ? ops : null;
|
|
@@ -1358,8 +1370,7 @@ function normalizeNonce(nonce) {
|
|
|
1358
1370
|
}
|
|
1359
1371
|
function destinationNonce(nonce, destination) {
|
|
1360
1372
|
if (nonce == null) return undefined;
|
|
1361
|
-
|
|
1362
|
-
const value = nonce[destination];
|
|
1373
|
+
const value = typeof nonce === "string" ? nonce : nonce[destination];
|
|
1363
1374
|
return typeof value === "string" && value ? value : undefined;
|
|
1364
1375
|
}
|
|
1365
1376
|
function scriptNonce(nonce) {
|
|
@@ -1405,7 +1416,7 @@ function nonceAttr(nonce, destination) {
|
|
|
1405
1416
|
function renderHeadAttrHtml(props) {
|
|
1406
1417
|
let attrs = "";
|
|
1407
1418
|
for (const name in props) {
|
|
1408
|
-
if (name === "children" || name === "ref" || name
|
|
1419
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1409
1420
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1410
1421
|
continue;
|
|
1411
1422
|
}
|
|
@@ -1418,7 +1429,7 @@ function renderHeadAttrHtml(props) {
|
|
|
1418
1429
|
function headAttrRecord(props, skipRelHref) {
|
|
1419
1430
|
let attrs = null;
|
|
1420
1431
|
for (const name in props) {
|
|
1421
|
-
if (name === "children" || name === "ref" || name
|
|
1432
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1422
1433
|
if ((name === "rel" || name === "href")) continue;
|
|
1423
1434
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1424
1435
|
const v = props[name];
|
|
@@ -1433,6 +1444,7 @@ function renderHeadTagMarkup(tag, props, identity, nonce) {
|
|
|
1433
1444
|
if (nonce && !hasNonceProp(props)) attrs += nonceAttr(nonce, nonceDestination(tag, props));
|
|
1434
1445
|
if (tag === "meta" || tag === "link" || tag === "base") return `<${tag}${attrs}>`;
|
|
1435
1446
|
let body = props.children == null ? "" : String(props.children);
|
|
1447
|
+
if (headBodyHook) body = headBodyHook(tag, props, body);
|
|
1436
1448
|
if (tag === "script") body = body.replace(/<\/(script)/gi, "<\\/$1");else if (tag === "style") body = escapeStyleContent(body);else body = escape(body);
|
|
1437
1449
|
return `<${tag}${attrs}>${body}</${tag}>`;
|
|
1438
1450
|
}
|
|
@@ -1441,32 +1453,51 @@ function useHead(tags) {
|
|
|
1441
1453
|
if (!ctx || !ctx.registerHeadTags) {
|
|
1442
1454
|
return;
|
|
1443
1455
|
}
|
|
1456
|
+
headBodyHook = headBodyText;
|
|
1444
1457
|
ctx.registerHeadTags(tags);
|
|
1445
1458
|
}
|
|
1446
1459
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
1460
|
+
const NOT_NAME = /[\0-\x20\x7F-\x9F"'<>/=]/;
|
|
1461
|
+
const TAG_START = /^[a-zA-Z]/;
|
|
1447
1462
|
const tagInfos = /*#__PURE__*/new Map();
|
|
1448
1463
|
function tagInfo(tag) {
|
|
1449
1464
|
let info = tagInfos.get(tag);
|
|
1450
1465
|
if (info === undefined) {
|
|
1466
|
+
if (!TAG_START.test(tag) || NOT_NAME.test(tag)) throw new Error(`"${tag}" is not a valid tag name`);
|
|
1467
|
+
let formDefaults, formAttributes;
|
|
1468
|
+
if (tag === "input" || tag === "option") {
|
|
1469
|
+
formDefaults = Object.create(null);
|
|
1470
|
+
formAttributes = Object.create(null);
|
|
1471
|
+
const state = DOMWithState[tag.toUpperCase()];
|
|
1472
|
+
for (const prop in state) {
|
|
1473
|
+
if (state[prop] === 2) {
|
|
1474
|
+
const attr = prop.slice(7).toLowerCase();
|
|
1475
|
+
formDefaults[attr] = prop;
|
|
1476
|
+
formAttributes[prop] = attr;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1451
1480
|
info = {
|
|
1452
1481
|
open: "<" + tag,
|
|
1453
1482
|
close: "</" + tag + ">",
|
|
1454
1483
|
isVoid: VOID_ELEMENTS.test(tag),
|
|
1455
1484
|
textarea: tag === "textarea",
|
|
1456
|
-
raw: tag === "script" || tag === "style"
|
|
1485
|
+
raw: tag === "script" || tag === "style",
|
|
1486
|
+
formDefaults,
|
|
1487
|
+
formAttributes
|
|
1457
1488
|
};
|
|
1458
1489
|
if (tagInfos.size < 512) tagInfos.set(tag, info);
|
|
1459
1490
|
}
|
|
1460
1491
|
return info;
|
|
1461
1492
|
}
|
|
1462
1493
|
const safeAttrNames = /*#__PURE__*/new Set();
|
|
1463
|
-
function
|
|
1464
|
-
if (safeAttrNames.has(prop)) return
|
|
1465
|
-
|
|
1466
|
-
if (
|
|
1467
|
-
return
|
|
1494
|
+
function isAttrName(prop) {
|
|
1495
|
+
if (safeAttrNames.has(prop)) return true;
|
|
1496
|
+
if (prop === "" || NOT_NAME.test(prop)) return false;
|
|
1497
|
+
if (safeAttrNames.size < 512) safeAttrNames.add(prop);
|
|
1498
|
+
return true;
|
|
1468
1499
|
}
|
|
1469
|
-
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,o.replaceWith(n.content),n.remove(),(_$HY.v=_$HY.v||{})[e]=1,_$HY.fe(e,t),_$HY.hp&&_$HY.hp[e]&&($dh(_$HY.hp[e]),delete _$HY.hp[e]),$dfd();return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return(_$HY.dlq=_$HY.dlq||{})[e]=1,0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1,$dfd();return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfd(e,i){if(e=_$HY.dq){_$HY.dq=0;for(i in e)$df(i)}if(e=_$HY.dlq){_$HY.dlq=0;for(i in e)$dfl(i)}}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}`;
|
|
1500
|
+
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,o.replaceWith(n.content),n.remove(),(_$HY.v=_$HY.v||{})[e]=1,_$HY.fe(e,t),_$HY.hp&&_$HY.hp[e]&&($dh(_$HY.hp[e]),delete _$HY.hp[e]),$dfd();return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return(_$HY.dlq=_$HY.dlq||{})[e]=1,0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1,$dfd();return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfd(e,i){if(e=_$HY.dq){_$HY.dq=0;for(i in e)$df(i)}if(e=_$HY.dlq){_$HY.dlq=0;for(i in e)$dfl(i)}}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}function $dfe(e,t,k){(t=e.target)&&t.getAttribute&&!t._$dc&&(k=t.getAttribute("data-dfc"))&&(t._$dc=1,$dfc(k))}document.addEventListener("load",$dfe,!0);document.addEventListener("error",$dfe,!0)`;
|
|
1470
1501
|
const HEAD_SCRIPT = `function $dha(o,i,e,n){for(i=0;i<o.length;i++)e=o[i],"t"==e[0]?((n=document.querySelector("title"))?n.hasAttribute("data-dh")||n.setAttribute("data-dhf",n.textContent):(n=document.createElement("title"),document.head.appendChild(n)),n.textContent=e[1],n.setAttribute("data-dh","title")):"r"==e[0]?$dhr(e[1]):(n=document.createElement(e[2]),Object.keys(e[3]).forEach(function(a){n.setAttribute(a,e[3][a])}),null!=e[4]&&(n.textContent=e[4]),n.setAttribute("data-dh",e[1]),document.head.appendChild(n))}function $dhr(v,l,i){for(l=document.head.querySelectorAll("[data-dh]"),i=0;i<l.length;i++)l[i].getAttribute("data-dh")==v&&l[i].remove()}function $dh(o){_$HY.h?_$HY.h(o):$dha(o)}`;
|
|
1471
1502
|
function renderToString(code, options = {}) {
|
|
1472
1503
|
const {
|
|
@@ -1552,7 +1583,7 @@ function renderToString(code, options = {}) {
|
|
|
1552
1583
|
closed = true;
|
|
1553
1584
|
serializer.close();
|
|
1554
1585
|
const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
|
|
1555
|
-
const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
|
|
1586
|
+
const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead) + shellEndMarker(context, renderId, nonce, noScripts);
|
|
1556
1587
|
if (render) render.shell();
|
|
1557
1588
|
if (requestEvent && requestEvent.response) {
|
|
1558
1589
|
commitResponseStub(requestEvent.response, {
|
|
@@ -1561,12 +1592,20 @@ function renderToString(code, options = {}) {
|
|
|
1561
1592
|
}
|
|
1562
1593
|
rendered = true;
|
|
1563
1594
|
return document;
|
|
1595
|
+
} catch (err) {
|
|
1596
|
+
reportServerError(err, {
|
|
1597
|
+
kind: "render",
|
|
1598
|
+
handling: "failed"
|
|
1599
|
+
}, null, options.onError);
|
|
1600
|
+
throw err;
|
|
1564
1601
|
} finally {
|
|
1565
1602
|
if (render) settleRender(render, rootOwner, rendered ? "complete" : "error");
|
|
1566
1603
|
context.trace = undefined;
|
|
1567
1604
|
if (dispose) dispose();
|
|
1568
1605
|
}
|
|
1569
1606
|
}
|
|
1607
|
+
const SHELL_ABANDONED = Symbol();
|
|
1608
|
+
const ABANDON_RENDER = Symbol();
|
|
1570
1609
|
function renderToStream(code, options = {}) {
|
|
1571
1610
|
let {
|
|
1572
1611
|
onCompleteShell,
|
|
@@ -1587,6 +1626,7 @@ function renderToStream(code, options = {}) {
|
|
|
1587
1626
|
let disconnected = false;
|
|
1588
1627
|
let failed = false;
|
|
1589
1628
|
let onFailed;
|
|
1629
|
+
let onDisconnectedBeforeShell;
|
|
1590
1630
|
const defuse = p => {
|
|
1591
1631
|
if (p && typeof p.then === "function") p.then(undefined, () => {});
|
|
1592
1632
|
};
|
|
@@ -1605,7 +1645,7 @@ function renderToStream(code, options = {}) {
|
|
|
1605
1645
|
complete(sink);
|
|
1606
1646
|
} : complete;
|
|
1607
1647
|
};
|
|
1608
|
-
const abandon = disconnect => {
|
|
1648
|
+
const abandon = (disconnect, quiet) => {
|
|
1609
1649
|
if (dead) return;
|
|
1610
1650
|
dead = true;
|
|
1611
1651
|
completed = true;
|
|
@@ -1641,7 +1681,7 @@ function renderToStream(code, options = {}) {
|
|
|
1641
1681
|
if (!disconnect) {
|
|
1642
1682
|
failed = true;
|
|
1643
1683
|
onFailed && onFailed(sink);
|
|
1644
|
-
}
|
|
1684
|
+
} else if (!sink && onDisconnectedBeforeShell) onDisconnectedBeforeShell();
|
|
1645
1685
|
};
|
|
1646
1686
|
const failRender = err => {
|
|
1647
1687
|
reportServerError(err, {
|
|
@@ -1758,10 +1798,10 @@ function renderToStream(code, options = {}) {
|
|
|
1758
1798
|
const styleAttr = nonceAttr(nonce, "style");
|
|
1759
1799
|
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
1760
1800
|
writeTasks();
|
|
1801
|
+
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1761
1802
|
for (const entry of styles.links) {
|
|
1762
|
-
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr}
|
|
1803
|
+
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} data-dfc="${key}">` : `<link${entry.attrHtml}${styleAttr} data-dfc="${key}">`);
|
|
1763
1804
|
}
|
|
1764
|
-
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1765
1805
|
} else {
|
|
1766
1806
|
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1767
1807
|
if (!deferActivation) {
|
|
@@ -1784,7 +1824,7 @@ function renderToStream(code, options = {}) {
|
|
|
1784
1824
|
}
|
|
1785
1825
|
},
|
|
1786
1826
|
shell(shellHtml, meta) {
|
|
1787
|
-
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead));
|
|
1827
|
+
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead) + shellEndMarker(context, renderId, nonce, noScripts));
|
|
1788
1828
|
},
|
|
1789
1829
|
...options.sink
|
|
1790
1830
|
};
|
|
@@ -1803,7 +1843,7 @@ function renderToStream(code, options = {}) {
|
|
|
1803
1843
|
};
|
|
1804
1844
|
let holds = 0;
|
|
1805
1845
|
const flushEnd = () => {
|
|
1806
|
-
if (!registry.size && !holds) {
|
|
1846
|
+
if (!registry.size && !holds && !rootHoles) {
|
|
1807
1847
|
serializeRootAssets();
|
|
1808
1848
|
queue(() => queue(() => {
|
|
1809
1849
|
if (context.live.end) {
|
|
@@ -1929,6 +1969,12 @@ function renderToStream(code, options = {}) {
|
|
|
1929
1969
|
}
|
|
1930
1970
|
let rootHoles = null;
|
|
1931
1971
|
let nextHoleId = 0;
|
|
1972
|
+
let parkedInlines = null;
|
|
1973
|
+
function inlineFragment(key, value) {
|
|
1974
|
+
if (rootHoles && !html.includes(`<template id="pl-${key}">`)) {
|
|
1975
|
+
(parkedInlines ||= new Map()).set(key, value);
|
|
1976
|
+
} else html = replacePlaceholder(html, key, value);
|
|
1977
|
+
}
|
|
1932
1978
|
let buffer = {
|
|
1933
1979
|
write(payload) {
|
|
1934
1980
|
tmp += payload;
|
|
@@ -2057,11 +2103,16 @@ function renderToStream(code, options = {}) {
|
|
|
2057
2103
|
});
|
|
2058
2104
|
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else serializer.write(key + "_fr", p);
|
|
2059
2105
|
}
|
|
2060
|
-
return (value, error) => {
|
|
2106
|
+
return (value, error, escaped) => {
|
|
2061
2107
|
if (registry.has(key)) {
|
|
2062
2108
|
const item = registry.get(key);
|
|
2063
2109
|
registry.delete(key);
|
|
2064
2110
|
if (error) abandonSubtree(key);
|
|
2111
|
+
if (error && escaped) {
|
|
2112
|
+
const wire = ssrSanitizeError(error, null);
|
|
2113
|
+
const message = wire instanceof Error ? wire.message : String(wire);
|
|
2114
|
+
if (sink.error) sink.error("", message);else if (context.live && context.live.error) context.live.error(escaped.frame, message);
|
|
2115
|
+
}
|
|
2065
2116
|
if (item.children && !error) {
|
|
2066
2117
|
for (const k in item.children) {
|
|
2067
2118
|
value = replacePlaceholder(value, k, item.children[k]);
|
|
@@ -2081,7 +2132,7 @@ function renderToStream(code, options = {}) {
|
|
|
2081
2132
|
if (!completed) {
|
|
2082
2133
|
if (error) dropHeadBoundary(headRegistry, key);
|
|
2083
2134
|
if (!firstFlushed) {
|
|
2084
|
-
queue(() =>
|
|
2135
|
+
queue(() => inlineFragment(key, value !== undefined ? value : ""));
|
|
2085
2136
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
2086
2137
|
item.resolve(error);
|
|
2087
2138
|
} else {
|
|
@@ -2125,7 +2176,7 @@ function renderToStream(code, options = {}) {
|
|
|
2125
2176
|
registerEntryAssets(manifest);
|
|
2126
2177
|
context.writer = createHydrationWriter(context, () => !completed);
|
|
2127
2178
|
const signal = options.signal;
|
|
2128
|
-
const onAbort = signal ? () => abandon("signal") : undefined;
|
|
2179
|
+
const onAbort = signal ? () => abandon("signal", !!(signal.reason && signal.reason.quiet === true)) : undefined;
|
|
2129
2180
|
let html = createRoot(d => {
|
|
2130
2181
|
dispose = () => {
|
|
2131
2182
|
context.trace = undefined;
|
|
@@ -2134,7 +2185,16 @@ function renderToStream(code, options = {}) {
|
|
|
2134
2185
|
};
|
|
2135
2186
|
rootOwner = claimRenderRoot(context);
|
|
2136
2187
|
if (requestEvent) claimEventRender(requestEvent, context);
|
|
2137
|
-
|
|
2188
|
+
let res;
|
|
2189
|
+
try {
|
|
2190
|
+
res = resolveSSRNode(escape(code()));
|
|
2191
|
+
} catch (err) {
|
|
2192
|
+
reportServerError(err, {
|
|
2193
|
+
kind: "render",
|
|
2194
|
+
handling: "failed"
|
|
2195
|
+
}, null, options.onError);
|
|
2196
|
+
throw err;
|
|
2197
|
+
}
|
|
2138
2198
|
if (!res.h.length) return res.t[0];
|
|
2139
2199
|
rootHoles = [];
|
|
2140
2200
|
let out = res.t[0];
|
|
@@ -2181,6 +2241,13 @@ function renderToStream(code, options = {}) {
|
|
|
2181
2241
|
for (const p of res.p) blockingPromises.add(p);
|
|
2182
2242
|
}
|
|
2183
2243
|
}
|
|
2244
|
+
if (parkedInlines) {
|
|
2245
|
+
for (const [key, value] of parkedInlines) {
|
|
2246
|
+
if (!html.includes(`<template id="pl-${key}">`)) continue;
|
|
2247
|
+
html = replacePlaceholder(html, key, value);
|
|
2248
|
+
parkedInlines.delete(key);
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2184
2251
|
if (pending.length) {
|
|
2185
2252
|
rootHoles = pending;
|
|
2186
2253
|
return false;
|
|
@@ -2342,11 +2409,16 @@ function renderToStream(code, options = {}) {
|
|
|
2342
2409
|
},
|
|
2343
2410
|
pipe(w) {
|
|
2344
2411
|
claimConsumer("pipe");
|
|
2412
|
+
const abandoned = w[SHELL_ABANDONED];
|
|
2345
2413
|
onFailure(sink => {
|
|
2346
2414
|
try {
|
|
2347
|
-
sink ? sink.end() : w.end();
|
|
2415
|
+
sink ? sink.end() : abandoned ? abandoned() : w.end();
|
|
2348
2416
|
} catch (_) {}
|
|
2349
2417
|
});
|
|
2418
|
+
if (abandoned) {
|
|
2419
|
+
w[ABANDON_RENDER] = abandon;
|
|
2420
|
+
if (disconnected) abandoned();else onDisconnectedBeforeShell = abandoned;
|
|
2421
|
+
}
|
|
2350
2422
|
function flush() {
|
|
2351
2423
|
allSettled(blockingPromises).then(awaited => {
|
|
2352
2424
|
scheduleFlush(() => {
|
|
@@ -2388,11 +2460,15 @@ function renderToStream(code, options = {}) {
|
|
|
2388
2460
|
};
|
|
2389
2461
|
}
|
|
2390
2462
|
function HydrationScript(props) {
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2463
|
+
if (sharedConfig.context) sharedConfig.context.bootstrap = true;
|
|
2464
|
+
const {
|
|
2465
|
+
eventNames,
|
|
2466
|
+
nonce
|
|
2467
|
+
} = {
|
|
2468
|
+
nonce: sharedConfig.context && sharedConfig.context.nonce,
|
|
2394
2469
|
...props
|
|
2395
|
-
}
|
|
2470
|
+
};
|
|
2471
|
+
return ssr(hydrationBootstrap(eventNames, scriptNonce(nonce), true));
|
|
2396
2472
|
}
|
|
2397
2473
|
function ssrGroup(fn, n) {
|
|
2398
2474
|
fn.$g = n;
|
|
@@ -2548,7 +2624,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2548
2624
|
let nextId = 0;
|
|
2549
2625
|
const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
|
|
2550
2626
|
const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
|
|
2551
|
-
const stripMarkers = html => html.replace(/<!--lh:\/?\d
|
|
2627
|
+
const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"/g, "");
|
|
2552
2628
|
const swept = (owner, ctx, fn) => {
|
|
2553
2629
|
const prev = sharedConfig.context;
|
|
2554
2630
|
sharedConfig.context = ctx;
|
|
@@ -3084,6 +3160,14 @@ function ssrStyleProperty(name, value) {
|
|
|
3084
3160
|
if (isSlotValue(value)) value = slotValueInline();
|
|
3085
3161
|
return value != null ? name + value : "";
|
|
3086
3162
|
}
|
|
3163
|
+
function ssrStyleProperties(...entries) {
|
|
3164
|
+
let result = "";
|
|
3165
|
+
for (let i = 0; i < entries.length; i += 2) {
|
|
3166
|
+
const entry = ssrStyleProperty(entries[i], entries[i + 1]);
|
|
3167
|
+
if (entry) result = result ? result + ";" + entry : entry;
|
|
3168
|
+
}
|
|
3169
|
+
return result;
|
|
3170
|
+
}
|
|
3087
3171
|
function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
3088
3172
|
const hk = needsId ? ssrHydrationKey() : "";
|
|
3089
3173
|
if (typeof props === "function") props = props();
|
|
@@ -3094,6 +3178,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3094
3178
|
let ownerIndex = null;
|
|
3095
3179
|
const ctx = renderConfig.context;
|
|
3096
3180
|
const slots = ctx !== undefined && ctx.claims !== undefined;
|
|
3181
|
+
const link = tag === "a" && ctx !== undefined && ctx.linkClaim !== undefined ? {} : null;
|
|
3097
3182
|
if (Array.isArray(props)) {
|
|
3098
3183
|
if (slots && props.$slot === true) props = slotSpreadSource();else {
|
|
3099
3184
|
let i = 0;
|
|
@@ -3123,6 +3208,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3123
3208
|
const skipChildren = info.isVoid;
|
|
3124
3209
|
let result = info.open + hk;
|
|
3125
3210
|
let behaviors = null;
|
|
3211
|
+
let childOwner = null;
|
|
3126
3212
|
const last = sources === null ? 0 : sources.length - 1;
|
|
3127
3213
|
let keysOf = null;
|
|
3128
3214
|
if (sources !== null) {
|
|
@@ -3133,7 +3219,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3133
3219
|
const keys = owners !== null ? viewKeys : keysOf !== null ? keysOf[s] : proxy ? Reflect.ownKeys(props) : Object.keys(props);
|
|
3134
3220
|
if (sources !== null) props = sources[s];
|
|
3135
3221
|
nextKey: for (let i = 0; i < keys.length; i++) {
|
|
3136
|
-
|
|
3222
|
+
let prop = keys[i];
|
|
3137
3223
|
if (typeof prop !== "string" || skip !== undefined && skip(prop)) continue;
|
|
3138
3224
|
if (owners !== null) props = owners[i];
|
|
3139
3225
|
for (let j = s + 1; j <= last; j++) {
|
|
@@ -3145,21 +3231,29 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3145
3231
|
continue;
|
|
3146
3232
|
}
|
|
3147
3233
|
if (ChildProperties.has(prop)) {
|
|
3148
|
-
if (children === undefined &&
|
|
3234
|
+
if (children === undefined && childOwner === null && !skipChildren) {
|
|
3235
|
+
if (prop === "children") childOwner = props;else children = info.raw || prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
3236
|
+
}
|
|
3149
3237
|
continue;
|
|
3150
3238
|
}
|
|
3151
|
-
const
|
|
3239
|
+
const key = prop;
|
|
3240
|
+
if (info.formAttributes !== undefined) {
|
|
3241
|
+
prop = spreadFormAttribute(prop, info, keys, keysOf, skip);
|
|
3242
|
+
if (prop === undefined) continue;
|
|
3243
|
+
}
|
|
3244
|
+
const value = props[key];
|
|
3152
3245
|
if (value == undefined) {
|
|
3153
|
-
if (slots && claims !== undefined && (prop === "ref" || prop
|
|
3246
|
+
if (slots && claims !== undefined && (prop === "ref" || isEventName(prop))) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, true);
|
|
3154
3247
|
continue;
|
|
3155
3248
|
}
|
|
3156
3249
|
if (prop.startsWith("prop:")) {
|
|
3157
3250
|
continue;
|
|
3158
3251
|
}
|
|
3159
|
-
if (prop === "ref" || prop
|
|
3252
|
+
if (prop === "ref" || isEventName(prop)) {
|
|
3160
3253
|
if (slots) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, claims !== undefined);
|
|
3161
3254
|
continue;
|
|
3162
3255
|
}
|
|
3256
|
+
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
3163
3257
|
if (slots && typeof value === "object") {
|
|
3164
3258
|
result += spreadObjectAttribute(prop, value);
|
|
3165
3259
|
} else if (prop === "style") {
|
|
@@ -3167,18 +3261,19 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3167
3261
|
} else if (prop === "class") {
|
|
3168
3262
|
result += ` class="${ssrClassName(value)}"`;
|
|
3169
3263
|
} else if (typeof value === "boolean") {
|
|
3170
|
-
if (
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
result += value === "" ? ` ${attrName(prop)}` : ` ${attrName(prop)}="${escape(value, true)}"`;
|
|
3264
|
+
if (value && isAttrName(prop)) result += ` ${prop}`;
|
|
3265
|
+
} else if (isAttrName(prop)) {
|
|
3266
|
+
result += value === "" ? ` ${prop}` : ` ${prop}="${escape(value, true)}"`;
|
|
3174
3267
|
}
|
|
3175
3268
|
}
|
|
3176
3269
|
}
|
|
3177
3270
|
if (slots && (behaviors !== null || claims !== undefined)) result += spreadBehaviorMarkers(behaviors, claims, ctx.claims);
|
|
3178
3271
|
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3272
|
+
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
3179
3273
|
if (skipChildren) return {
|
|
3180
3274
|
t: result + " />"
|
|
3181
3275
|
};
|
|
3276
|
+
if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
|
|
3182
3277
|
if (typeof children === "function") children = children();
|
|
3183
3278
|
const ct = typeof children;
|
|
3184
3279
|
if (ct === "string" || ct === "number") return {
|
|
@@ -3192,6 +3287,19 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3192
3287
|
};
|
|
3193
3288
|
return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
3194
3289
|
}
|
|
3290
|
+
function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
3291
|
+
const defaultProp = info.formDefaults[prop];
|
|
3292
|
+
if (defaultProp !== undefined && (skip === undefined || !skip(defaultProp))) {
|
|
3293
|
+
if (keysOf !== null) {
|
|
3294
|
+
for (let j = 0; j < keysOf.length; j++) {
|
|
3295
|
+
if (keysOf[j].includes(defaultProp)) return;
|
|
3296
|
+
}
|
|
3297
|
+
} else if (keys.includes(defaultProp)) return;
|
|
3298
|
+
}
|
|
3299
|
+
const attr = info.formAttributes[prop];
|
|
3300
|
+
if (attr !== undefined && skip !== undefined && skip(attr)) return;
|
|
3301
|
+
return attr === undefined ? prop : attr;
|
|
3302
|
+
}
|
|
3195
3303
|
function ssrElementAttribute(key, value) {
|
|
3196
3304
|
if (value == undefined) return "";
|
|
3197
3305
|
if (key === "style" || key === "class") {
|
|
@@ -3202,10 +3310,12 @@ function ssrElementAttribute(key, value) {
|
|
|
3202
3310
|
return value === "" ? ` ${key}` : ` ${key}="${escape(value, true)}"`;
|
|
3203
3311
|
}
|
|
3204
3312
|
function ssrAttribute(key, value) {
|
|
3313
|
+
if (typeof value === "string") return ` ${key}="${value}"`;
|
|
3205
3314
|
if (value == null || value === false) return "";
|
|
3206
3315
|
if (typeof value === "object") {
|
|
3207
3316
|
return isSlotValue(value) ? slotAttribute(key, value) : ` ${key}="${escape(String(value), true)}"`;
|
|
3208
3317
|
}
|
|
3318
|
+
if (typeof value === "function") return ` ${key}="${escape(String(value), true)}"`;
|
|
3209
3319
|
return value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
3210
3320
|
}
|
|
3211
3321
|
function ssrHydrationKey() {
|
|
@@ -3235,13 +3345,18 @@ function slotValue(occurrence, key, value, face) {
|
|
|
3235
3345
|
Object.defineProperty(sv, "toString", {
|
|
3236
3346
|
value: () => slotValueString()
|
|
3237
3347
|
});
|
|
3348
|
+
Object.defineProperty(sv, "w", {
|
|
3349
|
+
value: () => slotText(sv)
|
|
3350
|
+
});
|
|
3238
3351
|
return sv;
|
|
3239
3352
|
}
|
|
3240
3353
|
function slotValueString(sv, reason) {
|
|
3241
3354
|
return "";
|
|
3242
3355
|
}
|
|
3243
|
-
function
|
|
3244
|
-
|
|
3356
|
+
function slotText(sv) {
|
|
3357
|
+
const v = sv.f === SLOT_FACE_DATA ? sv.v : undefined;
|
|
3358
|
+
const text = typeof v === "string" || typeof v === "number" ? escape("" + v) : "";
|
|
3359
|
+
return `<!--${SLOT_MARKER}t=${slotEntry(sv)}-->${text}<!--/${SLOT_MARKER}t-->`;
|
|
3245
3360
|
}
|
|
3246
3361
|
function slotValueInline(kind, sv) {
|
|
3247
3362
|
return undefined;
|
|
@@ -3256,6 +3371,9 @@ function slotEntry(sv, name) {
|
|
|
3256
3371
|
function slotMarker(position, entries) {
|
|
3257
3372
|
return ` ${SLOT_MARKER}${position}="${entries}"`;
|
|
3258
3373
|
}
|
|
3374
|
+
function eventSlotStamp(mode) {
|
|
3375
|
+
return mode === CLAIMS_DOCUMENT ? " _hk" : "";
|
|
3376
|
+
}
|
|
3259
3377
|
function slotAttribute(key, sv) {
|
|
3260
3378
|
let out = "";
|
|
3261
3379
|
if (sv.f === SLOT_FACE_DATA) {
|
|
@@ -3304,6 +3422,7 @@ function eventPosition(prop) {
|
|
|
3304
3422
|
return prop.slice(2).toLowerCase();
|
|
3305
3423
|
}
|
|
3306
3424
|
function spreadBehaviorPosition(behaviors, prop, value, mode, index, settle) {
|
|
3425
|
+
if (!isAttrName(prop)) return behaviors;
|
|
3307
3426
|
const pos = prop === "ref" ? "ref" : eventPosition(prop);
|
|
3308
3427
|
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3309
3428
|
if (!settle) {
|
|
@@ -3350,13 +3469,18 @@ function spreadBehaviorMarkers(behaviors, claims, mode) {
|
|
|
3350
3469
|
}
|
|
3351
3470
|
}
|
|
3352
3471
|
let out = "";
|
|
3472
|
+
let events = false;
|
|
3353
3473
|
if (behaviors !== null) {
|
|
3354
3474
|
for (const [pos, b] of behaviors) {
|
|
3355
3475
|
const e = claims === undefined ? b : b.e;
|
|
3356
|
-
if (e)
|
|
3476
|
+
if (!e) continue;
|
|
3477
|
+
if (pos === "ref") out += slotMarker("ref", e);else {
|
|
3478
|
+
out += slotMarker("on:" + pos, e);
|
|
3479
|
+
events = true;
|
|
3480
|
+
}
|
|
3357
3481
|
}
|
|
3358
3482
|
}
|
|
3359
|
-
return out;
|
|
3483
|
+
return events ? out + eventSlotStamp(mode) : out;
|
|
3360
3484
|
}
|
|
3361
3485
|
function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
3362
3486
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -3385,8 +3509,9 @@ function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
|
3385
3509
|
}
|
|
3386
3510
|
function spreadObjectAttribute(prop, value) {
|
|
3387
3511
|
if (prop === "style" || prop === "class") return slotClassOrStyle(prop, value);
|
|
3388
|
-
if (
|
|
3389
|
-
return
|
|
3512
|
+
if (!isAttrName(prop)) return "";
|
|
3513
|
+
if (value[SLOT_VALUE] !== undefined) return slotAttribute(prop, value);
|
|
3514
|
+
return ` ${prop}="${escape(value, true)}"`;
|
|
3390
3515
|
}
|
|
3391
3516
|
function slotSpreadSource(tag, source) {
|
|
3392
3517
|
return {};
|
|
@@ -3395,13 +3520,21 @@ function ssrClaim(map) {
|
|
|
3395
3520
|
const mode = sharedConfig.context && sharedConfig.context.claims;
|
|
3396
3521
|
if (!mode) return "";
|
|
3397
3522
|
let out = "";
|
|
3523
|
+
let events = false;
|
|
3398
3524
|
for (const pos in map) {
|
|
3399
3525
|
const entries = claimEntries(pos, map[pos]);
|
|
3400
|
-
if (entries)
|
|
3526
|
+
if (!entries) continue;
|
|
3527
|
+
if (pos === "ref") out += slotMarker("ref", entries);else {
|
|
3528
|
+
out += slotMarker("on:" + pos, entries);
|
|
3529
|
+
events = true;
|
|
3530
|
+
}
|
|
3401
3531
|
}
|
|
3402
|
-
return out;
|
|
3532
|
+
return events ? out + eventSlotStamp(mode) : out;
|
|
3403
3533
|
}
|
|
3404
3534
|
function claimEntries(pos, value, mode) {
|
|
3535
|
+
if (Array.isArray(value) && pos !== "ref") {
|
|
3536
|
+
return "";
|
|
3537
|
+
}
|
|
3405
3538
|
if (Array.isArray(value)) {
|
|
3406
3539
|
let entries = "";
|
|
3407
3540
|
for (const v of value) {
|
|
@@ -3415,6 +3548,11 @@ function claimEntries(pos, value, mode) {
|
|
|
3415
3548
|
}
|
|
3416
3549
|
return "";
|
|
3417
3550
|
}
|
|
3551
|
+
function ssrLinkClaim(attrs) {
|
|
3552
|
+
const ctx = renderConfig.context;
|
|
3553
|
+
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
3554
|
+
return ctx.linkClaim(attrs);
|
|
3555
|
+
}
|
|
3418
3556
|
function decodeSSREntities(s) {
|
|
3419
3557
|
return s.indexOf("&") < 0 ? s : s.replace(/"/g, '"').replace(/</g, "<").replace(/&/g, "&");
|
|
3420
3558
|
}
|
|
@@ -3640,10 +3778,13 @@ function applyRef(r, element) {
|
|
|
3640
3778
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
3641
3779
|
}
|
|
3642
3780
|
function generateHydrationScript({
|
|
3643
|
-
eventNames
|
|
3781
|
+
eventNames,
|
|
3644
3782
|
nonce
|
|
3645
3783
|
} = {}) {
|
|
3646
|
-
return
|
|
3784
|
+
return hydrationBootstrap(eventNames, scriptNonce(nonce), false);
|
|
3785
|
+
}
|
|
3786
|
+
function hydrationBootstrap(eventNames = ["click", "input"], nonce, ledger) {
|
|
3787
|
+
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-->`;
|
|
3647
3788
|
}
|
|
3648
3789
|
function queue(fn) {
|
|
3649
3790
|
return Promise.resolve().then(fn);
|
|
@@ -3656,6 +3797,11 @@ function allSettled(promises) {
|
|
|
3656
3797
|
return size;
|
|
3657
3798
|
});
|
|
3658
3799
|
}
|
|
3800
|
+
function shellEndMarker(context, renderId, nonce, noScripts) {
|
|
3801
|
+
if (noScripts || !context || !context.bootstrap) return "";
|
|
3802
|
+
const id = JSON.stringify(renderId).replace(/</g, "\\u003C");
|
|
3803
|
+
return `<script${nonceAttr(nonce, "script")}>_$HY.s[${id}]=1,_$HY.sw&&_$HY.sw(${id})</script>`;
|
|
3804
|
+
}
|
|
3659
3805
|
function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
|
|
3660
3806
|
const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
|
|
3661
3807
|
const title = headTags ? headTags.title : null;
|
|
@@ -3846,6 +3992,10 @@ function tryResolveString(node, nested) {
|
|
|
3846
3992
|
if (node.h && node.h.length > 0) return {
|
|
3847
3993
|
merge: node
|
|
3848
3994
|
};
|
|
3995
|
+
if (node[SLOT_VALUE] !== undefined) {
|
|
3996
|
+
ssrTextTail = false;
|
|
3997
|
+
return node.w();
|
|
3998
|
+
}
|
|
3849
3999
|
if (node.t === undefined) {
|
|
3850
4000
|
return "";
|
|
3851
4001
|
}
|
|
@@ -3899,9 +4049,8 @@ function resolveSSRNode(node, result = {
|
|
|
3899
4049
|
result.t[result.t.length - 1] += node.t;
|
|
3900
4050
|
ssrTextTail = false;
|
|
3901
4051
|
} else if (node[SLOT_VALUE] !== undefined) {
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
ssrTextTail = true;
|
|
4052
|
+
result.t[result.t.length - 1] += node.w();
|
|
4053
|
+
ssrTextTail = false;
|
|
3905
4054
|
} else ;
|
|
3906
4055
|
} else if (t === "function") {
|
|
3907
4056
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
@@ -3954,6 +4103,14 @@ function configureServerErrors(config) {
|
|
|
3954
4103
|
}
|
|
3955
4104
|
(g[ServerErrors] ||= {}).hook = config ? config.onError : undefined;
|
|
3956
4105
|
}
|
|
4106
|
+
function reportRequestFailure(error, event) {
|
|
4107
|
+
reportServerError(error, {
|
|
4108
|
+
kind: "request",
|
|
4109
|
+
handling: "failed",
|
|
4110
|
+
event
|
|
4111
|
+
}, null);
|
|
4112
|
+
if (ambientServerErrorHook() === undefined) console.error(error);
|
|
4113
|
+
}
|
|
3957
4114
|
function getRequestEvent() {
|
|
3958
4115
|
const store = globalThis[RequestContext];
|
|
3959
4116
|
if (!store) return undefined;
|
|
@@ -3997,13 +4154,30 @@ function createHydrationWriter(context, isOpen) {
|
|
|
3997
4154
|
};
|
|
3998
4155
|
}
|
|
3999
4156
|
function getHydrationWriter() {
|
|
4157
|
+
const ctx = currentRenderContext();
|
|
4158
|
+
return ctx && ctx.writer;
|
|
4159
|
+
}
|
|
4160
|
+
function currentRenderContext() {
|
|
4000
4161
|
let ctx = renderContextOf(getOwner());
|
|
4001
4162
|
if (!ctx) {
|
|
4002
4163
|
const event = peekRequestEvent();
|
|
4003
4164
|
const renders = event && eventRenders.get(event);
|
|
4004
4165
|
if (renders && renders.size === 1) for (const c of renders) ctx = c;
|
|
4005
4166
|
}
|
|
4006
|
-
return ctx
|
|
4167
|
+
return ctx;
|
|
4168
|
+
}
|
|
4169
|
+
const LINK_STATE_RECORD = "links";
|
|
4170
|
+
function setLinkClaim(handler) {
|
|
4171
|
+
const ctx = currentRenderContext();
|
|
4172
|
+
if (!ctx) {
|
|
4173
|
+
return false;
|
|
4174
|
+
}
|
|
4175
|
+
ctx.linkClaim = handler;
|
|
4176
|
+
if (handler !== undefined) ctx.writer.write(LINK_STATE_RECORD, 1);
|
|
4177
|
+
return true;
|
|
4178
|
+
}
|
|
4179
|
+
function hasServerLinkState() {
|
|
4180
|
+
return false;
|
|
4007
4181
|
}
|
|
4008
4182
|
function takeHydrationValue(_key) {
|
|
4009
4183
|
return undefined;
|
|
@@ -4102,10 +4276,13 @@ function copyInitHeaders(init) {
|
|
|
4102
4276
|
for (const cookie of init.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
4103
4277
|
return headers;
|
|
4104
4278
|
}
|
|
4105
|
-
|
|
4106
|
-
|
|
4279
|
+
let stubGapFillExcluded;
|
|
4280
|
+
function isStubGapFillExcluded(key) {
|
|
4281
|
+
return (stubGapFillExcluded ||= new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location",
|
|
4282
|
+
...COMPOSED_BODY_FRAMING].map(header => header.toLowerCase()))).has(key);
|
|
4283
|
+
}
|
|
4107
4284
|
function fillsStubGap(key, headers, response) {
|
|
4108
|
-
if (key === "set-cookie" ||
|
|
4285
|
+
if (key === "set-cookie" || isStubGapFillExcluded(key)) return false;
|
|
4109
4286
|
if (response.body === null && (key === "content-type" || key === "content-length")) return false;
|
|
4110
4287
|
return !headers.has(key);
|
|
4111
4288
|
}
|
|
@@ -4197,7 +4374,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4197
4374
|
closed = true;
|
|
4198
4375
|
}
|
|
4199
4376
|
};
|
|
4200
|
-
|
|
4377
|
+
const sink = {
|
|
4201
4378
|
write(chunk) {
|
|
4202
4379
|
if (!flushed) {
|
|
4203
4380
|
flushed = true;
|
|
@@ -4212,6 +4389,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4212
4389
|
status: getExpectedRedirectStatus(stub),
|
|
4213
4390
|
headers: head.headers
|
|
4214
4391
|
}));
|
|
4392
|
+
sink[ABANDON_RENDER]("redirect", true);
|
|
4215
4393
|
return;
|
|
4216
4394
|
}
|
|
4217
4395
|
if (!head.headers.has("content-type")) {
|
|
@@ -4222,7 +4400,9 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4222
4400
|
controller = c;
|
|
4223
4401
|
},
|
|
4224
4402
|
cancel() {
|
|
4403
|
+
if (closed) return;
|
|
4225
4404
|
closed = true;
|
|
4405
|
+
sink[ABANDON_RENDER]("consumer");
|
|
4226
4406
|
}
|
|
4227
4407
|
}), {
|
|
4228
4408
|
status: head.status,
|
|
@@ -4233,6 +4413,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4233
4413
|
enqueue(transformChunk ? transformChunk(chunk) : chunk);
|
|
4234
4414
|
},
|
|
4235
4415
|
end() {
|
|
4416
|
+
if (!flushed) sink.write("");
|
|
4236
4417
|
if (closed || !controller) return;
|
|
4237
4418
|
const location = stub && stub.headers.get("Location");
|
|
4238
4419
|
if (location && isHttpNavigationTarget(location)) {
|
|
@@ -4243,8 +4424,23 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4243
4424
|
try {
|
|
4244
4425
|
controller.close();
|
|
4245
4426
|
} catch {}
|
|
4246
|
-
}
|
|
4247
|
-
|
|
4427
|
+
},
|
|
4428
|
+
[SHELL_ABANDONED]() {
|
|
4429
|
+
if (flushed) return;
|
|
4430
|
+
flushed = closed = true;
|
|
4431
|
+
if (stub) commitResponseStub(stub, {
|
|
4432
|
+
event
|
|
4433
|
+
});
|
|
4434
|
+
const head = deriveHead(stub, responseInit);
|
|
4435
|
+
const status = stub && stub.headers.get("Location") ? getExpectedRedirectStatus(stub) : 500;
|
|
4436
|
+
resolve(new Response(null, {
|
|
4437
|
+
status,
|
|
4438
|
+
headers: head.headers
|
|
4439
|
+
}));
|
|
4440
|
+
},
|
|
4441
|
+
[ABANDON_RENDER]() {}
|
|
4442
|
+
};
|
|
4443
|
+
result.pipe(sink);
|
|
4248
4444
|
});
|
|
4249
4445
|
}
|
|
4250
4446
|
function composeMiddleware(middlewares) {
|
|
@@ -4269,6 +4465,9 @@ function claimElement(node) {
|
|
|
4269
4465
|
function claimElementTree(root) {
|
|
4270
4466
|
return root;
|
|
4271
4467
|
}
|
|
4468
|
+
function dispatchAsInteraction(_e, fn) {
|
|
4469
|
+
return fn();
|
|
4470
|
+
}
|
|
4272
4471
|
function notSup() {
|
|
4273
4472
|
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
4274
4473
|
}
|
|
@@ -4277,71 +4476,9 @@ setContainerTraceResolver(getProjectionTrace);
|
|
|
4277
4476
|
setAsyncIterableSharer(shareAsyncIterable);
|
|
4278
4477
|
const isServer = true;
|
|
4279
4478
|
const isDev = false;
|
|
4479
|
+
const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
|
|
4280
4480
|
function dynamic(source, options) {
|
|
4281
|
-
|
|
4282
|
-
const component = untrack(source);
|
|
4283
|
-
if (typeof component === "function") return props => component(props);
|
|
4284
|
-
if (typeof component === "string") return props => ssrElement(component, props, undefined, true);
|
|
4285
|
-
return () => undefined;
|
|
4286
|
-
}
|
|
4287
|
-
const cached = createMemo(() => {
|
|
4288
|
-
const next = source();
|
|
4289
|
-
if (!next || typeof next.then !== "function") return next;
|
|
4290
|
-
return {
|
|
4291
|
-
[FLIGHT]: next
|
|
4292
|
-
};
|
|
4293
|
-
});
|
|
4294
|
-
const deferStream = !!options?.deferStream;
|
|
4295
|
-
return props => {
|
|
4296
|
-
const ctx = sharedConfig.context;
|
|
4297
|
-
let gated = !deferStream || !ctx?.async;
|
|
4298
|
-
const value = createMemo(() => {
|
|
4299
|
-
let c;
|
|
4300
|
-
try {
|
|
4301
|
-
c = cached();
|
|
4302
|
-
} catch (err) {
|
|
4303
|
-
if (!gated && err instanceof NotReadyError && !err.source?.$clientHole) {
|
|
4304
|
-
gated = true;
|
|
4305
|
-
ctx.block(Promise.resolve(err.source).then(() => {}, () => {}));
|
|
4306
|
-
}
|
|
4307
|
-
throw err;
|
|
4308
|
-
}
|
|
4309
|
-
if (!c || !c[FLIGHT]) return c;
|
|
4310
|
-
const next = c[FLIGHT];
|
|
4311
|
-
return {
|
|
4312
|
-
then: (onFulfilled, onRejected) => next.then(resolved => {
|
|
4313
|
-
let landed;
|
|
4314
|
-
try {
|
|
4315
|
-
landed = classifyLanding(resolved);
|
|
4316
|
-
} catch (err) {
|
|
4317
|
-
if (onRejected) return onRejected(err);
|
|
4318
|
-
throw err;
|
|
4319
|
-
}
|
|
4320
|
-
return onFulfilled ? onFulfilled(landed) : landed;
|
|
4321
|
-
}, onRejected)
|
|
4322
|
-
};
|
|
4323
|
-
}, {
|
|
4324
|
-
deferStream
|
|
4325
|
-
});
|
|
4326
|
-
return createMemo(() => {
|
|
4327
|
-
const c = value();
|
|
4328
|
-
if (c) {
|
|
4329
|
-
if (typeof c === "function") return c(props);
|
|
4330
|
-
if (typeof c === "string") {
|
|
4331
|
-
return ssrElement(c, props, undefined, true);
|
|
4332
|
-
}
|
|
4333
|
-
}
|
|
4334
|
-
}, {
|
|
4335
|
-
sync: true
|
|
4336
|
-
});
|
|
4337
|
-
};
|
|
4338
|
-
}
|
|
4339
|
-
const FLIGHT = Symbol("solid.dynamic-flight");
|
|
4340
|
-
const SERVER_COMPONENT = Symbol.for("solid.server-component");
|
|
4341
|
-
function classifyLanding(resolved) {
|
|
4342
|
-
if (typeof resolved !== "function" || SERVER_COMPONENT in resolved) return resolved;
|
|
4343
|
-
const message = "[DYNAMIC_ASYNC_COMPONENT] An async dynamic() source resolved to a client component function";
|
|
4344
|
-
throw new Error(message);
|
|
4481
|
+
return dynamicCore(source, options, ssrTag);
|
|
4345
4482
|
}
|
|
4346
4483
|
function Dynamic(props) {
|
|
4347
4484
|
const Comp = dynamic(() => props.component);
|
|
@@ -4471,4 +4608,4 @@ function httpHeader(name, value, options) {
|
|
|
4471
4608
|
}
|
|
4472
4609
|
}
|
|
4473
4610
|
|
|
4474
|
-
export { CLAIMS_DOCUMENT, CLAIMS_STREAM, 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, SLOT_FACE_DATA, SLOT_FACE_MARKUP, SLOT_FACE_STREAM, SLOT_MARKER, SLOT_VALUE, 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, 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, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, isSlotValue, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, slotValue, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperty, notSup as style, styleNonce, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|
|
4611
|
+
export { CLAIMS_DOCUMENT, CLAIMS_STREAM, 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, SLOT_FACE_DATA, SLOT_FACE_MARKUP, SLOT_FACE_STREAM, SLOT_MARKER, SLOT_VALUE, 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, isSlotValue, 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, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStyleProperty, slotValue, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, styleNonce, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|