@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.dev.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, getOwner, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, flatten, flush,
|
|
1
|
+
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, $DEVCOMP, 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: {
|
|
@@ -199,6 +200,15 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
|
|
203
|
+
function emitFinding(finding, subject = getOwner()) {
|
|
204
|
+
if (OBSERVE === undefined) return;
|
|
205
|
+
const entry = OBSERVE.diagnostics.emit(finding, subject);
|
|
206
|
+
if (DEV !== undefined) DEV.report(entry);
|
|
207
|
+
}
|
|
208
|
+
function devCheck(finding, subject) {
|
|
209
|
+
emitFinding(finding, subject);
|
|
210
|
+
}
|
|
211
|
+
|
|
202
212
|
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
203
213
|
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
204
214
|
const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
|
|
@@ -282,7 +292,16 @@ function resolveHead(groups) {
|
|
|
282
292
|
}
|
|
283
293
|
for (const [identity, tags] of byIdentity) {
|
|
284
294
|
if (identity === "title") {
|
|
285
|
-
if (tags.length > 1)
|
|
295
|
+
if (tags.length > 1) devCheck({
|
|
296
|
+
code: "HEAD_TAG_INVALID",
|
|
297
|
+
kind: "head",
|
|
298
|
+
severity: "warn",
|
|
299
|
+
message: "[HEAD_TAG_INVALID] Multiple <title> tags in one head group; the last one wins.",
|
|
300
|
+
data: {
|
|
301
|
+
reason: "duplicate-title",
|
|
302
|
+
detail: tags.length
|
|
303
|
+
}
|
|
304
|
+
});
|
|
286
305
|
winners.set(identity, {
|
|
287
306
|
seq: group.seq,
|
|
288
307
|
tags: [tags[tags.length - 1]]
|
|
@@ -388,6 +407,7 @@ const waitAsset = promise => {
|
|
|
388
407
|
}
|
|
389
408
|
gate();
|
|
390
409
|
};
|
|
410
|
+
const EVENT_KEY = "_$$";
|
|
391
411
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
392
412
|
const $$EVENT_TUPLE = Symbol();
|
|
393
413
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
@@ -402,6 +422,7 @@ function HydrationScript(_props) {
|
|
|
402
422
|
return null;
|
|
403
423
|
}
|
|
404
424
|
const getRequestEvent = voidFn;
|
|
425
|
+
const getTraceContext = voidFn;
|
|
405
426
|
function render(code, element, init, options = {}) {
|
|
406
427
|
if (!element) {
|
|
407
428
|
throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
|
|
@@ -413,6 +434,7 @@ function render(code, element, init, options = {}) {
|
|
|
413
434
|
try {
|
|
414
435
|
createRoot(dispose => {
|
|
415
436
|
disposer = dispose;
|
|
437
|
+
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
416
438
|
if (element === document) {
|
|
417
439
|
const tree = code();
|
|
418
440
|
effect(() => flatten(tree), () => {});
|
|
@@ -633,7 +655,7 @@ function className(node, value, prev) {
|
|
|
633
655
|
}
|
|
634
656
|
function addEvent(node, name, handler, delegate) {
|
|
635
657
|
if (delegate) {
|
|
636
|
-
const key =
|
|
658
|
+
const key = EVENT_KEY + name;
|
|
637
659
|
let data;
|
|
638
660
|
if (Array.isArray(handler)) {
|
|
639
661
|
data = handler[1];
|
|
@@ -702,7 +724,7 @@ function readShallow(value) {
|
|
|
702
724
|
if (value === null || typeof value !== "object") return value;
|
|
703
725
|
if (Array.isArray(value)) return value.map(readShallow);
|
|
704
726
|
if (value[$PROXY] !== value) return value;
|
|
705
|
-
const keys =
|
|
727
|
+
const keys = sourceKeys(value, SOURCE_PROXY);
|
|
706
728
|
const out = {};
|
|
707
729
|
for (let i = 0; i < keys.length; i++) {
|
|
708
730
|
const k = keys[i];
|
|
@@ -710,47 +732,108 @@ function readShallow(value) {
|
|
|
710
732
|
}
|
|
711
733
|
return out;
|
|
712
734
|
}
|
|
713
|
-
function ownKeys(o) {
|
|
714
|
-
return o[$PROXY] === o ? Reflect.ownKeys(o) : Object.keys(o);
|
|
715
|
-
}
|
|
716
735
|
function setStyleProperty(node, name, value) {
|
|
717
736
|
tagElement(node);
|
|
718
737
|
if (isHydrating(node)) return;
|
|
719
738
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
720
739
|
}
|
|
721
|
-
function spread(node, props, skipChildren) {
|
|
740
|
+
function spread(node, props, skipChildren, skip) {
|
|
722
741
|
const prevProps = {};
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
742
|
+
const apply = newProps => {
|
|
743
|
+
const r = newProps.ref;
|
|
744
|
+
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
745
|
+
assign(node, newProps, true, prevProps, true);
|
|
746
|
+
};
|
|
747
|
+
if (Array.isArray(props)) {
|
|
748
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
749
|
+
for (let i = props.length - 1; i >= 0; i--) {
|
|
750
|
+
const s = resolveSource(props[i]);
|
|
751
|
+
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
755
|
+
return prevProps;
|
|
756
|
+
}
|
|
757
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
758
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
759
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
760
|
+
if (desc !== undefined) {
|
|
761
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
762
|
+
}
|
|
763
|
+
} else insert(node, () => {
|
|
764
|
+
const source = resolveSource(props);
|
|
765
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
766
|
+
});
|
|
767
|
+
}
|
|
733
768
|
effect(() => {
|
|
734
|
-
const source =
|
|
769
|
+
const source = resolveSource(props);
|
|
735
770
|
const newProps = {};
|
|
736
|
-
const
|
|
737
|
-
if (
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}
|
|
743
|
-
} else collectProps(newProps, source);
|
|
771
|
+
const table = resolvedTable(source);
|
|
772
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
773
|
+
if (source != null) {
|
|
774
|
+
const view = viewOf(source);
|
|
775
|
+
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);
|
|
776
|
+
}
|
|
744
777
|
return newProps;
|
|
745
|
-
},
|
|
778
|
+
}, apply);
|
|
746
779
|
return prevProps;
|
|
747
780
|
}
|
|
748
|
-
function
|
|
749
|
-
const
|
|
750
|
-
|
|
781
|
+
function collectTable(out, table, skip) {
|
|
782
|
+
for (const [prop, leaf] of table) {
|
|
783
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
784
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
785
|
+
const v = leaf[prop];
|
|
786
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
787
|
+
}
|
|
788
|
+
return out;
|
|
789
|
+
}
|
|
790
|
+
function resolveSource(s) {
|
|
791
|
+
return typeof s === "function" ? s() : s;
|
|
792
|
+
}
|
|
793
|
+
function entryHas(s, key) {
|
|
794
|
+
const view = viewOf(s);
|
|
795
|
+
return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
|
|
796
|
+
}
|
|
797
|
+
function entryGet(s, key) {
|
|
798
|
+
const view = viewOf(s);
|
|
799
|
+
return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
|
|
800
|
+
}
|
|
801
|
+
function collectSources(out, sources, kinds, skip) {
|
|
802
|
+
const resolved = [];
|
|
803
|
+
const resolvedKinds = [];
|
|
804
|
+
for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
|
|
805
|
+
for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
|
|
806
|
+
return out;
|
|
807
|
+
}
|
|
808
|
+
function pushEntry(resolved, kinds, s, kind) {
|
|
809
|
+
if (kind !== SOURCE_MEMO) {
|
|
810
|
+
resolved.push(s);
|
|
811
|
+
kinds.push(kind);
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
s = resolveSource(s);
|
|
815
|
+
if (s == null) return;
|
|
816
|
+
const view = viewOf(s);
|
|
817
|
+
if (view instanceof OmitView) {
|
|
818
|
+
resolved.push(view);
|
|
819
|
+
kinds.push(SOURCE_OMIT);
|
|
820
|
+
} else if (view !== undefined) {
|
|
821
|
+
const f = view.sources,
|
|
822
|
+
k = view.kinds;
|
|
823
|
+
for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
|
|
824
|
+
} else {
|
|
825
|
+
resolved.push(s);
|
|
826
|
+
kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
function collectProps(out, s, kind, skip, later, laterKinds, from) {
|
|
830
|
+
const keys = sourceKeys(s, kind);
|
|
831
|
+
outer: for (let i = 0; i < keys.length; i++) {
|
|
751
832
|
const prop = keys[i];
|
|
752
|
-
if (typeof prop !== "string" || prop === "children"
|
|
753
|
-
|
|
833
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
834
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
835
|
+
if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
|
|
836
|
+
const v = sourceGet(s, kind, prop);
|
|
754
837
|
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
755
838
|
}
|
|
756
839
|
}
|
|
@@ -783,8 +866,7 @@ function installHydrationRuntime() {
|
|
|
783
866
|
hydrationRt = {
|
|
784
867
|
claimInitial(parent, multi, initial) {
|
|
785
868
|
if (isHydrating(parent)) {
|
|
786
|
-
if (!multi && initial === undefined && parent) initial =
|
|
787
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
869
|
+
if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
788
870
|
}
|
|
789
871
|
return initial;
|
|
790
872
|
},
|
|
@@ -808,7 +890,7 @@ function installHydrationRuntime() {
|
|
|
808
890
|
nodes.unshift(node);
|
|
809
891
|
node = node.previousSibling;
|
|
810
892
|
}
|
|
811
|
-
} else
|
|
893
|
+
} else return claimChildNodes(parent);
|
|
812
894
|
return stripTextSeparators(nodes);
|
|
813
895
|
},
|
|
814
896
|
dedupEvent(e) {
|
|
@@ -821,19 +903,36 @@ function stripTextSeparators(nodes) {
|
|
|
821
903
|
for (let i = 0; i < nodes.length; i++) {
|
|
822
904
|
const node = nodes[i],
|
|
823
905
|
t = node.nodeType;
|
|
824
|
-
if (t === 8) {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
}
|
|
830
|
-
if (v.startsWith("pl-")) continue;
|
|
831
|
-
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
906
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
907
|
+
node.remove();
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
832
911
|
nodes[j++] = node;
|
|
833
912
|
}
|
|
834
913
|
nodes.length = j;
|
|
835
914
|
return nodes;
|
|
836
915
|
}
|
|
916
|
+
function claimChildNodes(parent) {
|
|
917
|
+
const live = parent.childNodes;
|
|
918
|
+
const out = [];
|
|
919
|
+
for (let i = 0, n = live.length; i < n; i++) {
|
|
920
|
+
const node = live[i],
|
|
921
|
+
t = node.nodeType;
|
|
922
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
923
|
+
node.remove();
|
|
924
|
+
i--;
|
|
925
|
+
n--;
|
|
926
|
+
continue;
|
|
927
|
+
}
|
|
928
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
929
|
+
out.push(node);
|
|
930
|
+
}
|
|
931
|
+
return out;
|
|
932
|
+
}
|
|
933
|
+
function isPlaceholderScaffolding(node, t) {
|
|
934
|
+
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
935
|
+
}
|
|
837
936
|
function insert(parent, accessor, marker, initial, options) {
|
|
838
937
|
const multi = marker !== undefined;
|
|
839
938
|
const host = options && options.host;
|
|
@@ -1556,6 +1655,7 @@ function runHydrationEvents() {
|
|
|
1556
1655
|
}
|
|
1557
1656
|
function isHydrating(node) {
|
|
1558
1657
|
if (!sharedConfig.hydrating) return false;
|
|
1658
|
+
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1559
1659
|
if (!node || node.isConnected) return true;
|
|
1560
1660
|
const roots = sharedConfig.claimRoots;
|
|
1561
1661
|
if (roots) {
|
|
@@ -1635,7 +1735,7 @@ function eventHandler(e, container, state) {
|
|
|
1635
1735
|
if (owner && owner === resumeNode) return;
|
|
1636
1736
|
e[$$EVENT_OWNER] = owner || true;
|
|
1637
1737
|
let node = resumeNode || e.target;
|
|
1638
|
-
const key =
|
|
1738
|
+
const key = EVENT_KEY + e.type;
|
|
1639
1739
|
const oriTarget = e.target;
|
|
1640
1740
|
const boundary = owner || container || e.currentTarget;
|
|
1641
1741
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
@@ -1756,7 +1856,16 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1756
1856
|
current && cleanChildren(parent, current);
|
|
1757
1857
|
appendNodes(parent, value);
|
|
1758
1858
|
}
|
|
1759
|
-
} else
|
|
1859
|
+
} else devCheck({
|
|
1860
|
+
code: "UNRECOGNIZED_INSERT_VALUE",
|
|
1861
|
+
kind: "render",
|
|
1862
|
+
severity: "warn",
|
|
1863
|
+
message: `[UNRECOGNIZED_INSERT_VALUE] Unrecognized value. Skipped inserting (${typeof value}).`,
|
|
1864
|
+
data: {
|
|
1865
|
+
type: typeof value,
|
|
1866
|
+
value
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1760
1869
|
return value;
|
|
1761
1870
|
}
|
|
1762
1871
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
@@ -1837,16 +1946,25 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1837
1946
|
}
|
|
1838
1947
|
function gatherHydratable(element, root) {
|
|
1839
1948
|
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1949
|
+
const frames = root ? null : element.querySelectorAll("[data-fid]");
|
|
1950
|
+
const frameCount = frames ? frames.length : 0;
|
|
1951
|
+
const registry = sharedConfig.registry;
|
|
1840
1952
|
for (let i = 0; i < templates.length; i++) {
|
|
1841
1953
|
const node = templates[i];
|
|
1842
1954
|
const key = node.getAttribute("_hk");
|
|
1843
1955
|
if (root) {
|
|
1844
1956
|
if (!key.startsWith(root)) continue;
|
|
1845
|
-
} else {
|
|
1846
|
-
|
|
1847
|
-
|
|
1957
|
+
} else if (frameCount !== 0) {
|
|
1958
|
+
let inFrame = false;
|
|
1959
|
+
for (let j = 0; j < frameCount; j++) {
|
|
1960
|
+
if (frames[j].contains(node)) {
|
|
1961
|
+
inFrame = true;
|
|
1962
|
+
break;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
if (inFrame) continue;
|
|
1848
1966
|
}
|
|
1849
|
-
if (!
|
|
1967
|
+
if (!registry.has(key)) registry.set(key, node);
|
|
1850
1968
|
}
|
|
1851
1969
|
}
|
|
1852
1970
|
function getHydrationKey() {
|
|
@@ -1854,6 +1972,7 @@ function getHydrationKey() {
|
|
|
1854
1972
|
}
|
|
1855
1973
|
const RequestContext = Symbol();
|
|
1856
1974
|
|
|
1975
|
+
function configureServerErrors(_config) {}
|
|
1857
1976
|
function throwInBrowser(func) {
|
|
1858
1977
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1859
1978
|
console.error(err);
|
|
@@ -1883,14 +2002,14 @@ function composeMiddleware(middlewares) {
|
|
|
1883
2002
|
throwInBrowser(composeMiddleware);
|
|
1884
2003
|
}
|
|
1885
2004
|
function ssr(template, ...nodes) {}
|
|
1886
|
-
function ssrElement(name, props, children, needsId) {}
|
|
2005
|
+
function ssrElement(name, props, children, needsId, skip) {}
|
|
1887
2006
|
function ssrClassName(value) {}
|
|
1888
2007
|
function ssrStyle(value) {}
|
|
1889
2008
|
function ssrStyleProperty(name, value) {}
|
|
1890
2009
|
function ssrAttribute(key, value) {}
|
|
1891
2010
|
function ssrGroup(fn, n) {}
|
|
1892
2011
|
function ssrHydrationKey() {}
|
|
1893
|
-
function resolveSSRNode(node, result, top) {}
|
|
2012
|
+
function resolveSSRNode(node, result, top, nested) {}
|
|
1894
2013
|
function escape(s, attr) {}
|
|
1895
2014
|
|
|
1896
2015
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
@@ -1927,6 +2046,7 @@ function isSafeError(value) {
|
|
|
1927
2046
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1928
2047
|
}
|
|
1929
2048
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
2049
|
+
const REVALIDATE_ALL = "*";
|
|
1930
2050
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
1931
2051
|
function initWithRevalidate(init = {}) {
|
|
1932
2052
|
const resolved = typeof init === "number" ? {
|
|
@@ -1949,7 +2069,11 @@ function initWithRevalidate(init = {}) {
|
|
|
1949
2069
|
headers = new Headers(responseInit.headers);
|
|
1950
2070
|
}
|
|
1951
2071
|
if (revalidate !== undefined) {
|
|
1952
|
-
const
|
|
2072
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
2073
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
2074
|
+
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.`);
|
|
2075
|
+
}
|
|
2076
|
+
const keys = list.join(",");
|
|
1953
2077
|
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
1954
2078
|
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.`);
|
|
1955
2079
|
}
|
|
@@ -2071,7 +2195,8 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
|
2071
2195
|
function bindingOf(value) {
|
|
2072
2196
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
2073
2197
|
}
|
|
2074
|
-
function dynamic(source,
|
|
2198
|
+
function dynamic(source, options) {
|
|
2199
|
+
if (options?.static) return staticDynamic(untrack(source));
|
|
2075
2200
|
let latest = 0;
|
|
2076
2201
|
const sites = new Set();
|
|
2077
2202
|
let deliveredAddress;
|
|
@@ -2115,19 +2240,42 @@ function dynamic(source, _options) {
|
|
|
2115
2240
|
return untrack(() => component(props));
|
|
2116
2241
|
}
|
|
2117
2242
|
case "string":
|
|
2118
|
-
|
|
2119
|
-
spread(el, props);
|
|
2120
|
-
return el;
|
|
2243
|
+
return staticElement(component, props);
|
|
2121
2244
|
}
|
|
2122
2245
|
});
|
|
2123
2246
|
};
|
|
2124
2247
|
}
|
|
2248
|
+
function staticDynamic(component) {
|
|
2249
|
+
if (component && typeof component.then === "function") throw new Error("dynamic(): a static source must resolve synchronously, not to a promise");
|
|
2250
|
+
if (typeof component === "function") {
|
|
2251
|
+
Object.assign(component, {
|
|
2252
|
+
[$DEVCOMP]: true
|
|
2253
|
+
});
|
|
2254
|
+
const binding = bindingOf(component);
|
|
2255
|
+
if (binding) {
|
|
2256
|
+
const address = () => binding.address;
|
|
2257
|
+
return props => untrack(() => binding.component(props, address));
|
|
2258
|
+
}
|
|
2259
|
+
return props => untrack(() => component(props));
|
|
2260
|
+
}
|
|
2261
|
+
if (typeof component === "string") return props => staticElement(component, props);
|
|
2262
|
+
return () => undefined;
|
|
2263
|
+
}
|
|
2264
|
+
function staticElement(tag, props) {
|
|
2265
|
+
const hydrating = sharedConfig.hydrating;
|
|
2266
|
+
const el = hydrating ? getNextElement() : createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2267
|
+
spread(el, props);
|
|
2268
|
+
if (hydrating) runHydrationEvents();
|
|
2269
|
+
return el;
|
|
2270
|
+
}
|
|
2125
2271
|
function Dynamic(props) {
|
|
2126
2272
|
const Comp = dynamic(() => props.component);
|
|
2127
2273
|
return createComponent(Comp, omit(props, "component"));
|
|
2128
2274
|
}
|
|
2129
|
-
function createElement(tagName, is = undefined) {
|
|
2130
|
-
return
|
|
2275
|
+
function createElement(tagName, is = undefined, xmlns = undefined) {
|
|
2276
|
+
return xmlns ? document.createElementNS(xmlns, tagName, {
|
|
2277
|
+
is
|
|
2278
|
+
}) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
2131
2279
|
is
|
|
2132
2280
|
});
|
|
2133
2281
|
}
|
|
@@ -2159,4 +2307,4 @@ _moduleUrl) {
|
|
|
2159
2307
|
function httpStatus(_code, _text) {}
|
|
2160
2308
|
function httpHeader(_name, _value, _options) {}
|
|
2161
2309
|
|
|
2162
|
-
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 };
|
|
2310
|
+
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 };
|