@solidjs/web 2.0.0-rc.7 → 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 +638 -124
- package/dist/server.js +445 -94
- package/dist/{server.dev.cjs → server.observe.js} +602 -416
- package/dist/web.dev.js +229 -49
- package/dist/web.js +194 -46
- package/dist/{web.cjs → web.observe.js} +290 -275
- package/frames/dist/client.dev.js +103 -4
- package/frames/dist/client.js +5 -2
- package/frames/dist/{client.dev.cjs → client.observe.js} +139 -79
- package/frames/dist/server.dev.js +540 -79
- package/frames/dist/server.js +371 -52
- package/frames/dist/{server.cjs → server.observe.js} +544 -140
- package/frames/package.json +15 -21
- package/package.json +145 -294
- package/serialization/decode/package.json +3 -9
- package/serialization/package.json +3 -9
- package/serialization/types/serializer-decode.d.ts +49 -2
- package/server-functions/dist/{client.cjs → client.dev.js} +140 -107
- package/server-functions/dist/client.js +74 -69
- package/server-functions/dist/client.observe.js +1102 -0
- package/server-functions/dist/server.dev.js +430 -41
- package/server-functions/dist/server.js +367 -40
- package/server-functions/dist/{server.cjs → server.observe.js} +430 -85
- package/server-functions/package.json +15 -21
- package/server-functions/rich-args/package.json +3 -9
- package/storage/package.json +3 -9
- package/types/client.d.ts +39 -1
- package/types/diagnostics.d.ts +24 -0
- package/types/frames/frame-transport.d.ts +1 -1
- package/types/frames/serializer-decode.d.ts +49 -2
- 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/serializer-decode.d.ts +49 -2
- package/types/server-functions/client.d.ts +32 -22
- package/types/server-functions/server.d.ts +55 -41
- 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 +105 -6
- package/types/trace.d.ts +79 -0
- package/dist/server.cjs +0 -3708
- package/dist/web.dev.cjs +0 -2285
- package/frames/dist/client.cjs +0 -2043
- package/frames/dist/server.dev.cjs +0 -4584
- package/serialization/dist/decode.cjs +0 -155
- package/serialization/dist/serialization.cjs +0 -275
- package/serialization/types-cjs/index.d.cts +0 -101
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -172
- package/serialization/types-cjs/serializer.d.cts +0 -101
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.dev.cjs +0 -2409
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types-cjs/client.d.cts +0 -197
- package/types-cjs/constants.d.cts +0 -20
- package/types-cjs/cookies.d.cts +0 -41
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -370
- package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
- package/types-cjs/frames/frame-sink.d.cts +0 -92
- package/types-cjs/frames/frame-transport.d.cts +0 -189
- package/types-cjs/frames/serializer-decode.d.cts +0 -172
- package/types-cjs/frames/serializer.d.cts +0 -101
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/head.d.cts +0 -19
- package/types-cjs/index.d.cts +0 -191
- package/types-cjs/index.server.d.cts +0 -147
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4146
- package/types-cjs/package.json +0 -3
- package/types-cjs/reconcile.d.cts +0 -1
- package/types-cjs/render.d.cts +0 -6
- package/types-cjs/response.d.cts +0 -81
- package/types-cjs/serializer-decode.d.cts +0 -172
- package/types-cjs/serializer.d.cts +0 -101
- package/types-cjs/server-functions/client.d.cts +0 -184
- package/types-cjs/server-functions/flash.d.cts +0 -36
- package/types-cjs/server-functions/registry.d.cts +0 -100
- package/types-cjs/server-functions/rich-args.d.cts +0 -1
- package/types-cjs/server-functions/server.d.cts +0 -546
- package/types-cjs/server-functions/shared.d.cts +0 -283
- package/types-cjs/server-mock.d.cts +0 -337
- package/types-cjs/server.d.cts +0 -408
package/dist/web.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, createRoot, flatten, flush, createComponent, omit, createOwner, createSignal, onCleanup,
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, 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), () => {});
|
|
@@ -563,7 +567,7 @@ function className(node, value, prev) {
|
|
|
563
567
|
}
|
|
564
568
|
function addEvent(node, name, handler, delegate) {
|
|
565
569
|
if (delegate) {
|
|
566
|
-
const key =
|
|
570
|
+
const key = EVENT_KEY + name;
|
|
567
571
|
let data;
|
|
568
572
|
if (Array.isArray(handler)) {
|
|
569
573
|
data = handler[1];
|
|
@@ -622,34 +626,122 @@ function style(node, value, prev) {
|
|
|
622
626
|
}
|
|
623
627
|
}
|
|
624
628
|
}
|
|
629
|
+
function readShallow(value) {
|
|
630
|
+
if (value === null || typeof value !== "object") return value;
|
|
631
|
+
if (Array.isArray(value)) return value.map(readShallow);
|
|
632
|
+
if (value[$PROXY] !== value) return value;
|
|
633
|
+
const keys = sourceKeys(value, SOURCE_PROXY);
|
|
634
|
+
const out = {};
|
|
635
|
+
for (let i = 0; i < keys.length; i++) {
|
|
636
|
+
const k = keys[i];
|
|
637
|
+
if (typeof k === "string") out[k] = value[k];
|
|
638
|
+
}
|
|
639
|
+
return out;
|
|
640
|
+
}
|
|
625
641
|
function setStyleProperty(node, name, value) {
|
|
626
642
|
if (isHydrating(node)) return;
|
|
627
643
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
628
644
|
}
|
|
629
|
-
function spread(node, props, skipChildren) {
|
|
645
|
+
function spread(node, props, skipChildren, skip) {
|
|
630
646
|
const prevProps = {};
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
647
|
+
const apply = newProps => {
|
|
648
|
+
const r = newProps.ref;
|
|
649
|
+
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
650
|
+
assign(node, newProps, true, prevProps, true);
|
|
651
|
+
};
|
|
652
|
+
if (Array.isArray(props)) {
|
|
653
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
654
|
+
for (let i = props.length - 1; i >= 0; i--) {
|
|
655
|
+
const s = resolveSource(props[i]);
|
|
656
|
+
if (s != null && entryHas(s, "children")) return entryGet(s, "children");
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
660
|
+
return prevProps;
|
|
661
|
+
}
|
|
662
|
+
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
663
|
+
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
664
|
+
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
665
|
+
if (desc !== undefined) {
|
|
666
|
+
if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
|
|
667
|
+
}
|
|
668
|
+
} else insert(node, () => {
|
|
669
|
+
const source = resolveSource(props);
|
|
670
|
+
return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
671
|
+
});
|
|
672
|
+
}
|
|
641
673
|
effect(() => {
|
|
642
|
-
const source =
|
|
674
|
+
const source = resolveSource(props);
|
|
643
675
|
const newProps = {};
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
676
|
+
const table = resolvedTable(source);
|
|
677
|
+
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
678
|
+
if (source != null) {
|
|
679
|
+
const view = viewOf(source);
|
|
680
|
+
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);
|
|
648
681
|
}
|
|
649
682
|
return newProps;
|
|
650
|
-
},
|
|
683
|
+
}, apply);
|
|
651
684
|
return prevProps;
|
|
652
685
|
}
|
|
686
|
+
function collectTable(out, table, skip) {
|
|
687
|
+
for (const [prop, leaf] of table) {
|
|
688
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
689
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
690
|
+
const v = leaf[prop];
|
|
691
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
692
|
+
}
|
|
693
|
+
return out;
|
|
694
|
+
}
|
|
695
|
+
function resolveSource(s) {
|
|
696
|
+
return typeof s === "function" ? s() : s;
|
|
697
|
+
}
|
|
698
|
+
function entryHas(s, key) {
|
|
699
|
+
const view = viewOf(s);
|
|
700
|
+
return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
|
|
701
|
+
}
|
|
702
|
+
function entryGet(s, key) {
|
|
703
|
+
const view = viewOf(s);
|
|
704
|
+
return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
|
|
705
|
+
}
|
|
706
|
+
function collectSources(out, sources, kinds, skip) {
|
|
707
|
+
const resolved = [];
|
|
708
|
+
const resolvedKinds = [];
|
|
709
|
+
for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
|
|
710
|
+
for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
|
|
711
|
+
return out;
|
|
712
|
+
}
|
|
713
|
+
function pushEntry(resolved, kinds, s, kind) {
|
|
714
|
+
if (kind !== SOURCE_MEMO) {
|
|
715
|
+
resolved.push(s);
|
|
716
|
+
kinds.push(kind);
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
s = resolveSource(s);
|
|
720
|
+
if (s == null) return;
|
|
721
|
+
const view = viewOf(s);
|
|
722
|
+
if (view instanceof OmitView) {
|
|
723
|
+
resolved.push(view);
|
|
724
|
+
kinds.push(SOURCE_OMIT);
|
|
725
|
+
} else if (view !== undefined) {
|
|
726
|
+
const f = view.sources,
|
|
727
|
+
k = view.kinds;
|
|
728
|
+
for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
|
|
729
|
+
} else {
|
|
730
|
+
resolved.push(s);
|
|
731
|
+
kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
function collectProps(out, s, kind, skip, later, laterKinds, from) {
|
|
735
|
+
const keys = sourceKeys(s, kind);
|
|
736
|
+
outer: for (let i = 0; i < keys.length; i++) {
|
|
737
|
+
const prop = keys[i];
|
|
738
|
+
if (typeof prop !== "string" || prop === "children") continue;
|
|
739
|
+
if (skip !== undefined && skip(prop)) continue;
|
|
740
|
+
if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
|
|
741
|
+
const v = sourceGet(s, kind, prop);
|
|
742
|
+
out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
653
745
|
function dynamicProperty(props, key) {
|
|
654
746
|
const src = props[key];
|
|
655
747
|
Object.defineProperty(props, key, {
|
|
@@ -679,8 +771,7 @@ function installHydrationRuntime() {
|
|
|
679
771
|
hydrationRt = {
|
|
680
772
|
claimInitial(parent, multi, initial) {
|
|
681
773
|
if (isHydrating(parent)) {
|
|
682
|
-
if (!multi && initial === undefined && parent) initial =
|
|
683
|
-
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
774
|
+
if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
684
775
|
}
|
|
685
776
|
return initial;
|
|
686
777
|
},
|
|
@@ -704,7 +795,7 @@ function installHydrationRuntime() {
|
|
|
704
795
|
nodes.unshift(node);
|
|
705
796
|
node = node.previousSibling;
|
|
706
797
|
}
|
|
707
|
-
} else
|
|
798
|
+
} else return claimChildNodes(parent);
|
|
708
799
|
return stripTextSeparators(nodes);
|
|
709
800
|
},
|
|
710
801
|
dedupEvent(e) {
|
|
@@ -717,19 +808,36 @@ function stripTextSeparators(nodes) {
|
|
|
717
808
|
for (let i = 0; i < nodes.length; i++) {
|
|
718
809
|
const node = nodes[i],
|
|
719
810
|
t = node.nodeType;
|
|
720
|
-
if (t === 8) {
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
}
|
|
726
|
-
if (v.startsWith("pl-")) continue;
|
|
727
|
-
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
811
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
812
|
+
node.remove();
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
728
816
|
nodes[j++] = node;
|
|
729
817
|
}
|
|
730
818
|
nodes.length = j;
|
|
731
819
|
return nodes;
|
|
732
820
|
}
|
|
821
|
+
function claimChildNodes(parent) {
|
|
822
|
+
const live = parent.childNodes;
|
|
823
|
+
const out = [];
|
|
824
|
+
for (let i = 0, n = live.length; i < n; i++) {
|
|
825
|
+
const node = live[i],
|
|
826
|
+
t = node.nodeType;
|
|
827
|
+
if (t === 8 && node.nodeValue === "!$") {
|
|
828
|
+
node.remove();
|
|
829
|
+
i--;
|
|
830
|
+
n--;
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (isPlaceholderScaffolding(node, t)) continue;
|
|
834
|
+
out.push(node);
|
|
835
|
+
}
|
|
836
|
+
return out;
|
|
837
|
+
}
|
|
838
|
+
function isPlaceholderScaffolding(node, t) {
|
|
839
|
+
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
840
|
+
}
|
|
733
841
|
function insert(parent, accessor, marker, initial, options) {
|
|
734
842
|
const multi = marker !== undefined;
|
|
735
843
|
const host = options && options.host;
|
|
@@ -1278,9 +1386,13 @@ function hydrate(code, element, options = {}) {
|
|
|
1278
1386
|
sharedConfig.hydrating = false;
|
|
1279
1387
|
}
|
|
1280
1388
|
}, err => {
|
|
1281
|
-
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1282
1389
|
sharedConfig.hydrating = false;
|
|
1283
1390
|
sharedConfig.registry = undefined;
|
|
1391
|
+
if (element.nodeType === 9) {
|
|
1392
|
+
(globalThis.reportError || console.error)(err);
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1284
1396
|
disposer = render(code, element, [...element.childNodes], options);
|
|
1285
1397
|
});
|
|
1286
1398
|
return () => disposer && disposer();
|
|
@@ -1388,6 +1500,7 @@ function runHydrationEvents() {
|
|
|
1388
1500
|
}
|
|
1389
1501
|
function isHydrating(node) {
|
|
1390
1502
|
if (!sharedConfig.hydrating) return false;
|
|
1503
|
+
if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
|
|
1391
1504
|
if (!node || node.isConnected) return true;
|
|
1392
1505
|
const roots = sharedConfig.claimRoots;
|
|
1393
1506
|
if (roots) {
|
|
@@ -1467,7 +1580,7 @@ function eventHandler(e, container, state) {
|
|
|
1467
1580
|
if (owner && owner === resumeNode) return;
|
|
1468
1581
|
e[$$EVENT_OWNER] = owner || true;
|
|
1469
1582
|
let node = resumeNode || e.target;
|
|
1470
|
-
const key =
|
|
1583
|
+
const key = EVENT_KEY + e.type;
|
|
1471
1584
|
const oriTarget = e.target;
|
|
1472
1585
|
const boundary = owner || container || e.currentTarget;
|
|
1473
1586
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
@@ -1668,16 +1781,25 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1668
1781
|
}
|
|
1669
1782
|
function gatherHydratable(element, root) {
|
|
1670
1783
|
const templates = element.querySelectorAll(`*[_hk]`);
|
|
1784
|
+
const frames = root ? null : element.querySelectorAll("[data-fid]");
|
|
1785
|
+
const frameCount = frames ? frames.length : 0;
|
|
1786
|
+
const registry = sharedConfig.registry;
|
|
1671
1787
|
for (let i = 0; i < templates.length; i++) {
|
|
1672
1788
|
const node = templates[i];
|
|
1673
1789
|
const key = node.getAttribute("_hk");
|
|
1674
1790
|
if (root) {
|
|
1675
1791
|
if (!key.startsWith(root)) continue;
|
|
1676
|
-
} else {
|
|
1677
|
-
|
|
1678
|
-
|
|
1792
|
+
} else if (frameCount !== 0) {
|
|
1793
|
+
let inFrame = false;
|
|
1794
|
+
for (let j = 0; j < frameCount; j++) {
|
|
1795
|
+
if (frames[j].contains(node)) {
|
|
1796
|
+
inFrame = true;
|
|
1797
|
+
break;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
if (inFrame) continue;
|
|
1679
1801
|
}
|
|
1680
|
-
if (!
|
|
1802
|
+
if (!registry.has(key)) registry.set(key, node);
|
|
1681
1803
|
}
|
|
1682
1804
|
}
|
|
1683
1805
|
function getHydrationKey() {
|
|
@@ -1685,6 +1807,7 @@ function getHydrationKey() {
|
|
|
1685
1807
|
}
|
|
1686
1808
|
const RequestContext = Symbol();
|
|
1687
1809
|
|
|
1810
|
+
function configureServerErrors(_config) {}
|
|
1688
1811
|
function throwInBrowser(func) {
|
|
1689
1812
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
1690
1813
|
console.error(err);
|
|
@@ -1714,14 +1837,14 @@ function composeMiddleware(middlewares) {
|
|
|
1714
1837
|
throwInBrowser(composeMiddleware);
|
|
1715
1838
|
}
|
|
1716
1839
|
function ssr(template, ...nodes) {}
|
|
1717
|
-
function ssrElement(name, props, children, needsId) {}
|
|
1840
|
+
function ssrElement(name, props, children, needsId, skip) {}
|
|
1718
1841
|
function ssrClassName(value) {}
|
|
1719
1842
|
function ssrStyle(value) {}
|
|
1720
1843
|
function ssrStyleProperty(name, value) {}
|
|
1721
1844
|
function ssrAttribute(key, value) {}
|
|
1722
1845
|
function ssrGroup(fn, n) {}
|
|
1723
1846
|
function ssrHydrationKey() {}
|
|
1724
|
-
function resolveSSRNode(node, result, top) {}
|
|
1847
|
+
function resolveSSRNode(node, result, top, nested) {}
|
|
1725
1848
|
function escape(s, attr) {}
|
|
1726
1849
|
|
|
1727
1850
|
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
@@ -1758,6 +1881,7 @@ function isSafeError(value) {
|
|
|
1758
1881
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1759
1882
|
}
|
|
1760
1883
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1884
|
+
const REVALIDATE_ALL = "*";
|
|
1761
1885
|
const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
1762
1886
|
function initWithRevalidate(init = {}) {
|
|
1763
1887
|
const resolved = typeof init === "number" ? {
|
|
@@ -1780,7 +1904,11 @@ function initWithRevalidate(init = {}) {
|
|
|
1780
1904
|
headers = new Headers(responseInit.headers);
|
|
1781
1905
|
}
|
|
1782
1906
|
if (revalidate !== undefined) {
|
|
1783
|
-
const
|
|
1907
|
+
const list = Array.isArray(revalidate) ? revalidate : [revalidate];
|
|
1908
|
+
if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
|
|
1909
|
+
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.`);
|
|
1910
|
+
}
|
|
1911
|
+
const keys = list.join(",");
|
|
1784
1912
|
if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
|
|
1785
1913
|
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.`);
|
|
1786
1914
|
}
|
|
@@ -1902,7 +2030,8 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
|
1902
2030
|
function bindingOf(value) {
|
|
1903
2031
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1904
2032
|
}
|
|
1905
|
-
function dynamic(source,
|
|
2033
|
+
function dynamic(source, options) {
|
|
2034
|
+
if (options?.static) return staticDynamic(untrack(source));
|
|
1906
2035
|
let latest = 0;
|
|
1907
2036
|
const sites = new Set();
|
|
1908
2037
|
let deliveredAddress;
|
|
@@ -1943,19 +2072,38 @@ function dynamic(source, _options) {
|
|
|
1943
2072
|
return untrack(() => component(props));
|
|
1944
2073
|
}
|
|
1945
2074
|
case "string":
|
|
1946
|
-
|
|
1947
|
-
spread(el, props);
|
|
1948
|
-
return el;
|
|
2075
|
+
return staticElement(component, props);
|
|
1949
2076
|
}
|
|
1950
2077
|
});
|
|
1951
2078
|
};
|
|
1952
2079
|
}
|
|
2080
|
+
function staticDynamic(component) {
|
|
2081
|
+
if (typeof component === "function") {
|
|
2082
|
+
const binding = bindingOf(component);
|
|
2083
|
+
if (binding) {
|
|
2084
|
+
const address = () => binding.address;
|
|
2085
|
+
return props => untrack(() => binding.component(props, address));
|
|
2086
|
+
}
|
|
2087
|
+
return props => untrack(() => component(props));
|
|
2088
|
+
}
|
|
2089
|
+
if (typeof component === "string") return props => staticElement(component, props);
|
|
2090
|
+
return () => undefined;
|
|
2091
|
+
}
|
|
2092
|
+
function staticElement(tag, props) {
|
|
2093
|
+
const hydrating = sharedConfig.hydrating;
|
|
2094
|
+
const el = hydrating ? getNextElement() : createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2095
|
+
spread(el, props);
|
|
2096
|
+
if (hydrating) runHydrationEvents();
|
|
2097
|
+
return el;
|
|
2098
|
+
}
|
|
1953
2099
|
function Dynamic(props) {
|
|
1954
2100
|
const Comp = dynamic(() => props.component);
|
|
1955
2101
|
return createComponent(Comp, omit(props, "component"));
|
|
1956
2102
|
}
|
|
1957
|
-
function createElement(tagName, is = undefined) {
|
|
1958
|
-
return
|
|
2103
|
+
function createElement(tagName, is = undefined, xmlns = undefined) {
|
|
2104
|
+
return xmlns ? document.createElementNS(xmlns, tagName, {
|
|
2105
|
+
is
|
|
2106
|
+
}) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1959
2107
|
is
|
|
1960
2108
|
});
|
|
1961
2109
|
}
|
|
@@ -1987,4 +2135,4 @@ _moduleUrl) {
|
|
|
1987
2135
|
function httpStatus(_code, _text) {}
|
|
1988
2136
|
function httpHeader(_name, _value, _options) {}
|
|
1989
2137
|
|
|
1990
|
-
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, 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 };
|
|
2138
|
+
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 };
|