@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.
Files changed (88) hide show
  1. package/dist/server.dev.js +638 -124
  2. package/dist/server.js +445 -94
  3. package/dist/{server.dev.cjs → server.observe.js} +602 -416
  4. package/dist/web.dev.js +229 -49
  5. package/dist/web.js +194 -46
  6. package/dist/{web.cjs → web.observe.js} +290 -275
  7. package/frames/dist/client.dev.js +103 -4
  8. package/frames/dist/client.js +5 -2
  9. package/frames/dist/{client.dev.cjs → client.observe.js} +139 -79
  10. package/frames/dist/server.dev.js +540 -79
  11. package/frames/dist/server.js +371 -52
  12. package/frames/dist/{server.cjs → server.observe.js} +544 -140
  13. package/frames/package.json +15 -21
  14. package/package.json +145 -294
  15. package/serialization/decode/package.json +3 -9
  16. package/serialization/package.json +3 -9
  17. package/serialization/types/serializer-decode.d.ts +49 -2
  18. package/server-functions/dist/{client.cjs → client.dev.js} +140 -107
  19. package/server-functions/dist/client.js +74 -69
  20. package/server-functions/dist/client.observe.js +1102 -0
  21. package/server-functions/dist/server.dev.js +430 -41
  22. package/server-functions/dist/server.js +367 -40
  23. package/server-functions/dist/{server.cjs → server.observe.js} +430 -85
  24. package/server-functions/package.json +15 -21
  25. package/server-functions/rich-args/package.json +3 -9
  26. package/storage/package.json +3 -9
  27. package/types/client.d.ts +39 -1
  28. package/types/diagnostics.d.ts +24 -0
  29. package/types/frames/frame-transport.d.ts +1 -1
  30. package/types/frames/serializer-decode.d.ts +49 -2
  31. package/types/index.d.ts +25 -15
  32. package/types/index.server.d.ts +35 -8
  33. package/types/jsx.d.ts +15 -4
  34. package/types/observe.d.ts +294 -0
  35. package/types/response.d.ts +18 -0
  36. package/types/serializer-decode.d.ts +49 -2
  37. package/types/server-functions/client.d.ts +32 -22
  38. package/types/server-functions/server.d.ts +55 -41
  39. package/types/server-functions/shared.d.ts +39 -9
  40. package/types/server-mock.d.ts +26 -4
  41. package/types/server-observe.d.ts +39 -0
  42. package/types/server.d.ts +105 -6
  43. package/types/trace.d.ts +79 -0
  44. package/dist/server.cjs +0 -3708
  45. package/dist/web.dev.cjs +0 -2285
  46. package/frames/dist/client.cjs +0 -2043
  47. package/frames/dist/server.dev.cjs +0 -4584
  48. package/serialization/dist/decode.cjs +0 -155
  49. package/serialization/dist/serialization.cjs +0 -275
  50. package/serialization/types-cjs/index.d.cts +0 -101
  51. package/serialization/types-cjs/package.json +0 -3
  52. package/serialization/types-cjs/serializer-decode.d.cts +0 -172
  53. package/serialization/types-cjs/serializer.d.cts +0 -101
  54. package/server-functions/dist/rich-args.cjs +0 -11
  55. package/server-functions/dist/server.dev.cjs +0 -2409
  56. package/storage/dist/storage.cjs +0 -12
  57. package/storage/types-cjs/index.d.cts +0 -28
  58. package/storage/types-cjs/package.json +0 -3
  59. package/types-cjs/client.d.cts +0 -197
  60. package/types-cjs/constants.d.cts +0 -20
  61. package/types-cjs/cookies.d.cts +0 -41
  62. package/types-cjs/frames/client.d.cts +0 -36
  63. package/types-cjs/frames/frame-client.d.cts +0 -370
  64. package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
  65. package/types-cjs/frames/frame-sink.d.cts +0 -92
  66. package/types-cjs/frames/frame-transport.d.cts +0 -189
  67. package/types-cjs/frames/serializer-decode.d.cts +0 -172
  68. package/types-cjs/frames/serializer.d.cts +0 -101
  69. package/types-cjs/frames/server.d.cts +0 -52
  70. package/types-cjs/head.d.cts +0 -19
  71. package/types-cjs/index.d.cts +0 -191
  72. package/types-cjs/index.server.d.cts +0 -147
  73. package/types-cjs/jsx-properties.d.cts +0 -93
  74. package/types-cjs/jsx.d.cts +0 -4146
  75. package/types-cjs/package.json +0 -3
  76. package/types-cjs/reconcile.d.cts +0 -1
  77. package/types-cjs/render.d.cts +0 -6
  78. package/types-cjs/response.d.cts +0 -81
  79. package/types-cjs/serializer-decode.d.cts +0 -172
  80. package/types-cjs/serializer.d.cts +0 -101
  81. package/types-cjs/server-functions/client.d.cts +0 -184
  82. package/types-cjs/server-functions/flash.d.cts +0 -36
  83. package/types-cjs/server-functions/registry.d.cts +0 -100
  84. package/types-cjs/server-functions/rich-args.d.cts +0 -1
  85. package/types-cjs/server-functions/server.d.cts +0 -546
  86. package/types-cjs/server-functions/shared.d.cts +0 -283
  87. package/types-cjs/server-mock.d.cts +0 -337
  88. package/types-cjs/server.d.cts +0 -408
