@solidjs/web 2.0.0-rc.8 → 2.0.0-rc.9
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 +626 -125
- package/dist/server.js +433 -95
- package/dist/server.observe.js +3980 -0
- package/dist/web.dev.js +208 -60
- package/dist/web.js +175 -58
- package/dist/web.observe.js +175 -58
- package/frames/dist/client.dev.js +103 -4
- package/frames/dist/client.js +5 -2
- package/frames/dist/client.observe.js +2123 -0
- package/frames/dist/server.dev.js +521 -79
- package/frames/dist/server.js +352 -52
- package/frames/dist/server.observe.js +4946 -0
- package/frames/package.json +12 -0
- package/package.json +87 -3
- package/server-functions/dist/client.dev.js +1102 -0
- package/server-functions/dist/client.js +74 -69
- package/server-functions/dist/client.observe.js +1102 -0
- package/server-functions/dist/server.dev.js +402 -31
- package/server-functions/dist/server.js +339 -30
- package/server-functions/dist/server.observe.js +2726 -0
- package/server-functions/package.json +12 -0
- package/types/client.d.ts +22 -1
- package/types/diagnostics.d.ts +24 -0
- package/types/frames/frame-transport.d.ts +1 -1
- package/types/index.d.ts +25 -15
- package/types/index.server.d.ts +35 -8
- package/types/jsx.d.ts +15 -4
- package/types/observe.d.ts +294 -0
- package/types/response.d.ts +18 -0
- package/types/server-functions/client.d.ts +32 -22
- package/types/server-functions/server.d.ts +28 -37
- package/types/server-functions/shared.d.ts +39 -9
- package/types/server-mock.d.ts +26 -4
- package/types/server-observe.d.ts +39 -0
- package/types/server.d.ts +104 -5
- package/types/trace.d.ts +79 -0
package/dist/web.observe.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, createRoot, flatten, flush,
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, OBSERVE, createComponent, omit, createOwner, createSignal, onCleanup, createEffect } 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 { sourceKeys, SOURCE_PROXY, hasStaticKeys, resolvedTable, viewOf, OmitView, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_MEMO, SOURCE_PLAIN } from 'solid-js/internal';
|
|
3
4
|
|
|
4
5
|
const DOMWithState = {
|
|
5
6
|
INPUT: {
|
|
@@ -348,6 +349,7 @@ const waitAsset = promise => {
|
|
|
348
349
|
}
|
|
349
350
|
gate();
|
|
350
351
|
};
|
|
352
|
+
const EVENT_KEY = "_$$";
|
|
351
353
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
352
354
|
const $$EVENT_TUPLE = Symbol();
|
|
353
355
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
@@ -362,12 +364,14 @@ function HydrationScript(_props) {
|
|
|
362
364
|
return null;
|
|
363
365
|
}
|
|
364
366
|
const getRequestEvent = voidFn;
|
|
367
|
+
const getTraceContext = voidFn;
|
|
365
368
|
function render(code, element, init, options = {}) {
|
|
366
369
|
let disposer;
|
|
367
370
|
registerDelegatedRoot(element);
|
|
368
371
|
try {
|
|
369
372
|
createRoot(dispose => {
|
|
370
373
|
disposer = dispose;
|
|
374
|
+
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
371
375
|
if (element === document) {
|
|
372
376
|
const tree = code();
|
|
373
377
|
effect(() => flatten(tree), () => {});
|
|
@@ -580,7 +584,7 @@ function className(node, value, prev) {
|
|
|
580
584
|
}
|
|
581
585
|
function addEvent(node, name, handler, delegate) {
|
|
582
586
|
if (delegate) {
|
|
583
|
-
const key =
|
|
587
|
+
const key = EVENT_KEY + name;
|
|
584
588
|
let data;
|
|
585
589
|
if (Array.isArray(handler)) {
|
|
586
590
|
data = handler[1];
|
|
@@ -648,7 +652,7 @@ function readShallow(value) {
|
|
|
648
652
|
if (value === null || typeof value !== "object") return value;
|
|
649
653
|
if (Array.isArray(value)) return value.map(readShallow);
|
|
650
654
|
if (value[$PROXY] !== value) return value;
|
|
651
|
-
const keys =
|
|
655
|
+
const keys = sourceKeys(value, SOURCE_PROXY);
|
|
652
656
|
const out = {};
|
|
653
657
|
for (let i = 0; i < keys.length; i++) {
|
|
654
658
|
const k = keys[i];
|
|
@@ -656,46 +660,107 @@ function readShallow(value) {
|
|
|
656
660
|
}
|
|
657
661
|
return out;
|
|
658
662
|
}
|
|
659
|
-
function ownKeys(o) {
|
|
660
|
-
return o[$PROXY] === o ? Reflect.ownKeys(o) : Object.keys(o);
|
|
661
|
-
}
|
|
662
663
|
function setStyleProperty(node, name, value) {
|
|
663
664
|
if (isHydrating(node)) return;
|
|
664
665
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
665
666
|
}
|
|
666
|
-
function spread(node, props, skipChildren) {
|
|
667
|
+
function spread(node, props, skipChildren, skip) {
|
|
667
668
|
const prevProps = {};
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
669
|
+
const apply = newProps => {
|
|
670
|
+
const r = newProps.ref;
|
|
671
|
+
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
672
|
+
assign(node, newProps, true, prevProps, true);
|
|
673
|
+
};
|
|
674
|
+
if (Array.isArray(props)) {
|
|
675
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
676
|
+
for (let i = props.length - 1; i >= 0; i--) {
|
|
677
|
+
const s = resolveSource(props[i]);
|
|
678
|
+
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
682
|
+
return prevProps;
|
|
683
|
+
}
|
|
684
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
685
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
686
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
687
|
+
if (desc !== undefined) {
|
|
688
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
689
|
+
}
|
|
690
|
+
} else insert(node, () => {
|
|
691
|
+
const source = resolveSource(props);
|
|
692
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
693
|
+
});
|
|
694
|
+
}
|
|
678
695
|
effect(() => {
|
|
679
|
-
const source =
|
|
696
|
+
const source = resolveSource(props);
|
|
680
697
|
const newProps = {};
|
|
681
|
-
const
|
|
682
|
-
if (
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
}
|
|
688
|
-
} else collectProps(newProps, source);
|
|
698
|
+
const table = resolvedTable(source);
|
|
699
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
700
|
+
if (source != null) {
|
|
701
|
+
const view = viewOf(source);
|
|
702
|
+
if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
|
|
703
|
+
}
|
|
689
704
|
return newProps;
|
|
690
|
-
},
|
|
705
|
+
}, apply);
|
|
691
706
|
return prevProps;
|
|
692
707
|
}
|
|
693
|
-
function
|
|
694
|
-
const
|
|
695
|
-
|
|
708
|
+
function collectTable(out, table, skip) {
|
|
709
|
+
for (const [prop, leaf] of table) {
|
|
710
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
711
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
712
|
+
const v = leaf[prop];
|
|
713
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
714
|
+
}
|
|
715
|
+
return out;
|
|
716
|
+
}
|
|
717
|
+
function resolveSource(s) {
|
|
718
|
+
return typeof s === "function" ? s() : s;
|
|
719
|
+
}
|
|
720
|
+
function entryHas(s, key) {
|
|
721
|
+
const view = viewOf(s);
|
|
722
|
+
return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
|
|
723
|
+
}
|
|
724
|
+
function entryGet(s, key) {
|
|
725
|
+
const view = viewOf(s);
|
|
726
|
+
return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
|
|
727
|
+
}
|
|
728
|
+
function collectSources(out, sources, kinds, skip) {
|
|
729
|
+
const resolved = [];
|
|
730
|
+
const resolvedKinds = [];
|
|
731
|
+
for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
|
|
732
|
+
for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
|
|
733
|
+
return out;
|
|
734
|
+
}
|
|
735
|
+
function pushEntry(resolved, kinds, s, kind) {
|
|
736
|
+
if (kind !== SOURCE_MEMO) {
|
|
737
|
+
resolved.push(s);
|
|
738
|
+
kinds.push(kind);
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
s = resolveSource(s);
|
|
742
|
+
if (s == null) return;
|
|
743
|
+
const view = viewOf(s);
|
|
744
|
+
if (view instanceof OmitView) {
|
|
745
|
+
resolved.push(view);
|
|
746
|
+
kinds.push(SOURCE_OMIT);
|
|
747
|
+
} else if (view !== undefined) {
|
|
748
|
+
const f = view.sources,
|
|
749
|
+
k = view.kinds;
|
|
750
|
+
for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
|
|
751
|
+
} else {
|
|
752
|
+
resolved.push(s);
|
|
753
|
+
kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
function collectProps(out, s, kind, skip, later, laterKinds, from) {
|
|
757
|
+
const keys = sourceKeys(s, kind);
|
|
758
|
+
outer: for (let i = 0; i < keys.length; i++) {
|
|
696
759
|
const prop = keys[i];
|
|
697
|
-
if (typeof prop !== "string" || prop === "children"
|
|
698
|
-
|
|
760
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
761
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
762
|
+
if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
|
|
763
|
+
const v = sourceGet(s, kind, prop);
|
|
699
764
|
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
700
765
|
}
|
|
701
766
|
}
|
|
@@ -728,8 +793,7 @@ function installHydrationRuntime() {
|
|
|
728
793
|
hydrationRt = {
|
|
729
794
|
claimInitial(parent, multi, initial) {
|
|
730
795
|
if (isHydrating(parent)) {
|
|
731
|
-
if (!multi && initial === undefined && parent) initial =
|
|
732
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
796
|
+
if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
733
797
|
}
|
|
734
798
|
return initial;
|
|
735
799
|
},
|
|
@@ -753,7 +817,7 @@ function installHydrationRuntime() {
|
|
|
753
817
|
nodes.unshift(node);
|
|
754
818
|
node = node.previousSibling;
|
|
755
819
|
}
|
|
756
|
-
} else
|
|
820
|
+
} else return claimChildNodes(parent);
|
|
757
821
|
return stripTextSeparators(nodes);
|
|
758
822
|
},
|
|
759
823
|
dedupEvent(e) {
|
|
@@ -766,19 +830,36 @@ function stripTextSeparators(nodes) {
|
|
|
766
830
|
for (let i = 0; i < nodes.length; i++) {
|
|
767
831
|
const node = nodes[i],
|
|
768
832
|
t = node.nodeType;
|
|
769
|
-
if (t === 8) {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
}
|
|
775
|
-
if (v.startsWith("pl-")) continue;
|
|
776
|
-
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
833
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
834
|
+
node.remove();
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
777
838
|
nodes[j++] = node;
|
|
778
839
|
}
|
|
779
840
|
nodes.length = j;
|
|
780
841
|
return nodes;
|
|
781
842
|
}
|
|
843
|
+
function claimChildNodes(parent) {
|
|
844
|
+
const live = parent.childNodes;
|
|
845
|
+
const out = [];
|
|
846
|
+
for (let i = 0, n = live.length; i < n; i++) {
|
|
847
|
+
const node = live[i],
|
|
848
|
+
t = node.nodeType;
|
|
849
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
850
|
+
node.remove();
|
|
851
|
+
i--;
|
|
852
|
+
n--;
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
855
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
856
|
+
out.push(node);
|
|
857
|
+
}
|
|
858
|
+
return out;
|
|
859
|
+
}
|
|
860
|
+
function isPlaceholderScaffolding(node, t) {
|
|
861
|
+
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
862
|
+
}
|
|
782
863
|
function insert(parent, accessor, marker, initial, options) {
|
|
783
864
|
const multi = marker !== undefined;
|
|
784
865
|
const host = options && options.host;
|
|
@@ -1441,6 +1522,7 @@ function runHydrationEvents() {
|
|
|
1441
1522
|
}
|
|
1442
1523
|
function isHydrating(node) {
|
|
1443
1524
|
if (!sharedConfig.hydrating) return false;
|
|
1525
|
+
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1444
1526
|
if (!node || node.isConnected) return true;
|
|
1445
1527
|
const roots = sharedConfig.claimRoots;
|
|
1446
1528
|
if (roots) {
|
|
@@ -1520,7 +1602,7 @@ function eventHandler(e, container, state) {
|
|
|
1520
1602
|
if (owner && owner === resumeNode) return;
|
|
1521
1603
|
e[$$EVENT_OWNER] = owner || true;
|
|
1522
1604
|
let node = resumeNode || e.target;
|
|
1523
|
-
const key =
|
|
1605
|
+
const key = EVENT_KEY + e.type;
|
|
1524
1606
|
const oriTarget = e.target;
|
|
1525
1607
|
const boundary = owner || container || e.currentTarget;
|
|
1526
1608
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
@@ -1721,16 +1803,25 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1721
1803
|
}
|
|
1722
1804
|
function gatherHydratable(element, root) {
|
|
1723
1805
|
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1806
|
+
const frames = root ? null : element.querySelectorAll("[data-fid]");
|
|
1807
|
+
const frameCount = frames ? frames.length : 0;
|
|
1808
|
+
const registry = sharedConfig.registry;
|
|
1724
1809
|
for (let i = 0; i < templates.length; i++) {
|
|
1725
1810
|
const node = templates[i];
|
|
1726
1811
|
const key = node.getAttribute("_hk");
|
|
1727
1812
|
if (root) {
|
|
1728
1813
|
if (!key.startsWith(root)) continue;
|
|
1729
|
-
} else {
|
|
1730
|
-
|
|
1731
|
-
|
|
1814
|
+
} else if (frameCount !== 0) {
|
|
1815
|
+
let inFrame = false;
|
|
1816
|
+
for (let j = 0; j < frameCount; j++) {
|
|
1817
|
+
if (frames[j].contains(node)) {
|
|
1818
|
+
inFrame = true;
|
|
1819
|
+
break;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
if (inFrame) continue;
|
|
1732
1823
|
}
|
|
1733
|
-
if (!
|
|
1824
|
+
if (!registry.has(key)) registry.set(key, node);
|
|
1734
1825
|
}
|
|
1735
1826
|
}
|
|
1736
1827
|
function getHydrationKey() {
|
|
@@ -1738,6 +1829,7 @@ function getHydrationKey() {
|
|
|
1738
1829
|
}
|
|
1739
1830
|
const RequestContext = Symbol();
|
|
1740
1831
|
|
|
1832
|
+
function configureServerErrors(_config) {}
|
|
1741
1833
|
function throwInBrowser(func) {
|
|
1742
1834
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1743
1835
|
console.error(err);
|
|
@@ -1767,14 +1859,14 @@ function composeMiddleware(middlewares) {
|
|
|
1767
1859
|
throwInBrowser(composeMiddleware);
|
|
1768
1860
|
}
|
|
1769
1861
|
function ssr(template, ...nodes) {}
|
|
1770
|
-
function ssrElement(name, props, children, needsId) {}
|
|
1862
|
+
function ssrElement(name, props, children, needsId, skip) {}
|
|
1771
1863
|
function ssrClassName(value) {}
|
|
1772
1864
|
function ssrStyle(value) {}
|
|
1773
1865
|
function ssrStyleProperty(name, value) {}
|
|
1774
1866
|
function ssrAttribute(key, value) {}
|
|
1775
1867
|
function ssrGroup(fn, n) {}
|
|
1776
1868
|
function ssrHydrationKey() {}
|
|
1777
|
-
function resolveSSRNode(node, result, top) {}
|
|
1869
|
+
function resolveSSRNode(node, result, top, nested) {}
|
|
1778
1870
|
function escape(s, attr) {}
|
|
1779
1871
|
|
|
1780
1872
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
@@ -1811,6 +1903,7 @@ function isSafeError(value) {
|
|
|
1811
1903
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1812
1904
|
}
|
|
1813
1905
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1906
|
+
const REVALIDATE_ALL = "*";
|
|
1814
1907
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
1815
1908
|
function initWithRevalidate(init = {}) {
|
|
1816
1909
|
const resolved = typeof init === "number" ? {
|
|
@@ -1833,7 +1926,11 @@ function initWithRevalidate(init = {}) {
|
|
|
1833
1926
|
headers = new Headers(responseInit.headers);
|
|
1834
1927
|
}
|
|
1835
1928
|
if (revalidate !== undefined) {
|
|
1836
|
-
const
|
|
1929
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
1930
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
1931
|
+
throw new TypeError(`revalidate names "${REVALIDATE_ALL}" alongside other keys; "${REVALIDATE_ALL}" already ` + `means every entry and stands alone — pass revalidate: "${REVALIDATE_ALL}" or the named keys.`);
|
|
1932
|
+
}
|
|
1933
|
+
const keys = list.join(",");
|
|
1837
1934
|
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
1838
1935
|
throw new TypeError(`revalidate names ${keys.length} characters of cache keys; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the ${REVALIDATE_HEADER} header would overflow ` + `receivers (an 8 KiB proxy buffer holds the whole header block) and the response ` + `dies at the socket after the mutation committed. Split the invalidation across ` + `calls or use coarser keys — a dropped key would be a silently stale cache, so ` + `the runtime refuses rather than trims.`);
|
|
1839
1936
|
}
|
|
@@ -1955,7 +2052,8 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
|
1955
2052
|
function bindingOf(value) {
|
|
1956
2053
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1957
2054
|
}
|
|
1958
|
-
function dynamic(source,
|
|
2055
|
+
function dynamic(source, options) {
|
|
2056
|
+
if (options?.static) return staticDynamic(untrack(source));
|
|
1959
2057
|
let latest = 0;
|
|
1960
2058
|
const sites = new Set();
|
|
1961
2059
|
let deliveredAddress;
|
|
@@ -1996,19 +2094,38 @@ function dynamic(source, _options) {
|
|
|
1996
2094
|
return untrack(() => component(props));
|
|
1997
2095
|
}
|
|
1998
2096
|
case "string":
|
|
1999
|
-
|
|
2000
|
-
spread(el, props);
|
|
2001
|
-
return el;
|
|
2097
|
+
return staticElement(component, props);
|
|
2002
2098
|
}
|
|
2003
2099
|
});
|
|
2004
2100
|
};
|
|
2005
2101
|
}
|
|
2102
|
+
function staticDynamic(component) {
|
|
2103
|
+
if (typeof component === "function") {
|
|
2104
|
+
const binding = bindingOf(component);
|
|
2105
|
+
if (binding) {
|
|
2106
|
+
const address = () => binding.address;
|
|
2107
|
+
return props => untrack(() => binding.component(props, address));
|
|
2108
|
+
}
|
|
2109
|
+
return props => untrack(() => component(props));
|
|
2110
|
+
}
|
|
2111
|
+
if (typeof component === "string") return props => staticElement(component, props);
|
|
2112
|
+
return () => undefined;
|
|
2113
|
+
}
|
|
2114
|
+
function staticElement(tag, props) {
|
|
2115
|
+
const hydrating = sharedConfig.hydrating;
|
|
2116
|
+
const el = hydrating ? getNextElement() : createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2117
|
+
spread(el, props);
|
|
2118
|
+
if (hydrating) runHydrationEvents();
|
|
2119
|
+
return el;
|
|
2120
|
+
}
|
|
2006
2121
|
function Dynamic(props) {
|
|
2007
2122
|
const Comp = dynamic(() => props.component);
|
|
2008
2123
|
return createComponent(Comp, omit(props, "component"));
|
|
2009
2124
|
}
|
|
2010
|
-
function createElement(tagName, is = undefined) {
|
|
2011
|
-
return
|
|
2125
|
+
function createElement(tagName, is = undefined, xmlns = undefined) {
|
|
2126
|
+
return xmlns ? document.createElementNS(xmlns, tagName, {
|
|
2127
|
+
is
|
|
2128
|
+
}) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
2012
2129
|
is
|
|
2013
2130
|
});
|
|
2014
2131
|
}
|
|
@@ -2040,4 +2157,4 @@ _moduleUrl) {
|
|
|
2040
2157
|
function httpStatus(_code, _text) {}
|
|
2041
2158
|
function httpHeader(_name, _value, _options) {}
|
|
2042
2159
|
|
|
2043
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, 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, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, 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, waitAsset, warmAsset };
|
|
2160
|
+
export { 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, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, 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, waitAsset, warmAsset };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { getOwner, onCleanup, createMemo, runWithOwner, createSignal, createRenderEffect, createLoadingBoundary, createOwner, sharedConfig
|
|
1
|
+
import { DEV, OBSERVE, getOwner, onCleanup, createMemo, runWithOwner, createSignal, createRenderEffect, createLoadingBoundary, createOwner, sharedConfig } from 'solid-js';
|
|
2
2
|
import { delegateEvents, insert } from '@solidjs/web';
|
|
3
|
-
import {
|
|
3
|
+
import { frameAddress, SINGLE_FLIGHT_HEADER, deserializeStream, getServerFunctionsCodec, createChunk, getFlightDataConsumer, ERROR_HEADER, REVALIDATE_HEADER, ChunkReader, configureServerFunctionsClient } from '@solidjs/web/server-functions/client';
|
|
4
|
+
import { materializeContainerTrace } from 'solid-js/internal';
|
|
4
5
|
|
|
5
6
|
const ELEMENT_NODE = 1;
|
|
6
7
|
const TEXT_NODE = 3;
|
|
@@ -1175,7 +1176,16 @@ function devCheckRange(start, id) {
|
|
|
1175
1176
|
if (n.nodeType === COMMENT_NODE && n.data === end) return;
|
|
1176
1177
|
n = n.nextSibling;
|
|
1177
1178
|
}
|
|
1178
|
-
|
|
1179
|
+
DEV.report(OBSERVE.diagnostics.emit({
|
|
1180
|
+
code: "FRAME_MARKER_CORRUPTED",
|
|
1181
|
+
kind: "ssr",
|
|
1182
|
+
severity: "error",
|
|
1183
|
+
message: `[FRAME_MARKER_CORRUPTED] Frame slot range "${id}" is missing its end marker (<!--${end}-->) among its start ` + `marker's siblings. Slots after it in this content cannot be discovered. Likely causes: ` + `invalid HTML nesting split the range during parsing (e.g. a block element inside <p>), ` + `or an HTML-rewriting layer (CDN/minifier/translator) removed or moved the comment — ` + `serve frame documents with Cache-Control: no-transform.`,
|
|
1184
|
+
data: {
|
|
1185
|
+
slot: id,
|
|
1186
|
+
end
|
|
1187
|
+
}
|
|
1188
|
+
}, null));
|
|
1179
1189
|
}
|
|
1180
1190
|
function findRangeStart(from, id, bound) {
|
|
1181
1191
|
const target = `slot:${id}:start`;
|
|
@@ -1330,11 +1340,98 @@ function stashRange(frag, start, id) {
|
|
|
1330
1340
|
return null;
|
|
1331
1341
|
}
|
|
1332
1342
|
|
|
1343
|
+
const RECORDS = Symbol.for("@solidjs/signals/observe/records");
|
|
1344
|
+
function records() {
|
|
1345
|
+
return globalThis[RECORDS];
|
|
1346
|
+
}
|
|
1347
|
+
function frameCensus(event, type, own) {
|
|
1348
|
+
event.chunks++;
|
|
1349
|
+
switch (type) {
|
|
1350
|
+
case "html":
|
|
1351
|
+
if (!own) event.regions++;else if (event.shellMs === undefined) event.shellMs = performance.now() - event.at;
|
|
1352
|
+
break;
|
|
1353
|
+
case "fragment":
|
|
1354
|
+
event.fragments++;
|
|
1355
|
+
break;
|
|
1356
|
+
case "slot":
|
|
1357
|
+
event.slots++;
|
|
1358
|
+
break;
|
|
1359
|
+
case "error":
|
|
1360
|
+
event.errors++;
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
function observeFrameApply(response) {
|
|
1365
|
+
const channel = records();
|
|
1366
|
+
if (channel === undefined || !channel.observed("frame")) return undefined;
|
|
1367
|
+
let current;
|
|
1368
|
+
const close = (outcome, error) => {
|
|
1369
|
+
const open = current;
|
|
1370
|
+
current = undefined;
|
|
1371
|
+
open.event.durationMs = performance.now() - open.event.at;
|
|
1372
|
+
open.event.outcome = outcome;
|
|
1373
|
+
const live = {
|
|
1374
|
+
response
|
|
1375
|
+
};
|
|
1376
|
+
if (error !== undefined) live.error = error;
|
|
1377
|
+
channel.emit("frame", open.event, live);
|
|
1378
|
+
};
|
|
1379
|
+
return {
|
|
1380
|
+
chunk(chunk, wireId) {
|
|
1381
|
+
if (chunk.type === "start") {
|
|
1382
|
+
if (current !== undefined) close("truncated");
|
|
1383
|
+
const event = {
|
|
1384
|
+
side: "client",
|
|
1385
|
+
id: wireId,
|
|
1386
|
+
version: chunk.version,
|
|
1387
|
+
at: performance.now(),
|
|
1388
|
+
durationMs: 0,
|
|
1389
|
+
outcome: "complete",
|
|
1390
|
+
chunks: 0,
|
|
1391
|
+
fragments: 0,
|
|
1392
|
+
slots: 0,
|
|
1393
|
+
regions: 0,
|
|
1394
|
+
errors: 0
|
|
1395
|
+
};
|
|
1396
|
+
if (chunk.id !== wireId) event.address = chunk.id;
|
|
1397
|
+
current = {
|
|
1398
|
+
event,
|
|
1399
|
+
applied: chunk.id
|
|
1400
|
+
};
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
if (current === undefined) return;
|
|
1404
|
+
if (chunk.type === "complete") {
|
|
1405
|
+
if (chunk.id === current.applied) close("complete");
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
frameCensus(current.event, chunk.type, chunk.id === current.applied);
|
|
1409
|
+
},
|
|
1410
|
+
end(error) {
|
|
1411
|
+
if (current !== undefined) close(error !== undefined ? "error" : "truncated", error);
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1333
1416
|
const FRAME_STREAM_HEADER = "X-Frame-Stream";
|
|
1334
1417
|
function isFrameStreamResponse(response) {
|
|
1335
1418
|
return response.headers.has(FRAME_STREAM_HEADER);
|
|
1336
1419
|
}
|
|
1337
|
-
|
|
1420
|
+
const applyFrameResponse = observedApplyFrameResponse ;
|
|
1421
|
+
async function observedApplyFrameResponse(response, host, options = {}) {
|
|
1422
|
+
const observation = observeFrameApply(response);
|
|
1423
|
+
if (!observation) return applyFrames(response, host, options);
|
|
1424
|
+
let applied;
|
|
1425
|
+
try {
|
|
1426
|
+
applied = await applyFrames(response, host, options, observation);
|
|
1427
|
+
} catch (error) {
|
|
1428
|
+
observation.end(error);
|
|
1429
|
+
throw error;
|
|
1430
|
+
}
|
|
1431
|
+
observation.end();
|
|
1432
|
+
return applied;
|
|
1433
|
+
}
|
|
1434
|
+
async function applyFrames(response, host, options = {}, observation) {
|
|
1338
1435
|
const rootId = response.headers.get(FRAME_STREAM_HEADER) ?? "";
|
|
1339
1436
|
const as = options.as;
|
|
1340
1437
|
const version = options.version;
|
|
@@ -1346,12 +1443,14 @@ async function applyFrameResponse(response, host, options = {}) {
|
|
|
1346
1443
|
if (chunk.type === "outcome") {
|
|
1347
1444
|
if (options.onOutcome) options.onOutcome(chunk.payload);
|
|
1348
1445
|
} else {
|
|
1446
|
+
const wireId = chunk.id;
|
|
1349
1447
|
if (as !== undefined && chunk.id === rootId) chunk.id = as;
|
|
1350
1448
|
if (perFrame) {
|
|
1351
1449
|
let v = perFrame.get(chunk.id);
|
|
1352
1450
|
if (v === undefined) perFrame.set(chunk.id, v = version(chunk.id));
|
|
1353
1451
|
chunk.version = v;
|
|
1354
1452
|
} else if (version !== undefined) chunk.version = version;
|
|
1453
|
+
if (observation) observation.chunk(chunk, wireId);
|
|
1355
1454
|
if (chunk.type === "data" && host.prepareData) await host.prepareData();
|
|
1356
1455
|
host.apply(chunk);
|
|
1357
1456
|
}
|
package/frames/dist/client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { getOwner, onCleanup, createMemo, runWithOwner, createSignal, createRenderEffect, createLoadingBoundary, createOwner, sharedConfig
|
|
1
|
+
import { getOwner, onCleanup, createMemo, runWithOwner, createSignal, createRenderEffect, createLoadingBoundary, createOwner, sharedConfig } from 'solid-js';
|
|
2
2
|
import { delegateEvents, insert } from '@solidjs/web';
|
|
3
3
|
import { ChunkReader, frameAddress, SINGLE_FLIGHT_HEADER, deserializeStream, getServerFunctionsCodec, createChunk, getFlightDataConsumer, ERROR_HEADER, REVALIDATE_HEADER, configureServerFunctionsClient } from '@solidjs/web/server-functions/client';
|
|
4
|
+
import { materializeContainerTrace } from 'solid-js/internal';
|
|
4
5
|
|
|
5
6
|
const ELEMENT_NODE = 1;
|
|
6
7
|
const TEXT_NODE = 3;
|
|
@@ -1314,7 +1315,8 @@ const FRAME_STREAM_HEADER = "X-Frame-Stream";
|
|
|
1314
1315
|
function isFrameStreamResponse(response) {
|
|
1315
1316
|
return response.headers.has(FRAME_STREAM_HEADER);
|
|
1316
1317
|
}
|
|
1317
|
-
|
|
1318
|
+
const applyFrameResponse = applyFrames;
|
|
1319
|
+
async function applyFrames(response, host, options = {}, observation) {
|
|
1318
1320
|
const rootId = response.headers.get(FRAME_STREAM_HEADER) ?? "";
|
|
1319
1321
|
const as = options.as;
|
|
1320
1322
|
const version = options.version;
|
|
@@ -1326,6 +1328,7 @@ async function applyFrameResponse(response, host, options = {}) {
|
|
|
1326
1328
|
if (chunk.type === "outcome") {
|
|
1327
1329
|
if (options.onOutcome) options.onOutcome(chunk.payload);
|
|
1328
1330
|
} else {
|
|
1331
|
+
chunk.id;
|
|
1329
1332
|
if (as !== undefined && chunk.id === rootId) chunk.id = as;
|
|
1330
1333
|
if (perFrame) {
|
|
1331
1334
|
let v = perFrame.get(chunk.id);
|