@solidjs/web 2.0.0-rc.1 → 2.0.0-rc.10

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 (107) hide show
  1. package/dist/server.dev.js +4472 -0
  2. package/dist/server.js +1301 -251
  3. package/dist/{server.cjs → server.observe.js} +1501 -452
  4. package/dist/{dev.cjs → web.dev.js} +699 -360
  5. package/dist/web.js +454 -139
  6. package/dist/{dev.js → web.observe.js} +505 -211
  7. package/frames/dist/client.dev.js +463 -71
  8. package/frames/dist/client.js +363 -70
  9. package/frames/dist/{client.dev.cjs → client.observe.js} +486 -133
  10. package/frames/dist/server.dev.js +1713 -0
  11. package/frames/dist/server.js +552 -2583
  12. package/frames/dist/server.observe.js +1713 -0
  13. package/frames/package.json +2 -25
  14. package/package.json +214 -255
  15. package/performance-tracks/dist/performance-tracks.dev.js +678 -0
  16. package/performance-tracks/dist/performance-tracks.js +6 -0
  17. package/performance-tracks/dist/performance-tracks.observe.js +666 -0
  18. package/performance-tracks/package.json +7 -0
  19. package/performance-tracks/types/index.d.ts +67 -0
  20. package/serialization/decode/package.json +2 -15
  21. package/serialization/dist/decode.js +92 -15
  22. package/serialization/dist/serialization.js +103 -23
  23. package/serialization/package.json +2 -15
  24. package/serialization/types/index.d.ts +76 -157
  25. package/serialization/types/serializer-decode.d.ts +149 -112
  26. package/serialization/types/serializer.d.ts +101 -0
  27. package/server-functions/dist/client.dev.js +1364 -0
  28. package/server-functions/dist/client.js +611 -97
  29. package/server-functions/dist/client.observe.js +1343 -0
  30. package/server-functions/dist/server.dev.js +2138 -202
  31. package/server-functions/dist/server.js +2042 -199
  32. package/server-functions/dist/server.observe.js +3043 -0
  33. package/server-functions/package.json +2 -35
  34. package/server-functions/rich-args/package.json +2 -15
  35. package/storage/package.json +2 -15
  36. package/types/client.d.ts +193 -288
  37. package/types/constants.d.ts +20 -0
  38. package/types/cookies.d.ts +32 -84
  39. package/types/diagnostics.d.ts +56 -0
  40. package/types/frames/client.d.ts +1 -1
  41. package/types/frames/frame-client.d.ts +323 -259
  42. package/types/frames/frame-container-plugin.d.ts +72 -0
  43. package/types/frames/frame-sink.d.ts +101 -158
  44. package/types/frames/frame-transport.d.ts +192 -190
  45. package/types/frames/serializer-decode.d.ts +219 -0
  46. package/types/frames/serializer.d.ts +76 -157
  47. package/types/frames/server.d.ts +1 -1
  48. package/types/head.d.ts +19 -0
  49. package/types/index.d.ts +52 -80
  50. package/types/index.server.d.ts +174 -0
  51. package/types/jsx.d.ts +33 -35
  52. package/types/observe.d.ts +358 -0
  53. package/types/reconcile.d.ts +1 -0
  54. package/types/render.d.ts +9 -0
  55. package/types/response.d.ts +75 -150
  56. package/types/serializer-decode.d.ts +149 -112
  57. package/types/serializer.d.ts +76 -157
  58. package/types/server-functions/client.d.ts +192 -194
  59. package/types/server-functions/flash.d.ts +28 -30
  60. package/types/server-functions/registry.d.ts +102 -0
  61. package/types/server-functions/rich-args.d.ts +1 -10
  62. package/types/server-functions/server.d.ts +511 -475
  63. package/types/server-functions/shared.d.ts +366 -425
  64. package/types/server-mock.d.ts +110 -13
  65. package/types/server-observe.d.ts +77 -0
  66. package/types/server.d.ts +425 -425
  67. package/types/trace.d.ts +127 -0
  68. package/LICENSE +0 -21
  69. package/dist/web.cjs +0 -2008
  70. package/frames/dist/client.cjs +0 -1916
  71. package/frames/dist/server.cjs +0 -3756
  72. package/serialization/dist/decode.cjs +0 -122
  73. package/serialization/dist/serialization.cjs +0 -244
  74. package/serialization/types-cjs/index.d.cts +0 -182
  75. package/serialization/types-cjs/package.json +0 -3
  76. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  77. package/server-functions/dist/client.cjs +0 -793
  78. package/server-functions/dist/rich-args.cjs +0 -11
  79. package/server-functions/dist/server.cjs +0 -1171
  80. package/server-functions/dist/server.dev.cjs +0 -1171
  81. package/storage/dist/storage.cjs +0 -12
  82. package/storage/types-cjs/index.d.cts +0 -28
  83. package/storage/types-cjs/package.json +0 -3
  84. package/types/core.d.ts +0 -6
  85. package/types-cjs/client.d.cts +0 -337
  86. package/types-cjs/cookies.d.cts +0 -93
  87. package/types-cjs/core.d.cts +0 -6
  88. package/types-cjs/frames/client.d.cts +0 -36
  89. package/types-cjs/frames/frame-client.d.cts +0 -338
  90. package/types-cjs/frames/frame-sink.d.cts +0 -194
  91. package/types-cjs/frames/frame-transport.d.cts +0 -222
  92. package/types-cjs/frames/serializer.d.cts +0 -182
  93. package/types-cjs/frames/server.d.cts +0 -52
  94. package/types-cjs/index.d.cts +0 -244
  95. package/types-cjs/jsx-properties.d.cts +0 -93
  96. package/types-cjs/jsx.d.cts +0 -4159
  97. package/types-cjs/package.json +0 -3
  98. package/types-cjs/response.d.cts +0 -174
  99. package/types-cjs/serializer-decode.d.cts +0 -182
  100. package/types-cjs/serializer.d.cts +0 -182
  101. package/types-cjs/server-functions/client.d.cts +0 -231
  102. package/types-cjs/server-functions/flash.d.cts +0 -38
  103. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  104. package/types-cjs/server-functions/server.d.cts +0 -616
  105. package/types-cjs/server-functions/shared.d.cts +0 -523
  106. package/types-cjs/server-mock.d.cts +0 -277
  107. package/types-cjs/server.d.cts +0 -523
