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

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 (78) hide show
  1. package/dist/dev.cjs +86 -61
  2. package/dist/dev.js +81 -60
  3. package/dist/server.cjs +34 -17
  4. package/dist/server.js +35 -19
  5. package/dist/web.cjs +83 -59
  6. package/dist/web.js +78 -58
  7. package/frames/dist/client.cjs +8 -8
  8. package/frames/dist/client.dev.cjs +8 -8
  9. package/frames/dist/client.dev.js +8 -8
  10. package/frames/dist/client.js +8 -8
  11. package/frames/dist/server.cjs +28 -18
  12. package/frames/dist/server.js +29 -19
  13. package/package.json +20 -22
  14. package/serialization/dist/decode.cjs +3 -3
  15. package/serialization/dist/decode.js +3 -3
  16. package/serialization/dist/serialization.cjs +7 -11
  17. package/serialization/dist/serialization.js +7 -6
  18. package/serialization/types/index.d.ts +69 -157
  19. package/serialization/types/serializer-decode.d.ts +89 -112
  20. package/serialization/types/serializer.d.ts +94 -0
  21. package/serialization/types-cjs/index.d.cts +69 -157
  22. package/serialization/types-cjs/serializer-decode.d.cts +89 -112
  23. package/serialization/types-cjs/serializer.d.cts +94 -0
  24. package/types/client.d.ts +150 -290
  25. package/types/constants.d.ts +18 -0
  26. package/types/cookies.d.ts +31 -75
  27. package/types/frames/frame-client.d.ts +287 -277
  28. package/types/frames/frame-container-plugin.d.ts +71 -0
  29. package/types/frames/frame-sink.d.ts +58 -160
  30. package/types/frames/frame-transport.d.ts +161 -194
  31. package/types/frames/serializer-decode.d.ts +159 -0
  32. package/types/frames/serializer.d.ts +69 -157
  33. package/types/head.d.ts +16 -0
  34. package/types/index.d.ts +0 -65
  35. package/types/index.server.d.ts +125 -0
  36. package/types/jsx.d.ts +5 -13
  37. package/types/reconcile.d.ts +1 -0
  38. package/types/render.d.ts +4 -0
  39. package/types/response.d.ts +41 -153
  40. package/types/serializer-decode.d.ts +89 -112
  41. package/types/serializer.d.ts +69 -157
  42. package/types/server-functions/client.d.ts +93 -222
  43. package/types/server-functions/flash.d.ts +10 -30
  44. package/types/server-functions/registry.d.ts +63 -0
  45. package/types/server-functions/rich-args.d.ts +1 -10
  46. package/types/server-functions/server.d.ts +292 -574
  47. package/types/server-functions/shared.d.ts +112 -458
  48. package/types/server-mock.d.ts +2 -2
  49. package/types/server.d.ts +242 -434
  50. package/types-cjs/client.d.cts +150 -290
  51. package/types-cjs/constants.d.cts +18 -0
  52. package/types-cjs/cookies.d.cts +31 -75
  53. package/types-cjs/frames/frame-client.d.cts +287 -277
  54. package/types-cjs/frames/frame-container-plugin.d.cts +71 -0
  55. package/types-cjs/frames/frame-sink.d.cts +58 -160
  56. package/types-cjs/frames/frame-transport.d.cts +161 -194
  57. package/types-cjs/frames/serializer-decode.d.cts +159 -0
  58. package/types-cjs/frames/serializer.d.cts +69 -157
  59. package/types-cjs/head.d.cts +16 -0
  60. package/types-cjs/index.d.cts +0 -65
  61. package/types-cjs/index.server.d.cts +125 -0
  62. package/types-cjs/jsx.d.cts +5 -13
  63. package/types-cjs/reconcile.d.cts +1 -0
  64. package/types-cjs/render.d.cts +4 -0
  65. package/types-cjs/response.d.cts +41 -153
  66. package/types-cjs/serializer-decode.d.cts +89 -112
  67. package/types-cjs/serializer.d.cts +69 -157
  68. package/types-cjs/server-functions/client.d.cts +93 -222
  69. package/types-cjs/server-functions/flash.d.cts +10 -30
  70. package/types-cjs/server-functions/registry.d.cts +63 -0
  71. package/types-cjs/server-functions/rich-args.d.cts +1 -10
  72. package/types-cjs/server-functions/server.d.cts +292 -574
  73. package/types-cjs/server-functions/shared.d.cts +112 -458
  74. package/types-cjs/server-mock.d.cts +2 -2
  75. package/types-cjs/server.d.cts +242 -434
  76. package/LICENSE +0 -21
  77. package/types/core.d.ts +0 -9
  78. package/types-cjs/core.d.cts +0 -9
