@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.3

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 (78) hide show
  1. package/dist/dev.cjs +86 -61
  2. package/dist/dev.js +81 -60
  3. package/dist/server.cjs +34 -17
  4. package/dist/server.js +35 -19
  5. package/dist/web.cjs +83 -59
  6. package/dist/web.js +78 -58
  7. package/frames/dist/client.cjs +8 -8
  8. package/frames/dist/client.dev.cjs +8 -8
  9. package/frames/dist/client.dev.js +8 -8
  10. package/frames/dist/client.js +8 -8
  11. package/frames/dist/server.cjs +28 -18
  12. package/frames/dist/server.js +29 -19
  13. package/package.json +20 -22
  14. package/serialization/dist/decode.cjs +3 -3
  15. package/serialization/dist/decode.js +3 -3
  16. package/serialization/dist/serialization.cjs +7 -11
  17. package/serialization/dist/serialization.js +7 -6
  18. package/serialization/types/index.d.ts +69 -157
  19. package/serialization/types/serializer-decode.d.ts +89 -112
  20. package/serialization/types/serializer.d.ts +94 -0
  21. package/serialization/types-cjs/index.d.cts +69 -157
  22. package/serialization/types-cjs/serializer-decode.d.cts +89 -112
  23. package/serialization/types-cjs/serializer.d.cts +94 -0
  24. package/types/client.d.ts +150 -290
  25. package/types/constants.d.ts +18 -0
  26. package/types/cookies.d.ts +31 -75
  27. package/types/frames/frame-client.d.ts +287 -277
  28. package/types/frames/frame-container-plugin.d.ts +71 -0
  29. package/types/frames/frame-sink.d.ts +58 -160
  30. package/types/frames/frame-transport.d.ts +161 -194
  31. package/types/frames/serializer-decode.d.ts +159 -0
  32. package/types/frames/serializer.d.ts +69 -157
  33. package/types/head.d.ts +16 -0
  34. package/types/index.d.ts +0 -65
  35. package/types/index.server.d.ts +125 -0
  36. package/types/jsx.d.ts +5 -13
  37. package/types/reconcile.d.ts +1 -0
  38. package/types/render.d.ts +4 -0
  39. package/types/response.d.ts +41 -153
  40. package/types/serializer-decode.d.ts +89 -112
  41. package/types/serializer.d.ts +69 -157
  42. package/types/server-functions/client.d.ts +93 -222
  43. package/types/server-functions/flash.d.ts +10 -30
  44. package/types/server-functions/registry.d.ts +63 -0
  45. package/types/server-functions/rich-args.d.ts +1 -10
  46. package/types/server-functions/server.d.ts +292 -574
  47. package/types/server-functions/shared.d.ts +112 -458
  48. package/types/server-mock.d.ts +2 -2
  49. package/types/server.d.ts +242 -434
  50. package/types-cjs/client.d.cts +150 -290
  51. package/types-cjs/constants.d.cts +18 -0
  52. package/types-cjs/cookies.d.cts +31 -75
  53. package/types-cjs/frames/frame-client.d.cts +287 -277
  54. package/types-cjs/frames/frame-container-plugin.d.cts +71 -0
  55. package/types-cjs/frames/frame-sink.d.cts +58 -160
  56. package/types-cjs/frames/frame-transport.d.cts +161 -194
  57. package/types-cjs/frames/serializer-decode.d.cts +159 -0
  58. package/types-cjs/frames/serializer.d.cts +69 -157
  59. package/types-cjs/head.d.cts +16 -0
  60. package/types-cjs/index.d.cts +0 -65
  61. package/types-cjs/index.server.d.cts +125 -0
  62. package/types-cjs/jsx.d.cts +5 -13
  63. package/types-cjs/reconcile.d.cts +1 -0
  64. package/types-cjs/render.d.cts +4 -0
  65. package/types-cjs/response.d.cts +41 -153
  66. package/types-cjs/serializer-decode.d.cts +89 -112
  67. package/types-cjs/serializer.d.cts +69 -157
  68. package/types-cjs/server-functions/client.d.cts +93 -222
  69. package/types-cjs/server-functions/flash.d.cts +10 -30
  70. package/types-cjs/server-functions/registry.d.cts +63 -0
  71. package/types-cjs/server-functions/rich-args.d.cts +1 -10
  72. package/types-cjs/server-functions/server.d.cts +292 -574
  73. package/types-cjs/server-functions/shared.d.cts +112 -458
  74. package/types-cjs/server-mock.d.cts +2 -2
  75. package/types-cjs/server.d.cts +242 -434
  76. package/LICENSE +0 -21
  77. package/types/core.d.ts +0 -9
  78. package/types-cjs/core.d.cts +0 -9