@@ -1,182 +1,101 @@
1
- // Serialization surface (published as `@solidjs/web/serialization`): the
2
- // runtime's Seroval machinery, exposed for the runtime's own entries and
3
- // for integrations building transports on the same codec. This is
4
- // INTEGRATION-FACING plumbing, not application API — it is exempt from the
5
- // 2.0 stability guarantee and may change between releases. Application and
6
- // router code should configure `codec` on the server-function entries
7
- // instead of importing from here.
8
- import type { Serializer } from "seroval";
9
- import {
10
- JSONCodecOptions,
11
- PluginInfo,
12
- SerializerPlugin,
13
- SerovalNode
14
- } from "./serializer-decode.js";
15
-
16
- // The decode half — `SerovalNode`, the plugin TYPES, `DEFAULT_WEB_PLUGINS`,
17
- // `resolveSerializerPlugins`, `JSONCodecOptions`, `createJSONDeserializer`,
18
- // `createJSONDataTable` — is declared in serializer-decode.d.ts (published
19
- // as `@solidjs/web/serialization/decode`, the module lazy client consumers
20
- // load) and re-exported here so this remains the full surface.
21
- export * from "./serializer-decode.js";
22
-
23
- // ---- Plugin authoring ----
24
- //
25
- // Unlike the rest of this entry, plugin authoring is APPLICATION-FACING —
26
- // it is the supported way to feed the serializers' `plugins` options and
27
- // the server-function entries' `codec.plugins`. The values re-export
28
- // seroval's own (`createPlugin`, `OpaqueReference` — see serializer.js);
29
- // the plugin TYPES live in serializer-decode.d.ts (hand-declared there —
30
- // see its banner for why).
31
-
32
- /**
33
- * Builds a `SerializerPlugin` — seroval's `createPlugin`, re-exported so
34
- * plugin authors stay on the exact seroval instance/version the runtime
35
- * serializes with. Import it from HERE, not from your own `seroval`
36
- * dependency: a plugin built against a different copy/version would not
37
- * fail the build — it would emit nodes the other peer can't interpret.
38
- *
39
- * Application-facing (see the plugin-authoring banner above).
40
- */
41
- export function createPlugin<Value, Info extends PluginInfo>(
42
- plugin: SerializerPlugin<Value, Info>
43
- ): SerializerPlugin<Value, Info>;
44
-
45
- /**
46
- * Seroval's `OpaqueReference`, re-exported from the runtime's own instance
47
- * (an `OpaqueReference` from another seroval copy fails the serializer's
48
- * instanceof check and serializes as a plain value): wraps a value so it
49
- * crosses the wire as its `replacement` (default `undefined`) while
50
- * staying readable in-process through `.value`.
51
- *
52
- * Application-facing (see the plugin-authoring banner above).
53
- */
54
- export class OpaqueReference<V, R = undefined> {
55
- readonly value: V;
56
- readonly replacement?: R;
57
- constructor(value: V, replacement?: R);
58
- }
59
-
1
+ import { Serializer } from "seroval";
2
+ import type { JSONCodecOptions, PluginInfo, SerializerPlugin, SerovalNode } from "./serializer-decode.js";
3
+ export { DEFAULT_WEB_PLUGINS, createJSONDataTable, createJSONDeserializer, resolveSerializerPlugins } from "./serializer-decode.js";
4
+ export type * from "./serializer-decode.js";
60
5
  /**
61
6
  * Options for `createSerializer`.
62
7
  *
63
8
  * Integration-facing; may change (see the entry banner).
64
9
  */
