@solidjs/web 2.0.0-rc.6 → 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 +105 -35
- package/dist/server.dev.cjs +3794 -0
- package/dist/server.dev.js +3627 -0
- package/dist/server.js +106 -36
- package/dist/web.cjs +39 -385
- package/dist/{dev.cjs → web.dev.cjs} +91 -396
- package/dist/{dev.js → web.dev.js} +93 -393
- package/dist/web.js +41 -382
- 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 +234 -32
- package/frames/dist/server.dev.cjs +4584 -0
- package/frames/dist/server.dev.js +4571 -0
- package/frames/dist/server.js +234 -32
- 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 +13 -14
- package/server-functions/dist/client.js +13 -14
- package/server-functions/dist/server.cjs +331 -83
- package/server-functions/dist/server.dev.cjs +338 -82
- package/server-functions/dist/server.dev.js +338 -82
- package/server-functions/dist/server.js +331 -83
- package/types/client.d.ts +0 -3
- 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 +27 -3
- package/types/server-mock.d.ts +43 -7
- package/types/server.d.ts +47 -5
- package/types-cjs/client.d.cts +0 -3
- 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 +27 -3
- 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
|
@@ -264,6 +264,25 @@ export interface ServerFunctionsServerConfig {
|
|
|
264
264
|
* @default 1000
|
|
265
265
|
*/
|
|
266
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;
|
|
267
286
|
}
|
|
268
287
|
/**
|
|
269
288
|
* A registered server function: its build-stable id paired with the
|
|
@@ -320,8 +339,13 @@ export interface HandleServerFunctionOptions {
|
|
|
320
339
|
/**
|
|
321
340
|
* Overrides the configured per-invocation wrap for this handler — same
|
|
322
341
|
* contract as the `wrapInvocation` config option (see
|
|
323
|
-
* `WrapInvocationHook`), except it
|
|
324
|
-
*
|
|
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.
|
|
325
349
|
*/
|
|
326
350
|
wrapInvocation?: WrapInvocationHook;
|
|
327
351
|
/**
|
|
@@ -422,7 +446,7 @@ export declare function live<A extends readonly any[], R>(fn: (...args: A) => R)
|
|
|
422
446
|
export declare function getServerFunctionInvocation(): ServerFunctionInvocation | undefined;
|
|
423
447
|
export declare function getEventServerFunctionInvocation(event: RequestEvent | undefined): ServerFunctionInvocation | undefined;
|
|
424
448
|
export declare function foldSetCookies(headers: Headers, setCookies: readonly string[]): Headers;
|
|
425
|
-
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>;
|
|
426
450
|
/** @internal */
|
|
427
451
|
export declare function guardFailures(value: any, state: any): any;
|
|
428
452
|
/**
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { RequestEvent, RequestEventLocals, ResponseStub } from "./client.cjs";
|
|
2
2
|
import type { JSX } from "./jsx.cjs";
|
|
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-cjs/server.d.cts
CHANGED
|
@@ -5,10 +5,7 @@ export { clearFlashCookie, hasFlashCookie } from "./cookies.cjs";
|
|
|
5
5
|
export { getServerFunctionMetadata, getServerFunctionRPC, isServerFunction } from "./server-functions/registry.cjs";
|
|
6
6
|
import { JSX } from "./jsx.cjs";
|
|
7
7
|
import { SerializerPlugin } from "./serializer-decode.cjs";
|
|
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/patch-driver.d.ts
DELETED