@solidjs/web 2.0.0-rc.15 → 2.0.0-rc.16
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 +358 -479
- package/dist/server.js +343 -387
- package/dist/server.observe.js +343 -387
- package/dist/web.dev.js +57 -54
- package/dist/web.js +47 -49
- package/dist/web.observe.js +57 -54
- package/frames/dist/client.dev.js +610 -621
- package/frames/dist/client.js +540 -566
- package/frames/dist/client.observe.js +571 -573
- package/frames/dist/regions.js +43 -2
- package/frames/dist/server.dev.js +514 -423
- package/frames/dist/server.js +514 -370
- package/frames/dist/server.observe.js +514 -370
- package/frames/dist/wire.js +371 -6
- package/package.json +11 -11
- package/serialization/dist/decode.js +9 -7
- package/serialization/dist/serialization.js +9 -7
- package/serialization/types/serializer-decode.d.ts +2 -2
- package/server-functions/dist/client.dev.js +3 -1
- package/server-functions/dist/client.js +1 -1
- package/server-functions/dist/client.observe.js +3 -1
- package/server-functions/dist/rich-args.js +33 -1
- package/server-functions/dist/server.dev.js +127 -18
- package/server-functions/dist/server.js +127 -18
- package/server-functions/dist/server.observe.js +127 -18
- package/skills/server-components/SKILL.md +74 -185
- package/types/client.d.ts +15 -5
- package/types/frames/assets-tier.d.ts +2 -2
- package/types/frames/client.d.ts +8 -3
- package/types/frames/frame-client.d.ts +121 -157
- package/types/frames/frame-morph.d.ts +28 -0
- package/types/frames/frame-sink.d.ts +13 -9
- package/types/frames/frame-transport.d.ts +30 -1
- package/types/frames/regions-tier.d.ts +15 -0
- package/types/frames/serializer-decode.d.ts +2 -2
- package/types/frames/server.d.ts +0 -52
- package/types/frames/wire-tier.d.ts +54 -1
- package/types/index.d.ts +2 -2
- package/types/jsx.d.ts +11 -5
- package/types/observe.d.ts +14 -7
- package/types/render.d.ts +3 -1
- package/types/response.d.ts +5 -4
- package/types/serializer-decode.d.ts +2 -2
- package/types/server-functions/argument-codec.d.ts +21 -0
- package/types/server-functions/client.d.ts +14 -5
- package/types/server-functions/server.d.ts +6 -2
- package/types/server-functions/shared.d.ts +19 -0
- package/types/server-observe.d.ts +3 -2
- package/types/server.d.ts +57 -76
- package/frames/dist/bind.dev.js +0 -326
- package/frames/dist/bind.js +0 -295
- package/types/frames/bind-tier.d.ts +0 -60
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import type { FrameHost, FrameHostOptions } from "./frame-client.js";
|
|
2
|
+
/**
|
|
3
|
+
* A frame's mount as the live appliers reach it (the frame's `#live`):
|
|
4
|
+
* `e` its element, `t` its live-target cache, `c` its claim, `k` its slot
|
|
5
|
+
* index builder, `s` what each hole's range shows, `x` the give-up for a row-op record (mark it spent,
|
|
6
|
+
* cancel the connection so the resume re-sends the hole whole); `w`, in
|
|
7
|
+
* dev builds only, the diagnostic for a hole whose closing comment is gone
|
|
8
|
+
* (this chunk is built once for every condition, so the gate is the eager
|
|
9
|
+
* client's).
|
|
10
|
+
*/
|
|
11
|
+
interface LiveMount {
|
|
12
|
+
e: Element;
|
|
13
|
+
t: Map<string, Node>;
|
|
14
|
+
c: unknown;
|
|
15
|
+
k(found: Map<string, any>): void;
|
|
16
|
+
s(): Record<string, string>;
|
|
17
|
+
x(key: string, record: unknown): void;
|
|
18
|
+
w?: false | ((marker: string, open: Node) => void);
|
|
19
|
+
}
|
|
2
20
|
/**
|
|
3
21
|
* The host the handler hands over: the frame host, carrying the lazily
|
|
4
22
|
* loaded deserializer's load (`prepareData`) the transport awaits before a
|
|
@@ -113,4 +131,39 @@ export declare function cancel(host: object, address: string): void;
|
|
|
113
131
|
* @internal
|
|
114
132
|
*/
|
|
115
133
|
export declare function connect(response: Response, wire: WireSlot, address: string, binding: unknown, host: Host, bump: (address: string) => number, begin: (address: string, version: number) => void): unknown;
|
|
116
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Morph a live hole's marked range (`<!--lh:N-->…<!--lh:/N-->`, marker =
|
|
136
|
+
* `lh:N`) to its re-emitted html — the client half of the Stage 3 hole
|
|
137
|
+
* ledger. The same range-anchored reconcile as the root morph, so
|
|
138
|
+
* interior element identity (focus, media, third-party widget state)
|
|
139
|
+
* survives value ticks. A hole's content may hold slot ranges: the morph
|
|
140
|
+
* then resolves them against the frame's displaced-range index (`index`,
|
|
141
|
+
* one per flush pass: `r` the slot ranges by occurrence, `g` the subtrees
|
|
142
|
+
* the morphs inserted whole), as the root's does, so an occurrence the new
|
|
143
|
+
* content still has keeps its range — interior and mounted state —
|
|
144
|
+
* wherever it moved; the sync after the pass mounts the new ones and
|
|
145
|
+
* unmounts the ones gone. Returns whether the markers were found and the
|
|
146
|
+
* morph ran.
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
export declare function hole(f: LiveMount, marker: string, record: any, index: {
|
|
150
|
+
r?: Map<string, any>;
|
|
151
|
+
g?: Node[];
|
|
152
|
+
}): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Apply a live attr-hole re-emission: find the element addressed
|
|
155
|
+
* `data-lha="addr"` in the frame's range, parse the rebuilt attribute
|
|
156
|
+
* text through a scratch element (native entity decoding), and patch the
|
|
157
|
+
* element to match it the way the root morph matches server output
|
|
158
|
+
* (`morphAttributes`): set what's present, remove what is not — the text
|
|
159
|
+
* is the tag's WHOLE attribute area, so a name absent from it has
|
|
160
|
+
* vanished on the server, whether or not the emission names it in
|
|
161
|
+
* `removed` (a resume's re-emission cannot: the server holds the client's
|
|
162
|
+
* previous text only as a digest). The address itself and a
|
|
163
|
+
* `<details>`/`<dialog>` `open` are the morph's exceptions here too.
|
|
164
|
+
* Returns false when the element isn't in the DOM yet (pending; later
|
|
165
|
+
* flushes retry).
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
export declare function attrs(f: LiveMount, addr: string, record: any): boolean;
|
|
169
|
+
export { graft, morph } from "./frame-morph.js";
|
package/types/index.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
|
73
73
|
* </Portal>
|
|
74
74
|
* ```
|
|
75
75
|
*
|
|
76
|
-
* @description https://
|
|
76
|
+
* @description https://v2.solidjs.com/reference/solid-web/components/portal
|
|
77
77
|
*/
|
|
78
78
|
export declare function Portal(props: {
|
|
79
79
|
mount?: Element;
|
|
@@ -132,7 +132,7 @@ export { dynamicComponent } from "solid-js";
|
|
|
132
132
|
* }
|
|
133
133
|
* ```
|
|
134
134
|
*
|
|
135
|
-
* @description https://
|
|
135
|
+
* @description https://v2.solidjs.com/reference/solid-web/components/dynamic
|
|
136
136
|
*/
|
|
137
137
|
/**
|
|
138
138
|
* A component from a reactive source. The source may answer with the
|
package/types/jsx.d.ts
CHANGED
|
@@ -253,11 +253,10 @@ export namespace JSX {
|
|
|
253
253
|
/**
|
|
254
254
|
* Entity identity for server markup: the frame morph matches keyed
|
|
255
255
|
* elements across responses by it, so client state attached to the
|
|
256
|
-
* element (
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* one occurrence per render with or without it).
|
|
256
|
+
* element (focus, selection) follows the entity through reorders and
|
|
257
|
+
* refetches. SSR compiles it to the `_key` attribute; a DOM compile strips
|
|
258
|
+
* it. On a component, `$key` is slot occurrence identity across
|
|
259
|
+
* responses (optional; without it identity is positional).
|
|
261
260
|
*/
|
|
262
261
|
$key?: string | number | undefined;
|
|
263
262
|
}
|
|
@@ -896,6 +895,13 @@ export namespace JSX {
|
|
|
896
895
|
extends CustomAttributes<T>, PropAttributes, EventHandlersElement<T>, AriaAttributes {
|
|
897
896
|
// [key: ClassKeys]: boolean;
|
|
898
897
|
|
|
898
|
+
/**
|
|
899
|
+
* `data-*` attributes. JSX already accepts hyphenated names; this types
|
|
900
|
+
* them in props objects too (`ComponentProps<"div">`, a spread's source).
|
|
901
|
+
* `true` writes `""`; `false` and `undefined` remove the attribute.
|
|
902
|
+
*/
|
|
903
|
+
[key: `data-${string}`]: string | number | boolean | undefined;
|
|
904
|
+
|
|
899
905
|
// properties
|
|
900
906
|
innerHTML?: string;
|
|
901
907
|
textContent?: string | number;
|
package/types/observe.d.ts
CHANGED
|
@@ -472,11 +472,17 @@ declare module "solid-js" {
|
|
|
472
472
|
export declare function settledPromise(value: unknown): Promise<unknown> | undefined;
|
|
473
473
|
export declare function isDeferredBody(value: unknown): boolean;
|
|
474
474
|
/**
|
|
475
|
-
* The census one
|
|
476
|
-
*
|
|
477
|
-
*
|
|
475
|
+
* The census of one wire message (frame-sink.ts), kept by either half so
|
|
476
|
+
* both add up to the same numbers: a message counts once, and each record
|
|
477
|
+
* by what it writes — the root's content (`""`) a shell (or, addressed to
|
|
478
|
+
* a nested region, a region), `seg:<k>` content a fragment, `slot:<k>` a
|
|
479
|
+
* slot, any `:error` record an error. The end of the response (`:complete`,
|
|
480
|
+
* `:bound`) is not counted: a message writing only that is none.
|
|
478
481
|
*/
|
|
479
|
-
export declare function
|
|
482
|
+
export declare function frameRecordCensus(event: FrameEventBase, message: {
|
|
483
|
+
type?: string;
|
|
484
|
+
r?: Record<string, any>;
|
|
485
|
+
}, own: boolean): void;
|
|
480
486
|
/** What the client runtime hands a call observation as the call proceeds. */
|
|
481
487
|
export interface CallObservation {
|
|
482
488
|
/**
|
|
@@ -502,13 +508,14 @@ export declare function observeCall(id: string, method: "GET" | "POST", args: un
|
|
|
502
508
|
/** What the client's stream reader hands a frame observation. */
|
|
503
509
|
export interface FrameApplyObservation {
|
|
504
510
|
/**
|
|
505
|
-
* Every
|
|
506
|
-
* `wireId` is the id the
|
|
511
|
+
* Every message read, after the consumer's remapping (`as`, `version`) —
|
|
512
|
+
* `wireId` is the id the message carried before it.
|
|
507
513
|
*/
|
|
508
514
|
chunk(chunk: {
|
|
509
|
-
type
|
|
515
|
+
type?: string;
|
|
510
516
|
id: string;
|
|
511
517
|
version: number;
|
|
518
|
+
r?: Record<string, unknown>;
|
|
512
519
|
}, wireId: string): void;
|
|
513
520
|
/**
|
|
514
521
|
* The apply ended — cleanly, or with the failure it threw (a read that
|
package/types/render.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export declare let spreadName: string | undefined;
|
|
2
|
-
export declare
|
|
2
|
+
export declare let spreadLoc: string | undefined;
|
|
3
|
+
export declare function setSpreadName(name: string | undefined, loc?: string): void;
|
|
3
4
|
/** Dev: remember the element the running binding effect writes (first one wins). */
|
|
4
5
|
export declare function tagElement(node: Node): void;
|
|
5
6
|
export declare function effect<T>(fn: (prev?: T) => T, effectFn: (value: T, prev?: T) => void | (() => void), options?: {
|
|
6
7
|
scope?: boolean;
|
|
7
8
|
name?: string;
|
|
9
|
+
loc?: string;
|
|
8
10
|
}): void;
|
|
9
11
|
export declare function memo<T>(fn: () => T): () => T;
|
package/types/response.d.ts
CHANGED
|
@@ -66,9 +66,9 @@ export interface ResponseHelperInit extends ResponseInit {
|
|
|
66
66
|
* The cache keys the mutation invalidated, sent as the `X-Revalidate`
|
|
67
67
|
* header for the client's integrations to apply. Three declarations, three
|
|
68
68
|
* scopes: omitted sends no header — the host's default (Solid Router
|
|
69
|
-
* revalidates everything after
|
|
70
|
-
* convention reloads only what it owns); an empty
|
|
71
|
-
* header — nothing, explicitly; `REVALIDATE_ALL` (`"*"`) — every entry,
|
|
69
|
+
* revalidates everything after any mutation, form action or direct call;
|
|
70
|
+
* a router without that convention reloads only what it owns); an empty
|
|
71
|
+
* list (or `""`) sends an empty header — nothing, explicitly; `REVALIDATE_ALL` (`"*"`) — every entry,
|
|
72
72
|
* whatever the host's default. How named keys are matched (prefixes,
|
|
73
73
|
* namespaces) is each integration's business.
|
|
74
74
|
*/
|
|
@@ -111,7 +111,8 @@ export declare const NULL_BODY_STATUSES: ReadonlySet<number>;
|
|
|
111
111
|
* for the things a naked return can't express. Progressive enhancement
|
|
112
112
|
* stays invisible: the carried response holds a plain JSON body so
|
|
113
113
|
* consumers without the client runtime (no-JS form posts, direct HTTP)
|
|
114
|
-
* get real JSON, while integrations read `value` — no reparse.
|
|
114
|
+
* get real JSON, while integrations read `value` — no reparse. The body is
|
|
115
|
+
* encoded when read, so `value` may be anything a plain return may.
|
|
115
116
|
*
|
|
116
117
|
* Typed as `value`'s type: every caller of the function returning it —
|
|
117
118
|
* over HTTP or in-process — receives the value, never the envelope. At
|
|
@@ -223,8 +223,8 @@ export declare const DEFAULT_WEB_PLUGINS: readonly ({
|
|
|
223
223
|
* Integration-facing; may change (see the entry banner).
|
|
224
224
|
*/
|
|
225
225
|
export declare function resolveSerializerPlugins(customPlugins?: SerializerPlugin[]): SerializerPlugin[];
|
|
226
|
-
export declare function resolveCodecOptions(
|
|
227
|
-
plugins:
|
|
226
|
+
export declare function resolveCodecOptions(options?: JSONCodecOptions): {
|
|
227
|
+
plugins: any;
|
|
228
228
|
disabledFeatures: number;
|
|
229
229
|
depthLimit: number;
|
|
230
230
|
serializeErrorStacks: boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
/** The configured codec options with encode-side refusals ahead of every plugin. */
|
|
21
|
+
export declare function argumentEncodeCodec(codec: any): any;
|
|
@@ -23,6 +23,8 @@ export interface PrepareRequestContext {
|
|
|
23
23
|
* a chain — compose by wrapping functions in userland.
|
|
24
24
|
*/
|
|
25
25
|
export type PrepareRequestHook = (init: RequestInit, context: PrepareRequestContext) => RequestInit | Promise<RequestInit>;
|
|
26
|
+
/** How the transport sends a request: `fetch`'s shape, as the runtime calls it. */
|
|
27
|
+
export type ServerFunctionsSend = (address: string, init: RequestInit) => Response | Promise<Response>;
|
|
26
28
|
/** Options for `configureServerFunctionsClient`. */
|
|
27
29
|
export interface ServerFunctionsClientConfig {
|
|
28
30
|
/**
|
|
@@ -50,14 +52,17 @@ export interface ServerFunctionsClientConfig {
|
|
|
50
52
|
/**
|
|
51
53
|
* Codec options (extra plugins etc.) for encoding arguments and decoding
|
|
52
54
|
* results — must match the server's. Stored in the shared layer, so
|
|
53
|
-
* `decodeResponse` sees them too.
|
|
55
|
+
* `decodeResponse` sees them too. Arguments never carry `Response` or
|
|
56
|
+
* `Request` values, whatever plugins are configured: the server refuses
|
|
57
|
+
* them, and the rich-args encoder rejects the call before sending.
|
|
54
58
|
*/
|
|
55
59
|
codec?: JSONCodecOptions;
|
|
56
60
|
/**
|
|
57
61
|
* Sends every server-function request — retries, telemetry, a test
|
|
58
|
-
* double, or an app's own route.
|
|
62
|
+
* double, or an app's own route. Called as `(address, init)`, the
|
|
59
63
|
* address relative to the document as the global one receives it, so
|
|
60
|
-
* `parseServerFunctionActionUrl` reads the id back out for telemetry
|
|
64
|
+
* `parseServerFunctionActionUrl` reads the id back out for telemetry (a
|
|
65
|
+
* trailing third argument is the transport's own; ignore it). `null`
|
|
61
66
|
* restores the global.
|
|
62
67
|
*
|
|
63
68
|
* ```ts
|
|
@@ -81,7 +86,7 @@ export interface ServerFunctionsClientConfig {
|
|
|
81
86
|
* The wrapper replaces delivery for the requests the runtime chooses to
|
|
82
87
|
* send; the call-to-request mapping itself is not contractual.
|
|
83
88
|
*/
|
|
84
|
-
fetch?:
|
|
89
|
+
fetch?: ServerFunctionsSend | null;
|
|
85
90
|
/**
|
|
86
91
|
* Runs before every server-function fetch. Return (or mutate and return)
|
|
87
92
|
* the RequestInit the transport will use; `context.meta` is the
|
|
@@ -124,7 +129,10 @@ export interface ServerFunctionsClientConfig {
|
|
|
124
129
|
* declared shape and per-call options as dispatched (a `GET`-declared
|
|
125
130
|
* read stays a GET; a caller-supplied `signal` still owns the wire) —
|
|
126
131
|
* for a handler re-asking on its own account (a frames boundary's
|
|
127
|
-
* `reset`, frames-rulings 3.3).
|
|
132
|
+
* `reset`, frames-rulings 3.3). Observe tier only: `ctx.startedAt` is
|
|
133
|
+
* when the request was sent (`performance.now()`), so a handler can
|
|
134
|
+
* stamp what it hands out with the request's start
|
|
135
|
+
* (`OBSERVE.attribution.markFlight`).
|
|
128
136
|
*/
|
|
129
137
|
handle(response: Response, ctx: {
|
|
130
138
|
id: string;
|
|
@@ -132,6 +140,7 @@ export interface ServerFunctionsClientConfig {
|
|
|
132
140
|
args: unknown[];
|
|
133
141
|
context: unknown;
|
|
134
142
|
retry(): Promise<unknown>;
|
|
143
|
+
startedAt?: number;
|
|
135
144
|
}): unknown;
|
|
136
145
|
/**
|
|
137
146
|
* Answer a call before any request is made (t = 0 local answers — see
|
|
@@ -280,7 +280,11 @@ export interface ServerFunctionsServerConfig {
|
|
|
280
280
|
/**
|
|
281
281
|
* Codec options (extra plugins etc.) for decoding arguments and encoding
|
|
282
282
|
* results — must match the client's. Stored in the shared layer, so
|
|
283
|
-
* `decodeResponse` sees them too.
|
|
283
|
+
* `decodeResponse` sees them too. One asymmetry is fixed: arguments are
|
|
284
|
+
* client input and never decode `Response` or `Request` values, whatever
|
|
285
|
+
* plugins are configured — a call carrying one is refused with `400`.
|
|
286
|
+
* Results keep the full set. Every plugin added here is a type a client
|
|
287
|
+
* can make the server construct. When `serializeErrorStacks` is omitted,
|
|
284
288
|
* the server-function boundary defaults it from this module's compiled
|
|
285
289
|
* development variant.
|
|
286
290
|
*/
|
|
@@ -433,7 +437,7 @@ export interface HandleServerFunctionOptions {
|
|
|
433
437
|
* This request's server error hook, ahead of `configureServerErrors`' (see
|
|
434
438
|
* `ServerErrorHook` in `@solidjs/web`): the function's throw
|
|
435
439
|
* (`handling: "thrown"`) and a failure escaping through its result graph
|
|
436
|
-
* (`"channel"`), once per error, before the wire policy applies. Entry-only
|
|
440
|
+
* (`"channel"`), once per error per request, before the wire policy applies. Entry-only
|
|
437
441
|
* like `wrapInvocation`: a direct call the body makes during a render
|
|
438
442
|
* reports through the ambient hook.
|
|
439
443
|
*/
|
|
@@ -111,6 +111,25 @@ export interface ServerFunctionMetadata {
|
|
|
111
111
|
* `withMeta` write wins.
|
|
112
112
|
*/
|
|
113
113
|
readonly name?: string;
|
|
114
|
+
/**
|
|
115
|
+
* This function's own send, client side: the transport calls it instead
|
|
116
|
+
* of the configured `fetch` for every request the function makes, with
|
|
117
|
+
* the configured send (the app's `fetch`, or the global) as `next`. For
|
|
118
|
+
* an integration that answers a declared function's calls itself — a
|
|
119
|
+
* prerendered build's static artifacts, a cache — while the app's
|
|
120
|
+
* transport `fetch` stays the app's: pass on what you don't answer
|
|
121
|
+
* through `next`. The contract is `fetch`'s (see
|
|
122
|
+
* `ServerFunctionsClientConfig.fetch`); hydration adopts a
|
|
123
|
+
* server-rendered read only if the send reaches the global `fetch` in the
|
|
124
|
+
* same tick.
|
|
125
|
+
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* withMeta(getPosts, {
|
|
128
|
+
* fetch: (address, init, next) => cached(address) ?? next(address, init)
|
|
129
|
+
* });
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
readonly fetch?: (address: string, init: RequestInit, next: (address: string, init: RequestInit) => Response | Promise<Response>) => Response | Promise<Response>;
|
|
114
133
|
/** User-declared transport metadata attached with `withMeta`. */
|
|
115
134
|
readonly [key: string]: unknown;
|
|
116
135
|
}
|
|
@@ -55,9 +55,10 @@ export interface InvocationContext {
|
|
|
55
55
|
/** What the frame producer hands an observation: the stream's identity. */
|
|
56
56
|
export interface FrameObservation {
|
|
57
57
|
/** Counts the chunk — call for every chunk written after `start`. */
|
|
58
|
-
chunk(
|
|
59
|
-
type
|
|
58
|
+
chunk(message: {
|
|
59
|
+
type?: string;
|
|
60
60
|
id: string;
|
|
61
|
+
r?: Record<string, any>;
|
|
61
62
|
}): void;
|
|
62
63
|
/** Delivers the record. `error` is the value thrown on the synchronous failure path. */
|
|
63
64
|
settle(outcome: FrameProducedEvent["outcome"], error?: unknown): void;
|
package/types/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getOwner, createComponent, untrack, merge as mergeProps } from "solid-js";
|
|
2
|
-
import {
|
|
2
|
+
import { ssrScope as scope } from "solid-js/internal";
|
|
3
3
|
import type { Owner } from "solid-js";
|
|
4
4
|
import type { ServerErrorSite } from "solid-js/internal";
|
|
5
5
|
import { effect, memo } from "./render.js";
|
|
@@ -216,21 +216,7 @@ export interface SSRResponseOptions {
|
|
|
216
216
|
*/
|
|
217
217
|
export type FetchMiddleware = (request: Request, next: (request?: Request) => Promise<Response>) => Response | Promise<Response>;
|
|
218
218
|
export { createComponent, effect, memo, untrack, mergeProps, scope, getOwner };
|
|
219
|
-
export { sharedConfig };
|
|
220
219
|
export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.js";
|
|
221
|
-
/**
|
|
222
|
-
* The script half of a `CSPNonce`. The surfaces that emit one script take a
|
|
223
|
-
* `CSPNonce` and project it themselves; this stays exported only for
|
|
224
|
-
* `@solidjs/vite-plugin`'s generated handler, which still imports it.
|
|
225
|
-
* @internal
|
|
226
|
-
*/
|
|
227
|
-
export declare function scriptNonce(nonce?: CSPNonce): string | undefined;
|
|
228
|
-
/**
|
|
229
|
-
* The style half of a `CSPNonce`. Exported only for
|
|
230
|
-
* `@solidjs/vite-plugin`'s generated handler, which still imports it.
|
|
231
|
-
* @internal
|
|
232
|
-
*/
|
|
233
|
-
export declare function styleNonce(nonce?: CSPNonce): string | undefined;
|
|
234
220
|
export declare function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | HeadTag[])): void;
|
|
235
221
|
export declare function renderToString<T>(fn: () => T, options?: {
|
|
236
222
|
nonce?: CSPNonce;
|
|
@@ -278,7 +264,8 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
278
264
|
* `<Errored>` fallback (`handling: "fallback"`), a rejected fragment
|
|
279
265
|
* (`"client"`), a hydration value that would not serialize
|
|
280
266
|
* (`"serialize"`) — and the one that fails the request (`"failed"`),
|
|
281
|
-
* once per error
|
|
267
|
+
* once per error per kind per request (per render outside one), with
|
|
268
|
+
* where it was met. A one-argument listener still
|
|
282
269
|
* works; it hears them all — filter on `context.handling` for the
|
|
283
270
|
* request-failing ones alone. Without a hook (here or ambient) a
|
|
284
271
|
* failure that fails the request goes to `console.error`.
|
|
@@ -361,12 +348,34 @@ export declare function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
|
|
|
361
348
|
* commit through the render core, and the response's end-latch sweep is
|
|
362
349
|
* always the last one).
|
|
363
350
|
*/
|
|
364
|
-
export declare function createLiveHoles(sink: any, scoped: any): {
|
|
351
|
+
export declare function createLiveHoles(sink: any, scoped: any, settled: any, errorScope: any): {
|
|
365
352
|
suppressed: number;
|
|
366
353
|
sweeping: boolean;
|
|
367
354
|
parent: any;
|
|
368
|
-
recordStamp: number;
|
|
369
355
|
gateHit: boolean;
|
|
356
|
+
sweptOwners: boolean;
|
|
357
|
+
scope: any;
|
|
358
|
+
visit: any;
|
|
359
|
+
dry: boolean;
|
|
360
|
+
/**
|
|
361
|
+
* The id of a positional slot call: at render time (and on a retry,
|
|
362
|
+
* which renders) the render-positional id the proxy minted, `given`,
|
|
363
|
+
* kept for the call's position; on a sweep, the id that position had —
|
|
364
|
+
* or, for a position no render reached, `prop#~<scope>.<n>` (the `~`
|
|
365
|
+
* keeps it apart from render ids and `$key` ids, whose alphabet has
|
|
366
|
+
* none). Outside every hole, `given` as it is.
|
|
367
|
+
*/
|
|
368
|
+
slotId(prop: any, given: any): any;
|
|
369
|
+
/** A slot occurrence reached by the evaluation in progress; `forget` runs
|
|
370
|
+
* once a re-evaluation of its hole no longer reaches it. */
|
|
371
|
+
seen(id: any, forget: any): void;
|
|
372
|
+
/**
|
|
373
|
+
* Enter a nested hole's scope on the path that resolves it unminted (a
|
|
374
|
+
* sweep's interior, a suppressed window): the same scope a first render
|
|
375
|
+
* gives it inside `content()`. Returns the scope to restore, or
|
|
376
|
+
* undefined when none was entered.
|
|
377
|
+
*/
|
|
378
|
+
nest(hole: any): any;
|
|
370
379
|
/**
|
|
371
380
|
* Intercept a thunk content hole: resolve it, and — when the evaluation
|
|
372
381
|
* proves re-runnable — mint an id, wrap the output in its marker pair,
|
|
@@ -382,8 +391,9 @@ export declare function createLiveHoles(sink: any, scoped: any): {
|
|
|
382
391
|
mint(): number;
|
|
383
392
|
/** Whether interception may arm at the current evaluation point —
|
|
384
393
|
* `ssr()` asks before opening an attr capture (the `data-lha`
|
|
385
|
-
* injection must not touch out-of-scope bytes
|
|
386
|
-
* gated inside `content()`
|
|
394
|
+
* injection must not touch out-of-scope bytes, nor address an element
|
|
395
|
+
* nothing can change; content holes are gated inside `content()`
|
|
396
|
+
* itself). */
|
|
387
397
|
active(): boolean;
|
|
388
398
|
/**
|
|
389
399
|
* Register an element's attr-hole capture (built by `ssr()`'s in-tag
|
|
@@ -409,53 +419,12 @@ export declare function ssrStyle(value: string | {
|
|
|
409
419
|
}): string;
|
|
410
420
|
export declare function ssrStyleProperty(name: string, value: any): string;
|
|
411
421
|
export declare function ssrStyleProperties(...entries: any[]): string;
|
|
412
|
-
export declare function ssrElement(name: string, props: any | any[] | (() => any | any[]), children: any, needsId: boolean, skip?: (key: string) => boolean, attrs?: string | (() => string)
|
|
422
|
+
export declare function ssrElement(name: string, props: any | any[] | (() => any | any[]), children: any, needsId: boolean, skip?: (key: string) => boolean, attrs?: string | (() => string)): {
|
|
413
423
|
t: string;
|
|
414
424
|
};
|
|
415
425
|
export declare function ssrElementAttribute(key: string, value: any): string;
|
|
416
426
|
export declare function ssrAttribute(key: string, value: any): string;
|
|
417
427
|
export declare function ssrHydrationKey(): string;
|
|
418
|
-
export declare const CLAIMS_STREAM = 1;
|
|
419
|
-
export declare const CLAIMS_DOCUMENT = 2;
|
|
420
|
-
/** The brand on a binding slot's stand-in for one property read. */
|
|
421
|
-
export declare const SLOT_VALUE: unique symbol;
|
|
422
|
-
/** Marker attribute prefix on a consuming element (`_s:class`, `_s:on:click`, `_s:ref`). */
|
|
423
|
-
export declare const SLOT_MARKER = "_s:";
|
|
424
|
-
/** Faces a stand-in can come from (`slotValue`'s `face`). */
|
|
425
|
-
export declare const SLOT_FACE_STREAM = 0;
|
|
426
|
-
export declare const SLOT_FACE_DATA = 1;
|
|
427
|
-
export declare const SLOT_FACE_MARKUP = 2;
|
|
428
|
-
export declare function isSlotValue(value: unknown): boolean;
|
|
429
|
-
/**
|
|
430
|
-
* A binding slot's stand-in for one property read. `face` says what the
|
|
431
|
-
* occurrence's fill produced where this read happens: nothing (the stream
|
|
432
|
-
* face never runs fills), a data object (the document face — `value` is
|
|
433
|
-
* the t=0 value of `key`), or markup (the document face ran the fill and
|
|
434
|
-
* it returned content — a read off it is a dev finding at the position).
|
|
435
|
-
* The server has no value to compute with — on the stream face none at
|
|
436
|
-
* all, on the document face only the t=0 one — so the ONLY thing a stand-in
|
|
437
|
-
* can be is the whole value at one position. Every coercion the runtime can
|
|
438
|
-
* see (a template literal, `+`, a comparison, an explicit `String()`) is a
|
|
439
|
-
* dev finding, and it renders NOTHING on either face: the document face
|
|
440
|
-
* never shows a t=0 value the stream face cannot reproduce, so a misuse is
|
|
441
|
-
* visible on the first render rather than on the first refetch. Truthiness
|
|
442
|
-
* (`if (row.done)`, `row.x && …`) has no hook and is the one misuse only
|
|
443
|
-
* the rule can catch — a stand-in is an object and always truthy.
|
|
444
|
-
* @internal Created by the slot proxies (frames server).
|
|
445
|
-
*/
|
|
446
|
-
export declare function slotValue(occurrence: string, key: string, value: unknown, face: number): object;
|
|
447
|
-
/**
|
|
448
|
-
* The compiled per-element hole for ref/onXxx positions on a server
|
|
449
|
-
* intrinsic (behind the `serverComponents` compiler option):
|
|
450
|
-
* `ctx.claims ? ssrClaim({ click: expr, ref: expr2 }) : ""`. The compiler
|
|
451
|
-
* drops handler and ref expressions from plain SSR output, so this is
|
|
452
|
-
* where a stand-in at one of those positions is seen. A server-local
|
|
453
|
-
* function there can never run (the server has no client to run it on);
|
|
454
|
-
* dev says so, inside the component barrier only. An element with a
|
|
455
|
-
* handler position bound is an EVENT-SLOT consumer and carries the
|
|
456
|
-
* replay-window stamp beside its markers (`eventSlotStamp`).
|
|
457
|
-
*/
|
|
458
|
-
export declare function ssrClaim(map: Record<string, unknown>): string;
|
|
459
428
|
/**
|
|
460
429
|
* A render's link handler (`setLinkClaim`): given an anchor's link-relevant
|
|
461
430
|
* attributes — `href`, and `target` / `rel` / `download` / `link` /
|
|
@@ -464,7 +433,7 @@ export declare function ssrClaim(map: Record<string, unknown>): string;
|
|
|
464
433
|
* (`" data-active"`, `' data-active aria-current="page"'`), or `""`.
|
|
465
434
|
* Synchronous and pure; the markup is the handler's own and is written
|
|
466
435
|
* verbatim.
|
|
467
|
-
* @
|
|
436
|
+
* @internal
|
|
468
437
|
*/
|
|
469
438
|
export type LinkClaimHandler = (attrs: Readonly<Record<string, unknown>>) => string;
|
|
470
439
|
/**
|
|
@@ -514,13 +483,20 @@ export interface ServerErrorContext extends Omit<ServerErrorSite, "event"> {
|
|
|
514
483
|
}
|
|
515
484
|
/**
|
|
516
485
|
* The server error hook (see `configureServerErrors`): every failure the
|
|
517
|
-
* server runtime handles or fails on, once per error object
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
486
|
+
* server runtime handles or fails on, once per error object per `kind` per
|
|
487
|
+
* request (per render when no request is in scope — never once per
|
|
488
|
+
* process: an error object one request met and another meets again is
|
|
489
|
+
* heard by both), with where it was met. A direct server-function call that
|
|
490
|
+
* throws during SSR and the `<Errored>` that contains it are heard as both:
|
|
491
|
+
* `server-function` (the call failed), then `render` (the render fell back),
|
|
492
|
+
* so `kind: "render"` alone answers whether a render failed. Return the value the client should receive in
|
|
493
|
+
* place of the error — rendered into the fallback, serialized for
|
|
494
|
+
* hydration, sent as the RPC error — or nothing for the default policy (a
|
|
495
|
+
* generic `Error` outside the dev build, the error itself in it;
|
|
496
|
+
* `markSafeError` still passes through).
|
|
522
497
|
* A returned value is taken as intended client-facing content and is not
|
|
523
|
-
* sanitized again. Ignored for `handling: "failed"`, which has no wire
|
|
498
|
+
* sanitized again. Ignored for `handling: "failed"`, which has no wire, and
|
|
499
|
+
* once an earlier kind's sight gave one: every road carries the first.
|
|
524
500
|
*
|
|
525
501
|
* One road a mapping does not reach: a rejected async source's serialized
|
|
526
502
|
* rejection is encoded the moment the source rejects, ahead of the boundary
|
|
@@ -538,9 +514,10 @@ export interface ServerErrorsConfig {
|
|
|
538
514
|
* `init()` makes to see every failure the runtime handles in production:
|
|
539
515
|
* an `<Errored>` fallback rendered, a `<Loading>` fragment rejected, a
|
|
540
516
|
* server-function throw (HTTP dispatch or an in-process call during SSR),
|
|
541
|
-
* the failure that fails a request. Called once per error object
|
|
542
|
-
*
|
|
543
|
-
*
|
|
517
|
+
* the failure that fails a request. Called once per error object per kind
|
|
518
|
+
* per request (per render outside one), at first sight, wherever the runtime
|
|
519
|
+
* met it; its return, when given, is the wire value (see
|
|
520
|
+
* `ServerErrorHook`). A per-request hook — `renderToStream`'s
|
|
544
521
|
* `onError`, the server-function handler's — overrides it for that
|
|
545
522
|
* request. Registered on `globalThis` under a registered symbol, so a
|
|
546
523
|
* bundled server build and an instrumented `--import`ed module share it.
|
|
@@ -561,8 +538,8 @@ export declare function configureServerErrors(config: ServerErrorsConfig): void;
|
|
|
561
538
|
* function the runtime reports, such as a throw a framework's request
|
|
562
539
|
* handler catches from its middleware. The ambient server error hook hears
|
|
563
540
|
* it as `{ kind: "request", handling: "failed", event }`, once per error
|
|
564
|
-
* object, and its return is ignored, as for every `handling:
|
|
565
|
-
* render failure is the render's: a synchronous throw out of
|
|
541
|
+
* object per request, and its return is ignored, as for every `handling:
|
|
542
|
+
* "failed"`. A render failure is the render's: a synchronous throw out of
|
|
566
543
|
* `renderToString` or `renderToStream` was already heard as `kind:
|
|
567
544
|
* "render"` before the caller caught it, so reporting it here adds nothing.
|
|
568
545
|
* With no hook registered the failure goes to `console.error`, as a render
|
|
@@ -651,12 +628,13 @@ export declare function getHydrationWriter(): HydrationWriter | undefined;
|
|
|
651
628
|
* // in <Router>'s server render
|
|
652
629
|
* setLinkClaim(attrs => matchLink(attrs, location) ? ' data-active aria-current="page"' : "");
|
|
653
630
|
* ```
|
|
654
|
-
* @
|
|
631
|
+
* @internal
|
|
655
632
|
*/
|
|
656
633
|
export declare function setLinkClaim(handler: LinkClaimHandler | undefined): boolean;
|
|
657
634
|
/**
|
|
658
635
|
* Server: `false`. The client reads the `links` hydration record a render
|
|
659
636
|
* with a link handler wrote (`setLinkClaim`); see the client entry.
|
|
637
|
+
* @internal
|
|
660
638
|
*/
|
|
661
639
|
export declare function hasServerLinkState(): boolean;
|
|
662
640
|
/** Server stub — the registry is the client's. See the client entry. */
|
|
@@ -691,7 +669,10 @@ export declare function createSSRResponse(result: {
|
|
|
691
669
|
}): void;
|
|
692
670
|
}, event: RequestEvent | undefined, options?: SSRResponseOptions): Promise<Response>;
|
|
693
671
|
export declare function composeMiddleware(middlewares: FetchMiddleware[]): (request: Request, next: (request?: Request) => Response | Promise<Response>) => Promise<Response>;
|
|
694
|
-
/**
|
|
672
|
+
/**
|
|
673
|
+
* Options for `registerElementClaim` (see the client entry); inert on the server.
|
|
674
|
+
* @internal
|
|
675
|
+
*/
|
|
695
676
|
export type ElementClaimOptions = {
|
|
696
677
|
/**
|
|
697
678
|
* Attribute names whose compiler-owned writes re-claim an already claimed
|