@@ -1,182 +1,94 @@
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
+ /** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
23
+ plugins?: SerializerPlugin[];
24
+ /** Receives each emitted script chunk. */
25
+ onData: (result: string) => void;
26
+ onError?: (error: unknown) => void;
27
+ /** Fires once all async values have settled. */
28
+ onDone?: () => void;
84
29
  }
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
30
  /**
99
31
  * Options for `createHydrationSerializer` — `WebSerializerOptions` minus
100
32
  * the knobs hydration pins (`globalIdentifier`, `disabledFeatures`).
101
33
  * @internal
102
34
  */
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
-
35
+ export type HydrationSerializerOptions = Omit<WebSerializerOptions, "globalIdentifier" | "disabledFeatures">;
130
36
  /**
131
37
  * Options for `serializeJSON`.
132
38
  *
133
39
  * Integration-facing; may change (see the entry banner).
134
40
  */
135
41
  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;
42
+ /**
43
+ * Receives each serialized node; `initial` is true for the first chunk
44
+ * (the source value itself). Async values produce additional chunks as
45
+ * they resolve.
46
+ */
47
+ onParse: (node: SerovalNode, initial: boolean) => void;
48
+ onError?: (error: unknown) => void;
49
+ /** Fires once all async values have settled. */
50
+ onDone?: () => void;
145
51
  }
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
52
  /** Options for `createJSONSerializer`. */
159
53
  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;
54
+ /**
55
+ * Receives each keyed record — `initial` is true for a key's first node
56
+ * (the written value itself); async values patch through later records
57
+ * under the same key. The decoding peer is `createJSONDataTable`.
58
+ */
59
+ onData: (record: {
60
+ key: string;
61
+ node: SerovalNode;
62
+ initial: boolean;
63
+ }) => void;
64
+ onError?: (error: unknown) => void;
65
+ /** Fires once `flush()` has been called and every pending value settled. */
66
+ onDone?: () => void;
67
+ }
68
+ export declare const createPlugin: <Value, Info extends PluginInfo>(plugin: SerializerPlugin<Value, Info>) => SerializerPlugin<Value, Info>;
69
+ export interface OpaqueReference<V = unknown, R = undefined> {
70
+ readonly value: V;
71
+ readonly replacement?: R;
169
72
  }
170
-
73
+ export declare const OpaqueReference: {
74
+ new <V, R = undefined>(value: V, replacement?: R): OpaqueReference<V, R>;
75
+ };
171
76
  /**
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.
77
+ * Creates a streaming Seroval serializer preconfigured with the web plugin
78
+ * set and the default feature policy. Emits JavaScript chunks (through
79
+ * `onData`) that reconstruct the values under `globalIdentifier` when
80
+ * evaluated the script-injection form of serialization renderers build
81
+ * on. For a JSON-based wire codec (no eval on the receiving side), use
82
+ * `serializeJSON` / `createJSONDeserializer` instead.
83
+ *
84
+ * Integration-facing; may change (see the entry banner).
177
85
  */