@@ -1,8 +1,8 @@
1
- import { createMemo, runWithOwner, createOwner, sharedConfig, createRoot, ssrHandleError, getOwner, inServerComponentScope, creationStamp, NoHydration, runInServerComponentScope, Hydration, getProjectionTrace } from 'solid-js';
1
+ import { sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, inServerComponentScope, creationStamp, NoHydration, runInServerComponentScope, createMemo, Hydration, createOwner, getProjectionTrace } from 'solid-js';
2
2
  import { Feature, createStream, toCrossJSONStream, Serializer, getCrossReferenceHeader } from 'seroval';
3
3
  import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
4
4
 
5
- const STATE = Symbol.for("dom-expressions.container-trace-state");
5
+ const STATE = Symbol.for("solid.container-trace-state");
6
6
  const state = globalThis[STATE] || (globalThis[STATE] = {
7
7
  materialized: new WeakMap(),
8
8
  materializedValues: new WeakSet()
@@ -17,7 +17,7 @@ function isContainerTraced(value) {
17
17
  const resolve = state.resolveTrace;
18
18
  return !!(resolve && value && typeof value === "object" && resolve(value));
19
19
  }
20
- const TRACE = Symbol.for("dom-expressions.container-trace");
20
+ const TRACE = Symbol.for("solid.container-trace");
21
21
  function envelopeContainerTraces(value) {
22
22
  if (!state.resolveTrace || value == null || typeof value !== "object") return value;
23
23
  const trace = state.resolveTrace(value);
@@ -68,7 +68,7 @@ function parseTrace(value, ctx) {
68
68
  };
69
69
  }
70
70
  const ContainerTracePlugin = {
71
- tag: "dom-expressions/container-trace",
71
+ tag: "solid/container-trace",
72
72
  test(value) {
73
73
  return value != null && typeof value === "object" && TRACE in value;
74
74
  },
@@ -99,13 +99,6 @@ const ContainerTracePlugin = {
99
99
  }
100
100
  };
101
101
 
102
- const runWithHydrationScope = (id, fn) => runWithOwner(createOwner({
103
- id
104
- }), fn);
105
- const ssrAsyncValue = value => createMemo(() => value, {
106
- serialize: false
107
- });
108
-
109
102
  setContainerTraceStreamMint(iterable => {
110
103
  const stream = createStream();
111
104
  (async () => {
@@ -1816,6 +1809,15 @@ function createLiveHoles(sink, scoped) {
1816
1809
  const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
1817
1810
  const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
1818
1811
  const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->/g, "");
1812
+ const swept = (owner, ctx, fn) => {
1813
+ const prev = sharedConfig.context;
1814
+ sharedConfig.context = ctx;
1815
+ try {
1816
+ return owner ? runWithOwner(owner, fn) : fn();
1817
+ } finally {
1818
+ sharedConfig.context = prev;
1819
+ }
1820
+ };
1819
1821
  function resolveHoleValue(hole) {
1820
1822
  const result = {
1821
1823
  t: [""],
@@ -1881,6 +1883,7 @@ function createLiveHoles(sink, scoped) {
1881
1883
  const recordsBefore = engine.recordStamp;
1882
1884
  const ownersBefore = stamp();
1883
1885
  const owner = getOwner();
1886
+ const holeCtx = sharedConfig.context;
1884
1887
  const b = {
1885
1888
  key: null,
1886
1889
  children: [],
@@ -1894,7 +1897,7 @@ function createLiveHoles(sink, scoped) {
1894
1897
  const sweepOwnersBefore = stamp();
1895
1898
  let res;
1896
1899
  try {
1897
- res = owner ? runWithOwner(owner, () => resolveHoleValue(hole)) : resolveHoleValue(hole);
1900
+ res = swept(owner, holeCtx, () => resolveHoleValue(hole));
1898
1901
  } catch (err) {
1899
1902
  b.closed = true;
1900
1903
  sink.closeBinding(b.key);
@@ -2002,6 +2005,7 @@ function createLiveHoles(sink, scoped) {
2002
2005
  },
2003
2006
  attr(cap) {
2004
2007
  const owner = getOwner();
2008
+ const holeCtx = sharedConfig.context;
2005
2009
  const b = {
2006
2010
  key: "lha:" + cap.id,
2007
2011
  children: [],
@@ -2037,7 +2041,7 @@ function createLiveHoles(sink, scoped) {
2037
2041
  if (vt === "string" || vt === "number") html += v;
2038
2042
  }
2039
2043
  };
2040
- owner ? runWithOwner(owner, run) : run();
2044
+ swept(owner, holeCtx, run);
2041
2045
  } catch (err) {
2042
2046
  if (ssrHandleError(err, true)) return;
2043
2047
  b.closed = true;
@@ -2297,7 +2301,7 @@ function ssr(t) {
2297
2301
  };
2298
2302
  return result;
2299
2303
  }
2300
- const CLAIM_PROP = /*#__PURE__*/Symbol.for("dom-expressions.claim-prop");
2304
+ const CLAIM_PROP = /*#__PURE__*/Symbol.for("solid.claim-prop");
2301
2305
  const CLAIMS_STREAM = 1;
2302
2306
  const CLAIMS_DOCUMENT = 2;
2303
2307
  function resolveSSRSelectValues(html) {
@@ -2668,9 +2672,9 @@ const FRAME_STREAM_HEADER = "X-Frame-Stream";
2668
2672
  function isFrameStreamResponse(response) {
2669
2673
  return response.headers.has(FRAME_STREAM_HEADER);
2670
2674
  }
2671
- const SERVER_COMPONENT = /*#__PURE__*/Symbol.for("dom-expressions.server-component");
2672
- const SERVER_COMPONENT_SOURCE = /*#__PURE__*/Symbol.for("dom-expressions.server-component-source");
2673
- const SERVER_COMPONENT_ADDRESS = /*#__PURE__*/Symbol.for("dom-expressions.server-component-address");
2675
+ const SERVER_COMPONENT = /*#__PURE__*/Symbol.for("solid.server-component");
2676
+ const SERVER_COMPONENT_SOURCE = /*#__PURE__*/Symbol.for("solid.server-component-source");
2677
+ const SERVER_COMPONENT_ADDRESS = /*#__PURE__*/Symbol.for("solid.server-component-address");
2674
2678
  let serverComponentRegistryExpr;
2675
2679
  function setServerComponentBootstrap(resolve) {
2676
2680
  serverComponentRegistryExpr = resolve;
@@ -2682,7 +2686,7 @@ function parseServerComponent(value, ctx) {
2682
2686
  };
2683
2687
  }
2684
2688
  const ServerComponentPlugin = {
2685
- tag: "dom-expressions/server-component",
2689
+ tag: "solid/server-component",
2686
2690
  test(value) {
2687
2691
  return typeof value === "function" && SERVER_COMPONENT in value;
2688
2692
  },
@@ -2715,6 +2719,12 @@ function flightCodec(codec) {
2715
2719
  };
2716
2720
  }
2717
2721
 
2722
+ const runWithHydrationScope = (id, fn) => runWithOwner(createOwner({
2723
+ id
2724
+ }), fn);
2725
+ const ssrAsyncValue = value => createMemo(() => value, {
2726
+ serialize: false
2727
+ });
2718
2728
  const scopeStamp = typeof creationStamp === "function" ? creationStamp : () => 0;
2719
2729
  function serverOwned(render) {
2720
2730
  return NoHydration ? NoHydration({
@@ -3293,7 +3303,7 @@ function createDocumentSlotProps(clientProps, frameId) {
3293
3303
  }
3294
3304
  });
3295
3305
  }
3296
- const FRAME_TAG = "dx-frame";
3306
+ const FRAME_TAG = "solid-frame";
3297
3307
  const FRAME_ID_ATTR = "data-fid";
3298
3308
  function frameElementOpen(id) {
3299
3309
  const escaped = sharedConfig.context ? sharedConfig.context.escape(String(id), true) : String(id);
package/package.json CHANGED
@@ -1,14 +1,14 @@
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.2",
4
+ "version": "2.0.0-rc.3",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/solidjs/solid.git",
11
- "directory": "packages/solid-web"
11
+ "directory": "packages/web"
12
12
  },
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -373,32 +373,18 @@
373
373
  },
374
374
  "./types/*": "./types/*"
375
375
  },
376
- "dependencies": {
377
- "seroval": "~1.5.4",
378
- "seroval-plugins": "~1.5.4"
379
- },
380
- "peerDependencies": {
381
- "solid-js": "^2.0.0-rc.2"
382
- },
383
- "devDependencies": {
384
- "@codspeed/vitest-plugin": "^5.4.0",
385
- "solid-js": "2.0.0-rc.2"
386
- },
387
376
  "scripts": {
388
377
  "build": "npm-run-all -nl build:clean types:copy-jsx build:js",
389
378
  "build:clean": "rimraf dist/",
390
379
  "build:js": "rollup -c",
391
380
  "link": "symlink-dir . node_modules/@solidjs/web",
392
- "types": "npm-run-all -nl types:clean types:copy-jsx types:web types:copy-web types:web-storage types:copy-server-functions types:copy-serialization types:web-frames types:copy-frames types:cjs",
393
- "types:clean": "rimraf types/ types-cjs/ storage/types/ storage/types-cjs/ serialization/types/ serialization/types-cjs/ frames/types/",
394
- "types:copy-jsx": "ncp ../../node_modules/@dom-expressions/runtime/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/jsx-properties.d.ts ./src/jsx-properties.d.ts && dom-expressions-jsx-types --input ./src/jsx.d.ts --element \"SolidElement | Node | ArrayElement\" --import 'import type { Element as SolidElement } from \"solid-js\";'",
381
+ "types": "npm-run-all -nl types:clean types:copy-jsx types:web types:copy-web types:web-storage types:cjs",
382
+ "types:clean": "rimraf types/ types-cjs/ storage/types/ storage/types-cjs/ serialization/types/ serialization/types-cjs/ frames/types/ .types-build/",
383
+ "jsx-sync": "node ./scripts/jsx-sync.mjs --compile --element \"SolidElement | Node | ArrayElement\" --import \"import type { Element as SolidElement } from \\\"solid-js\\\";\"",
384
+ "types:copy-jsx": "pnpm run jsx-sync",
395
385
  "types:web": "tsc --project ./tsconfig.build.json",
396
- "types:copy-web": "node -e \"const src = fs.readFileSync('../../node_modules/@dom-expressions/runtime/src/client.d.ts', 'utf8'); const marker = 'export type { RequestEventLocals } from'; if (!src.includes(marker)) throw new Error('client.d.ts drift: the type-only RequestEventLocals re-export was not found — revisit the augmentation-identity rewrite'); fs.writeFileSync('./types/client.d.ts', src.replace(marker, 'export { RequestEventLocals } from'));\" && ncp ../../node_modules/@dom-expressions/runtime/src/server.d.ts ./types/server.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/serializer.d.ts ./types/serializer.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/serializer-decode.d.ts ./types/serializer-decode.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/response.d.ts ./types/response.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/cookies.d.ts ./types/cookies.d.ts && ncp ./src/jsx.d.ts ./types/jsx.d.ts && ncp ./src/jsx-properties.d.ts ./types/jsx-properties.d.ts",
386
+ "types:copy-web": "node ./scripts/copy-types.mjs",
397
387
  "types:web-storage": "tsc --project ./storage/tsconfig.build.json",
398
- "types:web-frames": "tsc --project ./frames/tsconfig.build.json",
399
- "types:copy-serialization": "node -e \"fs.mkdirSync('./serialization/types', { recursive: true }); fs.copyFileSync('../../node_modules/@dom-expressions/runtime/src/serializer.d.ts', './serialization/types/index.d.ts'); fs.copyFileSync('../../node_modules/@dom-expressions/runtime/src/serializer-decode.d.ts', './serialization/types/serializer-decode.d.ts');\"",
400
- "types:copy-server-functions": "node -e \"fs.mkdirSync('./types/server-functions', { recursive: true }); for (const f of ['shared', 'flash', 'client', 'server', 'rich-args']) fs.copyFileSync('../../node_modules/@dom-expressions/runtime/src/server-functions/' + f + '.d.ts', './types/server-functions/' + f + '.d.ts');\"",
401
- "types:copy-frames": "node -e \"fs.mkdirSync('./types/frames', { recursive: true }); for (const f of ['frame-client', 'frame-transport', 'frame-sink', 'serializer']) fs.copyFileSync('../../node_modules/@dom-expressions/runtime/src/' + f + '.d.ts', './types/frames/' + f + '.d.ts'); for (const f of ['client', 'server']) fs.writeFileSync('./types/frames/' + f + '.d.ts', fs.readFileSync('./frames/types/' + f + '.d.ts', 'utf8').replaceAll('@dom-expressions/runtime/src/', './'));\"",
402
388
  "types:cjs": "node ../../scripts/sync-dual-types.mjs ./types ./types-cjs ./storage/types ./storage/types-cjs ./serialization/types ./serialization/types-cjs",
403
389
  "test": "vitest run && vitest run --config vite.config.server.mjs && vitest run --config vite.config.hydrate.mjs",
404
390
  "test:server": "vitest run --config vite.config.server.mjs",
@@ -406,5 +392,17 @@
406
392
  "bench": "vitest bench --run",
407
393
  "bench:server": "vitest bench --run --config vite.config.server-bench.mjs",
408
394
  "test-types": "tsc --project tsconfig.test.json"
395
+ },
396
+ "dependencies": {
397
+ "seroval": "~1.5.4",
398
+ "seroval-plugins": "~1.5.4"
399
+ },
400
+ "peerDependencies": {
401
+ "solid-js": "^2.0.0-rc.3"
402
+ },
403
+ "devDependencies": {
404
+ "@codspeed/vitest-plugin": "^5.4.0",
405
+ "@solidjs/signals": "workspace:*",
406
+ "solid-js": "workspace:*"
409
407
  }
410
- }
408
+ }
@@ -3,7 +3,7 @@
3
3
  var seroval = require('seroval');
4
4
  var web = require('seroval-plugins/web');
5
5
 
6
- const STATE = Symbol.for("dom-expressions.container-trace-state");
6
+ const STATE = Symbol.for("solid.container-trace-state");
7
7
  const state = globalThis[STATE] || (globalThis[STATE] = {
8
8
  materialized: new WeakMap(),
9
9
  materializedValues: new WeakSet()
@@ -11,7 +11,7 @@ const state = globalThis[STATE] || (globalThis[STATE] = {
11
11
  function setContainerTraceStreamMint(fn) {
12
12
  state.streamOf = fn;
13
13
  }
14
- const TRACE = Symbol.for("dom-expressions.container-trace");
14
+ const TRACE = Symbol.for("solid.container-trace");
15
15
  function materialize(marker) {
16
16
  let value = state.materialized.get(marker.$tr);
17
17
  if (value === undefined) {
@@ -30,7 +30,7 @@ function parseTrace(value, ctx) {
30
30
  };
31
31
  }
32
32
  const ContainerTracePlugin = {
33
- tag: "dom-expressions/container-trace",
33
+ tag: "solid/container-trace",
34
34
  test(value) {
35
35
  return value != null && typeof value === "object" && TRACE in value;
36
36
  },
@@ -1,7 +1,7 @@
1
1
  import { Feature, fromCrossJSON, createStream } from 'seroval';
2
2
  import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
3
3
 
4
- const STATE = Symbol.for("dom-expressions.container-trace-state");
4
+ const STATE = Symbol.for("solid.container-trace-state");
5
5
  const state = globalThis[STATE] || (globalThis[STATE] = {
6
6
  materialized: new WeakMap(),
7
7
  materializedValues: new WeakSet()
@@ -9,7 +9,7 @@ const state = globalThis[STATE] || (globalThis[STATE] = {
9
9
  function setContainerTraceStreamMint(fn) {
10
10
  state.streamOf = fn;
11
11
  }
12
- const TRACE = Symbol.for("dom-expressions.container-trace");
12
+ const TRACE = Symbol.for("solid.container-trace");
13
13
  function materialize(marker) {
14
14
  let value = state.materialized.get(marker.$tr);
15
15
  if (value === undefined) {
@@ -28,7 +28,7 @@ function parseTrace(value, ctx) {
28
28
  };
29
29
  }
30
30
  const ContainerTracePlugin = {
31
- tag: "dom-expressions/container-trace",
31
+ tag: "solid/container-trace",
32
32
  test(value) {
33
33
  return value != null && typeof value === "object" && TRACE in value;
34
34
  },
@@ -3,7 +3,7 @@
3
3
  var seroval = require('seroval');
4
4
  var web = require('seroval-plugins/web');
5
5
 
6
- const STATE = Symbol.for("dom-expressions.container-trace-state");
6
+ const STATE = Symbol.for("solid.container-trace-state");
7
7
  const state = globalThis[STATE] || (globalThis[STATE] = {
8
8
  materialized: new WeakMap(),
9
9
  materializedValues: new WeakSet()
@@ -11,7 +11,7 @@ const state = globalThis[STATE] || (globalThis[STATE] = {
11
11
  function setContainerTraceStreamMint(fn) {
12
12
  state.streamOf = fn;
13
13
  }
14
- const TRACE = Symbol.for("dom-expressions.container-trace");
14
+ const TRACE = Symbol.for("solid.container-trace");
15
15
  function materialize(marker) {
16
16
  let value = state.materialized.get(marker.$tr);
17
17
  if (value === undefined) {
@@ -30,7 +30,7 @@ function parseTrace(value, ctx) {
30
30
  };
31
31
  }
32
32
  const ContainerTracePlugin = {
33
- tag: "dom-expressions/container-trace",
33
+ tag: "solid/container-trace",
34
34
  test(value) {
35
35
  return value != null && typeof value === "object" && TRACE in value;
36
36
  },
@@ -135,6 +135,8 @@ function createJSONDataTable(options) {
135
135
  const DEFAULT_DISABLED_FEATURES = seroval.Feature.AggregateError | seroval.Feature.BigIntTypedArray;
136
136
  const serializeOnlyDisabledFeatures = () => process.env.NODE_ENV === "development" ? 0 : seroval.Feature.ErrorPrototypeStack;
137
137
  const HYDRATION_GLOBAL = "_$HY.r";
138
+ const createPlugin = seroval.createPlugin;
139
+ const OpaqueReference = seroval.OpaqueReference;
138
140
  function createSerializer(options) {
139
141
  return new seroval.Serializer({
140
142
  ...options,
@@ -242,19 +244,13 @@ function createJSONSerializer({
242
244
  };
243
245
  }
244
246
 
245
- Object.defineProperty(exports, "OpaqueReference", {
246
- enumerable: true,
247
- get: function () { return seroval.OpaqueReference; }
248
- });
249
- Object.defineProperty(exports, "createPlugin", {
250
- enumerable: true,
251
- get: function () { return seroval.createPlugin; }
252
- });
253
247
  exports.DEFAULT_WEB_PLUGINS = DEFAULT_WEB_PLUGINS;
248
+ exports.OpaqueReference = OpaqueReference;
254
249
  exports.createHydrationSerializer = createHydrationSerializer;
255
250
  exports.createJSONDataTable = createJSONDataTable;
256
251
  exports.createJSONDeserializer = createJSONDeserializer;
257
252
  exports.createJSONSerializer = createJSONSerializer;
253
+ exports.createPlugin = createPlugin;
258
254
  exports.createSerializer = createSerializer;
259
255
  exports.getLocalHeaderScript = getLocalHeaderScript;
260
256
  exports.resolveSerializerPlugins = resolveSerializerPlugins;
@@ -1,8 +1,7 @@
1
- import { Feature, fromCrossJSON, createStream, toCrossJSONStream, Serializer, getCrossReferenceHeader } from 'seroval';
2
- export { OpaqueReference, createPlugin } from 'seroval';
1
+ import { Feature, fromCrossJSON, createStream, OpaqueReference as OpaqueReference$1, createPlugin as createPlugin$1, toCrossJSONStream, Serializer, getCrossReferenceHeader } from 'seroval';
3
2
  import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
4
3
 
5
- const STATE = Symbol.for("dom-expressions.container-trace-state");
4
+ const STATE = Symbol.for("solid.container-trace-state");
6
5
  const state = globalThis[STATE] || (globalThis[STATE] = {
7
6
  materialized: new WeakMap(),
8
7
  materializedValues: new WeakSet()
@@ -10,7 +9,7 @@ const state = globalThis[STATE] || (globalThis[STATE] = {
10
9
  function setContainerTraceStreamMint(fn) {
11
10
  state.streamOf = fn;
12
11
  }
13
- const TRACE = Symbol.for("dom-expressions.container-trace");
12
+ const TRACE = Symbol.for("solid.container-trace");
14
13
  function materialize(marker) {
15
14
  let value = state.materialized.get(marker.$tr);
16
15
  if (value === undefined) {
@@ -29,7 +28,7 @@ function parseTrace(value, ctx) {
29
28
  };
30
29
  }
31
30
  const ContainerTracePlugin = {
32
- tag: "dom-expressions/container-trace",
31
+ tag: "solid/container-trace",
33
32
  test(value) {
34
33
  return value != null && typeof value === "object" && TRACE in value;
35
34
  },
@@ -134,6 +133,8 @@ function createJSONDataTable(options) {
134
133
  const DEFAULT_DISABLED_FEATURES = Feature.AggregateError | Feature.BigIntTypedArray;
135
134
  const serializeOnlyDisabledFeatures = () => process.env.NODE_ENV === "development" ? 0 : Feature.ErrorPrototypeStack;
136
135
  const HYDRATION_GLOBAL = "_$HY.r";
136
+ const createPlugin = createPlugin$1;
137
+ const OpaqueReference = OpaqueReference$1;
137
138
  function createSerializer(options) {
138
139
  return new Serializer({
139
140
  ...options,
@@ -241,4 +242,4 @@ function createJSONSerializer({
241
242
  };
242
243
  }
243
244
 
244
- export { DEFAULT_WEB_PLUGINS, createHydrationSerializer, createJSONDataTable, createJSONDeserializer, createJSONSerializer, createSerializer, getLocalHeaderScript, resolveSerializerPlugins, serializeJSON };
245
+ export { DEFAULT_WEB_PLUGINS, OpaqueReference, createHydrationSerializer, createJSONDataTable, createJSONDeserializer, createJSONSerializer, createPlugin, createSerializer, getLocalHeaderScript, resolveSerializerPlugins, serializeJSON };
@@ -1,182 +1,94 @@
1
- // Serialization surface (published as `@solidjs/web/serialization`): the
2
- // runtime's Seroval machinery, exposed for the runtime's own entries and
3
- // for integrations building transports on the same codec. This is
4
- // INTEGRATION-FACING plumbing, not application API — it is exempt from the
5
- // 2.0 stability guarantee and may change between releases. Application and
6
- // router code should configure `codec` on the server-function entries
7
- // instead of importing from here.
8
- import type { Serializer } from "seroval";
9
- import {
10
- JSONCodecOptions,
11
- PluginInfo,
12
- SerializerPlugin,
13
- SerovalNode
14
- } from "./serializer-decode.js";
15
-
16
- // The decode half — `SerovalNode`, the plugin TYPES, `DEFAULT_WEB_PLUGINS`,
17
- // `resolveSerializerPlugins`, `JSONCodecOptions`, `createJSONDeserializer`,
18
- // `createJSONDataTable` — is declared in serializer-decode.d.ts (published
19
- // as `@solidjs/web/serialization/decode`, the module lazy client consumers
20
- // load) and re-exported here so this remains the full surface.
21
- export * from "./serializer-decode.js";
22
-
23
- // ---- Plugin authoring ----
24
- //
25
- // Unlike the rest of this entry, plugin authoring is APPLICATION-FACING —
26
- // it is the supported way to feed the serializers' `plugins` options and
27
- // the server-function entries' `codec.plugins`. The values re-export
28
- // seroval's own (`createPlugin`, `OpaqueReference` — see serializer.js);
29
- // the plugin TYPES live in serializer-decode.d.ts (hand-declared there —
30
- // see its banner for why).
31
-
32
- /**
33
- * Builds a `SerializerPlugin` — seroval's `createPlugin`, re-exported so
34
- * plugin authors stay on the exact seroval instance/version the runtime
35
- * serializes with. Import it from HERE, not from your own `seroval`
36
- * dependency: a plugin built against a different copy/version would not
37
- * fail the build — it would emit nodes the other peer can't interpret.
38
- *
39
- * Application-facing (see the plugin-authoring banner above).
40
- */
41
- export function createPlugin<Value, Info extends PluginInfo>(
42
- plugin: SerializerPlugin<Value, Info>
43
- ): SerializerPlugin<Value, Info>;
44
-
45
- /**
46
- * Seroval's `OpaqueReference`, re-exported from the runtime's own instance
47
- * (an `OpaqueReference` from another seroval copy fails the serializer's
48
- * instanceof check and serializes as a plain value): wraps a value so it
49
- * crosses the wire as its `replacement` (default `undefined`) while
50
- * staying readable in-process through `.value`.
51
- *
52
- * Application-facing (see the plugin-authoring banner above).
53
- */
54
- export class OpaqueReference<V, R = undefined> {
55
- readonly value: V;
56
- readonly replacement?: R;
57
- constructor(value: V, replacement?: R);
58
- }
59
-
1
+ import { Serializer } from "seroval";
2
+ import type { JSONCodecOptions, PluginInfo, SerializerPlugin, SerovalNode } from "./serializer-decode.js";
3
+ export { DEFAULT_WEB_PLUGINS, createJSONDataTable, createJSONDeserializer, resolveSerializerPlugins } from "./serializer-decode.js";
4
+ export type * from "./serializer-decode.js";
60
5
  /**
61
6
  * Options for `createSerializer`.
62
7
  *
63
8
  * Integration-facing; may change (see the entry banner).
64
9
  */
65
10
  export interface WebSerializerOptions {
66
- /** Name of the global object the emitted scripts write resolved values into. */
67
- globalIdentifier: string;
68
- /** Cross-reference scope id, for isolating multiple streams on one page. */
69
- scopeId?: string;
70
- /**
71
- * Seroval feature bitflags to exclude from output. Defaults to disabling
72
- * post-ES2017 features (AggregateError, BigInt typed arrays). Outside
73
- * development, `Error.prototype.stack` is additionally stripped on top of
74
- * any override — serialized stacks leak server paths to the client.
75
- */
76
- disabledFeatures?: number;
77
- /** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
78
- plugins?: SerializerPlugin[];
79
- /** Receives each emitted script chunk. */
80
- onData: (result: string) => void;
81
- onError?: (error: unknown) => void;
82
- /** Fires once all async values have settled. */
83
- onDone?: () => void;
11
+ /** Name of the global object the emitted scripts write resolved values into. */
12
+ globalIdentifier: string;
13
+ /** Cross-reference scope id, for isolating multiple streams on one page. */
14
+ scopeId?: string;
15
+ /**
16
+ * Seroval feature bitflags to exclude from output. Defaults to disabling
17
+ * post-ES2017 features (AggregateError, BigInt typed arrays). Outside
18
+ * development, `Error.prototype.stack` is additionally stripped on top of
19
+ * any override — serialized stacks leak server paths to the client.
20
+ */
21
+ disabledFeatures?: number;
22
+ /** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
23
+ plugins?: SerializerPlugin[];
24
+ /** Receives each emitted script chunk. */
25
+ onData: (result: string) => void;
26
+ onError?: (error: unknown) => void;
27
+ /** Fires once all async values have settled. */
28
+ onDone?: () => void;
84
29
  }
85
-
86
- /**
87
- * Creates a streaming Seroval serializer preconfigured with the web plugin
88
- * set and the default feature policy. Emits JavaScript chunks (through
89
- * `onData`) that reconstruct the values under `globalIdentifier` when
90
- * evaluated — the script-injection form of serialization renderers build
91
- * on. For a JSON-based wire codec (no eval on the receiving side), use
92
- * `serializeJSON` / `createJSONDeserializer` instead.
93
- *
94
- * Integration-facing; may change (see the entry banner).
95
- */
96
- export function createSerializer(options: WebSerializerOptions): Serializer;
97
-
98
30
  /**
99
31
  * Options for `createHydrationSerializer` — `WebSerializerOptions` minus
100
32
  * the knobs hydration pins (`globalIdentifier`, `disabledFeatures`).
101
33
  * @internal
102
34
  */
103
- export type HydrationSerializerOptions = Omit<
104
- WebSerializerOptions,
105
- "globalIdentifier" | "disabledFeatures"
106
- >;
107
-
108
- /**
109
- * Renderer primitive — the serializer SSR uses for hydration output. Pins
110
- * the hydration global (`_$HY.r`) and feature policy; only the wiring
111
- * options (callbacks, scope, extra plugins) are configurable. Not meant
112
- * for hand-written code — custom serialization should use
113
- * `createSerializer` or the JSON codec.
114
- * @internal
115
- */
116
- export function createHydrationSerializer(options: HydrationSerializerOptions): Serializer;
117
-
118
- /**
119
- * Renderer primitive — returns the cross-reference bootstrap script SSR
120
- * emits ahead of hydration data for a render scope. Not meant for
121
- * hand-written code.
122
- * @internal
123
- */
124
- export function getLocalHeaderScript(id?: string): string;
125
-
126
- // ---- JSON codec (server function transports) ----
127
- // (`JSONCodecOptions` and the decode half are declared in
128
- // serializer-decode.d.ts and re-exported above.)
129
-
35
+ export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures">;
130
36
  /**
131
37
  * Options for `serializeJSON`.
132
38
  *
133
39
  * Integration-facing; may change (see the entry banner).
134
40
  */
135
41
  export interface JSONSerializeOptions extends JSONCodecOptions {
136
- /**
137
- * Receives each serialized node; `initial` is true for the first chunk
138
- * (the source value itself). Async values produce additional chunks as
139
- * they resolve.
140
- */
141
- onParse: (node: SerovalNode, initial: boolean) => void;
142
- onError?: (error: unknown) => void;
143
- /** Fires once all async values have settled. */
144
- onDone?: () => void;
42
+ /**
43
+ * Receives each serialized node; `initial` is true for the first chunk
44
+ * (the source value itself). Async values produce additional chunks as
45
+ * they resolve.
46
+ */
47
+ onParse: (node: SerovalNode, initial: boolean) => void;
48
+ onError?: (error: unknown) => void;
49
+ /** Fires once all async values have settled. */
50
+ onDone?: () => void;
145
51
  }
146
-
147
- /**
148
- * Serializes `value` as SerovalNode chunks delivered through `onParse` —
149
- * the encoding half of the eval-free JSON codec (RPC-style transports;
150
- * the deserializing peer needs no script evaluation, so CSP-safe). Wire
151
- * framing of the nodes is the transport's concern. Returns a cancel
152
- * function that aborts pending async serialization.
153
- *
154
- * Integration-facing; may change (see the entry banner).
155
- */
156
- export function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
157
-
158
52
  /** Options for `createJSONSerializer`. */
159
53
  export interface JSONSerializerOptions extends JSONCodecOptions {
160
- /**
161
- * Receives each keyed record — `initial` is true for a key's first node
162
- * (the written value itself); async values patch through later records
163
- * under the same key. The decoding peer is `createJSONDataTable`.
164
- */
165
- onData: (record: { key: string; node: SerovalNode; initial: boolean }) => void;
166
- onError?: (error: unknown) => void;
167
- /** Fires once `flush()` has been called and every pending value settled. */
168
- onDone?: () => void;
54
+ /**
55
+ * Receives each keyed record — `initial` is true for a key's first node
56
+ * (the written value itself); async values patch through later records
57
+ * under the same key. The decoding peer is `createJSONDataTable`.
58
+ */
59
+ onData: (record: {
60
+ key: string;
61
+ node: SerovalNode;
62
+ initial: boolean;
63
+ }) => void;
64
+ onError?: (error: unknown) => void;
65
+ /** Fires once `flush()` has been called and every pending value settled. */
66
+ onDone?: () => void;
67
+ }
68
+ export declare const createPlugin: <Value, Info extends PluginInfo>(plugin: SerializerPlugin<Value, Info>) => SerializerPlugin<Value, Info>;
69
+ export interface OpaqueReference<V = unknown, R = undefined> {
70
+ readonly value: V;
71
+ readonly replacement?: R;
169
72
  }
170
-
73
+ export declare const OpaqueReference: {
74
+ new <V, R = undefined>(value: V, replacement?: R): OpaqueReference<V, R>;
75
+ };
171
76
  /**
172
- * The keyed, streaming encoder of the eval-free JSON codec — the render
173
- * stream's data serializer (frames default to it). Each `write(key, value)`
174
- * shares one reference space, so cross-record identity holds; `flush()`
175
- * marks the write set complete (writes after it are dropped, mirroring the
176
- * hydration serializer); `close()` aborts pending async serialization.
77
+ * Creates a streaming Seroval serializer preconfigured with the web plugin
78
+ * set and the default feature policy. Emits JavaScript chunks (through
79
+ * `onData`) that reconstruct the values under `globalIdentifier` when
80
+ * evaluated the script-injection form of serialization renderers build
81
+ * on. For a JSON-based wire codec (no eval on the receiving side), use
82
+ * `serializeJSON` / `createJSONDeserializer` instead.
83
+ *
84
+ * Integration-facing; may change (see the entry banner).
177
85
  */
178
- export function createJSONSerializer(options: JSONSerializerOptions): {
179
- write(key: string, value: unknown): void;
180
- flush(): void;
181
- close(): void;
86
+ export declare function createSerializer(options: WebSerializerOptions): Serializer;
87
+ export declare function createHydrationSerializer(options: HydrationSerializerOptions): Serializer;
88
+ export declare function getLocalHeaderScript(id?: string): string;
89
+ export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
90
+ export declare function createJSONSerializer(options: JSONSerializerOptions): {
91
+ write(key: string, value: unknown): void;
92
+ flush(): void;
93
+ close(): void;
182
94
  };