@solidjs/web 2.0.0-rc.1 → 2.0.0-rc.10

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 (107) hide show
  1. package/dist/server.dev.js +4472 -0
  2. package/dist/server.js +1301 -251
  3. package/dist/{server.cjs → server.observe.js} +1501 -452
  4. package/dist/{dev.cjs → web.dev.js} +699 -360
  5. package/dist/web.js +454 -139
  6. package/dist/{dev.js → web.observe.js} +505 -211
  7. package/frames/dist/client.dev.js +463 -71
  8. package/frames/dist/client.js +363 -70
  9. package/frames/dist/{client.dev.cjs → client.observe.js} +486 -133
  10. package/frames/dist/server.dev.js +1713 -0
  11. package/frames/dist/server.js +552 -2583
  12. package/frames/dist/server.observe.js +1713 -0
  13. package/frames/package.json +2 -25
  14. package/package.json +214 -255
  15. package/performance-tracks/dist/performance-tracks.dev.js +678 -0
  16. package/performance-tracks/dist/performance-tracks.js +6 -0
  17. package/performance-tracks/dist/performance-tracks.observe.js +666 -0
  18. package/performance-tracks/package.json +7 -0
  19. package/performance-tracks/types/index.d.ts +67 -0
  20. package/serialization/decode/package.json +2 -15
  21. package/serialization/dist/decode.js +92 -15
  22. package/serialization/dist/serialization.js +103 -23
  23. package/serialization/package.json +2 -15
  24. package/serialization/types/index.d.ts +76 -157
  25. package/serialization/types/serializer-decode.d.ts +149 -112
  26. package/serialization/types/serializer.d.ts +101 -0
  27. package/server-functions/dist/client.dev.js +1364 -0
  28. package/server-functions/dist/client.js +611 -97
  29. package/server-functions/dist/client.observe.js +1343 -0
  30. package/server-functions/dist/server.dev.js +2138 -202
  31. package/server-functions/dist/server.js +2042 -199
  32. package/server-functions/dist/server.observe.js +3043 -0
  33. package/server-functions/package.json +2 -35
  34. package/server-functions/rich-args/package.json +2 -15
  35. package/storage/package.json +2 -15
  36. package/types/client.d.ts +193 -288
  37. package/types/constants.d.ts +20 -0
  38. package/types/cookies.d.ts +32 -84
  39. package/types/diagnostics.d.ts +56 -0
  40. package/types/frames/client.d.ts +1 -1
  41. package/types/frames/frame-client.d.ts +323 -259
  42. package/types/frames/frame-container-plugin.d.ts +72 -0
  43. package/types/frames/frame-sink.d.ts +101 -158
  44. package/types/frames/frame-transport.d.ts +192 -190
  45. package/types/frames/serializer-decode.d.ts +219 -0
  46. package/types/frames/serializer.d.ts +76 -157
  47. package/types/frames/server.d.ts +1 -1
  48. package/types/head.d.ts +19 -0
  49. package/types/index.d.ts +52 -80
  50. package/types/index.server.d.ts +174 -0
  51. package/types/jsx.d.ts +33 -35
  52. package/types/observe.d.ts +358 -0
  53. package/types/reconcile.d.ts +1 -0
  54. package/types/render.d.ts +9 -0
  55. package/types/response.d.ts +75 -150
  56. package/types/serializer-decode.d.ts +149 -112
  57. package/types/serializer.d.ts +76 -157
  58. package/types/server-functions/client.d.ts +192 -194
  59. package/types/server-functions/flash.d.ts +28 -30
  60. package/types/server-functions/registry.d.ts +102 -0
  61. package/types/server-functions/rich-args.d.ts +1 -10
  62. package/types/server-functions/server.d.ts +511 -475
  63. package/types/server-functions/shared.d.ts +366 -425
  64. package/types/server-mock.d.ts +110 -13
  65. package/types/server-observe.d.ts +77 -0
  66. package/types/server.d.ts +425 -425
  67. package/types/trace.d.ts +127 -0
  68. package/LICENSE +0 -21
  69. package/dist/web.cjs +0 -2008
  70. package/frames/dist/client.cjs +0 -1916
  71. package/frames/dist/server.cjs +0 -3756
  72. package/serialization/dist/decode.cjs +0 -122
  73. package/serialization/dist/serialization.cjs +0 -244
  74. package/serialization/types-cjs/index.d.cts +0 -182
  75. package/serialization/types-cjs/package.json +0 -3
  76. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  77. package/server-functions/dist/client.cjs +0 -793
  78. package/server-functions/dist/rich-args.cjs +0 -11
  79. package/server-functions/dist/server.cjs +0 -1171
  80. package/server-functions/dist/server.dev.cjs +0 -1171
  81. package/storage/dist/storage.cjs +0 -12
  82. package/storage/types-cjs/index.d.cts +0 -28
  83. package/storage/types-cjs/package.json +0 -3
  84. package/types/core.d.ts +0 -6
  85. package/types-cjs/client.d.cts +0 -337
  86. package/types-cjs/cookies.d.cts +0 -93
  87. package/types-cjs/core.d.cts +0 -6
  88. package/types-cjs/frames/client.d.cts +0 -36
  89. package/types-cjs/frames/frame-client.d.cts +0 -338
  90. package/types-cjs/frames/frame-sink.d.cts +0 -194
  91. package/types-cjs/frames/frame-transport.d.cts +0 -222
  92. package/types-cjs/frames/serializer.d.cts +0 -182
  93. package/types-cjs/frames/server.d.cts +0 -52
  94. package/types-cjs/index.d.cts +0 -244
  95. package/types-cjs/jsx-properties.d.cts +0 -93
  96. package/types-cjs/jsx.d.cts +0 -4159
  97. package/types-cjs/package.json +0 -3
  98. package/types-cjs/response.d.cts +0 -174
  99. package/types-cjs/serializer-decode.d.cts +0 -182
  100. package/types-cjs/serializer.d.cts +0 -182
  101. package/types-cjs/server-functions/client.d.cts +0 -231
  102. package/types-cjs/server-functions/flash.d.cts +0 -38
  103. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  104. package/types-cjs/server-functions/server.d.cts +0 -616
  105. package/types-cjs/server-functions/shared.d.cts +0 -523
  106. package/types-cjs/server-mock.d.cts +0 -277
  107. package/types-cjs/server.d.cts +0 -523
