@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/web.cjs
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 = {};
|
|
@@ -652,8 +673,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
652
673
|
const value = normalize(accessor(), current, multi, true);
|
|
653
674
|
if (typeof value !== "function") return value;
|
|
654
675
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
655
|
-
insertExpression(parent, inner, current, marker);
|
|
656
|
-
current = inner;
|
|
676
|
+
current = insertExpression(parent, inner, current, marker);
|
|
657
677
|
host && tagHost(current, host);
|
|
658
678
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
659
679
|
...options,
|
|
@@ -662,8 +682,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
662
682
|
return INNER_OWNED;
|
|
663
683
|
}, value => {
|
|
664
684
|
if (value === INNER_OWNED) return;
|
|
665
|
-
insertExpression(parent, value, current, marker);
|
|
666
|
-
current = value;
|
|
685
|
+
current = insertExpression(parent, value, current, marker);
|
|
667
686
|
host && tagHost(current, host);
|
|
668
687
|
},
|
|
669
688
|
accessor.$s ? options ? {
|
|
@@ -1392,8 +1411,11 @@ function eventHandler(e, container, state) {
|
|
|
1392
1411
|
retarget(oriTarget);
|
|
1393
1412
|
}
|
|
1394
1413
|
function insertExpression(parent, value, current, marker) {
|
|
1395
|
-
if (hydrationRt !== null && isHydrating(parent))
|
|
1396
|
-
|
|
1414
|
+
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1415
|
+
if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
|
|
1416
|
+
return value;
|
|
1417
|
+
}
|
|
1418
|
+
if (value === current) return value;
|
|
1397
1419
|
const t = typeof value,
|
|
1398
1420
|
multi = marker !== undefined;
|
|
1399
1421
|
if (t === "string" || t === "number") {
|
|
@@ -1432,6 +1454,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1432
1454
|
appendNodes(parent, value);
|
|
1433
1455
|
}
|
|
1434
1456
|
} else ;
|
|
1457
|
+
return value;
|
|
1435
1458
|
}
|
|
1436
1459
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1437
1460
|
value = solidJs.flatten(value, {
|
|
@@ -1569,13 +1592,17 @@ function resolveSSRNode(node, result, top) {}
|
|
|
1569
1592
|
function escape(s, attr) {}
|
|
1570
1593
|
|
|
1571
1594
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1595
|
+
// PURE-annotated factory (same convention as solid's MockPromise): the brand
|
|
1596
|
+
const ResponseEnvelope = /* @__PURE__ */(() => {
|
|
1597
|
+
class ResponseEnvelope {
|
|
1598
|
+
constructor(response, value) {
|
|
1599
|
+
this.response = response;
|
|
1600
|
+
this.value = value;
|
|
1601
|
+
}
|
|
1576
1602
|
}
|
|
1577
|
-
|
|
1578
|
-
ResponseEnvelope
|
|
1603
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1604
|
+
return ResponseEnvelope;
|
|
1605
|
+
})();
|
|
1579
1606
|
function isResponseEnvelope(value) {
|
|
1580
1607
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1581
1608
|
}
|
|
@@ -1691,7 +1718,8 @@ function portalImpl(props) {
|
|
|
1691
1718
|
endMarker = document.createTextNode(""),
|
|
1692
1719
|
mount = () => props.mount || document.body,
|
|
1693
1720
|
content = solidJs.createMemo(() => [startMarker, props.children], {
|
|
1694
|
-
ssrSource: "client"
|
|
1721
|
+
ssrSource: "client",
|
|
1722
|
+
loadingValue: undefined
|
|
1695
1723
|
});
|
|
1696
1724
|
solidJs.createRenderEffect(
|
|
1697
1725
|
() => [mount(), content(), solidJs.getOwner()], ([, c, owner]) => {
|
|
@@ -1728,7 +1756,8 @@ function portalImpl(props) {
|
|
|
1728
1756
|
ssrSource: "client"
|
|
1729
1757
|
});
|
|
1730
1758
|
if (solidJs.sharedConfig.hydrating) return solidJs.createMemo(() => treeMarker, {
|
|
1731
|
-
ssrSource: "client"
|
|
1759
|
+
ssrSource: "client",
|
|
1760
|
+
loadingValue: undefined
|
|
1732
1761
|
});
|
|
1733
1762
|
return treeMarker;
|
|
1734
1763
|
}
|
|
@@ -1812,7 +1841,9 @@ _moduleUrl) {
|
|
|
1812
1841
|
if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
|
|
1813
1842
|
const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
|
|
1814
1843
|
const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1815
|
-
solidJs.sharedConfig.onHydrationEnd
|
|
1844
|
+
const onHydrationEnd = solidJs.sharedConfig.onHydrationEnd;
|
|
1845
|
+
const release = () => setMounted(true);
|
|
1846
|
+
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1816
1847
|
return gate;
|
|
1817
1848
|
};
|
|
1818
1849
|
}
|
|
@@ -1895,6 +1926,7 @@ exports.assign = assign;
|
|
|
1895
1926
|
exports.claimElement = claimElement;
|
|
1896
1927
|
exports.claimElementTree = claimElementTree;
|
|
1897
1928
|
exports.className = className;
|
|
1929
|
+
exports.clearFlashCookie = clearFlashCookie;
|
|
1898
1930
|
exports.clientOnly = clientOnly;
|
|
1899
1931
|
exports.commitEventResponse = commitEventResponse;
|
|
1900
1932
|
exports.composeMiddleware = composeMiddleware;
|
|
@@ -1916,6 +1948,9 @@ exports.getNextMarker = getNextMarker;
|
|
|
1916
1948
|
exports.getNextMatch = getNextMatch;
|
|
1917
1949
|
exports.getNextSibling = getNextSibling;
|
|
1918
1950
|
exports.getRequestEvent = voidFn;
|
|
1951
|
+
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
1952
|
+
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
1953
|
+
exports.hasFlashCookie = hasFlashCookie;
|
|
1919
1954
|
exports.httpHeader = httpHeader;
|
|
1920
1955
|
exports.httpStatus = httpStatus;
|
|
1921
1956
|
exports.hydrate = hydrate;
|
|
@@ -1926,6 +1961,7 @@ exports.isHref = isHref;
|
|
|
1926
1961
|
exports.isResponseEnvelope = isResponseEnvelope;
|
|
1927
1962
|
exports.isSafeError = isSafeError;
|
|
1928
1963
|
exports.isServer = isServer;
|
|
1964
|
+
exports.isServerFunction = isServerFunction;
|
|
1929
1965
|
exports.markSafeError = markSafeError;
|
|
1930
1966
|
exports.memo = memo;
|
|
1931
1967
|
exports.mergeProps = mergeProps;
|
package/dist/web.js
CHANGED
|
@@ -301,6 +301,27 @@ function serializeCookie(name, value, options = {}) {
|
|
|
301
301
|
}
|
|
302
302
|
return cookie;
|
|
303
303
|
}
|
|
304
|
+
const FLASH_COOKIE = "flash";
|
|
305
|
+
const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
|
|
306
|
+
function hasFlashCookie(cookieHeader) {
|
|
307
|
+
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
308
|
+
}
|
|
309
|
+
function clearFlashCookie() {
|
|
310
|
+
return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
|
|
314
|
+
function getServerFunctionMetadata(fn) {
|
|
315
|
+
if (typeof fn !== "function") return undefined;
|
|
316
|
+
return fn[SERVER_FUNCTION_METADATA] || undefined;
|
|
317
|
+
}
|
|
318
|
+
function isServerFunction(fn) {
|
|
319
|
+
return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
|
|
320
|
+
}
|
|
321
|
+
const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
|
|
322
|
+
function getServerFunctionRPC() {
|
|
323
|
+
return globalThis[SERVER_FUNCTION_RPC];
|
|
324
|
+
}
|
|
304
325
|
|
|
305
326
|
const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
|
|
306
327
|
const INNER_OWNED = {};
|
|
@@ -651,8 +672,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
651
672
|
const value = normalize(accessor(), current, multi, true);
|
|
652
673
|
if (typeof value !== "function") return value;
|
|
653
674
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
654
|
-
insertExpression(parent, inner, current, marker);
|
|
655
|
-
current = inner;
|
|
675
|
+
current = insertExpression(parent, inner, current, marker);
|
|
656
676
|
host && tagHost(current, host);
|
|
657
677
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
658
678
|
...options,
|
|
@@ -661,8 +681,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
661
681
|
return INNER_OWNED;
|
|
662
682
|
}, value => {
|
|
663
683
|
if (value === INNER_OWNED) return;
|
|
664
|
-
insertExpression(parent, value, current, marker);
|
|
665
|
-
current = value;
|
|
684
|
+
current = insertExpression(parent, value, current, marker);
|
|
666
685
|
host && tagHost(current, host);
|
|
667
686
|
},
|
|
668
687
|
accessor.$s ? options ? {
|
|
@@ -1391,8 +1410,11 @@ function eventHandler(e, container, state) {
|
|
|
1391
1410
|
retarget(oriTarget);
|
|
1392
1411
|
}
|
|
1393
1412
|
function insertExpression(parent, value, current, marker) {
|
|
1394
|
-
if (hydrationRt !== null && isHydrating(parent))
|
|
1395
|
-
|
|
1413
|
+
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1414
|
+
if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
|
|
1415
|
+
return value;
|
|
1416
|
+
}
|
|
1417
|
+
if (value === current) return value;
|
|
1396
1418
|
const t = typeof value,
|
|
1397
1419
|
multi = marker !== undefined;
|
|
1398
1420
|
if (t === "string" || t === "number") {
|
|
@@ -1431,6 +1453,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1431
1453
|
appendNodes(parent, value);
|
|
1432
1454
|
}
|
|
1433
1455
|
} else ;
|
|
1456
|
+
return value;
|
|
1434
1457
|
}
|
|
1435
1458
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1436
1459
|
value = flatten(value, {
|
|
@@ -1568,13 +1591,17 @@ function resolveSSRNode(node, result, top) {}
|
|
|
1568
1591
|
function escape(s, attr) {}
|
|
1569
1592
|
|
|
1570
1593
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1594
|
+
// PURE-annotated factory (same convention as solid's MockPromise): the brand
|
|
1595
|
+
const ResponseEnvelope = /* @__PURE__ */(() => {
|
|
1596
|
+
class ResponseEnvelope {
|
|
1597
|
+
constructor(response, value) {
|
|
1598
|
+
this.response = response;
|
|
1599
|
+
this.value = value;
|
|
1600
|
+
}
|
|
1575
1601
|
}
|
|
1576
|
-
|
|
1577
|
-
ResponseEnvelope
|
|
1602
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1603
|
+
return ResponseEnvelope;
|
|
1604
|
+
})();
|
|
1578
1605
|
function isResponseEnvelope(value) {
|
|
1579
1606
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1580
1607
|
}
|
|
@@ -1690,7 +1717,8 @@ function portalImpl(props) {
|
|
|
1690
1717
|
endMarker = document.createTextNode(""),
|
|
1691
1718
|
mount = () => props.mount || document.body,
|
|
1692
1719
|
content = createMemo(() => [startMarker, props.children], {
|
|
1693
|
-
ssrSource: "client"
|
|
1720
|
+
ssrSource: "client",
|
|
1721
|
+
loadingValue: undefined
|
|
1694
1722
|
});
|
|
1695
1723
|
createRenderEffect(
|
|
1696
1724
|
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
@@ -1727,7 +1755,8 @@ function portalImpl(props) {
|
|
|
1727
1755
|
ssrSource: "client"
|
|
1728
1756
|
});
|
|
1729
1757
|
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1730
|
-
ssrSource: "client"
|
|
1758
|
+
ssrSource: "client",
|
|
1759
|
+
loadingValue: undefined
|
|
1731
1760
|
});
|
|
1732
1761
|
return treeMarker;
|
|
1733
1762
|
}
|
|
@@ -1811,11 +1840,13 @@ _moduleUrl) {
|
|
|
1811
1840
|
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1812
1841
|
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1813
1842
|
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1814
|
-
sharedConfig.onHydrationEnd
|
|
1843
|
+
const onHydrationEnd = sharedConfig.onHydrationEnd;
|
|
1844
|
+
const release = () => setMounted(true);
|
|
1845
|
+
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1815
1846
|
return gate;
|
|
1816
1847
|
};
|
|
1817
1848
|
}
|
|
1818
1849
|
function httpStatus(_code, _text) {}
|
|
1819
1850
|
function httpHeader(_name, _value, _options) {}
|
|
1820
1851
|
|
|
1821
|
-
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 };
|
|
1852
|
+
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 };
|