@solidjs/web 2.0.0-beta.31 → 2.0.0-beta.32

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.
Files changed (64) hide show
  1. package/README.md +1 -6
  2. package/dist/dev.cjs +234 -45
  3. package/dist/dev.js +221 -42
  4. package/dist/server.cjs +456 -123
  5. package/dist/server.js +445 -120
  6. package/dist/web.cjs +234 -45
  7. package/dist/web.js +221 -42
  8. package/frames/dist/client.cjs +217 -112
  9. package/frames/dist/client.dev.cjs +217 -112
  10. package/frames/dist/client.dev.js +218 -113
  11. package/frames/dist/client.js +218 -113
  12. package/frames/dist/server.cjs +488 -177
  13. package/frames/dist/server.js +489 -179
  14. package/package.json +55 -4
  15. package/serialization/dist/serialization.cjs +8 -0
  16. package/serialization/dist/serialization.js +1 -0
  17. package/serialization/types/index.d.ts +173 -6
  18. package/serialization/types-cjs/index.d.cts +173 -6
  19. package/server-functions/dist/client.cjs +46 -9
  20. package/server-functions/dist/client.js +47 -11
  21. package/server-functions/dist/rich-args.cjs +11 -0
  22. package/server-functions/dist/rich-args.js +9 -0
  23. package/server-functions/dist/server.cjs +275 -126
  24. package/server-functions/dist/server.dev.cjs +1053 -0
  25. package/server-functions/dist/server.dev.js +1021 -0
  26. package/server-functions/dist/server.js +273 -127
  27. package/server-functions/package.json +10 -0
  28. package/server-functions/rich-args/package.json +20 -0
  29. package/storage/types/index.d.ts +1 -1
  30. package/storage/types-cjs/index.d.cts +1 -1
  31. package/types/client.d.ts +127 -6
  32. package/types/core.d.ts +3 -1
  33. package/types/frames/client.d.ts +15 -1
  34. package/types/frames/frame-client.d.ts +37 -7
  35. package/types/frames/frame-sink.d.ts +26 -3
  36. package/types/frames/frame-transport.d.ts +39 -7
  37. package/types/frames/serializer.d.ts +173 -6
  38. package/types/frames/server.d.ts +22 -0
  39. package/types/index.d.ts +2 -3
  40. package/types/response.d.ts +45 -0
  41. package/types/serializer.d.ts +173 -6
  42. package/types/server-functions/client.d.ts +1 -0
  43. package/types/server-functions/rich-args.d.ts +10 -0
  44. package/types/server-functions/server.d.ts +98 -0
  45. package/types/server-functions/shared.d.ts +22 -0
  46. package/types/server-mock.d.ts +171 -59
  47. package/types/server.d.ts +188 -36
  48. package/types-cjs/client.d.cts +127 -6
  49. package/types-cjs/core.d.cts +3 -1
  50. package/types-cjs/frames/client.d.cts +15 -1
  51. package/types-cjs/frames/frame-client.d.cts +37 -7
  52. package/types-cjs/frames/frame-sink.d.cts +26 -3
  53. package/types-cjs/frames/frame-transport.d.cts +39 -7
  54. package/types-cjs/frames/serializer.d.cts +173 -6
  55. package/types-cjs/frames/server.d.cts +22 -0
  56. package/types-cjs/index.d.cts +2 -3
  57. package/types-cjs/response.d.cts +45 -0
  58. package/types-cjs/serializer.d.cts +173 -6
  59. package/types-cjs/server-functions/client.d.cts +1 -0
  60. package/types-cjs/server-functions/rich-args.d.cts +10 -0
  61. package/types-cjs/server-functions/server.d.cts +98 -0
  62. package/types-cjs/server-functions/shared.d.cts +22 -0
  63. package/types-cjs/server-mock.d.cts +171 -59
  64. package/types-cjs/server.d.cts +188 -36
@@ -119,6 +119,33 @@ export type CollectFlightDataHook = (
119
119
  outcome: ServerFunctionOutcome
120
120
  ) => unknown | Promise<unknown>;
121
121
 
