@solidjs/web 2.0.0-rc.6 → 2.0.0-rc.8

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 (82) hide show
  1. package/dist/{server.cjs → server.dev.js} +274 -272
  2. package/dist/server.js +119 -36
  3. package/dist/{dev.js → web.dev.js} +131 -399
  4. package/dist/web.js +78 -388
  5. package/dist/{web.cjs → web.observe.js} +174 -622
  6. package/frames/dist/client.dev.js +11 -3
  7. package/frames/dist/client.js +11 -3
  8. package/frames/dist/{server.cjs → server.dev.js} +375 -125
  9. package/frames/dist/server.js +253 -32
  10. package/frames/package.json +7 -15
  11. package/package.json +88 -251
  12. package/serialization/decode/package.json +3 -9
  13. package/serialization/dist/decode.js +18 -4
  14. package/serialization/dist/serialization.js +18 -4
  15. package/serialization/package.json +3 -9
  16. package/serialization/types/serializer-decode.d.ts +49 -2
  17. package/server-functions/dist/client.js +13 -14
  18. package/server-functions/dist/server.dev.js +359 -85
  19. package/server-functions/dist/server.js +352 -86
  20. package/server-functions/package.json +6 -24
  21. package/server-functions/rich-args/package.json +3 -9
  22. package/storage/package.json +3 -9
  23. package/types/client.d.ts +17 -3
  24. package/types/frames/frame-client.d.ts +1 -1
  25. package/types/frames/serializer-decode.d.ts +49 -2
  26. package/types/head.d.ts +3 -0
  27. package/types/index.d.ts +18 -7
  28. package/types/index.server.d.ts +31 -9
  29. package/types/render.d.ts +3 -1
  30. package/types/serializer-decode.d.ts +49 -2
  31. package/types/server-functions/flash.d.ts +12 -3
  32. package/types/server-functions/server.d.ts +50 -3
  33. package/types/server-mock.d.ts +43 -7
  34. package/types/server.d.ts +48 -6
  35. package/dist/dev.cjs +0 -2590
  36. package/frames/dist/client.cjs +0 -2035
  37. package/frames/dist/client.dev.cjs +0 -2055
  38. package/serialization/dist/decode.cjs +0 -141
  39. package/serialization/dist/serialization.cjs +0 -261
  40. package/serialization/types-cjs/index.d.cts +0 -101
  41. package/serialization/types-cjs/package.json +0 -3
  42. package/serialization/types-cjs/serializer-decode.d.cts +0 -172
  43. package/serialization/types-cjs/serializer.d.cts +0 -101
  44. package/server-functions/dist/client.cjs +0 -1070
  45. package/server-functions/dist/rich-args.cjs +0 -11
  46. package/server-functions/dist/server.cjs +0 -2133
  47. package/server-functions/dist/server.dev.cjs +0 -2153
  48. package/storage/dist/storage.cjs +0 -12
  49. package/storage/types-cjs/index.d.cts +0 -28
  50. package/storage/types-cjs/package.json +0 -3
  51. package/types/patch-driver.d.ts +0 -3
  52. package/types-cjs/client.d.cts +0 -200
  53. package/types-cjs/constants.d.cts +0 -20
  54. package/types-cjs/cookies.d.cts +0 -41
  55. package/types-cjs/frames/client.d.cts +0 -36
  56. package/types-cjs/frames/frame-client.d.cts +0 -370
  57. package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
  58. package/types-cjs/frames/frame-sink.d.cts +0 -92
  59. package/types-cjs/frames/frame-transport.d.cts +0 -189
  60. package/types-cjs/frames/serializer-decode.d.cts +0 -172
  61. package/types-cjs/frames/serializer.d.cts +0 -101
  62. package/types-cjs/frames/server.d.cts +0 -52
  63. package/types-cjs/head.d.cts +0 -16
  64. package/types-cjs/index.d.cts +0 -180
  65. package/types-cjs/index.server.d.cts +0 -125
  66. package/types-cjs/jsx-properties.d.cts +0 -93
  67. package/types-cjs/jsx.d.cts +0 -4146
  68. package/types-cjs/package.json +0 -3
  69. package/types-cjs/patch-driver.d.cts +0 -3
  70. package/types-cjs/reconcile.d.cts +0 -1
  71. package/types-cjs/render.d.cts +0 -4
  72. package/types-cjs/response.d.cts +0 -81
  73. package/types-cjs/serializer-decode.d.cts +0 -172
  74. package/types-cjs/serializer.d.cts +0 -101
  75. package/types-cjs/server-functions/client.d.cts +0 -184
  76. package/types-cjs/server-functions/flash.d.cts +0 -27
  77. package/types-cjs/server-functions/registry.d.cts +0 -100
  78. package/types-cjs/server-functions/rich-args.d.cts +0 -1
  79. package/types-cjs/server-functions/server.d.cts +0 -522
  80. package/types-cjs/server-functions/shared.d.cts +0 -283
  81. package/types-cjs/server-mock.d.cts +0 -301
  82. package/types-cjs/server.d.cts +0 -366
@@ -1,8 +1,7 @@
1
- 'use strict';
2
-
3
- var solidJs = require('solid-js');
4
- var seroval = require('seroval');
5
- var web = require('seroval-plugins/web');
1
+ import { createRenderEffect, getOwner, createMemo, sharedConfig, createRoot, inServerComponentScope, ssrHandleError, creationStamp, runWithOwner, createComponent, omit, getNextChildId, NotReadyError, onCleanup, getProjectionTrace } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, ssrScope as scope, sharedConfig, untrack } from 'solid-js';
3
+ import { Feature, createStream, Serializer, getCrossReferenceHeader } from 'seroval';
4
+ import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
6
5
 
