@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.20

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 (124) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +5065 -0
  3. package/dist/server.js +1757 -355
  4. package/dist/{server.cjs → server.observe.js} +1951 -558
  5. package/dist/{dev.cjs → web.dev.js} +945 -550
  6. package/dist/web.js +635 -332
  7. package/dist/{dev.js → web.observe.js} +688 -403
  8. package/frames/dist/assets.js +92 -0
  9. package/frames/dist/client.dev.js +1296 -1198
  10. package/frames/dist/client.js +1128 -1191
  11. package/frames/dist/client.observe.js +2041 -0
  12. package/frames/dist/regions.js +171 -0
  13. package/frames/dist/server.dev.js +2549 -0
  14. package/frames/dist/server.js +1688 -3005
  15. package/frames/dist/server.observe.js +2548 -0
  16. package/frames/dist/trace.js +45 -0
  17. package/frames/dist/wire.js +594 -0
  18. package/frames/package.json +2 -25
  19. package/package.json +244 -256
  20. package/performance-tracks/dist/performance-tracks.dev.js +679 -0
  21. package/performance-tracks/dist/performance-tracks.js +6 -0
  22. package/performance-tracks/dist/performance-tracks.observe.js +667 -0
  23. package/performance-tracks/package.json +7 -0
  24. package/performance-tracks/types/index.d.ts +69 -0
  25. package/serialization/decode/package.json +2 -15
  26. package/serialization/dist/decode.js +121 -25
  27. package/serialization/dist/serialization.js +242 -88
  28. package/serialization/package.json +2 -15
  29. package/serialization/types/index.d.ts +85 -158
  30. package/serialization/types/serializer-decode.d.ts +173 -114
  31. package/serialization/types/serializer.d.ts +109 -0
  32. package/server-functions/dist/client.dev.js +1462 -0
  33. package/server-functions/dist/client.js +667 -165
  34. package/server-functions/dist/client.observe.js +1441 -0
  35. package/server-functions/dist/rich-args.js +84 -1
  36. package/server-functions/dist/server.dev.js +2714 -297
  37. package/server-functions/dist/server.js +2595 -271
  38. package/server-functions/dist/server.observe.js +3594 -0
  39. package/server-functions/package.json +2 -35
  40. package/server-functions/rich-args/package.json +2 -15
  41. package/skills/server-components/SKILL.md +117 -0
  42. package/storage/package.json +2 -15
  43. package/types/client.d.ts +342 -288
  44. package/types/constants.d.ts +22 -0
  45. package/types/cookies.d.ts +32 -84
  46. package/types/diagnostics.d.ts +80 -0
  47. package/types/frames/assets-tier.d.ts +78 -0
  48. package/types/frames/client.d.ts +40 -1
  49. package/types/frames/frame-client.d.ts +443 -280
  50. package/types/frames/frame-container-plugin.d.ts +64 -0
  51. package/types/frames/frame-morph.d.ts +29 -0
  52. package/types/frames/frame-sink.d.ts +141 -161
  53. package/types/frames/frame-transport.d.ts +263 -184
  54. package/types/frames/regions-tier.d.ts +60 -0
  55. package/types/frames/serializer-decode.d.ts +241 -0
  56. package/types/frames/serializer.d.ts +85 -158
  57. package/types/frames/server.d.ts +2 -2
  58. package/types/frames/trace-tier.d.ts +2 -0
  59. package/types/frames/tree-rewrite.d.ts +39 -0
  60. package/types/frames/wire-tier.d.ts +169 -0
  61. package/types/head.d.ts +20 -0
  62. package/types/index.d.ts +98 -81
  63. package/types/index.server.d.ts +159 -0
  64. package/types/jsx.d.ts +49 -44
  65. package/types/observe.d.ts +535 -0
  66. package/types/reconcile.d.ts +1 -0
  67. package/types/render.d.ts +11 -0
  68. package/types/request-error-hook.d.ts +5 -0
  69. package/types/response.d.ts +95 -147
  70. package/types/serializer-decode.d.ts +173 -114
  71. package/types/serializer.d.ts +85 -158
  72. package/types/server-functions/argument-codec.d.ts +30 -0
  73. package/types/server-functions/client.d.ts +238 -223
  74. package/types/server-functions/flash.d.ts +28 -30
  75. package/types/server-functions/registry.d.ts +105 -0
  76. package/types/server-functions/rich-args.d.ts +1 -10
  77. package/types/server-functions/server.d.ts +539 -531
  78. package/types/server-functions/shared.d.ts +398 -425
  79. package/types/server-functions/uploads.d.ts +50 -0
  80. package/types/server-mock.d.ts +120 -13
  81. package/types/server-observe.d.ts +86 -0
  82. package/types/server.d.ts +571 -422
  83. package/types/trace.d.ts +127 -0
  84. package/LICENSE +0 -21
  85. package/dist/web.cjs +0 -2033
  86. package/frames/dist/client.cjs +0 -2002
  87. package/frames/dist/client.dev.cjs +0 -2022
  88. package/frames/dist/server.cjs +0 -3877
  89. package/serialization/dist/decode.cjs +0 -139
  90. package/serialization/dist/serialization.cjs +0 -261
  91. package/serialization/types-cjs/index.d.cts +0 -182
  92. package/serialization/types-cjs/package.json +0 -3
  93. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  94. package/server-functions/dist/client.cjs +0 -834
  95. package/server-functions/dist/rich-args.cjs +0 -11
  96. package/server-functions/dist/server.cjs +0 -1242
  97. package/server-functions/dist/server.dev.cjs +0 -1242
  98. package/storage/dist/storage.cjs +0 -12
  99. package/storage/types-cjs/index.d.cts +0 -28
  100. package/storage/types-cjs/package.json +0 -3
  101. package/types/core.d.ts +0 -9
  102. package/types-cjs/client.d.cts +0 -337
  103. package/types-cjs/cookies.d.cts +0 -93
  104. package/types-cjs/core.d.cts +0 -9
  105. package/types-cjs/frames/client.d.cts +0 -36
  106. package/types-cjs/frames/frame-client.d.cts +0 -356
  107. package/types-cjs/frames/frame-sink.d.cts +0 -194
  108. package/types-cjs/frames/frame-transport.d.cts +0 -222
  109. package/types-cjs/frames/serializer.d.cts +0 -182
  110. package/types-cjs/frames/server.d.cts +0 -52
  111. package/types-cjs/index.d.cts +0 -244
  112. package/types-cjs/jsx-properties.d.cts +0 -93
  113. package/types-cjs/jsx.d.cts +0 -4159
  114. package/types-cjs/package.json +0 -3
  115. package/types-cjs/response.d.cts +0 -174
  116. package/types-cjs/serializer-decode.d.cts +0 -182
  117. package/types-cjs/serializer.d.cts +0 -182
  118. package/types-cjs/server-functions/client.d.cts +0 -262
  119. package/types-cjs/server-functions/flash.d.cts +0 -38
  120. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  121. package/types-cjs/server-functions/server.d.cts +0 -681
  122. package/types-cjs/server-functions/shared.d.cts +0 -523
  123. package/types-cjs/server-mock.d.cts +0 -286
  124. package/types-cjs/server.d.cts +0 -544
