@solidjs/web 2.0.0-rc.5 → 2.0.0-rc.7
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.cjs +122 -38
- package/dist/server.dev.cjs +3794 -0
- package/dist/server.dev.js +3627 -0
- package/dist/server.js +123 -39
- package/dist/web.cjs +102 -366
- package/dist/{dev.cjs → web.dev.cjs} +153 -376
- package/dist/{dev.js → web.dev.js} +155 -374
- package/dist/web.js +104 -364
- package/frames/dist/client.cjs +11 -3
- package/frames/dist/client.dev.cjs +11 -3
- package/frames/dist/client.dev.js +11 -3
- package/frames/dist/client.js +11 -3
- package/frames/dist/server.cjs +320 -53
- package/frames/dist/server.dev.cjs +4584 -0
- package/frames/dist/server.dev.js +4571 -0
- package/frames/dist/server.js +320 -53
- package/frames/package.json +10 -0
- package/package.json +78 -8
- package/serialization/dist/decode.cjs +18 -4
- package/serialization/dist/decode.js +18 -4
- package/serialization/dist/serialization.cjs +18 -4
- package/serialization/dist/serialization.js +18 -4
- package/server-functions/dist/client.cjs +27 -16
- package/server-functions/dist/client.js +27 -16
- package/server-functions/dist/server.cjs +529 -131
- package/server-functions/dist/server.dev.cjs +536 -130
- package/server-functions/dist/server.dev.js +536 -130
- package/server-functions/dist/server.js +529 -131
- package/types/client.d.ts +1 -3
- package/types/constants.d.ts +3 -1
- package/types/frames/frame-client.d.ts +1 -1
- package/types/head.d.ts +3 -0
- package/types/index.d.ts +18 -7
- package/types/index.server.d.ts +31 -9
- package/types/render.d.ts +3 -1
- package/types/server-functions/flash.d.ts +12 -3
- package/types/server-functions/server.d.ts +100 -5
- package/types/server-mock.d.ts +43 -7
- package/types/server.d.ts +47 -5
- package/types-cjs/client.d.cts +1 -3
- package/types-cjs/constants.d.cts +3 -1
- package/types-cjs/frames/frame-client.d.cts +1 -1
- package/types-cjs/head.d.cts +3 -0
- package/types-cjs/index.d.cts +18 -7
- package/types-cjs/index.server.d.cts +31 -9
- package/types-cjs/render.d.cts +3 -1
- package/types-cjs/server-functions/flash.d.cts +12 -3
- package/types-cjs/server-functions/server.d.cts +100 -5
- package/types-cjs/server-mock.d.cts +43 -7
- package/types-cjs/server.d.cts +47 -5
- package/types/patch-driver.d.ts +0 -3
- package/types-cjs/patch-driver.d.cts +0 -3
package/types/client.d.ts
CHANGED
|
@@ -79,8 +79,6 @@ export interface RequestEvent {
|
|
|
79
79
|
export type { CookieOptions } from "./cookies.js";
|
|
80
80
|
export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./server-functions/shared.js";
|
|
81
81
|
export declare const waitAsset: (promise: Promise<unknown>) => void;
|
|
82
|
-
export declare let listDriver: ((parent: Node, listFn: any, marker?: Node, lateClassic?: () => void) => boolean) | undefined;
|
|
83
|
-
export declare function installListDriver(driver: typeof listDriver): void;
|
|
84
82
|
export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.js";
|
|
85
83
|
/** Client stub — hydration bootstrap is a server-only emit. */
|
|
86
84
|
export declare function generateHydrationScript(_options?: {
|
|
@@ -136,7 +134,7 @@ export declare function claimElement<T extends Element>(node: T): T;
|
|
|
136
134
|
export declare function setAttribute(node: Element, name: string, value: string): void;
|
|
137
135
|
export declare function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
138
136
|
export declare function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
|
|
139
|
-
export declare function addEvent(node: Element, name: string, handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions), delegate: boolean): void;
|
|
137
|
+
export declare function addEvent(node: Element, name: string, handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions), delegate: boolean): EventListener | EventListenerObject | void;
|
|
140
138
|
export declare function style(node: Element, value: {
|
|
141
139
|
[k: string]: string;
|
|
142
140
|
}, prev?: {
|
package/types/constants.d.ts
CHANGED
|
@@ -15,4 +15,6 @@ declare const Namespaces: Record<string, string>;
|
|
|
15
15
|
declare const VoidElements: Set<string>;
|
|
16
16
|
declare const RawTextElements: Set<string>;
|
|
17
17
|
declare const DOMElements: Set<string>;
|
|
18
|
-
|
|
18
|
+
declare const COMPOSED_BODY_FRAMING: ReadonlySet<string>;
|
|
19
|
+
declare function isHttpNavigationTarget(target: string): boolean;
|
|
20
|
+
export { DOMWithState, ChildProperties, DelegatedEvents, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DOMElements, $$SLOT, $$HOST, COMPOSED_BODY_FRAMING, isHttpNavigationTarget };
|
package/types/head.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const HEAD_ELIGIBLE_TAGS: Set<string>;
|
|
2
2
|
export declare const HEAD_ATTR_NAME: RegExp;
|
|
3
3
|
export declare const RESOURCE_LINK_RELS: Set<string>;
|
|
4
|
+
export declare const RESOURCE_QUALIFIERS: string[];
|
|
4
5
|
export declare const STYLESHEET_FETCH_META: Set<string>;
|
|
5
6
|
export declare function evalHeadValue(v: any): any;
|
|
6
7
|
export declare function evalHeadProps(props: any, presets: any): {};
|
|
@@ -11,6 +12,8 @@ export declare function classifyHeadTag(desc: any): {
|
|
|
11
12
|
resource: boolean;
|
|
12
13
|
rel?: undefined;
|
|
13
14
|
};
|
|
15
|
+
export declare function qualifierValue(name: any, value: any): any;
|
|
16
|
+
export declare function asciiLowerCase(value: any): any;
|
|
14
17
|
export declare function resourceIdentity(tag: any, props: any): string;
|
|
15
18
|
export declare function replaceableIdentity(tag: any, props: any, key: any, unique: any): any;
|
|
16
19
|
export declare function resolveHead(groups: any): Map<any, any>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Component } from "solid-js";
|
|
2
2
|
import type { JSX } from "./jsx.js";
|
|
3
3
|
export * from "./client.js";
|
|
4
|
-
export { patchDriver, rowProof, driveList } from "./patch-driver.js";
|
|
5
4
|
export * from "./server-mock.js";
|
|
6
5
|
export * from "./response.js";
|
|
7
6
|
export type { JSX } from "./jsx.js";
|
|
@@ -79,7 +78,16 @@ export declare function Portal(props: {
|
|
|
79
78
|
mount?: Element;
|
|
80
79
|
children: JSX.Element;
|
|
81
80
|
}): JSX.Element;
|
|
82
|
-
export
|
|
81
|
+
export interface DynamicOptions {
|
|
82
|
+
/**
|
|
83
|
+
* SSR only: hold the document's first flush until the source settles, so
|
|
84
|
+
* the resolved component renders into the shell instead of streaming in
|
|
85
|
+
* behind its boundary's fallback. Same meaning as `createMemo`'s
|
|
86
|
+
* `deferStream`. Ignored on the client.
|
|
87
|
+
*/
|
|
88
|
+
deferStream?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, _options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
83
91
|
/**
|
|
84
92
|
* Renders an arbitrary custom or native component and forwards the other
|
|
85
93
|
* props. JSX form of `dynamic()` — same primitive, picked at the JSX site.
|
|
@@ -152,9 +160,10 @@ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
|
|
|
152
160
|
* `event.response` status at write time and restores it when the owning
|
|
153
161
|
* scope is disposed — so a boundary that errored, declared a status, and
|
|
154
162
|
* then recovered retracts its write instead of stomping a status a
|
|
155
|
-
* surviving part of the tree legitimately set. Once the
|
|
156
|
-
*
|
|
157
|
-
*
|
|
163
|
+
* surviving part of the tree legitimately set. Once the response head is
|
|
164
|
+
* `committed` (head derived/sent — the shell flush of a piped
|
|
165
|
+
* `renderToStream`, the completion of an awaited one, `createSSRResponse`
|
|
166
|
+
* for a `renderToString` result), writes and retractions are no-ops.
|
|
158
167
|
*/
|
|
159
168
|
export declare function httpStatus(_code: number, _text?: string): void;
|
|
160
169
|
/**
|
|
@@ -172,8 +181,10 @@ export declare function httpStatus(_code: number, _text?: string): void;
|
|
|
172
181
|
* Retraction semantics (server): the header's prior value is snapshotted at
|
|
173
182
|
* write time and restored when the owning scope is disposed (deleted if
|
|
174
183
|
* there was none) — a boundary that errors or recovers retracts its writes.
|
|
175
|
-
* Once the
|
|
176
|
-
*
|
|
184
|
+
* Once the response head is `committed` (head derived/sent — the shell
|
|
185
|
+
* flush of a piped `renderToStream`, the completion of an awaited one,
|
|
186
|
+
* `createSSRResponse` for a `renderToString` result), writes and
|
|
187
|
+
* retractions are no-ops.
|
|
177
188
|
*/
|
|
178
189
|
export declare function httpHeader(_name: string, _value: string, _options?: {
|
|
179
190
|
append?: boolean;
|
package/types/index.server.d.ts
CHANGED
|
@@ -13,14 +13,28 @@ export { For, Show, Loading, Reveal, Switch, Match, Repeat, Errored, NoHydration
|
|
|
13
13
|
export declare const isServer: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Build-time constant indicating whether code is running in a dev build.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Set by `_SOLID_DEV_` substitution per artifact, exactly like the client
|
|
17
|
+
* entry: `dist/server.dev.*` (the `development` export condition) → `true`,
|
|
18
|
+
* `dist/server.*` → `false`. The server runtime's own `_SOLID_DEV_` gates are
|
|
19
|
+
* replaced by the same pass, so this flag and the bundle's internal behavior
|
|
20
|
+
* cannot disagree.
|
|
18
21
|
*/
|
|
19
22
|
export declare const isDev: boolean;
|
|
20
23
|
export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
|
|
21
24
|
export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
|
|
22
25
|
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
23
|
-
export
|
|
26
|
+
export interface DynamicOptions {
|
|
27
|
+
/**
|
|
28
|
+
* SSR only: hold the document's first flush until the source settles, so
|
|
29
|
+
* the resolved component renders into the shell instead of streaming in
|
|
30
|
+
* behind its boundary's fallback. Same meaning as `createMemo`'s
|
|
31
|
+
* `deferStream`. Default `false` — a `dynamic()` source is data of unknown
|
|
32
|
+
* cost and streams by default (a code-split `lazy()` always holds the shell
|
|
33
|
+
* for its module load, since its code is a prerequisite to the render).
|
|
34
|
+
*/
|
|
35
|
+
deferStream?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
24
38
|
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
25
39
|
[K in keyof P]: P[K];
|
|
26
40
|
} & {
|
|
@@ -90,9 +104,14 @@ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
|
|
|
90
104
|
* write without stomping a status a surviving part of the tree legitimately
|
|
91
105
|
* set (e.g. a 404 page whose inner boundary recovers stays a 404), and
|
|
92
106
|
* sibling scopes may dispose in any order (#2984). Both the write and the
|
|
93
|
-
* cleanup are no-ops once the
|
|
94
|
-
*
|
|
95
|
-
*
|
|
107
|
+
* cleanup are no-ops once the response head is `committed` (head
|
|
108
|
+
* derived/sent — status can no longer change). The head commits when it
|
|
109
|
+
* freezes: at shell flush for a piped `renderToStream` (`createSSRResponse`
|
|
110
|
+
* commits on the first write), at completion for an awaited one (the render
|
|
111
|
+
* commits right before its final dispose, so the declarations still live at
|
|
112
|
+
* that point are the ones the consumer derives the head from), and when
|
|
113
|
+
* `createSSRResponse` receives a `renderToString` result. On the client this
|
|
114
|
+
* is a no-op.
|
|
96
115
|
*/
|
|
97
116
|
export declare function httpStatus(code: number, text?: string): void;
|
|
98
117
|
/**
|
|
@@ -116,9 +135,12 @@ export declare function httpStatus(code: number, text?: string): void;
|
|
|
116
135
|
* multiple values must survive as separate entries — the base is captured
|
|
117
136
|
* and replayed entry-exact (`getSetCookie()` + re-append; `get()`/`set()`
|
|
118
137
|
* would comma-join the entries and then collapse them into one corrupt
|
|
119
|
-
* header). Both the write and the cleanup are no-ops once the
|
|
120
|
-
*
|
|
121
|
-
*
|
|
138
|
+
* header). Both the write and the cleanup are no-ops once the response head
|
|
139
|
+
* is `committed` (head derived/sent — headers can no longer change); the
|
|
140
|
+
* head commits when it freezes — shell flush for a piped `renderToStream`,
|
|
141
|
+
* completion (right before the final dispose) for an awaited one,
|
|
142
|
+
* `createSSRResponse` for a `renderToString` result — see `httpStatus`. On
|
|
143
|
+
* the client this is a no-op.
|
|
122
144
|
*/
|
|
123
145
|
export declare function httpHeader(name: string, value: string, options?: {
|
|
124
146
|
append?: boolean;
|
package/types/render.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** Dev: remember the element the running binding effect writes (first one wins). */
|
|
2
|
+
export declare function tagElement(node: Node): void;
|
|
3
|
+
export declare function effect<T>(fn: (prev?: T) => T, effectFn: (value: T, prev?: T) => void | (() => void), options?: {
|
|
2
4
|
scope?: boolean;
|
|
3
5
|
}): void;
|
|
4
6
|
export declare function memo<T>(fn: () => T): () => T;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function setFlashSecret(secret: any): void;
|
|
1
2
|
/**
|
|
2
3
|
* The outcome of a call made without the client runtime, as it rides the
|
|
3
4
|
* flash cookie: what was submitted, where, and what came back. `result` and
|
|
@@ -7,7 +8,15 @@
|
|
|
7
8
|
export interface FlashSubmission {
|
|
8
9
|
/** The arguments the call was made with (files are dropped). */
|
|
9
10
|
input: any[];
|
|
10
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* The call's url: the UNBOUND function base — the server function
|
|
13
|
+
* request's pathname (`<endpoint>/<id>`), without the `?args=` query a
|
|
14
|
+
* `.with()`-bound form's action carries (or any other query decoration).
|
|
15
|
+
* Matches what the scripted road records as a submission's url, so
|
|
16
|
+
* integrations can match flash and scripted submissions with the same
|
|
17
|
+
* `s.url === fn.base` test; bound arguments arrive in `input` instead,
|
|
18
|
+
* prepended exactly like a scripted call's.
|
|
19
|
+
*/
|
|
11
20
|
url: string;
|
|
12
21
|
/** The returned value, when the call returned. */
|
|
13
22
|
result?: any;
|
|
@@ -23,5 +32,5 @@ export interface FlashSubmission {
|
|
|
23
32
|
*/
|
|
24
33
|
truncated?: boolean;
|
|
25
34
|
}
|
|
26
|
-
export declare function encodeFlashCookie(url: string, result: any, input: any[], thrown?: boolean): string
|
|
27
|
-
export declare function decodeFlashCookie(cookieHeader: string | null): FlashSubmission | undefined
|
|
35
|
+
export declare function encodeFlashCookie(url: string, result: any, input: any[], thrown?: boolean): Promise<string | null>;
|
|
36
|
+
export declare function decodeFlashCookie(cookieHeader: string | null): Promise<FlashSubmission | undefined>;
|
|
@@ -241,7 +241,9 @@ export interface ServerFunctionsServerConfig {
|
|
|
241
241
|
/**
|
|
242
242
|
* Codec options (extra plugins etc.) for decoding arguments and encoding
|
|
243
243
|
* results — must match the client's. Stored in the shared layer, so
|
|
244
|
-
* `decodeResponse` sees them too.
|
|
244
|
+
* `decodeResponse` sees them too. When `serializeErrorStacks` is omitted,
|
|
245
|
+
* the server-function boundary defaults it from this module's compiled
|
|
246
|
+
* development variant.
|
|
245
247
|
*/
|
|
246
248
|
codec?: JSONCodecOptions;
|
|
247
249
|
/**
|
|
@@ -262,6 +264,25 @@ export interface ServerFunctionsServerConfig {
|
|
|
262
264
|
* @default 1000
|
|
263
265
|
*/
|
|
264
266
|
maxArguments?: number;
|
|
267
|
+
/**
|
|
268
|
+
* The DEPLOYMENT SECRET: one value per deployment, from which any feature
|
|
269
|
+
* that needs a key derives its own (domain-separated, so per-purpose keys
|
|
270
|
+
* share no material). Today one feature does — the no-JS flash cookie
|
|
271
|
+
* (#3239): the flash carries the submitted form input — whatever the user
|
|
272
|
+
* typed — so its payload is always AES-GCM encrypted; it never rides the
|
|
273
|
+
* wire or rests in the cookie jar as plaintext. Every instance that can
|
|
274
|
+
* serve the render after a form post must share the secret (behind a load
|
|
275
|
+
* balancer, a per-instance secret would silently lose outcomes), so there
|
|
276
|
+
* is no generated fallback here: when this is not set, the secret falls
|
|
277
|
+
* back to the one the Solid bundler plugin injects into the server build
|
|
278
|
+
* (a fresh value per build), and with neither present the outcome is
|
|
279
|
+
* simply not flashed — the form post still redirects cleanly, and dev
|
|
280
|
+
* builds warn once. Any non-empty string works; rotating it (or
|
|
281
|
+
* redeploying with the plugin's value) invalidates in-flight flashes,
|
|
282
|
+
* which are 60-second one-shot cookies — the next render reads "no
|
|
283
|
+
* flash".
|
|
284
|
+
*/
|
|
285
|
+
secret?: string;
|
|
265
286
|
}
|
|
266
287
|
/**
|
|
267
288
|
* A registered server function: its build-stable id paired with the
|
|
@@ -318,8 +339,13 @@ export interface HandleServerFunctionOptions {
|
|
|
318
339
|
/**
|
|
319
340
|
* Overrides the configured per-invocation wrap for this handler — same
|
|
320
341
|
* contract as the `wrapInvocation` config option (see
|
|
321
|
-
* `WrapInvocationHook`), except it
|
|
322
|
-
*
|
|
342
|
+
* `WrapInvocationHook`), except it is ENTRY-ONLY: it wraps exactly the
|
|
343
|
+
* invocation the request addressed. Nested direct server-function calls
|
|
344
|
+
* made by the dispatched body are not re-wrapped by it — they consult
|
|
345
|
+
* only the configured hook, which is ambient and wraps every direct call
|
|
346
|
+
* (a per-request option can't see direct SSR calls). Policy that must
|
|
347
|
+
* cover every hop belongs on `configureServerFunctionsServer`'s
|
|
348
|
+
* `wrapInvocation`, not here.
|
|
323
349
|
*/
|
|
324
350
|
wrapInvocation?: WrapInvocationHook;
|
|
325
351
|
/**
|
|
@@ -420,7 +446,7 @@ export declare function live<A extends readonly any[], R>(fn: (...args: A) => R)
|
|
|
420
446
|
export declare function getServerFunctionInvocation(): ServerFunctionInvocation | undefined;
|
|
421
447
|
export declare function getEventServerFunctionInvocation(event: RequestEvent | undefined): ServerFunctionInvocation | undefined;
|
|
422
448
|
export declare function foldSetCookies(headers: Headers, setCookies: readonly string[]): Headers;
|
|
423
|
-
export declare function createNoJSHandler(options?: NoJSHandlerOptions): (result: unknown, request: Request, args: unknown[], thrown?: boolean) => Response
|
|
449
|
+
export declare function createNoJSHandler(options?: NoJSHandlerOptions): (result: unknown, request: Request, args: unknown[], thrown?: boolean) => Promise<Response>;
|
|
424
450
|
/** @internal */
|
|
425
451
|
export declare function guardFailures(value: any, state: any): any;
|
|
426
452
|
/**
|
|
@@ -440,7 +466,7 @@ export declare function guardFailures(value: any, state: any): any;
|
|
|
440
466
|
* teardown registry are threaded through its state (`{ items: rows() }` —
|
|
441
467
|
* a cursor beside a total — gets the same two guarantees as `return rows()`).
|
|
442
468
|
*/
|
|
443
|
-
export declare function serializeResponseStream(value: any, codecOptions: any, signal: any): ReadableStream<any>;
|
|
469
|
+
export declare function serializeResponseStream(value: any, codecOptions: any, signal: any, scope: any): ReadableStream<any>;
|
|
444
470
|
/** Message a sanitized (production) server error carries on the wire. */
|
|
445
471
|
export declare const GENERIC_SERVER_ERROR_MESSAGE = "Internal Server Error";
|
|
446
472
|
export declare function setServerFunctionsDev(dev: boolean): void;
|
|
@@ -448,4 +474,73 @@ export declare function sanitizeServerError(value: unknown): unknown;
|
|
|
448
474
|
export declare function observeServerFunctionCalls(observer: (call: ServerFunctionCall) => void): () => void;
|
|
449
475
|
export declare function serverFunctionUrl(id: string, boundArgs?: readonly unknown[]): string;
|
|
450
476
|
export declare function parseServerFunctionUrl(url: string): string | null;
|
|
477
|
+
/**
|
|
478
|
+
* Web-standard HTTP handler for server function calls: resolves the
|
|
479
|
+
* function id from the request, enforces the method allowlist (POST always
|
|
480
|
+
* dispatches; GET and HEAD dispatch only to functions that declared `GET`,
|
|
481
|
+
* with HEAD returning the equivalent GET's status and headers minus the
|
|
482
|
+
* body; every other method answers 405), decodes arguments, runs the
|
|
483
|
+
* function under a request-event scope, and encodes the result (forwarding
|
|
484
|
+
* redirect/revalidation metadata through headers). Mount it on the endpoint
|
|
485
|
+
* the client transport targets (default `/_server`); platform adapters (h3,
|
|
486
|
+
* express, ...) convert their request shape to a web `Request` around it.
|
|
487
|
+
*
|
|
488
|
+
* Requests are same-origin by default. The handler accepts browser requests
|
|
489
|
+
* proven by `Sec-Fetch-Site`, `Origin`, or `Referer`, and rejects requests
|
|
490
|
+
* without usable metadata unless explicitly configured otherwise. GET/HEAD
|
|
491
|
+
* requests to `GET`-declared functions skip this gate: they are reads by
|
|
492
|
+
* contract, cross-site response READING is already blocked by same-origin
|
|
493
|
+
* policy, and skipping it keeps the `Vary: Sec-Fetch-Site, Origin, Referer`
|
|
494
|
+
* it would impose off the responses shared caches are meant to store.
|
|
495
|
+
*
|
|
496
|
+
* Every response leaves with `Cache-Control: no-store` unless the function
|
|
497
|
+
* set its own cache policy (via `respond()` headers or a returned
|
|
498
|
+
* `Response`) — caching is opt-in on the wire, not just in prose.
|
|
499
|
+
*
|
|
500
|
+
* When the event carries a `response` head stub (`event.response`, see the
|
|
501
|
+
* server entry's `ResponseStub`), the handler folds it onto every outgoing
|
|
502
|
+
* response as the head freezes — its `Set-Cookie` values (cookies appended
|
|
503
|
+
* during the call) append cookie-by-cookie alongside the result's own,
|
|
504
|
+
* other stub headers fill gaps (the call's response metadata wins; the
|
|
505
|
+
* protocol-owned family — the error/format/single-flight tags, `Location`,
|
|
506
|
+
* `X-Revalidate` — never fills, and neither does `Content-Type`/`Content-
|
|
507
|
+
* Length` onto a bodiless response) — and marks the stub `committed`, so
|
|
508
|
+
* later cookie/header writes report instead of silently missing the wire.
|
|
509
|
+
*
|
|
510
|
+
* ## Thrown-error sanitization (security default)
|
|
511
|
+
*
|
|
512
|
+
* A thrown `Response`/envelope (`redirect`/`reload`/`respond`) is intentional
|
|
513
|
+
* control flow and is forwarded untouched. A *plain* thrown value (a bare
|
|
514
|
+
* `Error`, string, or object) is different: serialized verbatim it would ship
|
|
515
|
+
* its `message` and every own-property to the client — a driver/ORM error's
|
|
516
|
+
* failing query, connection string, or bound parameters included. So outside
|
|
517
|
+
* the dev build a plain thrown value is replaced with a generic `Error`
|
|
518
|
+
* before serialization; the client still receives *an* `Error` (the shape
|
|
519
|
+
* `submission.error` etc. expect), just with no leaked content. The dev
|
|
520
|
+
* build keeps full fidelity (message, stack, own-props) for DX and the dev
|
|
521
|
+
* toolbar inspector. Dev/prod is the BUILD VARIANT, not `NODE_ENV`:
|
|
522
|
+
* `@solidjs/web` publishes a dev copy of this entry behind the
|
|
523
|
+
* `development` export condition (what Vite dev resolves) and the default
|
|
524
|
+
* resolution sanitizes — as does importing the runtime source directly with
|
|
525
|
+
* no bundler signal (fail-safe).
|
|
526
|
+
*
|
|
527
|
+
* Escape hatch: brand the value with `markSafeError` (`Symbol.for(
|
|
528
|
+
* "solid.SafeError")`) to send its content intact in every environment.
|
|
529
|
+
* A `wrapInvocation`/`transformResult` override that maps errors expresses
|
|
530
|
+
* intent the same way — throw a `Response`/envelope, or brand the mapped
|
|
531
|
+
* error safe; an unbranded plain error it lets propagate is sanitized like
|
|
532
|
+
* any other, so a framework onError policy must brand its result to keep a
|
|
533
|
+
* custom client-facing message in production.
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* ```ts
|
|
537
|
+
* import { handleServerFunctionRequest } from "@solidjs/web/server-functions";
|
|
538
|
+
* import "virtual:solid-server-function-manifest";
|
|
539
|
+
*
|
|
540
|
+
* // in the server's request handling:
|
|
541
|
+
* if (url.pathname.startsWith("/_server")) {
|
|
542
|
+
* return handleServerFunctionRequest(request);
|
|
543
|
+
* }
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
451
546
|
export declare function handleServerFunctionRequest(request: Request, options?: HandleServerFunctionOptions): Promise<Response>;
|
package/types/server-mock.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { RequestEvent, RequestEventLocals, ResponseStub } from "./client.js";
|
|
2
2
|
import type { JSX } from "./jsx.js";
|
|
3
|
-
|
|
4
|
-
export type PreloadLink = {
|
|
5
|
-
href: string;
|
|
6
|
-
as: JSX.HTMLPreloadAs;
|
|
3
|
+
type PreloadLinkAttributes = {
|
|
7
4
|
type?: string;
|
|
8
5
|
crossorigin?: JSX.HTMLCrossorigin;
|
|
9
6
|
integrity?: string;
|
|
@@ -11,7 +8,44 @@ export type PreloadLink = {
|
|
|
11
8
|
fetchpriority?: JSX.HTMLFetchPriority;
|
|
12
9
|
media?: string;
|
|
13
10
|
};
|
|
14
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* An explicit `<link rel="preload">` emitted by the SSR asset pipeline.
|
|
13
|
+
*
|
|
14
|
+
* `as` is the HTML Standard's set of preload destinations exactly — anything
|
|
15
|
+
* else translates to null and the browser does nothing with the link.
|
|
16
|
+
*
|
|
17
|
+
* `imagesrcset` candidates must already be resolved by the integration: they
|
|
18
|
+
* are carried verbatim (a relative candidate resolves against the DOCUMENT
|
|
19
|
+
* URL, not the manifest base). Pair it with `imagesizes` whenever a candidate
|
|
20
|
+
* uses a width descriptor, which the spec requires — without it the source
|
|
21
|
+
* size falls back to `100vw` and the preload can miss the image the `<img>`
|
|
22
|
+
* selects. Omitting `href` is the spec's own recommendation for the source-set
|
|
23
|
+
* form: it would only serve browsers without `imagesrcset` support, and there
|
|
24
|
+
* it would likely preload the wrong candidate.
|
|
25
|
+
*/
|
|
26
|
+
export type PreloadLink = PreloadLinkAttributes & ({
|
|
27
|
+
href: string;
|
|
28
|
+
as: Exclude<JSX.HTMLPreloadAs, "image">;
|
|
29
|
+
imagesrcset?: never;
|
|
30
|
+
imagesizes?: never;
|
|
31
|
+
} | {
|
|
32
|
+
href: string;
|
|
33
|
+
as: "image";
|
|
34
|
+
imagesrcset?: string;
|
|
35
|
+
imagesizes?: string;
|
|
36
|
+
} | {
|
|
37
|
+
href?: never;
|
|
38
|
+
as: "image";
|
|
39
|
+
imagesrcset: string;
|
|
40
|
+
imagesizes?: string;
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Static asset graph consumed by the SSR pipeline. This is Solid's own
|
|
44
|
+
* contract — a parsed Vite client manifest satisfies it structurally
|
|
45
|
+
* (unknown fields pass through untyped), but any bundler integration can
|
|
46
|
+
* produce it. Only these fields are ever read: `preloads` is Solid's
|
|
47
|
+
* extension slot for explicit typed links the integration selects.
|
|
48
|
+
*/
|
|
15
49
|
export type AssetManifest = Record<string, {
|
|
16
50
|
file: string;
|
|
17
51
|
css?: string[];
|
|
@@ -195,8 +229,9 @@ export declare function getExpectedRedirectStatus(response: ResponseStub): numbe
|
|
|
195
229
|
* shell flush, a pre-flush `Location` becomes a real redirect
|
|
196
230
|
* (`getExpectedRedirectStatus`), and a post-flush one appends the
|
|
197
231
|
* nonce-aware `<script>window.location=...</script>` fallback. String
|
|
198
|
-
* results return a `Response` synchronously
|
|
199
|
-
*
|
|
232
|
+
* results return a `Response` synchronously (an awaited `renderToStream`
|
|
233
|
+
* result arrives already committed — its head froze at completion); stream
|
|
234
|
+
* results resolve at shell flush. Server-only.
|
|
200
235
|
*/
|
|
201
236
|
export declare function createSSRResponse(result: string, event: RequestEvent | undefined, options?: {
|
|
202
237
|
responseInit?: ResponseInit;
|
|
@@ -299,3 +334,4 @@ export declare function resolveSSRNode(node: any, result?: any, top?: boolean):
|
|
|
299
334
|
* @internal
|
|
300
335
|
*/
|
|
301
336
|
export declare function escape(s: any, attr?: boolean): any;
|
|
337
|
+
export {};
|
package/types/server.d.ts
CHANGED
|
@@ -5,10 +5,7 @@ export { clearFlashCookie, hasFlashCookie } from "./cookies.js";
|
|
|
5
5
|
export { getServerFunctionMetadata, getServerFunctionRPC, isServerFunction } from "./server-functions/registry.js";
|
|
6
6
|
import { JSX } from "./jsx.js";
|
|
7
7
|
import { SerializerPlugin } from "./serializer-decode.js";
|
|
8
|
-
|
|
9
|
-
export type PreloadLink = {
|
|
10
|
-
href: string;
|
|
11
|
-
as: JSX.HTMLPreloadAs;
|
|
8
|
+
type PreloadLinkAttributes = {
|
|
12
9
|
type?: string;
|
|
13
10
|
crossorigin?: JSX.HTMLCrossorigin;
|
|
14
11
|
integrity?: string;
|
|
@@ -16,7 +13,44 @@ export type PreloadLink = {
|
|
|
16
13
|
fetchpriority?: JSX.HTMLFetchPriority;
|
|
17
14
|
media?: string;
|
|
18
15
|
};
|
|
19
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* An explicit `<link rel="preload">` emitted by the SSR asset pipeline.
|
|
18
|
+
*
|
|
19
|
+
* `as` is the HTML Standard's set of preload destinations exactly — anything
|
|
20
|
+
* else translates to null and the browser does nothing with the link.
|
|
21
|
+
*
|
|
22
|
+
* `imagesrcset` candidates must already be resolved by the integration: they
|
|
23
|
+
* are carried verbatim (a relative candidate resolves against the DOCUMENT
|
|
24
|
+
* URL, not the manifest base). Pair it with `imagesizes` whenever a candidate
|
|
25
|
+
* uses a width descriptor, which the spec requires — without it the source
|
|
26
|
+
* size falls back to `100vw` and the preload can miss the image the `<img>`
|
|
27
|
+
* selects. Omitting `href` is the spec's own recommendation for the source-set
|
|
28
|
+
* form: it would only serve browsers without `imagesrcset` support, and there
|
|
29
|
+
* it would likely preload the wrong candidate.
|
|
30
|
+
*/
|
|
31
|
+
export type PreloadLink = PreloadLinkAttributes & ({
|
|
32
|
+
href: string;
|
|
33
|
+
as: Exclude<JSX.HTMLPreloadAs, "image">;
|
|
34
|
+
imagesrcset?: never;
|
|
35
|
+
imagesizes?: never;
|
|
36
|
+
} | {
|
|
37
|
+
href: string;
|
|
38
|
+
as: "image";
|
|
39
|
+
imagesrcset?: string;
|
|
40
|
+
imagesizes?: string;
|
|
41
|
+
} | {
|
|
42
|
+
href?: never;
|
|
43
|
+
as: "image";
|
|
44
|
+
imagesrcset: string;
|
|
45
|
+
imagesizes?: string;
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Static asset graph consumed by the SSR pipeline. This is Solid's own
|
|
49
|
+
* contract — a parsed Vite client manifest satisfies it structurally
|
|
50
|
+
* (unknown fields pass through untyped), but any bundler integration can
|
|
51
|
+
* produce it. Only these fields are ever read: `preloads` is Solid's
|
|
52
|
+
* extension slot for explicit typed links the integration selects.
|
|
53
|
+
*/
|
|
20
54
|
export type AssetManifest = Record<string, {
|
|
21
55
|
file: string;
|
|
22
56
|
css?: string[];
|
|
@@ -233,6 +267,14 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
233
267
|
* await renderToStream(...)`). Render errors route through `onError` and
|
|
234
268
|
* the promise resolves with whatever HTML the render produced; it never
|
|
235
269
|
* rejects.
|
|
270
|
+
*
|
|
271
|
+
* Completion is this path's head-freeze point: the request event's
|
|
272
|
+
* `response` head (the request scope the render was started in) is
|
|
273
|
+
* committed right before the render's final dispose, so
|
|
274
|
+
* `httpStatus`/`httpHeader` declarations still live at completion survive
|
|
275
|
+
* into `createSSRResponse(html, event)` — which sees the already-committed
|
|
276
|
+
* stub and passes it through. The piped forms freeze at shell flush
|
|
277
|
+
* instead.
|
|
236
278
|
*/
|
|
237
279
|
then<TResult1 = string, TResult2 = never>(onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
238
280
|
pipe: (writable: {
|
package/types-cjs/client.d.cts
CHANGED
|
@@ -79,8 +79,6 @@ export interface RequestEvent {
|
|
|
79
79
|
export type { CookieOptions } from "./cookies.cjs";
|
|
80
80
|
export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./server-functions/shared.cjs";
|
|
81
81
|
export declare const waitAsset: (promise: Promise<unknown>) => void;
|
|
82
|
-
export declare let listDriver: ((parent: Node, listFn: any, marker?: Node, lateClassic?: () => void) => boolean) | undefined;
|
|
83
|
-
export declare function installListDriver(driver: typeof listDriver): void;
|
|
84
82
|
export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.cjs";
|
|
85
83
|
/** Client stub — hydration bootstrap is a server-only emit. */
|
|
86
84
|
export declare function generateHydrationScript(_options?: {
|
|
@@ -136,7 +134,7 @@ export declare function claimElement<T extends Element>(node: T): T;
|
|
|
136
134
|
export declare function setAttribute(node: Element, name: string, value: string): void;
|
|
137
135
|
export declare function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
138
136
|
export declare function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
|
|
139
|
-
export declare function addEvent(node: Element, name: string, handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions), delegate: boolean): void;
|
|
137
|
+
export declare function addEvent(node: Element, name: string, handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions), delegate: boolean): EventListener | EventListenerObject | void;
|
|
140
138
|
export declare function style(node: Element, value: {
|
|
141
139
|
[k: string]: string;
|
|
142
140
|
}, prev?: {
|
|
@@ -15,4 +15,6 @@ declare const Namespaces: Record<string, string>;
|
|
|
15
15
|
declare const VoidElements: Set<string>;
|
|
16
16
|
declare const RawTextElements: Set<string>;
|
|
17
17
|
declare const DOMElements: Set<string>;
|
|
18
|
-
|
|
18
|
+
declare const COMPOSED_BODY_FRAMING: ReadonlySet<string>;
|
|
19
|
+
declare function isHttpNavigationTarget(target: string): boolean;
|
|
20
|
+
export { DOMWithState, ChildProperties, DelegatedEvents, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DOMElements, $$SLOT, $$HOST, COMPOSED_BODY_FRAMING, isHttpNavigationTarget };
|
package/types-cjs/head.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const HEAD_ELIGIBLE_TAGS: Set<string>;
|
|
2
2
|
export declare const HEAD_ATTR_NAME: RegExp;
|
|
3
3
|
export declare const RESOURCE_LINK_RELS: Set<string>;
|
|
4
|
+
export declare const RESOURCE_QUALIFIERS: string[];
|
|
4
5
|
export declare const STYLESHEET_FETCH_META: Set<string>;
|
|
5
6
|
export declare function evalHeadValue(v: any): any;
|
|
6
7
|
export declare function evalHeadProps(props: any, presets: any): {};
|
|
@@ -11,6 +12,8 @@ export declare function classifyHeadTag(desc: any): {
|
|
|
11
12
|
resource: boolean;
|
|
12
13
|
rel?: undefined;
|
|
13
14
|
};
|
|
15
|
+
export declare function qualifierValue(name: any, value: any): any;
|
|
16
|
+
export declare function asciiLowerCase(value: any): any;
|
|
14
17
|
export declare function resourceIdentity(tag: any, props: any): string;
|
|
15
18
|
export declare function replaceableIdentity(tag: any, props: any, key: any, unique: any): any;
|
|
16
19
|
export declare function resolveHead(groups: any): Map<any, any>;
|
package/types-cjs/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Component } from "solid-js";
|
|
2
2
|
import type { JSX } from "./jsx.cjs";
|
|
3
3
|
export * from "./client.cjs";
|
|
4
|
-
export { patchDriver, rowProof, driveList } from "./patch-driver.cjs";
|
|
5
4
|
export * from "./server-mock.cjs";
|
|
6
5
|
export * from "./response.cjs";
|
|
7
6
|
export type { JSX } from "./jsx.cjs";
|
|
@@ -79,7 +78,16 @@ export declare function Portal(props: {
|
|
|
79
78
|
mount?: Element;
|
|
80
79
|
children: JSX.Element;
|
|
81
80
|
}): JSX.Element;
|
|
82
|
-
export
|
|
81
|
+
export interface DynamicOptions {
|
|
82
|
+
/**
|
|
83
|
+
* SSR only: hold the document's first flush until the source settles, so
|
|
84
|
+
* the resolved component renders into the shell instead of streaming in
|
|
85
|
+
* behind its boundary's fallback. Same meaning as `createMemo`'s
|
|
86
|
+
* `deferStream`. Ignored on the client.
|
|
87
|
+
*/
|
|
88
|
+
deferStream?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, _options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
83
91
|
/**
|
|
84
92
|
* Renders an arbitrary custom or native component and forwards the other
|
|
85
93
|
* props. JSX form of `dynamic()` — same primitive, picked at the JSX site.
|
|
@@ -152,9 +160,10 @@ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
|
|
|
152
160
|
* `event.response` status at write time and restores it when the owning
|
|
153
161
|
* scope is disposed — so a boundary that errored, declared a status, and
|
|
154
162
|
* then recovered retracts its write instead of stomping a status a
|
|
155
|
-
* surviving part of the tree legitimately set. Once the
|
|
156
|
-
*
|
|
157
|
-
*
|
|
163
|
+
* surviving part of the tree legitimately set. Once the response head is
|
|
164
|
+
* `committed` (head derived/sent — the shell flush of a piped
|
|
165
|
+
* `renderToStream`, the completion of an awaited one, `createSSRResponse`
|
|
166
|
+
* for a `renderToString` result), writes and retractions are no-ops.
|
|
158
167
|
*/
|
|
159
168
|
export declare function httpStatus(_code: number, _text?: string): void;
|
|
160
169
|
/**
|
|
@@ -172,8 +181,10 @@ export declare function httpStatus(_code: number, _text?: string): void;
|
|
|
172
181
|
* Retraction semantics (server): the header's prior value is snapshotted at
|
|
173
182
|
* write time and restored when the owning scope is disposed (deleted if
|
|
174
183
|
* there was none) — a boundary that errors or recovers retracts its writes.
|
|
175
|
-
* Once the
|
|
176
|
-
*
|
|
184
|
+
* Once the response head is `committed` (head derived/sent — the shell
|
|
185
|
+
* flush of a piped `renderToStream`, the completion of an awaited one,
|
|
186
|
+
* `createSSRResponse` for a `renderToString` result), writes and
|
|
187
|
+
* retractions are no-ops.
|
|
177
188
|
*/
|
|
178
189
|
export declare function httpHeader(_name: string, _value: string, _options?: {
|
|
179
190
|
append?: boolean;
|