@solidjs/web 2.0.0-rc.7 → 2.0.0-rc.8

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 (72) hide show
  1. package/dist/server.dev.js +15 -2
  2. package/dist/server.js +15 -2
  3. package/dist/web.dev.js +41 -9
  4. package/dist/web.js +39 -8
  5. package/dist/{web.cjs → web.observe.js} +137 -239
  6. package/frames/dist/server.dev.js +19 -0
  7. package/frames/dist/server.js +19 -0
  8. package/frames/package.json +6 -24
  9. package/package.json +81 -314
  10. package/serialization/decode/package.json +3 -9
  11. package/serialization/package.json +3 -9
  12. package/serialization/types/serializer-decode.d.ts +49 -2
  13. package/server-functions/dist/server.dev.js +28 -10
  14. package/server-functions/dist/server.js +28 -10
  15. package/server-functions/package.json +6 -24
  16. package/server-functions/rich-args/package.json +3 -9
  17. package/storage/package.json +3 -9
  18. package/types/client.d.ts +17 -0
  19. package/types/frames/serializer-decode.d.ts +49 -2
  20. package/types/serializer-decode.d.ts +49 -2
  21. package/types/server-functions/server.d.ts +27 -4
  22. package/types/server.d.ts +1 -1
  23. package/dist/server.cjs +0 -3708
  24. package/dist/server.dev.cjs +0 -3794
  25. package/dist/web.dev.cjs +0 -2285
  26. package/frames/dist/client.cjs +0 -2043
  27. package/frames/dist/client.dev.cjs +0 -2063
  28. package/frames/dist/server.cjs +0 -4542
  29. package/frames/dist/server.dev.cjs +0 -4584
  30. package/serialization/dist/decode.cjs +0 -155
  31. package/serialization/dist/serialization.cjs +0 -275
  32. package/serialization/types-cjs/index.d.cts +0 -101
  33. package/serialization/types-cjs/package.json +0 -3
  34. package/serialization/types-cjs/serializer-decode.d.cts +0 -172
  35. package/serialization/types-cjs/serializer.d.cts +0 -101
  36. package/server-functions/dist/client.cjs +0 -1069
  37. package/server-functions/dist/rich-args.cjs +0 -11
  38. package/server-functions/dist/server.cjs +0 -2381
  39. package/server-functions/dist/server.dev.cjs +0 -2409
  40. package/storage/dist/storage.cjs +0 -12
  41. package/storage/types-cjs/index.d.cts +0 -28
  42. package/storage/types-cjs/package.json +0 -3
  43. package/types-cjs/client.d.cts +0 -197
  44. package/types-cjs/constants.d.cts +0 -20
  45. package/types-cjs/cookies.d.cts +0 -41
  46. package/types-cjs/frames/client.d.cts +0 -36
  47. package/types-cjs/frames/frame-client.d.cts +0 -370
  48. package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
  49. package/types-cjs/frames/frame-sink.d.cts +0 -92
  50. package/types-cjs/frames/frame-transport.d.cts +0 -189
  51. package/types-cjs/frames/serializer-decode.d.cts +0 -172
  52. package/types-cjs/frames/serializer.d.cts +0 -101
  53. package/types-cjs/frames/server.d.cts +0 -52
  54. package/types-cjs/head.d.cts +0 -19
  55. package/types-cjs/index.d.cts +0 -191
  56. package/types-cjs/index.server.d.cts +0 -147
  57. package/types-cjs/jsx-properties.d.cts +0 -93
  58. package/types-cjs/jsx.d.cts +0 -4146
  59. package/types-cjs/package.json +0 -3
  60. package/types-cjs/reconcile.d.cts +0 -1
  61. package/types-cjs/render.d.cts +0 -6
  62. package/types-cjs/response.d.cts +0 -81
  63. package/types-cjs/serializer-decode.d.cts +0 -172
  64. package/types-cjs/serializer.d.cts +0 -101
  65. package/types-cjs/server-functions/client.d.cts +0 -184
  66. package/types-cjs/server-functions/flash.d.cts +0 -36
  67. package/types-cjs/server-functions/registry.d.cts +0 -100
  68. package/types-cjs/server-functions/rich-args.d.cts +0 -1
  69. package/types-cjs/server-functions/server.d.cts +0 -546
  70. package/types-cjs/server-functions/shared.d.cts +0 -283
  71. package/types-cjs/server-mock.d.cts +0 -337
  72. package/types-cjs/server.d.cts +0 -408
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var node_async_hooks = require('node:async_hooks');
4
- var web = require('@solidjs/web');
5
-
6
- function provideRequestEvent(init, cb) {
7
- if (!web.isServer) throw new Error("Attempting to use server context in non-server build");
8
- const ctx = globalThis[web.RequestContext] = globalThis[web.RequestContext] || new node_async_hooks.AsyncLocalStorage();
9
- return ctx.run(init, cb);
10
- }
11
-
12
- exports.provideRequestEvent = provideRequestEvent;
@@ -1,28 +0,0 @@
1
- import type { RequestEvent } from "@solidjs/web";
2
- /**
3
- * Establishes the request-event scope for a server request: everything
4
- * `cb` runs (across `await`s, via AsyncLocalStorage) sees `init` from
5
- * `getRequestEvent()`. Call it at the top of the server's request handling,
6
- * wrapping SSR and server-function dispatch; the server-functions runtime
7
- * also picks the scope up automatically as its default event provider.
8
- *
9
- * Lives on its own subpath because it imports `node:async_hooks` — keep it
10
- * out of environments without that module.
11
- *
12
- * @example
13
- * ```ts
14
- * import { provideRequestEvent } from "@solidjs/web/storage";
15
- *
16
- * async function handler(request: Request) {
17
- * return provideRequestEvent({ request, locals: {} }, () =>
18
- * renderToStream(() => <App />)
19
- * );
20
- * }
21
- * ```
22
- *
23
- * @param init the event for this request — frameworks pass their richer
24
- * event shapes
25
- * @param cb runs synchronously; its return value is passed through
26
- * @throws on the client, where there is no request to scope
27
- */
28
- export declare function provideRequestEvent<T extends RequestEvent, U>(init: T, cb: () => U): U;
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,197 +0,0 @@
1
- import { getOwner, createComponent, untrack, merge as mergeProps } from "solid-js";
2
- import { effect, memo } from "./render.cjs";
3
- import { JSX } from "./jsx.cjs";
4
- import type { RequestEventLocals } from "./server.cjs";
5
- type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
6
- /**
7
- * A head tag descriptor. Props values may be getters (reactive on the
8
- * client); `children` is the text body. `key` overrides the built-in dedupe
9
- * identity (`title` is a hard singleton that `key` cannot fork).
10
- *
11
- * Getters must be plain reads: they evaluate inside registry-owned
12
- * computations here and at flush time on the server, so a getter that
13
- * allocates a reactive owner (`createMemo`, a `children()` helper) consumes
14
- * a hydration id slot on one side only and desyncs every id allocated after
15
- * the `useHead` call. Create such helpers eagerly at component position and
16
- * read them from the getter. See docs/head-management-rfc.md.
17
- */
18
- export type HeadTag = {
19
- tag: "title" | "meta" | "link" | "style" | "script" | "base";
20
- props: Record<string, any>;
21
- key?: string | (() => string);
22
- };
23
- export type AssetDescriptor = {
24
- type: "style";
25
- href: string;
26
- attrs?: Record<string, string>;
27
- } | {
28
- type: "inline-style";
29
- id: string;
30
- content?: string;
31
- attrs?: Record<string, string>;
32
- } | {
33
- type: "module";
34
- href: string;
35
- } | ExclusiveAssetDescriptor<any>;
36
- export interface ExclusiveAssetDescriptor<T> {
37
- policy: "exclusive";
38
- key: string;
39
- value: T;
40
- get(): T;
41
- set(value: T): void;
42
- }
43
- /**
44
- * Registry entry returned by `warmAsset`. Stylesheet entries carry load
45
- * tracking for the client reveal gate (docs/client-css-reveal-gating.md):
46
- * `loadPromise` resolves on load OR error (never rejects) — an errored
47
- * sheet releases the gate, parity with the server gate.
48
- */
49
- export interface AssetEntry {
50
- loadState?: "pending" | "loaded" | "errored";
51
- loadPromise?: Promise<void>;
52
- }
53
- /**
54
- * See the server entry's `ResponseStub` — the shape of the mutable response
55
- * head integrations expose as `event.response` via module augmentation.
56
- */
57
- export interface ResponseStub {
58
- status?: number;
59
- statusText?: string;
60
- headers: Headers;
61
- /**
62
- * Set by the integration once the response head has been derived/sent
63
- * from this stub (status/headers can no longer change); consumers must
64
- * treat later writes and cleanup-time retractions as no-ops.
65
- */
66
- committed?: boolean;
67
- }
68
- /**
69
- * See the server entry's `RequestEventLocals` — the augmentable type of
70
- * `RequestEvent.locals`. Re-exported (not re-declared) so both entries
71
- * share ONE interface identity and a single augmentation reaches every
72
- * `locals`, whichever entry typed the event.
73
- */
74
- export { RequestEventLocals } from "./server.cjs";
75
- export interface RequestEvent {
76
- request: Request;
77
- locals: RequestEventLocals;
78
- }
79
- export type { CookieOptions } from "./cookies.cjs";
80
- export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./server-functions/shared.cjs";
81
- export declare const waitAsset: (promise: Promise<unknown>) => void;
82
- export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.cjs";
83
- /** Client stub — hydration bootstrap is a server-only emit. */
84
- export declare function generateHydrationScript(_options?: {
85
- eventNames?: string[];
86
- nonce?: string;
87
- }): string;
88
- /** Client stub — valid JSX component, renders nothing. */
89
- export declare function HydrationScript(_props?: {
90
- nonce?: string;
91
- eventNames?: string[];
92
- }): null;
93
- export { effect, memo, untrack, getOwner, createComponent };
94
- /**
95
- * Compiler-emitted prop-spread helper. The JSX transform emits
96
- * `mergeProps(...)` when compiling prop spreads on components — not a
97
- * user-facing API. Application code should import `merge` from `solid-js`.
98
- * @internal
99
- */
100
- export { mergeProps };
101
- export declare const getRequestEvent: () => RequestEvent | undefined;
102
- export { parseCookieHeader, serializeCookie } from "./cookies.cjs";
103
- export { clearFlashCookie, hasFlashCookie } from "./cookies.cjs";
104
- export { getServerFunctionMetadata, getServerFunctionRPC, isServerFunction } from "./server-functions/registry.cjs";
105
- /**
106
- * Renders a component tree into a DOM element. Returns a dispose function
107
- * that tears the tree down and cleans up reactive scopes when called.
108
- *
109
- * The top-level insert is queued via `{ schedule: true }` so its initial
110
- * DOM attach goes through the effect queue rather than executing inline.
111
- * This lets the mount participate in transitions: if an uncaught async
112
- * read surfaces during the initial render (no `Loading` ancestor absorbs
113
- * it), the mount is held by the transition and attaches atomically once
114
- * all pending settles. On the no-async happy path the tail `flush()`
115
- * drains the queued callback so the attach is synchronous by the time
116
- * `render()` returns. The dev enforcement window scopes
117
- * `ASYNC_OUTSIDE_LOADING_BOUNDARY` to the initial mount only.
118
- */
119
- export declare function render(code: () => JSX.Element, element: MountableElement, init?: JSX.Element, options?: {
120
- owner?: unknown;
121
- renderId?: string;
122
- }): () => void;
123
- export declare function template(html: string, flag?: 1 | 2): () => Element;
124
- export declare function delegateEvents(eventNames: string[]): void;
125
- export declare function registerDelegatedRoot(root: MountableElement): void;
126
- export declare function unregisterDelegatedRoot(root: MountableElement): void;
127
- export declare function registerDelegatedContainer(container: MountableElement, owner?: MountableElement): void;
128
- export declare function unregisterDelegatedContainer(container: MountableElement, owner?: MountableElement): void;
129
- export declare function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
130
- export declare function setProperty(node: Element, name: string, value: any): void;
131
- export declare function registerElementClaim(handler: (element: Element) => void): () => void;
132
- export declare function claimElementTree<T extends Node>(root: T): T;
133
- export declare function claimElement<T extends Element>(node: T): T;
134
- export declare function setAttribute(node: Element, name: string, value: string): void;
135
- export declare function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
136
- export declare function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
137
- export declare function addEvent(node: Element, name: string, handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions), delegate: boolean): EventListener | EventListenerObject | void;
138
- export declare function style(node: Element, value: {
139
- [k: string]: string;
140
- }, prev?: {
141
- [k: string]: string;
142
- }): void;
143
- export declare function setStyleProperty(node: Element, name: string, value: any): void;
144
- export declare function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
145
- export declare function dynamicProperty(props: unknown, key: string): unknown;
146
- export declare function applyRef<T extends Element = Element>(r: ((element: NoInfer<T>) => void) | ((element: NoInfer<T>) => void)[], element: T): void;
147
- export declare function ref(fn: () => ((element: Element) => void) | ((element: Element) => void)[], element: Element): void;
148
- /** Compiler-emitted primitive; not for hand-written code. @internal */
149
- export declare function scope<T extends () => any>(fn: T): T;
150
- export declare function installHydrationRuntime(): void;
151
- /**
152
- * Compiler-emitted primitive; not for hand-written code.
153
- * @internal
154
- */
155
- export declare function insert<T>(parent: MountableElement, accessor: (() => T) | T, marker?: Node | null, init?: JSX.Element, options?: {
156
- /**
157
- * Live accessor for the slot's logical host in the source tree (portals).
158
- * Each top-level node the slot manages is tagged with a `_$host` getter
159
- * backed by this accessor so delegated events retarget correctly.
160
- */
161
- host?: () => Node | null;
162
- /** Defer the insert effect to the queue instead of running it inline. */
163
- schedule?: boolean;
164
- }): JSX.Element;
165
- export declare function assign(node: Element, props: any, skipChildren?: Boolean, prevProps?: any, skipRef?: Boolean): void;
166
- export declare function warmAsset(descriptor: AssetDescriptor): AssetEntry | undefined;
167
- export declare function acquireAsset(descriptor: AssetDescriptor): () => void;
168
- export declare function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | HeadTag[])): void;
169
- /**
170
- * Resumes a server-rendered tree on the client, attaching event listeners
171
- * and reactive bindings without reconstructing the DOM. Returns a `dispose`
172
- * function that tears down reactive scopes (DOM nodes are left in place).
173
- *
174
- * Use this when the page HTML was produced by `renderToString` or
175
- * `renderToStream`. For client-only apps, use `render` instead.
176
- *
177
- * Pass `options.renderId` to hydrate one of multiple roots emitted by a
178
- * server render that used the same id.
179
- *
180
- * When the server renders a full document but the client hydrates only the
181
- * app subtree, the server must give that subtree its own id namespace: wrap
182
- * the document shell in `<NoHydration>` and re-enter with `<Hydration>`
183
- * around the app. Otherwise the app's hydration ids are allocated under the
184
- * document component's owner tree and this walk can never claim them.
185
- */
186
- export declare function hydrate(fn: () => JSX.Element, node: MountableElement, options?: {
187
- renderId?: string;
188
- owner?: unknown;
189
- }): () => void;
190
- export declare function getNextElement(template?: () => Element): Element;
191
- export declare function getNextMatch(start: Node, elementName: string): Element;
192
- export declare function getNextMarker(start: Node): [Node, Array<Node>];
193
- export declare function getFirstChild(node: any, expectedTag: any): any;
194
- export declare function getNextSibling(node: any, expectedTag: any): any;
195
- export declare function runHydrationEvents(): void;
196
- export declare function getHydrationKey(): string | undefined;
197
- export declare const RequestContext: unique symbol;
@@ -1,20 +0,0 @@
1
- /**
2
- * Flags
3
- *
4
- * - 1 - Stateful property - value derives from reactive state
5
- * - 2 - Locked to property - value not specially treated
6
- */
7
- declare const DOMWithState: Record<string, Record<string, 1 | 2>>;
8
- declare const ChildProperties: Set<string>;
9
- declare const $$SLOT: unique symbol;
10
- declare const $$HOST: unique symbol;
11
- declare const DelegatedEvents: Set<string>;
12
- declare const SVGElements: Set<string>;
13
- declare const MathMLElements: Set<string>;
14
- declare const Namespaces: Record<string, string>;
15
- declare const VoidElements: Set<string>;
16
- declare const RawTextElements: Set<string>;
17
- declare const DOMElements: Set<string>;
18
- declare const COMPOSED_BODY_FRAMING: ReadonlySet<string>;
19
- declare function isHttpNavigationTarget(target: string): boolean;
20
- export { DOMWithState, ChildProperties, DelegatedEvents, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DOMElements, $$SLOT, $$HOST, COMPOSED_BODY_FRAMING, isHttpNavigationTarget };
@@ -1,41 +0,0 @@
1
- export interface CookieOptions {
2
- /** Cookie `Path` attribute. Defaults to `/`. */
3
- path?: string;
4
- /** Cookie `Domain` attribute. Emitted only when provided. */
5
- domain?: string;
6
- /** Cookie `Max-Age` attribute, in seconds (truncated to an integer). */
7
- maxAge?: number;
8
- /** Cookie `Expires` attribute. */
9
- expires?: Date;
10
- /** Emit the `HttpOnly` attribute. */
11
- httpOnly?: boolean;
12
- /** Emit the `Secure` attribute. */
13
- secure?: boolean;
14
- /** Cookie `SameSite` attribute, any case. */
15
- sameSite?: "lax" | "strict" | "none" | "Lax" | "Strict" | "None";
16
- /**
17
- * Emit the `Partitioned` attribute (CHIPS): a third-party cookie keyed to
18
- * the top-level site it was set under — the only third-party cookie that
19
- * keeps working as browsers finish removing the rest. Requires `secure`.
20
- */
21
- partitioned?: boolean;
22
- }
23
- /**
24
- * Parses a `Cookie` request header into a name → value map. Names and
25
- * values are `decodeURIComponent`-decoded (falling back to the raw text
26
- * when decoding throws — cookies set by other producers are not
27
- * necessarily percent-encoded); a quoted value keeps its content, per the
28
- * RFC 6265 grammar. `null`/empty input parses to an empty map.
29
- *
30
- * The read half of the platform gap — the blessed request-cookie read is
31
- * `parseCookieHeader(event.request.headers.get("cookie"))`.
32
- */
33
- export declare function parseCookieHeader(header: string | null | undefined): Record<string, string>;
34
- export declare function serializeCookie(name: string, value: string, options?: CookieOptions): string;
35
- export declare const FLASH_COOKIE = "flash";
36
- /** Whether a Cookie header carries a flash cookie (readable or not). */
37
- export declare function hasFlashCookie(cookieHeader: string | null): boolean;
38
- /** The raw encoded flash payload out of a Cookie header, if present. */
39
- export declare function matchFlashCookie(cookieHeader: string | null): string | undefined;
40
- /** The Set-Cookie value clearing the flash cookie after it has been read. */
41
- export declare function clearFlashCookie(): string;
@@ -1,36 +0,0 @@
1
- export { createFrame, createFrameHost, createFrameElement, FRAME_APPLIED_EVENT } from "./frame-client.cjs";
2
- export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.cjs";
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
- */
18
- export declare function getFrameHost(): any;
19
- /**
20
- * Installs the server-component transport policy on the server-function
21
- * client — the identity split (DR-1): CONTENT is keyed by the call's
22
- * intrinsic (function, arguments) address — per-args, exactly like the
23
- * query cache, so a cached resolution always names the content it was
24
- * cached for — while the MOUNT belongs to the call site. Every call of a
25
- * function resolves a binding wrapping the same per-function component
26
- * (the document placeholder), so `dynamic` keeps its instance across both
27
- * refetches AND argument changes; the instance follows delivered addresses
28
- * by re-binding its frame's pull, and a preload for unshown args only ever
29
- * warms that address's resident store.
30
- *
31
- * Call once in the client entry (an explicit call — the package is
32
- * `sideEffects: false`, so a bare import would be tree-shaken away);
33
- * call again to rebind to a custom host.
34
- * @experimental
35
- */
36
- export declare function installServerComponents(host?: any): void;