122
+ /**
123
+ * Wraps a server function execution — the per-invocation seam for
124
+ * framework policies (per-function middleware, auth, logging, error
125
+ * mapping). Called inside the call's event scope with the invocation
126
+ * identity already established: `getServerFunctionInvocation()` answers
127
+ * before, during and after `run()`. Must return (or resolve to) `run()`'s
128
+ * result — replacing it replaces the function's result; throwing routes
129
+ * through the handler's normal error encoding.
130
+ *
131
+ * The context carries the call's identity (`id`, parsed `args`), its
132
+ * `event`, and how it arrived: `direct` is `true` for in-process SSR calls
133
+ * (where `request` is absent) and `false` for HTTP dispatch. On the direct
134
+ * path the wrapper must stay transparent for synchronous functions —
135
+ * return `run()`'s value, not an unconditional promise, unless it needs to
136
+ * be async.
137
+ */
138
+ export type WrapInvocationHook = (
139
+ run: () => unknown,
140
+ context: {
141
+ id: string;
142
+ args: unknown[];
143
+ event: ServerFunctionEvent;
144
+ request?: Request;
145
+ direct: boolean;
146
+ }
147
+ ) => unknown;
148
+
122
149
  /**
123
150
  * Request headers with `setCookies` folded into the `Cookie` header, as the
124
151
  * browser would have applied them before its next request. Later entries
@@ -180,6 +207,14 @@ export interface ServerFunctionsServerConfig {
180
207
  * an established request scope parks on the global.
181
208
  */
182
209
  provideEvent?: <T>(event: ServerFunctionEvent, fn: () => T) => T;
210
+ /**
211
+ * Wraps every server function execution — HTTP dispatch and direct SSR
212
+ * calls alike — with the invocation identity already established (see
213
+ * `WrapInvocationHook`). The per-invocation seam for framework policies:
214
+ * per-function middleware, auth, logging, error mapping. A per-request
215
+ * option overrides it for HTTP dispatch.
216
+ */
217
+ wrapInvocation?: WrapInvocationHook;
183
218
  /**
184
219
  * The single-flight hook: produces the data payload folded into
185
220
  * responses of calls that opted in (see `CollectFlightDataHook`).
@@ -402,6 +437,13 @@ export interface HandleServerFunctionOptions {
402
437
  * contract as the `provideEvent` config option.
403
438
  */
404
439
  provideEvent?<T>(event: ServerFunctionEvent, fn: () => T): T;