65
10
  export interface WebSerializerOptions {
66
- /** Name of the global object the emitted scripts write resolved values into. */
67
- globalIdentifier: string;
68
- /** Cross-reference scope id, for isolating multiple streams on one page. */
69
- scopeId?: string;
70
- /**
71
- * Seroval feature bitflags to exclude from output. Defaults to disabling
72
- * post-ES2017 features (AggregateError, BigInt typed arrays). Outside
73
- * development, `Error.prototype.stack` is additionally stripped on top of
74
- * any override — serialized stacks leak server paths to the client.
75
- */
76
- disabledFeatures?: number;
77
- /** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
78
- plugins?: SerializerPlugin[];
79
- /** Receives each emitted script chunk. */
80
- onData: (result: string) => void;
81
- onError?: (error: unknown) => void;
82
- /** Fires once all async values have settled. */
83
- onDone?: () => void;
11
+ /** Name of the global object the emitted scripts write resolved values into. */
12
+ globalIdentifier: string;
13
+ /** Cross-reference scope id, for isolating multiple streams on one page. */
14
+ scopeId?: string;
15
+ /**
16
+ * Seroval feature bitflags to exclude from output. Defaults to disabling
17
+ * post-ES2017 features (AggregateError, BigInt typed arrays). Outside
18
+ * development, `Error.prototype.stack` is additionally stripped on top of
19
+ * any override — serialized stacks leak server paths to the client.
20
+ */
21
+ disabledFeatures?: number;
22
+ /**
23
+ * Whether serialized `Error`s carry their `.stack`. Defaults to
24
+ * `NODE_ENV === "development"`; set `false` to pin production disclosure
25
+ * to the deployment rather than the ambient variable (#3152 — see
26
+ * `JSONCodecOptions.serializeErrorStacks`).
27
+ */
28
+ serializeErrorStacks?: boolean;
29
+ /** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
30
+ plugins?: SerializerPlugin[];
31
+ /** Receives each emitted script chunk. */
32
+ onData: (result: string) => void;
33
+ onError?: (error: unknown) => void;
34
+ /** Fires once all async values have settled. */
35
+ onDone?: () => void;
84
36
  }
85
-
86
- /**
87
- * Creates a streaming Seroval serializer preconfigured with the web plugin
88
- * set and the default feature policy. Emits JavaScript chunks (through
89
- * `onData`) that reconstruct the values under `globalIdentifier` when
90
- * evaluated — the script-injection form of serialization renderers build
91
- * on. For a JSON-based wire codec (no eval on the receiving side), use
92
- * `serializeJSON` / `createJSONDeserializer` instead.
93
- *
94
- * Integration-facing; may change (see the entry banner).
95
- */
96
- export function createSerializer(options: WebSerializerOptions): Serializer;
97
-
98
37
  /**
99
38
  * Options for `createHydrationSerializer` — `WebSerializerOptions` minus
100
39
  * the knobs hydration pins (`globalIdentifier`, `disabledFeatures`).
101
40
  * @internal
102
41
  */
103
- export type HydrationSerializerOptions = Omit<
104
- WebSerializerOptions,
105
- "globalIdentifier" | "disabledFeatures"
106
- >;
107
-
108
- /**
109
- * Renderer primitive — the serializer SSR uses for hydration output. Pins
110
- * the hydration global (`_$HY.r`) and feature policy; only the wiring
111
- * options (callbacks, scope, extra plugins) are configurable. Not meant
112
- * for hand-written code — custom serialization should use
113
- * `createSerializer` or the JSON codec.
114
- * @internal
115
- */
116
- export function createHydrationSerializer(options: HydrationSerializerOptions): Serializer;
117
-
118
- /**
119
- * Renderer primitive — returns the cross-reference bootstrap script SSR
120
- * emits ahead of hydration data for a render scope. Not meant for
121
- * hand-written code.
122
- * @internal
123
- */
124
- export function getLocalHeaderScript(id?: string): string;
125
-
126
- // ---- JSON codec (server function transports) ----
127
- // (`JSONCodecOptions` and the decode half are declared in
128
- // serializer-decode.d.ts and re-exported above.)
129
-
42
+ export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures">;
130
43
  /**
131
44
  * Options for `serializeJSON`.
132
45
  *
133
46
  * Integration-facing; may change (see the entry banner).
134
47
  */