178
- export function createJSONSerializer(options: JSONSerializerOptions): {
179
- write(key: string, value: unknown): void;
180
- flush(): void;
181
- close(): void;
86
+ export declare function createSerializer(options: WebSerializerOptions): Serializer;
87
+ export declare function createHydrationSerializer(options: HydrationSerializerOptions): Serializer;
88
+ export declare function getLocalHeaderScript(id?: string): string;
89
+ export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
90
+ export declare function createJSONSerializer(options: JSONSerializerOptions): {
91
+ write(key: string, value: unknown): void;
92
+ flush(): void;
93
+ close(): void;
182
94
  };
@@ -0,0 +1,16 @@
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 STYLESHEET_FETCH_META: Set<string>;
5
+ export declare function evalHeadValue(v: any): any;
6
+ export declare function evalHeadProps(props: any, presets: any): {};
7
+ export declare function classifyHeadTag(desc: any): {
8
+ resource: boolean;
9
+ rel: any;
10
+ } | {
11
+ resource: boolean;
12
+ rel?: undefined;
13
+ };
14
+ export declare function resourceIdentity(tag: any, props: any): string;
15
+ export declare function replaceableIdentity(tag: any, props: any, key: any, unique: any): any;
16
+ 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,7 +43,6 @@ 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>;
@@ -63,59 +51,6 @@ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
63
51
  } & {
64
52
  component: T | null | undefined | false;
65
53
  };
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
54
  /**
120
55
  * Renders its children into a different part of the DOM (modal roots,
121
56
  * tooltips, layers that need to escape an `overflow: hidden` ancestor).
@@ -0,0 +1,125 @@
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 { JSX } from "./jsx.js";
6
+ export { For, Show, Loading, Reveal, Switch, Match, Repeat, Errored, NoHydration, Hydration } from "solid-js";
7
+ /**
8
+ * Build-time constant indicating whether code is running on the server. This
9
+ * is the server entry; the value is `true`. The client entry of `@solidjs/web`
10
+ * sets it to `false`. See the client-entry JSDoc for the canonical guard
11
+ * pattern.
12
+ */
13
+ export declare const isServer: boolean;
14
+ /**
15
+ * Build-time constant indicating whether code is running in a dev build.
16
+ * The server entry hard-codes `false` (SSR builds are production by
17
+ * convention); the client entry's value is set by `_SOLID_DEV_` substitution.
18
+ */
19
+ export declare const isDev: boolean;
20
+ export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
21
+ export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
22
+ export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
23
+ export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false): Component<ComponentProps<T>>;
24
+ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
25
+ [K in keyof P]: P[K];
26
+ } & {
27
+ component: T | null | undefined | false;
28
+ };
29
+ export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
30
+ /**
31
+ * Portals are client-only islands: the server renders nothing for them —
32
+ * `props.children` is never evaluated, no async is started, and nothing is
33
+ * serialized. The client renders the content fresh once hydration settles.
34
+ * Throwing here instead (as earlier betas did) is strictly worse: an ancestor
35
+ * `Errored` catches it and bakes the error fallback into the streamed HTML
36
+ * for a tree that renders fine client-side (#2876).
37
+ *
38
+ * The one thing both sides must still agree on is the parent's child-id
39
+ * counter: the client Portal scopes its internals under one owner (one slot),
40
+ * so consume the matching slot here or every hydration id after the portal
41
+ * drifts.
42
+ */
43
+ export declare function Portal(props: {
44
+ mount?: Element;
45
+ children: JSX.Element;
46
+ }): JSX.Element;
47
+ /**
48
+ * Server half of `clientOnly`: the wrapped component never renders on the
49
+ * server — the import is never even started — only `props.fallback` is
50
+ * SSR'd. The client build swaps the real component in after load + mount.
51
+ * See the client entry's JSDoc for the full contract.
52
+ *
53
+ * `moduleUrl` is injected by the bundler's module-URL pass (the same one
54
+ * that annotates `lazy()`, padding the options slot when a call site omits
55
+ * it); when present and an asset manifest is set, the render emits early
56
+ * preload hints for the module — see `registerClientOnlyPreload` for why
57
+ * they stay out of the hydration asset map. Without it (untransformed code)
58
+ * or without a manifest, behavior is unchanged.
59
+ */
60
+ export declare function clientOnly<M extends Record<string, any>, K extends keyof M & string>(fn: () => Promise<M>, options: {
61
+ lazy?: boolean;
62
+ export: K;
63
+ }, moduleUrl?: string): Component<ComponentProps<M[K]> & {
64
+ fallback?: JSX.Element;
65
+ }>;
66
+ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
67
+ default: T;
68
+ }>, options?: {
69
+ lazy?: boolean;
70
+ export?: string;
71
+ }, moduleUrl?: string): Component<ComponentProps<T> & {
72
+ fallback?: JSX.Element;
73
+ }>;
74
+ /**
75
+ * Declares the HTTP response status (and optional status text) for the
76
+ * lifetime of the current reactive scope during SSR, writing to the request
77
+ * event's `response` head (core's `ResponseStub`, exposed by the
78
+ * integration).
79
+ *
80
+ * Naming note — this is a scope-tied *declaration*, not a mutation: "while
81
+ * this reactive scope is live, the response has this status." Solid reserves
82
+ * `set*` verbs for event-time mutation; `httpStatus` is called bare in a
83
+ * component or reactive-scope body (like `createSignal`/`onCleanup`) and
84
+ * un-declares on scope disposal.
85
+ *
86
+ * Retraction semantics: disposal retracts only this scope's declaration —
87
+ * the response falls back to the latest still-live declaration, or to the
88
+ * base status the integration had set before the first declaration. A
89
+ * boundary that errored, declared a status, and then recovered retracts its
90
+ * write without stomping a status a surviving part of the tree legitimately
91
+ * set (e.g. a 404 page whose inner boundary recovers stays a 404), and
92
+ * sibling scopes may dispose in any order (#2984). Both the write and the
93
+ * cleanup are no-ops once the integration marks the response head
94
+ * `committed` (head derived/sent — status can no longer change). On the
95
+ * client this is a no-op.
96
+ */
97
+ export declare function httpStatus(code: number, text?: string): void;
98
+ /**
99
+ * Declares an HTTP response header (or with `append`, appends to one) for
100
+ * the lifetime of the current reactive scope during SSR, writing to the
101
+ * request event's `response` head (core's `ResponseStub`, exposed by the
102
+ * integration).
103
+ *
104
+ * Naming note — this is a scope-tied *declaration*, not a mutation: "while
105
+ * this reactive scope is live, the response has this header." Solid reserves
106
+ * `set*` verbs for event-time mutation; `httpHeader` is called bare in a
107
+ * component or reactive-scope body (like `createSignal`/`onCleanup`) and
108
+ * un-declares on scope disposal.
109
+ *
110
+ * Retraction semantics: disposal retracts only this scope's declaration —
111
+ * the header is recomputed by replaying the still-live declarations, in
112
+ * their original write order, over the base value the integration had set
113
+ * before the first declaration (deleted when there is neither). Sibling
114
+ * scopes may therefore dispose in any order without disturbing each
115
+ * other's contributions (#2984). For `set-cookie` — the one header whose
116
+ * multiple values must survive as separate entries — the base is captured
117
+ * and replayed entry-exact (`getSetCookie()` + re-append; `get()`/`set()`
118
+ * would comma-join the entries and then collapse them into one corrupt
119
+ * header). Both the write and the cleanup are no-ops once the integration
120
+ * marks the response head `committed` (head derived/sent — headers can no
121
+ * longer change). On the client this is a no-op.
122
+ */
123
+ export declare function httpHeader(name: string, value: string, options?: {
124
+ append?: boolean;
125
+ }): void;
package/types/jsx.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  /**
2
- THIS FILE IS GENERATED BY `./jsx-update.mjs`.
3
- PLEASE UPDATE `jsx-h.d.ts` INSTEAD AND RUN `pnpm jsx-sync-types`.
4
- */
2
+ * THIS FILE IS GENERATED by `scripts/jsx-sync.mjs`.
3
+ * Edit `jsx-h.d.ts` and run `pnpm --filter @solidjs/web jsx-sync`
4
+ * (also runs as part of `pnpm types`).
5
+ */
5
6
 