440
+ /**
441
+ * Overrides the configured per-invocation wrap for this handler — same
442
+ * contract as the `wrapInvocation` config option (see
443
+ * `WrapInvocationHook`), except it only applies to HTTP dispatch (a
444
+ * per-request option can't see direct SSR calls).
445
+ */
446
+ wrapInvocation?: WrapInvocationHook;
405
447
  /**
406
448
  * Observes or replaces the function's result before encoding — the
407
449
  * extension point for response metadata policies (headers, statuses,
@@ -473,6 +515,41 @@ export interface HandleServerFunctionOptions {
473
515
  * (default `/_server`); platform adapters (h3, express, ...) convert their
474
516
  * request shape to a web `Request` around it.
475
517
  *
518
+ * When the event carries a `response` head stub (`event.response`, see the
519
+ * server entry's `ResponseStub`), the handler folds it onto every outgoing
520
+ * response as the head freezes — its `Set-Cookie` values (cookies appended
521
+ * during the call) append cookie-by-cookie alongside the result's own,
522
+ * other stub headers fill gaps (the call's response metadata wins; the
523
+ * protocol-owned family — the error/format/single-flight tags, `Location`,
524
+ * `X-Revalidate` — never fills, and neither does `Content-Type`/`Content-
525
+ * Length` onto a bodiless response) — and marks the stub `committed`, so
526
+ * later cookie/header writes report instead of silently missing the wire.
527
+ *
528
+ * ## Thrown-error sanitization (security default)
529
+ *
530
+ * A thrown `Response`/envelope (`redirect`/`reload`/`respond`) is intentional
531
+ * control flow and is forwarded untouched. A *plain* thrown value (a bare
532
+ * `Error`, string, or object) is different: serialized verbatim it would ship
533
+ * its `message` and every own-property to the client — a driver/ORM error's
534
+ * failing query, connection string, or bound parameters included. So outside
535
+ * the dev build a plain thrown value is replaced with a generic `Error`
536
+ * before serialization; the client still receives *an* `Error` (the shape
537
+ * `submission.error` etc. expect), just with no leaked content. The dev
538
+ * build keeps full fidelity (message, stack, own-props) for DX and the dev
539
+ * toolbar inspector. Dev/prod is the BUILD VARIANT, not `NODE_ENV`:
540
+ * `@solidjs/web` publishes a dev copy of this entry behind the
541
+ * `development` export condition (what Vite dev resolves) and the default
542
+ * resolution sanitizes — as does importing the runtime source directly with
543
+ * no bundler signal (fail-safe).
544
+ *
545
+ * Escape hatch: brand the value with `markSafeError` (`Symbol.for(
546
+ * "solid.SafeError")`) to send its content intact in every environment.
547
+ * A `wrapInvocation`/`transformResult` override that maps errors expresses
548
+ * intent the same way — throw a `Response`/envelope, or brand the mapped
549
+ * error safe; an unbranded plain error it lets propagate is sanitized like
550
+ * any other, so a framework onError policy must brand its result to keep a
551
+ * custom client-facing message in production.
552
+ *
476
553
  * @example
477
554
  * ```ts
478
555
  * import { handleServerFunctionRequest } from "@solidjs/web/server-functions";
@@ -488,3 +565,24 @@ export function handleServerFunctionRequest(
488
565
  request: Request,
489
566
  options?: HandleServerFunctionOptions
490
567
  ): Promise<Response>;
568
+
569
+ /** Message a sanitized (production) server error carries on the wire. */
570
+ export const GENERIC_SERVER_ERROR_MESSAGE: string;
571
+
572
+ /**
573
+ * The production error-sanitization policy `handleServerFunctionRequest`
574
+ * applies to a plain thrown value before serialization. Returns `value`
575
+ * unchanged in the dev build or when it is branded safe (`markSafeError`);
576
+ * otherwise returns a generic `Error` carrying `GENERIC_SERVER_ERROR_MESSAGE`.
577
+ * Exposed for frameworks composing their own dispatch around the same policy.
578
+ */
579
+ export function sanitizeServerError(value: unknown): unknown;
580
+
581
+ /**
582
+ * Overrides the build-variant dev flag for this module instance — the seam
583
+ * for test harnesses and hand-rolled bundles whose packaging cannot replace
584
+ * `_DX_DEV_`. Applications never call this; select the dev build through
585
+ * the `development` export condition instead.
586
+ * @internal
587
+ */
588
+ export function setServerFunctionsDev(dev: boolean): void;
@@ -18,6 +18,9 @@ export function configureServerFunctionsCodec(codec: JSONCodecOptions | undefine
18
18
  * `configureServerFunctionsCodec` or the client/server `codec` option), or
19
19
  * undefined when running on the defaults. Integrations pass this to
20
20
  * lower-level codec helpers so custom plugins configured by the app apply.
21
+ *
22
+ * Integration plumbing; not meant for hand-written application code.
23
+ * @internal
21
24
  */
22
25
  export function getServerFunctionsCodec(): JSONCodecOptions | undefined;
23
26
 
@@ -57,6 +60,9 @@ export const ERROR_HEADER: string;
57
60
  * travels percent-encoded behind a marker. `decodeErrorHeaderValue`
58
61
  * round-trips the message exactly, astral-plane characters included (lone
59
62
  * surrogates are replaced with U+FFFD — they cannot survive UTF-8 anyway).
63
+ *
64
+ * Transport wire detail; not meant for hand-written code.
65
+ * @internal
60
66
  */
61
67
  export function encodeErrorHeaderValue(value: string): string;
62
68
 
@@ -64,6 +70,10 @@ export function encodeErrorHeaderValue(value: string): string;
64
70
  * Decodes an `ERROR_HEADER` value produced by `encodeErrorHeaderValue`:
65
71
  * marked values are percent-decoded, everything else (including values from
66
72
  * peers that never encode) passes through untouched.
73
+ *
74
+ * Integration plumbing for readers of `ERROR_HEADER`; not meant for
75
+ * hand-written application code.
76
+ * @internal
67
77
  */
68
78
  export function decodeErrorHeaderValue(value: string): string;
