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

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 (50) hide show
  1. package/dist/server.cjs +105 -35
  2. package/dist/server.dev.cjs +3794 -0
  3. package/dist/server.dev.js +3627 -0
  4. package/dist/server.js +106 -36
  5. package/dist/web.cjs +39 -385
  6. package/dist/{dev.cjs → web.dev.cjs} +91 -396
  7. package/dist/{dev.js → web.dev.js} +93 -393
  8. package/dist/web.js +41 -382
  9. package/frames/dist/client.cjs +11 -3
  10. package/frames/dist/client.dev.cjs +11 -3
  11. package/frames/dist/client.dev.js +11 -3
  12. package/frames/dist/client.js +11 -3
  13. package/frames/dist/server.cjs +234 -32
  14. package/frames/dist/server.dev.cjs +4584 -0
  15. package/frames/dist/server.dev.js +4571 -0
  16. package/frames/dist/server.js +234 -32
  17. package/frames/package.json +10 -0
  18. package/package.json +78 -8
  19. package/serialization/dist/decode.cjs +18 -4
  20. package/serialization/dist/decode.js +18 -4
  21. package/serialization/dist/serialization.cjs +18 -4
  22. package/serialization/dist/serialization.js +18 -4
  23. package/server-functions/dist/client.cjs +13 -14
  24. package/server-functions/dist/client.js +13 -14
  25. package/server-functions/dist/server.cjs +331 -83
  26. package/server-functions/dist/server.dev.cjs +338 -82
  27. package/server-functions/dist/server.dev.js +338 -82
  28. package/server-functions/dist/server.js +331 -83
  29. package/types/client.d.ts +0 -3
  30. package/types/frames/frame-client.d.ts +1 -1
  31. package/types/head.d.ts +3 -0
  32. package/types/index.d.ts +18 -7
  33. package/types/index.server.d.ts +31 -9
  34. package/types/render.d.ts +3 -1
  35. package/types/server-functions/flash.d.ts +12 -3
  36. package/types/server-functions/server.d.ts +27 -3
  37. package/types/server-mock.d.ts +43 -7
  38. package/types/server.d.ts +47 -5
  39. package/types-cjs/client.d.cts +0 -3
  40. package/types-cjs/frames/frame-client.d.cts +1 -1
  41. package/types-cjs/head.d.cts +3 -0
  42. package/types-cjs/index.d.cts +18 -7
  43. package/types-cjs/index.server.d.cts +31 -9
  44. package/types-cjs/render.d.cts +3 -1
  45. package/types-cjs/server-functions/flash.d.cts +12 -3
  46. package/types-cjs/server-functions/server.d.cts +27 -3
  47. package/types-cjs/server-mock.d.cts +43 -7
  48. package/types-cjs/server.d.cts +47 -5
  49. package/types/patch-driver.d.ts +0 -3
  50. package/types-cjs/patch-driver.d.cts +0 -3
@@ -291,6 +291,18 @@ const ERROR_HEADER = "X-Server-Function-Error";
291
291
  const BODY_FORMAT_HEADER = "X-Server-Function-Format";
292
292
  const REDIRECT_HEADER = "X-Server-Function-Redirect";
293
293
  const SINGLE_FLIGHT_HEADER = "X-Single-Flight";
294
+ const BodyFormat = {
295
+ Serialized: "0",
296
+ String: "1",
297
+ FormData: "2",
298
+ URLSearchParams: "3",
299
+ Blob: "4",
300
+ File: "5",
301
+ ArrayBuffer: "6",
302
+ Uint8Array: "7",
303
+ Json: "8",
304
+ Void: "9"
305
+ };
294
306
  function createChunk(data) {
295
307
  const encoder = new TextEncoder();
296
308
  const encodeData = encoder.encode(data);
@@ -426,12 +438,24 @@ function classifyHeadTag(desc) {
426
438
  resource: false
427
439
  };
428
440
  }
