@solidjs/web 2.0.0-rc.13 → 2.0.0-rc.14
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 +200 -73
- package/dist/server.js +182 -59
- package/dist/server.observe.js +183 -60
- package/dist/web.dev.js +70 -35
- package/dist/web.js +43 -31
- package/dist/web.observe.js +43 -33
- 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 +605 -1086
- package/frames/dist/client.js +572 -1066
- package/frames/dist/client.observe.js +571 -1066
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +339 -177
- package/frames/dist/server.js +335 -173
- package/frames/dist/server.observe.js +335 -173
- package/frames/dist/trace.js +42 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +28 -2
- 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 +37 -8
- package/serialization/dist/serialization.js +39 -10
- package/serialization/types/serializer-decode.d.ts +24 -2
- package/server-functions/dist/client.dev.js +99 -61
- package/server-functions/dist/client.js +99 -61
- package/server-functions/dist/client.observe.js +99 -61
- package/server-functions/dist/server.dev.js +87 -50
- package/server-functions/dist/server.js +87 -50
- package/server-functions/dist/server.observe.js +87 -50
- package/skills/server-components/SKILL.md +65 -43
- package/types/client.d.ts +20 -0
- package/types/constants.d.ts +2 -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 +32 -8
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/wire-tier.d.ts +116 -0
- package/types/index.d.ts +38 -0
- package/types/index.server.d.ts +9 -0
- package/types/jsx.d.ts +1 -1
- package/types/observe.d.ts +4 -2
- package/types/serializer-decode.d.ts +24 -2
- package/types/server-functions/client.d.ts +26 -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 +13 -1
- package/types/server.d.ts +34 -8
package/dist/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId, untrack, NotReadyError } from 'solid-js';
|
|
2
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,
|
|
3
|
+
import { sharedConfig, ssrSanitizeError, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, 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 = {
|
|
@@ -59,6 +59,10 @@ function isHttpNavigationTarget(target) {
|
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
function isEventName(name) {
|
|
63
|
+
let c;
|
|
64
|
+
return name.startsWith("on") && (c = name.charCodeAt(2)) > 64 && c < 91;
|
|
65
|
+
}
|
|
62
66
|
|
|
63
67
|
const transparentOptions = {
|
|
64
68
|
transparent: true,
|
|
@@ -376,10 +380,10 @@ function isShareableIterable(value) {
|
|
|
376
380
|
return false;
|
|
377
381
|
}
|
|
378
382
|
}
|
|
379
|
-
function materialize(marker) {
|
|
383
|
+
function materialize(marker, claiming) {
|
|
380
384
|
let value = state.materialized.get(marker.$tr);
|
|
381
385
|
if (value === undefined) {
|
|
382
|
-
value = state.materializeTrace(marker);
|
|
386
|
+
value = state.materializeTrace(marker, claiming);
|
|
383
387
|
state.materialized.set(marker.$tr, value);
|
|
384
388
|
if (value !== null && typeof value === "object") state.materializedValues.add(value);
|
|
385
389
|
}
|
|
@@ -437,23 +441,22 @@ setContainerTraceStreamMint(iterable => {
|
|
|
437
441
|
})();
|
|
438
442
|
return stream;
|
|
439
443
|
});
|
|
440
|
-
const DEFAULT_WEB_PLUGINS = Object.freeze([AbortSignalPlugin,
|
|
444
|
+
const DEFAULT_WEB_PLUGINS = /* @__PURE__ */Object.freeze([AbortSignalPlugin,
|
|
441
445
|
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
442
446
|
FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin,
|
|
443
447
|
ContainerTracePlugin]);
|
|
444
448
|
function resolveSerializerPlugins(customPlugins) {
|
|
445
449
|
return customPlugins ? [...customPlugins, ...DEFAULT_WEB_PLUGINS] : [...DEFAULT_WEB_PLUGINS];
|
|
446
450
|
}
|
|
447
|
-
Feature.RegExp;
|
|
448
451
|
|
|
449
|
-
const
|
|
452
|
+
const defaultDisabledFeatures = () => Feature.AggregateError | Feature.BigIntTypedArray;
|
|
450
453
|
const serializeOnlyDisabledFeatures = serializeErrorStacks => (serializeErrorStacks === undefined ? process.env.NODE_ENV === "development" : serializeErrorStacks) ? 0 : Feature.ErrorPrototypeStack;
|
|
451
454
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
452
455
|
function createSerializer(options) {
|
|
453
456
|
return new Serializer({
|
|
454
457
|
...options,
|
|
455
458
|
plugins: resolveSerializerPlugins(options.plugins),
|
|
456
|
-
disabledFeatures: (options.disabledFeatures === undefined ?
|
|
459
|
+
disabledFeatures: (options.disabledFeatures === undefined ? defaultDisabledFeatures() : options.disabledFeatures) | serializeOnlyDisabledFeatures(options.serializeErrorStacks)
|
|
457
460
|
});
|
|
458
461
|
}
|
|
459
462
|
function createHydrationSerializer({
|
|
@@ -652,7 +655,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
652
655
|
return cookie;
|
|
653
656
|
}
|
|
654
657
|
const FLASH_COOKIE = "flash";
|
|
655
|
-
const FLASH_MATCHER =
|
|
658
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
656
659
|
function hasFlashCookie(cookieHeader) {
|
|
657
660
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
658
661
|
}
|
|
@@ -664,7 +667,6 @@ const ERROR_HEADER = "X-Server-Function-Error";
|
|
|
664
667
|
const BODY_FORMAT_HEADER = "X-Server-Function-Format";
|
|
665
668
|
const REDIRECT_HEADER = "X-Server-Function-Redirect";
|
|
666
669
|
const SINGLE_FLIGHT_HEADER = "X-Single-Flight";
|
|
667
|
-
new TextEncoder().encode(":\n\n");
|
|
668
670
|
|
|
669
671
|
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
670
672
|
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
@@ -1316,7 +1318,7 @@ function flushHeadFragment(registry, boundary, nonce) {
|
|
|
1316
1318
|
const t = winner.tags[i];
|
|
1317
1319
|
const attrs = {};
|
|
1318
1320
|
for (const name in t.props) {
|
|
1319
|
-
if (name === "children" || name === "ref" || name
|
|
1321
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1320
1322
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1321
1323
|
continue;
|
|
1322
1324
|
}
|
|
@@ -1405,7 +1407,7 @@ function nonceAttr(nonce, destination) {
|
|
|
1405
1407
|
function renderHeadAttrHtml(props) {
|
|
1406
1408
|
let attrs = "";
|
|
1407
1409
|
for (const name in props) {
|
|
1408
|
-
if (name === "children" || name === "ref" || name
|
|
1410
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1409
1411
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1410
1412
|
continue;
|
|
1411
1413
|
}
|
|
@@ -1418,7 +1420,7 @@ function renderHeadAttrHtml(props) {
|
|
|
1418
1420
|
function headAttrRecord(props, skipRelHref) {
|
|
1419
1421
|
let attrs = null;
|
|
1420
1422
|
for (const name in props) {
|
|
1421
|
-
if (name === "children" || name === "ref" || name
|
|
1423
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1422
1424
|
if ((name === "rel" || name === "href")) continue;
|
|
1423
1425
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1424
1426
|
const v = props[name];
|
|
@@ -1444,10 +1446,13 @@ function useHead(tags) {
|
|
|
1444
1446
|
ctx.registerHeadTags(tags);
|
|
1445
1447
|
}
|
|
1446
1448
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
1449
|
+
const NOT_NAME = /[\0-\x20\x7F-\x9F"'<>/=]/;
|
|
1450
|
+
const TAG_START = /^[a-zA-Z]/;
|
|
1447
1451
|
const tagInfos = /*#__PURE__*/new Map();
|
|
1448
1452
|
function tagInfo(tag) {
|
|
1449
1453
|
let info = tagInfos.get(tag);
|
|
1450
1454
|
if (info === undefined) {
|
|
1455
|
+
if (!TAG_START.test(tag) || NOT_NAME.test(tag)) throw new Error(`"${tag}" is not a valid tag name`);
|
|
1451
1456
|
info = {
|
|
1452
1457
|
open: "<" + tag,
|
|
1453
1458
|
close: "</" + tag + ">",
|
|
@@ -1460,13 +1465,13 @@ function tagInfo(tag) {
|
|
|
1460
1465
|
return info;
|
|
1461
1466
|
}
|
|
1462
1467
|
const safeAttrNames = /*#__PURE__*/new Set();
|
|
1463
|
-
function
|
|
1464
|
-
if (safeAttrNames.has(prop)) return
|
|
1465
|
-
|
|
1466
|
-
if (
|
|
1467
|
-
return
|
|
1468
|
+
function isAttrName(prop) {
|
|
1469
|
+
if (safeAttrNames.has(prop)) return true;
|
|
1470
|
+
if (prop === "" || NOT_NAME.test(prop)) return false;
|
|
1471
|
+
if (safeAttrNames.size < 512) safeAttrNames.add(prop);
|
|
1472
|
+
return true;
|
|
1468
1473
|
}
|
|
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])}`;
|
|
1474
|
+
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
1475
|
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
1476
|
function renderToString(code, options = {}) {
|
|
1472
1477
|
const {
|
|
@@ -1561,12 +1566,20 @@ function renderToString(code, options = {}) {
|
|
|
1561
1566
|
}
|
|
1562
1567
|
rendered = true;
|
|
1563
1568
|
return document;
|
|
1569
|
+
} catch (err) {
|
|
1570
|
+
reportServerError(err, {
|
|
1571
|
+
kind: "render",
|
|
1572
|
+
handling: "failed"
|
|
1573
|
+
}, null, options.onError);
|
|
1574
|
+
throw err;
|
|
1564
1575
|
} finally {
|
|
1565
1576
|
if (render) settleRender(render, rootOwner, rendered ? "complete" : "error");
|
|
1566
1577
|
context.trace = undefined;
|
|
1567
1578
|
if (dispose) dispose();
|
|
1568
1579
|
}
|
|
1569
1580
|
}
|
|
1581
|
+
const SHELL_ABANDONED = Symbol();
|
|
1582
|
+
const ABANDON_RENDER = Symbol();
|
|
1570
1583
|
function renderToStream(code, options = {}) {
|
|
1571
1584
|
let {
|
|
1572
1585
|
onCompleteShell,
|
|
@@ -1587,6 +1600,7 @@ function renderToStream(code, options = {}) {
|
|
|
1587
1600
|
let disconnected = false;
|
|
1588
1601
|
let failed = false;
|
|
1589
1602
|
let onFailed;
|
|
1603
|
+
let onDisconnectedBeforeShell;
|
|
1590
1604
|
const defuse = p => {
|
|
1591
1605
|
if (p && typeof p.then === "function") p.then(undefined, () => {});
|
|
1592
1606
|
};
|
|
@@ -1605,7 +1619,7 @@ function renderToStream(code, options = {}) {
|
|
|
1605
1619
|
complete(sink);
|
|
1606
1620
|
} : complete;
|
|
1607
1621
|
};
|
|
1608
|
-
const abandon = disconnect => {
|
|
1622
|
+
const abandon = (disconnect, quiet) => {
|
|
1609
1623
|
if (dead) return;
|
|
1610
1624
|
dead = true;
|
|
1611
1625
|
completed = true;
|
|
@@ -1641,7 +1655,7 @@ function renderToStream(code, options = {}) {
|
|
|
1641
1655
|
if (!disconnect) {
|
|
1642
1656
|
failed = true;
|
|
1643
1657
|
onFailed && onFailed(sink);
|
|
1644
|
-
}
|
|
1658
|
+
} else if (!sink && onDisconnectedBeforeShell) onDisconnectedBeforeShell();
|
|
1645
1659
|
};
|
|
1646
1660
|
const failRender = err => {
|
|
1647
1661
|
reportServerError(err, {
|
|
@@ -1758,10 +1772,10 @@ function renderToStream(code, options = {}) {
|
|
|
1758
1772
|
const styleAttr = nonceAttr(nonce, "style");
|
|
1759
1773
|
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
1760
1774
|
writeTasks();
|
|
1775
|
+
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1761
1776
|
for (const entry of styles.links) {
|
|
1762
|
-
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr}
|
|
1777
|
+
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} data-dfc="${key}">` : `<link${entry.attrHtml}${styleAttr} data-dfc="${key}">`);
|
|
1763
1778
|
}
|
|
1764
|
-
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1765
1779
|
} else {
|
|
1766
1780
|
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1767
1781
|
if (!deferActivation) {
|
|
@@ -1803,7 +1817,7 @@ function renderToStream(code, options = {}) {
|
|
|
1803
1817
|
};
|
|
1804
1818
|
let holds = 0;
|
|
1805
1819
|
const flushEnd = () => {
|
|
1806
|
-
if (!registry.size && !holds) {
|
|
1820
|
+
if (!registry.size && !holds && !rootHoles) {
|
|
1807
1821
|
serializeRootAssets();
|
|
1808
1822
|
queue(() => queue(() => {
|
|
1809
1823
|
if (context.live.end) {
|
|
@@ -1929,6 +1943,12 @@ function renderToStream(code, options = {}) {
|
|
|
1929
1943
|
}
|
|
1930
1944
|
let rootHoles = null;
|
|
1931
1945
|
let nextHoleId = 0;
|
|
1946
|
+
let parkedInlines = null;
|
|
1947
|
+
function inlineFragment(key, value) {
|
|
1948
|
+
if (rootHoles && !html.includes(`<template id="pl-${key}">`)) {
|
|
1949
|
+
(parkedInlines ||= new Map()).set(key, value);
|
|
1950
|
+
} else html = replacePlaceholder(html, key, value);
|
|
1951
|
+
}
|
|
1932
1952
|
let buffer = {
|
|
1933
1953
|
write(payload) {
|
|
1934
1954
|
tmp += payload;
|
|
@@ -2057,11 +2077,16 @@ function renderToStream(code, options = {}) {
|
|
|
2057
2077
|
});
|
|
2058
2078
|
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else serializer.write(key + "_fr", p);
|
|
2059
2079
|
}
|
|
2060
|
-
return (value, error) => {
|
|
2080
|
+
return (value, error, escaped) => {
|
|
2061
2081
|
if (registry.has(key)) {
|
|
2062
2082
|
const item = registry.get(key);
|
|
2063
2083
|
registry.delete(key);
|
|
2064
2084
|
if (error) abandonSubtree(key);
|
|
2085
|
+
if (error && escaped) {
|
|
2086
|
+
const wire = ssrSanitizeError(error, null);
|
|
2087
|
+
const message = wire instanceof Error ? wire.message : String(wire);
|
|
2088
|
+
if (sink.error) sink.error("", message);else if (context.live && context.live.error) context.live.error(escaped.frame, message);
|
|
2089
|
+
}
|
|
2065
2090
|
if (item.children && !error) {
|
|
2066
2091
|
for (const k in item.children) {
|
|
2067
2092
|
value = replacePlaceholder(value, k, item.children[k]);
|
|
@@ -2081,7 +2106,7 @@ function renderToStream(code, options = {}) {
|
|
|
2081
2106
|
if (!completed) {
|
|
2082
2107
|
if (error) dropHeadBoundary(headRegistry, key);
|
|
2083
2108
|
if (!firstFlushed) {
|
|
2084
|
-
queue(() =>
|
|
2109
|
+
queue(() => inlineFragment(key, value !== undefined ? value : ""));
|
|
2085
2110
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
2086
2111
|
item.resolve(error);
|
|
2087
2112
|
} else {
|
|
@@ -2125,7 +2150,7 @@ function renderToStream(code, options = {}) {
|
|
|
2125
2150
|
registerEntryAssets(manifest);
|
|
2126
2151
|
context.writer = createHydrationWriter(context, () => !completed);
|
|
2127
2152
|
const signal = options.signal;
|
|
2128
|
-
const onAbort = signal ? () => abandon("signal") : undefined;
|
|
2153
|
+
const onAbort = signal ? () => abandon("signal", !!(signal.reason && signal.reason.quiet === true)) : undefined;
|
|
2129
2154
|
let html = createRoot(d => {
|
|
2130
2155
|
dispose = () => {
|
|
2131
2156
|
context.trace = undefined;
|
|
@@ -2134,7 +2159,16 @@ function renderToStream(code, options = {}) {
|
|
|
2134
2159
|
};
|
|
2135
2160
|
rootOwner = claimRenderRoot(context);
|
|
2136
2161
|
if (requestEvent) claimEventRender(requestEvent, context);
|
|
2137
|
-
|
|
2162
|
+
let res;
|
|
2163
|
+
try {
|
|
2164
|
+
res = resolveSSRNode(escape(code()));
|
|
2165
|
+
} catch (err) {
|
|
2166
|
+
reportServerError(err, {
|
|
2167
|
+
kind: "render",
|
|
2168
|
+
handling: "failed"
|
|
2169
|
+
}, null, options.onError);
|
|
2170
|
+
throw err;
|
|
2171
|
+
}
|
|
2138
2172
|
if (!res.h.length) return res.t[0];
|
|
2139
2173
|
rootHoles = [];
|
|
2140
2174
|
let out = res.t[0];
|
|
@@ -2181,6 +2215,13 @@ function renderToStream(code, options = {}) {
|
|
|
2181
2215
|
for (const p of res.p) blockingPromises.add(p);
|
|
2182
2216
|
}
|
|
2183
2217
|
}
|
|
2218
|
+
if (parkedInlines) {
|
|
2219
|
+
for (const [key, value] of parkedInlines) {
|
|
2220
|
+
if (!html.includes(`<template id="pl-${key}">`)) continue;
|
|
2221
|
+
html = replacePlaceholder(html, key, value);
|
|
2222
|
+
parkedInlines.delete(key);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2184
2225
|
if (pending.length) {
|
|
2185
2226
|
rootHoles = pending;
|
|
2186
2227
|
return false;
|
|
@@ -2342,11 +2383,16 @@ function renderToStream(code, options = {}) {
|
|
|
2342
2383
|
},
|
|
2343
2384
|
pipe(w) {
|
|
2344
2385
|
claimConsumer("pipe");
|
|
2386
|
+
const abandoned = w[SHELL_ABANDONED];
|
|
2345
2387
|
onFailure(sink => {
|
|
2346
2388
|
try {
|
|
2347
|
-
sink ? sink.end() : w.end();
|
|
2389
|
+
sink ? sink.end() : abandoned ? abandoned() : w.end();
|
|
2348
2390
|
} catch (_) {}
|
|
2349
2391
|
});
|
|
2392
|
+
if (abandoned) {
|
|
2393
|
+
w[ABANDON_RENDER] = abandon;
|
|
2394
|
+
if (disconnected) abandoned();else onDisconnectedBeforeShell = abandoned;
|
|
2395
|
+
}
|
|
2350
2396
|
function flush() {
|
|
2351
2397
|
allSettled(blockingPromises).then(awaited => {
|
|
2352
2398
|
scheduleFlush(() => {
|
|
@@ -3084,6 +3130,14 @@ function ssrStyleProperty(name, value) {
|
|
|
3084
3130
|
if (isSlotValue(value)) value = slotValueInline();
|
|
3085
3131
|
return value != null ? name + value : "";
|
|
3086
3132
|
}
|
|
3133
|
+
function ssrStyleProperties(...entries) {
|
|
3134
|
+
let result = "";
|
|
3135
|
+
for (let i = 0; i < entries.length; i += 2) {
|
|
3136
|
+
const entry = ssrStyleProperty(entries[i], entries[i + 1]);
|
|
3137
|
+
if (entry) result = result ? result + ";" + entry : entry;
|
|
3138
|
+
}
|
|
3139
|
+
return result;
|
|
3140
|
+
}
|
|
3087
3141
|
function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
3088
3142
|
const hk = needsId ? ssrHydrationKey() : "";
|
|
3089
3143
|
if (typeof props === "function") props = props();
|
|
@@ -3123,6 +3177,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3123
3177
|
const skipChildren = info.isVoid;
|
|
3124
3178
|
let result = info.open + hk;
|
|
3125
3179
|
let behaviors = null;
|
|
3180
|
+
let childOwner = null;
|
|
3126
3181
|
const last = sources === null ? 0 : sources.length - 1;
|
|
3127
3182
|
let keysOf = null;
|
|
3128
3183
|
if (sources !== null) {
|
|
@@ -3145,18 +3200,20 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3145
3200
|
continue;
|
|
3146
3201
|
}
|
|
3147
3202
|
if (ChildProperties.has(prop)) {
|
|
3148
|
-
if (children === undefined &&
|
|
3203
|
+
if (children === undefined && childOwner === null && !skipChildren) {
|
|
3204
|
+
if (prop === "children") childOwner = props;else children = info.raw || prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
3205
|
+
}
|
|
3149
3206
|
continue;
|
|
3150
3207
|
}
|
|
3151
3208
|
const value = props[prop];
|
|
3152
3209
|
if (value == undefined) {
|
|
3153
|
-
if (slots && claims !== undefined && (prop === "ref" || prop
|
|
3210
|
+
if (slots && claims !== undefined && (prop === "ref" || isEventName(prop))) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, true);
|
|
3154
3211
|
continue;
|
|
3155
3212
|
}
|
|
3156
3213
|
if (prop.startsWith("prop:")) {
|
|
3157
3214
|
continue;
|
|
3158
3215
|
}
|
|
3159
|
-
if (prop === "ref" || prop
|
|
3216
|
+
if (prop === "ref" || isEventName(prop)) {
|
|
3160
3217
|
if (slots) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, claims !== undefined);
|
|
3161
3218
|
continue;
|
|
3162
3219
|
}
|
|
@@ -3167,10 +3224,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3167
3224
|
} else if (prop === "class") {
|
|
3168
3225
|
result += ` class="${ssrClassName(value)}"`;
|
|
3169
3226
|
} else if (typeof value === "boolean") {
|
|
3170
|
-
if (
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
result += value === "" ? ` ${attrName(prop)}` : ` ${attrName(prop)}="${escape(value, true)}"`;
|
|
3227
|
+
if (value && isAttrName(prop)) result += ` ${prop}`;
|
|
3228
|
+
} else if (isAttrName(prop)) {
|
|
3229
|
+
result += value === "" ? ` ${prop}` : ` ${prop}="${escape(value, true)}"`;
|
|
3174
3230
|
}
|
|
3175
3231
|
}
|
|
3176
3232
|
}
|
|
@@ -3179,6 +3235,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3179
3235
|
if (skipChildren) return {
|
|
3180
3236
|
t: result + " />"
|
|
3181
3237
|
};
|
|
3238
|
+
if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
|
|
3182
3239
|
if (typeof children === "function") children = children();
|
|
3183
3240
|
const ct = typeof children;
|
|
3184
3241
|
if (ct === "string" || ct === "number") return {
|
|
@@ -3202,10 +3259,12 @@ function ssrElementAttribute(key, value) {
|
|
|
3202
3259
|
return value === "" ? ` ${key}` : ` ${key}="${escape(value, true)}"`;
|
|
3203
3260
|
}
|
|
3204
3261
|
function ssrAttribute(key, value) {
|
|
3262
|
+
if (typeof value === "string") return ` ${key}="${value}"`;
|
|
3205
3263
|
if (value == null || value === false) return "";
|
|
3206
3264
|
if (typeof value === "object") {
|
|
3207
3265
|
return isSlotValue(value) ? slotAttribute(key, value) : ` ${key}="${escape(String(value), true)}"`;
|
|
3208
3266
|
}
|
|
3267
|
+
if (typeof value === "function") return ` ${key}="${escape(String(value), true)}"`;
|
|
3209
3268
|
return value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
3210
3269
|
}
|
|
3211
3270
|
function ssrHydrationKey() {
|
|
@@ -3235,13 +3294,18 @@ function slotValue(occurrence, key, value, face) {
|
|
|
3235
3294
|
Object.defineProperty(sv, "toString", {
|
|
3236
3295
|
value: () => slotValueString()
|
|
3237
3296
|
});
|
|
3297
|
+
Object.defineProperty(sv, "w", {
|
|
3298
|
+
value: () => slotText(sv)
|
|
3299
|
+
});
|
|
3238
3300
|
return sv;
|
|
3239
3301
|
}
|
|
3240
3302
|
function slotValueString(sv, reason) {
|
|
3241
3303
|
return "";
|
|
3242
3304
|
}
|
|
3243
|
-
function
|
|
3244
|
-
|
|
3305
|
+
function slotText(sv) {
|
|
3306
|
+
const v = sv.f === SLOT_FACE_DATA ? sv.v : undefined;
|
|
3307
|
+
const text = typeof v === "string" || typeof v === "number" ? escape("" + v) : "";
|
|
3308
|
+
return `<!--${SLOT_MARKER}t=${slotEntry(sv)}-->${text}<!--/${SLOT_MARKER}t-->`;
|
|
3245
3309
|
}
|
|
3246
3310
|
function slotValueInline(kind, sv) {
|
|
3247
3311
|
return undefined;
|
|
@@ -3256,6 +3320,9 @@ function slotEntry(sv, name) {
|
|
|
3256
3320
|
function slotMarker(position, entries) {
|
|
3257
3321
|
return ` ${SLOT_MARKER}${position}="${entries}"`;
|
|
3258
3322
|
}
|
|
3323
|
+
function eventSlotStamp(mode) {
|
|
3324
|
+
return mode === CLAIMS_DOCUMENT ? " _hk" : "";
|
|
3325
|
+
}
|
|
3259
3326
|
function slotAttribute(key, sv) {
|
|
3260
3327
|
let out = "";
|
|
3261
3328
|
if (sv.f === SLOT_FACE_DATA) {
|
|
@@ -3304,6 +3371,7 @@ function eventPosition(prop) {
|
|
|
3304
3371
|
return prop.slice(2).toLowerCase();
|
|
3305
3372
|
}
|
|
3306
3373
|
function spreadBehaviorPosition(behaviors, prop, value, mode, index, settle) {
|
|
3374
|
+
if (!isAttrName(prop)) return behaviors;
|
|
3307
3375
|
const pos = prop === "ref" ? "ref" : eventPosition(prop);
|
|
3308
3376
|
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3309
3377
|
if (!settle) {
|
|
@@ -3350,13 +3418,18 @@ function spreadBehaviorMarkers(behaviors, claims, mode) {
|
|
|
3350
3418
|
}
|
|
3351
3419
|
}
|
|
3352
3420
|
let out = "";
|
|
3421
|
+
let events = false;
|
|
3353
3422
|
if (behaviors !== null) {
|
|
3354
3423
|
for (const [pos, b] of behaviors) {
|
|
3355
3424
|
const e = claims === undefined ? b : b.e;
|
|
3356
|
-
if (e)
|
|
3425
|
+
if (!e) continue;
|
|
3426
|
+
if (pos === "ref") out += slotMarker("ref", e);else {
|
|
3427
|
+
out += slotMarker("on:" + pos, e);
|
|
3428
|
+
events = true;
|
|
3429
|
+
}
|
|
3357
3430
|
}
|
|
3358
3431
|
}
|
|
3359
|
-
return out;
|
|
3432
|
+
return events ? out + eventSlotStamp(mode) : out;
|
|
3360
3433
|
}
|
|
3361
3434
|
function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
3362
3435
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -3385,8 +3458,9 @@ function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
|
3385
3458
|
}
|
|
3386
3459
|
function spreadObjectAttribute(prop, value) {
|
|
3387
3460
|
if (prop === "style" || prop === "class") return slotClassOrStyle(prop, value);
|
|
3388
|
-
if (
|
|
3389
|
-
return
|
|
3461
|
+
if (!isAttrName(prop)) return "";
|
|
3462
|
+
if (value[SLOT_VALUE] !== undefined) return slotAttribute(prop, value);
|
|
3463
|
+
return ` ${prop}="${escape(value, true)}"`;
|
|
3390
3464
|
}
|
|
3391
3465
|
function slotSpreadSource(tag, source) {
|
|
3392
3466
|
return {};
|
|
@@ -3395,13 +3469,21 @@ function ssrClaim(map) {
|
|
|
3395
3469
|
const mode = sharedConfig.context && sharedConfig.context.claims;
|
|
3396
3470
|
if (!mode) return "";
|
|
3397
3471
|
let out = "";
|
|
3472
|
+
let events = false;
|
|
3398
3473
|
for (const pos in map) {
|
|
3399
3474
|
const entries = claimEntries(pos, map[pos]);
|
|
3400
|
-
if (entries)
|
|
3475
|
+
if (!entries) continue;
|
|
3476
|
+
if (pos === "ref") out += slotMarker("ref", entries);else {
|
|
3477
|
+
out += slotMarker("on:" + pos, entries);
|
|
3478
|
+
events = true;
|
|
3479
|
+
}
|
|
3401
3480
|
}
|
|
3402
|
-
return out;
|
|
3481
|
+
return events ? out + eventSlotStamp(mode) : out;
|
|
3403
3482
|
}
|
|
3404
3483
|
function claimEntries(pos, value, mode) {
|
|
3484
|
+
if (Array.isArray(value) && pos !== "ref") {
|
|
3485
|
+
return "";
|
|
3486
|
+
}
|
|
3405
3487
|
if (Array.isArray(value)) {
|
|
3406
3488
|
let entries = "";
|
|
3407
3489
|
for (const v of value) {
|
|
@@ -3643,7 +3725,7 @@ function generateHydrationScript({
|
|
|
3643
3725
|
eventNames = ["click", "input"],
|
|
3644
3726
|
nonce
|
|
3645
3727
|
} = {}) {
|
|
3646
|
-
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:{},fe(){}});</script><!--xs-->`;
|
|
3728
|
+
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)}),fe(){}});</script><!--xs-->`;
|
|
3647
3729
|
}
|
|
3648
3730
|
function queue(fn) {
|
|
3649
3731
|
return Promise.resolve().then(fn);
|
|
@@ -3846,6 +3928,10 @@ function tryResolveString(node, nested) {
|
|
|
3846
3928
|
if (node.h && node.h.length > 0) return {
|
|
3847
3929
|
merge: node
|
|
3848
3930
|
};
|
|
3931
|
+
if (node[SLOT_VALUE] !== undefined) {
|
|
3932
|
+
ssrTextTail = false;
|
|
3933
|
+
return node.w();
|
|
3934
|
+
}
|
|
3849
3935
|
if (node.t === undefined) {
|
|
3850
3936
|
return "";
|
|
3851
3937
|
}
|
|
@@ -3899,9 +3985,8 @@ function resolveSSRNode(node, result = {
|
|
|
3899
3985
|
result.t[result.t.length - 1] += node.t;
|
|
3900
3986
|
ssrTextTail = false;
|
|
3901
3987
|
} else if (node[SLOT_VALUE] !== undefined) {
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
ssrTextTail = true;
|
|
3988
|
+
result.t[result.t.length - 1] += node.w();
|
|
3989
|
+
ssrTextTail = false;
|
|
3905
3990
|
} else ;
|
|
3906
3991
|
} else if (t === "function") {
|
|
3907
3992
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
@@ -3954,6 +4039,14 @@ function configureServerErrors(config) {
|
|
|
3954
4039
|
}
|
|
3955
4040
|
(g[ServerErrors] ||= {}).hook = config ? config.onError : undefined;
|
|
3956
4041
|
}
|
|
4042
|
+
function reportRequestFailure(error, event) {
|
|
4043
|
+
reportServerError(error, {
|
|
4044
|
+
kind: "request",
|
|
4045
|
+
handling: "failed",
|
|
4046
|
+
event
|
|
4047
|
+
}, null);
|
|
4048
|
+
if (ambientServerErrorHook() === undefined) console.error(error);
|
|
4049
|
+
}
|
|
3957
4050
|
function getRequestEvent() {
|
|
3958
4051
|
const store = globalThis[RequestContext];
|
|
3959
4052
|
if (!store) return undefined;
|
|
@@ -4102,10 +4195,13 @@ function copyInitHeaders(init) {
|
|
|
4102
4195
|
for (const cookie of init.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
4103
4196
|
return headers;
|
|
4104
4197
|
}
|
|
4105
|
-
|
|
4106
|
-
|
|
4198
|
+
let stubGapFillExcluded;
|
|
4199
|
+
function isStubGapFillExcluded(key) {
|
|
4200
|
+
return (stubGapFillExcluded ||= new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location",
|
|
4201
|
+
...COMPOSED_BODY_FRAMING].map(header => header.toLowerCase()))).has(key);
|
|
4202
|
+
}
|
|
4107
4203
|
function fillsStubGap(key, headers, response) {
|
|
4108
|
-
if (key === "set-cookie" ||
|
|
4204
|
+
if (key === "set-cookie" || isStubGapFillExcluded(key)) return false;
|
|
4109
4205
|
if (response.body === null && (key === "content-type" || key === "content-length")) return false;
|
|
4110
4206
|
return !headers.has(key);
|
|
4111
4207
|
}
|
|
@@ -4197,7 +4293,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4197
4293
|
closed = true;
|
|
4198
4294
|
}
|
|
4199
4295
|
};
|
|
4200
|
-
|
|
4296
|
+
const sink = {
|
|
4201
4297
|
write(chunk) {
|
|
4202
4298
|
if (!flushed) {
|
|
4203
4299
|
flushed = true;
|
|
@@ -4212,6 +4308,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4212
4308
|
status: getExpectedRedirectStatus(stub),
|
|
4213
4309
|
headers: head.headers
|
|
4214
4310
|
}));
|
|
4311
|
+
sink[ABANDON_RENDER]("redirect", true);
|
|
4215
4312
|
return;
|
|
4216
4313
|
}
|
|
4217
4314
|
if (!head.headers.has("content-type")) {
|
|
@@ -4222,7 +4319,9 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4222
4319
|
controller = c;
|
|
4223
4320
|
},
|
|
4224
4321
|
cancel() {
|
|
4322
|
+
if (closed) return;
|
|
4225
4323
|
closed = true;
|
|
4324
|
+
sink[ABANDON_RENDER]("consumer");
|
|
4226
4325
|
}
|
|
4227
4326
|
}), {
|
|
4228
4327
|
status: head.status,
|
|
@@ -4233,6 +4332,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4233
4332
|
enqueue(transformChunk ? transformChunk(chunk) : chunk);
|
|
4234
4333
|
},
|
|
4235
4334
|
end() {
|
|
4335
|
+
if (!flushed) sink.write("");
|
|
4236
4336
|
if (closed || !controller) return;
|
|
4237
4337
|
const location = stub && stub.headers.get("Location");
|
|
4238
4338
|
if (location && isHttpNavigationTarget(location)) {
|
|
@@ -4243,8 +4343,23 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4243
4343
|
try {
|
|
4244
4344
|
controller.close();
|
|
4245
4345
|
} catch {}
|
|
4246
|
-
}
|
|
4247
|
-
|
|
4346
|
+
},
|
|
4347
|
+
[SHELL_ABANDONED]() {
|
|
4348
|
+
if (flushed) return;
|
|
4349
|
+
flushed = closed = true;
|
|
4350
|
+
if (stub) commitResponseStub(stub, {
|
|
4351
|
+
event
|
|
4352
|
+
});
|
|
4353
|
+
const head = deriveHead(stub, responseInit);
|
|
4354
|
+
const status = stub && stub.headers.get("Location") ? getExpectedRedirectStatus(stub) : 500;
|
|
4355
|
+
resolve(new Response(null, {
|
|
4356
|
+
status,
|
|
4357
|
+
headers: head.headers
|
|
4358
|
+
}));
|
|
4359
|
+
},
|
|
4360
|
+
[ABANDON_RENDER]() {}
|
|
4361
|
+
};
|
|
4362
|
+
result.pipe(sink);
|
|
4248
4363
|
});
|
|
4249
4364
|
}
|
|
4250
4365
|
function composeMiddleware(middlewares) {
|
|
@@ -4269,6 +4384,9 @@ function claimElement(node) {
|
|
|
4269
4384
|
function claimElementTree(root) {
|
|
4270
4385
|
return root;
|
|
4271
4386
|
}
|
|
4387
|
+
function dispatchAsInteraction(_e, fn) {
|
|
4388
|
+
return fn();
|
|
4389
|
+
}
|
|
4272
4390
|
function notSup() {
|
|
4273
4391
|
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
4392
|
}
|
|
@@ -4278,10 +4396,17 @@ setAsyncIterableSharer(shareAsyncIterable);
|
|
|
4278
4396
|
const isServer = true;
|
|
4279
4397
|
const isDev = false;
|
|
4280
4398
|
function dynamic(source, options) {
|
|
4399
|
+
return dynamicCore(source, options, ssrTag);
|
|
4400
|
+
}
|
|
4401
|
+
function dynamicComponent(source, options) {
|
|
4402
|
+
return dynamicCore(source, options);
|
|
4403
|
+
}
|
|
4404
|
+
const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
|
|
4405
|
+
function dynamicCore(source, options, tagArm) {
|
|
4281
4406
|
if (options?.static) {
|
|
4282
4407
|
const component = untrack(source);
|
|
4283
4408
|
if (typeof component === "function") return props => component(props);
|
|
4284
|
-
if (typeof component === "string") return props =>
|
|
4409
|
+
if (typeof component === "string" && tagArm) return props => tagArm(component, props);
|
|
4285
4410
|
return () => undefined;
|
|
4286
4411
|
}
|
|
4287
4412
|
const cached = createMemo(() => {
|
|
@@ -4327,9 +4452,7 @@ function dynamic(source, options) {
|
|
|
4327
4452
|
const c = value();
|
|
4328
4453
|
if (c) {
|
|
4329
4454
|
if (typeof c === "function") return c(props);
|
|
4330
|
-
if (typeof c === "string")
|
|
4331
|
-
return ssrElement(c, props, undefined, true);
|
|
4332
|
-
}
|
|
4455
|
+
if (typeof c === "string" && tagArm) return tagArm(c, props);
|
|
4333
4456
|
}
|
|
4334
4457
|
}, {
|
|
4335
4458
|
sync: true
|
|
@@ -4471,4 +4594,4 @@ function httpHeader(name, value, options) {
|
|
|
4471
4594
|
}
|
|
4472
4595
|
}
|
|
4473
4596
|
|
|
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 };
|
|
4597
|
+
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, dynamicComponent, 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, reportRequestFailure, 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, ssrStyleProperties, ssrStyleProperty, notSup as style, styleNonce, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|