@@ -1,182 +0,0 @@
1
- // The DECODE half of the serialization surface (published as
2
- // `@solidjs/web/serialization/decode`): what reading a serialized payload
3
- // needs — `fromCrossJSON`-backed deserializers and the shared plugin set —
4
- // with none of the encode machinery. Lazy client consumers (the frames
5
- // data tables, `deserializeStream`) load this module so the encode half
6
- // never ships to a browser that only reads. The full serializer.d.ts
7
- // re-exports everything here; see its banner for the stability contract
8
- // (integration-facing, exempt from the 2.0 stability guarantee).
9
- // ---- Plugin types ----
10
- //
11
- // Declared here by hand (seroval's published d.ts use extensionless
12
- // ESM-relative imports that `moduleResolution: "nodenext"` cannot follow —
13
- // a bare type re-export would silently degrade the surface to `any` under
14
- // skipLibCheck, and an import would make every entry whose types reach
15
- // this module — the MAIN client entry included, via the server-function
16
- // seam's `JSONCodecOptions` — unimportable from a strict Node16 CJS
17
- // consumer). The declarations mirror seroval ~1.5 exactly; the `~` pin is
18
- // what makes mirroring safe. Plugin AUTHORING (`createPlugin`,
19
- // `OpaqueReference`) lives on the full serialization entry.
20
-
21
- /**
22
- * Seroval's node shape — the intermediate representation `serializeJSON`
23
- * emits and `createJSONDeserializer` consumes. Safe to `JSON.stringify`.
24
- * Declared by hand like the plugin types below (same rationale): the
25
- * observable envelope — a numeric type tag, an optional reference id —
26
- * with the rest owned by the codec. Real seroval nodes satisfy it; treat
27
- * it as an opaque token.
28
- *
29
- * Integration-facing; may change (see the entry banner).
30
- */
31
- export interface SerovalNode {
32
- /** Node type tag (seroval-internal enum). */
33
- t: number;
34
- /** Reference id, when the node participates in cross-referencing. */
35
- i?: number | undefined;
36
- [key: string]: unknown;
37
- }
38
-
39
- /** Per-plugin bookkeeping seroval hands each plugin callback. */
40
- export interface PluginData {
41
- id: number;
42
- }
43
-
44
- /**
45
- * The shape of a plugin's parsed payload: a map of `SerovalNode`s produced
46
- * by the parse contexts, consumed by `serialize`/`deserialize`.
47
- */
48
- export type PluginInfo = { [key: string]: SerovalNode };
49
-
50
- /** Parse context for `parse.sync`: turns child values into nodes. */
51
- export interface SyncParsePluginContext {
52
- parse<T>(current: T): SerovalNode;
53
- }
54
-
55
- /** Parse context for `parse.async`: like sync, but child parses await. */
56
- export interface AsyncParsePluginContext {
57
- parse<T>(current: T): Promise<SerovalNode>;
58
- }
59
-
60
- /**
61
- * Parse context for `parse.stream`: sync parsing plus the streaming
62
- * lifecycle (pending-state tracking, late node emission, cleanup).
63
- */
64
- export interface StreamParsePluginContext {
65
- parse<T>(current: T): SerovalNode;
66
- parseWithError<T>(current: T): SerovalNode | undefined;
67
- isAlive(): boolean;
68
- pushPendingState(): void;
69
- popPendingState(): void;
70
- onParse(node: SerovalNode): void;
71
- onError(error: unknown): void;
72
- addCleanup(callback: () => void): void;
73
- }
74
-
75
- /** Serialize context: renders child nodes to JS source. */
76
- export interface SerializePluginContext {
77
- serialize(node: SerovalNode): string;
78
- }
79
-
80
- /** Deserialize context: revives child nodes to runtime values. */
81
- export interface DeserializePluginContext {
82
- deserialize<T>(node: SerovalNode): T;
83
- }
84
-
85
- /**
86
- * A Seroval plugin usable with the web serializers — teaches the codec how
87
- * to encode/decode a custom value type (`Value` is the value it matches,
88
- * `Info` its parsed payload). Supply matching plugins on both peers of a
89
- * transport. Bare `SerializerPlugin` (both parameters defaulted to `any`)
90
- * is the list-element type every `plugins` option accepts.
91
- *
92
- * Integration-facing; may change (see the entry banner).
93
- */
94
- export interface SerializerPlugin<Value = any, Info extends PluginInfo = any> {
95
- /** A unique string identifying the plugin — namespace it (`"app/Thing"`). */
96
- tag: string;
97
- /** Dependency plugins, resolved ahead of this one. */
98
- extends?: SerializerPlugin[];
99
- /** Whether `value` is this plugin's to encode. */
100
- test(value: unknown): boolean;
101
- /** Parsing modes — provide the ones the transports you target use. */
102
- parse: {
103
- sync?: (value: Value, ctx: SyncParsePluginContext, data: PluginData) => Info;
104
- async?: (value: Value, ctx: AsyncParsePluginContext, data: PluginData) => Promise<Info>;
105
- stream?: (value: Value, ctx: StreamParsePluginContext, data: PluginData) => Info;
106
- };
107
- /** Renders the parsed payload as JS source (script-injection form). */
108
- serialize(node: Info, ctx: SerializePluginContext, data: PluginData): string;
109
- /** Revives the parsed payload back into the runtime value. */
110
- deserialize(node: Info, ctx: DeserializePluginContext, data: PluginData): Value;
111
- }
112
-
113
- /**
114
- * Baseline plugin set for serializing web-platform values (AbortSignal,
115
- * Event, FormData, Headers, ReadableStream, Request, Response, URL, ...).
116
- * Applied by every serializer in this module; custom plugins compose ahead
117
- * of it via `resolveSerializerPlugins`.
118
- *
119
- * Integration-facing; may change (see the entry banner).
120
- */
121
- export const DEFAULT_WEB_PLUGINS: readonly SerializerPlugin[];
122
-
123
- /**
124
- * Composes custom plugins with `DEFAULT_WEB_PLUGINS`. Custom plugins come
125
- * first so they can shadow a default for values both would match. Returns a
126
- * fresh array; the defaults are never mutated. Useful when handing a full
127
- * plugin list to another serialization layer.
128
- *
129
- * Integration-facing; may change (see the entry banner).
130
- */
131
- export function resolveSerializerPlugins(customPlugins?: SerializerPlugin[]): SerializerPlugin[];
132
-
133
- /**
134
- * Options shared by both halves of the JSON codec. All of them must match
135
- * on the serializing and deserializing peer or payloads will not
136
- * round-trip — for server functions, set them once through the
137
- * client/server `codec` config option.
138
- *
139
- * Integration-facing; may change (see the entry banner).
140
- */
141
- export interface JSONCodecOptions {
142
- /** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. Must match on both peers. */
143
- plugins?: SerializerPlugin[];
144
- /**
145
- * Seroval feature bitflags to exclude. Defaults to disabling `RegExp`
146
- * (payloads may come from an untrusted peer). Must match on both peers.
147
- * Outside development, the encoding side additionally strips
148
- * `Error.prototype.stack` on top of any override — serialized stacks leak
149
- * server paths to the client. Decoding stays permissive, so payloads from
150
- * a development peer still round-trip.
151
- */
152
- disabledFeatures?: number;
153
- /** Maximum parse/deserialize depth. Defaults to 64. Must match on both peers. */
154
- depthLimit?: number;
155
- }
156
-
157
- /**
158
- * Creates the decoding counterpart of `serializeJSON`. Cross-references
159
- * between chunks resolve through state shared across calls, so all chunks
160
- * from one stream must go through the same deserializer instance. The first
161
- * chunk's return value is the decoded source value; feeding later chunks
162
- * settles the async values referenced inside it.
163
- *
164
- * Integration-facing; may change (see the entry banner).
165
- */
166
- export function createJSONDeserializer(options?: JSONCodecOptions): <T>(node: SerovalNode) => T;
167
-
168
- /**
169
- * A resident, response-scoped decode table over the keyed JSON codec: apply
170
- * each frame `data` chunk with `apply`, resolve `{ $ref }` slot args with
171
- * `resolve`. The frames client host wires one per response
172
- * (`applyData: c => table.apply(c)`).
173
- *
174
- * Integration-facing; may change (see the entry banner). This serialization
175
- * entry is the single home of the data table — the frames client consumes
176
- * it internally rather than re-exporting it.
177
- */
178
- export interface JSONDataTable {
179
- apply(chunk: { key?: string; node?: unknown; initial?: boolean }): void;
180
- resolve<T = unknown>(ref: { $ref: string }): T;
181
- }
182
- export function createJSONDataTable(options?: JSONCodecOptions): JSONDataTable;