441
+ function qualifierValue(name, value) {
442
+ if (value == null || value === false) return null;
443
+ if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
444
+ const v = value === true ? "" : String(value);
445
+ if (name === "as") return asciiLowerCase(v);
446
+ if (name !== "crossorigin") return v;
447
+ return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
448
+ }
449
+ function asciiLowerCase(value) {
450
+ return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
451
+ }
429
452
  function resourceIdentity(tag, props) {
430
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
453
+ const url = String(props.href || props.src || "");
454
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
431
455
  for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
432
456
  const q = RESOURCE_QUALIFIERS[i];
433
- const value = props[q];
434
- if (value != null) id += ":" + q + "=" + (value === true ? "" : value);
457
+ const value = qualifierValue(q, props[q]);
458
+ if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
435
459
  }
436
460
  return id;
437
461
  }
@@ -505,12 +529,20 @@ function resolveAssets(moduleUrl, manifest) {
505
529
  if (e.preloads) {
506
530
  for (let i = 0; i < e.preloads.length; i++) {
507
531
  const link = e.preloads[i];
508
- if (!link || typeof link.href !== "string" || !link.href) continue;
532
+ const href = link && typeof link.href === "string" && link.href;
533
+ const srcset = link && typeof link.imagesrcset === "string" && link.imagesrcset;
534
+ if (!href && !srcset) continue;
509
535
  if (!preloads) preloads = [];
510
- preloads.push({
536
+ if (href) preloads.push({
511
537
  ...link,
512
- href: joinAssetPath(base, link.href)
513
- });
538
+ href: joinAssetPath(base, href)
539
+ });else {
540
+ const {
541
+ href: bad,
542
+ ...rest
543
+ } = link;
544
+ preloads.push(rest);
545
+ }
514
546
  }
515
547
  }
516
548
  if (e.imports) for (let i = 0; i < e.imports.length; i++) walk(e.imports[i]);
@@ -642,9 +674,13 @@ function isCssUrl(url) {
642
674
  const q = url.search(/[?#]/);
643
675
  return (q === -1 ? url : url.slice(0, q)).endsWith(".css");
644
676
  }
645
- const PRELOAD_LINK_ATTRIBUTES = ["type", "crossorigin", "integrity", "referrerpolicy", "fetchpriority", "media"];
677
+ const RESPONSIVE_ATTRIBUTES = ["imagesrcset", "imagesizes"];
678
+ function isSetAttr(value) {
679
+ return value != null && value !== false && value !== "";
680
+ }
681
+ const PRELOAD_LINK_ATTRIBUTES = ["type", "crossorigin", "integrity", "referrerpolicy", "fetchpriority", "media", "imagesrcset", "imagesizes"];
646
682
  function registerPreloadLink(tracking, headRegistry, link, nonce) {
647
- if (!link || typeof link !== "object" || typeof link.href !== "string" || !link.href) {
683
+ if (!link || typeof link !== "object") {
648
684
  return null;
649
685
  }
650
686
  if (typeof link.as !== "string") {
@@ -665,13 +701,35 @@ function registerPreloadLink(tracking, headRegistry, link, nonce) {
665
701
  default:
666
702
  return null;
667
703
  }
704
+ const responsive = as === "image";
705
+ let srcset = null;
706
+ let sizes = null;
707
+ if (responsive) {
708
+ for (const name of RESPONSIVE_ATTRIBUTES) {
709
+ const value = link[name];
710
+ if (!isSetAttr(value)) continue;
711
+ if (typeof value !== "string") {
712
+ continue;
713
+ }
714
+ if (name === "imagesrcset") srcset = value;else sizes = value;
715
+ }
716
+ }
717
+ const href = typeof link.href === "string" && link.href ? link.href : null;
718
+ if (!href && !srcset) {
719
+ return null;
720
+ }
668
721
  const props = {
669
- rel: "preload",
670
- href: link.href,
671
- as
722
+ rel: "preload"
672
723
  };
724
+ if (href) props.href = href;
725
+ props.as = as;
673
726
  for (let i = 0; i < PRELOAD_LINK_ATTRIBUTES.length; i++) {
674
727
  const name = PRELOAD_LINK_ATTRIBUTES[i];
728
+ if (RESPONSIVE_ATTRIBUTES.indexOf(name) !== -1) {
729
+ const value = name === "imagesrcset" ? srcset : sizes;
730
+ if (value !== null) props[name] = value;
731
+ continue;
732
+ }
675
733
  const value = link[name];
676
734
  if (value == null || value === false) continue;
677
735
  props[name] = value === true ? "" : String(value);
@@ -1036,9 +1094,6 @@ function normalizeNonce(nonce) {
1036
1094
  styleAttr: typeof style === "string" && style ? ` nonce="${escape(style, true)}"` : ""
1037
1095
  };
1038
1096
  }
1039
- function asciiLowerCase(value) {
1040
- return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
1041
- }
1042
1097
  function hasNonceProp(props) {
1043
1098
  for (const name in props) if (name.length === 5 && asciiLowerCase(name) === "nonce" && props[name] != null) return true;
1044
1099
  return false;
@@ -1119,6 +1174,7 @@ function renderToStream(code, options = {}) {
1119
1174
  onHead
1120
1175
  } = options;
1121
1176
  const nonce = normalizeNonce(options.nonce);
1177
+ const requestEvent = peekRequestEvent();
1122
1178
  let dispose;
1123
1179
  let dead = false;
1124
1180
  const abandon = () => {
@@ -1220,6 +1276,7 @@ function renderToStream(code, options = {}) {
1220
1276
  };
1221
1277
  const onDone = () => {
1222
1278
  writeTasks();
1279
+ lastBlockingSize = blockingPromises.size;
1223
1280
  doShell();
1224
1281
  onCompleteAll && onCompleteAll({
1225
1282
  write(v) {
@@ -1609,9 +1666,9 @@ function renderToStream(code, options = {}) {
1609
1666
  function doShell() {
1610
1667
  if (shellCompleted) return;
1611
1668
  sharedConfig.context = context;
1612
- const blockersBefore = blockingPromises.size;
1669
+ if (blockingPromises.size !== lastBlockingSize) return;
1613
1670
  if (!resolveRootHoles()) return;
1614
- if (blockingPromises.size !== blockersBefore) return;
1671
+ if (blockingPromises.size !== lastBlockingSize) return;
1615
1672
  if (!headShellReady(headRegistry, p => blockingPromises.add(p))) return;
1616
1673
  headStyles = new Set();
1617
1674
  for (const url of tracking.emittedAssets) {
@@ -1639,7 +1696,7 @@ function renderToStream(code, options = {}) {
1639
1696
  let lastBlockingSize = -1;
1640
1697
  let lastRegistrySize = -1;
1641
1698
  let drainTurn = 0;
1642
- const scheduleFlush = fn => {
1699
+ const scheduleFlush = (fn, awaited) => {
1643
1700
  const attempt = () => {
1644
1701
  flushStubBatch();
1645
1702
  if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
@@ -1650,8 +1707,8 @@ function renderToStream(code, options = {}) {
1650
1707
  }
1651
1708
  fn();
1652
1709
  };
1653
- const progressed = blockingPromises.size !== lastBlockingSize;
1654
- lastBlockingSize = blockingPromises.size;
1710
+ const progressed = awaited !== lastBlockingSize;
1711
+ lastBlockingSize = awaited;
1655
1712
  lastRegistrySize = -1;
1656
1713
  drainTurn = 0;
1657
1714
  progressed ? queue(attempt) : setTimeout(attempt);
@@ -1668,7 +1725,7 @@ function renderToStream(code, options = {}) {
1668
1725
  let resolve;
1669
1726
  const p = new Promise(r => resolve = r);
1670
1727
  function flush() {
1671
- allSettled(blockingPromises).then(() => {
1728
+ allSettled(blockingPromises).then(awaited => {
1672
1729
  scheduleFlush(() => {
1673
1730
  if (dead) return resolve();
1674
1731
  try {
@@ -1706,7 +1763,7 @@ function renderToStream(code, options = {}) {
1706
1763
  dispose();
1707
1764
  writable.end();
1708
1765
  } else flushEnd();
1709
- });
1766
+ }, awaited);
1710
1767
  });
1711
1768
  }
1712
1769
  flush();
@@ -1714,8 +1771,12 @@ function renderToStream(code, options = {}) {
1714
1771
  };
1715
1772
  return {
1716
1773
  then(onFulfilled, onRejected) {
1774
+ const freezeHead = () => {
1775
+ if (requestEvent && requestEvent.response) commitResponseStub(requestEvent.response);
1776
+ };
1717
1777
  const p = new Promise(resolve => {
1718
1778
  function complete() {
1779
+ freezeHead();
1719
1780
  dispose();
1720
1781
  resolve(tmp);
1721
1782
  }
@@ -1727,17 +1788,16 @@ function renderToStream(code, options = {}) {
1727
1788
  };
1728
1789
  } else onCompleteAll = complete;
1729
1790
  function flush() {
1730
- allSettled(blockingPromises).then(() => {
1791
+ allSettled(blockingPromises).then(awaited => {
1731
1792
  scheduleFlush(() => {
1732
1793
  try {
1733
- const blockersBefore = blockingPromises.size;
1734
- if (!resolveRootHoles() || blockingPromises.size !== blockersBefore || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
1794
+ if (blockingPromises.size !== lastBlockingSize || !resolveRootHoles() || blockingPromises.size !== lastBlockingSize || !headShellReady(headRegistry, p => blockingPromises.add(p))) return flush();
1735
1795
  } catch (err) {
1736
1796
  failRender(err);
1737
1797
  return resolve(tmp);
1738
1798
  }
1739
1799
  queue(flushEnd);
1740
- });
1800
+ }, awaited);
1741
1801
  });
1742
1802
  }
1743
1803
  flush();
@@ -1747,7 +1807,7 @@ function renderToStream(code, options = {}) {
1747
1807
  pipe(w) {
1748
1808
  claimConsumer("pipe");
1749
1809
  function flush() {
1750
- allSettled(blockingPromises).then(() => {
1810
+ allSettled(blockingPromises).then(awaited => {
1751
1811
  scheduleFlush(() => {
1752
1812
  if (dead) return;
1753
1813
  try {
@@ -1769,7 +1829,7 @@ function renderToStream(code, options = {}) {
1769
1829
  dispose();
1770
1830
  writable.end();
1771
1831
  } else flushEnd();
1772
- });
1832
+ }, awaited);
1773
1833
  });
1774
1834
  }
1775
1835
  flush();
@@ -2541,7 +2601,7 @@ function allSettled(promises) {
2541
2601
  let size = promises.size;
2542
2602
  return Promise.allSettled(promises).then(() => {
2543
2603
  if (promises.size !== size) return allSettled(promises);
2544
- return;
2604
+ return size;
2545
2605
  });
2546
2606
  }
2547
2607
  function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
@@ -2791,10 +2851,145 @@ function resolveSSRSync(node) {
2791
2851
  if (!res.h.length) return res.t[0];
2792
2852
  throw new Error("This value cannot be rendered synchronously. Are you missing a boundary?");
2793
2853
  }
2854
+ const RequestContext = Symbol.for("solid.RequestContext");
2855
+ function peekRequestEvent() {
2856
+ const store = globalThis[RequestContext];
2857
+ return store ? store.getStore() : undefined;
2858
+ }
2859
+ function reportLostHeaderWrite(method, name) {
2860
+ 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).";
2861
+ console.error(message);
2862
+ }
2863
+ function commitResponseStub(stub, {
2864
+ allowLateLocation = false
2865
+ } = {}) {
2866
+ if (!stub || stub.committed) return stub;
2867
+ stub.committed = true;
2868
+ const headers = stub.headers;
2869
+ if (!headers || typeof headers.set !== "function") return stub;
2870
+ for (const method of ["set", "append", "delete"]) {
2871
+ const original = headers[method].bind(headers);
2872
+ headers[method] = function (name, ...rest) {
2873
+ if (allowLateLocation && method === "set" && String(name).toLowerCase() === "location") {
2874
+ return original(name, ...rest);
2875
+ }
2876
+ reportLostHeaderWrite(method, name);
2877
+ };
2878
+ }
2879
+ return stub;
2880
+ }
2794
2881
  /*#__PURE__*/new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location",
2795
2882
  ...COMPOSED_BODY_FRAMING].map(header => header.toLowerCase()));
2796
2883
 
2797
2884
  function scopeDeferredResult(value, scope) {
2885
+ const bound = bindDeferredBody(value, scope);
2886
+ if (bound !== value || value === null || typeof value !== "object") return bound;
2887
+ return scopeDeferredContents(value, scope);
2888
+ }
2889
+ class ScopeFrame {
2890
+ constructor(value, next, keys, descriptors) {
2891
+ this.value = value;
2892
+ this.next = next;
2893
+ this.keys = keys;
2894
+ this.descriptors = descriptors;
2895
+ this.i = 0;
2896
+ this.changed = false;
2897
+ }
2898
+ }
2899
+ function enterScopeCarrier(value, state) {
2900
+ if (value === null || typeof value !== "object" && typeof value !== "function") return value;
2901
+ if (state.seen.has(value)) {
2902
+ state.cyclic.add(value);
2903
+ return state.seen.get(value);
2904
+ }
2905
+ const bound = bindDeferredBody(value, state.scope);
2906
+ if (bound !== value) {
2907
+ state.seen.set(value, bound);
2908
+ return bound;
2909
+ }
2910
+ if (typeof value !== "object") return value;
2911
+ if (Array.isArray(value)) {
2912
+ if (Object.isFrozen(value)) {
2913
+ state.seen.set(value, value);
2914
+ return value;
2915
+ }
2916
+ const next = value.slice();
2917
+ state.seen.set(value, next);
2918
+ return new ScopeFrame(value, next, null, null);
2919
+ }
2920
+ const prototype = Object.getPrototypeOf(value);
2921
+ if (prototype !== Object.prototype && prototype !== null || Object.isFrozen(value)) {
2922
+ state.seen.set(value, value);
2923
+ return value;
2924
+ }
2925
+ const descriptors = Object.getOwnPropertyDescriptors(value);
2926
+ const next = Object.create(prototype, descriptors);
2927
+ state.seen.set(value, next);
2928
+ return new ScopeFrame(value, next, Object.keys(value), descriptors);
2929
+ }
2930
+ function scopeDeferredContents(root, scope) {
2931
+ const state = {
2932
+ seen: new Map(),
2933
+ cyclic: new Set(),
2934
+ scope
2935
+ };
2936
+ const entered = enterScopeCarrier(root, state);
2937
+ if (!(entered instanceof ScopeFrame)) return entered;
2938
+ const stack = [entered];
2939
+ let delivered = NOTHING;
2940
+ for (;;) {
2941
+ const top = stack[stack.length - 1];
2942
+ const length = top.keys ? top.keys.length : top.value.length;
2943
+ let pushed = null;
2944
+ while (top.i < length) {
2945
+ const i = top.i;
2946
+ let original;
2947
+ let writable = true;
2948
+ if (top.keys) {
2949
+ const descriptor = top.descriptors[top.keys[i]];
2950
+ writable = "value" in descriptor && descriptor.writable === true;
2951
+ original = writable ? descriptor.value : undefined;
2952
+ } else {
2953
+ original = top.value[i];
2954
+ }
2955
+ if (!writable) {
2956
+ top.i++;
2957
+ continue;
2958
+ }
2959
+ let bound;
2960
+ if (delivered !== NOTHING) {
2961
+ bound = delivered;
2962
+ delivered = NOTHING;
2963
+ } else {
2964
+ bound = enterScopeCarrier(original, state);
2965
+ if (bound instanceof ScopeFrame) {
2966
+ pushed = bound;
2967
+ break;
2968
+ }
2969
+ }
2970
+ if (bound !== original) {
2971
+ if (top.keys) top.next[top.keys[i]] = bound;else top.next[i] = bound;
2972
+ top.changed = true;
2973
+ }
2974
+ top.i++;
2975
+ }
2976
+ if (pushed !== null) {
2977
+ stack.push(pushed);
2978
+ continue;
2979
+ }
2980
+ stack.pop();
2981
+ let out;
2982
+ if (top.changed || state.cyclic.has(top.value)) {
2983
+ out = top.next;
2984
+ } else {
2985
+ state.seen.set(top.value, top.value);
2986
+ out = top.value;
2987
+ }
2988
+ if (stack.length === 0) return out;
2989
+ delivered = out;
2990
+ }
2991
+ }
2992
+ function bindDeferredBody(value, scope) {
2798
2993
  if (value === null || typeof value !== "object" && typeof value !== "function") return value;
2799
2994
  const promised = scope(() => nativePromise(value));
2800
2995
  if (promised) {
@@ -2844,6 +3039,7 @@ const INVOCATIONS = new WeakMap();
2844
3039
  function getEventServerFunctionInvocation(event) {
2845
3040
  return event && INVOCATIONS.get(event);
2846
3041
  }
3042
+ new Set(Object.values(BodyFormat));
2847
3043
  function guardFailures(value, state) {
2848
3044
  if (!state) state = {
2849
3045
  seen: new WeakMap(),
@@ -3068,7 +3264,7 @@ function enterGuard(value, state) {
3068
3264
  return new Frame(SET, value, next, [...value], null);
3069
3265
  }
3070
3266
  const prototype = Object.getPrototypeOf(value);
3071
- if (prototype !== Object.prototype && prototype !== null) {
3267
+ if (prototype !== Object.prototype && prototype !== null && !(value instanceof Error)) {
3072
3268
  state.seen.set(value, value);
3073
3269
  return value;
3074
3270
  }
@@ -3079,7 +3275,11 @@ function enterGuard(value, state) {
3079
3275
  }
3080
3276
  const next = Object.create(prototype, descriptors);
3081
3277
  state.seen.set(value, next);
3082
- return new Frame(OBJECT, value, next, Object.keys(value), descriptors);
3278
+ const children = !(value instanceof Error) ? Object.keys(value) : Object.getOwnPropertyNames(value).filter(key => {
3279
+ const descriptor = descriptors[key];
3280
+ return descriptor.enumerable || "value" in descriptor;
3281
+ });
3282
+ return new Frame(OBJECT, value, next, children, descriptors);
3083
3283
  }
3084
3284
  function keepGuarded(value, next, changed, state) {
3085
3285
  if (changed || state.cyclic.has(value)) return next;
@@ -3167,9 +3367,11 @@ function serverComponentScope(render) {
3167
3367
  return runInServerComponentScope ? runInServerComponentScope(render) : render();
3168
3368
  }
3169
3369
  function wirePreload(entry) {
3170
- return {
3370
+ return entry.href ? {
3171
3371
  href: entry.href,
3172
3372
  attrs: entry.attrs
3373
+ } : {
3374
+ attrs: entry.attrs
3173
3375
  };
3174
3376
  }
3175
3377
  const SERVER_COMPONENT_BOOTSTRAP_EXPR = "(self._$SC||(self._$SC={c:{},a:{},r(i,a){a&&(this.a[a]=i,this.reg&&this.reg(a,i));return this.c[i]||(this.c[i]=(p,b)=>self._$SC.impl(i,p,b))}}))";
@@ -17,6 +17,16 @@
17
17
  "default": "./dist/client.cjs"
18
18
  }
19
19
  },
20
+ "development": {
21
+ "import": {
22
+ "types": "../types/frames/server.d.ts",
23
+ "default": "./dist/server.dev.js"
24
+ },
25
+ "require": {
26
+ "types": "../types-cjs/frames/server.d.cts",
27
+ "default": "./dist/server.dev.cjs"
28
+ }
29
+ },
20
30
  "import": {
21
31
  "types": "../types/frames/server.d.ts",
22
32
  "default": "./dist/server.js"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solidjs/web",
3
3
  "description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
4
- "version": "2.0.0-rc.6",
4
+ "version": "2.0.0-rc.7",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -43,6 +43,16 @@
43
43
  "exports": {
44
44
  ".": {
45
45
  "worker": {
46
+ "development": {
47
+ "import": {
48
+ "types": "./types/index.d.ts",
49
+ "default": "./dist/server.dev.js"
50
+ },
51
+ "require": {
52
+ "types": "./types-cjs/index.d.cts",
53
+ "default": "./dist/server.dev.cjs"
54
+ }
55
+ },
46
56
  "import": {
47
57
  "types": "./types/index.d.ts",
48
58
  "default": "./dist/server.js"
@@ -56,11 +66,11 @@
56
66
  "development": {
57
67
  "import": {
58
68
  "types": "./types/index.d.ts",
59
- "default": "./dist/dev.js"
69
+ "default": "./dist/web.dev.js"
60
70
  },
61
71
  "require": {
62
72
  "types": "./types-cjs/index.d.cts",
63
- "default": "./dist/dev.cjs"
73
+ "default": "./dist/web.dev.cjs"
64
74
  }
65
75
  },
66
76
  "import": {
@@ -73,6 +83,16 @@
73
83
  }
74
84
  },
75
85
  "deno": {
86
+ "development": {
87
+ "import": {
88
+ "types": "./types/index.d.ts",
89
+ "default": "./dist/server.dev.js"
90
+ },
91
+ "require": {
92
+ "types": "./types-cjs/index.d.cts",
93
+ "default": "./dist/server.dev.cjs"
94
+ }
95
+ },
76
96
  "import": {
77
97
  "types": "./types/index.d.ts",
78
98
  "default": "./dist/server.js"
@@ -83,6 +103,16 @@
83
103
  }
84
104
  },
85
105
  "node": {
106
+ "development": {
107
+ "import": {
108
+ "types": "./types/index.d.ts",
109
+ "default": "./dist/server.dev.js"
110
+ },
111
+ "require": {
112
+ "types": "./types-cjs/index.d.cts",
113
+ "default": "./dist/server.dev.cjs"
114
+ }
115
+ },
86
116
  "import": {
87
117
  "types": "./types/index.d.ts",
88
118
  "default": "./dist/server.js"
@@ -95,11 +125,11 @@
95
125
  "development": {
96
126
  "import": {
97
127
  "types": "./types/index.d.ts",
98
- "default": "./dist/dev.js"
128
+ "default": "./dist/web.dev.js"
99
129
  },
100
130
  "require": {
101
131
  "types": "./types-cjs/index.d.cts",
102
- "default": "./dist/dev.cjs"
132
+ "default": "./dist/web.dev.cjs"
103
133
  }
104
134
  },
105
135
  "import": {
@@ -124,11 +154,11 @@
124
154
  "./jsx-dev-runtime": {
125
155
  "import": {
126
156
  "types": "./types/jsx.d.ts",
127
- "default": "./dist/dev.js"
157
+ "default": "./dist/web.dev.js"
128
158
  },
129
159
  "require": {
130
160
  "types": "./types-cjs/jsx.d.cts",
131
- "default": "./dist/dev.cjs"
161
+ "default": "./dist/web.dev.cjs"
132
162
  }
133
163
  },
134
164
  "./storage": {
@@ -283,6 +313,16 @@
283
313
  },
284
314
  "./frames": {
285
315
  "worker": {
316
+ "development": {
317
+ "import": {
318
+ "types": "./types/frames/server.d.ts",
319
+ "default": "./frames/dist/server.dev.js"
320
+ },
321
+ "require": {
322
+ "types": "./types-cjs/frames/server.d.cts",
323
+ "default": "./frames/dist/server.dev.cjs"
324
+ }
325
+ },
286
326
  "import": {
287
327
  "types": "./types/frames/server.d.ts",
288
328
  "default": "./frames/dist/server.js"
@@ -313,6 +353,16 @@
313
353
  }
314
354
  },
315
355
  "deno": {
356
+ "development": {
357
+ "import": {
358
+ "types": "./types/frames/server.d.ts",
359
+ "default": "./frames/dist/server.dev.js"
360
+ },
361
+ "require": {
362
+ "types": "./types-cjs/frames/server.d.cts",
363
+ "default": "./frames/dist/server.dev.cjs"
364
+ }
365
+ },
316
366
  "import": {
317
367
  "types": "./types/frames/server.d.ts",
318
368
  "default": "./frames/dist/server.js"
@@ -323,6 +373,16 @@
323
373
  }
324
374
  },
325
375
  "node": {
376
+ "development": {
377
+ "import": {
378
+ "types": "./types/frames/server.d.ts",
379
+ "default": "./frames/dist/server.dev.js"
380
+ },
381
+ "require": {
382
+ "types": "./types-cjs/frames/server.d.cts",
383
+ "default": "./frames/dist/server.dev.cjs"
384
+ }
385
+ },
326
386
  "import": {
327
387
  "types": "./types/frames/server.d.ts",
328
388
  "default": "./frames/dist/server.js"
@@ -352,6 +412,16 @@
352
412
  }
353
413
  },
354
414
  "./frames/server": {
415
+ "development": {
416
+ "import": {
417
+ "types": "./types/frames/server.d.ts",
418
+ "default": "./frames/dist/server.dev.js"
419
+ },
420
+ "require": {
421
+ "types": "./types-cjs/frames/server.d.cts",
422
+ "default": "./frames/dist/server.dev.cjs"
423
+ }
424
+ },
355
425
  "import": {
356
426
  "types": "./types/frames/server.d.ts",
357
427
  "default": "./frames/dist/server.js"
@@ -398,7 +468,7 @@
398
468
  "seroval-plugins": "~1.5.4"
399
469
  },
400
470
  "peerDependencies": {
401
- "solid-js": "^2.0.0-rc.6"
471
+ "solid-js": "^2.0.0-rc.7"
402
472
  },
403
473
  "devDependencies": {
404
474
  "@codspeed/vitest-plugin": "^5.4.0",
@@ -98,11 +98,25 @@ function resolveCodecOptions({
98
98
  function createJSONDeserializer(options) {
99
99
  const refs = new Map();
100
100
  const resolved = resolveCodecOptions(options);
101
+ let owned = 0;
102
+ function ownDecodedPromises() {
103
+ if (refs.size === owned) return;
104
+ let index = 0;
105
+ for (const value of refs.values()) {
106
+ if (index++ < owned) continue;
107
+ if (value instanceof Promise) value.then(undefined, () => {});
108
+ }
109
+ owned = refs.size;
110
+ }
101
111
  function deserializeJSONChunk(node) {
102
- return seroval.fromCrossJSON(node, {
103
- refs,
104
- ...resolved
105
- });
112
+ try {
113
+ return seroval.fromCrossJSON(node, {
114
+ refs,
115
+ ...resolved
116
+ });
117
+ } finally {
118
+ ownDecodedPromises();
119
+ }
106
120
  }
107
121
  deserializeJSONChunk.abort = function abort(error) {
108
122
  for (const value of refs.values()) {