@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.4
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/dev.cjs +433 -72
- package/dist/dev.js +426 -71
- package/dist/server.cjs +39 -21
- package/dist/server.js +40 -23
- package/dist/web.cjs +421 -70
- package/dist/web.js +414 -69
- package/frames/dist/client.cjs +8 -8
- package/frames/dist/client.dev.cjs +8 -8
- package/frames/dist/client.dev.js +8 -8
- package/frames/dist/client.js +8 -8
- package/frames/dist/server.cjs +28 -18
- package/frames/dist/server.js +29 -19
- package/package.json +20 -22
- package/serialization/dist/decode.cjs +3 -3
- package/serialization/dist/decode.js +3 -3
- package/serialization/dist/serialization.cjs +7 -11
- package/serialization/dist/serialization.js +7 -6
- package/serialization/types/index.d.ts +69 -157
- package/serialization/types/serializer-decode.d.ts +89 -112
- package/serialization/types/serializer.d.ts +94 -0
- package/serialization/types-cjs/index.d.cts +69 -157
- package/serialization/types-cjs/serializer-decode.d.cts +89 -112
- package/serialization/types-cjs/serializer.d.cts +94 -0
- package/server-functions/dist/client.cjs +126 -19
- package/server-functions/dist/client.js +123 -19
- package/server-functions/dist/server.cjs +156 -28
- package/server-functions/dist/server.dev.cjs +156 -28
- package/server-functions/dist/server.dev.js +153 -28
- package/server-functions/dist/server.js +153 -28
- package/types/client.d.ts +152 -290
- package/types/constants.d.ts +18 -0
- package/types/cookies.d.ts +31 -75
- package/types/frames/frame-client.d.ts +287 -277
- package/types/frames/frame-container-plugin.d.ts +71 -0
- package/types/frames/frame-sink.d.ts +58 -160
- package/types/frames/frame-transport.d.ts +161 -194
- package/types/frames/serializer-decode.d.ts +159 -0
- package/types/frames/serializer.d.ts +69 -157
- package/types/head.d.ts +16 -0
- package/types/index.d.ts +1 -65
- package/types/index.server.d.ts +125 -0
- package/types/jsx.d.ts +5 -13
- package/types/patch-driver.d.ts +3 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +4 -0
- package/types/response.d.ts +48 -152
- package/types/serializer-decode.d.ts +89 -112
- package/types/serializer.d.ts +69 -157
- package/types/server-functions/client.d.ts +124 -222
- package/types/server-functions/flash.d.ts +10 -30
- package/types/server-functions/registry.d.ts +100 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +295 -574
- package/types/server-functions/shared.d.ts +155 -458
- package/types/server-mock.d.ts +2 -2
- package/types/server.d.ts +242 -434
- package/types-cjs/client.d.cts +152 -290
- package/types-cjs/constants.d.cts +18 -0
- package/types-cjs/cookies.d.cts +31 -75
- package/types-cjs/frames/frame-client.d.cts +287 -277
- package/types-cjs/frames/frame-container-plugin.d.cts +71 -0
- package/types-cjs/frames/frame-sink.d.cts +58 -160
- package/types-cjs/frames/frame-transport.d.cts +161 -194
- package/types-cjs/frames/serializer-decode.d.cts +159 -0
- package/types-cjs/frames/serializer.d.cts +69 -157
- package/types-cjs/head.d.cts +16 -0
- package/types-cjs/index.d.cts +1 -65
- package/types-cjs/index.server.d.cts +125 -0
- package/types-cjs/jsx.d.cts +5 -13
- package/types-cjs/patch-driver.d.cts +3 -0
- package/types-cjs/reconcile.d.cts +1 -0
- package/types-cjs/render.d.cts +4 -0
- package/types-cjs/response.d.cts +48 -152
- package/types-cjs/serializer-decode.d.cts +89 -112
- package/types-cjs/serializer.d.cts +69 -157
- package/types-cjs/server-functions/client.d.cts +124 -222
- package/types-cjs/server-functions/flash.d.cts +10 -30
- package/types-cjs/server-functions/registry.d.cts +100 -0
- package/types-cjs/server-functions/rich-args.d.cts +1 -10
- package/types-cjs/server-functions/server.d.cts +295 -574
- package/types-cjs/server-functions/shared.d.cts +155 -458
- package/types-cjs/server-mock.d.cts +2 -2
- package/types-cjs/server.d.cts +242 -434
- package/LICENSE +0 -21
- package/types/core.d.ts +0 -9
- package/types-cjs/core.d.cts +0 -9
package/types-cjs/server.d.cts
CHANGED
|
@@ -1,35 +1,29 @@
|
|
|
1
|
+
import { sharedConfig, getOwner, createComponent, untrack, merge as mergeProps, ssrScope as scope } from "solid-js";
|
|
2
|
+
import { effect, memo } from "./render.cjs";
|
|
3
|
+
export { parseCookieHeader, serializeCookie } from "./cookies.cjs";
|
|
4
|
+
export { clearFlashCookie, hasFlashCookie } from "./cookies.cjs";
|
|
5
|
+
export { getServerFunctionMetadata, getServerFunctionRPC, isServerFunction } from "./server-functions/registry.cjs";
|
|
1
6
|
import { JSX } from "./jsx.cjs";
|
|
2
7
|
import { SerializerPlugin } from "./serializer-decode.cjs";
|
|
3
|
-
export const DOMWithState: Record<string, Record<string, 1 | 2>>;
|
|
4
|
-
export const ChildProperties: Set<string>;
|
|
5
|
-
export const DelegatedEvents: Set<string>;
|
|
6
|
-
export const DOMElements: Set<string>;
|
|
7
|
-
export const SVGElements: Set<string>;
|
|
8
|
-
export const MathMLElements: Set<string>;
|
|
9
|
-
export const VoidElements: Set<string>;
|
|
10
|
-
export const RawTextElements: Set<string>;
|
|
11
|
-
export const Namespaces: Record<string, string>;
|
|
12
|
-
|
|
13
|
-
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
14
|
-
|
|
15
8
|
/** Static asset manifest produced by a build (e.g. parsed Vite manifest.json). */
|
|
16
|
-
export type AssetManifest = Record<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
export type AssetManifest = Record<string, {
|
|
10
|
+
file: string;
|
|
11
|
+
css?: string[];
|
|
12
|
+
isEntry?: boolean;
|
|
13
|
+
imports?: string[];
|
|
14
|
+
}> & {
|
|
15
|
+
_base?: string;
|
|
16
|
+
};
|
|
21
17
|
/** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
|
|
22
18
|
export type InlineStyleAsset = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
id: string;
|
|
20
|
+
content: string;
|
|
21
|
+
attrs?: Record<string, string>;
|
|
26
22
|
};
|
|
27
|
-
|
|
28
23
|
export type ResolvedAssets = {
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
js: string[];
|
|
25
|
+
css: (string | InlineStyleAsset)[];
|
|
31
26
|
};
|
|
32
|
-
|
|
33
27
|
/**
|
|
34
28
|
* Resolver form of the manifest option — the primitive a dev server
|
|
35
29
|
* implements against its live module graph (a static manifest object is
|
|
@@ -40,23 +34,17 @@ export type ResolvedAssets = {
|
|
|
40
34
|
* is accepted as shorthand for `{ resolve }`.
|
|
41
35
|
*/
|
|
42
36
|
export type AssetResolver = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*/
|
|
52
|
-
resolveSync?(key: string): ResolvedAssets | null | undefined;
|
|
37
|
+
resolve(key: string): ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* Synchronous fast path answering with whatever is knowable without async
|
|
40
|
+
* work (typically js URLs, omitting css). Sync consumers — e.g. a lazy
|
|
41
|
+
* component's `moduleUrl` getter used by islands — use this when `resolve`
|
|
42
|
+
* would return a promise, so adapters should provide it whenever possible.
|
|
43
|
+
*/
|
|
44
|
+
resolveSync?(key: string): ResolvedAssets | null | undefined;
|
|
53
45
|
};
|
|
54
|
-
|
|
55
46
|
/** Bare-function shorthand for `AssetResolver` (no sync fast path). */
|
|
56
|
-
export type AssetResolverFn = (
|
|
57
|
-
key: string
|
|
58
|
-
) => ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
|
|
59
|
-
|
|
47
|
+
export type AssetResolverFn = (key: string) => ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
|
|
60
48
|
/**
|
|
61
49
|
* CSP nonce for the tags a server render emits. A string applies to both
|
|
62
50
|
* nonce-aware destinations. A `{ script, style }` pair routes each tag to
|
|
@@ -71,106 +59,10 @@ export type AssetResolverFn = (
|
|
|
71
59
|
* emit one script (`HydrationScript`, `generateHydrationScript`,
|
|
72
60
|
* `createSSRResponse`) take a string — project with `scriptNonce`.
|
|
73
61
|
*/
|
|
74
|
-
export type CSPNonce = string | {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export function scriptNonce(nonce?: CSPNonce): string | undefined;
|
|
78
|
-
/** The style-destination half of a render `nonce`. */
|
|
79
|
-
export function styleNonce(nonce?: CSPNonce): string | undefined;
|
|
80
|
-
|
|
81
|
-
export function renderToString<T>(
|
|
82
|
-
fn: () => T,
|
|
83
|
-
options?: {
|
|
84
|
-
nonce?: CSPNonce;
|
|
85
|
-
renderId?: string;
|
|
86
|
-
noScripts?: boolean;
|
|
87
|
-
plugins?: SerializerPlugin[];
|
|
88
|
-
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
89
|
-
onError?: (err: any) => void;
|
|
90
|
-
/**
|
|
91
|
-
* Embedded-render contract for hosts that own the document. When the
|
|
92
|
-
* render output contains no `</head>`, everything head-bound (resolved
|
|
93
|
-
* `useHead` winners, eager resources, tracked asset links, inline
|
|
94
|
-
* styles) is delivered here as one HTML string — prelude (charset/base)
|
|
95
|
-
* first — for the host to splice into its own `<head>` template, instead
|
|
96
|
-
* of being dropped. Called synchronously before `renderToString`
|
|
97
|
-
* returns; not called when the output has a `</head>` (splicing is
|
|
98
|
-
* automatic then).
|
|
99
|
-
*/
|
|
100
|
-
onHead?: (head: string) => void;
|
|
101
|
-
}
|
|
102
|
-
): string;
|
|
103
|
-
export function renderToStream<T>(
|
|
104
|
-
fn: () => T,
|
|
105
|
-
options?: {
|
|
106
|
-
nonce?: CSPNonce;
|
|
107
|
-
renderId?: string;
|
|
108
|
-
noScripts?: boolean;
|
|
109
|
-
plugins?: SerializerPlugin[];
|
|
110
|
-
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
111
|
-
onCompleteShell?: (info: { write: (v: string) => void }) => void;
|
|
112
|
-
onCompleteAll?: (info: { write: (v: string) => void }) => void;
|
|
113
|
-
onError?: (err: any) => void;
|
|
114
|
-
/**
|
|
115
|
-
* Embedded-render contract for hosts that own the document. When the
|
|
116
|
-
* shell contains no `</head>`, everything head-bound at first flush
|
|
117
|
-
* (resolved `useHead` winners, eager resources, tracked asset links,
|
|
118
|
-
* inline styles) is delivered here as one HTML string — prelude first —
|
|
119
|
-
* before the shell chunk is emitted, so the host can write its own
|
|
120
|
-
* `<head>` ahead of piping the stream. Post-shell head updates flow
|
|
121
|
-
* through the stream itself and apply in the browser. Not called when
|
|
122
|
-
* the shell has a `</head>` (splicing is automatic then).
|
|
123
|
-
*/
|
|
124
|
-
onHead?: (head: string) => void;
|
|
125
|
-
}
|
|
126
|
-
): {
|
|
127
|
-
/**
|
|
128
|
-
* Awaiting the stream resolves with the complete HTML once every boundary
|
|
129
|
-
* settles — the fully-settled-string form of the render (`const html =
|
|
130
|
-
* await renderToStream(...)`). Render errors route through `onError` and
|
|
131
|
-
* the promise resolves with whatever HTML the render produced; it never
|
|
132
|
-
* rejects.
|
|
133
|
-
*/
|
|
134
|
-
then<TResult1 = string, TResult2 = never>(
|
|
135
|
-
onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null,
|
|
136
|
-
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
|
|
137
|
-
): Promise<TResult1 | TResult2>;
|
|
138
|
-
pipe: (writable: { write: (v: string) => void; end: () => void }) => void;
|
|
139
|
-
pipeTo: (writable: WritableStream) => Promise<void>;
|
|
140
|
-
/**
|
|
141
|
-
* Lazy `ReadableStream<Uint8Array>` view of the render — hand it straight
|
|
142
|
-
* to `new Response(stream.readable)`. First access starts the render
|
|
143
|
-
* piping through an internal `TransformStream` (chunks are UTF-8 encoded
|
|
144
|
-
* bytes, the same as `pipeTo` writes) and the stream is cached, so
|
|
145
|
-
* repeated access returns the same instance. Like `pipe`/`pipeTo`, this
|
|
146
|
-
* consumes the render: use exactly one of the three — mixing distinct
|
|
147
|
-
* consumers (`readable` after `pipe`/`pipeTo`, or vice versa) throws an
|
|
148
|
-
* error naming the conflict.
|
|
149
|
-
*/
|
|
150
|
-
readonly readable: ReadableStream<Uint8Array>;
|
|
62
|
+
export type CSPNonce = string | {
|
|
63
|
+
script: string | false;
|
|
64
|
+
style: string | false;
|
|
151
65
|
};
|
|
152
|
-
|
|
153
|
-
export function HydrationScript(props: { nonce?: string; eventNames?: string[] }): JSX.Element;
|
|
154
|
-
export function ssr(template: string[] | string, ...nodes: any[]): { t: string };
|
|
155
|
-
export function ssrElement(
|
|
156
|
-
name: string,
|
|
157
|
-
props: any,
|
|
158
|
-
children: any,
|
|
159
|
-
needsId: boolean
|
|
160
|
-
): { t: string };
|
|
161
|
-
export function ssrClassName(value: string | { [k: string]: boolean } | Array<any>): string;
|
|
162
|
-
export function ssrStyle(value: string | { [k: string]: string }): string;
|
|
163
|
-
export function ssrStyleProperty(name: string, value: any): string;
|
|
164
|
-
export function ssrAttribute(key: string, value: any): string;
|
|
165
|
-
export function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
|
|
166
|
-
export function scope<T>(fn: () => T): () => unknown;
|
|
167
|
-
export function ssrHydrationKey(): string;
|
|
168
|
-
export function resolveSSRNode(node: any, result?: any, top?: boolean): any;
|
|
169
|
-
export function escape(s: any, attr?: boolean): any;
|
|
170
|
-
export function applyRef(
|
|
171
|
-
r: ((element: any) => void) | ((element: any) => void)[],
|
|
172
|
-
element: any
|
|
173
|
-
): void;
|
|
174
66
|
/**
|
|
175
67
|
* A head tag descriptor. Props values may be getters (evaluated lazily on
|
|
176
68
|
* the server — at the owning flush boundary — and reactively on the client);
|
|
@@ -187,39 +79,10 @@ export function applyRef(
|
|
|
187
79
|
* docs/head-management-rfc.md.
|
|
188
80
|
*/
|
|
189
81
|
export type HeadTag = {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
82
|
+
tag: "title" | "meta" | "link" | "style" | "script" | "base";
|
|
83
|
+
props: Record<string, any>;
|
|
84
|
+
key?: string | (() => string);
|
|
193
85
|
};
|
|
194
|
-
/**
|
|
195
|
-
* Registers head tags with the render's head registry. An array is a group —
|
|
196
|
-
* one replacement set; a single tag is a group of one; a function is a
|
|
197
|
-
* reactive group whose membership resolves at the owning flush boundary
|
|
198
|
-
* (resource tags inside it emit at that flush rather than eagerly).
|
|
199
|
-
* Replaceable tags (title/meta/canonical/…) resolve by last-committed group
|
|
200
|
-
* and stream as patches with their suspense boundary's reveal; resource tags
|
|
201
|
-
* (preload and friends, stylesheets, `script[src]`) emit eagerly and dedupe
|
|
202
|
-
* by identity. See docs/head-management-rfc.md.
|
|
203
|
-
*/
|
|
204
|
-
export function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | HeadTag[])): void;
|
|
205
|
-
export function getHydrationKey(): string | undefined;
|
|
206
|
-
export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
|
|
207
|
-
export function memo<T>(fn: () => T, equal: boolean): () => T;
|
|
208
|
-
export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
209
|
-
export function mergeProps(...sources: unknown[]): unknown;
|
|
210
|
-
export function getOwner(): unknown;
|
|
211
|
-
export function generateHydrationScript(options?: {
|
|
212
|
-
nonce?: string;
|
|
213
|
-
eventNames?: string[];
|
|
214
|
-
}): string;
|
|
215
|
-
/**
|
|
216
|
-
* Registered symbol (`Symbol.for("solid.RequestContext")`) naming the
|
|
217
|
-
* global slot where `provideRequestEvent` parks the AsyncLocalStorage that
|
|
218
|
-
* scopes request events. Integration plumbing — application code reads the
|
|
219
|
-
* event through `getRequestEvent()` instead.
|
|
220
|
-
* @internal
|
|
221
|
-
*/
|
|
222
|
-
export declare const RequestContext: unique symbol;
|
|
223
86
|
/**
|
|
224
87
|
* The mutable response head an integration's handler exposes on the request
|
|
225
88
|
* event as `event.response`: status/statusText/headers it will apply when
|
|
@@ -235,22 +98,21 @@ export declare const RequestContext: unique symbol;
|
|
|
235
98
|
* and reads it when folding single-flight cookies, but never requires it.
|
|
236
99
|
*/
|
|
237
100
|
export interface ResponseStub {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
101
|
+
status?: number;
|
|
102
|
+
statusText?: string;
|
|
103
|
+
headers: Headers;
|
|
104
|
+
/**
|
|
105
|
+
* Set once the response head has been derived/sent from this stub —
|
|
106
|
+
* status and headers can no longer change. Flip it through
|
|
107
|
+
* `commitResponseStub`, which also instruments the stub's `headers` so
|
|
108
|
+
* a post-commit write fails loudly (dev build throws, production
|
|
109
|
+
* reports + no-ops) instead of silently missing the wire. `status`/
|
|
110
|
+
* `statusText` stay plain fields: consumers that write response
|
|
111
|
+
* metadata during render (e.g. JSX response components) must still
|
|
112
|
+
* treat later status writes and cleanup-time retractions as no-ops.
|
|
113
|
+
*/
|
|
114
|
+
committed?: boolean;
|
|
252
115
|
}
|
|
253
|
-
|
|
254
116
|
/**
|
|
255
117
|
* The type of `RequestEvent.locals` — a module-augmentable interface so
|
|
256
118
|
* applications can type the state their middleware hangs on the event.
|
|
@@ -272,9 +134,8 @@ export interface ResponseStub {
|
|
|
272
134
|
* `locals` would break every untyped write that works today).
|
|
273
135
|
*/
|
|
274
136
|
export interface RequestEventLocals {
|
|
275
|
-
|
|
137
|
+
[key: string | number | symbol]: any;
|
|
276
138
|
}
|
|
277
|
-
|
|
278
139
|
/**
|
|
279
140
|
* The per-request context available on the server: the incoming `Request`
|
|
280
141
|
* and a `locals` bag integrations and middleware can hang state on (typed
|
|
@@ -283,262 +144,209 @@ export interface RequestEventLocals {
|
|
|
283
144
|
* `ResponseStub`).
|
|
284
145
|
*/
|
|
285
146
|
export interface RequestEvent {
|
|
286
|
-
|
|
287
|
-
|
|
147
|
+
request: Request;
|
|
148
|
+
locals: RequestEventLocals;
|
|
288
149
|
}
|
|
289
|
-
/**
|
|
290
|
-
* The current request event, when called on the server inside a request
|
|
291
|
-
* scope (established by `provideRequestEvent` from `@solidjs/web/storage`
|
|
292
|
-
* or by the framework). Undefined on the client and outside a request.
|
|
293
|
-
* Read it above `await` boundaries in partially-polyfilled environments.
|
|
294
|
-
*/
|
|
295
|
-
export function getRequestEvent(): RequestEvent | undefined;
|
|
296
|
-
|
|
297
|
-
/** A fresh, uncommitted response head. */
|
|
298
|
-
export function createResponseStub(): ResponseStub;
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* The canonical request event for HTTP handlers: the incoming `Request`, a
|
|
302
|
-
* `locals` bag, and a `response` head stub the render writes to. `init`
|
|
303
|
-
* spreads over the defaults so frameworks can extend the shape.
|
|
304
|
-
*/
|
|
305
|
-
export function createRequestEvent<T extends object = {}>(
|
|
306
|
-
request: Request,
|
|
307
|
-
init?: T
|
|
308
|
-
): RequestEvent & { response: ResponseStub } & T;
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* The status an outgoing redirect should use for a response head carrying
|
|
312
|
-
* a `Location`: the stub's own status when it is a redirect status, 302
|
|
313
|
-
* otherwise.
|
|
314
|
-
*/
|
|
315
|
-
export function getExpectedRedirectStatus(response: ResponseStub): number;
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Flips a response stub to `committed` — the moment its head freezes on
|
|
319
|
-
* the wire — and instruments the stub's `headers` mutating methods
|
|
320
|
-
* (`set`/`append`/`delete`, patched in place; the `Headers` identity and
|
|
321
|
-
* reads are untouched) so a post-commit write fails loudly instead of
|
|
322
|
-
* silently missing the wire: it throws in the dev build and reports +
|
|
323
|
-
* no-ops otherwise. Every head materialization path commits through here
|
|
324
|
-
* (`createSSRResponse`, the server-function handler's commit seam);
|
|
325
|
-
* integrations deriving their own heads should too.
|
|
326
|
-
*
|
|
327
|
-
* `allowLateLocation` is the stream path's documented exception: a
|
|
328
|
-
* `Location` set after the shell flushed is still honored client-side
|
|
329
|
-
* (stream completion appends a `window.location` script), so that one
|
|
330
|
-
* write stays permitted there.
|
|
331
|
-
*/
|
|
332
|
-
export function commitResponseStub(
|
|
333
|
-
stub: ResponseStub,
|
|
334
|
-
options?: { allowLateLocation?: boolean }
|
|
335
|
-
): ResponseStub;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Handler-lifecycle plumbing — a response's exit through the request
|
|
339
|
-
* event's response-stub lifecycle: page results leave through
|
|
340
|
-
* `createSSRResponse`, any other `Response` (a middleware early return, an
|
|
341
|
-
* API result) leaves through `commitEventResponse`; application middleware
|
|
342
|
-
* never calls this. Folds the event's stub onto the outgoing response —
|
|
343
|
-
* `Set-Cookie` appends entry-by-entry alongside the response's own, other
|
|
344
|
-
* stub headers fill gaps only (never the wire-protocol family the handlers
|
|
345
|
-
* own, never `Content-Type`/`Content-Length` on a bodiless response), the
|
|
346
|
-
* status is never taken from the stub — then commits the stub
|
|
347
|
-
* (`commitResponseStub`: post-commit writes fail loudly). Responses with
|
|
348
|
-
* immutable headers are rebuilt around merged copies.
|
|
349
|
-
*
|
|
350
|
-
* Idempotent at handler edges: an already-committed stub passes the
|
|
351
|
-
* response through untouched, so a handler may apply this unconditionally
|
|
352
|
-
* after its middleware chain unwinds — page responses from
|
|
353
|
-
* `createSSRResponse` come back committed and do not double-fold.
|
|
354
|
-
*
|
|
355
|
-
* `event` defaults to the ambient `getRequestEvent()`.
|
|
356
|
-
*/
|
|
357
|
-
export function commitEventResponse(response: Response, event?: RequestEvent): Response;
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* The cookie codec (the platform-gap primitives — see cookies.d.ts): ALL
|
|
361
|
-
* of core's cookie surface. The blessed patterns are
|
|
362
|
-
* `parseCookieHeader(event.request.headers.get("cookie"))` for reads and
|
|
363
|
-
* `event.response.headers.append("set-cookie", serializeCookie(name,
|
|
364
|
-
* value, options))` for writes.
|
|
365
|
-
*/
|
|
366
|
-
export { parseCookieHeader, serializeCookie } from "./cookies.cjs";
|
|
367
150
|
export type { CookieOptions } from "./cookies.cjs";
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* The flash cookie's isomorphic half and the codec-free server-function
|
|
371
|
-
* layer (reference detection + the late-bound RPC seam) — mirrors of the
|
|
372
|
-
* client entry's exports, so integration code reading them stays
|
|
373
|
-
* universal. Declared through server-functions/shared.d.ts, the
|
|
374
|
-
* declaration home published-types layouts ship.
|
|
375
|
-
*/
|
|
376
|
-
export {
|
|
377
|
-
clearFlashCookie,
|
|
378
|
-
getServerFunctionMetadata,
|
|
379
|
-
getServerFunctionRPC,
|
|
380
|
-
hasFlashCookie,
|
|
381
|
-
isServerFunction
|
|
382
|
-
} from "./server-functions/shared.cjs";
|
|
383
|
-
export type {
|
|
384
|
-
ServerFunction,
|
|
385
|
-
ServerFunctionMetadata,
|
|
386
|
-
ServerFunctionRPC
|
|
387
|
-
} from "./server-functions/shared.cjs";
|
|
388
|
-
|
|
151
|
+
export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./server-functions/shared.cjs";
|
|
389
152
|
export interface SSRResponseOptions {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
153
|
+
/** Base head; the stub's status/headers win over it. */
|
|
154
|
+
responseInit?: ResponseInit;
|
|
155
|
+
/** Nonce carried by the post-flush `<script>` redirect fallback. */
|
|
156
|
+
nonce?: string;
|
|
157
|
+
/** Rewrites each outgoing HTML chunk (entry script injection, ...). */
|
|
158
|
+
transformChunk?: (chunk: string) => string;
|
|
396
159
|
}
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Derives the outgoing `Response` for an SSR render result, running the
|
|
400
|
-
* response-head lifecycle against `event.response`: commit at shell flush,
|
|
401
|
-
* pre-flush `Location` becomes a real redirect, post-flush `Location`
|
|
402
|
-
* appends a client-side script redirect before the stream closes.
|
|
403
|
-
* Synchronous for string results; resolves at shell flush for stream
|
|
404
|
-
* results.
|
|
405
|
-
*/
|
|
406
|
-
export function createSSRResponse(
|
|
407
|
-
result: string,
|
|
408
|
-
event: RequestEvent | undefined,
|
|
409
|
-
options?: SSRResponseOptions
|
|
410
|
-
): Response;
|
|
411
|
-
export function createSSRResponse(
|
|
412
|
-
result: { pipe(writable: { write: (v: string) => void; end: () => void }): void },
|
|
413
|
-
event: RequestEvent | undefined,
|
|
414
|
-
options?: SSRResponseOptions
|
|
415
|
-
): Promise<Response>;
|
|
416
|
-
|
|
417
160
|
/**
|
|
418
161
|
* Fetch-style middleware: return a `Response` to answer the request, or
|
|
419
162
|
* call `next()` (optionally with a substitute `Request`) to advance the
|
|
420
163
|
* chain and observe/replace the eventual response.
|
|
421
164
|
*/
|
|
422
|
-
export type FetchMiddleware = (
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
):
|
|
473
|
-
/**
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
export function
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
165
|
+
export type FetchMiddleware = (request: Request, next: (request?: Request) => Promise<Response>) => Response | Promise<Response>;
|
|
166
|
+
export { createComponent, effect, memo, untrack, mergeProps, scope, getOwner };
|
|
167
|
+
export { sharedConfig };
|
|
168
|
+
export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.cjs";
|
|
169
|
+
export declare function scriptNonce(nonce?: CSPNonce): string | undefined;
|
|
170
|
+
export declare function styleNonce(nonce?: CSPNonce): string | undefined;
|
|
171
|
+
export declare function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | HeadTag[])): void;
|
|
172
|
+
export declare function renderToString<T>(fn: () => T, options?: {
|
|
173
|
+
nonce?: CSPNonce;
|
|
174
|
+
renderId?: string;
|
|
175
|
+
noScripts?: boolean;
|
|
176
|
+
plugins?: SerializerPlugin[];
|
|
177
|
+
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
178
|
+
onError?: (err: any) => void;
|
|
179
|
+
/**
|
|
180
|
+
* Embedded-render contract for hosts that own the document. When the
|
|
181
|
+
* render output contains no `</head>`, everything head-bound (resolved
|
|
182
|
+
* `useHead` winners, eager resources, tracked asset links, inline
|
|
183
|
+
* styles) is delivered here as one HTML string — prelude (charset/base)
|
|
184
|
+
* first — for the host to splice into its own `<head>` template, instead
|
|
185
|
+
* of being dropped. Called synchronously before `renderToString`
|
|
186
|
+
* returns; not called when the output has a `</head>` (splicing is
|
|
187
|
+
* automatic then).
|
|
188
|
+
*/
|
|
189
|
+
onHead?: (head: string) => void;
|
|
190
|
+
}): string;
|
|
191
|
+
export declare function renderToStream<T>(fn: () => T, options?: {
|
|
192
|
+
nonce?: CSPNonce;
|
|
193
|
+
renderId?: string;
|
|
194
|
+
noScripts?: boolean;
|
|
195
|
+
plugins?: SerializerPlugin[];
|
|
196
|
+
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
197
|
+
onCompleteShell?: (info: {
|
|
198
|
+
write: (v: string) => void;
|
|
199
|
+
}) => void;
|
|
200
|
+
onCompleteAll?: (info: {
|
|
201
|
+
write: (v: string) => void;
|
|
202
|
+
}) => void;
|
|
203
|
+
onError?: (err: any) => void;
|
|
204
|
+
/**
|
|
205
|
+
* Embedded-render contract for hosts that own the document. When the
|
|
206
|
+
* shell contains no `</head>`, everything head-bound at first flush
|
|
207
|
+
* (resolved `useHead` winners, eager resources, tracked asset links,
|
|
208
|
+
* inline styles) is delivered here as one HTML string — prelude first —
|
|
209
|
+
* before the shell chunk is emitted, so the host can write its own
|
|
210
|
+
* `<head>` ahead of piping the stream. Post-shell head updates flow
|
|
211
|
+
* through the stream itself and apply in the browser. Not called when
|
|
212
|
+
* the shell has a `</head>` (splicing is automatic then).
|
|
213
|
+
*/
|
|
214
|
+
onHead?: (head: string) => void;
|
|
215
|
+
}): {
|
|
216
|
+
/**
|
|
217
|
+
* Awaiting the stream resolves with the complete HTML once every boundary
|
|
218
|
+
* settles — the fully-settled-string form of the render (`const html =
|
|
219
|
+
* await renderToStream(...)`). Render errors route through `onError` and
|
|
220
|
+
* the promise resolves with whatever HTML the render produced; it never
|
|
221
|
+
* rejects.
|
|
222
|
+
*/
|
|
223
|
+
then<TResult1 = string, TResult2 = never>(onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
224
|
+
pipe: (writable: {
|
|
225
|
+
write: (v: string) => void;
|
|
226
|
+
end: () => void;
|
|
227
|
+
}) => void;
|
|
228
|
+
pipeTo: (writable: WritableStream) => Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Lazy `ReadableStream<Uint8Array>` view of the render — hand it straight
|
|
231
|
+
* to `new Response(stream.readable)`. First access starts the render
|
|
232
|
+
* piping through an internal `TransformStream` (chunks are UTF-8 encoded
|
|
233
|
+
* bytes, the same as `pipeTo` writes) and the stream is cached, so
|
|
234
|
+
* repeated access returns the same instance. Like `pipe`/`pipeTo`, this
|
|
235
|
+
* consumes the render: use exactly one of the three — mixing distinct
|
|
236
|
+
* consumers (`readable` after `pipe`/`pipeTo`, or vice versa) throws an
|
|
237
|
+
* error naming the conflict.
|
|
238
|
+
*/
|
|
239
|
+
readonly readable: ReadableStream<Uint8Array>;
|
|
240
|
+
};
|
|
241
|
+
export declare function HydrationScript(props: {
|
|
242
|
+
nonce?: string;
|
|
243
|
+
eventNames?: string[];
|
|
244
|
+
}): JSX.Element;
|
|
245
|
+
export declare function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
|
|
502
246
|
/**
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
*
|
|
247
|
+
* The live-hole engine for one frame response. Constructed by the frame
|
|
248
|
+
* renderer (frame-sink) and published on the render context; `ssr()` and
|
|
249
|
+
* `resolveSSRNode` route content holes through `content()` while it is
|
|
250
|
+
* present. Bindings live in the sink's DR-2 ledger — same commit-driven
|
|
251
|
+
* sweeps, same equality gating, same end-of-response latch as watched slot
|
|
252
|
+
* args.
|
|
253
|
+
*
|
|
254
|
+
* Every state transition is commit-driven: the engine never chains its own
|
|
255
|
+
* promises, so it cannot amplify commits or starve the event loop — a
|
|
256
|
+
* pending re-evaluation simply waits for the next commit (async settles
|
|
257
|
+
* commit through the render core, and the response's end-latch sweep is
|
|
258
|
+
* always the last one).
|
|
508
259
|
*/
|
|
509
|
-
export function
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
)
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
260
|
+
export declare function createLiveHoles(sink: any, scoped: any): {
|
|
261
|
+
suppressed: number;
|
|
262
|
+
sweeping: boolean;
|
|
263
|
+
parent: any;
|
|
264
|
+
recordStamp: number;
|
|
265
|
+
gateHit: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Intercept a thunk content hole: resolve it, and — when the evaluation
|
|
268
|
+
* proves re-runnable — mint an id, wrap the output in its marker pair,
|
|
269
|
+
* and open the ledger binding. Returns a string (sync resolve), a
|
|
270
|
+
* marker-wrapped `{ t, h, p }` template (NotReady escalation — markers
|
|
271
|
+
* ride the template so the retry's splice lands inside them), an
|
|
272
|
+
* UNMARKED string/template (latched: slot positions, impure
|
|
273
|
+
* evaluations), or null when interception is off for this evaluation.
|
|
274
|
+
*/
|
|
275
|
+
content(hole: any): any;
|
|
276
|
+
/** The shared id counter — `ssr()` mints an attr address at injection
|
|
277
|
+
* time, before its capture completes. */
|
|
278
|
+
mint(): number;
|
|
279
|
+
/** Whether interception may arm at the current evaluation point —
|
|
280
|
+
* `ssr()` asks before opening an attr capture (the `data-lha`
|
|
281
|
+
* injection must not touch out-of-scope bytes; content holes are
|
|
282
|
+
* gated inside `content()` itself). */
|
|
283
|
+
active(): boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Register an element's attr-hole capture (built by `ssr()`'s in-tag
|
|
286
|
+
* scan): the tag's attribute area as alternating static strings and
|
|
287
|
+
* re-runnable parts (`{ f }` thunks, `{ g, i }` group positions). Sweeps
|
|
288
|
+
* rebuild the text, equality-gate against the baseline, and ship
|
|
289
|
+
* changes as an element-keyed `attr` chunk. Names that vanish between
|
|
290
|
+
* rebuilds ride an explicit `removed` list — the server holds the
|
|
291
|
+
* previous text, so the client never tracks name history.
|
|
292
|
+
*/
|
|
293
|
+
attr(cap: any): void;
|
|
294
|
+
};
|
|
295
|
+
export declare function ssr(template: string[] | string, ...nodes: any[]): {
|
|
296
|
+
t: string;
|
|
297
|
+
};
|
|
298
|
+
export declare function ssrClassName(value: string | {
|
|
299
|
+
[k: string]: boolean;
|
|
300
|
+
} | Array<any>): string;
|
|
301
|
+
export declare function ssrStyle(value: string | {
|
|
302
|
+
[k: string]: string;
|
|
303
|
+
}): string;
|
|
304
|
+
export declare function ssrStyleProperty(name: string, value: any): string;
|
|
305
|
+
export declare function ssrElement(name: string, props: any, children: any, needsId: boolean): {
|
|
306
|
+
t: string;
|
|
307
|
+
};
|
|
308
|
+
export declare function ssrAttribute(key: string, value: any): string;
|
|
309
|
+
export declare function ssrHydrationKey(): string;
|
|
310
|
+
export declare const CLAIM_PROP: unique symbol;
|
|
311
|
+
export declare const CLAIMS_STREAM = 1;
|
|
312
|
+
export declare const CLAIMS_DOCUMENT = 2;
|
|
313
|
+
export declare function ssrClaim(map: any): string;
|
|
314
|
+
export declare function ssrSelectValues(): void;
|
|
315
|
+
export declare function resolveSSRSelectValues(html: any): any;
|
|
316
|
+
export declare function escape(s: any, attr?: boolean): any;
|
|
317
|
+
export declare function getHydrationKey(): string | undefined;
|
|
318
|
+
export declare function applyRef(r: ((element: any) => void) | ((element: any) => void)[], element: any): void;
|
|
319
|
+
export declare function generateHydrationScript(options?: {
|
|
320
|
+
nonce?: string;
|
|
321
|
+
eventNames?: string[];
|
|
322
|
+
}): string;
|
|
323
|
+
export declare function resolveSSRNode(node: any, result?: any, top?: boolean): any;
|
|
324
|
+
export declare const RequestContext: unique symbol; /**
|
|
325
|
+
* The current request event, when called on the server inside a request
|
|
326
|
+
* scope (established by `provideRequestEvent` from `@solidjs/web/storage`
|
|
327
|
+
* or by the framework). Undefined on the client and outside a request.
|
|
328
|
+
* Read it above `await` boundaries in partially-polyfilled environments.
|
|
543
329
|
*/
|
|
544
|
-
export function
|
|
330
|
+
export declare function getRequestEvent(): RequestEvent | undefined;
|
|
331
|
+
export declare function createResponseStub(): ResponseStub;
|
|
332
|
+
export declare function createRequestEvent<T extends object = {}>(request: Request, init?: T): RequestEvent & {
|
|
333
|
+
response: ResponseStub;
|
|
334
|
+
} & T;
|
|
335
|
+
export declare function commitResponseStub(stub: ResponseStub, options?: {
|
|
336
|
+
allowLateLocation?: boolean;
|
|
337
|
+
}): ResponseStub;
|
|
338
|
+
export declare function getExpectedRedirectStatus(response: ResponseStub): number;
|
|
339
|
+
export declare function commitEventResponse(response: Response, event?: RequestEvent): Response;
|
|
340
|
+
export declare function createSSRResponse(result: string, event: RequestEvent | undefined, options?: SSRResponseOptions): Response;
|
|
341
|
+
export declare function createSSRResponse(result: {
|
|
342
|
+
pipe(writable: {
|
|
343
|
+
write: (v: string) => void;
|
|
344
|
+
end: () => void;
|
|
345
|
+
}): void;
|
|
346
|
+
}, event: RequestEvent | undefined, options?: SSRResponseOptions): Promise<Response>;
|
|
347
|
+
export declare function composeMiddleware(middlewares: FetchMiddleware[]): (request: Request, next: (request?: Request) => Response | Promise<Response>) => Promise<Response>;
|
|
348
|
+
export declare function registerElementClaim(handler: (element: Element) => void): () => void;
|
|
349
|
+
export declare function claimElement<T extends Element>(node: T): T;
|
|
350
|
+
export declare function claimElementTree<T extends Node>(root: T): T;
|
|
351
|
+
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 acquireAsset };
|
|
352
|
+
declare function notSup(): void;
|