@@ -1,544 +0,0 @@
1
- import { JSX } from "./jsx.cjs";
2
- 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
- /** Static asset manifest produced by a build (e.g. parsed Vite manifest.json). */
16
- export type AssetManifest = Record<
17
- string,
18
- { file: string; css?: string[]; isEntry?: boolean; imports?: string[] }
19
- > & { _base?: string };
20
-
21
- /** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
22
- export type InlineStyleAsset = {
23
- id: string;
24
- content: string;
25
- attrs?: Record<string, string>;
26
- };
27
-
28
- export type ResolvedAssets = {
29
- js: string[];
30
- css: (string | InlineStyleAsset)[];
31
- };
32
-
33
- /**
34
- * Resolver form of the manifest option — the primitive a dev server
35
- * implements against its live module graph (a static manifest object is
36
- * normalized into a sync resolver internally). `resolve` may return a
37
- * promise (async resolvers require streaming rendering); CSS entries may be
38
- * URL strings (emitted as load-gated `<link>` tags) or inline-style
39
- * descriptors (emitted as `<style>` tags). A bare `resolve`-shaped function
40
- * is accepted as shorthand for `{ resolve }`.
41
- */
42
- export type AssetResolver = {
43
- resolve(
44
- key: string
45
- ): ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
46
- /**
47
- * Synchronous fast path answering with whatever is knowable without async
48
- * work (typically js URLs, omitting css). Sync consumers — e.g. a lazy
49
- * component's `moduleUrl` getter used by islands — use this when `resolve`
50
- * would return a promise, so adapters should provide it whenever possible.
51
- */
52
- resolveSync?(key: string): ResolvedAssets | null | undefined;
53
- };
54
-
55
- /** 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
-
60
- /**
61
- * CSP nonce for the tags a server render emits. A string applies to both
62
- * nonce-aware destinations. A `{ script, style }` pair routes each tag to
63
- * the directive governing its fetch (`script-src-elem` / `style-src-elem`,
64
- * falling back to `script-src` / `style-src` then `default-src`). Both
65
- * keys are required; `false` leaves that destination un-nonced. Worker
66
- * destinations take the script nonce, which only applies when their own
67
- * fallback reaches `script-src`. A nonce on a `useHead` tag's own props
68
- * always wins.
69
- *
70
- * Only `renderToString` / `renderToStream` take this shape. Surfaces that
71
- * emit one script (`HydrationScript`, `generateHydrationScript`,
72
- * `createSSRResponse`) take a string — project with `scriptNonce`.
73
- */
74
- export type CSPNonce = string | { script: string | false; style: string | false };
75
-
76
- /** The script-destination half of a render `nonce`. */
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>;
151
- };
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
- /**
175
- * A head tag descriptor. Props values may be getters (evaluated lazily on
176
- * the server — at the owning flush boundary — and reactively on the client);
177
- * `children` is the text body (title text, inline style/script content).
178
- * `key` overrides the built-in dedupe identity (`title` is a hard singleton
179
- * that `key` cannot fork).
180
- *
181
- * Getters must be plain reads: they evaluate at flush time here (under no
182
- * component owner) and inside registry-owned computations on the client, so
183
- * a getter that allocates a reactive owner (`createMemo`, a `children()`
184
- * helper) consumes a hydration id slot on one side only and desyncs every
185
- * id allocated after the `useHead` call. Create such helpers eagerly at
186
- * component position and read them from the getter. See
187
- * docs/head-management-rfc.md.
188
- */
189
- export type HeadTag = {
190
- tag: "title" | "meta" | "link" | "style" | "script" | "base";
191
- props: Record<string, any>;
192
- key?: string | (() => string);
193
- };
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
- /**
224
- * The mutable response head an integration's handler exposes on the request
225
- * event as `event.response`: status/statusText/headers it will apply when
226
- * sending the response. A scaffold, not a `Response` — application code
227
- * (e.g. JSX response components) writes to it during render, and the
228
- * handler reads it when the head goes out. Core does not declare the
229
- * `response` property on `RequestEvent` itself: integrations that provide
230
- * one declare it through module augmentation (as `@solidjs/router` does),
231
- * and this type names the shape they agree on. Core's server-function
232
- * handler folds it onto the outgoing response when present — its
233
- * `Set-Cookie` values (cookies appended during the call via
234
- * `serializeCookie`) append cookie-by-cookie, other headers fill gaps —
235
- * and reads it when folding single-flight cookies, but never requires it.
236
- */
237
- export interface ResponseStub {
238
- status?: number;
239
- statusText?: string;
240
- headers: Headers;
241
- /**
242
- * Set once the response head has been derived/sent from this stub —
243
- * status and headers can no longer change. Flip it through
244
- * `commitResponseStub`, which also instruments the stub's `headers` so
245
- * a post-commit write fails loudly (dev build throws, production
246
- * reports + no-ops) instead of silently missing the wire. `status`/
247
- * `statusText` stay plain fields: consumers that write response
248
- * metadata during render (e.g. JSX response components) must still
249
- * treat later status writes and cleanup-time retractions as no-ops.
250
- */
251
- committed?: boolean;
252
- }
253
-
254
- /**
255
- * The type of `RequestEvent.locals` — a module-augmentable interface so
256
- * applications can type the state their middleware hangs on the event.
257
- * Augment it through the package that re-exports the event (interface
258
- * identity flows through the re-export chain):
259
- *
260
- * ```ts
261
- * declare module "@solidjs/web" {
262
- * interface RequestEventLocals {
263
- * user: User;
264
- * }
265
- * }
266
- * ```
267
- *
268
- * The index signature keeps un-augmented usage permissive — `locals` is a
269
- * free-form bag by default — so augmentation adds precision for the keys
270
- * it names without gating existing code. The flip side: unaugmented keys
271
- * read as `any` rather than erroring, a deliberate trade (a strict-only
272
- * `locals` would break every untyped write that works today).
273
- */
274
- export interface RequestEventLocals {
275
- [key: string | number | symbol]: any;
276
- }
277
-
278
- /**
279
- * The per-request context available on the server: the incoming `Request`
280
- * and a `locals` bag integrations and middleware can hang state on (typed
281
- * through the augmentable `RequestEventLocals`). Frameworks typically
282
- * extend this shape with richer fields (e.g. a `response` head — see
283
- * `ResponseStub`).
284
- */
285
- export interface RequestEvent {
286
- request: Request;
287
- locals: RequestEventLocals;
288
- }
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
- 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
-
389
- export interface SSRResponseOptions {
390
- /** Base head; the stub's status/headers win over it. */
391
- responseInit?: ResponseInit;
392
- /** Nonce carried by the post-flush `<script>` redirect fallback. */
393
- nonce?: string;
394
- /** Rewrites each outgoing HTML chunk (entry script injection, ...). */
395
- transformChunk?: (chunk: string) => string;
396
- }
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
- /**
418
- * Fetch-style middleware: return a `Response` to answer the request, or
419
- * call `next()` (optionally with a substitute `Request`) to advance the
420
- * chain and observe/replace the eventual response.
421
- */
422
- export type FetchMiddleware = (
423
- request: Request,
424
- next: (request?: Request) => Promise<Response>
425
- ) => Response | Promise<Response>;
426
-
427
- /**
428
- * Composes fetch-style middleware into one function of the same shape;
429
- * the terminal `next` dispatches to the actual handler. Runs in whatever
430
- * scope the caller established (`provideRequestEvent`), so
431
- * `getRequestEvent()` works exactly as in application code.
432
- */
433
- export function composeMiddleware(
434
- middlewares: FetchMiddleware[]
435
- ): (
436
- request: Request,
437
- next: (request?: Request) => Response | Promise<Response>
438
- ) => Promise<Response>;
439
-
440
- export function untrack<T>(fn: () => T): T;
441
-
442
- // client-only APIs
443
-
444
- /** @deprecated not supported on the server side */
445
- export function style(
446
- node: Element,
447
- value: { [k: string]: string },
448
- prev?: { [k: string]: string }
449
- ): void;
450
-
451
- /** @deprecated not supported on the server side */
452
- export function insert<T>(
453
- parent: MountableElement,
454
- accessor: (() => T) | T,
455
- marker?: Node | null,
456
- init?: JSX.Element
457
- ): JSX.Element;
458
-
459
- /** @deprecated not supported on the server side */
460
- export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
461
-
462
- /** @deprecated not supported on the server side */
463
- export function delegateEvents(eventNames: string[]): void;
464
- /** @deprecated not supported on the server side */
465
- export function registerDelegatedRoot(root: MountableElement): void;
466
- /** @deprecated not supported on the server side */
467
- export function unregisterDelegatedRoot(root: MountableElement): void;
468
- /** @deprecated not supported on the server side */
469
- export function registerDelegatedContainer(
470
- container: MountableElement,
471
- owner?: MountableElement
472
- ): void;
473
- /** @deprecated not supported on the server side */
474
- export function unregisterDelegatedContainer(
475
- container: MountableElement,
476
- owner?: MountableElement
477
- ): void;
478
- /** @deprecated not supported on the server side */
479
- export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
480
- /** @deprecated not supported on the server side */
481
- export function dynamicProperty(props: unknown, key: string): unknown;
482
- /** @deprecated not supported on the server side */
483
- export function setAttribute(node: Element, name: string, value: string): void;
484
- /** @deprecated not supported on the server side */
485
- export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
486
-
487
- /**
488
- * Server no-op: element claims are a client-only concern, but consumers may
489
- * register isomorphically. Returns a no-op unregister function.
490
- */
491
- export function registerElementClaim(handler: (element: Element) => void): () => void;
492
- /** Server no-op: returns `node` unchanged. Claims never fire during SSR. */
493
- export function claimElement<T extends Element>(node: T): T;
494
- /** Server no-op: returns `root` unchanged. Claims never fire during SSR. */
495
- export function claimElementTree<T extends Node>(root: T): T;
496
-
497
- /** @deprecated not supported on the server side */
498
- export function addEvent(node: Element, name: string, handler: () => void, delegate: boolean): void;
499
-
500
- /** @deprecated not supported on the server side */
501
- export function render(code: () => JSX.Element, element: MountableElement): () => void;
502
- /**
503
- * @deprecated not supported on the server side
504
- * @param flag
505
- * - `undefined` — clone the template as-is (uses `cloneNode`).
506
- * - `1` — use `document.importNode` instead of `cloneNode`.
507
- * - `2` — the template html is wrapped; the outer tag is stripped at clone time.
508
- */
509
- export function template(html: string, flag?: 1 | 2): () => Element;
510
- /** @deprecated not supported on the server side */
511
- export function setProperty(node: Element, name: string, value: any): void;
512
- /** @deprecated not supported on the server side */
513
- export function className(node: Element, value: string): void;
514
- /** @deprecated not supported on the server side */
515
- export function assign(node: Element, props: any, skipChildren?: Boolean): void;
516
-
517
- /** @deprecated not supported on the server side */
518
- export function hydrate(
519
- fn: () => JSX.Element,
520
- node: MountableElement,
521
- options?: { renderId?: string; owner?: unknown }
522
- ): () => void;
523
-
524
- /** @deprecated not supported on the server side */
525
- export function getNextElement(template?: () => Element): Element;
526
- /** @deprecated not supported on the server side */
527
- export function getNextMatch(start: Node, elementName: string): Element;
528
- /** @deprecated not supported on the server side */
529
- export function getNextMarker(start: Node): [Node, Array<Node>];
530
- /** @deprecated not supported on the server side */
531
- export function runHydrationEvents(): void;
532
- /** @deprecated not supported on the server side */
533
- export function ref(
534
- fn: () => ((element: Element) => void) | ((element: Element) => void)[],
535
- element: Element
536
- ): void;
537
- /** @deprecated not supported on the server side */
538
- export function setStyleProperty(node: Element, name: string, value: any): void;
539
- /**
540
- * @internal See client.d.ts — head-management RFC policy: ambient CSS is
541
- * unmanaged; the head registry owns directly-mounted stylesheet lifecycle.
542
- * @deprecated not supported on the server side — register assets through the render context instead
543
- */
544
- export function acquireAsset(descriptor: unknown): () => void;