6
7
  import * as csstype from "csstype";
7
8
  import type { PropKey, WidenPropValue } from "./jsx-properties.js";
8
9
  import type { Element as SolidElement } from "solid-js";
9
10
 
10
11
  /**
11
- * Originally based on JSX types for Surplus and Inferno and adapted for `dom-expressions`.
12
+ * Originally based on JSX types for Surplus and Inferno and adapted for Solid.
12
13
  *
13
14
  * - https://github.com/adamhaile/surplus/blob/master/index.d.ts
14
15
  * - https://github.com/infernojs/inferno/blob/master/packages/inferno/src/core/types.ts
@@ -249,15 +250,6 @@ export namespace JSX {
249
250
  ref?: Ref<T>;
250
251
  children?: Element | undefined;
251
252
  $ServerOnly?: boolean | undefined;
252
- /**
253
- * Entity identity for server markup (SSR-only): compiles to the `_key`
254
- * attribute the frame morph matches keyed elements by, so live element
255
- * state (form values, `open`, focus) follows the entity across
256
- * reordering morphs. Sibling-scoped, like client keyed rendering.
257
- * Stripped from DOM compiles; on components, `$key` is slot occurrence
258
- * identity instead.
259
- */
260
- $key?: string | number | undefined;
261
253
  }
262
254
  interface ExplicitProperties {}
263
255
  type PropAttributes = {
@@ -0,0 +1 @@
1
+ export default function reconcileArrays(parentNode: Node, a: Node[], b: Node[], marker?: Node | null): void;
@@ -0,0 +1,4 @@
1
+ export declare function effect<T>(fn: (prev?: T) => T, effectFn: (value: T, prev?: T) => void, options?: {
2
+ scope?: boolean;
3
+ }): void;
4
+ export declare function memo<T>(fn: () => T): () => T;