@solidjs/web 2.0.0-rc.7 → 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 (72) hide show
  1. package/dist/server.dev.js +15 -2
  2. package/dist/server.js +15 -2
  3. package/dist/web.dev.js +41 -9
  4. package/dist/web.js +39 -8
  5. package/dist/{web.cjs → web.observe.js} +137 -239
  6. package/frames/dist/server.dev.js +19 -0
  7. package/frames/dist/server.js +19 -0
  8. package/frames/package.json +6 -24
  9. package/package.json +81 -314
  10. package/serialization/decode/package.json +3 -9
  11. package/serialization/package.json +3 -9
  12. package/serialization/types/serializer-decode.d.ts +49 -2
  13. package/server-functions/dist/server.dev.js +28 -10
  14. package/server-functions/dist/server.js +28 -10
  15. package/server-functions/package.json +6 -24
  16. package/server-functions/rich-args/package.json +3 -9
  17. package/storage/package.json +3 -9
  18. package/types/client.d.ts +17 -0
  19. package/types/frames/serializer-decode.d.ts +49 -2
  20. package/types/serializer-decode.d.ts +49 -2
  21. package/types/server-functions/server.d.ts +27 -4
  22. package/types/server.d.ts +1 -1
  23. package/dist/server.cjs +0 -3708
  24. package/dist/server.dev.cjs +0 -3794
  25. package/dist/web.dev.cjs +0 -2285
  26. package/frames/dist/client.cjs +0 -2043
  27. package/frames/dist/client.dev.cjs +0 -2063
  28. package/frames/dist/server.cjs +0 -4542
  29. package/frames/dist/server.dev.cjs +0 -4584
  30. package/serialization/dist/decode.cjs +0 -155
  31. package/serialization/dist/serialization.cjs +0 -275
  32. package/serialization/types-cjs/index.d.cts +0 -101
  33. package/serialization/types-cjs/package.json +0 -3
  34. package/serialization/types-cjs/serializer-decode.d.cts +0 -172
  35. package/serialization/types-cjs/serializer.d.cts +0 -101
  36. package/server-functions/dist/client.cjs +0 -1069
  37. package/server-functions/dist/rich-args.cjs +0 -11
  38. package/server-functions/dist/server.cjs +0 -2381
  39. package/server-functions/dist/server.dev.cjs +0 -2409
  40. package/storage/dist/storage.cjs +0 -12
  41. package/storage/types-cjs/index.d.cts +0 -28
  42. package/storage/types-cjs/package.json +0 -3
  43. package/types-cjs/client.d.cts +0 -197
  44. package/types-cjs/constants.d.cts +0 -20
  45. package/types-cjs/cookies.d.cts +0 -41
  46. package/types-cjs/frames/client.d.cts +0 -36
  47. package/types-cjs/frames/frame-client.d.cts +0 -370
  48. package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
  49. package/types-cjs/frames/frame-sink.d.cts +0 -92
  50. package/types-cjs/frames/frame-transport.d.cts +0 -189
  51. package/types-cjs/frames/serializer-decode.d.cts +0 -172
  52. package/types-cjs/frames/serializer.d.cts +0 -101
  53. package/types-cjs/frames/server.d.cts +0 -52
  54. package/types-cjs/head.d.cts +0 -19
  55. package/types-cjs/index.d.cts +0 -191
  56. package/types-cjs/index.server.d.cts +0 -147
  57. package/types-cjs/jsx-properties.d.cts +0 -93
  58. package/types-cjs/jsx.d.cts +0 -4146
  59. package/types-cjs/package.json +0 -3
  60. package/types-cjs/reconcile.d.cts +0 -1
  61. package/types-cjs/render.d.cts +0 -6
  62. package/types-cjs/response.d.cts +0 -81
  63. package/types-cjs/serializer-decode.d.cts +0 -172
  64. package/types-cjs/serializer.d.cts +0 -101
  65. package/types-cjs/server-functions/client.d.cts +0 -184
  66. package/types-cjs/server-functions/flash.d.cts +0 -36
  67. package/types-cjs/server-functions/registry.d.cts +0 -100
  68. package/types-cjs/server-functions/rich-args.d.cts +0 -1
  69. package/types-cjs/server-functions/server.d.cts +0 -546
  70. package/types-cjs/server-functions/shared.d.cts +0 -283
  71. package/types-cjs/server-mock.d.cts +0 -337
  72. package/types-cjs/server.d.cts +0 -408
