@solidjs/web 2.0.0-rc.17 → 2.0.0-rc.19
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 +191 -35
- package/dist/server.js +186 -35
- package/dist/server.observe.js +186 -35
- package/dist/web.dev.js +53 -71
- package/dist/web.js +52 -70
- package/dist/web.observe.js +52 -70
- package/frames/dist/server.dev.js +75 -40
- package/frames/dist/server.js +75 -40
- package/frames/dist/server.observe.js +75 -40
- package/frames/dist/wire.js +110 -14
- package/package.json +4 -4
- package/serialization/dist/decode.js +10 -5
- package/serialization/dist/serialization.js +121 -61
- package/serialization/types/index.d.ts +12 -4
- package/serialization/types/serializer.d.ts +12 -4
- package/server-functions/dist/server.dev.js +245 -8
- package/server-functions/dist/server.js +245 -8
- package/server-functions/dist/server.observe.js +245 -8
- package/types/frames/frame-morph.d.ts +1 -0
- package/types/frames/serializer.d.ts +12 -4
- package/types/serializer.d.ts +12 -4
- package/types/server-functions/server.d.ts +19 -3
- package/types/server-functions/shared.d.ts +9 -0
|
@@ -36,10 +36,11 @@ export interface WebSerializerOptions {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Options for `createHydrationSerializer` — `WebSerializerOptions` minus
|
|
39
|
-
* the knobs hydration pins (`globalIdentifier`, `disabledFeatures
|
|
39
|
+
* the knobs hydration pins (`globalIdentifier`, `disabledFeatures`,
|
|
40
|
+
* `serializeErrorStacks`: its stacks follow `NODE_ENV`).
|
|
40
41
|
* @internal
|
|
41
42
|
*/
|
|
42
|
-
export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures">;
|
|
43
|
+
export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures" | "serializeErrorStacks">;
|
|
43
44
|
/**
|
|
44
45
|
* Options for `serializeJSON`.
|
|
45
46
|
*
|
|
@@ -69,7 +70,10 @@ export interface JSONSerializerOptions extends JSONCodecOptions {
|
|
|
69
70
|
initial: boolean;
|
|
70
71
|
}) => void;
|
|
71
72
|
onError?: (error: unknown) => void;
|
|
72
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Fires once `flush()` has been called and every pending value settled, or
|
|
75
|
+
* once `close()` runs.
|
|
76
|
+
*/
|
|
73
77
|
onDone?: () => void;
|
|
74
78
|
}
|
|
75
79
|
export declare const createPlugin: <Value, Info extends PluginInfo>(plugin: SerializerPlugin<Value, Info>) => SerializerPlugin<Value, Info>;
|
|
@@ -91,7 +95,11 @@ export declare const OpaqueReference: {
|
|
|
91
95
|
* Integration-facing; may change (see the entry banner).
|
|
92
96
|
*/
|
|
93
97
|
export declare function createSerializer(options: WebSerializerOptions): Serializer;
|
|
94
|
-
export declare function createHydrationSerializer(options: HydrationSerializerOptions):
|
|
98
|
+
export declare function createHydrationSerializer(options: HydrationSerializerOptions): {
|
|
99
|
+
write(key: string, value: unknown): void;
|
|
100
|
+
flush(): void;
|
|
101
|
+
close(): void;
|
|
102
|
+
};
|
|
95
103
|
export declare function getLocalHeaderScript(id?: string): string;
|
|
96
104
|
export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
|
|
97
105
|
export declare function createJSONSerializer(options: JSONSerializerOptions): {
|
package/types/serializer.d.ts
CHANGED
|
@@ -36,10 +36,11 @@ export interface WebSerializerOptions {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Options for `createHydrationSerializer` — `WebSerializerOptions` minus
|
|
39
|
-
* the knobs hydration pins (`globalIdentifier`, `disabledFeatures
|
|
39
|
+
* the knobs hydration pins (`globalIdentifier`, `disabledFeatures`,
|
|
40
|
+
* `serializeErrorStacks`: its stacks follow `NODE_ENV`).
|
|
40
41
|
* @internal
|
|
41
42
|
*/
|
|
42
|
-
export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures">;
|
|
43
|
+
export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures" | "serializeErrorStacks">;
|
|
43
44
|
/**
|
|
44
45
|
* Options for `serializeJSON`.
|
|
45
46
|
*
|
|
@@ -69,7 +70,10 @@ export interface JSONSerializerOptions extends JSONCodecOptions {
|
|
|
69
70
|
initial: boolean;
|
|
70
71
|
}) => void;
|
|
71
72
|
onError?: (error: unknown) => void;
|
|
72
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Fires once `flush()` has been called and every pending value settled, or
|
|
75
|
+
* once `close()` runs.
|
|
76
|
+
*/
|
|
73
77
|
onDone?: () => void;
|
|
74
78
|
}
|
|
75
79
|
export declare const createPlugin: <Value, Info extends PluginInfo>(plugin: SerializerPlugin<Value, Info>) => SerializerPlugin<Value, Info>;
|
|
@@ -91,7 +95,11 @@ export declare const OpaqueReference: {
|
|
|
91
95
|
* Integration-facing; may change (see the entry banner).
|
|
92
96
|
*/
|
|
93
97
|
export declare function createSerializer(options: WebSerializerOptions): Serializer;
|
|
94
|
-
export declare function createHydrationSerializer(options: HydrationSerializerOptions):
|
|
98
|
+
export declare function createHydrationSerializer(options: HydrationSerializerOptions): {
|
|
99
|
+
write(key: string, value: unknown): void;
|
|
100
|
+
flush(): void;
|
|
101
|
+
close(): void;
|
|
102
|
+
};
|
|
95
103
|
export declare function getLocalHeaderScript(id?: string): string;
|
|
96
104
|
export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
|
|
97
105
|
export declare function createJSONSerializer(options: JSONSerializerOptions): {
|
|
@@ -351,6 +351,18 @@ export interface ServerFunctionsServerConfig {
|
|
|
351
351
|
* outside the dev build; `0`/`undefined` is off.
|
|
352
352
|
*/
|
|
353
353
|
chaosReconnectEvery?: number;
|
|
354
|
+
/**
|
|
355
|
+
* Id of the build this server was bundled with. A call whose
|
|
356
|
+
* `X-Server-Function-Build` header names another build is answered `409`
|
|
357
|
+
* and the function does not run: the page was loaded from a build whose
|
|
358
|
+
* functions may take other arguments or return another shape. The answer
|
|
359
|
+
* carries the unknown-function label, so the client rejects with
|
|
360
|
+
* `unknownFunction: true`, the same as for an id this build does not
|
|
361
|
+
* have. The client runtime does not send the header itself: the build
|
|
362
|
+
* integration adds it through `prepareRequest`. Calls without the header
|
|
363
|
+
* are not checked. Leave unset to check nothing.
|
|
364
|
+
*/
|
|
365
|
+
buildId?: string;
|
|
354
366
|
}
|
|
355
367
|
/**
|
|
356
368
|
* A registered server function: its build-stable id paired with the
|
|
@@ -530,9 +542,10 @@ export declare function live<A extends readonly any[], R>(fn: (...args: A) => R)
|
|
|
530
542
|
/**
|
|
531
543
|
* Declares a live server function whose answer is the same for every
|
|
532
544
|
* viewer: implies `live` and `GET`, and at the live address every caller
|
|
533
|
-
* with the same arguments shares ONE render (frames server half)
|
|
534
|
-
* outer body still runs per
|
|
535
|
-
* returns is the shared
|
|
545
|
+
* with the same arguments shares ONE render (frames server half) or ONE
|
|
546
|
+
* data source (see sharedSourceResponse). The outer body still runs per
|
|
547
|
+
* call — a gate (auth, redirects) — but what it returns is the shared
|
|
548
|
+
* answer's to render.
|
|
536
549
|
* @experimental
|
|
537
550
|
*/
|
|
538
551
|
export declare function broadcast<A extends readonly any[], R>(fn: (...args: A) => R): ServerFunction<A, LiveSource<Awaited<R>>>;
|
|
@@ -563,6 +576,9 @@ export declare function guardFailures(value: any, state: any): any;
|
|
|
563
576
|
* encodeLiveResult): the same payloads one per event, a comment heartbeat
|
|
564
577
|
* while idle, and each yield's position — parked on `live.pending` by the
|
|
565
578
|
* live adapter — riding as the `id:` of the record that carries the yield.
|
|
579
|
+
* A broadcast's shared stream (`live.nodes`) is nobody's body: it carries
|
|
580
|
+
* no heartbeat or chaos (each tap arms its own), and records which node
|
|
581
|
+
* each chunk carries for the fan-out to read (see startSharedSource).
|
|
566
582
|
*/
|
|
567
583
|
export declare function serializeResponseStream(value: any, codecOptions: any, signal: any, scope: any, live: any): ReadableStream<any>;
|
|
568
584
|
/**
|
|
@@ -296,6 +296,15 @@ export declare const LIVE_WIRE: unique symbol;
|
|
|
296
296
|
* Nothing distinguishes it otherwise: a CDN 404 and a skew 404 look alike.
|
|
297
297
|
*/
|
|
298
298
|
export declare const UNKNOWN_HEADER = "X-Server-Function-Unknown";
|
|
299
|
+
/**
|
|
300
|
+
* Header carrying a build id. The build integration adds it to calls
|
|
301
|
+
* through `prepareRequest`; the client runtime never sends it. A server
|
|
302
|
+
* configured with another `buildId` answers `409` with its own id under the
|
|
303
|
+
* same header and the `UNKNOWN_HEADER` label, and does not run the function.
|
|
304
|
+
* This catches the skew the unknown-id 404 cannot: a function whose id
|
|
305
|
+
* survived the deploy but whose arguments or result changed shape.
|
|
306
|
+
*/
|
|
307
|
+
export declare const BUILD_HEADER = "X-Server-Function-Build";
|
|
299
308
|
/**
|
|
300
309
|
* Header carrying a redirect to scripted callers. fetch FOLLOWS redirect
|
|
301
310
|
* statuses before the transport can read them, so a scripted answer masks
|