69
79
 
@@ -412,6 +422,9 @@ export function decodeResponse<T = unknown>(
412
422
  * undefined for body-less responses) rides as `{ value }`. Integrations
413
423
  * that apply response metadata themselves use this so the payload shape
414
424
  * stays core's own.
425
+ *
426
+ * Integration plumbing; not meant for hand-written application code.
427
+ * @internal
415
428
  */
416
429
  export function decodeResponsePayload<T = unknown, D = unknown>(
417
430
  response: Response,
@@ -422,6 +435,9 @@ export function decodeResponsePayload<T = unknown, D = unknown>(
422
435
  * Frame one payload for the server-function wire: a `;0x<len32>;` length
423
436
  * prefix followed by the utf-8 data. Both transports (server-function
424
437
  * responses and frame streams) share this framing.
438
+ *
439
+ * Transport wire detail; not meant for hand-written code.
440
+ * @internal
425
441
  */
426
442
  export function createChunk(data: string): Uint8Array;
427
443
 
@@ -429,6 +445,9 @@ export function createChunk(data: string): Uint8Array;
429
445
  * Incremental decoder for `createChunk` framing over a byte stream: `next()`
430
446
  * yields one complete payload string per call (async-iterator result shape),
431
447
  * buffering partial frames internally until their length prefix is satisfied.
448
+ *
449
+ * Transport wire detail; not meant for hand-written code.
450
+ * @internal
432
451
  */
433
452
  export class ChunkReader {
434
453
  constructor(stream: ReadableStream<Uint8Array>);
@@ -441,5 +460,8 @@ export class ChunkReader {
441
460
  * Both peers derive it independently — the server names flight regions with
442
461
  * it, the client routes them by it — so it must stay deterministic across
443
462
  * realms and releases.
463
+ *
464
+ * Transport wire detail; not meant for hand-written code.
465
+ * @internal
444
466
  */
445
467
  export function frameAddress(id: string, args?: readonly unknown[]): string;
@@ -1,7 +1,48 @@
1
+ import type { RequestEvent, RequestEventLocals, ResponseStub } from "./client.js";
2
+ /** Static asset manifest produced by a build (e.g. parsed Vite manifest.json). */
3
+ export type AssetManifest = Record<string, {
4
+ file: string;
5
+ css?: string[];
6
+ isEntry?: boolean;
7
+ imports?: string[];
8
+ }> & {
9
+ _base?: string;
10
+ };
11
+ /** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
12
+ export type InlineStyleAsset = {
13
+ id: string;
14
+ content: string;
15
+ attrs?: Record<string, string>;
16
+ };
17
+ export type ResolvedAssets = {
18
+ js: string[];
19
+ css: (string | InlineStyleAsset)[];
20
+ };
21
+ /**
22
+ * Resolver form of the manifest option — the primitive a dev server
23
+ * implements against its live module graph (a static manifest object is
24
+ * normalized into a sync resolver internally). `resolve` may return a
25
+ * promise (async resolvers require streaming rendering); CSS entries may be
26
+ * URL strings (emitted as load-gated `<link>` tags) or inline-style
27
+ * descriptors (emitted as `<style>` tags). A bare `resolve`-shaped function
28
+ * is accepted as shorthand for `{ resolve }`.
29
+ */
30
+ export type AssetResolver = {
31
+ resolve(key: string): ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
32
+ /**
33
+ * Synchronous fast path answering with whatever is knowable without async
34
+ * work (typically js URLs, omitting css). Sync consumers — e.g. a lazy
35
+ * component's `moduleUrl` getter used by islands — use this when `resolve`
36
+ * would return a promise, so adapters should provide it whenever possible.
37
+ */
38
+ resolveSync?(key: string): ResolvedAssets | null | undefined;
39
+ };
40
+ /** Bare-function shorthand for `AssetResolver` (no sync fast path). */
41
+ export type AssetResolverFn = (key: string) => ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
1
42
  /**
2
43
  * Renders a component tree synchronously to an HTML string. Async reads inside
3
44
  * `<Loading>` boundaries emit their `fallback` content; for full-graph
4
- * resolution use `renderToStringAsync` instead.
45
+ * resolution await `renderToStream` instead.
5
46
  *
6
47
  * Pair the returned HTML with `hydrate()` on the client.
7
48
  *
@@ -18,45 +59,20 @@ export declare function renderToString<T>(fn: () => T, options?: {
18
59
  renderId?: string;
19
60
  noScripts?: boolean;
20
61
  plugins?: any[];
21
- manifest?: Record<string, {
22
- file: string;
23
- css?: string[];
24
- isEntry?: boolean;
25
- isDynamicEntry?: boolean;
26
- imports?: string[];
27
- }>;
62
+ manifest?: AssetManifest | AssetResolver | AssetResolverFn;
28
63
  onError?: (err: any) => void;
64
+ /**
65
+ * Embedded-render contract for hosts that own the document. When the
66
+ * render output contains no `</head>`, everything head-bound (resolved
67
+ * `useHead` winners, eager resources, tracked asset links, inline
68
+ * styles) is delivered here as one HTML string — prelude (charset/base)
69
+ * first — for the host to splice into its own `<head>` template, instead
70
+ * of being dropped. Called synchronously before `renderToString`
71
+ * returns; not called when the output has a `</head>` (splicing is
72
+ * automatic then).
73
+ */
74
+ onHead?: (head: string) => void;
29
75
  }): string;
30
- /**
31
- * Renders a component tree to an HTML string and awaits all async reads in the
32
- * subtree before resolving. The returned HTML reflects the fully-settled state
33
- * — no `<Loading>` fallbacks appear in the output.
34
- *
35
- * Use this when you want a complete page in one round-trip. For incremental
36
- * streaming with progressive boundary resolution, use `renderToStream`.
37
- *
38
- * @example
39
- * ```tsx
40
- * import { renderToStringAsync } from "@solidjs/web";
41
- *
42
- * const html = await renderToStringAsync(() => <App />);
43
- * ```
44
- */
45
- export declare function renderToStringAsync<T>(fn: () => T, options?: {
46
- timeoutMs?: number;
47
- nonce?: string;
48
- renderId?: string;
49
- noScripts?: boolean;
50
- plugins?: any[];
51
- manifest?: Record<string, {
52
- file: string;
53
- css?: string[];
54
- isEntry?: boolean;
55
- isDynamicEntry?: boolean;
56
- imports?: string[];
57
- }>;
58
- onError?: (err: any) => void;
59
- }): Promise<string>;
60
76
  /**
61
77
  * Streams an HTML response, flushing the synchronous shell first and then
62
78
  * progressively emitting async-resolved fragments as their `<Loading>`
@@ -64,9 +80,10 @@ export declare function renderToStringAsync<T>(fn: () => T, options?: {
64
80
  *
65
81
  * Returns an object with `pipe`/`pipeTo` for piping to a Node `Writable` or
66
82
  * a Web `WritableStream`, a lazy `readable` byte-stream view for
67
- * `new Response(stream.readable)`, plus a `then` for awaiting full
68
- * completion. `pipe`, `pipeTo`, and `readable` each consume the render
69
- * use exactly one of the three.
83
+ * `new Response(stream.readable)`, plus a thenable for awaiting full
84
+ * completion `await renderToStream(...)` resolves with the settled HTML
85
+ * (the fully-resolved-string form of the render). `pipe`, `pipeTo`, and
86
+ * `readable` each consume the render — use exactly one of the three.
70
87
  *
71
88
  * @example
72
89
  * ```tsx
@@ -77,6 +94,9 @@ export declare function renderToStringAsync<T>(fn: () => T, options?: {
77
94
  *
78
95
  * // Web (Workers / Deno):
79
96
  * return new Response(renderToStream(() => <App />).readable);
97
+ *
98
+ * // Fully settled string:
99
+ * const html = await renderToStream(() => <App />);
80
100
  * ```
81
101
  */
82
102
  export declare function renderToStream<T>(fn: () => T, options?: {
@@ -84,13 +104,7 @@ export declare function renderToStream<T>(fn: () => T, options?: {
84
104
  renderId?: string;
85
105
  noScripts?: boolean;
86
106
  plugins?: any[];
87
- manifest?: Record<string, {
88
- file: string;
89
- css?: string[];
90
- isEntry?: boolean;
91
- isDynamicEntry?: boolean;
92
- imports?: string[];
93
- }>;
107
+ manifest?: AssetManifest | AssetResolver | AssetResolverFn;
94
108
  onCompleteShell?: (info: {
95
109
  write: (v: string) => void;
96
110
  }) => void;
@@ -98,8 +112,25 @@ export declare function renderToStream<T>(fn: () => T, options?: {
98
112
  write: (v: string) => void;
99
113
  }) => void;
100
114
  onError?: (err: any) => void;
115
+ /**
116
+ * Embedded-render contract for hosts that own the document. When the
117
+ * shell contains no `</head>`, everything head-bound at first flush
118
+ * (resolved `useHead` winners, eager resources, tracked asset links,
119
+ * inline styles) is delivered here as one HTML string — prelude first —
120
+ * before the shell chunk is emitted, so the host can write its own
121
+ * `<head>` ahead of piping the stream. Post-shell head updates flow
122
+ * through the stream itself and apply in the browser. Not called when
123
+ * the shell has a `</head>` (splicing is automatic then).
124
+ */
125
+ onHead?: (head: string) => void;
101
126
  }): {
102
- then: (fn: (html: string) => void) => void;
127
+ /**
128
+ * Awaiting the stream resolves with the complete HTML once every boundary
129
+ * settles — the fully-settled-string form of the render. Render errors
130
+ * route through `onError` and the promise resolves with whatever HTML the
131
+ * render produced; it never rejects.
132
+ */
133
+ then<TResult1 = string, TResult2 = never>(onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
103
134
  pipe: (writable: {
104
135
  write: (v: string) => void;
105
136
  end: () => void;
@@ -107,6 +138,75 @@ export declare function renderToStream<T>(fn: () => T, options?: {
107
138
  pipeTo: (writable: WritableStream) => Promise<void>;
108
139
  readonly readable: ReadableStream<Uint8Array>;
109
140
  };
141
+ /**
142
+ * Fetch-style middleware: receives the `Request` and a `next` continuation
143
+ * (pass a `Request` to substitute it downstream) and returns the `Response`.
144
+ * Composed with `composeMiddleware`; runs inside the request-event scope, so
145
+ * `getRequestEvent()` works exactly as in application code.
146
+ */
147
+ export type FetchMiddleware = (request: Request, next: (request?: Request) => Promise<Response>) => Response | Promise<Response>;
148
+ /**
149
+ * Creates a fresh, uncommitted {@link ResponseStub}. Server-only.
150
+ */
151
+ export declare function createResponseStub(): ResponseStub;
152
+ /**
153
+ * Builds the canonical request event — a web-standard `Request`, a `locals`
154
+ * bag, and a stub-backed `response` head — for `provideRequestEvent`.
155
+ * Server-only: on the client the request event belongs to the server that
156
+ * rendered the page.
157
+ */
158
+ export declare function createRequestEvent<T extends object = {}>(request: Request, init?: T): {
159
+ request: Request;
160
+ locals: RequestEventLocals;
161
+ response: ResponseStub;
162
+ } & T;
163
+ /**
164
+ * The HTTP status a redirect should use: the stub's own status when it is a
165
+ * redirect status (301/302/303/307/308), 302 otherwise. Server-only.
166
+ */
167
+ export declare function getExpectedRedirectStatus(response: ResponseStub): number;
168
+ /**
169
+ * Derives the outgoing `Response` for an SSR render result, running the
170
+ * response-head lifecycle against `event.response`: the stub commits at
171
+ * shell flush, a pre-flush `Location` becomes a real redirect
172
+ * (`getExpectedRedirectStatus`), and a post-flush one appends the
173
+ * nonce-aware `<script>window.location=...</script>` fallback. String
174
+ * results return a `Response` synchronously; stream results resolve at
175
+ * shell flush. Server-only.
176
+ */
177
+ export declare function createSSRResponse(result: string, event: RequestEvent | undefined, options?: {
178
+ responseInit?: ResponseInit;
179
+ nonce?: string;
180
+ transformChunk?: (chunk: string) => string;
181
+ }): Response;
182
+ export declare function createSSRResponse(result: {
183
+ pipe(writable: {
184
+ write: (v: string) => void;
185
+ end: () => void;
186
+ }): void;
187
+ }, event: RequestEvent | undefined, options?: {
188
+ responseInit?: ResponseInit;
189
+ nonce?: string;
190
+ transformChunk?: (chunk: string) => string;
191
+ }): Promise<Response>;
192
+ /**
193
+ * Handler-lifecycle plumbing — the exit for a `Response` that did not go
194
+ * through `createSSRResponse` (a middleware early return, an API result):
195
+ * folds the request event's response stub onto it (cookies append
196
+ * entry-by-entry, other headers gap-fill, status never) and commits the
197
+ * stub. Already-committed stubs pass the response through untouched, so
198
+ * handlers apply it unconditionally after their middleware chain unwinds.
199
+ * `event` defaults to the ambient `getRequestEvent()`. Application
200
+ * middleware never calls this. Server-only.
201
+ */
202
+ export declare function commitEventResponse(response: Response, event?: RequestEvent): Response;
203
+ /**
204
+ * Composes fetch-style middleware — `(request, next) => Response` — into a
205
+ * single function of the same shape. Nothing reaches the wire until the
206
+ * outermost middleware returns, so headers on the returned `Response` stay
207
+ * mutable through the whole unwind, streamed bodies included. Server-only.
208
+ */
209
+ export declare function composeMiddleware(middlewares: FetchMiddleware[]): (request: Request, next: (request?: Request) => Response | Promise<Response>) => Promise<Response>;
110
210
  /**
111
211
  * Compiler primitive — emitted by JSX-DOM-Expressions for tagged-template
112
212
  * SSR output. Not meant for hand-written code.
@@ -124,27 +224,39 @@ export declare function ssrElement(name: string, props: any, children: any, need
124
224
  t: string;
125
225
  };
126
226
  /**
127
- * Compiler primitive — serializes a classList object for SSR output. Not
128
- * meant for hand-written code.
227
+ * Compiler primitive — serializes a class value (string, object map, or
228
+ * array) for SSR output. Not meant for hand-written code.
129
229
  * @internal
130
230
  */
131
- export declare function ssrClassList(value: {
231
+ export declare function ssrClassName(value: string | {
132
232
  [k: string]: boolean;
133
- }): string;
233
+ } | Array<any>): string;
134
234
  /**
135
- * Compiler primitive — serializes a style object for SSR output. Not meant
235
+ * Compiler primitive — serializes a style value for SSR output. Not meant
136
236
  * for hand-written code.
137
237
  * @internal
138
238
  */
139
- export declare function ssrStyle(value: {
239
+ export declare function ssrStyle(value: string | {
140
240
  [k: string]: string;
141
241
  }): string;
142
242
  /**
143
- * Compiler primitive — serializes a boolean attribute for SSR output. Not
243
+ * Compiler primitive — serializes one style property for SSR output. Not
244
+ * meant for hand-written code.
245
+ * @internal
246
+ */
247
+ export declare function ssrStyleProperty(name: string, value: any): string;
248
+ /**
249
+ * Compiler primitive — serializes an attribute for SSR output. Not meant
250
+ * for hand-written code.
251
+ * @internal
252
+ */
253
+ export declare function ssrAttribute(key: string, value: any): string;
254
+ /**
255
+ * Compiler primitive — wraps a template-group closure for SSR output. Not
144
256
  * meant for hand-written code.
145
257
  * @internal
146
258
  */
147
- export declare function ssrAttribute(key: string, value: boolean): string;
259
+ export declare function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
148
260
  /**
149
261
  * Compiler primitive — generates the hydration-key attribute for SSR
150
262
  * output. Not meant for hand-written code.
@@ -156,10 +268,10 @@ export declare function ssrHydrationKey(): string;
156
268
  * Not meant for hand-written code.
157
269
  * @internal
158
270
  */
159
- export declare function resolveSSRNode(node: any): string;
271
+ export declare function resolveSSRNode(node: any, result?: any, top?: boolean): any;
160
272
  /**
161
273
  * Escapes a string for safe inclusion in HTML output. Used by the SSR
162
274
  * runtime; not generally part of user code.
163
275
  * @internal
164
276
  */
165
- export declare function escape(html: string): string;
277
+ export declare function escape(s: any, attr?: boolean): any;