@@ -1,172 +0,0 @@
1
- /**
2
- * Seroval's node shape — the intermediate representation `serializeJSON`
3
- * emits and `createJSONDeserializer` consumes. Safe to `JSON.stringify`.
4
- * Declared by hand like the plugin types below (same rationale): the
5
- * observable envelope — a numeric type tag, an optional reference id —
6
- * with the rest owned by the codec. Real seroval nodes satisfy it; treat
7
- * it as an opaque token.
8
- *
9
- * Integration-facing; may change (see the entry banner).
10
- */
11
- export interface SerovalNode {
12
- /** Node type tag (seroval-internal enum). */
13
- t: number;
14
- /** Reference id, when the node participates in cross-referencing. */
15
- i?: number | undefined;
16
- [key: string]: unknown;
17
- }
18
- /** Per-plugin bookkeeping seroval hands each plugin callback. */
19
- export interface PluginData {
20
- id: number;
21
- }
22
- /**
23
- * The shape of a plugin's parsed payload: a map of `SerovalNode`s produced
24
- * by the parse contexts, consumed by `serialize`/`deserialize`.
25
- */
26
- export type PluginInfo = {
27
- [key: string]: SerovalNode;
28
- };
29
- /** Parse context for `parse.sync`: turns child values into nodes. */
30
- export interface SyncParsePluginContext {
31
- parse<T>(current: T): SerovalNode;
32
- }
33
- /** Parse context for `parse.async`: like sync, but child parses await. */
34
- export interface AsyncParsePluginContext {
35
- parse<T>(current: T): Promise<SerovalNode>;
36
- }
37
- /**
38
- * Parse context for `parse.stream`: sync parsing plus the streaming
39
- * lifecycle (pending-state tracking, late node emission, cleanup).
40
- */
41
- export interface StreamParsePluginContext {
42
- parse<T>(current: T): SerovalNode;
43
- parseWithError<T>(current: T): SerovalNode | undefined;
44
- isAlive(): boolean;
45
- pushPendingState(): void;
46
- popPendingState(): void;
47
- onParse(node: SerovalNode): void;
48
- onError(error: unknown): void;
49
- addCleanup(callback: () => void): void;
50
- }
51
- /** Serialize context: renders child nodes to JS source. */
52
- export interface SerializePluginContext {
53
- serialize(node: SerovalNode): string;
54
- }
55
- /** Deserialize context: revives child nodes to runtime values. */
56
- export interface DeserializePluginContext {
57
- deserialize<T>(node: SerovalNode): T;
58
- }
59
- /**
60
- * A Seroval plugin usable with the web serializers — teaches the codec how
61
- * to encode/decode a custom value type (`Value` is the value it matches,
62
- * `Info` its parsed payload). Supply matching plugins on both peers of a
63
- * transport. Bare `SerializerPlugin` (both parameters defaulted to `any`)
64
- * is the list-element type every `plugins` option accepts.
65
- *
66
- * Integration-facing; may change (see the entry banner).
67
- */
68
- export interface SerializerPlugin<Value = any, Info extends PluginInfo = any> {
69
- /** A unique string identifying the plugin — namespace it (`"app/Thing"`). */
70
- tag: string;
71
- /** Dependency plugins, resolved ahead of this one. */
72
- extends?: SerializerPlugin[];
73
- /** Whether `value` is this plugin's to encode. */
74
- test(value: unknown): boolean;
75
- /** Parsing modes — provide the ones the transports you target use. */
76
- parse: {
77
- sync?: (value: Value, ctx: SyncParsePluginContext, data: PluginData) => Info;
78
- async?: (value: Value, ctx: AsyncParsePluginContext, data: PluginData) => Promise<Info>;
79
- stream?: (value: Value, ctx: StreamParsePluginContext, data: PluginData) => Info;
80
- };
81
- /** Renders the parsed payload as JS source (script-injection form). */
82
- serialize(node: Info, ctx: SerializePluginContext, data: PluginData): string;
83
- /** Revives the parsed payload back into the runtime value. */
84
- deserialize(node: Info, ctx: DeserializePluginContext, data: PluginData): Value;
85
- }
86
- /**
87
- * Options shared by both halves of the JSON codec. All of them must match
88
- * on the serializing and deserializing peer or payloads will not
89
- * round-trip — for server functions, set them once through the
90
- * client/server `codec` config option.
91
- *
92
- * Integration-facing; may change (see the entry banner).
93
- */
94
- export interface JSONCodecOptions {
95
- /** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. Must match on both peers. */
96
- plugins?: SerializerPlugin[];
97
- /**
98
- * Seroval feature bitflags to exclude. Defaults to disabling `RegExp`
99
- * (payloads may come from an untrusted peer). Must match on both peers.
100
- * Outside development, the encoding side additionally strips
101
- * `Error.prototype.stack` on top of any override — serialized stacks leak
102
- * server paths to the client. Decoding stays permissive, so payloads from
103
- * a development peer still round-trip.
104
- */
105
- disabledFeatures?: number;
106
- /** Maximum parse/deserialize depth. Defaults to 64. Must match on both peers. */
107
- depthLimit?: number;
108
- /**
109
- * Whether serialized `Error`s carry their `.stack` — server file paths,
110
- * internal function names, the shape of the deployment — to the peer.
111
- * Defaults to `NODE_ENV === "development"`, but that signal describes the
112
- * PROCESS, not the artifact: a production build running with
113
- * `NODE_ENV=development` (a base image, a stray dotenv) ships stacks to
114
- * the wire — including for errors marked safe with `markSafeError`, whose
115
- * stacks traverse application code (#3152). Set `false` to pin production
116
- * disclosure regardless of the ambient variable. Encode-side only; the
117
- * decode side is always permissive, so it need not match peers.
118
- */
119
- serializeErrorStacks?: boolean;
120
- }
121
- /**
122
- * A resident, response-scoped decode table over the keyed JSON codec: apply
123
- * each frame `data` chunk with `apply`, resolve `{ $ref }` slot args with
124
- * `resolve`. The frames client host wires one per response
125
- * (`applyData: c => table.apply(c)`).
126
- *
127
- * Integration-facing; may change (see the entry banner). This serialization
128
- * entry is the single home of the data table — the frames client consumes
129
- * it internally rather than re-exporting it.
130
- */
131
- export interface JSONDataTable {
132
- apply(chunk: {
133
- key?: string;
134
- node?: unknown;
135
- initial?: boolean;
136
- }): void;
137
- resolve<T = unknown>(ref: {
138
- $ref: string;
139
- }): T;
140
- }
141
- /**
142
- * Baseline plugin set for serializing web-platform values. Shared by the
143
- * hydration serializer and any consumer building its own serializer (e.g.
144
- * server function transports). Plugin objects carry both their serialize
145
- * and deserialize halves, so the set lives on the decode side and the
146
- * encode module composes over it.
147
- */
148
- export declare const DEFAULT_WEB_PLUGINS: any; /**
149
- * Composes custom plugins with `DEFAULT_WEB_PLUGINS`. Custom plugins come
150
- * first so they can shadow a default for values both would match. Returns a
151
- * fresh array; the defaults are never mutated. Useful when handing a full
152
- * plugin list to another serialization layer.
153
- *
154
- * Integration-facing; may change (see the entry banner).
155
- */
156
- export declare function resolveSerializerPlugins(customPlugins?: SerializerPlugin[]): SerializerPlugin[];
157
- export declare function resolveCodecOptions({ plugins, disabledFeatures, depthLimit, serializeErrorStacks }?: JSONCodecOptions): {
158
- plugins: SerializerPlugin<any, any>[];
159
- disabledFeatures: any;
160
- depthLimit: number;
161
- serializeErrorStacks: boolean;
162
- }; /**
163
- * Creates the decoding counterpart of `serializeJSON`. Cross-references
164
- * between chunks resolve through state shared across calls, so all chunks
165
- * from one stream must go through the same deserializer instance. The first
166
- * chunk's return value is the decoded source value; feeding later chunks
167
- * settles the async values referenced inside it.
168
- *
169
- * Integration-facing; may change (see the entry banner).
170
- */
171
- export declare function createJSONDeserializer(options?: JSONCodecOptions): <T>(node: SerovalNode) => T;
172
- export declare function createJSONDataTable(options?: JSONCodecOptions): JSONDataTable;
@@ -1,101 +0,0 @@
1
- import { Serializer } from "seroval";
2
- import type { JSONCodecOptions, PluginInfo, SerializerPlugin, SerovalNode } from "./serializer-decode.cjs";
3
- export { DEFAULT_WEB_PLUGINS, createJSONDataTable, createJSONDeserializer, resolveSerializerPlugins } from "./serializer-decode.cjs";
4
- export type * from "./serializer-decode.cjs";
5
- /**
6
- * Options for `createSerializer`.
7
- *
8
- * Integration-facing; may change (see the entry banner).
9
- */
10
- export interface WebSerializerOptions {
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
- /**
23
- * Whether serialized `Error`s carry their `.stack`. Defaults to
24
- * `NODE_ENV === "development"`; set `false` to pin production disclosure
25
- * to the deployment rather than the ambient variable (#3152 — see
26
- * `JSONCodecOptions.serializeErrorStacks`).
27
- */
28
- serializeErrorStacks?: boolean;
29
- /** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
30
- plugins?: SerializerPlugin[];
31
- /** Receives each emitted script chunk. */
32
- onData: (result: string) => void;
33
- onError?: (error: unknown) => void;
34
- /** Fires once all async values have settled. */
35
- onDone?: () => void;
36
- }
37
- /**
38
- * Options for `createHydrationSerializer` — `WebSerializerOptions` minus
39
- * the knobs hydration pins (`globalIdentifier`, `disabledFeatures`).
40
- * @internal
41
- */
42
- export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures">;
43
- /**
44
- * Options for `serializeJSON`.
45
- *
46
- * Integration-facing; may change (see the entry banner).
47
- */
48
- export interface JSONSerializeOptions extends JSONCodecOptions {
49
- /**
50
- * Receives each serialized node; `initial` is true for the first chunk
51
- * (the source value itself). Async values produce additional chunks as
52
- * they resolve.
53
- */
54
- onParse: (node: SerovalNode, initial: boolean) => void;
55
- onError?: (error: unknown) => void;
56
- /** Fires once all async values have settled. */
57
- onDone?: () => void;
58
- }
59
- /** Options for `createJSONSerializer`. */
60
- export interface JSONSerializerOptions extends JSONCodecOptions {
61
- /**
62
- * Receives each keyed record — `initial` is true for a key's first node
63
- * (the written value itself); async values patch through later records
64
- * under the same key. The decoding peer is `createJSONDataTable`.
65
- */
66
- onData: (record: {
67
- key: string;
68
- node: SerovalNode;
69
- initial: boolean;
70
- }) => void;
71
- onError?: (error: unknown) => void;
72
- /** Fires once `flush()` has been called and every pending value settled. */
73
- onDone?: () => void;
74
- }
75
- export declare const createPlugin: <Value, Info extends PluginInfo>(plugin: SerializerPlugin<Value, Info>) => SerializerPlugin<Value, Info>;
76
- export interface OpaqueReference<V = unknown, R = undefined> {
77
- readonly value: V;
78
- readonly replacement?: R;
79
- }
80
- export declare const OpaqueReference: {
81
- new <V, R = undefined>(value: V, replacement?: R): OpaqueReference<V, R>;
82
- };
83
- /**
84
- * Creates a streaming Seroval serializer preconfigured with the web plugin
85
- * set and the default feature policy. Emits JavaScript chunks (through
86
- * `onData`) that reconstruct the values under `globalIdentifier` when
87
- * evaluated — the script-injection form of serialization renderers build
88
- * on. For a JSON-based wire codec (no eval on the receiving side), use
89
- * `serializeJSON` / `createJSONDeserializer` instead.
90
- *
91
- * Integration-facing; may change (see the entry banner).
92
- */
93
- export declare function createSerializer(options: WebSerializerOptions): Serializer;
94
- export declare function createHydrationSerializer(options: HydrationSerializerOptions): Serializer;
95
- export declare function getLocalHeaderScript(id?: string): string;
96
- export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
97
- export declare function createJSONSerializer(options: JSONSerializerOptions): {
98
- write(key: string, value: unknown): void;
99
- flush(): void;
100
- close(): void;
101
- };