package/dist/web.dev.js CHANGED
@@ -1,5 +1,6 @@
1
- import { createRenderEffect, getOwner, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, flatten, flush, DEV, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, createEffect } from 'solid-js';
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) console.warn("Multiple <title> tags in one head group; the last one wins.");
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), () => {});
@@ -509,7 +531,7 @@ function describeEventTarget(target) {
509
531
  return out;
510
532
  }
511
533
  function dispatchAsInteraction(e, fn) {
512
- return DEV.attribution.withInteraction({
534
+ return OBSERVE.attribution.withInteraction({
513
535
  type: e.type,
514
536
  target: describeEventTarget(e.target)
515
537
  }, fn);
@@ -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 = `$$${name}`;
658
+ const key = EVENT_KEY + name;
637
659
  let data;
638
660
  if (Array.isArray(handler)) {
639
661
  data = handler[1];
@@ -698,35 +720,123 @@ function style(node, value, prev) {
698
720
  }
699
721
  }
700
722
  }
723
+ function readShallow(value) {
724
+ if (value === null || typeof value !== "object") return value;
725
+ if (Array.isArray(value)) return value.map(readShallow);
726
+ if (value[$PROXY] !== value) return value;
727
+ const keys = sourceKeys(value, SOURCE_PROXY);
728
+ const out = {};
729
+ for (let i = 0; i < keys.length; i++) {
730
+ const k = keys[i];
731
+ if (typeof k === "string") out[k] = value[k];
732
+ }
733
+ return out;
734
+ }
701
735
  function setStyleProperty(node, name, value) {
702
736
  tagElement(node);
703
737
  if (isHydrating(node)) return;
704
738
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
705
739
  }
706
- function spread(node, props, skipChildren) {
740
+ function spread(node, props, skipChildren, skip) {
707
741
  const prevProps = {};
708
- const get = () => (typeof props === "function" ? props() : props) ?? {};
709
- if (!skipChildren) insert(node, () => {
710
- const source = get();
711
- return hasOwn.call(source, "children") ? source.children : undefined;
712
- });
713
- effect(() => {
714
- const source = get();
715
- const r = hasOwn.call(source, "ref") && source.ref;
716
- (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
717
- }, () => {});
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
+ }
718
768
  effect(() => {
719
- const source = get();
769
+ const source = resolveSource(props);
720
770
  const newProps = {};
721
- for (const prop in source) {
722
- if (!hasOwn.call(source, prop)) continue;
723
- if (prop === "children" || prop === "ref") continue;
724
- newProps[prop] = source[prop];
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);
725
776
  }
726
777
  return newProps;
727
- }, props => assign(node, props, true, prevProps, true));
778
+ }, apply);
728
779
  return prevProps;
729
780
  }
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++) {
832
+ const prop = keys[i];
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);
837
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
838
+ }
839
+ }
730
840
  function dynamicProperty(props, key) {
731
841
  const src = props[key];
732
842
  Object.defineProperty(props, key, {
@@ -756,8 +866,7 @@ function installHydrationRuntime() {
756
866
  hydrationRt = {
757
867
  claimInitial(parent, multi, initial) {
758
868
  if (isHydrating(parent)) {
759
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
760
- if (Array.isArray(initial)) stripTextSeparators(initial);
869
+ if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
761
870
  }
762
871
  return initial;
763
872
  },
@@ -781,7 +890,7 @@ function installHydrationRuntime() {
781
890
  nodes.unshift(node);
782
891
  node = node.previousSibling;
783
892
  }
784
- } else nodes = [...parent.childNodes];
893
+ } else return claimChildNodes(parent);
785
894
  return stripTextSeparators(nodes);
786
895
  },
787
896
  dedupEvent(e) {
@@ -794,19 +903,36 @@ function stripTextSeparators(nodes) {
794
903
  for (let i = 0; i < nodes.length; i++) {
795
904
  const node = nodes[i],
796
905
  t = node.nodeType;
797
- if (t === 8) {
798
- const v = node.nodeValue;
799
- if (v === "!$") {
800
- node.remove();
801
- continue;
802
- }
803
- if (v.startsWith("pl-")) continue;
804
- } 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;
805
911
  nodes[j++] = node;
806
912
  }
807
913
  nodes.length = j;
808
914
  return nodes;
809
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
+ }
810
936
  function insert(parent, accessor, marker, initial, options) {
811
937
  const multi = marker !== undefined;
812
938
  const host = options && options.host;
@@ -1369,9 +1495,14 @@ function hydrate(code, element, options = {}) {
1369
1495
  sharedConfig.hydrating = false;
1370
1496
  }
1371
1497
  }, err => {
1372
- console.error("Hydration module preload failed, falling back to client render:", err);
1373
1498
  sharedConfig.hydrating = false;
1374
1499
  sharedConfig.registry = undefined;
1500
+ if (element.nodeType === 9) {
1501
+ console.error("Hydration module preload failed for a document root; a document shell cannot " + "be client-rendered, so hydration was abandoned and the page is not interactive.");
1502
+ (globalThis.reportError || console.error)(err);
1503
+ return;
1504
+ }
1505
+ console.error("Hydration module preload failed, falling back to client render:", err);
1375
1506
  disposer = render(code, element, [...element.childNodes], options);
1376
1507
  });
1377
1508
  return () => disposer && disposer();
@@ -1524,6 +1655,7 @@ function runHydrationEvents() {
1524
1655
  }
1525
1656
  function isHydrating(node) {
1526
1657
  if (!sharedConfig.hydrating) return false;
1658
+ if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
1527
1659
  if (!node || node.isConnected) return true;
1528
1660
  const roots = sharedConfig.claimRoots;
1529
1661
  if (roots) {
@@ -1603,7 +1735,7 @@ function eventHandler(e, container, state) {
1603
1735
  if (owner && owner === resumeNode) return;
1604
1736
  e[$$EVENT_OWNER] = owner || true;
1605
1737
  let node = resumeNode || e.target;
1606
- const key = `$$${e.type}`;
1738
+ const key = EVENT_KEY + e.type;
1607
1739
  const oriTarget = e.target;
1608
1740
  const boundary = owner || container || e.currentTarget;
1609
1741
  const retarget = value => Object.defineProperty(e, "target", {
@@ -1724,7 +1856,16 @@ function insertExpression(parent, value, current, marker) {
1724
1856
  current && cleanChildren(parent, current);
1725
1857
  appendNodes(parent, value);
1726
1858
  }
1727
- } else console.warn(`Unrecognized value. Skipped inserting`, value);
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
+ });
1728
1869
  return value;
1729
1870
  }
1730
1871
  function normalize(value, current, multi, doNotUnwrap) {
@@ -1805,16 +1946,25 @@ function cleanChildren(parent, current, marker, replacement) {
1805
1946
  }
1806
1947
  function gatherHydratable(element, root) {
1807
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;
1808
1952
  for (let i = 0; i < templates.length; i++) {
1809
1953
  const node = templates[i];
1810
1954
  const key = node.getAttribute("_hk");
1811
1955
  if (root) {
1812
1956
  if (!key.startsWith(root)) continue;
1813
- } else {
1814
- const frame = node.closest("[data-fid]");
1815
- if (frame && frame !== element && element.contains(frame)) continue;
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;
1816
1966
  }
1817
- if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
1967
+ if (!registry.has(key)) registry.set(key, node);
1818
1968
  }
1819
1969
  }
1820
1970
  function getHydrationKey() {
@@ -1822,6 +1972,7 @@ function getHydrationKey() {
1822
1972
  }
1823
1973
  const RequestContext = Symbol();
1824
1974
 
1975
+ function configureServerErrors(_config) {}
1825
1976
  function throwInBrowser(func) {
1826
1977
  const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
1827
1978
  console.error(err);
@@ -1851,14 +2002,14 @@ function composeMiddleware(middlewares) {
1851
2002
  throwInBrowser(composeMiddleware);
1852
2003
  }
1853
2004
  function ssr(template, ...nodes) {}
1854
- function ssrElement(name, props, children, needsId) {}
2005
+ function ssrElement(name, props, children, needsId, skip) {}
1855
2006
  function ssrClassName(value) {}
1856
2007
  function ssrStyle(value) {}
1857
2008
  function ssrStyleProperty(name, value) {}
1858
2009
  function ssrAttribute(key, value) {}
1859
2010
  function ssrGroup(fn, n) {}
1860
2011
  function ssrHydrationKey() {}
1861
- function resolveSSRNode(node, result, top) {}
2012
+ function resolveSSRNode(node, result, top, nested) {}
1862
2013
  function escape(s, attr) {}
1863
2014
 
1864
2015
  const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
@@ -1895,6 +2046,7 @@ function isSafeError(value) {
1895
2046
  return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
1896
2047
  }
1897
2048
  const REVALIDATE_HEADER = "X-Revalidate";
2049
+ const REVALIDATE_ALL = "*";
1898
2050
  const RESPONSE_HEADER_VALUE_LIMIT = 4096;
1899
2051
  function initWithRevalidate(init = {}) {
1900
2052
  const resolved = typeof init === "number" ? {
@@ -1917,7 +2069,11 @@ function initWithRevalidate(init = {}) {
1917
2069
  headers = new Headers(responseInit.headers);
1918
2070
  }
1919
2071
  if (revalidate !== undefined) {
1920
- const keys = revalidate.toString();
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(",");
1921
2077
  if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
1922
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.`);
1923
2079
  }
@@ -2039,7 +2195,8 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
2039
2195
  function bindingOf(value) {
2040
2196
  return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
2041
2197
  }
2042
- function dynamic(source, _options) {
2198
+ function dynamic(source, options) {
2199
+ if (options?.static) return staticDynamic(untrack(source));
2043
2200
  let latest = 0;
2044
2201
  const sites = new Set();
2045
2202
  let deliveredAddress;
@@ -2083,19 +2240,42 @@ function dynamic(source, _options) {
2083
2240
  return untrack(() => component(props));
2084
2241
  }
2085
2242
  case "string":
2086
- const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
2087
- spread(el, props);
2088
- return el;
2243
+ return staticElement(component, props);
2089
2244
  }
2090
2245
  });
2091
2246
  };
2092
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
+ }
2093
2271
  function Dynamic(props) {
2094
2272
  const Comp = dynamic(() => props.component);
2095
2273
  return createComponent(Comp, omit(props, "component"));
2096
2274
  }
2097
- function createElement(tagName, is = undefined) {
2098
- return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
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, {
2099
2279
  is
2100
2280
  });
2101
2281
  }
@@ -2127,4 +2307,4 @@ _moduleUrl) {
2127
2307
  function httpStatus(_code, _text) {}
2128
2308
  function httpHeader(_name, _value, _options) {}
2129
2309
 
2130
- 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 };
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 };