7
6
  const DOMWithState = {
8
7
  INPUT: {
@@ -67,14 +66,26 @@ const syncOptions = {
67
66
  sync: true
68
67
  };
69
68
  function effect(fn, effectFn, options) {
70
- solidJs.createRenderEffect(fn, effectFn, options ? {
69
+ const nodeOptions = options ? {
71
70
  sync: true,
72
71
  ...options,
73
72
  transparent: !options.scope
74
- } : transparentOptions);
73
+ } : transparentOptions;
74
+ {
75
+ createRenderEffect(prev => {
76
+ getOwner();
77
+ return fn(prev);
78
+ }, (value, prev) => {
79
+ try {
80
+ return effectFn(value, prev);
81
+ } finally {
82
+ }
83
+ }, nodeOptions);
84
+ return;
85
+ }
75
86
  }
76
87
  function memo(fn) {
77
- return solidJs.createMemo(() => fn(), syncOptions);
88
+ return createMemo(() => fn(), syncOptions);
78
89
  }
79
90
 
80
91
  const STATE = Symbol.for("solid.container-trace-state");
@@ -139,7 +150,7 @@ const ContainerTracePlugin = {
139
150
  };
140
151
 
141
152
  setContainerTraceStreamMint(iterable => {
142
- const stream = seroval.createStream();
153
+ const stream = createStream();
143
154
  (async () => {
144
155
  try {
145
156
  for await (const value of iterable) stream.next(value);
@@ -150,20 +161,20 @@ setContainerTraceStreamMint(iterable => {
150
161
  })();
151
162
  return stream;
152
163
  });
153
- const DEFAULT_WEB_PLUGINS = Object.freeze([web.AbortSignalPlugin,
154
- web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
155
- web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin,
164
+ const DEFAULT_WEB_PLUGINS = Object.freeze([AbortSignalPlugin,
165
+ CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
166
+ FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin,
156
167
  ContainerTracePlugin]);
157
168
  function resolveSerializerPlugins(customPlugins) {
158
169
  return customPlugins ? [...customPlugins, ...DEFAULT_WEB_PLUGINS] : [...DEFAULT_WEB_PLUGINS];
159
170
  }
160
- seroval.Feature.RegExp;
171
+ Feature.RegExp;
161
172
 
162
- const DEFAULT_DISABLED_FEATURES = seroval.Feature.AggregateError | seroval.Feature.BigIntTypedArray;
163
- const serializeOnlyDisabledFeatures = serializeErrorStacks => (serializeErrorStacks === undefined ? process.env.NODE_ENV === "development" : serializeErrorStacks) ? 0 : seroval.Feature.ErrorPrototypeStack;
173
+ const DEFAULT_DISABLED_FEATURES = Feature.AggregateError | Feature.BigIntTypedArray;
174
+ const serializeOnlyDisabledFeatures = serializeErrorStacks => (serializeErrorStacks === undefined ? process.env.NODE_ENV === "development" : serializeErrorStacks) ? 0 : Feature.ErrorPrototypeStack;
164
175
  const HYDRATION_GLOBAL = "_$HY.r";
165
176
  function createSerializer(options) {
166
- return new seroval.Serializer({
177
+ return new Serializer({
167
178
  ...options,
168
179
  plugins: resolveSerializerPlugins(options.plugins),
169
180
  disabledFeatures: (options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures) | serializeOnlyDisabledFeatures(options.serializeErrorStacks)
@@ -186,7 +197,7 @@ function createHydrationSerializer({
186
197
  });
187
198
  }
188
199
  function getLocalHeaderScript(id) {
189
- return seroval.getCrossReferenceHeader(id) + ";";
200
+ return getCrossReferenceHeader(id) + ";";
190
201
  }
191
202
 
192
203
  const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
@@ -345,6 +356,7 @@ function decodeSafe(text) {
345
356
  }
346
357
  }
347
358
  function serializeCookie(name, value, options = {}) {
359
+ assertServableCookie(name, options);
348
360
  let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
349
361
  cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
350
362
  if (options.domain) cookie += `; Domain=${options.domain}`;
@@ -359,6 +371,25 @@ function serializeCookie(name, value, options = {}) {
359
371
  }
360
372
  return cookie;
361
373
  }
374
+ function assertServableCookie(name, options) {
375
+ const reject = reason => {
376
+ throw new Error(`serializeCookie: every browser silently rejects this cookie — ${reason}. ` + `It would never come back on a request, with no error anywhere.`);
377
+ };
378
+ const lower = name.toLowerCase();
379
+ if (lower.startsWith("__host-")) {
380
+ if (!options.secure) reject(`the __Host- prefix on \`${name}\` requires \`secure: true\``);
381
+ if (options.path !== undefined && options.path !== "/") reject(`the __Host- prefix on \`${name}\` requires \`Path=/\` (got \`${options.path}\`) — ` + `host-locking is the prefix's whole contract, so it cannot be path-scoped`);
382
+ if (options.domain) reject(`the __Host- prefix on \`${name}\` forbids \`Domain\` (got \`${options.domain}\`)`);
383
+ } else if (lower.startsWith("__secure-") && !options.secure) {
384
+ reject(`the __Secure- prefix on \`${name}\` requires \`secure: true\``);
385
+ }
386
+ if (options.sameSite && options.sameSite.toLowerCase() === "none" && !options.secure) {
387
+ reject("`SameSite=None` requires `secure: true`");
388
+ }
389
+ if (options.partitioned && !options.secure) {
390
+ reject("`Partitioned` requires `secure: true`");
391
+ }
392
+ }
362
393
  const FLASH_COOKIE = "flash";
363
394
  const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
364
395
  function hasFlashCookie(cookieHeader) {
@@ -405,12 +436,24 @@ function classifyHeadTag(desc) {
405
436
  resource: false
406
437
  };
407
438
  }
439
+ function qualifierValue(name, value) {
440
+ if (value == null || value === false) return null;
441
+ if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
442
+ const v = value === true ? "" : String(value);
443
+ if (name === "as") return asciiLowerCase(v);
444
+ if (name !== "crossorigin") return v;
445
+ return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
446
+ }
447
+ function asciiLowerCase(value) {
448
+ return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
449
+ }
408
450
  function resourceIdentity(tag, props) {
409
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
451
+ const url = String(props.href || props.src || "");
452
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
410
453
  for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
411
454
  const q = RESOURCE_QUALIFIERS[i];
412
- const value = props[q];
413
- if (value != null) id += ":" + q + "=" + (value === true ? "" : value);
455
+ const value = qualifierValue(q, props[q]);
456
+ if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
414
457
  }
415
458
  return id;
416
459
  }
@@ -444,6 +487,7 @@ function resolveHead(groups) {
444
487
  }
445
488
  for (const [identity, tags] of byIdentity) {
446
489
  if (identity === "title") {
490
+ if (tags.length > 1) console.warn("Multiple <title> tags in one head group; the last one wins.");
447
491
  winners.set(identity, {
448
492
  seq: group.seq,
449
493
  tags: [tags[tags.length - 1]]
@@ -465,6 +509,32 @@ function joinAssetPath(base, file) {
465
509
  if (base[base.length - 1] !== "/") base += "/";
466
510
  return base + (file[0] === "/" ? file.slice(1) : file);
467
511
  }
512
+ function eachCandidate(srcset, visit) {
513
+ let i = 0;
514
+ const n = srcset.length;
515
+ while (i < n) {
516
+ while (i < n && /[\s,]/.test(srcset[i])) i++;
517
+ const start = i;
518
+ while (i < n && !/\s/.test(srcset[i])) i++;
519
+ if (i === start) return false;
520
+ const raw = srcset.slice(start, i);
521
+ const url = raw.replace(/,+$/, "");
522
+ let descriptors = "";
523
+ if (url === raw) {
524
+ const from = i;
525
+ while (i < n && srcset[i] !== ",") i++;
526
+ descriptors = srcset.slice(from, i);
527
+ }
528
+ if (url && visit(url, descriptors)) return true;
529
+ }
530
+ return false;
531
+ }
532
+ function hasRelativeCandidate(srcset) {
533
+ return eachCandidate(srcset, url => !/^(?:[a-zA-Z][a-zA-Z0-9+.-]*:|\/)/.test(url));
534
+ }
535
+ function hasWidthDescriptor(srcset) {
536
+ return eachCandidate(srcset, (_, descriptors) => /(?:^|\s)\d+(?:\.\d+)?w(?=\s|$)/.test(descriptors));
537
+ }
468
538
  function resolveAssets(moduleUrl, manifest) {
469
539
  if (!manifest) return null;
470
540
  const base = manifest._base;
@@ -484,12 +554,22 @@ function resolveAssets(moduleUrl, manifest) {
484
554
  if (e.preloads) {
485
555
  for (let i = 0; i < e.preloads.length; i++) {
486
556
  const link = e.preloads[i];
487
- if (!link || typeof link.href !== "string" || !link.href) continue;
557
+ const href = link && typeof link.href === "string" && link.href;
558
+ const srcset = link && typeof link.imagesrcset === "string" && link.imagesrcset;
559
+ if (!href && !srcset) continue;
488
560
  if (!preloads) preloads = [];
489
- preloads.push({
561
+ if (href) preloads.push({
490
562
  ...link,
491
- href: joinAssetPath(base, link.href)
492
- });
563
+ href: joinAssetPath(base, href)
564
+ });else {
565
+ const {
566
+ href: bad,
567
+ ...rest
568
+ } = link;
569
+ if (bad !== undefined) console.warn("Preload href must be a non-empty string; dropping it.", bad);
570
+ preloads.push(rest);
571
+ }
572
+ if (srcset && hasRelativeCandidate(srcset)) console.warn("imagesrcset candidates are not joined with the manifest base — they resolve " + "against the document URL, so a relative candidate points somewhere else " + "than the joined href; the integration should emit resolved URLs.", srcset);
493
573
  }
494
574
  }
495
575
  if (e.imports) for (let i = 0; i < e.imports.length; i++) walk(e.imports[i]);
@@ -504,7 +584,7 @@ function resolveAssets(moduleUrl, manifest) {
504
584
  }
505
585
  function registerEntryAssets(manifest) {
506
586
  if (!manifest || typeof manifest === "function" || typeof manifest.resolve === "function") return;
507
- const ctx = solidJs.sharedConfig.context;
587
+ const ctx = sharedConfig.context;
508
588
  if (!ctx?.registerAsset) return;
509
589
  for (const key in manifest) {
510
590
  if (manifest[key].isEntry) {
@@ -621,12 +701,18 @@ function isCssUrl(url) {
621
701
  const q = url.search(/[?#]/);
622
702
  return (q === -1 ? url : url.slice(0, q)).endsWith(".css");
623
703
  }
624
- const PRELOAD_LINK_ATTRIBUTES = ["type", "crossorigin", "integrity", "referrerpolicy", "fetchpriority", "media"];
704
+ const RESPONSIVE_ATTRIBUTES = ["imagesrcset", "imagesizes"];
705
+ function isSetAttr(value) {
706
+ return value != null && value !== false && value !== "";
707
+ }
708
+ const PRELOAD_LINK_ATTRIBUTES = ["type", "crossorigin", "integrity", "referrerpolicy", "fetchpriority", "media", "imagesrcset", "imagesizes"];
625
709
  function registerPreloadLink(tracking, headRegistry, link, nonce) {
626
- if (!link || typeof link !== "object" || typeof link.href !== "string" || !link.href) {
710
+ if (!link || typeof link !== "object") {
711
+ console.warn('registerAsset("preload") requires a descriptor object.', link);
627
712
  return null;
628
713
  }
629
714
  if (typeof link.as !== "string") {
715
+ console.warn('registerAsset("preload") requires an as destination.');
630
716
  return null;
631
717
  }
632
718
  const as = asciiLowerCase(link.as);
@@ -642,21 +728,50 @@ function registerPreloadLink(tracking, headRegistry, link, nonce) {
642
728
  case "track":
643
729
  break;
644
730
  default:
731
+ console.warn(`registerAsset("preload") received an unsupported as destination "${link.as}".`);
645
732
  return null;
646
733
  }
734
+ const responsive = as === "image";
735
+ if (!responsive && (isSetAttr(link.imagesrcset) || isSetAttr(link.imagesizes))) console.warn('registerAsset("preload") only supports imagesrcset and imagesizes with as="image".');
736
+ let srcset = null;
737
+ let sizes = null;
738
+ if (responsive) {
739
+ for (const name of RESPONSIVE_ATTRIBUTES) {
740
+ const value = link[name];
741
+ if (!isSetAttr(value)) continue;
742
+ if (typeof value !== "string") {
743
+ console.warn(`registerAsset("preload") expects a string ${name}.`);
744
+ continue;
745
+ }
746
+ if (name === "imagesrcset") srcset = value;else sizes = value;
747
+ }
748
+ }
749
+ const href = typeof link.href === "string" && link.href ? link.href : null;
750
+ if (!href && link.href != null && link.href !== false) console.warn("Preload href must be a non-empty string; dropping it.", link.href);
751
+ if (!href && !srcset) {
752
+ console.warn('registerAsset("preload") requires a non-empty string href or imagesrcset.');
753
+ return null;
754
+ }
755
+ if (srcset && !sizes && hasWidthDescriptor(srcset)) console.warn("imagesrcset uses a width descriptor, so imagesizes is required; without it the " + "source size defaults to 100vw and the preload may not match the image.", srcset);
647
756
  const props = {
648
- rel: "preload",
649
- href: link.href,
650
- as
757
+ rel: "preload"
651
758
  };
759
+ if (href) props.href = href;
760
+ props.as = as;
652
761
  for (let i = 0; i < PRELOAD_LINK_ATTRIBUTES.length; i++) {
653
762
  const name = PRELOAD_LINK_ATTRIBUTES[i];
763
+ if (RESPONSIVE_ATTRIBUTES.indexOf(name) !== -1) {
764
+ const value = name === "imagesrcset" ? srcset : sizes;
765
+ if (value !== null) props[name] = value;
766
+ continue;
767
+ }
654
768
  const value = link[name];
655
769
  if (value == null || value === false) continue;
656
770
  props[name] = value === true ? "" : String(value);
657
771
  }
658
772
  const identity = resourceIdentity("link", props);
659
773
  if (headRegistry.resources.has(identity)) return null;
774
+ if (props.crossorigin == null && (as === "font" || as === "fetch")) console.warn(`registerAsset("preload") with as="${as}" has no crossorigin and may not match the eventual request.`);
660
775
  const attrs = headAttrRecord(props);
661
776
  const nonceValue = destination && nonce && nonce[destination];
662
777
  if (typeof nonceValue === "string" && nonceValue) attrs.nonce = nonceValue;
@@ -695,11 +810,12 @@ function registerHeadTags(registry, context, tracking, emitResource, nonce, tags
695
810
  return;
696
811
  }
697
812
  if (!Array.isArray(tags)) tags = [tags];
698
- const probe = solidJs.sharedConfig.context && solidJs.sharedConfig.context._loadingPhase;
813
+ const probe = sharedConfig.context && sharedConfig.context._loadingPhase;
699
814
  let replaceable = null;
700
815
  for (let i = 0; i < tags.length; i++) {
701
816
  const desc = tags[i];
702
817
  if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
818
+ console.warn(`useHead: ignoring non-head tag`, desc);
703
819
  continue;
704
820
  }
705
821
  const cls = classifyHeadTag(desc);
@@ -710,7 +826,7 @@ function registerHeadTags(registry, context, tracking, emitResource, nonce, tags
710
826
  } : undefined);
711
827
  evalHeadValue(desc.key);
712
828
  } catch (err) {
713
- if (solidJs.ssrHandleError(err)) throw err;
829
+ if (ssrHandleError(err)) throw err;
714
830
  }
715
831
  }
716
832
  if (cls.resource) {
@@ -732,7 +848,7 @@ function registerHeadTags(registry, context, tracking, emitResource, nonce, tags
732
848
  function headShellReady(registry, block) {
733
849
  let ready = true;
734
850
  const pends = err => {
735
- const source = solidJs.ssrHandleError(err, true);
851
+ const source = ssrHandleError(err, true);
736
852
  if (!source) return false;
737
853
  block(source);
738
854
  ready = false;
@@ -751,6 +867,7 @@ function headShellReady(registry, block) {
751
867
  } : undefined);
752
868
  } catch (err) {
753
869
  if (pends(err)) continue;
870
+ console.warn(`useHead: error evaluating resource tag props`, err);
754
871
  parked.splice(i, 1);
755
872
  continue;
756
873
  }
@@ -781,9 +898,9 @@ function emitHeadResource(registry, context, tracking, emitResource, nonce, desc
781
898
  rel
782
899
  } : undefined);
783
900
  } catch (err) {
784
- const loadingPhase = solidJs.sharedConfig.context && solidJs.sharedConfig.context._loadingPhase;
785
- if (loadingPhase && solidJs.ssrHandleError(err)) throw err;
786
- if (!loadingPhase && !context._currentBoundaryId && !registry.shellFlushed && typeof context.block === "function" && solidJs.ssrHandleError(err, true)) {
901
+ const loadingPhase = sharedConfig.context && sharedConfig.context._loadingPhase;
902
+ if (loadingPhase && ssrHandleError(err)) throw err;
903
+ if (!loadingPhase && !context._currentBoundaryId && !registry.shellFlushed && typeof context.block === "function" && ssrHandleError(err, true)) {
787
904
  registry.parkedResources.push({
788
905
  desc,
789
906
  rel,
@@ -791,6 +908,7 @@ function emitHeadResource(registry, context, tracking, emitResource, nonce, desc
791
908
  });
792
909
  return;
793
910
  }
911
+ console.warn(`useHead: error evaluating resource tag props`, err);
794
912
  return;
795
913
  }
796
914
  const identity = resourceIdentity(desc.tag, props);
@@ -852,6 +970,7 @@ function commitHeadBoundary(registry, boundary, isPendingFragment) {
852
970
  try {
853
971
  resolved = reg.list();
854
972
  } catch (err) {
973
+ console.warn(`useHead: error evaluating head group membership`, err);
855
974
  continue;
856
975
  }
857
976
  if (!Array.isArray(resolved)) resolved = [resolved];
@@ -859,6 +978,7 @@ function commitHeadBoundary(registry, boundary, isPendingFragment) {
859
978
  for (let j = 0; j < resolved.length; j++) {
860
979
  const desc = resolved[j];
861
980
  if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
981
+ console.warn(`useHead: ignoring non-head tag`, desc);
862
982
  continue;
863
983
  }
864
984
  const cls = classifyHeadTag(desc);
@@ -884,10 +1004,12 @@ function commitHeadBoundary(registry, boundary, isPendingFragment) {
884
1004
  } : undefined);
885
1005
  key = evalHeadValue(desc.key);
886
1006
  } catch (err) {
1007
+ console.warn(`useHead: error evaluating tag props`, err);
887
1008
  continue;
888
1009
  }
889
1010
  const identity = replaceableIdentity(desc.tag, props, key, "u:" + registry.uniq++);
890
1011
  if ((identity === "base" || identity === "charset") && registry.shellFlushed) {
1012
+ console.warn(`useHead: <${desc.tag}> (${identity}) registered after shell flush is ignored`);
891
1013
  continue;
892
1014
  }
893
1015
  tags.push({
@@ -977,6 +1099,7 @@ function flushHeadFragment(registry, boundary, nonce) {
977
1099
  for (const name in t.props) {
978
1100
  if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
979
1101
  if (!HEAD_ATTR_NAME.test(name)) {
1102
+ console.warn(`useHead: ignoring invalid attribute name "${name}"`);
980
1103
  continue;
981
1104
  }
982
1105
  const v = t.props[name];
@@ -1027,9 +1150,6 @@ function scriptNonce(nonce) {
1027
1150
  function styleNonce(nonce) {
1028
1151
  return destinationNonce(nonce, "style");
1029
1152
  }
1030
- function asciiLowerCase(value) {
1031
- return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
1032
- }
1033
1153
  function hasNonceProp(props) {
1034
1154
  for (const name in props) if (name.length === 5 && asciiLowerCase(name) === "nonce" && props[name] != null) return true;
1035
1155
  return false;
@@ -1069,6 +1189,7 @@ function renderHeadAttrHtml(props) {
1069
1189
  for (const name in props) {
1070
1190
  if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
1071
1191
  if (!HEAD_ATTR_NAME.test(name)) {
1192
+ console.warn(`useHead: ignoring invalid attribute name "${name}"`);
1072
1193
  continue;
1073
1194
  }
1074
1195
  const v = props[name];
@@ -1099,8 +1220,9 @@ function renderHeadTagMarkup(tag, props, identity, nonce) {
1099
1220
  return `<${tag}${attrs}>${body}</${tag}>`;
1100
1221
  }
1101
1222
  function useHead(tags) {
1102
- const ctx = solidJs.sharedConfig.context;
1223
+ const ctx = sharedConfig.context;
1103
1224
  if (!ctx || !ctx.registerHeadTags) {
1225
+ console.warn("useHead() called outside of a server render; registration ignored.");
1104
1226
  return;
1105
1227
  }
1106
1228
  ctx.registerHeadTags(tags);
@@ -1131,16 +1253,16 @@ function renderToString(code, options = {}) {
1131
1253
  });
1132
1254
  const tracking = createAssetTracking();
1133
1255
  const headRegistry = createHeadRegistry();
1134
- solidJs.sharedConfig.context = {
1256
+ sharedConfig.context = {
1135
1257
  nonce: options.nonce,
1136
1258
  escape: escape,
1137
1259
  resolve: resolveSSRNode,
1138
1260
  ssr: ssr,
1139
1261
  registerHeadTags(tags) {
1140
- registerHeadTags(headRegistry, solidJs.sharedConfig.context, tracking, null, nonce, tags);
1262
+ registerHeadTags(headRegistry, sharedConfig.context, tracking, null, nonce, tags);
1141
1263
  },
1142
1264
  serialize(id, p) {
1143
- if (solidJs.sharedConfig.context.noHydrate) return;
1265
+ if (sharedConfig.context.noHydrate) return;
1144
1266
  if (p != null && typeof p === "object" && (typeof p.then === "function" || typeof p[Symbol.asyncIterator] === "function")) {
1145
1267
  throw new Error("Cannot serialize async value in renderToString (id: " + id + "). " + "Use renderToStream for async data.");
1146
1268
  }
@@ -1166,16 +1288,16 @@ function renderToString(code, options = {}) {
1166
1288
  tracking.emittedAssets.add(value);
1167
1289
  }
1168
1290
  };
1169
- applyAssetTracking(solidJs.sharedConfig.context, tracking, manifest, noScripts);
1291
+ applyAssetTracking(sharedConfig.context, tracking, manifest, noScripts);
1170
1292
  registerEntryAssets(manifest);
1171
- let html = solidJs.createRoot(d => {
1293
+ let html = createRoot(d => {
1172
1294
  setTimeout(d);
1173
1295
  return resolveSSRSync(escape(code()));
1174
1296
  }, {
1175
1297
  id: renderId
1176
1298
  });
1177
- serializeFragmentAssets("", tracking.boundaryModules, solidJs.sharedConfig.context, renderId);
1178
- solidJs.sharedConfig.context.noHydrate = true;
1299
+ serializeFragmentAssets("", tracking.boundaryModules, sharedConfig.context, renderId);
1300
+ sharedConfig.context.noHydrate = true;
1179
1301
  serializer.close();
1180
1302
  const head = renderShellHead(headRegistry, nonce, null, noScripts);
1181
1303
  return assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
@@ -1190,6 +1312,7 @@ function renderToStream(code, options = {}) {
1190
1312
  onHead
1191
1313
  } = options;
1192
1314
  const nonce = normalizeNonce(options.nonce);
1315
+ const requestEvent = peekRequestEvent();
1193
1316
  let dispose;
1194
1317
  let dead = false;
1195
1318
  const abandon = () => {
@@ -1291,6 +1414,7 @@ function renderToStream(code, options = {}) {
1291
1414
  };
1292
1415
  const onDone = () => {
1293
1416
  writeTasks();
1417
+ lastBlockingSize = blockingPromises.size;
1294
1418
  doShell();
1295
1419
  onCompleteAll && onCompleteAll({
1296
1420
  write(v) {
@@ -1451,7 +1575,7 @@ function renderToStream(code, options = {}) {
1451
1575
  emitTask(`${!headScriptFlushed ? HEAD_SCRIPT : ""}(_$HY.hp=_$HY.hp||{})[${JSON.stringify(key)}]=${payload}`);
1452
1576
  headScriptFlushed = true;
1453
1577
  };
1454
- solidJs.sharedConfig.context = context = {
1578
+ sharedConfig.context = context = {
1455
1579
  async: true,
1456
1580
  nonce: options.nonce,
1457
1581
  live: {},
@@ -1515,7 +1639,7 @@ function renderToStream(code, options = {}) {
1515
1639
  html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
1516
1640
  },
1517
1641
  serialize(id, p, deferStream) {
1518
- if (solidJs.sharedConfig.context.noHydrate) return;
1642
+ if (sharedConfig.context.noHydrate) return;
1519
1643
  if (p && typeof p === "object" && typeof p.then === "function") {
1520
1644
  if (!firstFlushed && deferStream) {
1521
1645
  blockingPromises.add(p);
@@ -1626,7 +1750,7 @@ function renderToStream(code, options = {}) {
1626
1750
  applyAssetTracking(context, tracking, manifest, noScripts);
1627
1751
  context.failRender = failRender;
1628
1752
  registerEntryAssets(manifest);
1629
- let html = solidJs.createRoot(d => {
1753
+ let html = createRoot(d => {
1630
1754
  dispose = d;
1631
1755
  const res = resolveSSRNode(escape(code()));
1632
1756
  if (!res.h.length) return res.t[0];
@@ -1679,10 +1803,10 @@ function renderToStream(code, options = {}) {
1679
1803
  }
1680
1804
  function doShell() {
1681
1805
  if (shellCompleted) return;
1682
- solidJs.sharedConfig.context = context;
1683
- const blockersBefore = blockingPromises.size;
1806
+ sharedConfig.context = context;
1807
+ if (blockingPromises.size !== lastBlockingSize) return;
1684
1808
  if (!resolveRootHoles()) return;
1685
- if (blockingPromises.size !== blockersBefore) return;
1809
+ if (blockingPromises.size !== lastBlockingSize) return;
1686
1810
  if (!headShellReady(headRegistry, p => blockingPromises.add(p))) return;
1687
1811
  headStyles = new Set();
1688
1812
  for (const url of tracking.emittedAssets) {
@@ -1710,7 +1834,7 @@ function renderToStream(code, options = {}) {
1710
1834
  let lastBlockingSize = -1;
1711
1835
  let lastRegistrySize = -1;
1712
1836
  let drainTurn = 0;
1713
- const scheduleFlush = fn => {
1837
+ const scheduleFlush = (fn, awaited) => {
1714
1838
  const attempt = () => {
1715
1839
  flushStubBatch();
1716
1840
  if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
@@ -1721,8 +1845,8 @@ function renderToStream(code, options = {}) {
1721
1845
  }
1722
1846
  fn();
1723
1847
  };
1724
- const progressed = blockingPromises.size !== lastBlockingSize;
1725
- lastBlockingSize = blockingPromises.size;
1848
+ const progressed = awaited !== lastBlockingSize;
1849
+ lastBlockingSize = awaited;
1726
1850
  lastRegistrySize = -1;
1727
1851
  drainTurn = 0;
1728
1852
  progressed ? queue(attempt) : setTimeout(attempt);
@@ -1739,7 +1863,7 @@ function renderToStream(code, options = {}) {
1739
1863
  let resolve;
1740
1864
  const p = new Promise(r => resolve = r);
1741
1865
  function flush() {
1742
- allSettled(blockingPromises).then(() => {
1866
+ allSettled(blockingPromises).then(awaited => {
1743
1867
  scheduleFlush(() => {
1744
1868
  if (dead) return resolve();
1745
1869
  try {
@@ -1777,7 +1901,7 @@ function renderToStream(code, options = {}) {
1777
1901
  dispose();
1778
1902
  writable.end();
1779
1903
  } else flushEnd();
1780
- });
1904
+ }, awaited);
1781
1905
  });
1782
1906
  }
1783
1907
  flush();
@@ -1785,8 +1909,12 @@ function renderToStream(code, options = {}) {
1785
1909
  };
1786
1910
  return {
1787
1911
  then(onFulfilled, onRejected) {
1912
+ const freezeHead = () => {
1913
+ if (requestEvent && requestEvent.response) commitResponseStub(requestEvent.response);
1914
+ };
1788
1915
  const p = new Promise(resolve => {
1789
1916
  function complete() {
1917
+ freezeHead();
1790
1918
  dispose();
1791
1919
  resolve(tmp);
1792
1920
  }
@@ -1798,17 +1926,16 @@ function renderToStream(code, options = {}) {
1798
1926
  };
1799
1927
  } else onCompleteAll = complete;
1800
1928
  function flush() {
1801
- allSettled(blockingPromises).then(() => {
1929
+ allSettled(blockingPromises).then(awaited => {
1802
1930
  scheduleFlush(() => {
1803
1931
  try {
1804
- const blockersBefore = blockingPromises.size;
1805
- if (!resolveRootHoles() || blockingPromises.size !== blockersBefore || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
1932
+ if (blockingPromises.size !== lastBlockingSize || !resolveRootHoles() || blockingPromises.size !== lastBlockingSize || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
1806
1933
  } catch (err) {
1807
1934
  failRender(err);
1808
1935
  return resolve(tmp);
1809
1936
  }
1810
1937
  queue(flushEnd);
1811
- });
1938
+ }, awaited);
1812
1939
  });
1813
1940
  }
1814
1941
  flush();
@@ -1818,7 +1945,7 @@ function renderToStream(code, options = {}) {
1818
1945
  pipe(w) {
1819
1946
  claimConsumer("pipe");
1820
1947
  function flush() {
1821
- allSettled(blockingPromises).then(() => {
1948
+ allSettled(blockingPromises).then(awaited => {
1822
1949
  scheduleFlush(() => {
1823
1950
  if (dead) return;
1824
1951
  try {
@@ -1840,7 +1967,7 @@ function renderToStream(code, options = {}) {
1840
1967
  dispose();
1841
1968
  writable.end();
1842
1969
  } else flushEnd();
1843
- });
1970
+ }, awaited);
1844
1971
  });
1845
1972
  }
1846
1973
  flush();
@@ -1861,7 +1988,7 @@ function renderToStream(code, options = {}) {
1861
1988
  };
1862
1989
  }
1863
1990
  function HydrationScript(props) {
1864
- const nonce = scriptNonce(solidJs.sharedConfig.context && solidJs.sharedConfig.context.nonce);
1991
+ const nonce = scriptNonce(sharedConfig.context && sharedConfig.context.nonce);
1865
1992
  return ssr(generateHydrationScript({
1866
1993
  nonce,
1867
1994
  ...props
@@ -1872,14 +1999,14 @@ function ssrGroup(fn, n) {
1872
1999
  return fn;
1873
2000
  }
1874
2001
  function buildAsyncWrap(err, node) {
1875
- const p = solidJs.ssrHandleError(err);
2002
+ const p = ssrHandleError(err);
1876
2003
  if (!p) return null;
1877
2004
  if (node.$rw) return {
1878
2005
  fn: node,
1879
2006
  p
1880
2007
  };
1881
- const owner = solidJs.getOwner();
1882
- const live = solidJs.sharedConfig.context && solidJs.sharedConfig.context.liveHoles;
2008
+ const owner = getOwner();
2009
+ const live = sharedConfig.context && sharedConfig.context.liveHoles;
1883
2010
  const suppress = node.$lhSuppress || live && (live.suppressed || live.sweeping);
1884
2011
  if (!owner) {
1885
2012
  if (suppress) node.$lhSuppress = true;
@@ -1888,7 +2015,7 @@ function buildAsyncWrap(err, node) {
1888
2015
  p
1889
2016
  };
1890
2017
  }
1891
- const fn = () => solidJs.runWithOwner(owner, node);
2018
+ const fn = () => runWithOwner(owner, node);
1892
2019
  fn.$rw = true;
1893
2020
  if (suppress) fn.$lhSuppress = true;
1894
2021
  if (node.$lhSkip) fn.$lhSkip = true;
@@ -2015,16 +2142,16 @@ function holeContentPositions(t) {
2015
2142
  }
2016
2143
  function createLiveHoles(sink, scoped) {
2017
2144
  let nextId = 0;
2018
- const stamp = typeof solidJs.creationStamp === "function" ? solidJs.creationStamp : () => 0;
2019
- const inScope = scoped && typeof solidJs.inServerComponentScope === "function" ? solidJs.inServerComponentScope : null;
2145
+ const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
2146
+ const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
2020
2147
  const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->/g, "");
2021
2148
  const swept = (owner, ctx, fn) => {
2022
- const prev = solidJs.sharedConfig.context;
2023
- solidJs.sharedConfig.context = ctx;
2149
+ const prev = sharedConfig.context;
2150
+ sharedConfig.context = ctx;
2024
2151
  try {
2025
- return owner ? solidJs.runWithOwner(owner, fn) : fn();
2152
+ return owner ? runWithOwner(owner, fn) : fn();
2026
2153
  } finally {
2027
- solidJs.sharedConfig.context = prev;
2154
+ sharedConfig.context = prev;
2028
2155
  }
2029
2156
  };
2030
2157
  function resolveHoleValue(hole) {
@@ -2091,8 +2218,8 @@ function createLiveHoles(sink, scoped) {
2091
2218
  if (inScope && !inScope()) return null;
2092
2219
  const recordsBefore = engine.recordStamp;
2093
2220
  const ownersBefore = stamp();
2094
- const owner = solidJs.getOwner();
2095
- const holeCtx = solidJs.sharedConfig.context;
2221
+ const owner = getOwner();
2222
+ const holeCtx = sharedConfig.context;
2096
2223
  const b = {
2097
2224
  key: null,
2098
2225
  children: [],
@@ -2213,8 +2340,8 @@ function createLiveHoles(sink, scoped) {
2213
2340
  return !inScope || inScope();
2214
2341
  },
2215
2342
  attr(cap) {
2216
- const owner = solidJs.getOwner();
2217
- const holeCtx = solidJs.sharedConfig.context;
2343
+ const owner = getOwner();
2344
+ const holeCtx = sharedConfig.context;
2218
2345
  const b = {
2219
2346
  key: "lha:" + cap.id,
2220
2347
  children: [],
@@ -2252,7 +2379,7 @@ function createLiveHoles(sink, scoped) {
2252
2379
  };
2253
2380
  swept(owner, holeCtx, run);
2254
2381
  } catch (err) {
2255
- if (solidJs.ssrHandleError(err, true)) return;
2382
+ if (ssrHandleError(err, true)) return;
2256
2383
  b.closed = true;
2257
2384
  sink.closeBinding(b.key);
2258
2385
  sink.error("lha:" + cap.id, String(err && err.message || err));
@@ -2295,7 +2422,7 @@ function ssr(t) {
2295
2422
  let lastGroup = null;
2296
2423
  let lastGroupVal = null;
2297
2424
  let lastGroupIdx = 0;
2298
- const live = solidJs.sharedConfig.context && solidJs.sharedConfig.context.liveHoles;
2425
+ const live = sharedConfig.context && sharedConfig.context.liveHoles;
2299
2426
  const hp = live ? holeContentPositions(t) : null;
2300
2427
  let lastOpen = null;
2301
2428
  let cap = null;
@@ -2549,12 +2676,18 @@ function ssrStyleProperty(name, value) {
2549
2676
  }
2550
2677
  function ssrElement(tag, props, children, needsId) {
2551
2678
  const hk = needsId ? ssrHydrationKey() : "";
2552
- if (props == null) props = {};else if (typeof props === "function") props = props();
2679
+ if (typeof props === "function") props = props();
2680
+ if (props == null) props = {};
2553
2681
  const skipChildren = VOID_ELEMENTS.test(tag);
2554
2682
  const keys = Object.keys(props);
2555
2683
  let result = `<${tag}${hk} `;
2556
2684
  for (let i = 0; i < keys.length; i++) {
2557
2685
  const prop = keys[i];
2686
+ if (tag === "textarea" && (prop === "value" || prop === "defaultValue")) {
2687
+ const value = props[prop];
2688
+ if (value !== null) children = escape(value);
2689
+ continue;
2690
+ }
2558
2691
  if (ChildProperties.has(prop)) {
2559
2692
  if (children === undefined && !skipChildren) children = tag === "script" || tag === "style" || prop === "innerHTML" ? props[prop] : escape(props[prop]);
2560
2693
  continue;
@@ -2565,6 +2698,9 @@ function ssrElement(tag, props, children, needsId) {
2565
2698
  } else if (prop === "class") {
2566
2699
  result += `class="${ssrClassName(value)}"`;
2567
2700
  } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
2701
+ if (typeof value === "function" && value[CLAIM_PROP] !== undefined && (prop === "ref" || prop.slice(0, 2) === "on")) {
2702
+ console.warn(`A spread on a server-rendered <${tag}> carries \`${prop}\` from client props — ` + `spreads don't participate in behavior claims, so this drops. ` + `Write the position out: \`${prop}={props.${String(value[CLAIM_PROP])}}\`.`);
2703
+ }
2568
2704
  continue;
2569
2705
  } else if (typeof value === "boolean") {
2570
2706
  if (!value) continue;
@@ -2595,8 +2731,8 @@ function encodeClaimKey(key) {
2595
2731
  return String(key).replace(CLAIM_UNSAFE, c => encodeURIComponent(c));
2596
2732
  }
2597
2733
  function ssrClaim(map) {
2598
- const mode = solidJs.sharedConfig.context && solidJs.sharedConfig.context.claims;
2599
- if (!mode || mode === CLAIMS_DOCUMENT && !(typeof solidJs.inServerComponentScope === "function" && solidJs.inServerComponentScope())) {
2734
+ const mode = sharedConfig.context && sharedConfig.context.claims;
2735
+ if (!mode || mode === CLAIMS_DOCUMENT && !(typeof inServerComponentScope === "function" && inServerComponentScope())) {
2600
2736
  return "";
2601
2737
  }
2602
2738
  let out = "";
@@ -2606,6 +2742,9 @@ function ssrClaim(map) {
2606
2742
  for (const fn of list) {
2607
2743
  const prop = typeof fn === "function" && fn[CLAIM_PROP] || undefined;
2608
2744
  if (prop === undefined) {
2745
+ {
2746
+ console.warn(`A \`${pos}\` position on a server-rendered element received a server-local ` + `${typeof fn} — this handler can never run. Pass the function through the ` + `server component's props from the client (compose on the client before ` + `passing), or bind a mutation to \`action=\`.`);
2747
+ }
2609
2748
  continue;
2610
2749
  }
2611
2750
  out += `${out ? "," : ""}${pos}=${encodeClaimKey(prop)}`;
@@ -2724,10 +2863,13 @@ function escape(s, attr) {
2724
2863
  if (!attr && Array.isArray(s)) {
2725
2864
  const joined = tryJoinPlainSSRArray(s);
2726
2865
  if (joined !== undefined) return joined;
2866
+ const src = s;
2727
2867
  s = s.slice();
2728
2868
  for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
2869
+ if (src.$slot) s.$slot = true;
2729
2870
  return s;
2730
2871
  }
2872
+ if (!attr && t === "function") return escapeLate(s);
2731
2873
  if (attr) {
2732
2874
  if (s == null || t === "boolean" || t === "number") return s;
2733
2875
  return escape(String(s), attr);
@@ -2738,6 +2880,15 @@ function escape(s, attr) {
2738
2880
  if (i < 0) return s;
2739
2881
  return escapeSlow(s, attr, i);
2740
2882
  }
2883
+ function escapeLate(fn) {
2884
+ if (fn.$esc) return fn;
2885
+ const w = () => escape(fn());
2886
+ w.$esc = true;
2887
+ if (fn.$lhSkip) w.$lhSkip = true;
2888
+ if (fn.$lhSuppress) w.$lhSuppress = true;
2889
+ if (fn.$lhBinding) w.$lhBinding = fn.$lhBinding;
2890
+ return w;
2891
+ }
2741
2892
  const ESCAPE_CONTENT = /[&<]/;
2742
2893
  const ESCAPE_ATTR = /[&"<]/;
2743
2894
  function escapeSlow(s, attr, start) {
@@ -2818,8 +2969,8 @@ function tryJoinPlainSSRArray(nodes) {
2818
2969
  return out;
2819
2970
  }
2820
2971
  function getHydrationKey() {
2821
- const hydrate = solidJs.sharedConfig.context;
2822
- return hydrate && solidJs.sharedConfig.getNextContextId();
2972
+ const hydrate = sharedConfig.context;
2973
+ return hydrate && sharedConfig.getNextContextId();
2823
2974
  }
2824
2975
  function applyRef(r, element) {
2825
2976
  Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
@@ -2838,7 +2989,7 @@ function allSettled(promises) {
2838
2989
  let size = promises.size;
2839
2990
  return Promise.allSettled(promises).then(() => {
2840
2991
  if (promises.size !== size) return allSettled(promises);
2841
- return;
2992
+ return size;
2842
2993
  });
2843
2994
  }
2844
2995
  function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
@@ -3029,6 +3180,7 @@ function tryResolveString(node) {
3029
3180
  merge: node
3030
3181
  };
3031
3182
  if (node.t === undefined) {
3183
+ console.warn(`Unrecognized value. Skipped inserting`, node);
3032
3184
  return "";
3033
3185
  }
3034
3186
  return Array.isArray(node.t) ? node.t[0] : node.t;
@@ -3053,7 +3205,7 @@ function resolveSSRNode(node, result = {
3053
3205
  if (t === "string" || t === "number") {
3054
3206
  result.t[result.t.length - 1] += node;
3055
3207
  } else if (node == null || t === "boolean") ; else if (Array.isArray(node)) {
3056
- const slotLive = node.$slot && solidJs.sharedConfig.context && solidJs.sharedConfig.context.liveHoles;
3208
+ const slotLive = node.$slot && sharedConfig.context && sharedConfig.context.liveHoles;
3057
3209
  if (slotLive) slotLive.suppressed++;
3058
3210
  try {
3059
3211
  let prevNonObj = false;
@@ -3077,9 +3229,9 @@ function resolveSSRNode(node, result = {
3077
3229
  }
3078
3230
  } else if (node.t !== undefined) {
3079
3231
  result.t[result.t.length - 1] += node.t;
3080
- } else ;
3232
+ } else console.warn(`Unrecognized value. Skipped inserting`, node);
3081
3233
  } else if (t === "function") {
3082
- const live = solidJs.sharedConfig.context && solidJs.sharedConfig.context.liveHoles;
3234
+ const live = sharedConfig.context && sharedConfig.context.liveHoles;
3083
3235
  let liveNode = null;
3084
3236
  if (live && (liveNode = live.content(node)) !== null) {
3085
3237
  if (typeof liveNode === "string") result.t[result.t.length - 1] += liveNode;else resolveSSRNode(liveNode, result);
@@ -3105,7 +3257,11 @@ function resolveSSRSync(node) {
3105
3257
  }
3106
3258
  const RequestContext = Symbol.for("solid.RequestContext");
3107
3259
  function getRequestEvent() {
3108
- return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || solidJs.sharedConfig.context && solidJs.sharedConfig.context.event || console.warn("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
3260
+ return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || sharedConfig.context && sharedConfig.context.event || console.warn("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
3261
+ }
3262
+ function peekRequestEvent() {
3263
+ const store = globalThis[RequestContext];
3264
+ return store ? store.getStore() : undefined;
3109
3265
  }
3110
3266
  function createResponseStub() {
3111
3267
  return {
@@ -3125,7 +3281,7 @@ function createRequestEvent(request, init) {
3125
3281
  }
3126
3282
  function reportLostHeaderWrite(method, name) {
3127
3283
  const message = `Response header write dropped: headers.${method}(${JSON.stringify(String(name))}) ` + "ran after the response head was sent. Write headers before the shell flushes " + "(or before the handler returns).";
3128
- console.error(message);
3284
+ throw new Error(message);
3129
3285
  }
3130
3286
  function commitResponseStub(stub, {
3131
3287
  allowLateLocation = false
@@ -3320,16 +3476,28 @@ function notSup() {
3320
3476
  throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
3321
3477
  }
3322
3478
 
3323
- setContainerTraceResolver(solidJs.getProjectionTrace);
3479
+ setContainerTraceResolver(getProjectionTrace);
3324
3480
  const isServer = true;
3325
- const isDev = false;
3326
- function dynamic(source) {
3327
- const cached = solidJs.createMemo(source, {
3481
+ const isDev = true;
3482
+ function dynamic(source, options) {
3483
+ const cached = createMemo(source, {
3328
3484
  serialize: false
3329
3485
  });
3486
+ const deferStream = !!options?.deferStream;
3330
3487
  return props => {
3331
- return solidJs.createMemo(() => {
3332
- const c = cached();
3488
+ const ctx = sharedConfig.context;
3489
+ let gated = !deferStream || !ctx?.async;
3490
+ return createMemo(() => {
3491
+ let c;
3492
+ try {
3493
+ c = cached();
3494
+ } catch (err) {
3495
+ if (!gated && err instanceof NotReadyError) {
3496
+ gated = true;
3497
+ ctx.block(Promise.resolve(err.source).then(() => {}, () => {}));
3498
+ }
3499
+ throw err;
3500
+ }
3333
3501
  if (c) {
3334
3502
  if (typeof c === "function") return c(props);
3335
3503
  if (typeof c === "string") {
@@ -3343,15 +3511,15 @@ function dynamic(source) {
3343
3511
  }
3344
3512
  function Dynamic(props) {
3345
3513
  const Comp = dynamic(() => props.component);
3346
- return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
3514
+ return createComponent(Comp, omit(props, "component"));
3347
3515
  }
3348
3516
  function Portal(props) {
3349
- const o = solidJs.getOwner();
3350
- if (o?.id != null) solidJs.getNextChildId(o);
3517
+ const o = getOwner();
3518
+ if (o?.id != null) getNextChildId(o);
3351
3519
  return undefined;
3352
3520
  }
3353
3521
  function registerClientOnlyPreload(moduleUrl) {
3354
- const ctx = solidJs.sharedConfig.context;
3522
+ const ctx = sharedConfig.context;
3355
3523
  if (!ctx?.registerAsset || !ctx.resolveAssets) return;
3356
3524
  const registerAsset = ctx.registerAsset;
3357
3525
  const resolve = ctx.resolveAssets;
@@ -3388,7 +3556,7 @@ function registerClientOnlyPreload(moduleUrl) {
3388
3556
  function clientOnly(_fn, _options = {}, moduleUrl) {
3389
3557
  return props => {
3390
3558
  if (moduleUrl) registerClientOnlyPreload(moduleUrl);
3391
- return solidJs.createMemo(() => props.fallback);
3559
+ return createMemo(() => props.fallback);
3392
3560
  };
3393
3561
  }
3394
3562
  const statusLedgers = /* @__PURE__ */new WeakMap();
@@ -3415,7 +3583,7 @@ function httpStatus(code, text) {
3415
3583
  ledger.live.push(declaration);
3416
3584
  response.status = code;
3417
3585
  response.statusText = text;
3418
- solidJs.onCleanup(() => {
3586
+ onCleanup(() => {
3419
3587
  if (response.committed) return;
3420
3588
  const index = ledger.live.indexOf(declaration);
3421
3589
  if (index < 0) return;
@@ -3450,7 +3618,7 @@ function httpHeader(name, value, options) {
3450
3618
  };
3451
3619
  ledger.live.push(declaration);
3452
3620
  if (declaration.append) headers.append(name, value);else headers.set(name, value);
3453
- solidJs.onCleanup(() => {
3621
+ onCleanup(() => {
3454
3622
  if (response.committed) return;
3455
3623
  const index = ledger.live.indexOf(declaration);
3456
3624
  if (index < 0) return;
@@ -3469,170 +3637,4 @@ function httpHeader(name, value, options) {
3469
3637
  }
3470
3638
  }
3471
3639
 
3472
- Object.defineProperty(exports, "Errored", {
3473
- enumerable: true,
3474
- get: function () { return solidJs.Errored; }
3475
- });
3476
- Object.defineProperty(exports, "For", {
3477
- enumerable: true,
3478
- get: function () { return solidJs.For; }
3479
- });
3480
- Object.defineProperty(exports, "Hydration", {
3481
- enumerable: true,
3482
- get: function () { return solidJs.Hydration; }
3483
- });
3484
- Object.defineProperty(exports, "Loading", {
3485
- enumerable: true,
3486
- get: function () { return solidJs.Loading; }
3487
- });
3488
- Object.defineProperty(exports, "Match", {
3489
- enumerable: true,
3490
- get: function () { return solidJs.Match; }
3491
- });
3492
- Object.defineProperty(exports, "NoHydration", {
3493
- enumerable: true,
3494
- get: function () { return solidJs.NoHydration; }
3495
- });
3496
- Object.defineProperty(exports, "Repeat", {
3497
- enumerable: true,
3498
- get: function () { return solidJs.Repeat; }
3499
- });
3500
- Object.defineProperty(exports, "Reveal", {
3501
- enumerable: true,
3502
- get: function () { return solidJs.Reveal; }
3503
- });
3504
- Object.defineProperty(exports, "Show", {
3505
- enumerable: true,
3506
- get: function () { return solidJs.Show; }
3507
- });
3508
- Object.defineProperty(exports, "Switch", {
3509
- enumerable: true,
3510
- get: function () { return solidJs.Switch; }
3511
- });
3512
- Object.defineProperty(exports, "createComponent", {
3513
- enumerable: true,
3514
- get: function () { return solidJs.createComponent; }
3515
- });
3516
- Object.defineProperty(exports, "getOwner", {
3517
- enumerable: true,
3518
- get: function () { return solidJs.getOwner; }
3519
- });
3520
- Object.defineProperty(exports, "mergeProps", {
3521
- enumerable: true,
3522
- get: function () { return solidJs.merge; }
3523
- });
3524
- Object.defineProperty(exports, "scope", {
3525
- enumerable: true,
3526
- get: function () { return solidJs.ssrScope; }
3527
- });
3528
- Object.defineProperty(exports, "sharedConfig", {
3529
- enumerable: true,
3530
- get: function () { return solidJs.sharedConfig; }
3531
- });
3532
- Object.defineProperty(exports, "untrack", {
3533
- enumerable: true,
3534
- get: function () { return solidJs.untrack; }
3535
- });
3536
- exports.CLAIMS_DOCUMENT = CLAIMS_DOCUMENT;
3537
- exports.CLAIMS_STREAM = CLAIMS_STREAM;
3538
- exports.CLAIM_PROP = CLAIM_PROP;
3539
- exports.ChildProperties = ChildProperties;
3540
- exports.DOMElements = DOMElements;
3541
- exports.DOMWithState = DOMWithState;
3542
- exports.DelegatedEvents = DelegatedEvents;
3543
- exports.Dynamic = Dynamic;
3544
- exports.HREF = HREF;
3545
- exports.HydrationScript = HydrationScript;
3546
- exports.MathMLElements = MathMLElements;
3547
- exports.NULL_BODY_STATUSES = NULL_BODY_STATUSES;
3548
- exports.Namespaces = Namespaces;
3549
- exports.Portal = Portal;
3550
- exports.RESPONSE_HEADER_VALUE_LIMIT = RESPONSE_HEADER_VALUE_LIMIT;
3551
- exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
3552
- exports.RawTextElements = RawTextElements;
3553
- exports.RequestContext = RequestContext;
3554
- exports.ResponseEnvelope = ResponseEnvelope;
3555
- exports.SAFE_ERROR = SAFE_ERROR;
3556
- exports.SVGElements = SVGElements;
3557
- exports.VoidElements = VoidElements;
3558
- exports.acquireAsset = notSup;
3559
- exports.addEvent = notSup;
3560
- exports.applyRef = applyRef;
3561
- exports.assign = notSup;
3562
- exports.claimElement = claimElement;
3563
- exports.claimElementTree = claimElementTree;
3564
- exports.className = notSup;
3565
- exports.clearFlashCookie = clearFlashCookie;
3566
- exports.clientOnly = clientOnly;
3567
- exports.commitEventResponse = commitEventResponse;
3568
- exports.commitResponseStub = commitResponseStub;
3569
- exports.composeMiddleware = composeMiddleware;
3570
- exports.createLiveHoles = createLiveHoles;
3571
- exports.createRequestEvent = createRequestEvent;
3572
- exports.createResponseStub = createResponseStub;
3573
- exports.createSSRResponse = createSSRResponse;
3574
- exports.delegateEvents = notSup;
3575
- exports.dynamic = dynamic;
3576
- exports.dynamicProperty = notSup;
3577
- exports.effect = effect;
3578
- exports.escape = escape;
3579
- exports.generateHydrationScript = generateHydrationScript;
3580
- exports.getDelegatedRoot = notSup;
3581
- exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
3582
- exports.getHydrationKey = getHydrationKey;
3583
- exports.getNextElement = notSup;
3584
- exports.getNextMarker = notSup;
3585
- exports.getNextMatch = notSup;
3586
- exports.getRequestEvent = getRequestEvent;
3587
- exports.getServerFunctionMetadata = getServerFunctionMetadata;
3588
- exports.getServerFunctionRPC = getServerFunctionRPC;
3589
- exports.hasFlashCookie = hasFlashCookie;
3590
- exports.httpHeader = httpHeader;
3591
- exports.httpStatus = httpStatus;
3592
- exports.hydrate = notSup;
3593
- exports.insert = notSup;
3594
- exports.isDev = isDev;
3595
- exports.isHref = isHref;
3596
- exports.isResponseEnvelope = isResponseEnvelope;
3597
- exports.isSafeError = isSafeError;
3598
- exports.isServer = isServer;
3599
- exports.isServerFunction = isServerFunction;
3600
- exports.markSafeError = markSafeError;
3601
- exports.memo = memo;
3602
- exports.parseCookieHeader = parseCookieHeader;
3603
- exports.redirect = redirect;
3604
- exports.ref = notSup;
3605
- exports.registerDelegatedContainer = notSup;
3606
- exports.registerDelegatedRoot = notSup;
3607
- exports.registerElementClaim = registerElementClaim;
3608
- exports.reload = reload;
3609
- exports.render = notSup;
3610
- exports.renderToStream = renderToStream;
3611
- exports.renderToString = renderToString;
3612
- exports.resolveSSRNode = resolveSSRNode;
3613
- exports.resolveSSRSelectValues = resolveSSRSelectValues;
3614
- exports.respond = respond;
3615
- exports.runHydrationEvents = notSup;
3616
- exports.scriptNonce = scriptNonce;
3617
- exports.serializeCookie = serializeCookie;
3618
- exports.setAttribute = notSup;
3619
- exports.setAttributeNS = notSup;
3620
- exports.setProperty = notSup;
3621
- exports.setStyleProperty = notSup;
3622
- exports.spread = notSup;
3623
- exports.ssr = ssr;
3624
- exports.ssrAttribute = ssrAttribute;
3625
- exports.ssrClaim = ssrClaim;
3626
- exports.ssrClassName = ssrClassName;
3627
- exports.ssrElement = ssrElement;
3628
- exports.ssrGroup = ssrGroup;
3629
- exports.ssrHydrationKey = ssrHydrationKey;
3630
- exports.ssrSelectValues = ssrSelectValues;
3631
- exports.ssrStyle = ssrStyle;
3632
- exports.ssrStyleProperty = ssrStyleProperty;
3633
- exports.style = notSup;
3634
- exports.styleNonce = styleNonce;
3635
- exports.template = notSup;
3636
- exports.unregisterDelegatedContainer = notSup;
3637
- exports.unregisterDelegatedRoot = notSup;
3638
- exports.useHead = useHead;
3640
+ export { CLAIMS_DOCUMENT, CLAIMS_STREAM, CLAIM_PROP, 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, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperty, notSup as style, styleNonce, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };