@solidjs/web 2.0.0-beta.25 → 2.0.0-beta.27
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/dev.cjs +14 -9
- package/dist/dev.js +14 -10
- package/dist/server.cjs +41 -78
- package/dist/server.js +42 -80
- package/dist/web.cjs +14 -9
- package/dist/web.js +14 -10
- package/frames/dist/client.cjs +180 -224
- package/frames/dist/client.dev.cjs +1456 -0
- package/frames/dist/client.dev.js +1444 -0
- package/frames/dist/client.js +181 -225
- package/frames/dist/server.cjs +139 -123
- package/frames/dist/server.js +139 -123
- package/package.json +24 -4
- package/serialization/dist/serialization.cjs +6 -3
- package/serialization/dist/serialization.js +6 -3
- package/serialization/types/index.d.ts +7 -1
- package/serialization/types-cjs/index.d.cts +7 -1
- package/server-functions/dist/client.cjs +18 -5
- package/server-functions/dist/client.js +16 -6
- package/server-functions/dist/server.cjs +164 -8
- package/server-functions/dist/server.js +158 -9
- package/types/client.d.ts +3 -3
- package/types/frames/client.d.ts +1 -1
- package/types/frames/frame-client.d.ts +34 -28
- package/types/frames/serializer.d.ts +7 -1
- package/types/jsx.d.ts +1 -1
- package/types/response.d.ts +10 -0
- package/types/serializer.d.ts +7 -1
- package/types/server-functions/client.d.ts +3 -0
- package/types/server-functions/flash.d.ts +38 -0
- package/types/server-functions/server.d.ts +79 -4
- package/types/server-functions/shared.d.ts +35 -0
- package/types-cjs/client.d.cts +3 -3
- package/types-cjs/frames/client.d.cts +1 -1
- package/types-cjs/frames/frame-client.d.cts +34 -28
- package/types-cjs/frames/serializer.d.cts +7 -1
- package/types-cjs/jsx.d.cts +1 -1
- package/types-cjs/response.d.cts +10 -0
- package/types-cjs/serializer.d.cts +7 -1
- package/types-cjs/server-functions/client.d.cts +3 -0
- package/types-cjs/server-functions/flash.d.cts +38 -0
- package/types-cjs/server-functions/server.d.cts +79 -4
- package/types-cjs/server-functions/shared.d.cts +35 -0
package/dist/dev.cjs
CHANGED
|
@@ -33,7 +33,6 @@ const DOMWithState = {
|
|
|
33
33
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
34
34
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
35
35
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
36
|
-
const $$FRAME = /*#__PURE__*/Symbol.for("dom-expressions.frame");
|
|
37
36
|
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
37
|
const SVGElements = /*#__PURE__*/new Set([
|
|
39
38
|
"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",
|
|
@@ -486,7 +485,17 @@ function installHydrationRuntime() {
|
|
|
486
485
|
function stripTextSeparators(nodes) {
|
|
487
486
|
let j = 0;
|
|
488
487
|
for (let i = 0; i < nodes.length; i++) {
|
|
489
|
-
|
|
488
|
+
const node = nodes[i],
|
|
489
|
+
t = node.nodeType;
|
|
490
|
+
if (t === 8) {
|
|
491
|
+
const v = node.nodeValue;
|
|
492
|
+
if (v === "!$") {
|
|
493
|
+
node.remove();
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
if (v.startsWith("pl-")) continue;
|
|
497
|
+
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
498
|
+
nodes[j++] = node;
|
|
490
499
|
}
|
|
491
500
|
nodes.length = j;
|
|
492
501
|
return nodes;
|
|
@@ -1025,11 +1034,6 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1025
1034
|
parent.appendChild(value);
|
|
1026
1035
|
}
|
|
1027
1036
|
if (marker) value[$$SLOT] = marker;
|
|
1028
|
-
} else if (value[$$FRAME]) {
|
|
1029
|
-
if (current) {
|
|
1030
|
-
cleanChildren(parent, Array.isArray(current) ? current : [current], multi ? marker : null);
|
|
1031
|
-
}
|
|
1032
|
-
value[$$FRAME](parent, multi ? marker : null);
|
|
1033
1037
|
} else if (Array.isArray(value)) {
|
|
1034
1038
|
const currentArray = current && Array.isArray(current);
|
|
1035
1039
|
if (value.length === 0) {
|
|
@@ -1050,7 +1054,6 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1050
1054
|
doNotUnwrap
|
|
1051
1055
|
});
|
|
1052
1056
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1053
|
-
if (value != null && value[$$FRAME]) return value;
|
|
1054
1057
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1055
1058
|
if (Array.isArray(value)) {
|
|
1056
1059
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1172,13 +1175,14 @@ const HREF = Symbol.for("solid.Href");
|
|
|
1172
1175
|
function isHref(value) {
|
|
1173
1176
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1174
1177
|
}
|
|
1178
|
+
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1175
1179
|
function initWithRevalidate(init) {
|
|
1176
1180
|
const {
|
|
1177
1181
|
revalidate,
|
|
1178
1182
|
...responseInit
|
|
1179
1183
|
} = init;
|
|
1180
1184
|
const headers = new Headers(responseInit.headers);
|
|
1181
|
-
revalidate !== undefined && headers.set(
|
|
1185
|
+
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1182
1186
|
return {
|
|
1183
1187
|
responseInit,
|
|
1184
1188
|
headers
|
|
@@ -1391,6 +1395,7 @@ exports.HydrationScript = voidFn;
|
|
|
1391
1395
|
exports.MathMLElements = MathMLElements;
|
|
1392
1396
|
exports.Namespaces = Namespaces;
|
|
1393
1397
|
exports.Portal = Portal;
|
|
1398
|
+
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
1394
1399
|
exports.RawTextElements = RawTextElements;
|
|
1395
1400
|
exports.RequestContext = RequestContext;
|
|
1396
1401
|
exports.ResponseEnvelope = ResponseEnvelope;
|
package/dist/dev.js
CHANGED
|
@@ -32,7 +32,6 @@ const DOMWithState = {
|
|
|
32
32
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
33
33
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
34
34
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
35
|
-
const $$FRAME = /*#__PURE__*/Symbol.for("dom-expressions.frame");
|
|
36
35
|
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"]);
|
|
37
36
|
const SVGElements = /*#__PURE__*/new Set([
|
|
38
37
|
"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",
|
|
@@ -485,7 +484,17 @@ function installHydrationRuntime() {
|
|
|
485
484
|
function stripTextSeparators(nodes) {
|
|
486
485
|
let j = 0;
|
|
487
486
|
for (let i = 0; i < nodes.length; i++) {
|
|
488
|
-
|
|
487
|
+
const node = nodes[i],
|
|
488
|
+
t = node.nodeType;
|
|
489
|
+
if (t === 8) {
|
|
490
|
+
const v = node.nodeValue;
|
|
491
|
+
if (v === "!$") {
|
|
492
|
+
node.remove();
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
if (v.startsWith("pl-")) continue;
|
|
496
|
+
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
497
|
+
nodes[j++] = node;
|
|
489
498
|
}
|
|
490
499
|
nodes.length = j;
|
|
491
500
|
return nodes;
|
|
@@ -1024,11 +1033,6 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1024
1033
|
parent.appendChild(value);
|
|
1025
1034
|
}
|
|
1026
1035
|
if (marker) value[$$SLOT] = marker;
|
|
1027
|
-
} else if (value[$$FRAME]) {
|
|
1028
|
-
if (current) {
|
|
1029
|
-
cleanChildren(parent, Array.isArray(current) ? current : [current], multi ? marker : null);
|
|
1030
|
-
}
|
|
1031
|
-
value[$$FRAME](parent, multi ? marker : null);
|
|
1032
1036
|
} else if (Array.isArray(value)) {
|
|
1033
1037
|
const currentArray = current && Array.isArray(current);
|
|
1034
1038
|
if (value.length === 0) {
|
|
@@ -1049,7 +1053,6 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1049
1053
|
doNotUnwrap
|
|
1050
1054
|
});
|
|
1051
1055
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1052
|
-
if (value != null && value[$$FRAME]) return value;
|
|
1053
1056
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1054
1057
|
if (Array.isArray(value)) {
|
|
1055
1058
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1171,13 +1174,14 @@ const HREF = Symbol.for("solid.Href");
|
|
|
1171
1174
|
function isHref(value) {
|
|
1172
1175
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1173
1176
|
}
|
|
1177
|
+
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1174
1178
|
function initWithRevalidate(init) {
|
|
1175
1179
|
const {
|
|
1176
1180
|
revalidate,
|
|
1177
1181
|
...responseInit
|
|
1178
1182
|
} = init;
|
|
1179
1183
|
const headers = new Headers(responseInit.headers);
|
|
1180
|
-
revalidate !== undefined && headers.set(
|
|
1184
|
+
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1181
1185
|
return {
|
|
1182
1186
|
responseInit,
|
|
1183
1187
|
headers
|
|
@@ -1327,4 +1331,4 @@ function createElement(tagName, is = undefined) {
|
|
|
1327
1331
|
});
|
|
1328
1332
|
}
|
|
1329
1333
|
|
|
1330
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1334
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
package/dist/server.cjs
CHANGED
|
@@ -65,6 +65,7 @@ const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectF
|
|
|
65
65
|
const memo = fn => solidJs.createMemo(() => fn(), syncOptions);
|
|
66
66
|
|
|
67
67
|
const DEFAULT_DISABLED_FEATURES = seroval.Feature.AggregateError | seroval.Feature.BigIntTypedArray;
|
|
68
|
+
const serializeOnlyDisabledFeatures = () => process.env.NODE_ENV === "development" ? 0 : seroval.Feature.ErrorPrototypeStack;
|
|
68
69
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
69
70
|
const DEFAULT_WEB_PLUGINS = Object.freeze([web.AbortSignalPlugin,
|
|
70
71
|
web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
|
|
@@ -76,7 +77,7 @@ function createSerializer(options) {
|
|
|
76
77
|
return new seroval.Serializer({
|
|
77
78
|
...options,
|
|
78
79
|
plugins: resolveSerializerPlugins(options.plugins),
|
|
79
|
-
disabledFeatures: options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures
|
|
80
|
+
disabledFeatures: (options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures) | serializeOnlyDisabledFeatures()
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
function createHydrationSerializer({
|
|
@@ -225,7 +226,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
228
|
-
const REPLACE_SCRIPT = `function $df(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;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(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])}`;
|
|
229
|
+
const REPLACE_SCRIPT = `function $df(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,_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e,t),$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])}`;
|
|
229
230
|
function renderToString(code, options = {}) {
|
|
230
231
|
const {
|
|
231
232
|
renderId = "",
|
|
@@ -287,11 +288,8 @@ function renderToString(code, options = {}) {
|
|
|
287
288
|
serializeFragmentAssets("", tracking.boundaryModules, solidJs.sharedConfig.context);
|
|
288
289
|
solidJs.sharedConfig.context.noHydrate = true;
|
|
289
290
|
serializer.close();
|
|
290
|
-
|
|
291
|
-
html
|
|
292
|
-
html = injectInlineStyles(tracking.inlineStyles, html, nonce);
|
|
293
|
-
if (scripts.length) html = injectScripts(html, scripts, options.nonce);
|
|
294
|
-
return html;
|
|
291
|
+
const assetsHtml = resolveAssetsHtml(solidJs.sharedConfig.context.assets);
|
|
292
|
+
return assembleDocument(html, assetsHtml, tracking.emittedAssets, tracking.inlineStyles, scripts.length ? scripts : "", nonce);
|
|
295
293
|
}
|
|
296
294
|
function renderToStream(code, options = {}) {
|
|
297
295
|
let {
|
|
@@ -364,11 +362,7 @@ function renderToStream(code, options = {}) {
|
|
|
364
362
|
}
|
|
365
363
|
},
|
|
366
364
|
shell(shellHtml, meta) {
|
|
367
|
-
shellHtml
|
|
368
|
-
shellHtml = injectPreloadLinks(meta.preloads, shellHtml);
|
|
369
|
-
shellHtml = injectInlineStyles(meta.inlineStyles, shellHtml, nonce);
|
|
370
|
-
if (meta.tasks.length) shellHtml = injectScripts(shellHtml, meta.tasks, nonce);
|
|
371
|
-
buffer.write(shellHtml);
|
|
365
|
+
buffer.write(assembleDocument(shellHtml, meta.assets, meta.preloads, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce));
|
|
372
366
|
},
|
|
373
367
|
...options.sink
|
|
374
368
|
};
|
|
@@ -1113,28 +1107,36 @@ function resolveAssetsHtml(assets) {
|
|
|
1113
1107
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
1114
1108
|
return out;
|
|
1115
1109
|
}
|
|
1116
|
-
function
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1110
|
+
function assembleDocument(html, assetsHtml, emittedAssets, inlineStyles, scripts, nonce) {
|
|
1111
|
+
const scriptTag = scripts ? `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>` : "";
|
|
1112
|
+
if (!assetsHtml && !(emittedAssets && emittedAssets.size) && !(inlineStyles && inlineStyles.size)) {
|
|
1113
|
+
if (!scriptTag) return html;
|
|
1114
|
+
const xs = html.indexOf("<!--xs-->");
|
|
1115
|
+
return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
|
|
1116
|
+
}
|
|
1117
|
+
const headIdx = html.indexOf("</head>");
|
|
1118
|
+
if (headIdx === -1) {
|
|
1119
|
+
if (!scriptTag) return html;
|
|
1120
|
+
const xs = html.indexOf("<!--xs-->");
|
|
1121
|
+
return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
|
|
1122
|
+
}
|
|
1123
|
+
let head = assetsHtml || "";
|
|
1124
|
+
if (emittedAssets && emittedAssets.size) {
|
|
1125
|
+
for (const url of emittedAssets) {
|
|
1126
|
+
head += url.endsWith(".css") ? `<link rel="stylesheet" href="${url}">` : `<link rel="modulepreload" href="${url}">`;
|
|
1133
1127
|
}
|
|
1134
1128
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1129
|
+
if (inlineStyles && inlineStyles.size) {
|
|
1130
|
+
for (const entry of inlineStyles.values()) {
|
|
1131
|
+
if (entry.emitted) continue;
|
|
1132
|
+
entry.emitted = true;
|
|
1133
|
+
head += renderInlineStyle(entry, nonce);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
if (!scriptTag) return html.slice(0, headIdx) + head + html.slice(headIdx);
|
|
1137
|
+
const xsIdx = html.indexOf("<!--xs-->");
|
|
1138
|
+
if (xsIdx === -1) return html.slice(0, headIdx) + head + html.slice(headIdx) + scriptTag;
|
|
1139
|
+
return xsIdx < headIdx ? html.slice(0, xsIdx) + scriptTag + html.slice(xsIdx, headIdx) + head + html.slice(headIdx) : html.slice(0, headIdx) + head + html.slice(headIdx, xsIdx) + scriptTag + html.slice(xsIdx);
|
|
1138
1140
|
}
|
|
1139
1141
|
function serializeFragmentAssets(key, boundaryModules, context) {
|
|
1140
1142
|
const map = boundaryModules.get(key);
|
|
@@ -1186,26 +1188,6 @@ function renderInlineStyle(entry, nonce) {
|
|
|
1186
1188
|
}
|
|
1187
1189
|
return `<style${nonce ? ` nonce="${nonce}"` : ""} data-asset="${escape(entry.id, true)}"${attrs}>${escapeStyleContent(entry.content)}</style>`;
|
|
1188
1190
|
}
|
|
1189
|
-
function injectInlineStyles(inlineStyles, html, nonce) {
|
|
1190
|
-
if (!inlineStyles.size) return html;
|
|
1191
|
-
const index = html.indexOf("</head>");
|
|
1192
|
-
if (index === -1) return html;
|
|
1193
|
-
let out = "";
|
|
1194
|
-
for (const entry of inlineStyles.values()) {
|
|
1195
|
-
if (entry.emitted) continue;
|
|
1196
|
-
entry.emitted = true;
|
|
1197
|
-
out += renderInlineStyle(entry, nonce);
|
|
1198
|
-
}
|
|
1199
|
-
return out ? html.slice(0, index) + out + html.slice(index) : html;
|
|
1200
|
-
}
|
|
1201
|
-
function injectScripts(html, scripts, nonce) {
|
|
1202
|
-
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
1203
|
-
const index = html.indexOf("<!--xs-->");
|
|
1204
|
-
if (index > -1) {
|
|
1205
|
-
return html.slice(0, index) + tag + html.slice(index);
|
|
1206
|
-
}
|
|
1207
|
-
return html + tag;
|
|
1208
|
-
}
|
|
1209
1191
|
function waitForFragments(registry, key) {
|
|
1210
1192
|
for (const k of [...registry.keys()].reverse()) {
|
|
1211
1193
|
if (key.startsWith(k)) return k;
|
|
@@ -1361,13 +1343,14 @@ const HREF = Symbol.for("solid.Href");
|
|
|
1361
1343
|
function isHref(value) {
|
|
1362
1344
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1363
1345
|
}
|
|
1346
|
+
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1364
1347
|
function initWithRevalidate(init) {
|
|
1365
1348
|
const {
|
|
1366
1349
|
revalidate,
|
|
1367
1350
|
...responseInit
|
|
1368
1351
|
} = init;
|
|
1369
1352
|
const headers = new Headers(responseInit.headers);
|
|
1370
|
-
revalidate !== undefined && headers.set(
|
|
1353
|
+
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1371
1354
|
return {
|
|
1372
1355
|
responseInit,
|
|
1373
1356
|
headers
|
|
@@ -1417,33 +1400,12 @@ function respond(value, init = {}) {
|
|
|
1417
1400
|
const isServer = true;
|
|
1418
1401
|
const isDev = false;
|
|
1419
1402
|
function dynamic(source) {
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1403
|
+
const cached = solidJs.createMemo(source, {
|
|
1404
|
+
serialize: false
|
|
1405
|
+
});
|
|
1422
1406
|
return props => {
|
|
1423
|
-
const comp = source();
|
|
1424
|
-
let p;
|
|
1425
|
-
let settled = false;
|
|
1426
|
-
let value;
|
|
1427
|
-
let error;
|
|
1428
|
-
if (comp && typeof comp.then === "function") {
|
|
1429
|
-
p = comp;
|
|
1430
|
-
p.then(v => {
|
|
1431
|
-
value = v;
|
|
1432
|
-
settled = true;
|
|
1433
|
-
}, err => {
|
|
1434
|
-
error = err;
|
|
1435
|
-
settled = true;
|
|
1436
|
-
});
|
|
1437
|
-
const ctx = solidJs.sharedConfig.context;
|
|
1438
|
-
if (ctx?.async) ctx.block(p.then(() => {}, () => {}));
|
|
1439
|
-
}
|
|
1440
1407
|
return solidJs.createMemo(() => {
|
|
1441
|
-
|
|
1442
|
-
if (p) {
|
|
1443
|
-
if (!settled) throw new solidJs.NotReadyError(p);
|
|
1444
|
-
if (error) throw error;
|
|
1445
|
-
c = value;
|
|
1446
|
-
}
|
|
1408
|
+
const c = cached();
|
|
1447
1409
|
if (c) {
|
|
1448
1410
|
if (typeof c === "function") return c(props);
|
|
1449
1411
|
if (typeof c === "string") {
|
|
@@ -1536,6 +1498,7 @@ exports.HydrationScript = HydrationScript;
|
|
|
1536
1498
|
exports.MathMLElements = MathMLElements;
|
|
1537
1499
|
exports.Namespaces = Namespaces;
|
|
1538
1500
|
exports.Portal = Portal;
|
|
1501
|
+
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
1539
1502
|
exports.RawTextElements = RawTextElements;
|
|
1540
1503
|
exports.RequestContext = RequestContext;
|
|
1541
1504
|
exports.ResponseEnvelope = ResponseEnvelope;
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, createComponent, omit, getNextChildId
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, ssrScope as scope, untrack } from 'solid-js';
|
|
3
3
|
import { Serializer, getCrossReferenceHeader, Feature } from 'seroval';
|
|
4
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
@@ -64,6 +64,7 @@ const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, optio
|
|
|
64
64
|
const memo = fn => createMemo(() => fn(), syncOptions);
|
|
65
65
|
|
|
66
66
|
const DEFAULT_DISABLED_FEATURES = Feature.AggregateError | Feature.BigIntTypedArray;
|
|
67
|
+
const serializeOnlyDisabledFeatures = () => process.env.NODE_ENV === "development" ? 0 : Feature.ErrorPrototypeStack;
|
|
67
68
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
68
69
|
const DEFAULT_WEB_PLUGINS = Object.freeze([AbortSignalPlugin,
|
|
69
70
|
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
@@ -75,7 +76,7 @@ function createSerializer(options) {
|
|
|
75
76
|
return new Serializer({
|
|
76
77
|
...options,
|
|
77
78
|
plugins: resolveSerializerPlugins(options.plugins),
|
|
78
|
-
disabledFeatures: options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures
|
|
79
|
+
disabledFeatures: (options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures) | serializeOnlyDisabledFeatures()
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
function createHydrationSerializer({
|
|
@@ -224,7 +225,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
227
|
-
const REPLACE_SCRIPT = `function $df(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;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(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])}`;
|
|
228
|
+
const REPLACE_SCRIPT = `function $df(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,_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e,t),$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])}`;
|
|
228
229
|
function renderToString(code, options = {}) {
|
|
229
230
|
const {
|
|
230
231
|
renderId = "",
|
|
@@ -286,11 +287,8 @@ function renderToString(code, options = {}) {
|
|
|
286
287
|
serializeFragmentAssets("", tracking.boundaryModules, sharedConfig.context);
|
|
287
288
|
sharedConfig.context.noHydrate = true;
|
|
288
289
|
serializer.close();
|
|
289
|
-
|
|
290
|
-
html
|
|
291
|
-
html = injectInlineStyles(tracking.inlineStyles, html, nonce);
|
|
292
|
-
if (scripts.length) html = injectScripts(html, scripts, options.nonce);
|
|
293
|
-
return html;
|
|
290
|
+
const assetsHtml = resolveAssetsHtml(sharedConfig.context.assets);
|
|
291
|
+
return assembleDocument(html, assetsHtml, tracking.emittedAssets, tracking.inlineStyles, scripts.length ? scripts : "", nonce);
|
|
294
292
|
}
|
|
295
293
|
function renderToStream(code, options = {}) {
|
|
296
294
|
let {
|
|
@@ -363,11 +361,7 @@ function renderToStream(code, options = {}) {
|
|
|
363
361
|
}
|
|
364
362
|
},
|
|
365
363
|
shell(shellHtml, meta) {
|
|
366
|
-
shellHtml
|
|
367
|
-
shellHtml = injectPreloadLinks(meta.preloads, shellHtml);
|
|
368
|
-
shellHtml = injectInlineStyles(meta.inlineStyles, shellHtml, nonce);
|
|
369
|
-
if (meta.tasks.length) shellHtml = injectScripts(shellHtml, meta.tasks, nonce);
|
|
370
|
-
buffer.write(shellHtml);
|
|
364
|
+
buffer.write(assembleDocument(shellHtml, meta.assets, meta.preloads, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce));
|
|
371
365
|
},
|
|
372
366
|
...options.sink
|
|
373
367
|
};
|
|
@@ -1112,28 +1106,36 @@ function resolveAssetsHtml(assets) {
|
|
|
1112
1106
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
1113
1107
|
return out;
|
|
1114
1108
|
}
|
|
1115
|
-
function
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1109
|
+
function assembleDocument(html, assetsHtml, emittedAssets, inlineStyles, scripts, nonce) {
|
|
1110
|
+
const scriptTag = scripts ? `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>` : "";
|
|
1111
|
+
if (!assetsHtml && !(emittedAssets && emittedAssets.size) && !(inlineStyles && inlineStyles.size)) {
|
|
1112
|
+
if (!scriptTag) return html;
|
|
1113
|
+
const xs = html.indexOf("<!--xs-->");
|
|
1114
|
+
return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
|
|
1115
|
+
}
|
|
1116
|
+
const headIdx = html.indexOf("</head>");
|
|
1117
|
+
if (headIdx === -1) {
|
|
1118
|
+
if (!scriptTag) return html;
|
|
1119
|
+
const xs = html.indexOf("<!--xs-->");
|
|
1120
|
+
return xs === -1 ? html + scriptTag : html.slice(0, xs) + scriptTag + html.slice(xs);
|
|
1121
|
+
}
|
|
1122
|
+
let head = assetsHtml || "";
|
|
1123
|
+
if (emittedAssets && emittedAssets.size) {
|
|
1124
|
+
for (const url of emittedAssets) {
|
|
1125
|
+
head += url.endsWith(".css") ? `<link rel="stylesheet" href="${url}">` : `<link rel="modulepreload" href="${url}">`;
|
|
1132
1126
|
}
|
|
1133
1127
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1128
|
+
if (inlineStyles && inlineStyles.size) {
|
|
1129
|
+
for (const entry of inlineStyles.values()) {
|
|
1130
|
+
if (entry.emitted) continue;
|
|
1131
|
+
entry.emitted = true;
|
|
1132
|
+
head += renderInlineStyle(entry, nonce);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
if (!scriptTag) return html.slice(0, headIdx) + head + html.slice(headIdx);
|
|
1136
|
+
const xsIdx = html.indexOf("<!--xs-->");
|
|
1137
|
+
if (xsIdx === -1) return html.slice(0, headIdx) + head + html.slice(headIdx) + scriptTag;
|
|
1138
|
+
return xsIdx < headIdx ? html.slice(0, xsIdx) + scriptTag + html.slice(xsIdx, headIdx) + head + html.slice(headIdx) : html.slice(0, headIdx) + head + html.slice(headIdx, xsIdx) + scriptTag + html.slice(xsIdx);
|
|
1137
1139
|
}
|
|
1138
1140
|
function serializeFragmentAssets(key, boundaryModules, context) {
|
|
1139
1141
|
const map = boundaryModules.get(key);
|
|
@@ -1185,26 +1187,6 @@ function renderInlineStyle(entry, nonce) {
|
|
|
1185
1187
|
}
|
|
1186
1188
|
return `<style${nonce ? ` nonce="${nonce}"` : ""} data-asset="${escape(entry.id, true)}"${attrs}>${escapeStyleContent(entry.content)}</style>`;
|
|
1187
1189
|
}
|
|
1188
|
-
function injectInlineStyles(inlineStyles, html, nonce) {
|
|
1189
|
-
if (!inlineStyles.size) return html;
|
|
1190
|
-
const index = html.indexOf("</head>");
|
|
1191
|
-
if (index === -1) return html;
|
|
1192
|
-
let out = "";
|
|
1193
|
-
for (const entry of inlineStyles.values()) {
|
|
1194
|
-
if (entry.emitted) continue;
|
|
1195
|
-
entry.emitted = true;
|
|
1196
|
-
out += renderInlineStyle(entry, nonce);
|
|
1197
|
-
}
|
|
1198
|
-
return out ? html.slice(0, index) + out + html.slice(index) : html;
|
|
1199
|
-
}
|
|
1200
|
-
function injectScripts(html, scripts, nonce) {
|
|
1201
|
-
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
1202
|
-
const index = html.indexOf("<!--xs-->");
|
|
1203
|
-
if (index > -1) {
|
|
1204
|
-
return html.slice(0, index) + tag + html.slice(index);
|
|
1205
|
-
}
|
|
1206
|
-
return html + tag;
|
|
1207
|
-
}
|
|
1208
1190
|
function waitForFragments(registry, key) {
|
|
1209
1191
|
for (const k of [...registry.keys()].reverse()) {
|
|
1210
1192
|
if (key.startsWith(k)) return k;
|
|
@@ -1360,13 +1342,14 @@ const HREF = Symbol.for("solid.Href");
|
|
|
1360
1342
|
function isHref(value) {
|
|
1361
1343
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1362
1344
|
}
|
|
1345
|
+
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1363
1346
|
function initWithRevalidate(init) {
|
|
1364
1347
|
const {
|
|
1365
1348
|
revalidate,
|
|
1366
1349
|
...responseInit
|
|
1367
1350
|
} = init;
|
|
1368
1351
|
const headers = new Headers(responseInit.headers);
|
|
1369
|
-
revalidate !== undefined && headers.set(
|
|
1352
|
+
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1370
1353
|
return {
|
|
1371
1354
|
responseInit,
|
|
1372
1355
|
headers
|
|
@@ -1416,33 +1399,12 @@ function respond(value, init = {}) {
|
|
|
1416
1399
|
const isServer = true;
|
|
1417
1400
|
const isDev = false;
|
|
1418
1401
|
function dynamic(source) {
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1402
|
+
const cached = createMemo(source, {
|
|
1403
|
+
serialize: false
|
|
1404
|
+
});
|
|
1421
1405
|
return props => {
|
|
1422
|
-
const comp = source();
|
|
1423
|
-
let p;
|
|
1424
|
-
let settled = false;
|
|
1425
|
-
let value;
|
|
1426
|
-
let error;
|
|
1427
|
-
if (comp && typeof comp.then === "function") {
|
|
1428
|
-
p = comp;
|
|
1429
|
-
p.then(v => {
|
|
1430
|
-
value = v;
|
|
1431
|
-
settled = true;
|
|
1432
|
-
}, err => {
|
|
1433
|
-
error = err;
|
|
1434
|
-
settled = true;
|
|
1435
|
-
});
|
|
1436
|
-
const ctx = sharedConfig.context;
|
|
1437
|
-
if (ctx?.async) ctx.block(p.then(() => {}, () => {}));
|
|
1438
|
-
}
|
|
1439
1406
|
return createMemo(() => {
|
|
1440
|
-
|
|
1441
|
-
if (p) {
|
|
1442
|
-
if (!settled) throw new NotReadyError(p);
|
|
1443
|
-
if (error) throw error;
|
|
1444
|
-
c = value;
|
|
1445
|
-
}
|
|
1407
|
+
const c = cached();
|
|
1446
1408
|
if (c) {
|
|
1447
1409
|
if (typeof c === "function") return c(props);
|
|
1448
1410
|
if (typeof c === "string") {
|
|
@@ -1464,4 +1426,4 @@ function Portal(props) {
|
|
|
1464
1426
|
return undefined;
|
|
1465
1427
|
}
|
|
1466
1428
|
|
|
1467
|
-
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };
|
|
1429
|
+
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };
|
package/dist/web.cjs
CHANGED
|
@@ -33,7 +33,6 @@ const DOMWithState = {
|
|
|
33
33
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
34
34
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
35
35
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
36
|
-
const $$FRAME = /*#__PURE__*/Symbol.for("dom-expressions.frame");
|
|
37
36
|
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
37
|
const SVGElements = /*#__PURE__*/new Set([
|
|
39
38
|
"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",
|
|
@@ -481,7 +480,17 @@ function installHydrationRuntime() {
|
|
|
481
480
|
function stripTextSeparators(nodes) {
|
|
482
481
|
let j = 0;
|
|
483
482
|
for (let i = 0; i < nodes.length; i++) {
|
|
484
|
-
|
|
483
|
+
const node = nodes[i],
|
|
484
|
+
t = node.nodeType;
|
|
485
|
+
if (t === 8) {
|
|
486
|
+
const v = node.nodeValue;
|
|
487
|
+
if (v === "!$") {
|
|
488
|
+
node.remove();
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
if (v.startsWith("pl-")) continue;
|
|
492
|
+
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
493
|
+
nodes[j++] = node;
|
|
485
494
|
}
|
|
486
495
|
nodes.length = j;
|
|
487
496
|
return nodes;
|
|
@@ -968,11 +977,6 @@ function insertExpression(parent, value, current, marker) {
|
|
|
968
977
|
parent.appendChild(value);
|
|
969
978
|
}
|
|
970
979
|
if (marker) value[$$SLOT] = marker;
|
|
971
|
-
} else if (value[$$FRAME]) {
|
|
972
|
-
if (current) {
|
|
973
|
-
cleanChildren(parent, Array.isArray(current) ? current : [current], multi ? marker : null);
|
|
974
|
-
}
|
|
975
|
-
value[$$FRAME](parent, multi ? marker : null);
|
|
976
980
|
} else if (Array.isArray(value)) {
|
|
977
981
|
const currentArray = current && Array.isArray(current);
|
|
978
982
|
if (value.length === 0) {
|
|
@@ -993,7 +997,6 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
993
997
|
doNotUnwrap
|
|
994
998
|
});
|
|
995
999
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
996
|
-
if (value != null && value[$$FRAME]) return value;
|
|
997
1000
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
998
1001
|
if (Array.isArray(value)) {
|
|
999
1002
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1115,13 +1118,14 @@ const HREF = Symbol.for("solid.Href");
|
|
|
1115
1118
|
function isHref(value) {
|
|
1116
1119
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1117
1120
|
}
|
|
1121
|
+
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1118
1122
|
function initWithRevalidate(init) {
|
|
1119
1123
|
const {
|
|
1120
1124
|
revalidate,
|
|
1121
1125
|
...responseInit
|
|
1122
1126
|
} = init;
|
|
1123
1127
|
const headers = new Headers(responseInit.headers);
|
|
1124
|
-
revalidate !== undefined && headers.set(
|
|
1128
|
+
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1125
1129
|
return {
|
|
1126
1130
|
responseInit,
|
|
1127
1131
|
headers
|
|
@@ -1329,6 +1333,7 @@ exports.HydrationScript = voidFn;
|
|
|
1329
1333
|
exports.MathMLElements = MathMLElements;
|
|
1330
1334
|
exports.Namespaces = Namespaces;
|
|
1331
1335
|
exports.Portal = Portal;
|
|
1336
|
+
exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
|
|
1332
1337
|
exports.RawTextElements = RawTextElements;
|
|
1333
1338
|
exports.RequestContext = RequestContext;
|
|
1334
1339
|
exports.ResponseEnvelope = ResponseEnvelope;
|