@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.
- package/dist/server.dev.js +15 -2
- package/dist/server.js +15 -2
- package/dist/web.dev.js +41 -9
- package/dist/web.js +39 -8
- package/dist/{web.cjs → web.observe.js} +137 -239
- package/frames/dist/server.dev.js +19 -0
- package/frames/dist/server.js +19 -0
- package/frames/package.json +6 -24
- package/package.json +81 -314
- package/serialization/decode/package.json +3 -9
- package/serialization/package.json +3 -9
- package/serialization/types/serializer-decode.d.ts +49 -2
- package/server-functions/dist/server.dev.js +28 -10
- package/server-functions/dist/server.js +28 -10
- package/server-functions/package.json +6 -24
- package/server-functions/rich-args/package.json +3 -9
- package/storage/package.json +3 -9
- package/types/client.d.ts +17 -0
- package/types/frames/serializer-decode.d.ts +49 -2
- package/types/serializer-decode.d.ts +49 -2
- package/types/server-functions/server.d.ts +27 -4
- package/types/server.d.ts +1 -1
- package/dist/server.cjs +0 -3708
- package/dist/server.dev.cjs +0 -3794
- package/dist/web.dev.cjs +0 -2285
- package/frames/dist/client.cjs +0 -2043
- package/frames/dist/client.dev.cjs +0 -2063
- package/frames/dist/server.cjs +0 -4542
- package/frames/dist/server.dev.cjs +0 -4584
- package/serialization/dist/decode.cjs +0 -155
- package/serialization/dist/serialization.cjs +0 -275
- package/serialization/types-cjs/index.d.cts +0 -101
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -172
- package/serialization/types-cjs/serializer.d.cts +0 -101
- package/server-functions/dist/client.cjs +0 -1069
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -2381
- package/server-functions/dist/server.dev.cjs +0 -2409
- 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-cjs/client.d.cts +0 -197
- package/types-cjs/constants.d.cts +0 -20
- package/types-cjs/cookies.d.cts +0 -41
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -370
- package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
- package/types-cjs/frames/frame-sink.d.cts +0 -92
- package/types-cjs/frames/frame-transport.d.cts +0 -189
- package/types-cjs/frames/serializer-decode.d.cts +0 -172
- package/types-cjs/frames/serializer.d.cts +0 -101
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/head.d.cts +0 -19
- package/types-cjs/index.d.cts +0 -191
- package/types-cjs/index.server.d.cts +0 -147
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4146
- package/types-cjs/package.json +0 -3
- package/types-cjs/reconcile.d.cts +0 -1
- package/types-cjs/render.d.cts +0 -6
- package/types-cjs/response.d.cts +0 -81
- package/types-cjs/serializer-decode.d.cts +0 -172
- package/types-cjs/serializer.d.cts +0 -101
- package/types-cjs/server-functions/client.d.cts +0 -184
- package/types-cjs/server-functions/flash.d.cts +0 -36
- package/types-cjs/server-functions/registry.d.cts +0 -100
- package/types-cjs/server-functions/rich-args.d.cts +0 -1
- package/types-cjs/server-functions/server.d.cts +0 -546
- package/types-cjs/server-functions/shared.d.cts +0 -283
- package/types-cjs/server-mock.d.cts +0 -337
- package/types-cjs/server.d.cts +0 -408
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { FrameHost } from "./frame-client.cjs";
|
|
2
|
-
import { JSONCodecOptions } from "./serializer-decode.cjs";
|
|
3
|
-
type FlightConsumer = (data: unknown, context: {
|
|
4
|
-
response: Response;
|
|
5
|
-
}) => void | Promise<void>;
|
|
6
|
-
/**
|
|
7
|
-
* Options for `applyFrameResponse`.
|
|
8
|
-
* @experimental
|
|
9
|
-
*/
|
|
10
|
-
export interface ApplyFrameResponseOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Remap the producer's root frame id onto a local one — the id your
|
|
13
|
-
* insertable/frame registered under — so navigations to the same boundary
|
|
14
|
-
* reuse the same frame regardless of what the server called it. Boundary
|
|
15
|
-
* identity belongs to the client.
|
|
16
|
-
*/
|
|
17
|
-
as?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Restamp every chunk of the response with this version (one response IS
|
|
20
|
-
* one version). Versions belong to the client too: the producer cannot
|
|
21
|
-
* know how many streams a boundary has consumed, so pass the Nth-response
|
|
22
|
-
* counter to make policy A's stale-guard real across navigations. A
|
|
23
|
-
* single-flight response addresses several boundaries, each with its own
|
|
24
|
-
* history — pass a function and it is called once per frame in the
|
|
25
|
-
* response.
|
|
26
|
-
*/
|
|
27
|
-
version?: number | ((frameId: string) => number);
|
|
28
|
-
/**
|
|
29
|
-
* Receives the payload text of each `outcome` chunk — the response-scoped
|
|
30
|
-
* single-flight envelope, the caller's result rather than anything the
|
|
31
|
-
* host renders.
|
|
32
|
-
*/
|
|
33
|
-
onOutcome?(payload: string): void;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The value under `COMPONENT_BINDING` on a transport-resolved binding.
|
|
37
|
-
* @experimental
|
|
38
|
-
*/
|
|
39
|
-
export interface ComponentBinding<C = unknown> {
|
|
40
|
-
/** The per-function mount component (the equals-gate identity). */
|
|
41
|
-
component: C;
|
|
42
|
-
/** The call's intrinsic (function, arguments) address — its store's key. */
|
|
43
|
-
address: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Options for `createServerComponentHandler`.
|
|
47
|
-
* @experimental
|
|
48
|
-
*/
|
|
49
|
-
export interface ServerComponentHandlerOptions<C = unknown> {
|
|
50
|
-
host: FrameHost;
|
|
51
|
-
/**
|
|
52
|
-
* Builds the framework's mount component for a server FUNCTION. Invoked
|
|
53
|
-
* once per function and cached — this is the equals-gate identity every
|
|
54
|
-
* call of the function resolves through. The component is CALLED (by the
|
|
55
|
-
* binding wrapper or a gated reader), receiving its current address as a
|
|
56
|
-
* second argument (`() => string`); it should (re-)bind its frame's pull
|
|
57
|
-
* to that address's store. Multi-mount fans out per site.
|
|
58
|
-
*/
|
|
59
|
-
component(fnId: string): C;
|
|
60
|
-
/**
|
|
61
|
-
* A new response is about to stream into an address: rotate
|
|
62
|
-
* response-scoped state (codec data tables) here. `version` is the
|
|
63
|
-
* client-owned stream counter the chunks will be stamped with.
|
|
64
|
-
*/
|
|
65
|
-
onStream?(address: string, version: number, response: Response): void;
|
|
66
|
-
/**
|
|
67
|
-
* Answer a call SYNCHRONOUSLY before any request is made (t = 0 local
|
|
68
|
-
* answers — e.g. a boundary the document already carries). Returning a
|
|
69
|
-
* non-undefined value resolves the call with it; a hydrating consumer
|
|
70
|
-
* never observes a pending beat.
|
|
71
|
-
*/
|
|
72
|
-
intercept?(info: {
|
|
73
|
-
id: string;
|
|
74
|
-
meta: unknown;
|
|
75
|
-
args: unknown[];
|
|
76
|
-
}): C | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Reads the registered single-flight consumer at delivery time. The
|
|
79
|
-
* consumer is module state in the server-function client's SHARED
|
|
80
|
-
* instance; pass a getter reading that instance when your bundling gives
|
|
81
|
-
* this module a private copy. Defaults to the local copy's reader.
|
|
82
|
-
*/
|
|
83
|
-
consumer?(): FlightConsumer | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* Reads the configured codec options at decode time — same instance-
|
|
86
|
-
* identity contract as `consumer`. Defaults to the local copy's reader.
|
|
87
|
-
*/
|
|
88
|
-
codec?(): JSONCodecOptions | undefined;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Header tagging a Response as a frame stream; its value is the producing
|
|
92
|
-
* frame's id. Frame-owned contract (hence the namespace) — deliberately not
|
|
93
|
-
* a `BodyFormat` entry, since the body is frame chunks, not a serialized
|
|
94
|
-
* value.
|
|
95
|
-
*/
|
|
96
|
-
export declare const FRAME_STREAM_HEADER = "X-Frame-Stream"; /**
|
|
97
|
-
* Whether a fetch Response carries a frame stream.
|
|
98
|
-
* @experimental
|
|
99
|
-
*/
|
|
100
|
-
export declare function isFrameStreamResponse(response: Response): boolean;
|
|
101
|
-
export declare function applyFrameResponse(response: Response, host: FrameHost, options?: ApplyFrameResponseOptions): Promise<string>;
|
|
102
|
-
/** Brands an inline-rendered server component with its function id. */
|
|
103
|
-
export declare const SERVER_COMPONENT: unique symbol;
|
|
104
|
-
/** The unwrapped server component behind an inline-render wrap. */
|
|
105
|
-
export declare const SERVER_COMPONENT_SOURCE: unique symbol;
|
|
106
|
-
/** The call's wire address (`frameAddress`), for regions to be emitted under. */
|
|
107
|
-
export declare const SERVER_COMPONENT_ADDRESS: unique symbol;
|
|
108
|
-
/**
|
|
109
|
-
* The binding brand on values the transport resolves: `{ component, address }`
|
|
110
|
-
* (see `createServerComponentHandler`). The identity split (DR-1,
|
|
111
|
-
* docs/server-components-principles.md): `component` is the MOUNT identity —
|
|
112
|
-
* one per server function, stable across every call — while `address` names
|
|
113
|
-
* the call's content store. An equals-gated reader (a framework's `dynamic`)
|
|
114
|
-
* compares `component` across resolutions: same function means "same
|
|
115
|
-
* instance, new binding" — it keeps its mounted instance and delivers the
|
|
116
|
-
* new address into it (the instance's frame re-binds its pull to that
|
|
117
|
-
* address's resident store) — and a different function swaps normally.
|
|
118
|
-
* `Symbol.for`, so consumers honor it without importing this module.
|
|
119
|
-
*/
|
|
120
|
-
export declare const COMPONENT_BINDING: unique symbol;
|
|
121
|
-
export declare function setServerComponentBootstrap(resolve: (ctx: unknown) => string): void;
|
|
122
|
-
/**
|
|
123
|
-
* Seroval plugin for a server component crossing a serialization boundary.
|
|
124
|
-
* A branded component (see `frameTransformDirectResult`) serializes as a
|
|
125
|
-
* REFERENCE — its markup never rides as data.
|
|
126
|
-
*
|
|
127
|
-
* Two distinct consumers share the one tag:
|
|
128
|
-
*
|
|
129
|
-
* - `serialize` (eval-style, the document hydration serializer): emits
|
|
130
|
-
* `self._$SC.r("<function id>")`. The document shell's inline bootstrap
|
|
131
|
-
* memoizes a stable placeholder per FUNCTION — a delegating shell whose
|
|
132
|
-
* every mount binds to its own SSR'd element during adoption — so the
|
|
133
|
-
* address adds nothing at t=0 and the reference stays id-keyed.
|
|
134
|
-
* - `deserialize` (the JSON codec): the codec only ever carries a component
|
|
135
|
-
* inside a single-flight envelope, so this is a FLIGHT reference. It must
|
|
136
|
-
* resolve to the exact object the reading call site already holds — an
|
|
137
|
-
* integration seeding its cache with anything else fails the consumer's
|
|
138
|
-
* equals-gate and remounts the boundary — so it resolves through the live
|
|
139
|
-
* transport registry by the call's address.
|
|
140
|
-
*/
|
|
141
|
-
declare function parseServerComponent(value: any, ctx: any): {
|
|
142
|
-
id: any;
|
|
143
|
-
address: any;
|
|
144
|
-
};
|
|
145
|
-
/** @type {import("seroval").Plugin<Function, { id: any, address: any }>} */
|
|
146
|
-
export declare const ServerComponentPlugin: {
|
|
147
|
-
tag: string;
|
|
148
|
-
test(value: any): boolean;
|
|
149
|
-
parse: {
|
|
150
|
-
sync: typeof parseServerComponent;
|
|
151
|
-
async(value: any, ctx: any): Promise<{
|
|
152
|
-
id: any;
|
|
153
|
-
address: any;
|
|
154
|
-
}>;
|
|
155
|
-
stream: typeof parseServerComponent;
|
|
156
|
-
};
|
|
157
|
-
serialize(node: any, ctx: any): string;
|
|
158
|
-
deserialize(node: any, ctx: any): any;
|
|
159
|
-
}; /**
|
|
160
|
-
* The codec options for a single-flight envelope: `codec` plus
|
|
161
|
-
* `ServerComponentPlugin` (deduped by tag). Injected by the protocol on both
|
|
162
|
-
* legs; exported for integrations composing their own flight carriers.
|
|
163
|
-
* @experimental
|
|
164
|
-
*/
|
|
165
|
-
export declare function flightCodec(codec?: JSONCodecOptions): JSONCodecOptions;
|
|
166
|
-
export declare function createServerComponentHandler<C>(options: ServerComponentHandlerOptions<C>): {
|
|
167
|
-
intercept?(info: {
|
|
168
|
-
id: string;
|
|
169
|
-
meta: unknown;
|
|
170
|
-
args: unknown[];
|
|
171
|
-
}): unknown;
|
|
172
|
-
handle(response: Response, ctx: {
|
|
173
|
-
id: string;
|
|
174
|
-
meta: unknown;
|
|
175
|
-
args: unknown[];
|
|
176
|
-
context: unknown;
|
|
177
|
-
}): unknown;
|
|
178
|
-
/**
|
|
179
|
-
* Declares that the document is showing a call: hydration-data references
|
|
180
|
-
* carry their call's address (`_$SC.r(id, address)`) but never travel
|
|
181
|
-
* through the transport, so the integration forwards those records here.
|
|
182
|
-
* Mints the call's binding (a post-load refetch then resolves a value
|
|
183
|
-
* whose component matches what the document mounted) and brands the
|
|
184
|
-
* per-function component so cache-seeded readers deliver instead of
|
|
185
|
-
* remounting when their site later switches calls.
|
|
186
|
-
*/
|
|
187
|
-
showing(address: string, functionId: string): void;
|
|
188
|
-
};
|
|
189
|
-
export {};
|
|
@@ -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
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Element as SolidElement } from "solid-js";
|
|
2
|
-
/**
|
|
3
|
-
* A client position in a server component: a prop the server renders (as JSX
|
|
4
|
-
* or by calling it) where client-owned markup belongs. `P` is the client
|
|
5
|
-
* component's own props, so a server component can reference the client
|
|
6
|
-
* component's type directly instead of restating it.
|
|
7
|
-
*
|
|
8
|
-
* Arguments are classified by VALUE, not by name — any prop may carry any of
|
|
9
|
-
* these:
|
|
10
|
-
*
|
|
11
|
-
* - primitives ride the chunk;
|
|
12
|
-
* - server JSX streams as a nested region (html once, never data);
|
|
13
|
-
* - anything else serializes as a data record.
|
|
14
|
-
*
|
|
15
|
-
* Async server JSX in an argument needs its own boundary: the region is
|
|
16
|
-
* emitted as one finished string, so a bare async read has no fallback to
|
|
17
|
-
* show and no fragment to reveal into.
|
|
18
|
-
*
|
|
19
|
-
* `$key` names the occurrence so client state follows an entity across
|
|
20
|
-
* responses rather than being positional — the slot-level analogue of `For`'s
|
|
21
|
-
* `keyed`, for when references can't carry identity because every response
|
|
22
|
-
* re-creates everything. It is occurrence identity, not client data: it is
|
|
23
|
-
* stripped before the client component sees its props. Positional identity is
|
|
24
|
-
* the right default; `$key` matters when a live list reorders.
|
|
25
|
-
* @experimental
|
|
26
|
-
*/
|
|
27
|
-
export type Slot<P = {}> = (props: P & {
|
|
28
|
-
$key?: string | number;
|
|
29
|
-
}) => SolidElement;
|
|
30
|
-
/**
|
|
31
|
-
* Types an async value crossing the slot border (DR-2, value tier). What you
|
|
32
|
-
* pass is what ships — the promise / async iterable itself rides the data
|
|
33
|
-
* channel — but the client's prop READ settles: it suspends into the covering
|
|
34
|
-
* boundary until first arrival (a promise's resolution, an iterable's first
|
|
35
|
-
* yield), then reads as the settled value, updating per yield for iterables.
|
|
36
|
-
*
|
|
37
|
-
* `asyncArg` is the type-level statement of that contract: identity at
|
|
38
|
-
* runtime, settled type at the border, so `Slot<P>` keeps the fill's props
|
|
39
|
-
* truthful to what its reads actually return.
|
|
40
|
-
*
|
|
41
|
-
* Slots render as JSX — the compiler wraps each prop in a getter so the read
|
|
42
|
-
* defers to the slot border, where the runtime owns it. A call form
|
|
43
|
-
* (`props.status({ … })`) evaluates its args eagerly in the component body —
|
|
44
|
-
* a top-level read, an error in most cases.
|
|
45
|
-
*
|
|
46
|
-
* ```tsx
|
|
47
|
-
* <props.status progress={asyncArg(gen.progress)} stats={asyncArg(gen.stats)} />
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export declare function asyncArg<T>(value: PromiseLike<T> | AsyncIterable<T>): T;
|
|
51
|
-
export { renderToFrameStream, renderServerComponent, serverComponentResponse, frameTransformResult, frameTransformFlightResult, createFrameSink, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.cjs";
|
|
52
|
-
export { FRAME_STREAM_HEADER, isFrameStreamResponse } from "./frame-transport.cjs";
|
package/types-cjs/head.d.cts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const HEAD_ELIGIBLE_TAGS: Set<string>;
|
|
2
|
-
export declare const HEAD_ATTR_NAME: RegExp;
|
|
3
|
-
export declare const RESOURCE_LINK_RELS: Set<string>;
|
|
4
|
-
export declare const RESOURCE_QUALIFIERS: string[];
|
|
5
|
-
export declare const STYLESHEET_FETCH_META: Set<string>;
|
|
6
|
-
export declare function evalHeadValue(v: any): any;
|
|
7
|
-
export declare function evalHeadProps(props: any, presets: any): {};
|
|
8
|
-
export declare function classifyHeadTag(desc: any): {
|
|
9
|
-
resource: boolean;
|
|
10
|
-
rel: any;
|
|
11
|
-
} | {
|
|
12
|
-
resource: boolean;
|
|
13
|
-
rel?: undefined;
|
|
14
|
-
};
|
|
15
|
-
export declare function qualifierValue(name: any, value: any): any;
|
|
16
|
-
export declare function asciiLowerCase(value: any): any;
|
|
17
|
-
export declare function resourceIdentity(tag: any, props: any): string;
|
|
18
|
-
export declare function replaceableIdentity(tag: any, props: any, key: any, unique: any): any;
|
|
19
|
-
export declare function resolveHead(groups: any): Map<any, any>;
|