@solidjs/web 2.0.0-rc.13 → 2.0.0-rc.15
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 +317 -185
- package/dist/server.js +298 -161
- package/dist/server.observe.js +299 -171
- package/dist/web.dev.js +207 -189
- package/dist/web.js +180 -178
- package/dist/web.observe.js +180 -180
- package/frames/dist/assets.js +92 -0
- package/frames/dist/bind.dev.js +326 -0
- package/frames/dist/bind.js +295 -0
- package/frames/dist/client.dev.js +665 -1114
- package/frames/dist/client.js +630 -1087
- package/frames/dist/client.observe.js +629 -1087
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +400 -201
- package/frames/dist/server.js +397 -198
- package/frames/dist/server.observe.js +397 -198
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +30 -4
- package/performance-tracks/dist/performance-tracks.dev.js +2 -1
- package/performance-tracks/dist/performance-tracks.observe.js +2 -1
- package/performance-tracks/types/index.d.ts +8 -6
- package/serialization/dist/decode.js +38 -9
- package/serialization/dist/serialization.js +40 -11
- package/serialization/types/serializer-decode.d.ts +24 -2
- package/server-functions/dist/client.dev.js +101 -62
- package/server-functions/dist/client.js +101 -62
- package/server-functions/dist/client.observe.js +101 -62
- package/server-functions/dist/server.dev.js +178 -67
- package/server-functions/dist/server.js +178 -67
- package/server-functions/dist/server.observe.js +178 -67
- package/skills/server-components/SKILL.md +65 -43
- package/types/client.d.ts +120 -8
- package/types/constants.d.ts +3 -1
- package/types/diagnostics.d.ts +8 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/bind-tier.d.ts +60 -0
- package/types/frames/client.d.ts +37 -3
- package/types/frames/frame-client.d.ts +249 -78
- package/types/frames/frame-container-plugin.d.ts +2 -2
- package/types/frames/frame-sink.d.ts +33 -0
- package/types/frames/frame-transport.d.ts +66 -18
- package/types/frames/regions-tier.d.ts +45 -0
- package/types/frames/serializer-decode.d.ts +24 -2
- package/types/frames/server.d.ts +33 -9
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/wire-tier.d.ts +116 -0
- package/types/head.d.ts +1 -0
- package/types/index.d.ts +61 -16
- package/types/index.server.d.ts +3 -18
- package/types/jsx.d.ts +4 -13
- package/types/observe.d.ts +4 -2
- package/types/response.d.ts +26 -4
- package/types/serializer-decode.d.ts +24 -2
- package/types/server-functions/client.d.ts +30 -0
- package/types/server-functions/registry.d.ts +4 -1
- package/types/server-functions/shared.d.ts +12 -8
- package/types/server-mock.d.ts +22 -3
- package/types/server.d.ts +119 -17
package/types/response.d.ts
CHANGED
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
* payloads); the HTTP handler forwards `response`'s headers and
|
|
5
5
|
* (non-redirect) status and encodes `value` as the body through the codec,
|
|
6
6
|
* while client-only integrations read `value` directly — no reparse.
|
|
7
|
+
*
|
|
8
|
+
* The envelope IS a `Response` — the given response's body, status and
|
|
9
|
+
* headers — so a consumer that knows nothing of Solid (a filesystem
|
|
10
|
+
* router's API dispatch, any fetch-style handler) answers with it as-is.
|
|
11
|
+
* `response` is the envelope itself, or `undefined` when constructed
|
|
12
|
+
* without one.
|
|
7
13
|
*/
|
|
8
|
-
export interface ResponseEnvelope<T = unknown> {
|
|
14
|
+
export interface ResponseEnvelope<T = unknown> extends Response {
|
|
9
15
|
response: Response | undefined;
|
|
10
16
|
value: T;
|
|
11
17
|
}
|
|
@@ -73,13 +79,24 @@ export declare const RESPONSE_HEADER_VALUE_LIMIT = 4096;
|
|
|
73
79
|
/**
|
|
74
80
|
* Response redirecting to `url` (default 302). `revalidate` names the
|
|
75
81
|
* cache keys the mutation invalidated.
|
|
82
|
+
*
|
|
83
|
+
* Typed so it never shows up in the type of the function returning it: a
|
|
84
|
+
* redirect is control flow for the integration to act on, not a value.
|
|
85
|
+
* `T` defaults to `never`, which vanishes from the inferred return type's
|
|
86
|
+
* union; where the context expects a type (an annotated return, a
|
|
87
|
+
* `Response`-typed request handler) `T` takes it. A literal `never` return
|
|
88
|
+
* would also mark code after a bare call unreachable; a type parameter
|
|
89
|
+
* does not. At runtime it is a real `Response`.
|
|
76
90
|
*/
|
|
77
|
-
export declare function redirect(url: string | Href, init?: number | ResponseHelperInit):
|
|
91
|
+
export declare function redirect<T = never>(url: string | Href, init?: number | ResponseHelperInit): T;
|
|
78
92
|
/**
|
|
79
93
|
* Empty response requesting revalidation of the named cache keys (all of
|
|
80
94
|
* them when omitted).
|
|
95
|
+
*
|
|
96
|
+
* Typed as `redirect` is, for the same reason: it never shows up in the
|
|
97
|
+
* type of the function returning it. At runtime it is a real `Response`.
|
|
81
98
|
*/
|
|
82
|
-
export declare function reload(init?: ResponseHelperInit):
|
|
99
|
+
export declare function reload<T = never>(init?: ResponseHelperInit): T;
|
|
83
100
|
/**
|
|
84
101
|
* Statuses HTTP forbids a body on — the `Response` constructor enforces it
|
|
85
102
|
* by throwing on ANY body, `JSON.stringify(undefined)`'s `"undefined"`
|
|
@@ -95,5 +112,10 @@ export declare const NULL_BODY_STATUSES: ReadonlySet<number>;
|
|
|
95
112
|
* stays invisible: the carried response holds a plain JSON body so
|
|
96
113
|
* consumers without the client runtime (no-JS form posts, direct HTTP)
|
|
97
114
|
* get real JSON, while integrations read `value` — no reparse.
|
|
115
|
+
*
|
|
116
|
+
* Typed as `value`'s type: every caller of the function returning it —
|
|
117
|
+
* over HTTP or in-process — receives the value, never the envelope. At
|
|
118
|
+
* runtime it is a `ResponseEnvelope`, a real `Response` that integrations
|
|
119
|
+
* recognize with `isResponseEnvelope()`.
|
|
98
120
|
*/
|
|
99
|
-
export declare function respond<T>(value: T, init?: ResponseHelperInit):
|
|
121
|
+
export declare function respond<T>(value: T, init?: ResponseHelperInit): T;
|
|
@@ -121,8 +121,17 @@ export interface JSONCodecOptions {
|
|
|
121
121
|
/**
|
|
122
122
|
* A resident, response-scoped decode table over the keyed JSON codec: apply
|
|
123
123
|
* each frame `data` chunk with `apply`, resolve `{ $ref }` slot args with
|
|
124
|
-
* `resolve
|
|
125
|
-
* (`applyData: c => table.apply(c)
|
|
124
|
+
* `resolve`, and `close` it when the response ends. The frames client host
|
|
125
|
+
* wires one per response (`applyData: c => table.apply(c)`,
|
|
126
|
+
* `closeData: (…) => table.close(error)`).
|
|
127
|
+
*
|
|
128
|
+
* A `{ $ref }` to a key no `apply` has delivered yet is a PENDING READ the
|
|
129
|
+
* table owns (`@internal` behaviour — the frames client is its consumer): a
|
|
130
|
+
* promise marked `s = 0`, settled by the key's `apply` and rejected by
|
|
131
|
+
* `close` — the response ended without delivering the key, so a value that
|
|
132
|
+
* never comes is an error where it is read, not a silence. Stamped `s`/`v`
|
|
133
|
+
* as it settles (`1` fulfilled, `2` rejected — the hydration serializer's
|
|
134
|
+
* marks, which a reader adopts synchronously).
|
|
126
135
|
*
|
|
127
136
|
* Integration-facing; may change (see the entry banner). This serialization
|
|
128
137
|
* entry is the single home of the data table — the frames client consumes
|
|
@@ -134,9 +143,22 @@ export interface JSONDataTable {
|
|
|
134
143
|
node?: unknown;
|
|
135
144
|
initial?: boolean;
|
|
136
145
|
}): void;
|
|
146
|
+
/**
|
|
147
|
+
* The value under `ref`, or the table's pending read of it: a promise
|
|
148
|
+
* marked `s = 0` carrying `c`, the callbacks the table runs in the
|
|
149
|
+
* `apply` / `close` that settles it — the key delivered (whatever its
|
|
150
|
+
* value's shape: a delivered promise is adopted by the read, the
|
|
151
|
+
* callbacks do not wait for it) or the table closed.
|
|
152
|
+
*/
|
|
137
153
|
resolve<T = unknown>(ref: {
|
|
138
154
|
$ref: string;
|
|
139
155
|
}): T;
|
|
156
|
+
/**
|
|
157
|
+
* The response has ended: every pending read of a key it never
|
|
158
|
+
* delivered rejects — with `error` (the response's own) when given, with
|
|
159
|
+
* an `Error` naming the key otherwise. Idempotent.
|
|
160
|
+
*/
|
|
161
|
+
close(error?: unknown): void;
|
|
140
162
|
}
|
|
141
163
|
/**
|
|
142
164
|
* Baseline plugin set for serializing web-platform values. Shared by the
|
|
@@ -98,6 +98,10 @@ export interface ServerFunctionsClientConfig {
|
|
|
98
98
|
* }
|
|
99
99
|
* });
|
|
100
100
|
* ```
|
|
101
|
+
*
|
|
102
|
+
* Return synchronously when you can: hydration adopts a server-rendered
|
|
103
|
+
* read only if its request is sent in the same tick, so an async hook
|
|
104
|
+
* makes every hydrated read fetch again from the browser.
|
|
101
105
|
*/
|
|
102
106
|
prepareRequest?: PrepareRequestHook;
|
|
103
107
|
/**
|
|
@@ -115,11 +119,30 @@ export interface ServerFunctionsClientConfig {
|
|
|
115
119
|
id: string;
|
|
116
120
|
meta: unknown;
|
|
117
121
|
}): unknown;
|
|
122
|
+
/**
|
|
123
|
+
* `ctx.retry` makes the same call again — the reference, arguments,
|
|
124
|
+
* declared shape and per-call options as dispatched (a `GET`-declared
|
|
125
|
+
* read stays a GET; a caller-supplied `signal` still owns the wire) —
|
|
126
|
+
* for a handler re-asking on its own account (a frames boundary's
|
|
127
|
+
* `reset`, frames-rulings 3.3).
|
|
128
|
+
*/
|
|
118
129
|
handle(response: Response, ctx: {
|
|
119
130
|
id: string;
|
|
120
131
|
meta: unknown;
|
|
121
132
|
args: unknown[];
|
|
122
133
|
context: unknown;
|
|
134
|
+
retry(): Promise<unknown>;
|
|
135
|
+
}): unknown;
|
|
136
|
+
/**
|
|
137
|
+
* Answer a call before any request is made (t = 0 local answers — see
|
|
138
|
+
* `createServerComponentHandler`). `info.retry` is the call as it would
|
|
139
|
+
* go to the wire, for a handler that answers now and re-asks later.
|
|
140
|
+
*/
|
|
141
|
+
intercept?(info: {
|
|
142
|
+
id: string;
|
|
143
|
+
meta: unknown;
|
|
144
|
+
args: unknown[];
|
|
145
|
+
retry(): Promise<unknown>;
|
|
123
146
|
}): unknown;
|
|
124
147
|
/**
|
|
125
148
|
* What a `live` (re)connect of the call resumes from, when the handler
|
|
@@ -135,6 +158,13 @@ export interface ServerFunctionsClientConfig {
|
|
|
135
158
|
position?: string;
|
|
136
159
|
headers?: Record<string, string>;
|
|
137
160
|
} | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* A `live()` call was made — fired at the call, before its first fetch,
|
|
163
|
+
* so a handler that serves live calls through code it loads on demand
|
|
164
|
+
* (the frames client's live wire tier) can start the load against the
|
|
165
|
+
* request's own latency. Per call, not per connect.
|
|
166
|
+
*/
|
|
167
|
+
onLive?(): void;
|
|
138
168
|
};
|
|
139
169
|
/**
|
|
140
170
|
* Encoder for argument lists JSON can't carry faithfully. JSON-safe args
|
|
@@ -96,7 +96,10 @@ export declare function provideServerFunctionRPC(rpc: any): void;
|
|
|
96
96
|
/**
|
|
97
97
|
* The registered RPC surface, or undefined when no server function exists
|
|
98
98
|
* in this build's graph. Integration plumbing (routers): gate every use of
|
|
99
|
-
* the transport/codec behind this read instead of importing it.
|
|
99
|
+
* the transport/codec behind this read instead of importing it. Both halves
|
|
100
|
+
* carry `GET` and `decodeResponse`. (A handler re-asking a call it answered
|
|
101
|
+
* does so through the call's own `retry` thunk — `responseHandler` in the
|
|
102
|
+
* client config — not through this slot.)
|
|
100
103
|
* @internal
|
|
101
104
|
*/
|
|
102
105
|
export declare function getServerFunctionRPC(): any;
|
|
@@ -178,11 +178,13 @@ export declare function hasFlightMetadata(response: Response): boolean;
|
|
|
178
178
|
* envelope context, whose `SINGLE_FLIGHT_HEADER` names the folded sources.
|
|
179
179
|
* Each registered consumer receives its own slice, in registration order,
|
|
180
180
|
* awaited sequentially so caches are seeded before the caller sees the
|
|
181
|
-
* value.
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
181
|
+
* value. Pending entries in the slices (values the collector folded while
|
|
182
|
+
* still in flight, streamed after the response head) are settled before
|
|
183
|
+
* any consumer runs. A consumer whose source was not folded is skipped —
|
|
184
|
+
* unless the response carries integration metadata, in which case it runs
|
|
185
|
+
* with `data` `undefined` to apply the metadata. Consumers are looked up
|
|
186
|
+
* per delivery: an awaited consumer may unsubscribe another (a provider
|
|
187
|
+
* tearing down under a navigation).
|
|
186
188
|
*
|
|
187
189
|
* Transport building block; not meant for hand-written code.
|
|
188
190
|
* @internal
|
|
@@ -354,14 +356,16 @@ export declare function extractBody(source: Request | Response, codecOptions?: J
|
|
|
354
356
|
export declare function createChunk(data: string): Uint8Array;
|
|
355
357
|
export declare class ChunkReader {
|
|
356
358
|
constructor(stream: any);
|
|
357
|
-
|
|
359
|
+
/** Reads once into the buffer; answers whether the reader was cancelled. */
|
|
360
|
+
readChunk(): Promise<any>;
|
|
358
361
|
next(): Promise<{
|
|
359
362
|
done: boolean;
|
|
360
|
-
value:
|
|
363
|
+
value: any;
|
|
361
364
|
}>;
|
|
362
365
|
drain(interpret: any): Promise<void>;
|
|
363
366
|
/** End the read: the body is cancelled through the lock this reader
|
|
364
|
-
* holds, and a pending `next()` resolves done
|
|
367
|
+
* holds, and a pending `next()` resolves done, even partway through a
|
|
368
|
+
* frame. */
|
|
365
369
|
cancel(reason: any): any;
|
|
366
370
|
}
|
|
367
371
|
/**
|
package/types/server-mock.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ServerErrorSite } from "solid-js";
|
|
|
5
5
|
* Where a server-side failure was met, as the server error hook hears it —
|
|
6
6
|
* the client's view of the server entry's type (see `configureServerErrors`
|
|
7
7
|
* there). `kind: "render"`: `fallback`/`client`/`failed`; `kind:
|
|
8
|
-
* "server-function"`: `thrown`/`channel`.
|
|
8
|
+
* "server-function"`: `thrown`/`channel`; `kind: "request"`: `failed`.
|
|
9
9
|
*/
|
|
10
10
|
export interface ServerErrorContext extends Omit<ServerErrorSite, "event"> {
|
|
11
11
|
event?: RequestEvent;
|
|
@@ -20,6 +20,12 @@ export interface ServerErrorsConfig {
|
|
|
20
20
|
* is a no-op so isomorphic setup code can call it unguarded.
|
|
21
21
|
*/
|
|
22
22
|
export declare function configureServerErrors(_config: ServerErrorsConfig): void;
|
|
23
|
+
/**
|
|
24
|
+
* Reports a failure that fails a request outside any render (see the
|
|
25
|
+
* server entry's `reportRequestFailure`). Server-only; on the client this is
|
|
26
|
+
* a no-op.
|
|
27
|
+
*/
|
|
28
|
+
export declare function reportRequestFailure(_error: unknown, _event: RequestEvent): void;
|
|
23
29
|
type PreloadLinkAttributes = {
|
|
24
30
|
type?: string;
|
|
25
31
|
crossorigin?: JSX.HTMLCrossorigin;
|
|
@@ -265,7 +271,7 @@ export declare function getExpectedRedirectStatus(response: ResponseStub): numbe
|
|
|
265
271
|
*/
|
|
266
272
|
export declare function createSSRResponse(result: string, event: RequestEvent | undefined, options?: {
|
|
267
273
|
responseInit?: ResponseInit;
|
|
268
|
-
nonce?:
|
|
274
|
+
nonce?: CSPNonce;
|
|
269
275
|
transformChunk?: (chunk: string) => string;
|
|
270
276
|
}): Response;
|
|
271
277
|
export declare function createSSRResponse(result: {
|
|
@@ -275,7 +281,7 @@ export declare function createSSRResponse(result: {
|
|
|
275
281
|
}): void;
|
|
276
282
|
}, event: RequestEvent | undefined, options?: {
|
|
277
283
|
responseInit?: ResponseInit;
|
|
278
|
-
nonce?:
|
|
284
|
+
nonce?: CSPNonce;
|
|
279
285
|
transformChunk?: (chunk: string) => string;
|
|
280
286
|
}): Promise<Response>;
|
|
281
287
|
/**
|
|
@@ -319,6 +325,13 @@ export declare function ssrElement(name: string, props: any | any[] | (() => any
|
|
|
319
325
|
* @internal
|
|
320
326
|
*/
|
|
321
327
|
export declare function ssrElementAttribute(key: string, value: any): string;
|
|
328
|
+
/**
|
|
329
|
+
* Compiler primitive — the hole after a candidate anchor's attributes in SSR
|
|
330
|
+
* output, the render's link handler's markup (see the server entry's
|
|
331
|
+
* `setLinkClaim`). Not meant for hand-written code.
|
|
332
|
+
* @internal
|
|
333
|
+
*/
|
|
334
|
+
export declare function ssrLinkClaim(attrs: Readonly<Record<string, unknown>>): string;
|
|
322
335
|
/**
|
|
323
336
|
* Compiler primitive — serializes a class value (string, object map, or
|
|
324
337
|
* array) for SSR output. Not meant for hand-written code.
|
|
@@ -341,6 +354,12 @@ export declare function ssrStyle(value: string | {
|
|
|
341
354
|
* @internal
|
|
342
355
|
*/
|
|
343
356
|
export declare function ssrStyleProperty(name: string, value: any): string;
|
|
357
|
+
/**
|
|
358
|
+
* Compiler primitive — serializes a style object's `name, value` pairs for
|
|
359
|
+
* SSR output. Not meant for hand-written code.
|
|
360
|
+
* @internal
|
|
361
|
+
*/
|
|
362
|
+
export declare function ssrStyleProperties(...entries: any[]): string;
|
|
344
363
|
/**
|
|
345
364
|
* Compiler primitive — serializes an attribute for SSR output. Not meant
|
|
346
365
|
* for hand-written code.
|
package/types/server.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getOwner, createComponent, untrack, merge as mergeProps } from "solid-js";
|
|
2
2
|
import { sharedConfig, ssrScope as scope } from "solid-js/internal";
|
|
3
|
+
import type { Owner } from "solid-js";
|
|
3
4
|
import type { ServerErrorSite } from "solid-js/internal";
|
|
4
5
|
import { effect, memo } from "./render.js";
|
|
5
6
|
import { type TraceContext } from "./trace.js";
|
|
@@ -106,9 +107,9 @@ export type AssetResolverFn = (key: string) => ResolvedAssets | null | undefined
|
|
|
106
107
|
* fallback reaches `script-src`. A nonce on a `useHead` tag's own props
|
|
107
108
|
* always wins.
|
|
108
109
|
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
110
|
+
* Surfaces that emit one script (`HydrationScript`,
|
|
111
|
+
* `generateHydrationScript`, `createSSRResponse`) take either shape and use
|
|
112
|
+
* its script half.
|
|
112
113
|
*/
|
|
113
114
|
export type CSPNonce = string | {
|
|
114
115
|
script: string | false;
|
|
@@ -203,8 +204,8 @@ export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "
|
|
|
203
204
|
export interface SSRResponseOptions {
|
|
204
205
|
/** Base head; the stub's status/headers win over it. */
|
|
205
206
|
responseInit?: ResponseInit;
|
|
206
|
-
/** Nonce carried by the post-flush `<script>` redirect fallback. */
|
|
207
|
-
nonce?:
|
|
207
|
+
/** Nonce carried by the post-flush `<script>` redirect fallback (its script half). */
|
|
208
|
+
nonce?: CSPNonce;
|
|
208
209
|
/** Rewrites each outgoing HTML chunk (entry script injection, ...). */
|
|
209
210
|
transformChunk?: (chunk: string) => string;
|
|
210
211
|
}
|
|
@@ -217,7 +218,18 @@ export type FetchMiddleware = (request: Request, next: (request?: Request) => Pr
|
|
|
217
218
|
export { createComponent, effect, memo, untrack, mergeProps, scope, getOwner };
|
|
218
219
|
export { sharedConfig };
|
|
219
220
|
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
|
+
*/
|
|
220
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
|
+
*/
|
|
221
233
|
export declare function styleNonce(nonce?: CSPNonce): string | undefined;
|
|
222
234
|
export declare function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | HeadTag[])): void;
|
|
223
235
|
export declare function renderToString<T>(fn: () => T, options?: {
|
|
@@ -230,8 +242,10 @@ export declare function renderToString<T>(fn: () => T, options?: {
|
|
|
230
242
|
* This render's server error hook, ahead of `configureServerErrors`'
|
|
231
243
|
* (see `ServerErrorHook`): every failure the render handles — an
|
|
232
244
|
* `<Errored>` fallback (`handling: "fallback"`), a hydration value that
|
|
233
|
-
* would not serialize (`"serialize"`) —
|
|
234
|
-
*
|
|
245
|
+
* would not serialize (`"serialize"`) — and the throw that fails it
|
|
246
|
+
* (`"failed"`, heard before it is rethrown to the caller), once per
|
|
247
|
+
* error, with where it was met. A one-argument listener still works; it
|
|
248
|
+
* hears them all.
|
|
235
249
|
*/
|
|
236
250
|
onError?: ServerErrorHook;
|
|
237
251
|
/**
|
|
@@ -329,7 +343,7 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
329
343
|
readonly readable: ReadableStream<Uint8Array>;
|
|
330
344
|
};
|
|
331
345
|
export declare function HydrationScript(props: {
|
|
332
|
-
nonce?:
|
|
346
|
+
nonce?: CSPNonce;
|
|
333
347
|
eventNames?: string[];
|
|
334
348
|
}): JSX.Element;
|
|
335
349
|
export declare function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
|
|
@@ -394,6 +408,7 @@ export declare function ssrStyle(value: string | {
|
|
|
394
408
|
[k: string]: string;
|
|
395
409
|
}): string;
|
|
396
410
|
export declare function ssrStyleProperty(name: string, value: any): string;
|
|
411
|
+
export declare function ssrStyleProperties(...entries: any[]): string;
|
|
397
412
|
export declare function ssrElement(name: string, props: any | any[] | (() => any | any[]), children: any, needsId: boolean, skip?: (key: string) => boolean, attrs?: string | (() => string), claims?: () => Record<number, Record<string, unknown>>): {
|
|
398
413
|
t: string;
|
|
399
414
|
};
|
|
@@ -402,7 +417,7 @@ export declare function ssrAttribute(key: string, value: any): string;
|
|
|
402
417
|
export declare function ssrHydrationKey(): string;
|
|
403
418
|
export declare const CLAIMS_STREAM = 1;
|
|
404
419
|
export declare const CLAIMS_DOCUMENT = 2;
|
|
405
|
-
/** The brand on
|
|
420
|
+
/** The brand on a binding slot's stand-in for one property read. */
|
|
406
421
|
export declare const SLOT_VALUE: unique symbol;
|
|
407
422
|
/** Marker attribute prefix on a consuming element (`_s:class`, `_s:on:click`, `_s:ref`). */
|
|
408
423
|
export declare const SLOT_MARKER = "_s:";
|
|
@@ -412,7 +427,7 @@ export declare const SLOT_FACE_DATA = 1;
|
|
|
412
427
|
export declare const SLOT_FACE_MARKUP = 2;
|
|
413
428
|
export declare function isSlotValue(value: unknown): boolean;
|
|
414
429
|
/**
|
|
415
|
-
*
|
|
430
|
+
* A binding slot's stand-in for one property read. `face` says what the
|
|
416
431
|
* occurrence's fill produced where this read happens: nothing (the stream
|
|
417
432
|
* face never runs fills), a data object (the document face — `value` is
|
|
418
433
|
* the t=0 value of `key`), or markup (the document face ran the fill and
|
|
@@ -430,22 +445,44 @@ export declare function isSlotValue(value: unknown): boolean;
|
|
|
430
445
|
*/
|
|
431
446
|
export declare function slotValue(occurrence: string, key: string, value: unknown, face: number): object;
|
|
432
447
|
/**
|
|
433
|
-
* The compiled per-element hole for ref/
|
|
448
|
+
* The compiled per-element hole for ref/onXxx positions on a server
|
|
434
449
|
* intrinsic (behind the `serverComponents` compiler option):
|
|
435
450
|
* `ctx.claims ? ssrClaim({ click: expr, ref: expr2 }) : ""`. The compiler
|
|
436
451
|
* drops handler and ref expressions from plain SSR output, so this is
|
|
437
452
|
* where a stand-in at one of those positions is seen. A server-local
|
|
438
453
|
* function there can never run (the server has no client to run it on);
|
|
439
|
-
* dev says so, inside the component barrier only.
|
|
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`).
|
|
440
457
|
*/
|
|
441
458
|
export declare function ssrClaim(map: Record<string, unknown>): string;
|
|
459
|
+
/**
|
|
460
|
+
* A render's link handler (`setLinkClaim`): given an anchor's link-relevant
|
|
461
|
+
* attributes — `href`, and `target` / `rel` / `download` / `link` /
|
|
462
|
+
* `aria-current` when present, raw values as written — returns the extra
|
|
463
|
+
* attribute markup for the anchor, each attribute with its leading space
|
|
464
|
+
* (`" data-active"`, `' data-active aria-current="page"'`), or `""`.
|
|
465
|
+
* Synchronous and pure; the markup is the handler's own and is written
|
|
466
|
+
* verbatim.
|
|
467
|
+
* @experimental
|
|
468
|
+
*/
|
|
469
|
+
export type LinkClaimHandler = (attrs: Readonly<Record<string, unknown>>) => string;
|
|
470
|
+
/**
|
|
471
|
+
* Compiler-emitted hole after a candidate anchor's attributes in SSR output:
|
|
472
|
+
* the render's link handler's markup for the anchor (`setLinkClaim`), or
|
|
473
|
+
* `""` when the render has no handler. An author-written `aria-current`
|
|
474
|
+
* wins — the handler is not consulted for that anchor. Not for hand-written
|
|
475
|
+
* code.
|
|
476
|
+
* @internal
|
|
477
|
+
*/
|
|
478
|
+
export declare function ssrLinkClaim(attrs: Readonly<Record<string, unknown>>): string;
|
|
442
479
|
export declare function ssrSelectValues(): void;
|
|
443
480
|
export declare function resolveSSRSelectValues(html: any): any;
|
|
444
481
|
export declare function escape(s: any, attr?: boolean): any;
|
|
445
482
|
export declare function getHydrationKey(): string | undefined;
|
|
446
483
|
export declare function applyRef(r: ((element: any) => void) | ((element: any) => void)[], element: any): void;
|
|
447
484
|
export declare function generateHydrationScript(options?: {
|
|
448
|
-
nonce?:
|
|
485
|
+
nonce?: CSPNonce;
|
|
449
486
|
eventNames?: string[];
|
|
450
487
|
}): string;
|
|
451
488
|
export declare function resolveSSRNode(node: any, result?: any, top?: boolean, nested?: boolean): any;
|
|
@@ -454,12 +491,17 @@ export declare const RequestContext: unique symbol; /**
|
|
|
454
491
|
*
|
|
455
492
|
* `kind: "render"` — `fallback`: an `<Errored>` rendered its fallback;
|
|
456
493
|
* `client`: a `<Loading>` fragment rejected and the client re-renders the
|
|
457
|
-
* subtree; `failed`: nothing contained it and the request fails
|
|
494
|
+
* subtree; `failed`: nothing contained it and the request fails — including
|
|
495
|
+
* a synchronous throw out of `renderToString` or `renderToStream`'s first
|
|
496
|
+
* pass, reported before it reaches the caller;
|
|
458
497
|
* `serialize`: a hydration value would not serialize and the render went on
|
|
459
498
|
* without it (a render that passed `onError`). `kind: "server-function"` — `thrown`:
|
|
460
499
|
* the body threw; `channel`: a rejection or throw escaping through the
|
|
461
500
|
* result graph (a promise, an iterable, a stream) with the head already
|
|
462
|
-
* committed. `
|
|
501
|
+
* committed. `kind: "request"` (always `failed`): a failure that fails the
|
|
502
|
+
* request outside any render or server function the runtime reports — a
|
|
503
|
+
* middleware throw the framework's request handler catches (see
|
|
504
|
+
* `reportRequestFailure`). `boundary` is the hydration id the boundary records and
|
|
463
505
|
* findings use; `ownerPath` is where the error was THROWN — the component
|
|
464
506
|
* labels root-first up the owner chain it escaped, when the compiler emitted
|
|
465
507
|
* them — and `boundaryPath` where it was MET, the same labels up the
|
|
@@ -514,6 +556,20 @@ export interface ServerErrorsConfig {
|
|
|
514
556
|
* ```
|
|
515
557
|
*/
|
|
516
558
|
export declare function configureServerErrors(config: ServerErrorsConfig): void;
|
|
559
|
+
/**
|
|
560
|
+
* Reports a failure that fails a request outside any render or server
|
|
561
|
+
* function the runtime reports, such as a throw a framework's request
|
|
562
|
+
* handler catches from its middleware. The ambient server error hook hears
|
|
563
|
+
* it as `{ kind: "request", handling: "failed", event }`, once per error
|
|
564
|
+
* object, and its return is ignored, as for every `handling: "failed"`. A
|
|
565
|
+
* render failure is the render's: a synchronous throw out of
|
|
566
|
+
* `renderToString` or `renderToStream` was already heard as `kind:
|
|
567
|
+
* "render"` before the caller caught it, so reporting it here adds nothing.
|
|
568
|
+
* With no hook registered the failure goes to `console.error`, as a render
|
|
569
|
+
* that fails before its shell does. There is no per-request hook at this
|
|
570
|
+
* layer.
|
|
571
|
+
*/
|
|
572
|
+
export declare function reportRequestFailure(error: unknown, event: RequestEvent): void;
|
|
517
573
|
/**
|
|
518
574
|
* The current request event, when called on the server inside a request
|
|
519
575
|
* scope (established by `provideRequestEvent` from `@solidjs/web/storage`
|
|
@@ -571,6 +627,38 @@ export type HydrationValue<T = unknown> = {
|
|
|
571
627
|
* ```
|
|
572
628
|
*/
|
|
573
629
|
export declare function getHydrationWriter(): HydrationWriter | undefined;
|
|
630
|
+
/**
|
|
631
|
+
* Sets the link handler of the render the caller belongs to — found through
|
|
632
|
+
* the caller's owner (component setup), else through the request scope when
|
|
633
|
+
* exactly one render is open for it — so every candidate anchor rendered
|
|
634
|
+
* from here on carries the handler's markup (`aria-current="page"`,
|
|
635
|
+
* `data-active`) in the server HTML. Returns `false` outside any render.
|
|
636
|
+
*
|
|
637
|
+
* Scoped to the render: concurrent renders never share a handler, and it is
|
|
638
|
+
* gone with the render. Set once per render, typically from a router's
|
|
639
|
+
* server render with its request's location; `undefined` clears it. Anchors
|
|
640
|
+
* serialized BEFORE the call (a document shell above the router) are not
|
|
641
|
+
* marked. Server components inline in the document render under the page's
|
|
642
|
+
* handler; a server component's own frame stream has none unless its render
|
|
643
|
+
* sets one.
|
|
644
|
+
*
|
|
645
|
+
* The first call with a handler writes the `links` hydration record once for
|
|
646
|
+
* the response (`hasServerLinkState()` on the client), the signal that the
|
|
647
|
+
* anchors' link state is the server's and can be trusted at hydration.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```ts
|
|
651
|
+
* // in <Router>'s server render
|
|
652
|
+
* setLinkClaim(attrs => matchLink(attrs, location) ? ' data-active aria-current="page"' : "");
|
|
653
|
+
* ```
|
|
654
|
+
* @experimental
|
|
655
|
+
*/
|
|
656
|
+
export declare function setLinkClaim(handler: LinkClaimHandler | undefined): boolean;
|
|
657
|
+
/**
|
|
658
|
+
* Server: `false`. The client reads the `links` hydration record a render
|
|
659
|
+
* with a link handler wrote (`setLinkClaim`); see the client entry.
|
|
660
|
+
*/
|
|
661
|
+
export declare function hasServerLinkState(): boolean;
|
|
574
662
|
/** Server stub — the registry is the client's. See the client entry. */
|
|
575
663
|
export declare function takeHydrationValue<T = unknown>(_key: string): HydrationValue<T> | undefined;
|
|
576
664
|
/**
|
|
@@ -603,8 +691,22 @@ export declare function createSSRResponse(result: {
|
|
|
603
691
|
}): void;
|
|
604
692
|
}, event: RequestEvent | undefined, options?: SSRResponseOptions): Promise<Response>;
|
|
605
693
|
export declare function composeMiddleware(middlewares: FetchMiddleware[]): (request: Request, next: (request?: Request) => Response | Promise<Response>) => Promise<Response>;
|
|
606
|
-
|
|
607
|
-
export
|
|
694
|
+
/** Options for `registerElementClaim` (see the client entry); inert on the server. */
|
|
695
|
+
export type ElementClaimOptions = {
|
|
696
|
+
/**
|
|
697
|
+
* Attribute names whose compiler-owned writes re-claim an already claimed
|
|
698
|
+
* element, as plain names (`href` covers `prop:href` and `xlink:href`).
|
|
699
|
+
* Defaults to `["href", "action"]`.
|
|
700
|
+
*/
|
|
701
|
+
attributes?: readonly string[];
|
|
702
|
+
}; /**
|
|
703
|
+
* Server no-op: element claims are a client-only concern, but consumers may
|
|
704
|
+
* register isomorphically. Returns a no-op unregister function.
|
|
705
|
+
*/
|
|
706
|
+
export declare function registerElementClaim(handler: (element: Element) => void, options?: ElementClaimOptions): () => void;
|
|
707
|
+
export declare function claimElement<T extends Element>(node: T, owner?: Owner | null): T;
|
|
608
708
|
export declare function claimElementTree<T extends Node>(root: T): T;
|
|
709
|
+
/** Server: `fn()`. No event is dispatched during SSR, so there is no interaction to join. */
|
|
710
|
+
export declare function dispatchAsInteraction<T>(_e: Event, fn: () => T): T;
|
|
609
711
|
export { notSup as style, notSup as insert, notSup as spread, notSup as delegateEvents, notSup as registerDelegatedRoot, notSup as unregisterDelegatedRoot, notSup as registerDelegatedContainer, notSup as unregisterDelegatedContainer, notSup as getDelegatedRoot, notSup as dynamicProperty, notSup as setAttribute, notSup as setAttributeNS, notSup as addEvent, notSup as render, notSup as template, notSup as setProperty, notSup as className, notSup as assign, notSup as hydrate, notSup as getNextElement, notSup as getNextMatch, notSup as getNextMarker, notSup as runHydrationEvents, notSup as ref, notSup as setStyleProperty, notSup as readShallow, notSup as acquireAsset };
|
|
610
712
|
declare function notSup(): void;
|