@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.observe.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo, OBSERVE, 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,
|
|
@@ -460,10 +464,10 @@ function isShareableIterable(value) {
|
|
|
460
464
|
return false;
|
|
461
465
|
}
|
|
462
466
|
}
|
|
463
|
-
function materialize(marker) {
|
|
467
|
+
function materialize(marker, claiming) {
|
|
464
468
|
let value = state.materialized.get(marker.$tr);
|
|
465
469
|
if (value === undefined) {
|
|
466
|
-
value = state.materializeTrace(marker);
|
|
470
|
+
value = state.materializeTrace(marker, claiming);
|
|
467
471
|
state.materialized.set(marker.$tr, value);
|
|
468
472
|
if (value !== null && typeof value === "object") state.materializedValues.add(value);
|
|
469
473
|
}
|
|
@@ -521,23 +525,22 @@ setContainerTraceStreamMint(iterable => {
|
|
|
521
525
|
})();
|
|
522
526
|
return stream;
|
|
523
527
|
});
|
|
524
|
-
const DEFAULT_WEB_PLUGINS = Object.freeze([AbortSignalPlugin,
|
|
528
|
+
const DEFAULT_WEB_PLUGINS = /* @__PURE__ */Object.freeze([AbortSignalPlugin,
|
|
525
529
|
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
526
530
|
FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin,
|
|
527
531
|
ContainerTracePlugin]);
|
|
528
532
|
function resolveSerializerPlugins(customPlugins) {
|
|
529
533
|
return customPlugins ? [...customPlugins, ...DEFAULT_WEB_PLUGINS] : [...DEFAULT_WEB_PLUGINS];
|
|
530
534
|
}
|
|
531
|
-
Feature.RegExp;
|
|
532
535
|
|
|
533
|
-
const
|
|
536
|
+
const defaultDisabledFeatures = () => Feature.AggregateError | Feature.BigIntTypedArray;
|
|
534
537
|
const serializeOnlyDisabledFeatures = serializeErrorStacks => (serializeErrorStacks === undefined ? process.env.NODE_ENV === "development" : serializeErrorStacks) ? 0 : Feature.ErrorPrototypeStack;
|
|
535
538
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
536
539
|
function createSerializer(options) {
|
|
537
540
|
return new Serializer({
|
|
538
541
|
...options,
|
|
539
542
|
plugins: resolveSerializerPlugins(options.plugins),
|
|
540
|
-
disabledFeatures: (options.disabledFeatures === undefined ?
|
|
543
|
+
disabledFeatures: (options.disabledFeatures === undefined ? defaultDisabledFeatures() : options.disabledFeatures) | serializeOnlyDisabledFeatures(options.serializeErrorStacks)
|
|
541
544
|
});
|
|
542
545
|
}
|
|
543
546
|
function createHydrationSerializer({
|
|
@@ -736,7 +739,7 @@ function serializeCookie(name, value, options = {}) {
|
|
|
736
739
|
return cookie;
|
|
737
740
|
}
|
|
738
741
|
const FLASH_COOKIE = "flash";
|
|
739
|
-
const FLASH_MATCHER =
|
|
742
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
740
743
|
function hasFlashCookie(cookieHeader) {
|
|
741
744
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
742
745
|
}
|
|
@@ -748,7 +751,6 @@ const ERROR_HEADER = "X-Server-Function-Error";
|
|
|
748
751
|
const BODY_FORMAT_HEADER = "X-Server-Function-Format";
|
|
749
752
|
const REDIRECT_HEADER = "X-Server-Function-Redirect";
|
|
750
753
|
const SINGLE_FLIGHT_HEADER = "X-Single-Flight";
|
|
751
|
-
new TextEncoder().encode(":\n\n");
|
|
752
754
|
|
|
753
755
|
function emitFinding(finding, subject = getOwner()) {
|
|
754
756
|
if (OBSERVE === undefined) return;
|
|
@@ -1412,7 +1414,7 @@ function flushHeadFragment(registry, boundary, nonce) {
|
|
|
1412
1414
|
const t = winner.tags[i];
|
|
1413
1415
|
const attrs = {};
|
|
1414
1416
|
for (const name in t.props) {
|
|
1415
|
-
if (name === "children" || name === "ref" || name
|
|
1417
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1416
1418
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1417
1419
|
continue;
|
|
1418
1420
|
}
|
|
@@ -1501,7 +1503,7 @@ function nonceAttr(nonce, destination) {
|
|
|
1501
1503
|
function renderHeadAttrHtml(props) {
|
|
1502
1504
|
let attrs = "";
|
|
1503
1505
|
for (const name in props) {
|
|
1504
|
-
if (name === "children" || name === "ref" || name
|
|
1506
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1505
1507
|
if (!HEAD_ATTR_NAME.test(name)) {
|
|
1506
1508
|
continue;
|
|
1507
1509
|
}
|
|
@@ -1514,7 +1516,7 @@ function renderHeadAttrHtml(props) {
|
|
|
1514
1516
|
function headAttrRecord(props, skipRelHref) {
|
|
1515
1517
|
let attrs = null;
|
|
1516
1518
|
for (const name in props) {
|
|
1517
|
-
if (name === "children" || name === "ref" || name
|
|
1519
|
+
if (name === "children" || name === "ref" || isEventName(name)) continue;
|
|
1518
1520
|
if ((name === "rel" || name === "href")) continue;
|
|
1519
1521
|
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1520
1522
|
const v = props[name];
|
|
@@ -1540,10 +1542,13 @@ function useHead(tags) {
|
|
|
1540
1542
|
ctx.registerHeadTags(tags);
|
|
1541
1543
|
}
|
|
1542
1544
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
1545
|
+
const NOT_NAME = /[\0-\x20\x7F-\x9F"'<>/=]/;
|
|
1546
|
+
const TAG_START = /^[a-zA-Z]/;
|
|
1543
1547
|
const tagInfos = /*#__PURE__*/new Map();
|
|
1544
1548
|
function tagInfo(tag) {
|
|
1545
1549
|
let info = tagInfos.get(tag);
|
|
1546
1550
|
if (info === undefined) {
|
|
1551
|
+
if (!TAG_START.test(tag) || NOT_NAME.test(tag)) throw new Error(`"${tag}" is not a valid tag name`);
|
|
1547
1552
|
info = {
|
|
1548
1553
|
open: "<" + tag,
|
|
1549
1554
|
close: "</" + tag + ">",
|
|
@@ -1556,13 +1561,13 @@ function tagInfo(tag) {
|
|
|
1556
1561
|
return info;
|
|
1557
1562
|
}
|
|
1558
1563
|
const safeAttrNames = /*#__PURE__*/new Set();
|
|
1559
|
-
function
|
|
1560
|
-
if (safeAttrNames.has(prop)) return
|
|
1561
|
-
|
|
1562
|
-
if (
|
|
1563
|
-
return
|
|
1564
|
+
function isAttrName(prop) {
|
|
1565
|
+
if (safeAttrNames.has(prop)) return true;
|
|
1566
|
+
if (prop === "" || NOT_NAME.test(prop)) return false;
|
|
1567
|
+
if (safeAttrNames.size < 512) safeAttrNames.add(prop);
|
|
1568
|
+
return true;
|
|
1564
1569
|
}
|
|
1565
|
-
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])}`;
|
|
1570
|
+
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)`;
|
|
1566
1571
|
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)}`;
|
|
1567
1572
|
function renderToString(code, options = {}) {
|
|
1568
1573
|
const {
|
|
@@ -1657,12 +1662,20 @@ function renderToString(code, options = {}) {
|
|
|
1657
1662
|
}
|
|
1658
1663
|
rendered = true;
|
|
1659
1664
|
return document;
|
|
1665
|
+
} catch (err) {
|
|
1666
|
+
reportServerError(err, {
|
|
1667
|
+
kind: "render",
|
|
1668
|
+
handling: "failed"
|
|
1669
|
+
}, null, options.onError);
|
|
1670
|
+
throw err;
|
|
1660
1671
|
} finally {
|
|
1661
1672
|
if (render) settleRender(render, rootOwner, rendered ? "complete" : "error");
|
|
1662
1673
|
context.trace = undefined;
|
|
1663
1674
|
if (dispose) dispose();
|
|
1664
1675
|
}
|
|
1665
1676
|
}
|
|
1677
|
+
const SHELL_ABANDONED = Symbol();
|
|
1678
|
+
const ABANDON_RENDER = Symbol();
|
|
1666
1679
|
function renderToStream(code, options = {}) {
|
|
1667
1680
|
let {
|
|
1668
1681
|
onCompleteShell,
|
|
@@ -1683,6 +1696,7 @@ function renderToStream(code, options = {}) {
|
|
|
1683
1696
|
let disconnected = false;
|
|
1684
1697
|
let failed = false;
|
|
1685
1698
|
let onFailed;
|
|
1699
|
+
let onDisconnectedBeforeShell;
|
|
1686
1700
|
const defuse = p => {
|
|
1687
1701
|
if (p && typeof p.then === "function") p.then(undefined, () => {});
|
|
1688
1702
|
};
|
|
@@ -1701,9 +1715,9 @@ function renderToStream(code, options = {}) {
|
|
|
1701
1715
|
complete(sink);
|
|
1702
1716
|
} : complete;
|
|
1703
1717
|
};
|
|
1704
|
-
const abandon = disconnect => {
|
|
1718
|
+
const abandon = (disconnect, quiet) => {
|
|
1705
1719
|
if (dead) return;
|
|
1706
|
-
if (disconnect) emitFinding({
|
|
1720
|
+
if (disconnect && !quiet) emitFinding({
|
|
1707
1721
|
code: "SSR_STREAM_ABANDONED",
|
|
1708
1722
|
kind: "ssr",
|
|
1709
1723
|
severity: "warn",
|
|
@@ -1748,7 +1762,7 @@ function renderToStream(code, options = {}) {
|
|
|
1748
1762
|
if (!disconnect) {
|
|
1749
1763
|
failed = true;
|
|
1750
1764
|
onFailed && onFailed(sink);
|
|
1751
|
-
}
|
|
1765
|
+
} else if (!sink && onDisconnectedBeforeShell) onDisconnectedBeforeShell();
|
|
1752
1766
|
};
|
|
1753
1767
|
const failRender = err => {
|
|
1754
1768
|
reportServerError(err, {
|
|
@@ -1875,10 +1889,10 @@ function renderToStream(code, options = {}) {
|
|
|
1875
1889
|
const styleAttr = nonceAttr(nonce, "style");
|
|
1876
1890
|
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
1877
1891
|
writeTasks();
|
|
1892
|
+
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1878
1893
|
for (const entry of styles.links) {
|
|
1879
|
-
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr}
|
|
1894
|
+
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} data-dfc="${key}">` : `<link${entry.attrHtml}${styleAttr} data-dfc="${key}">`);
|
|
1880
1895
|
}
|
|
1881
|
-
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1882
1896
|
} else {
|
|
1883
1897
|
buffer.write(`<template id="${key}">${value}</template>`);
|
|
1884
1898
|
if (!deferActivation) {
|
|
@@ -1920,7 +1934,7 @@ function renderToStream(code, options = {}) {
|
|
|
1920
1934
|
};
|
|
1921
1935
|
let holds = 0;
|
|
1922
1936
|
const flushEnd = () => {
|
|
1923
|
-
if (!registry.size && !holds) {
|
|
1937
|
+
if (!registry.size && !holds && !rootHoles) {
|
|
1924
1938
|
serializeRootAssets();
|
|
1925
1939
|
queue(() => queue(() => {
|
|
1926
1940
|
if (context.live.end) {
|
|
@@ -2062,6 +2076,12 @@ function renderToStream(code, options = {}) {
|
|
|
2062
2076
|
}
|
|
2063
2077
|
let rootHoles = null;
|
|
2064
2078
|
let nextHoleId = 0;
|
|
2079
|
+
let parkedInlines = null;
|
|
2080
|
+
function inlineFragment(key, value) {
|
|
2081
|
+
if (rootHoles && !html.includes(`<template id="pl-${key}">`)) {
|
|
2082
|
+
(parkedInlines ||= new Map()).set(key, value);
|
|
2083
|
+
} else html = replacePlaceholder(html, key, value);
|
|
2084
|
+
}
|
|
2065
2085
|
let buffer = {
|
|
2066
2086
|
write(payload) {
|
|
2067
2087
|
tmp += payload;
|
|
@@ -2190,11 +2210,16 @@ function renderToStream(code, options = {}) {
|
|
|
2190
2210
|
});
|
|
2191
2211
|
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else serializer.write(key + "_fr", p);
|
|
2192
2212
|
}
|
|
2193
|
-
return (value, error) => {
|
|
2213
|
+
return (value, error, escaped) => {
|
|
2194
2214
|
if (registry.has(key)) {
|
|
2195
2215
|
const item = registry.get(key);
|
|
2196
2216
|
registry.delete(key);
|
|
2197
2217
|
if (error) abandonSubtree(key, error);
|
|
2218
|
+
if (error && escaped) {
|
|
2219
|
+
const wire = ssrSanitizeError(error, null);
|
|
2220
|
+
const message = wire instanceof Error ? wire.message : String(wire);
|
|
2221
|
+
if (sink.error) sink.error("", message);else if (context.live && context.live.error) context.live.error(escaped.frame, message);
|
|
2222
|
+
}
|
|
2198
2223
|
if (item.children && !error) {
|
|
2199
2224
|
for (const k in item.children) {
|
|
2200
2225
|
value = replacePlaceholder(value, k, item.children[k]);
|
|
@@ -2214,7 +2239,7 @@ function renderToStream(code, options = {}) {
|
|
|
2214
2239
|
if (!completed) {
|
|
2215
2240
|
if (error) dropHeadBoundary(headRegistry, key);
|
|
2216
2241
|
if (!firstFlushed) {
|
|
2217
|
-
queue(() =>
|
|
2242
|
+
queue(() => inlineFragment(key, value !== undefined ? value : ""));
|
|
2218
2243
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
2219
2244
|
item.resolve(error);
|
|
2220
2245
|
} else {
|
|
@@ -2258,7 +2283,7 @@ function renderToStream(code, options = {}) {
|
|
|
2258
2283
|
registerEntryAssets(manifest);
|
|
2259
2284
|
context.writer = createHydrationWriter(context, () => !completed);
|
|
2260
2285
|
const signal = options.signal;
|
|
2261
|
-
const onAbort = signal ? () => abandon("signal") : undefined;
|
|
2286
|
+
const onAbort = signal ? () => abandon("signal", !!(signal.reason && signal.reason.quiet === true)) : undefined;
|
|
2262
2287
|
let html = createRoot(d => {
|
|
2263
2288
|
dispose = () => {
|
|
2264
2289
|
context.trace = undefined;
|
|
@@ -2267,7 +2292,16 @@ function renderToStream(code, options = {}) {
|
|
|
2267
2292
|
};
|
|
2268
2293
|
rootOwner = claimRenderRoot(context);
|
|
2269
2294
|
if (requestEvent) claimEventRender(requestEvent, context);
|
|
2270
|
-
|
|
2295
|
+
let res;
|
|
2296
|
+
try {
|
|
2297
|
+
res = resolveSSRNode(escape(code()));
|
|
2298
|
+
} catch (err) {
|
|
2299
|
+
reportServerError(err, {
|
|
2300
|
+
kind: "render",
|
|
2301
|
+
handling: "failed"
|
|
2302
|
+
}, null, options.onError);
|
|
2303
|
+
throw err;
|
|
2304
|
+
}
|
|
2271
2305
|
if (!res.h.length) return res.t[0];
|
|
2272
2306
|
rootHoles = [];
|
|
2273
2307
|
let out = res.t[0];
|
|
@@ -2314,6 +2348,13 @@ function renderToStream(code, options = {}) {
|
|
|
2314
2348
|
for (const p of res.p) blockingPromises.add(p);
|
|
2315
2349
|
}
|
|
2316
2350
|
}
|
|
2351
|
+
if (parkedInlines) {
|
|
2352
|
+
for (const [key, value] of parkedInlines) {
|
|
2353
|
+
if (!html.includes(`<template id="pl-${key}">`)) continue;
|
|
2354
|
+
html = replacePlaceholder(html, key, value);
|
|
2355
|
+
parkedInlines.delete(key);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2317
2358
|
if (pending.length) {
|
|
2318
2359
|
rootHoles = pending;
|
|
2319
2360
|
return false;
|
|
@@ -2475,11 +2516,16 @@ function renderToStream(code, options = {}) {
|
|
|
2475
2516
|
},
|
|
2476
2517
|
pipe(w) {
|
|
2477
2518
|
claimConsumer("pipe");
|
|
2519
|
+
const abandoned = w[SHELL_ABANDONED];
|
|
2478
2520
|
onFailure(sink => {
|
|
2479
2521
|
try {
|
|
2480
|
-
sink ? sink.end() : w.end();
|
|
2522
|
+
sink ? sink.end() : abandoned ? abandoned() : w.end();
|
|
2481
2523
|
} catch (_) {}
|
|
2482
2524
|
});
|
|
2525
|
+
if (abandoned) {
|
|
2526
|
+
w[ABANDON_RENDER] = abandon;
|
|
2527
|
+
if (disconnected) abandoned();else onDisconnectedBeforeShell = abandoned;
|
|
2528
|
+
}
|
|
2483
2529
|
function flush() {
|
|
2484
2530
|
allSettled(blockingPromises).then(awaited => {
|
|
2485
2531
|
scheduleFlush(() => {
|
|
@@ -3217,6 +3263,14 @@ function ssrStyleProperty(name, value) {
|
|
|
3217
3263
|
if (isSlotValue(value)) value = slotValueInline();
|
|
3218
3264
|
return value != null ? name + value : "";
|
|
3219
3265
|
}
|
|
3266
|
+
function ssrStyleProperties(...entries) {
|
|
3267
|
+
let result = "";
|
|
3268
|
+
for (let i = 0; i < entries.length; i += 2) {
|
|
3269
|
+
const entry = ssrStyleProperty(entries[i], entries[i + 1]);
|
|
3270
|
+
if (entry) result = result ? result + ";" + entry : entry;
|
|
3271
|
+
}
|
|
3272
|
+
return result;
|
|
3273
|
+
}
|
|
3220
3274
|
function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
3221
3275
|
const hk = needsId ? ssrHydrationKey() : "";
|
|
3222
3276
|
if (typeof props === "function") props = props();
|
|
@@ -3256,6 +3310,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3256
3310
|
const skipChildren = info.isVoid;
|
|
3257
3311
|
let result = info.open + hk;
|
|
3258
3312
|
let behaviors = null;
|
|
3313
|
+
let childOwner = null;
|
|
3259
3314
|
const last = sources === null ? 0 : sources.length - 1;
|
|
3260
3315
|
let keysOf = null;
|
|
3261
3316
|
if (sources !== null) {
|
|
@@ -3278,18 +3333,20 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3278
3333
|
continue;
|
|
3279
3334
|
}
|
|
3280
3335
|
if (ChildProperties.has(prop)) {
|
|
3281
|
-
if (children === undefined &&
|
|
3336
|
+
if (children === undefined && childOwner === null && !skipChildren) {
|
|
3337
|
+
if (prop === "children") childOwner = props;else children = info.raw || prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
3338
|
+
}
|
|
3282
3339
|
continue;
|
|
3283
3340
|
}
|
|
3284
3341
|
const value = props[prop];
|
|
3285
3342
|
if (value == undefined) {
|
|
3286
|
-
if (slots && claims !== undefined && (prop === "ref" || prop
|
|
3343
|
+
if (slots && claims !== undefined && (prop === "ref" || isEventName(prop))) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, true);
|
|
3287
3344
|
continue;
|
|
3288
3345
|
}
|
|
3289
3346
|
if (prop.startsWith("prop:")) {
|
|
3290
3347
|
continue;
|
|
3291
3348
|
}
|
|
3292
|
-
if (prop === "ref" || prop
|
|
3349
|
+
if (prop === "ref" || isEventName(prop)) {
|
|
3293
3350
|
if (slots) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, claims !== undefined);
|
|
3294
3351
|
continue;
|
|
3295
3352
|
}
|
|
@@ -3300,10 +3357,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3300
3357
|
} else if (prop === "class") {
|
|
3301
3358
|
result += ` class="${ssrClassName(value)}"`;
|
|
3302
3359
|
} else if (typeof value === "boolean") {
|
|
3303
|
-
if (
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
result += value === "" ? ` ${attrName(prop)}` : ` ${attrName(prop)}="${escape(value, true)}"`;
|
|
3360
|
+
if (value && isAttrName(prop)) result += ` ${prop}`;
|
|
3361
|
+
} else if (isAttrName(prop)) {
|
|
3362
|
+
result += value === "" ? ` ${prop}` : ` ${prop}="${escape(value, true)}"`;
|
|
3307
3363
|
}
|
|
3308
3364
|
}
|
|
3309
3365
|
}
|
|
@@ -3312,6 +3368,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3312
3368
|
if (skipChildren) return {
|
|
3313
3369
|
t: result + " />"
|
|
3314
3370
|
};
|
|
3371
|
+
if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
|
|
3315
3372
|
if (typeof children === "function") children = children();
|
|
3316
3373
|
const ct = typeof children;
|
|
3317
3374
|
if (ct === "string" || ct === "number") return {
|
|
@@ -3335,10 +3392,12 @@ function ssrElementAttribute(key, value) {
|
|
|
3335
3392
|
return value === "" ? ` ${key}` : ` ${key}="${escape(value, true)}"`;
|
|
3336
3393
|
}
|
|
3337
3394
|
function ssrAttribute(key, value) {
|
|
3395
|
+
if (typeof value === "string") return ` ${key}="${value}"`;
|
|
3338
3396
|
if (value == null || value === false) return "";
|
|
3339
3397
|
if (typeof value === "object") {
|
|
3340
3398
|
return isSlotValue(value) ? slotAttribute(key, value) : ` ${key}="${escape(String(value), true)}"`;
|
|
3341
3399
|
}
|
|
3400
|
+
if (typeof value === "function") return ` ${key}="${escape(String(value), true)}"`;
|
|
3342
3401
|
return value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
3343
3402
|
}
|
|
3344
3403
|
function ssrHydrationKey() {
|
|
@@ -3368,13 +3427,18 @@ function slotValue(occurrence, key, value, face) {
|
|
|
3368
3427
|
Object.defineProperty(sv, "toString", {
|
|
3369
3428
|
value: () => slotValueString()
|
|
3370
3429
|
});
|
|
3430
|
+
Object.defineProperty(sv, "w", {
|
|
3431
|
+
value: () => slotText(sv)
|
|
3432
|
+
});
|
|
3371
3433
|
return sv;
|
|
3372
3434
|
}
|
|
3373
3435
|
function slotValueString(sv, reason) {
|
|
3374
3436
|
return "";
|
|
3375
3437
|
}
|
|
3376
|
-
function
|
|
3377
|
-
|
|
3438
|
+
function slotText(sv) {
|
|
3439
|
+
const v = sv.f === SLOT_FACE_DATA ? sv.v : undefined;
|
|
3440
|
+
const text = typeof v === "string" || typeof v === "number" ? escape("" + v) : "";
|
|
3441
|
+
return `<!--${SLOT_MARKER}t=${slotEntry(sv)}-->${text}<!--/${SLOT_MARKER}t-->`;
|
|
3378
3442
|
}
|
|
3379
3443
|
function slotValueInline(kind, sv) {
|
|
3380
3444
|
return undefined;
|
|
@@ -3389,6 +3453,9 @@ function slotEntry(sv, name) {
|
|
|
3389
3453
|
function slotMarker(position, entries) {
|
|
3390
3454
|
return ` ${SLOT_MARKER}${position}="${entries}"`;
|
|
3391
3455
|
}
|
|
3456
|
+
function eventSlotStamp(mode) {
|
|
3457
|
+
return mode === CLAIMS_DOCUMENT ? " _hk" : "";
|
|
3458
|
+
}
|
|
3392
3459
|
function slotAttribute(key, sv) {
|
|
3393
3460
|
let out = "";
|
|
3394
3461
|
if (sv.f === SLOT_FACE_DATA) {
|
|
@@ -3437,6 +3504,7 @@ function eventPosition(prop) {
|
|
|
3437
3504
|
return prop.slice(2).toLowerCase();
|
|
3438
3505
|
}
|
|
3439
3506
|
function spreadBehaviorPosition(behaviors, prop, value, mode, index, settle) {
|
|
3507
|
+
if (!isAttrName(prop)) return behaviors;
|
|
3440
3508
|
const pos = prop === "ref" ? "ref" : eventPosition(prop);
|
|
3441
3509
|
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3442
3510
|
if (!settle) {
|
|
@@ -3483,13 +3551,18 @@ function spreadBehaviorMarkers(behaviors, claims, mode) {
|
|
|
3483
3551
|
}
|
|
3484
3552
|
}
|
|
3485
3553
|
let out = "";
|
|
3554
|
+
let events = false;
|
|
3486
3555
|
if (behaviors !== null) {
|
|
3487
3556
|
for (const [pos, b] of behaviors) {
|
|
3488
3557
|
const e = claims === undefined ? b : b.e;
|
|
3489
|
-
if (e)
|
|
3558
|
+
if (!e) continue;
|
|
3559
|
+
if (pos === "ref") out += slotMarker("ref", e);else {
|
|
3560
|
+
out += slotMarker("on:" + pos, e);
|
|
3561
|
+
events = true;
|
|
3562
|
+
}
|
|
3490
3563
|
}
|
|
3491
3564
|
}
|
|
3492
|
-
return out;
|
|
3565
|
+
return events ? out + eventSlotStamp(mode) : out;
|
|
3493
3566
|
}
|
|
3494
3567
|
function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
3495
3568
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -3518,8 +3591,9 @@ function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
|
3518
3591
|
}
|
|
3519
3592
|
function spreadObjectAttribute(prop, value) {
|
|
3520
3593
|
if (prop === "style" || prop === "class") return slotClassOrStyle(prop, value);
|
|
3521
|
-
if (
|
|
3522
|
-
return
|
|
3594
|
+
if (!isAttrName(prop)) return "";
|
|
3595
|
+
if (value[SLOT_VALUE] !== undefined) return slotAttribute(prop, value);
|
|
3596
|
+
return ` ${prop}="${escape(value, true)}"`;
|
|
3523
3597
|
}
|
|
3524
3598
|
function slotSpreadSource(tag, source) {
|
|
3525
3599
|
return {};
|
|
@@ -3528,13 +3602,21 @@ function ssrClaim(map) {
|
|
|
3528
3602
|
const mode = sharedConfig.context && sharedConfig.context.claims;
|
|
3529
3603
|
if (!mode) return "";
|
|
3530
3604
|
let out = "";
|
|
3605
|
+
let events = false;
|
|
3531
3606
|
for (const pos in map) {
|
|
3532
3607
|
const entries = claimEntries(pos, map[pos]);
|
|
3533
|
-
if (entries)
|
|
3608
|
+
if (!entries) continue;
|
|
3609
|
+
if (pos === "ref") out += slotMarker("ref", entries);else {
|
|
3610
|
+
out += slotMarker("on:" + pos, entries);
|
|
3611
|
+
events = true;
|
|
3612
|
+
}
|
|
3534
3613
|
}
|
|
3535
|
-
return out;
|
|
3614
|
+
return events ? out + eventSlotStamp(mode) : out;
|
|
3536
3615
|
}
|
|
3537
3616
|
function claimEntries(pos, value, mode) {
|
|
3617
|
+
if (Array.isArray(value) && pos !== "ref") {
|
|
3618
|
+
return "";
|
|
3619
|
+
}
|
|
3538
3620
|
if (Array.isArray(value)) {
|
|
3539
3621
|
let entries = "";
|
|
3540
3622
|
for (const v of value) {
|
|
@@ -3776,7 +3858,7 @@ function generateHydrationScript({
|
|
|
3776
3858
|
eventNames = ["click", "input"],
|
|
3777
3859
|
nonce
|
|
3778
3860
|
} = {}) {
|
|
3779
|
-
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-->`;
|
|
3861
|
+
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-->`;
|
|
3780
3862
|
}
|
|
3781
3863
|
function queue(fn) {
|
|
3782
3864
|
return Promise.resolve().then(fn);
|
|
@@ -3979,6 +4061,10 @@ function tryResolveString(node, nested) {
|
|
|
3979
4061
|
if (node.h && node.h.length > 0) return {
|
|
3980
4062
|
merge: node
|
|
3981
4063
|
};
|
|
4064
|
+
if (node[SLOT_VALUE] !== undefined) {
|
|
4065
|
+
ssrTextTail = false;
|
|
4066
|
+
return node.w();
|
|
4067
|
+
}
|
|
3982
4068
|
if (node.t === undefined) {
|
|
3983
4069
|
return "";
|
|
3984
4070
|
}
|
|
@@ -4032,9 +4118,8 @@ function resolveSSRNode(node, result = {
|
|
|
4032
4118
|
result.t[result.t.length - 1] += node.t;
|
|
4033
4119
|
ssrTextTail = false;
|
|
4034
4120
|
} else if (node[SLOT_VALUE] !== undefined) {
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
ssrTextTail = true;
|
|
4121
|
+
result.t[result.t.length - 1] += node.w();
|
|
4122
|
+
ssrTextTail = false;
|
|
4038
4123
|
} else ;
|
|
4039
4124
|
} else if (t === "function") {
|
|
4040
4125
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
@@ -4087,6 +4172,14 @@ function configureServerErrors(config) {
|
|
|
4087
4172
|
}
|
|
4088
4173
|
(g[ServerErrors] ||= {}).hook = config ? config.onError : undefined;
|
|
4089
4174
|
}
|
|
4175
|
+
function reportRequestFailure(error, event) {
|
|
4176
|
+
reportServerError(error, {
|
|
4177
|
+
kind: "request",
|
|
4178
|
+
handling: "failed",
|
|
4179
|
+
event
|
|
4180
|
+
}, null);
|
|
4181
|
+
if (ambientServerErrorHook() === undefined) console.error(error);
|
|
4182
|
+
}
|
|
4090
4183
|
function getRequestEvent() {
|
|
4091
4184
|
const store = globalThis[RequestContext];
|
|
4092
4185
|
if (!store) return undefined;
|
|
@@ -4257,10 +4350,13 @@ function copyInitHeaders(init) {
|
|
|
4257
4350
|
for (const cookie of init.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
4258
4351
|
return headers;
|
|
4259
4352
|
}
|
|
4260
|
-
|
|
4261
|
-
|
|
4353
|
+
let stubGapFillExcluded;
|
|
4354
|
+
function isStubGapFillExcluded(key) {
|
|
4355
|
+
return (stubGapFillExcluded ||= new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location",
|
|
4356
|
+
...COMPOSED_BODY_FRAMING].map(header => header.toLowerCase()))).has(key);
|
|
4357
|
+
}
|
|
4262
4358
|
function fillsStubGap(key, headers, response) {
|
|
4263
|
-
if (key === "set-cookie" ||
|
|
4359
|
+
if (key === "set-cookie" || isStubGapFillExcluded(key)) return false;
|
|
4264
4360
|
if (response.body === null && (key === "content-type" || key === "content-length")) return false;
|
|
4265
4361
|
return !headers.has(key);
|
|
4266
4362
|
}
|
|
@@ -4352,7 +4448,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4352
4448
|
closed = true;
|
|
4353
4449
|
}
|
|
4354
4450
|
};
|
|
4355
|
-
|
|
4451
|
+
const sink = {
|
|
4356
4452
|
write(chunk) {
|
|
4357
4453
|
if (!flushed) {
|
|
4358
4454
|
flushed = true;
|
|
@@ -4367,6 +4463,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4367
4463
|
status: getExpectedRedirectStatus(stub),
|
|
4368
4464
|
headers: head.headers
|
|
4369
4465
|
}));
|
|
4466
|
+
sink[ABANDON_RENDER]("redirect", true);
|
|
4370
4467
|
return;
|
|
4371
4468
|
}
|
|
4372
4469
|
if (!head.headers.has("content-type")) {
|
|
@@ -4377,7 +4474,9 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4377
4474
|
controller = c;
|
|
4378
4475
|
},
|
|
4379
4476
|
cancel() {
|
|
4477
|
+
if (closed) return;
|
|
4380
4478
|
closed = true;
|
|
4479
|
+
sink[ABANDON_RENDER]("consumer");
|
|
4381
4480
|
}
|
|
4382
4481
|
}), {
|
|
4383
4482
|
status: head.status,
|
|
@@ -4388,6 +4487,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4388
4487
|
enqueue(transformChunk ? transformChunk(chunk) : chunk);
|
|
4389
4488
|
},
|
|
4390
4489
|
end() {
|
|
4490
|
+
if (!flushed) sink.write("");
|
|
4391
4491
|
if (closed || !controller) return;
|
|
4392
4492
|
const location = stub && stub.headers.get("Location");
|
|
4393
4493
|
if (location && isHttpNavigationTarget(location)) {
|
|
@@ -4398,8 +4498,23 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
4398
4498
|
try {
|
|
4399
4499
|
controller.close();
|
|
4400
4500
|
} catch {}
|
|
4401
|
-
}
|
|
4402
|
-
|
|
4501
|
+
},
|
|
4502
|
+
[SHELL_ABANDONED]() {
|
|
4503
|
+
if (flushed) return;
|
|
4504
|
+
flushed = closed = true;
|
|
4505
|
+
if (stub) commitResponseStub(stub, {
|
|
4506
|
+
event
|
|
4507
|
+
});
|
|
4508
|
+
const head = deriveHead(stub, responseInit);
|
|
4509
|
+
const status = stub && stub.headers.get("Location") ? getExpectedRedirectStatus(stub) : 500;
|
|
4510
|
+
resolve(new Response(null, {
|
|
4511
|
+
status,
|
|
4512
|
+
headers: head.headers
|
|
4513
|
+
}));
|
|
4514
|
+
},
|
|
4515
|
+
[ABANDON_RENDER]() {}
|
|
4516
|
+
};
|
|
4517
|
+
result.pipe(sink);
|
|
4403
4518
|
});
|
|
4404
4519
|
}
|
|
4405
4520
|
function composeMiddleware(middlewares) {
|
|
@@ -4424,6 +4539,9 @@ function claimElement(node) {
|
|
|
4424
4539
|
function claimElementTree(root) {
|
|
4425
4540
|
return root;
|
|
4426
4541
|
}
|
|
4542
|
+
function dispatchAsInteraction(_e, fn) {
|
|
4543
|
+
return fn();
|
|
4544
|
+
}
|
|
4427
4545
|
function notSup() {
|
|
4428
4546
|
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>.");
|
|
4429
4547
|
}
|
|
@@ -4433,10 +4551,17 @@ setAsyncIterableSharer(shareAsyncIterable);
|
|
|
4433
4551
|
const isServer = true;
|
|
4434
4552
|
const isDev = false;
|
|
4435
4553
|
function dynamic(source, options) {
|
|
4554
|
+
return dynamicCore(source, options, ssrTag);
|
|
4555
|
+
}
|
|
4556
|
+
function dynamicComponent(source, options) {
|
|
4557
|
+
return dynamicCore(source, options);
|
|
4558
|
+
}
|
|
4559
|
+
const ssrTag = (tag, props) => ssrElement(tag, props, undefined, true);
|
|
4560
|
+
function dynamicCore(source, options, tagArm) {
|
|
4436
4561
|
if (options?.static) {
|
|
4437
4562
|
const component = untrack(source);
|
|
4438
4563
|
if (typeof component === "function") return props => component(props);
|
|
4439
|
-
if (typeof component === "string") return props =>
|
|
4564
|
+
if (typeof component === "string" && tagArm) return props => tagArm(component, props);
|
|
4440
4565
|
return () => undefined;
|
|
4441
4566
|
}
|
|
4442
4567
|
const cached = createMemo(() => {
|
|
@@ -4482,9 +4607,7 @@ function dynamic(source, options) {
|
|
|
4482
4607
|
const c = value();
|
|
4483
4608
|
if (c) {
|
|
4484
4609
|
if (typeof c === "function") return c(props);
|
|
4485
|
-
if (typeof c === "string")
|
|
4486
|
-
return ssrElement(c, props, undefined, true);
|
|
4487
|
-
}
|
|
4610
|
+
if (typeof c === "string" && tagArm) return tagArm(c, props);
|
|
4488
4611
|
}
|
|
4489
4612
|
}, {
|
|
4490
4613
|
sync: true
|
|
@@ -4635,4 +4758,4 @@ function httpHeader(name, value, options) {
|
|
|
4635
4758
|
}
|
|
4636
4759
|
}
|
|
4637
4760
|
|
|
4638
|
-
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 };
|
|
4761
|
+
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 };
|