@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.20
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.
- package/README.md +1 -1
- package/dist/server.dev.js +5065 -0
- package/dist/server.js +1757 -355
- package/dist/{server.cjs → server.observe.js} +1951 -558
- package/dist/{dev.cjs → web.dev.js} +945 -550
- package/dist/web.js +635 -332
- package/dist/{dev.js → web.observe.js} +688 -403
- package/frames/dist/assets.js +92 -0
- package/frames/dist/client.dev.js +1296 -1198
- package/frames/dist/client.js +1128 -1191
- package/frames/dist/client.observe.js +2041 -0
- package/frames/dist/regions.js +171 -0
- package/frames/dist/server.dev.js +2549 -0
- package/frames/dist/server.js +1688 -3005
- package/frames/dist/server.observe.js +2548 -0
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +594 -0
- package/frames/package.json +2 -25
- package/package.json +244 -256
- package/performance-tracks/dist/performance-tracks.dev.js +679 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +667 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +69 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +121 -25
- package/serialization/dist/serialization.js +242 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +85 -158
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +109 -0
- package/server-functions/dist/client.dev.js +1462 -0
- package/server-functions/dist/client.js +667 -165
- package/server-functions/dist/client.observe.js +1441 -0
- package/server-functions/dist/rich-args.js +84 -1
- package/server-functions/dist/server.dev.js +2714 -297
- package/server-functions/dist/server.js +2595 -271
- package/server-functions/dist/server.observe.js +3594 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/skills/server-components/SKILL.md +117 -0
- package/storage/package.json +2 -15
- package/types/client.d.ts +342 -288
- package/types/constants.d.ts +22 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +80 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/client.d.ts +40 -1
- package/types/frames/frame-client.d.ts +443 -280
- package/types/frames/frame-container-plugin.d.ts +64 -0
- package/types/frames/frame-morph.d.ts +29 -0
- package/types/frames/frame-sink.d.ts +141 -161
- package/types/frames/frame-transport.d.ts +263 -184
- package/types/frames/regions-tier.d.ts +60 -0
- package/types/frames/serializer-decode.d.ts +241 -0
- package/types/frames/serializer.d.ts +85 -158
- package/types/frames/server.d.ts +2 -2
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/frames/wire-tier.d.ts +169 -0
- package/types/head.d.ts +20 -0
- package/types/index.d.ts +98 -81
- package/types/index.server.d.ts +159 -0
- package/types/jsx.d.ts +49 -44
- package/types/observe.d.ts +535 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +11 -0
- package/types/request-error-hook.d.ts +5 -0
- package/types/response.d.ts +95 -147
- package/types/serializer-decode.d.ts +173 -114
- package/types/serializer.d.ts +85 -158
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +238 -223
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +105 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +539 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +50 -0
- package/types/server-mock.d.ts +120 -13
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +571 -422
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2033
- package/frames/dist/client.cjs +0 -2002
- package/frames/dist/client.dev.cjs +0 -2022
- package/frames/dist/server.cjs +0 -3877
- package/serialization/dist/decode.cjs +0 -139
- package/serialization/dist/serialization.cjs +0 -261
- package/serialization/types-cjs/index.d.cts +0 -182
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -182
- package/server-functions/dist/client.cjs +0 -834
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1242
- package/server-functions/dist/server.dev.cjs +0 -1242
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/core.d.ts +0 -9
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -9
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -356
- package/types-cjs/frames/frame-sink.d.cts +0 -194
- package/types-cjs/frames/frame-transport.d.cts +0 -222
- package/types-cjs/frames/serializer.d.cts +0 -182
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/index.d.cts +0 -244
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4159
- package/types-cjs/package.json +0 -3
- package/types-cjs/response.d.cts +0 -174
- package/types-cjs/serializer-decode.d.cts +0 -182
- package/types-cjs/serializer.d.cts +0 -182
- package/types-cjs/server-functions/client.d.cts +0 -262
- package/types-cjs/server-functions/flash.d.cts +0 -38
- package/types-cjs/server-functions/rich-args.d.cts +0 -10
- package/types-cjs/server-functions/server.d.cts +0 -681
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -286
- package/types-cjs/server.d.cts +0 -544
package/types/serializer.d.ts
CHANGED
|
@@ -1,182 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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;
|
|
84
36
|
}
|
|
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
37
|
/**
|
|
99
38
|
* Options for `createHydrationSerializer` — `WebSerializerOptions` minus
|
|
100
|
-
* the knobs hydration pins (`globalIdentifier`, `disabledFeatures
|
|
101
|
-
*
|
|
102
|
-
*/
|
|
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.
|
|
39
|
+
* the knobs hydration pins (`globalIdentifier`, `disabledFeatures`,
|
|
40
|
+
* `serializeErrorStacks`: its stacks follow `NODE_ENV`).
|
|
114
41
|
* @internal
|
|
115
42
|
*/
|
|
116
|
-
export
|
|
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
|
-
|
|
43
|
+
export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures" | "serializeErrorStacks">;
|
|
130
44
|
/**
|
|
131
45
|
* Options for `serializeJSON`.
|
|
132
46
|
*
|
|
133
47
|
* Integration-facing; may change (see the entry banner).
|
|
134
48
|
*/
|
|
135
49
|
export interface JSONSerializeOptions extends JSONCodecOptions {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Receives each serialized node; `initial` is true for the first chunk
|
|
52
|
+
* (the source value itself). Async values produce additional chunks as
|
|
53
|
+
* they resolve.
|
|
54
|
+
*/
|
|
55
|
+
onParse: (node: SerovalNode, initial: boolean) => void;
|
|
56
|
+
onError?: (error: unknown) => void;
|
|
57
|
+
/** Fires once all async values have settled. */
|
|
58
|
+
onDone?: () => void;
|
|
145
59
|
}
|
|
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
60
|
/** Options for `createJSONSerializer`. */
|
|
159
61
|
export interface JSONSerializerOptions extends JSONCodecOptions {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Receives each keyed record — `initial` is true for a key's first node
|
|
64
|
+
* (the written value itself); async values patch through later records
|
|
65
|
+
* under the same key. The decoding peer is `createJSONDataTable`.
|
|
66
|
+
*/
|
|
67
|
+
onData: (record: {
|
|
68
|
+
key: string;
|
|
69
|
+
node: SerovalNode;
|
|
70
|
+
initial: boolean;
|
|
71
|
+
}) => void;
|
|
72
|
+
onError?: (error: unknown) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Fires once `flush()` has been called and every pending value settled, or
|
|
75
|
+
* once `close()` runs.
|
|
76
|
+
*/
|
|
77
|
+
onDone?: () => void;
|
|
169
78
|
}
|
|
170
|
-
|
|
79
|
+
export declare const createPlugin: <Value, Info extends PluginInfo>(plugin: SerializerPlugin<Value, Info>) => SerializerPlugin<Value, Info>;
|
|
80
|
+
export interface OpaqueReference<V = unknown, R = undefined> {
|
|
81
|
+
readonly value: V;
|
|
82
|
+
readonly replacement?: R;
|
|
83
|
+
}
|
|
84
|
+
export declare const OpaqueReference: {
|
|
85
|
+
new <V, R = undefined>(value: V, replacement?: R): OpaqueReference<V, R>;
|
|
86
|
+
};
|
|
171
87
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
88
|
+
* Creates a streaming Seroval serializer preconfigured with the web plugin
|
|
89
|
+
* set and the default feature policy. Emits JavaScript chunks (through
|
|
90
|
+
* `onData`) that reconstruct the values under `globalIdentifier` when
|
|
91
|
+
* evaluated — the script-injection form of serialization renderers build
|
|
92
|
+
* on. For a JSON-based wire codec (no eval on the receiving side), use
|
|
93
|
+
* `serializeJSON` / `createJSONDeserializer` instead.
|
|
94
|
+
*
|
|
95
|
+
* Integration-facing; may change (see the entry banner).
|
|
177
96
|
*/
|
|
178
|
-
export function
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
97
|
+
export declare function createSerializer(options: WebSerializerOptions): Serializer;
|
|
98
|
+
export declare function createHydrationSerializer(options: HydrationSerializerOptions): {
|
|
99
|
+
write(key: string, value: unknown): void;
|
|
100
|
+
flush(): void;
|
|
101
|
+
close(): void;
|
|
102
|
+
};
|
|
103
|
+
export declare function getLocalHeaderScript(id?: string): string;
|
|
104
|
+
export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
|
|
105
|
+
export declare function createJSONSerializer(options: JSONSerializerOptions): {
|
|
106
|
+
write(key: string, value: unknown): void;
|
|
107
|
+
flush(): void;
|
|
108
|
+
close(): void;
|
|
182
109
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The refusal: thrown by the encoder, and answered as a 400 by dispatch. */
|
|
2
|
+
export declare function refusedArgumentError(name?: string): TypeError;
|
|
3
|
+
/** The refusal behind `error`, if any: the codec reports a plugin's throw as the `cause` of its own error. */
|
|
4
|
+
export declare function refusedArgument(error: any): any;
|
|
5
|
+
/**
|
|
6
|
+
* The codec options server-function arguments decode with: `codec` with its
|
|
7
|
+
* complete plugin list resolved and the refused types filtered out.
|
|
8
|
+
* `defaults` is the codec's default plugin set (from the lazily loaded
|
|
9
|
+
* decode module).
|
|
10
|
+
*/
|
|
11
|
+
export declare function argumentDecodeCodec(codec: any, defaults: any): any;
|
|
12
|
+
/**
|
|
13
|
+
* Whether a framed argument payload names a refused type. Read only on a
|
|
14
|
+
* decode that already failed: a payload naming one can never decode (its
|
|
15
|
+
* tag has no plugin), so this tells the refusal apart from every other
|
|
16
|
+
* malformed payload. A plugin node spells its tag as `"c":"<tag>"`; inside a
|
|
17
|
+
* JSON string the quotes would be escaped, so payload data cannot spell it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function namesRefusedType(payload: any): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The configured codec options with encode-side refusals ahead of every
|
|
22
|
+
* plugin. `extra` holds plugins for one call (the upload serializer), which
|
|
23
|
+
* go first.
|
|
24
|
+
*/
|
|
25
|
+
export declare function argumentEncodeCodec(codec: any, extra?: any[]): any;
|
|
26
|
+
/**
|
|
27
|
+
* Decode options from `argumentDecodeCodec` with plugins for one request
|
|
28
|
+
* (the upload deserializer) ahead of the resolved list.
|
|
29
|
+
*/
|
|
30
|
+
export declare function withArgumentPlugins(argumentCodec: any, extra: any): any;
|