135
48
  export interface JSONSerializeOptions extends JSONCodecOptions {
136
- /**
137
- * Receives each serialized node; `initial` is true for the first chunk
138
- * (the source value itself). Async values produce additional chunks as
139
- * they resolve.
140
- */
141
- onParse: (node: SerovalNode, initial: boolean) => void;
142
- onError?: (error: unknown) => void;
143
- /** Fires once all async values have settled. */
144
- onDone?: () => void;
49
+ /**
50
+ * Receives each serialized node; `initial` is true for the first chunk
51
+ * (the source value itself). Async values produce additional chunks as
52
+ * they resolve.
53
+ */
54
+ onParse: (node: SerovalNode, initial: boolean) => void;
55
+ onError?: (error: unknown) => void;
56
+ /** Fires once all async values have settled. */
57
+ onDone?: () => void;
145
58
  }
146
-
147
- /**
148
- * Serializes `value` as SerovalNode chunks delivered through `onParse` —
149
- * the encoding half of the eval-free JSON codec (RPC-style transports;
150
- * the deserializing peer needs no script evaluation, so CSP-safe). Wire
151
- * framing of the nodes is the transport's concern. Returns a cancel
152
- * function that aborts pending async serialization.
153
- *
154
- * Integration-facing; may change (see the entry banner).
155
- */
156
- export function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
157
-
158
59
  /** Options for `createJSONSerializer`. */
159
60
  export interface JSONSerializerOptions extends JSONCodecOptions {
160
- /**
161
- * Receives each keyed record — `initial` is true for a key's first node
162
- * (the written value itself); async values patch through later records
163
- * under the same key. The decoding peer is `createJSONDataTable`.
164
- */
165
- onData: (record: { key: string; node: SerovalNode; initial: boolean }) => void;
166
- onError?: (error: unknown) => void;
167
- /** Fires once `flush()` has been called and every pending value settled. */
168
- onDone?: () => void;
61
+ /**
62
+ * Receives each keyed record — `initial` is true for a key's first node
63
+ * (the written value itself); async values patch through later records
64
+ * under the same key. The decoding peer is `createJSONDataTable`.
65
+ */
66
+ onData: (record: {
67
+ key: string;
68
+ node: SerovalNode;
69
+ initial: boolean;
70
+ }) => void;
71
+ onError?: (error: unknown) => void;
72
+ /** Fires once `flush()` has been called and every pending value settled. */
73
+ onDone?: () => void;
74
+ }
75
+ export declare const createPlugin: <Value, Info extends PluginInfo>(plugin: SerializerPlugin<Value, Info>) => SerializerPlugin<Value, Info>;
76
+ export interface OpaqueReference<V = unknown, R = undefined> {
77
+ readonly value: V;
78
+ readonly replacement?: R;
169
79
  }
170
-
80
+ export declare const OpaqueReference: {
81
+ new <V, R = undefined>(value: V, replacement?: R): OpaqueReference<V, R>;
82
+ };
171
83
  /**
172
- * The keyed, streaming encoder of the eval-free JSON codec — the render
173
- * stream's data serializer (frames default to it). Each `write(key, value)`
174
- * shares one reference space, so cross-record identity holds; `flush()`
175
- * marks the write set complete (writes after it are dropped, mirroring the
176
- * hydration serializer); `close()` aborts pending async serialization.
84
+ * Creates a streaming Seroval serializer preconfigured with the web plugin
85
+ * set and the default feature policy. Emits JavaScript chunks (through
86
+ * `onData`) that reconstruct the values under `globalIdentifier` when
87
+ * evaluated — the script-injection form of serialization renderers build
88
+ * on. For a JSON-based wire codec (no eval on the receiving side), use
89
+ * `serializeJSON` / `createJSONDeserializer` instead.
90
+ *
91
+ * Integration-facing; may change (see the entry banner).
177
92
  */
