@solidjs/web 2.0.0-beta.32 → 2.0.0-beta.33
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 +51 -15
- package/dist/dev.js +47 -16
- package/dist/server.cjs +710 -71
- package/dist/server.js +707 -74
- package/dist/web.cjs +51 -15
- package/dist/web.js +47 -16
- package/frames/dist/client.cjs +181 -64
- package/frames/dist/client.dev.cjs +185 -64
- package/frames/dist/client.dev.js +183 -62
- package/frames/dist/client.js +179 -62
- package/frames/dist/server.cjs +969 -133
- package/frames/dist/server.js +971 -135
- package/package.json +17 -6
- package/serialization/decode/package.json +20 -0
- package/serialization/dist/decode.cjs +110 -0
- package/serialization/dist/decode.js +104 -0
- package/serialization/dist/serialization.cjs +98 -43
- package/serialization/dist/serialization.js +99 -44
- package/serialization/types/index.d.ts +18 -160
- package/serialization/types/serializer-decode.d.ts +182 -0
- package/serialization/types-cjs/index.d.cts +18 -160
- package/serialization/types-cjs/serializer-decode.d.cts +182 -0
- package/server-functions/dist/client.cjs +101 -105
- package/server-functions/dist/client.js +101 -105
- package/server-functions/dist/server.cjs +131 -107
- package/server-functions/dist/server.dev.cjs +131 -107
- package/server-functions/dist/server.dev.js +132 -108
- package/server-functions/dist/server.js +132 -108
- package/types/client.d.ts +23 -1
- package/types/cookies.d.ts +93 -0
- package/types/core.d.ts +1 -1
- package/types/frames/frame-client.d.ts +26 -0
- package/types/frames/frame-transport.d.ts +1 -1
- package/types/frames/serializer.d.ts +18 -160
- package/types/serializer-decode.d.ts +182 -0
- package/types/serializer.d.ts +18 -160
- package/types/server-functions/client.d.ts +1 -1
- package/types/server-functions/server.d.ts +1 -1
- package/types/server-functions/shared.d.ts +57 -1
- package/types/server.d.ts +21 -1
- package/types-cjs/client.d.cts +23 -1
- package/types-cjs/cookies.d.cts +93 -0
- package/types-cjs/core.d.cts +1 -1
- package/types-cjs/frames/frame-client.d.cts +26 -0
- package/types-cjs/frames/frame-transport.d.cts +1 -1
- package/types-cjs/frames/serializer.d.cts +18 -160
- package/types-cjs/serializer-decode.d.cts +182 -0
- package/types-cjs/serializer.d.cts +18 -160
- package/types-cjs/server-functions/client.d.cts +1 -1
- package/types-cjs/server-functions/server.d.cts +1 -1
- package/types-cjs/server-functions/shared.d.cts +57 -1
- package/types-cjs/server.d.cts +21 -1
package/dist/dev.cjs
CHANGED
|
@@ -303,6 +303,27 @@ function serializeCookie(name, value, options = {}) {
|
|
|
303
303
|
}
|
|
304
304
|
return cookie;
|
|
305
305
|
}
|
|
306
|
+
const FLASH_COOKIE = "flash";
|
|
307
|
+
const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
|
|
308
|
+
function hasFlashCookie(cookieHeader) {
|
|
309
|
+
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
310
|
+
}
|
|
311
|
+
function clearFlashCookie() {
|
|
312
|
+
return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
|
|
316
|
+
function getServerFunctionMetadata(fn) {
|
|
317
|
+
if (typeof fn !== "function") return undefined;
|
|
318
|
+
return fn[SERVER_FUNCTION_METADATA] || undefined;
|
|
319
|
+
}
|
|
320
|
+
function isServerFunction(fn) {
|
|
321
|
+
return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
|
|
322
|
+
}
|
|
323
|
+
const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
|
|
324
|
+
function getServerFunctionRPC() {
|
|
325
|
+
return globalThis[SERVER_FUNCTION_RPC];
|
|
326
|
+
}
|
|
306
327
|
|
|
307
328
|
const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
|
|
308
329
|
const INNER_OWNED = {};
|
|
@@ -658,8 +679,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
658
679
|
const value = normalize(accessor(), current, multi, true);
|
|
659
680
|
if (typeof value !== "function") return value;
|
|
660
681
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
661
|
-
insertExpression(parent, inner, current, marker);
|
|
662
|
-
current = inner;
|
|
682
|
+
current = insertExpression(parent, inner, current, marker);
|
|
663
683
|
host && tagHost(current, host);
|
|
664
684
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
665
685
|
...options,
|
|
@@ -668,8 +688,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
668
688
|
return INNER_OWNED;
|
|
669
689
|
}, value => {
|
|
670
690
|
if (value === INNER_OWNED) return;
|
|
671
|
-
insertExpression(parent, value, current, marker);
|
|
672
|
-
current = value;
|
|
691
|
+
current = insertExpression(parent, value, current, marker);
|
|
673
692
|
host && tagHost(current, host);
|
|
674
693
|
},
|
|
675
694
|
accessor.$s ? options ? {
|
|
@@ -1453,8 +1472,11 @@ function eventHandler(e, container, state) {
|
|
|
1453
1472
|
retarget(oriTarget);
|
|
1454
1473
|
}
|
|
1455
1474
|
function insertExpression(parent, value, current, marker) {
|
|
1456
|
-
if (hydrationRt !== null && isHydrating(parent))
|
|
1457
|
-
|
|
1475
|
+
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1476
|
+
if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
|
|
1477
|
+
return value;
|
|
1478
|
+
}
|
|
1479
|
+
if (value === current) return value;
|
|
1458
1480
|
const t = typeof value,
|
|
1459
1481
|
multi = marker !== undefined;
|
|
1460
1482
|
if (t === "string" || t === "number") {
|
|
@@ -1493,6 +1515,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1493
1515
|
appendNodes(parent, value);
|
|
1494
1516
|
}
|
|
1495
1517
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
1518
|
+
return value;
|
|
1496
1519
|
}
|
|
1497
1520
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1498
1521
|
value = solidJs.flatten(value, {
|
|
@@ -1630,13 +1653,17 @@ function resolveSSRNode(node, result, top) {}
|
|
|
1630
1653
|
function escape(s, attr) {}
|
|
1631
1654
|
|
|
1632
1655
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1656
|
+
// PURE-annotated factory (same convention as solid's MockPromise): the brand
|
|
1657
|
+
const ResponseEnvelope = /* @__PURE__ */(() => {
|
|
1658
|
+
class ResponseEnvelope {
|
|
1659
|
+
constructor(response, value) {
|
|
1660
|
+
this.response = response;
|
|
1661
|
+
this.value = value;
|
|
1662
|
+
}
|
|
1637
1663
|
}
|
|
1638
|
-
|
|
1639
|
-
ResponseEnvelope
|
|
1664
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1665
|
+
return ResponseEnvelope;
|
|
1666
|
+
})();
|
|
1640
1667
|
function isResponseEnvelope(value) {
|
|
1641
1668
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1642
1669
|
}
|
|
@@ -1754,7 +1781,8 @@ function portalImpl(props) {
|
|
|
1754
1781
|
endMarker = document.createTextNode(""),
|
|
1755
1782
|
mount = () => props.mount || document.body,
|
|
1756
1783
|
content = solidJs.createMemo(() => [startMarker, props.children], {
|
|
1757
|
-
ssrSource: "client"
|
|
1784
|
+
ssrSource: "client",
|
|
1785
|
+
loadingValue: undefined
|
|
1758
1786
|
});
|
|
1759
1787
|
solidJs.createRenderEffect(
|
|
1760
1788
|
() => [mount(), content(), solidJs.getOwner()], ([, c, owner]) => {
|
|
@@ -1791,7 +1819,8 @@ function portalImpl(props) {
|
|
|
1791
1819
|
ssrSource: "client"
|
|
1792
1820
|
});
|
|
1793
1821
|
if (solidJs.sharedConfig.hydrating) return solidJs.createMemo(() => treeMarker, {
|
|
1794
|
-
ssrSource: "client"
|
|
1822
|
+
ssrSource: "client",
|
|
1823
|
+
loadingValue: undefined
|
|
1795
1824
|
});
|
|
1796
1825
|
return treeMarker;
|
|
1797
1826
|
}
|
|
@@ -1878,7 +1907,9 @@ _moduleUrl) {
|
|
|
1878
1907
|
if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
|
|
1879
1908
|
const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
|
|
1880
1909
|
const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1881
|
-
solidJs.sharedConfig.onHydrationEnd
|
|
1910
|
+
const onHydrationEnd = solidJs.sharedConfig.onHydrationEnd;
|
|
1911
|
+
const release = () => setMounted(true);
|
|
1912
|
+
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1882
1913
|
return gate;
|
|
1883
1914
|
};
|
|
1884
1915
|
}
|
|
@@ -1961,6 +1992,7 @@ exports.assign = assign;
|
|
|
1961
1992
|
exports.claimElement = claimElement;
|
|
1962
1993
|
exports.claimElementTree = claimElementTree;
|
|
1963
1994
|
exports.className = className;
|
|
1995
|
+
exports.clearFlashCookie = clearFlashCookie;
|
|
1964
1996
|
exports.clientOnly = clientOnly;
|
|
1965
1997
|
exports.commitEventResponse = commitEventResponse;
|
|
1966
1998
|
exports.composeMiddleware = composeMiddleware;
|
|
@@ -1982,6 +2014,9 @@ exports.getNextMarker = getNextMarker;
|
|
|
1982
2014
|
exports.getNextMatch = getNextMatch;
|
|
1983
2015
|
exports.getNextSibling = getNextSibling;
|
|
1984
2016
|
exports.getRequestEvent = voidFn;
|
|
2017
|
+
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
2018
|
+
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
2019
|
+
exports.hasFlashCookie = hasFlashCookie;
|
|
1985
2020
|
exports.httpHeader = httpHeader;
|
|
1986
2021
|
exports.httpStatus = httpStatus;
|
|
1987
2022
|
exports.hydrate = hydrate;
|
|
@@ -1992,6 +2027,7 @@ exports.isHref = isHref;
|
|
|
1992
2027
|
exports.isResponseEnvelope = isResponseEnvelope;
|
|
1993
2028
|
exports.isSafeError = isSafeError;
|
|
1994
2029
|
exports.isServer = isServer;
|
|
2030
|
+
exports.isServerFunction = isServerFunction;
|
|
1995
2031
|
exports.markSafeError = markSafeError;
|
|
1996
2032
|
exports.memo = memo;
|
|
1997
2033
|
exports.mergeProps = mergeProps;
|
package/dist/dev.js
CHANGED
|
@@ -302,6 +302,27 @@ function serializeCookie(name, value, options = {}) {
|
|
|
302
302
|
}
|
|
303
303
|
return cookie;
|
|
304
304
|
}
|
|
305
|
+
const FLASH_COOKIE = "flash";
|
|
306
|
+
const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
|
|
307
|
+
function hasFlashCookie(cookieHeader) {
|
|
308
|
+
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
309
|
+
}
|
|
310
|
+
function clearFlashCookie() {
|
|
311
|
+
return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
|
|
315
|
+
function getServerFunctionMetadata(fn) {
|
|
316
|
+
if (typeof fn !== "function") return undefined;
|
|
317
|
+
return fn[SERVER_FUNCTION_METADATA] || undefined;
|
|
318
|
+
}
|
|
319
|
+
function isServerFunction(fn) {
|
|
320
|
+
return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
|
|
321
|
+
}
|
|
322
|
+
const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
|
|
323
|
+
function getServerFunctionRPC() {
|
|
324
|
+
return globalThis[SERVER_FUNCTION_RPC];
|
|
325
|
+
}
|
|
305
326
|
|
|
306
327
|
const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
|
|
307
328
|
const INNER_OWNED = {};
|
|
@@ -657,8 +678,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
657
678
|
const value = normalize(accessor(), current, multi, true);
|
|
658
679
|
if (typeof value !== "function") return value;
|
|
659
680
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
660
|
-
insertExpression(parent, inner, current, marker);
|
|
661
|
-
current = inner;
|
|
681
|
+
current = insertExpression(parent, inner, current, marker);
|
|
662
682
|
host && tagHost(current, host);
|
|
663
683
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
664
684
|
...options,
|
|
@@ -667,8 +687,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
667
687
|
return INNER_OWNED;
|
|
668
688
|
}, value => {
|
|
669
689
|
if (value === INNER_OWNED) return;
|
|
670
|
-
insertExpression(parent, value, current, marker);
|
|
671
|
-
current = value;
|
|
690
|
+
current = insertExpression(parent, value, current, marker);
|
|
672
691
|
host && tagHost(current, host);
|
|
673
692
|
},
|
|
674
693
|
accessor.$s ? options ? {
|
|
@@ -1452,8 +1471,11 @@ function eventHandler(e, container, state) {
|
|
|
1452
1471
|
retarget(oriTarget);
|
|
1453
1472
|
}
|
|
1454
1473
|
function insertExpression(parent, value, current, marker) {
|
|
1455
|
-
if (hydrationRt !== null && isHydrating(parent))
|
|
1456
|
-
|
|
1474
|
+
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1475
|
+
if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
|
|
1476
|
+
return value;
|
|
1477
|
+
}
|
|
1478
|
+
if (value === current) return value;
|
|
1457
1479
|
const t = typeof value,
|
|
1458
1480
|
multi = marker !== undefined;
|
|
1459
1481
|
if (t === "string" || t === "number") {
|
|
@@ -1492,6 +1514,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1492
1514
|
appendNodes(parent, value);
|
|
1493
1515
|
}
|
|
1494
1516
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
1517
|
+
return value;
|
|
1495
1518
|
}
|
|
1496
1519
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1497
1520
|
value = flatten(value, {
|
|
@@ -1629,13 +1652,17 @@ function resolveSSRNode(node, result, top) {}
|
|
|
1629
1652
|
function escape(s, attr) {}
|
|
1630
1653
|
|
|
1631
1654
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1655
|
+
// PURE-annotated factory (same convention as solid's MockPromise): the brand
|
|
1656
|
+
const ResponseEnvelope = /* @__PURE__ */(() => {
|
|
1657
|
+
class ResponseEnvelope {
|
|
1658
|
+
constructor(response, value) {
|
|
1659
|
+
this.response = response;
|
|
1660
|
+
this.value = value;
|
|
1661
|
+
}
|
|
1636
1662
|
}
|
|
1637
|
-
|
|
1638
|
-
ResponseEnvelope
|
|
1663
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1664
|
+
return ResponseEnvelope;
|
|
1665
|
+
})();
|
|
1639
1666
|
function isResponseEnvelope(value) {
|
|
1640
1667
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1641
1668
|
}
|
|
@@ -1753,7 +1780,8 @@ function portalImpl(props) {
|
|
|
1753
1780
|
endMarker = document.createTextNode(""),
|
|
1754
1781
|
mount = () => props.mount || document.body,
|
|
1755
1782
|
content = createMemo(() => [startMarker, props.children], {
|
|
1756
|
-
ssrSource: "client"
|
|
1783
|
+
ssrSource: "client",
|
|
1784
|
+
loadingValue: undefined
|
|
1757
1785
|
});
|
|
1758
1786
|
createRenderEffect(
|
|
1759
1787
|
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
@@ -1790,7 +1818,8 @@ function portalImpl(props) {
|
|
|
1790
1818
|
ssrSource: "client"
|
|
1791
1819
|
});
|
|
1792
1820
|
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1793
|
-
ssrSource: "client"
|
|
1821
|
+
ssrSource: "client",
|
|
1822
|
+
loadingValue: undefined
|
|
1794
1823
|
});
|
|
1795
1824
|
return treeMarker;
|
|
1796
1825
|
}
|
|
@@ -1877,11 +1906,13 @@ _moduleUrl) {
|
|
|
1877
1906
|
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1878
1907
|
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1879
1908
|
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1880
|
-
sharedConfig.onHydrationEnd
|
|
1909
|
+
const onHydrationEnd = sharedConfig.onHydrationEnd;
|
|
1910
|
+
const release = () => setMounted(true);
|
|
1911
|
+
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1881
1912
|
return gate;
|
|
1882
1913
|
};
|
|
1883
1914
|
}
|
|
1884
1915
|
function httpStatus(_code, _text) {}
|
|
1885
1916
|
function httpHeader(_name, _value, _options) {}
|
|
1886
1917
|
|
|
1887
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, markSafeError, memo, mergeProps, parseCookieHeader, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, warmAsset };
|
|
1918
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, mergeProps, parseCookieHeader, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, warmAsset };
|