@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
package/types/server.d.ts CHANGED
@@ -79,19 +79,6 @@ export function renderToString<T>(
79
79
  onHead?: (head: string) => void;
80
80
  }
81
81
  ): string;
82
- /** @deprecated use renderToStream which also returns a promise */
83
- export function renderToStringAsync<T>(
84
- fn: () => T,
85
- options?: {
86
- timeoutMs?: number;
87
- nonce?: string;
88
- renderId?: string;
89
- noScripts?: boolean;
90
- plugins?: SerializerPlugin[];
91
- manifest?: AssetManifest | AssetResolver | AssetResolverFn;
92
- onError?: (err: any) => void;
93
- }
94
- ): Promise<string>;
95
82
  export function renderToStream<T>(
96
83
  fn: () => T,
97
84
  options?: {
@@ -116,7 +103,17 @@ export function renderToStream<T>(
116
103
  onHead?: (head: string) => void;
117
104
  }
118
105
  ): {
119
- then: (fn: (html: string) => void) => void;
106
+ /**
107
+ * Awaiting the stream resolves with the complete HTML once every boundary
108
+ * settles — the fully-settled-string form of the render (`const html =
109
+ * await renderToStream(...)`). Render errors route through `onError` and
110
+ * the promise resolves with whatever HTML the render produced; it never
111
+ * rejects.
112
+ */
113
+ then<TResult1 = string, TResult2 = never>(
114
+ onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null,
115
+ onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
116
+ ): Promise<TResult1 | TResult2>;
120
117
  pipe: (writable: { write: (v: string) => void; end: () => void }) => void;
121
118
  pipeTo: (writable: WritableStream) => Promise<void>;
122
119
  /**
@@ -153,21 +150,20 @@ export function applyRef(
153
150
  r: ((element: any) => void) | ((element: any) => void)[],
154
151
  element: any
155
152
  ): void;
156
- /** @deprecated Use `useHead` — removed before `0.50.0` stable. */
157
- export function useAssets(fn: () => JSX.Element): void;
158
- /**
159
- * @deprecated Use the `onHead` render option — removed before `0.50.0`
160
- * stable. Reads ambient render state, so it is unsafe across concurrent
161
- * renders; `onHead` is closure-bound to its render and also carries
162
- * `useHead` output, which this does not.
163
- */
164
- export function getAssets(): string;
165
153
  /**
166
154
  * A head tag descriptor. Props values may be getters (evaluated lazily on
167
155
  * the server — at the owning flush boundary — and reactively on the client);
168
156
  * `children` is the text body (title text, inline style/script content).
169
157
  * `key` overrides the built-in dedupe identity (`title` is a hard singleton
170
158
  * that `key` cannot fork).
159
+ *
160
+ * Getters must be plain reads: they evaluate at flush time here (under no
161
+ * component owner) and inside registry-owned computations on the client, so
162
+ * a getter that allocates a reactive owner (`createMemo`, a `children()`
163
+ * helper) consumes a hydration id slot on one side only and desyncs every
164
+ * id allocated after the `useHead` call. Create such helpers eagerly at
165
+ * component position and read them from the getter. See
166
+ * docs/head-management-rfc.md.
171
167
  */
172
168
  export type HeadTag = {
173
169
  tag: "title" | "meta" | "link" | "style" | "script" | "base";
@@ -212,32 +208,62 @@ export declare const RequestContext: unique symbol;
212
208
  * `response` property on `RequestEvent` itself: integrations that provide
213
209
  * one declare it through module augmentation (as `@solidjs/router` does),
214
210
  * and this type names the shape they agree on. Core's server-function
215
- * handler reads its `Set-Cookie` headers when folding single-flight
216
- * cookies but never requires it.
211
+ * handler folds it onto the outgoing response when present — its
212
+ * `Set-Cookie` values (cookies appended during the call via
213
+ * `serializeCookie`) append cookie-by-cookie, other headers fill gaps —
214
+ * and reads it when folding single-flight cookies, but never requires it.
217
215
  */
218
216
  export interface ResponseStub {
219
217
  status?: number;
220
218
  statusText?: string;
221
219
  headers: Headers;
222
220
  /**
223
- * Set by the integration once the response head has been derived/sent
224
- * from this stub — status and headers can no longer change. Consumers
225
- * that write response metadata during render (e.g. JSX response
226
- * components) must treat later status/header writes and cleanup-time
227
- * retractions as no-ops.
221
+ * Set once the response head has been derived/sent from this stub —
222
+ * status and headers can no longer change. Flip it through
223
+ * `commitResponseStub`, which also instruments the stub's `headers` so
224
+ * a post-commit write fails loudly (dev build throws, production
225
+ * reports + no-ops) instead of silently missing the wire. `status`/
226
+ * `statusText` stay plain fields: consumers that write response
227
+ * metadata during render (e.g. JSX response components) must still
228
+ * treat later status writes and cleanup-time retractions as no-ops.
228
229
  */
229
230
  committed?: boolean;
230
231
  }
231
232
 
233
+ /**
234
+ * The type of `RequestEvent.locals` — a module-augmentable interface so
235
+ * applications can type the state their middleware hangs on the event.
236
+ * Augment it through the package that re-exports the event (interface
237
+ * identity flows through the re-export chain):
238
+ *
239
+ * ```ts
240
+ * declare module "@solidjs/web" {
241
+ * interface RequestEventLocals {
242
+ * user: User;
243
+ * }
244
+ * }
245
+ * ```
246
+ *
247
+ * The index signature keeps un-augmented usage permissive — `locals` is a
248
+ * free-form bag by default — so augmentation adds precision for the keys
249
+ * it names without gating existing code. The flip side: unaugmented keys
250
+ * read as `any` rather than erroring, a deliberate trade (a strict-only
251
+ * `locals` would break every untyped write that works today).
252
+ */
253
+ export interface RequestEventLocals {
254
+ [key: string | number | symbol]: any;
255
+ }
256
+
232
257
  /**
233
258
  * The per-request context available on the server: the incoming `Request`
234
- * and a `locals` bag integrations and middleware can hang state on.
235
- * Frameworks typically extend this shape with richer fields (e.g. a
236
- * `response` head — see `ResponseStub`).
259
+ * and a `locals` bag integrations and middleware can hang state on (typed
260
+ * through the augmentable `RequestEventLocals`). Frameworks typically
261
+ * extend this shape with richer fields (e.g. a `response` head — see
262
+ * `ResponseStub`).
237
263
  */
238
264
  export interface RequestEvent {
239
265
  request: Request;
240
- locals: Record<string | number | symbol, any>;
266
+ locals: RequestEventLocals;
241
267
  }
242
268
  /**
243
269
  * The current request event, when called on the server inside a request
@@ -247,7 +273,129 @@ export interface RequestEvent {
247
273
  */
248
274
  export function getRequestEvent(): RequestEvent | undefined;
249
275
 
250
- export function Assets(props: { children?: JSX.Element }): JSX.Element;
276
+ /** A fresh, uncommitted response head. */
277
+ export function createResponseStub(): ResponseStub;
278
+
279
+ /**
280
+ * The canonical request event for HTTP handlers: the incoming `Request`, a
281
+ * `locals` bag, and a `response` head stub the render writes to. `init`
282
+ * spreads over the defaults so frameworks can extend the shape.
283
+ */
284
+ export function createRequestEvent<T extends object = {}>(
285
+ request: Request,
286
+ init?: T
287
+ ): RequestEvent & { response: ResponseStub } & T;
288
+
289
+ /**
290
+ * The status an outgoing redirect should use for a response head carrying
291
+ * a `Location`: the stub's own status when it is a redirect status, 302
292
+ * otherwise.
293
+ */
294
+ export function getExpectedRedirectStatus(response: ResponseStub): number;
295
+
296
+ /**
297
+ * Flips a response stub to `committed` — the moment its head freezes on
298
+ * the wire — and instruments the stub's `headers` mutating methods
299
+ * (`set`/`append`/`delete`, patched in place; the `Headers` identity and
300
+ * reads are untouched) so a post-commit write fails loudly instead of
301
+ * silently missing the wire: it throws in the dev build and reports +
302
+ * no-ops otherwise. Every head materialization path commits through here
303
+ * (`createSSRResponse`, the server-function handler's commit seam);
304
+ * integrations deriving their own heads should too.
305
+ *
306
+ * `allowLateLocation` is the stream path's documented exception: a
307
+ * `Location` set after the shell flushed is still honored client-side
308
+ * (stream completion appends a `window.location` script), so that one
309
+ * write stays permitted there.
310
+ */
311
+ export function commitResponseStub(
312
+ stub: ResponseStub,
313
+ options?: { allowLateLocation?: boolean }
314
+ ): ResponseStub;
315
+
316
+ /**
317
+ * Handler-lifecycle plumbing — a response's exit through the request
318
+ * event's response-stub lifecycle: page results leave through
319
+ * `createSSRResponse`, any other `Response` (a middleware early return, an
320
+ * API result) leaves through `commitEventResponse`; application middleware
321
+ * never calls this. Folds the event's stub onto the outgoing response —
322
+ * `Set-Cookie` appends entry-by-entry alongside the response's own, other
323
+ * stub headers fill gaps only (never the wire-protocol family the handlers
324
+ * own, never `Content-Type`/`Content-Length` on a bodiless response), the
325
+ * status is never taken from the stub — then commits the stub
326
+ * (`commitResponseStub`: post-commit writes fail loudly). Responses with
327
+ * immutable headers are rebuilt around merged copies.
328
+ *
329
+ * Idempotent at handler edges: an already-committed stub passes the
330
+ * response through untouched, so a handler may apply this unconditionally
331
+ * after its middleware chain unwinds — page responses from
332
+ * `createSSRResponse` come back committed and do not double-fold.
333
+ *
334
+ * `event` defaults to the ambient `getRequestEvent()`.
335
+ */
336
+ export function commitEventResponse(response: Response, event?: RequestEvent): Response;
337
+
338
+ /**
339
+ * The cookie codec (the platform-gap primitives — see cookies.d.ts): ALL
340
+ * of core's cookie surface. The blessed patterns are
341
+ * `parseCookieHeader(event.request.headers.get("cookie"))` for reads and
342
+ * `event.response.headers.append("set-cookie", serializeCookie(name,
343
+ * value, options))` for writes.
344
+ */
345
+ export { parseCookieHeader, serializeCookie } from "./cookies.js";
346
+ export type { CookieOptions } from "./cookies.js";
347
+
348
+ export interface SSRResponseOptions {
349
+ /** Base head; the stub's status/headers win over it. */
350
+ responseInit?: ResponseInit;
351
+ /** Nonce carried by the post-flush `<script>` redirect fallback. */
352
+ nonce?: string;
353
+ /** Rewrites each outgoing HTML chunk (entry script injection, ...). */
354
+ transformChunk?: (chunk: string) => string;
355
+ }
356
+
357
+ /**
358
+ * Derives the outgoing `Response` for an SSR render result, running the
359
+ * response-head lifecycle against `event.response`: commit at shell flush,
360
+ * pre-flush `Location` becomes a real redirect, post-flush `Location`
361
+ * appends a client-side script redirect before the stream closes.
362
+ * Synchronous for string results; resolves at shell flush for stream
363
+ * results.
364
+ */
365
+ export function createSSRResponse(
366
+ result: string,
367
+ event: RequestEvent | undefined,
368
+ options?: SSRResponseOptions
369
+ ): Response;
370
+ export function createSSRResponse(
371
+ result: { pipe(writable: { write: (v: string) => void; end: () => void }): void },
372
+ event: RequestEvent | undefined,
373
+ options?: SSRResponseOptions
374
+ ): Promise<Response>;
375
+
376
+ /**
377
+ * Fetch-style middleware: return a `Response` to answer the request, or
378
+ * call `next()` (optionally with a substitute `Request`) to advance the
379
+ * chain and observe/replace the eventual response.
380
+ */
381
+ export type FetchMiddleware = (
382
+ request: Request,
383
+ next: (request?: Request) => Promise<Response>
384
+ ) => Response | Promise<Response>;
385
+
386
+ /**
387
+ * Composes fetch-style middleware into one function of the same shape;
388
+ * the terminal `next` dispatches to the actual handler. Runs in whatever
389
+ * scope the caller established (`provideRequestEvent`), so
390
+ * `getRequestEvent()` works exactly as in application code.
391
+ */
392
+ export function composeMiddleware(
393
+ middlewares: FetchMiddleware[]
394
+ ): (
395
+ request: Request,
396
+ next: (request?: Request) => Response | Promise<Response>
397
+ ) => Promise<Response>;
398
+
251
399
  export function untrack<T>(fn: () => T): T;
252
400
 
253
401
  // client-only APIs
@@ -347,5 +495,9 @@ export function ref(
347
495
  ): void;
348
496
  /** @deprecated not supported on the server side */
349
497
  export function setStyleProperty(node: Element, name: string, value: any): void;
350
- /** @deprecated not supported on the server side — register assets through the render context instead */
498
+ /**
499
+ * @internal See client.d.ts — head-management RFC policy: ambient CSS is
500
+ * unmanaged; the head registry owns directly-mounted stylesheet lifecycle.
501
+ * @deprecated not supported on the server side — register assets through the render context instead
502
+ */
351
503
  export function acquireAsset(descriptor: unknown): () => void;
@@ -1,12 +1,24 @@
1
1
  import { JSX } from "./jsx.cjs";
2
+ import type { RequestEventLocals } from "./server.cjs";
3
+ // Element/property classification tables consumed by the JSX compiler and
4
+ // custom renderers. Compiler/tooling surface; not for hand-written code.
5
+ /** Compiler/tooling table; not for hand-written code. @internal */
2
6
  export const DOMWithState: Record<string, Record<string, 1 | 2>>;
7
+ /** Compiler/tooling table; not for hand-written code. @internal */
3
8
  export const ChildProperties: Set<string>;
9
+ /** Compiler/tooling table; not for hand-written code. @internal */
4
10
  export const DelegatedEvents: Set<string>;
11
+ /** Compiler/tooling table; not for hand-written code. @internal */
5
12
  export const DOMElements: Set<string>;
13
+ /** Compiler/tooling table; not for hand-written code. @internal */
6
14
  export const SVGElements: Set<string>;
15
+ /** Compiler/tooling table; not for hand-written code. @internal */
7
16
  export const MathMLElements: Set<string>;
17
+ /** Compiler/tooling table; not for hand-written code. @internal */
8
18
  export const VoidElements: Set<string>;
19
+ /** Compiler/tooling table; not for hand-written code. @internal */
9
20
  export const RawTextElements: Set<string>;
21
+ /** Compiler/tooling table; not for hand-written code. @internal */
10
22
  export const Namespaces: Record<string, string>;
11
23
 
12
24
  type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
@@ -17,16 +29,30 @@ export function render(
17
29
  options?: { owner?: unknown }
18
30
  ): () => void;
19
31
  /**
32
+ * Compiler-emitted primitive; not for hand-written code.
20
33
  * @param flag
21
34
  * - `undefined` — clone the template as-is (uses `cloneNode`).
22
35
  * - `1` — use `document.importNode` instead of `cloneNode`.
23
36
  * - `2` — the template html is wrapped; the outer tag is stripped at clone time.
37
+ * @internal
24
38
  */
25
39
  export function template(html: string, flag?: 1 | 2): () => Element;
40
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
26
41
  export function scope<T extends () => any>(fn: T): T;
42
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
27
43
  export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
44
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
28
45
  export function memo<T>(fn: () => T, equal: boolean): () => T;
46
+ /**
47
+ * Compiler-emitted primitive; not for hand-written code — import `untrack`
48
+ * from `solid-js` instead.
49
+ * @internal
50
+ */
29
51
  export function untrack<T>(fn: () => T): T;
52
+ /**
53
+ * Compiler-emitted primitive; not for hand-written code.
54
+ * @internal
55
+ */
30
56
  export function insert<T>(
31
57
  parent: MountableElement,
32
58
  accessor: (() => T) | T,
@@ -43,20 +69,29 @@ export function insert<T>(
43
69
  schedule?: boolean;
44
70
  }
45
71
  ): JSX.Element;
72
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
46
73
  export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
74
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
47
75
  export function delegateEvents(eventNames: string[]): void;
76
+ /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
48
77
  export function registerDelegatedRoot(root: MountableElement): void;
78
+ /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
49
79
  export function unregisterDelegatedRoot(root: MountableElement): void;
80
+ /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
50
81
  export function registerDelegatedContainer(
51
82
  container: MountableElement,
52
83
  owner?: MountableElement
53
84
  ): void;
85
+ /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
54
86
  export function unregisterDelegatedContainer(
55
87
  container: MountableElement,
56
88
  owner?: MountableElement
57
89
  ): void;
90
+ /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
58
91
  export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
92
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
59
93
  export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
94
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
60
95
  export function assign(
61
96
  node: Element,
62
97
  props: any,
@@ -64,7 +99,9 @@ export function assign(
64
99
  prevProps?: any,
65
100
  skipRef?: Boolean
66
101
  ): void;
102
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
67
103
  export function setAttribute(node: Element, name: string, value: string): void;
104
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
68
105
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
69
106
  /**
70
107
  * Register a consumer for compiler-emitted element claims. Compiled DOM
@@ -77,11 +114,16 @@ export function setAttributeNS(node: Element, namespace: string, name: string, v
77
114
  * cleanup through your own reactive system. Dormant until registered —
78
115
  * without a handler the emitted claims are null checks. Returns an
79
116
  * unregister function.
117
+ *
118
+ * Integration plumbing (routers register the consumer); not meant for
119
+ * application code.
120
+ * @internal
80
121
  */
81
122
  export function registerElementClaim(handler: (element: Element) => void): () => void;
82
123
  /**
83
124
  * Claim `node` for registered consumers (see `registerElementClaim`).
84
125
  * Emitted by the compiler at element creation; idempotent by contract.
126
+ * @internal
85
127
  */
86
128
  export function claimElement<T extends Element>(node: T): T;
87
129
  /**
@@ -90,29 +132,50 @@ export function claimElement<T extends Element>(node: T): T;
90
132
  * compiled output emits, for content that becomes live DOM without compiled
91
133
  * creation code (frame streams, adopted SSR ranges). Dormant without a
92
134
  * registered consumer.
135
+ *
136
+ * Integration plumbing; not meant for application code.
137
+ * @internal
93
138
  */
94
139
  export function claimElementTree<T extends Node>(root: T): T;
140
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
95
141
  export function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
142
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
96
143
  export function setProperty(node: Element, name: string, value: any): void;
144
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
97
145
  export function setStyleProperty(node: Element, name: string, value: any): void;
146
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
98
147
  export function addEvent(
99
148
  node: Element,
100
149
  name: string,
101
150
  handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions),
102
151
  delegate: boolean
103
152
  ): void;
153
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
104
154
  export function style(
105
155
  node: Element,
106
156
  value: { [k: string]: string },
107
157
  prev?: { [k: string]: string }
108
158
  ): void;
159
+ /**
160
+ * Compiler-emitted primitive; not for hand-written code — import `getOwner`
161
+ * from `solid-js` instead.
162
+ * @internal
163
+ */
109
164
  export function getOwner(): unknown;
165
+ /**
166
+ * Compiler-emitted prop-spread helper; not for hand-written code — import
167
+ * `merge` from `solid-js` instead.
168
+ * @internal
169
+ */
110
170
  export function mergeProps(...sources: unknown[]): unknown;
171
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
111
172
  export function dynamicProperty(props: unknown, key: string): unknown;
173
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
112
174
  export function applyRef<T extends Element = Element>(
113
175
  r: ((element: NoInfer<T>) => void) | ((element: NoInfer<T>) => void)[],
114
176
  element: T
115
177
  ): void;
178
+ /** Compiler-emitted primitive; not for hand-written code. @internal */
116
179
  export function ref(
117
180
  fn: () => ((element: Element) => void) | ((element: Element) => void)[],
118
181
  element: Element
@@ -123,18 +186,25 @@ export function hydrate(
123
186
  node: MountableElement,
124
187
  options?: { renderId?: string; owner?: unknown }
125
188
  ): () => void;
189
+ /** Hydration-walk primitive; not for hand-written code. @internal */
126
190
  export function getHydrationKey(): string | undefined;
191
+ /** Hydration-walk primitive; not for hand-written code. @internal */
127
192
  export function getNextElement(template?: () => Element): Element;
193
+ /** Hydration-walk primitive; not for hand-written code. @internal */
128
194
  export function getNextMatch(start: Node, elementName: string): Element;
195
+ /** Hydration-walk primitive; not for hand-written code. @internal */
129
196
  export function getNextMarker(start: Node): [Node, Array<Node>];
130
- /** @deprecated Use `useHead` — removed before `0.50.0` stable. */
131
- export function useAssets(fn: () => JSX.Element): void;
132
- /** @deprecated Use `useHead` — removed before `0.50.0` stable. */
133
- export function getAssets(): string;
134
197
  /**
135
198
  * A head tag descriptor. Props values may be getters (reactive on the
136
199
  * client); `children` is the text body. `key` overrides the built-in dedupe
137
200
  * identity (`title` is a hard singleton that `key` cannot fork).
201
+ *
202
+ * Getters must be plain reads: they evaluate inside registry-owned
203
+ * computations here and at flush time on the server, so a getter that
204
+ * allocates a reactive owner (`createMemo`, a `children()` helper) consumes
205
+ * a hydration id slot on one side only and desyncs every id allocated after
206
+ * the `useHead` call. Create such helpers eagerly at component position and
207
+ * read them from the getter. See docs/head-management-rfc.md.
138
208
  */
139
209
  export type HeadTag = {
140
210
  tag: "title" | "meta" | "link" | "style" | "script" | "base";
@@ -163,13 +233,41 @@ export interface ExclusiveAssetDescriptor<T> {
163
233
  get(): T;
164
234
  set(value: T): void;
165
235
  }
236
+ /**
237
+ * @internal Ref-counted client asset ownership: acquire adopts or mounts the
238
+ * asset, the returned release follows the owner (with a grace period for
239
+ * back-and-forth navigation). Internal machinery, not a public CSS-lifecycle
240
+ * API — per the head-management RFC (docs/head-management-rfc.md), ambient
241
+ * bundler-injected CSS is never lifecycle-managed, and the head registry
242
+ * owns the lifecycle of directly-mounted stylesheets outright. This keeps
243
+ * its non-head roles (exclusive slots, owner-following DOM ownership).
244
+ */
166
245
  export function acquireAsset(descriptor: AssetDescriptor): () => void;
246
+ /**
247
+ * Registry entry returned by `warmAsset`. Stylesheet entries carry load
248
+ * tracking for the client reveal gate (docs/client-css-reveal-gating.md):
249
+ * `loadPromise` resolves on load OR error (never rejects) — an errored
250
+ * sheet releases the gate, parity with the server gate.
251
+ */
252
+ export interface AssetEntry {
253
+ loadState?: "pending" | "loaded" | "errored";
254
+ loadPromise?: Promise<void>;
255
+ }
256
+ /**
257
+ * @internal Warm half of `acquireAsset`: idempotent and refcount-free,
258
+ * callable from a compute phase so the fetch starts at discovery and
259
+ * overlaps a transition's data wait. Stylesheets warm as
260
+ * `rel="preload" as="style"` and are flipped live by `acquireAsset` at
261
+ * commit — a branch superseded before it commits leaks only an inert
262
+ * preload, never an applied sheet. Only link-backed descriptors warm;
263
+ * inline styles and exclusive slots return `undefined`.
264
+ */
265
+ export function warmAsset(descriptor: AssetDescriptor): AssetEntry | undefined;
167
266
  export function HydrationScript(props?: { nonce?: string; eventNames?: string[] }): JSX.Element;
168
267
  export function generateHydrationScript(options?: {
169
268
  nonce?: string;
170
269
  eventNames?: string[];
171
270
  }): string;
172
- export function Assets(props: { children?: JSX.Element }): JSX.Element;
173
271
  /**
174
272
  * See the server entry's `ResponseStub` — the shape of the mutable response
175
273
  * head integrations expose as `event.response` via module augmentation.
@@ -185,10 +283,33 @@ export interface ResponseStub {
185
283
  */
186
284
  committed?: boolean;
187
285
  }
286
+ /**
287
+ * See the server entry's `RequestEventLocals` — the augmentable type of
288
+ * `RequestEvent.locals`. Re-exported (not re-declared) so both entries
289
+ * share ONE interface identity and a single augmentation reaches every
290
+ * `locals`, whichever entry typed the event.
291
+ */
292
+ export type { RequestEventLocals } from "./server.cjs";
188
293
  export interface RequestEvent {
189
294
  request: Request;
190
- locals: Record<string | number | symbol, any>;
295
+ locals: RequestEventLocals;
191
296
  }
297
+ /**
298
+ * Registered symbol (`Symbol.for("solid.RequestContext")`) naming the global
299
+ * slot where `provideRequestEvent` parks the AsyncLocalStorage scoping
300
+ * request events. Integration plumbing — read the event through
301
+ * `getRequestEvent()` instead.
302
+ * @internal
303
+ */
192
304
  export declare const RequestContext: unique symbol;
193
305
  export function getRequestEvent(): RequestEvent | undefined;
306
+ /**
307
+ * The cookie codec (the platform-gap primitives — see cookies.d.ts for the
308
+ * blessed patterns): the real implementation on both entries, never a
309
+ * stub — a pure value transformer has legitimate browser uses
310
+ * (`document.cookie`). Tree-shakes away when unused.
311
+ */
312
+ export { parseCookieHeader, serializeCookie } from "./cookies.cjs";
313
+ export type { CookieOptions } from "./cookies.cjs";
314
+ /** Hydration-walk primitive; not for hand-written code. @internal */
194
315
  export function runHydrationEvents(): void;
@@ -1,4 +1,6 @@
1
1
  export { getOwner, runWithOwner, createComponent, createRoot as root, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError, ssrScope, NoHydration, Hydration, runInServerComponentScope } from "solid-js";
2
- export declare const effect: (fn: any, effectFn: any, options: any) => void;
2
+ export declare const effect: (fn: any, effectFn: any, options?: any) => void;
3
3
  export declare const memo: (fn: any) => import("solid-js").SourceAccessor<any>;
4
4
  export declare const runWithHydrationScope: (id: any, fn: any) => unknown;
5
+ export declare const ssrAsyncValue: (value: any) => import("solid-js").SourceAccessor<any>;
6
+ export declare const waitAsset: (promise: any) => void;
@@ -1,7 +1,20 @@
1
1
  export { createFrame, createFrameHost, createFrameElement, FRAME_APPLIED_EVENT } from "./frame-client.cjs";
2
2
  export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.cjs";
3
- export { createJSONDataTable } from "./serializer.cjs";
4
3
  export type { Slot } from "./server.cjs";
4
+ /**
5
+ * Client-condition twin of the server face's `asyncArg` (DR-2 value tier):
6
+ * the identity that types an async value crossing the slot border as its
7
+ * settled value. Server component modules are authored in universal code and
8
+ * may resolve under the browser condition at typecheck/bundle time — the
9
+ * call never runs here (the `"use server"` body executes server-side), but
10
+ * the symbol must exist.
11
+ */
12
+ export declare function asyncArg<T>(value: PromiseLike<T> | AsyncIterable<T>): T;
13
+ /**
14
+ * The app-wide shared frame host (created lazily): one chunk router with
15
+ * per-response codec data tables.
16
+ * @experimental
17
+ */
5
18
  export declare function getFrameHost(): any;
6
19
  /**
7
20
  * Installs the server-component transport policy on the server-function
@@ -18,5 +31,6 @@ export declare function getFrameHost(): any;
18
31
  * Call once in the client entry (an explicit call — the package is
19
32
  * `sideEffects: false`, so a bare import would be tree-shaken away);
20
33
  * call again to rebind to a custom host.
34
+ * @experimental
21
35
  */
22
36
  export declare function installServerComponents(host?: any): void;