178
- export function createJSONSerializer(options: JSONSerializerOptions): {
179
- write(key: string, value: unknown): void;
180
- flush(): void;
181
- close(): void;
93
+ export declare function createSerializer(options: WebSerializerOptions): Serializer;
94
+ export declare function createHydrationSerializer(options: HydrationSerializerOptions): Serializer;
95
+ export declare function getLocalHeaderScript(id?: string): string;
96
+ export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
97
+ export declare function createJSONSerializer(options: JSONSerializerOptions): {
98
+ write(key: string, value: unknown): void;
99
+ flush(): void;
100
+ close(): void;
182
101
  };
@@ -49,4 +49,4 @@ export type Slot<P = {}> = (props: P & {
49
49
  */
50
50
  export declare function asyncArg<T>(value: PromiseLike<T> | AsyncIterable<T>): T;
51
51
  export { renderToFrameStream, renderServerComponent, serverComponentResponse, frameTransformResult, frameTransformFlightResult, createFrameSink, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.js";
52
- export { FRAME_STREAM_HEADER, isFrameStreamResponse } from "./frame-transport.js";
52
+ export { FRAME_STREAM_HEADER, FRAME_HAVE_HEADER, FRAME_HAVE_BUDGET, isFrameStreamResponse } from "./frame-transport.js";
@@ -0,0 +1,19 @@
1
+ export declare const HEAD_ELIGIBLE_TAGS: Set<string>;
2
+ export declare const HEAD_ATTR_NAME: RegExp;
3
+ export declare const RESOURCE_LINK_RELS: Set<string>;
4
+ export declare const RESOURCE_QUALIFIERS: string[];
5
+ export declare const STYLESHEET_FETCH_META: Set<string>;
6
+ export declare function evalHeadValue(v: any): any;
7
+ export declare function evalHeadProps(props: any, presets: any): {};
8
+ export declare function classifyHeadTag(desc: any): {
9
+ resource: boolean;
10
+ rel: any;
11
+ } | {
12
+ resource: boolean;
13
+ rel?: undefined;
14
+ };
15
+ export declare function qualifierValue(name: any, value: any): any;
16
+ export declare function asciiLowerCase(value: any): any;
17
+ export declare function resourceIdentity(tag: any, props: any): string;
18
+ export declare function replaceableIdentity(tag: any, props: any, key: any, unique: any): any;
19
+ export declare function resolveHead(groups: any): Map<any, any>;
package/types/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { hydrate as hydrateCore } from "./client.js";
2
1
  import { Component } from "solid-js";
3
2
  import type { JSX } from "./jsx.js";
4
3
  export * from "./client.js";
@@ -6,16 +5,6 @@ export * from "./server-mock.js";
6
5
  export * from "./response.js";
7
6
  export type { JSX } from "./jsx.js";
8
7
  export { For, Show, Switch, Match, Errored, Loading, Repeat, Reveal, NoHydration, Hydration } from "solid-js";
9
- import { merge } from "solid-js";
10
- /**
11
- * Compiler-emitted prop-spread helper. The JSX transform (in
12
- * `dom-expressions`) emits `mergeProps(...)` calls when compiling prop
13
- * spreads on components — it is *not* a user-facing API. Application code
14
- * should import `merge` from `solid-js` directly.
15
- *
16
- * @internal
17
- */
18
- export declare const mergeProps: typeof merge;
19
8
  /**
20
9
  * Build-time constant indicating whether code is running on the server. This
21
10
  * client entry sets it to `false`; the matching server entry (`@solidjs/web`
@@ -54,68 +43,15 @@ export declare const isServer: boolean;
54
43
  * ```
55
44
  */
56
45
  export declare const isDev: boolean;
57
- type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
58
46
  export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
59
47
  export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
60
48
  export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
49
+ /** @deprecated Props of the deprecated `<Dynamic>`; see `dynamic()`. */
61
50
  export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
62
51
  [K in keyof P]: P[K];
63
52
  } & {
64
53
  component: T | null | undefined | false;
65
54
  };
66
- /**
67
- * Renders a component tree into a DOM element. Returns a dispose function
68
- * that tears the tree down and cleans up reactive scopes when called.
69
- *
70
- * @example
71
- * ```tsx
72
- * import { render } from "@solidjs/web";
73
- *
74
- * const dispose = render(() => <App />, document.getElementById("root")!);
75
- *
76
- * // Later, to unmount:
77
- * dispose();
78
- * ```
79
- *
80
- * @remarks
81
- * The top-level insert is queued via `insertOptions: { schedule: true }` so
82
- * its initial DOM attach goes through the effect queue rather than executing
83
- * inline. This lets the mount participate in transitions: if an uncaught
84
- * async read surfaces during the initial render (no `Loading` ancestor
85
- * absorbs it), the mount is held by the transition and attaches atomically
86
- * once all pending settles. On the no-async happy path the tail `flush()`
87
- * drains the queued callback so the attach is synchronous by the time
88
- * `render()` returns. The dev enforcement window scopes
89
- * `ASYNC_OUTSIDE_LOADING_BOUNDARY` to the initial mount only.
90
- */
91
- export declare function render(code: () => JSX.Element, element: MountableElement, init?: unknown, options?: {
92
- renderId?: string;
93
- }): () => void;
94
- /**
95
- * Resumes a server-rendered tree on the client, attaching event listeners
96
- * and reactive bindings without reconstructing the DOM. Returns a `dispose`
97
- * function that tears down reactive scopes (DOM nodes are left in place).
98
- *
99
- * Use this when the page HTML was produced by `renderToString` or
100
- * `renderToStream`. For client-only apps, use `render` instead.
101
- *
102
- * Pass `options.renderId` to hydrate one of multiple roots emitted by a
103
- * server render that used the same id.
104
- *
105
- * When the server renders a full document but the client hydrates only the
106
- * app subtree, the server must give that subtree its own id namespace: wrap
107
- * the document shell in `<NoHydration>` and re-enter with `<Hydration>`
108
- * around the app. Otherwise the app's hydration ids are allocated under the
109
- * document component's owner tree and this walk can never claim them.
110
- *
111
- * @example
112
- * ```tsx
113
- * import { hydrate } from "@solidjs/web";
114
- *
115
- * hydrate(() => <App />, document.getElementById("root")!);
116
- * ```
117
- */
118
- export declare const hydrate: typeof hydrateCore;
119
55
  /**
120
56
  * Renders its children into a different part of the DOM (modal roots,
121
57
  * tooltips, layers that need to escape an `overflow: hidden` ancestor).
@@ -143,21 +79,55 @@ export declare function Portal(props: {
143
79
  mount?: Element;
144
80
  children: JSX.Element;
145
81
  }): JSX.Element;
146
- export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false): Component<ComponentProps<T>>;
82
+ export interface DynamicOptions {
83
+ /**
84
+ * SSR only: hold the document's first flush until the source settles, so
85
+ * the resolved component renders into the shell instead of streaming in
86
+ * behind its boundary's fallback. Same meaning as `createMemo`'s
87
+ * `deferStream`. Ignored on the client.
88
+ */
89
+ deferStream?: boolean;
90
+ /**
91
+ * The source cannot change: call it once, untracked, now, and render the
92
+ * result with no computation per instance (see `dynamic`). The source must
93
+ * resolve synchronously.
94
+ */
95
+ static?: boolean;
96
+ }
97
+ /**
98
+ * A component from a reactive source. The source may answer with the
99
+ * component itself, a promise of it, or an async iterable of it — a `live`
100
+ * server component reference's answer is the last: the memo underneath pumps
101
+ * the iterable as it pumps any async source, and its value is the component
102
+ * the server answered with (a reconnect re-yields the same binding and is
103
+ * equality-quiet; nothing here re-mounts).
104
+ *
105
+ * Under SSR an async answer is an ordinary async memo's: its landing is
106
+ * serialized per instance and adopted here at hydration, so the source may
107
+ * stay async only when what it resolves to can cross — a server component
108
+ * (as a reference) or a serializable value (a tag name). A promise of a
109
+ * client component function is a dev error on the server
110
+ * (`DYNAMIC_ASYNC_COMPONENT`): resolve the async upstream, or use `lazy()`.
111
+ */
112
+ export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | AsyncIterable<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
147
113
  /**
148
- * Renders an arbitrary custom or native component and forwards the other
149
- * props. JSX form of `dynamic()` — same primitive, picked at the JSX site.
114
+ * @deprecated Use `dynamic()`. `<Dynamic>` is the same primitive, but its
115
+ * shape puts the tag in the same bag as the element's props: every instance
116
+ * merges `component` in at the call site, `omit()`s it back out here, and
117
+ * builds a fresh `dynamic()` factory (with its memo) because there is nowhere
118
+ * to hoist one. `dynamic()` has none of that and is one line longer:
150
119
  *
151
- * @example
152
120
  * ```tsx
153
- * <Dynamic
154
- * component={multiline() ? RichTextEditor : "input"}
155
- * value={value()}
156
- * onInput={onInput}
157
- * />
121
+ * // before
122
+ * <Dynamic component={multiline() ? RichTextEditor : "input"} value={value()} />
123
+ *
124
+ * // after — hoist per component instance (or per module for a constant)
125
+ * const Field = dynamic(() => multiline() ? RichTextEditor : "input");
126
+ * <Field value={value()} />
158
127
  * ```
159
128
  *
160
- * @description https://docs.solidjs.com/reference/components/dynamic
129
+ * Remains available in 2.0 (deprecated, no runtime warning); prefer `dynamic()`
130
+ * in new code.
161
131
  */
162
132
  export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
163
133
  /**
@@ -216,9 +186,10 @@ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
216
186
  * `event.response` status at write time and restores it when the owning
217
187
  * scope is disposed — so a boundary that errored, declared a status, and
218
188
  * then recovered retracts its write instead of stomping a status a
219
- * surviving part of the tree legitimately set. Once the integration marks
220
- * the response head `committed` (head derived/sent), writes and
221
- * retractions are no-ops.
189
+ * surviving part of the tree legitimately set. Once the response head is
190
+ * `committed` (head derived/sent — the shell flush of a piped
191
+ * `renderToStream`, the completion of an awaited one or of
192
+ * `renderToString`), writes and retractions are no-ops.
222
193
  */
223
194
  export declare function httpStatus(_code: number, _text?: string): void;
224
195
  /**
@@ -236,8 +207,9 @@ export declare function httpStatus(_code: number, _text?: string): void;
236
207
  * Retraction semantics (server): the header's prior value is snapshotted at
237
208
  * write time and restored when the owning scope is disposed (deleted if
238
209
  * there was none) — a boundary that errors or recovers retracts its writes.
239
- * Once the integration marks the response head `committed` (head
240
- * derived/sent), writes and retractions are no-ops.
210
+ * Once the response head is `committed` (head derived/sent — the shell
211
+ * flush of a piped `renderToStream`, the completion of an awaited one or
212
+ * of `renderToString`), writes and retractions are no-ops.
241
213
  */
242
214
  export declare function httpHeader(_name: string, _value: string, _options?: {
243
215
  append?: boolean;
@@ -0,0 +1,174 @@
1
+ import { type Component } from "solid-js";
2
+ import type { JSX } from "./jsx.js";
3
+ export * from "./server.js";
4
+ export * from "./response.js";
5
+ export type { CallEvent, CallListener, CallLive, FrameAppliedEvent, FrameEvent, FrameListener, FrameLive, FrameProducedEvent, InvocationEvent, InvocationListener, InvocationLive, RenderEvent, RenderListener, RenderLive } from "./observe.js";
6
+ export type { TraceContext, TraceProvider } from "./trace.js";
7
+ export type { JSX } from "./jsx.js";
8
+ export { For, Show, Loading, Reveal, Switch, Match, Repeat, Errored, NoHydration, Hydration } from "solid-js";
9
+ /**
10
+ * Build-time constant indicating whether code is running on the server. This
11
+ * is the server entry; the value is `true`. The client entry of `@solidjs/web`
12
+ * sets it to `false`. See the client-entry JSDoc for the canonical guard
13
+ * pattern.
14
+ */
15
+ export declare const isServer: boolean;
16
+ /**
17
+ * Build-time constant indicating whether code is running in a dev build.
18
+ * Set by `_SOLID_DEV_` substitution per artifact, exactly like the client
19
+ * entry: `dist/server.dev.*` (the `development` export condition) → `true`,
20
+ * `dist/server.*` → `false`. The server runtime's own `_SOLID_DEV_` gates are
21
+ * replaced by the same pass, so this flag and the bundle's internal behavior
22
+ * cannot disagree.
23
+ */
24
+ export declare const isDev: boolean;
25
+ export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
26
+ export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
27
+ export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
28
+ export interface DynamicOptions {
29
+ /**
30
+ * SSR only: hold the document's first flush until the source settles, so
31
+ * the resolved component renders into the shell instead of streaming in
32
+ * behind its boundary's fallback. Same meaning as `createMemo`'s
33
+ * `deferStream`. Default `false` — a `dynamic()` source is data of unknown
34
+ * cost and streams by default (a code-split `lazy()` always holds the shell
35
+ * for its module load, since its code is a prerequisite to the render).
36
+ */
37
+ deferStream?: boolean;
38
+ /**
39
+ * The source cannot change: call it once, untracked, now, and render the
40
+ * result with no computation per instance (see the client `dynamic`). The
41
+ * source must resolve synchronously.
42
+ */
43
+ static?: boolean;
44
+ }
45
+ export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
46
+ /** @deprecated Props of the deprecated `<Dynamic>`; see `dynamic()`. */
47
+ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
48
+ [K in keyof P]: P[K];
49
+ } & {
50
+ component: T | null | undefined | false;
51
+ };
52
+ /**
53
+ * @deprecated Use `dynamic()`. `<Dynamic>` is the same primitive, but its
54
+ * shape puts the tag in the same bag as the element's props: every instance
55
+ * merges `component` in at the call site, `omit()`s it back out here, and
56
+ * builds a fresh `dynamic()` factory (with its memo) because there is nowhere
57
+ * to hoist one. `dynamic()` has none of that and is one line longer:
58
+ *
59
+ * ```tsx
60
+ * // before
61
+ * <Dynamic component={multiline() ? RichTextEditor : "input"} value={value()} />
62
+ *
63
+ * // after — hoist per component instance (or per module for a constant)
64
+ * const Field = dynamic(() => multiline() ? RichTextEditor : "input");
65
+ * <Field value={value()} />
66
+ * ```
67
+ *
68
+ * Remains available in 2.0 (deprecated, no runtime warning); prefer `dynamic()`
69
+ * in new code.
70
+ */
71
+ export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
72
+ /**
73
+ * Portals are client-only islands: the server renders nothing for them —
74
+ * `props.children` is never evaluated, no async is started, and nothing is
75
+ * serialized. The client renders the content fresh once hydration settles.
76
+ * Throwing here instead (as earlier betas did) is strictly worse: an ancestor
77
+ * `Errored` catches it and bakes the error fallback into the streamed HTML
78
+ * for a tree that renders fine client-side (#2876).
79
+ *
80
+ * The one thing both sides must still agree on is the parent's child-id
81
+ * counter: the client Portal scopes its internals under one owner (one slot),
82
+ * so consume the matching slot here or every hydration id after the portal
83
+ * drifts.
84
+ */
85
+ export declare function Portal(props: {
86
+ mount?: Element;
87
+ children: JSX.Element;
88
+ }): JSX.Element;
89
+ /**
90
+ * Server half of `clientOnly`: the wrapped component never renders on the
91
+ * server — the import is never even started — only `props.fallback` is
92
+ * SSR'd. The client build swaps the real component in after load + mount.
93
+ * See the client entry's JSDoc for the full contract.
94
+ *
95
+ * `moduleUrl` is injected by the bundler's module-URL pass (the same one
96
+ * that annotates `lazy()`, padding the options slot when a call site omits
97
+ * it); when present and an asset manifest is set, the render emits early
98
+ * preload hints for the module — see `registerClientOnlyPreload` for why
99
+ * they stay out of the hydration asset map. Without it (untransformed code)
100
+ * or without a manifest, behavior is unchanged.
101
+ */
102
+ export declare function clientOnly<M extends Record<string, any>, K extends keyof M & string>(fn: () => Promise<M>, options: {
103
+ lazy?: boolean;
104
+ export: K;
105
+ }, moduleUrl?: string): Component<ComponentProps<M[K]> & {
106
+ fallback?: JSX.Element;
107
+ }>;
108
+ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
109
+ default: T;
110
+ }>, options?: {
111
+ lazy?: boolean;
112
+ export?: string;
113
+ }, moduleUrl?: string): Component<ComponentProps<T> & {
114
+ fallback?: JSX.Element;
115
+ }>;
116
+ /**
117
+ * Declares the HTTP response status (and optional status text) for the
118
+ * lifetime of the current reactive scope during SSR, writing to the request
119
+ * event's `response` head (core's `ResponseStub`, exposed by the
120
+ * integration).
121
+ *
122
+ * Naming note — this is a scope-tied *declaration*, not a mutation: "while
123
+ * this reactive scope is live, the response has this status." Solid reserves
124
+ * `set*` verbs for event-time mutation; `httpStatus` is called bare in a
125
+ * component or reactive-scope body (like `createSignal`/`onCleanup`) and
126
+ * un-declares on scope disposal.
127
+ *
128
+ * Retraction semantics: disposal retracts only this scope's declaration —
129
+ * the response falls back to the latest still-live declaration, or to the
130
+ * base status the integration had set before the first declaration. A
131
+ * boundary that errored, declared a status, and then recovered retracts its
132
+ * write without stomping a status a surviving part of the tree legitimately
133
+ * set (e.g. a 404 page whose inner boundary recovers stays a 404), and
134
+ * sibling scopes may dispose in any order (#2984). Both the write and the
135
+ * cleanup are no-ops once the response head is `committed` (head
136
+ * derived/sent — status can no longer change). The head commits when it
137
+ * freezes: at shell flush for a piped `renderToStream` (`createSSRResponse`
138
+ * commits on the first write), and at completion for an awaited one or for
139
+ * `renderToString` (the render commits right before its final dispose, so
140
+ * the declarations still live at that point are the ones the consumer
141
+ * derives the head from; `createSSRResponse` then passes the committed stub
142
+ * through). On the client this is a no-op.
143
+ */
144
+ export declare function httpStatus(code: number, text?: string): void;
145
+ /**
146
+ * Declares an HTTP response header (or with `append`, appends to one) for
147
+ * the lifetime of the current reactive scope during SSR, writing to the
148
+ * request event's `response` head (core's `ResponseStub`, exposed by the
149
+ * integration).
150
+ *
151
+ * Naming note — this is a scope-tied *declaration*, not a mutation: "while
152
+ * this reactive scope is live, the response has this header." Solid reserves
153
+ * `set*` verbs for event-time mutation; `httpHeader` is called bare in a
154
+ * component or reactive-scope body (like `createSignal`/`onCleanup`) and
155
+ * un-declares on scope disposal.
156
+ *
157
+ * Retraction semantics: disposal retracts only this scope's declaration —
158
+ * the header is recomputed by replaying the still-live declarations, in
159
+ * their original write order, over the base value the integration had set
160
+ * before the first declaration (deleted when there is neither). Sibling
161
+ * scopes may therefore dispose in any order without disturbing each
162
+ * other's contributions (#2984). For `set-cookie` — the one header whose
163
+ * multiple values must survive as separate entries — the base is captured
164
+ * and replayed entry-exact (`getSetCookie()` + re-append; `get()`/`set()`
165
+ * would comma-join the entries and then collapse them into one corrupt
166
+ * header). Both the write and the cleanup are no-ops once the response head
167
+ * is `committed` (head derived/sent — headers can no longer change); the
168
+ * head commits when it freezes — shell flush for a piped `renderToStream`,
169
+ * completion (right before the final dispose) for an awaited one and for
170
+ * `renderToString` — see `httpStatus`. On the client this is a no-op.
171
+ */
172
+ export declare function httpHeader(name: string, value: string, options?: {
173
+ append?: boolean;
174
+ }): void;