@solidjs/web 2.0.0-rc.6 → 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 (82) hide show
  1. package/dist/{server.cjs → server.dev.js} +274 -272
  2. package/dist/server.js +119 -36
  3. package/dist/{dev.js → web.dev.js} +131 -399
  4. package/dist/web.js +78 -388
  5. package/dist/{web.cjs → web.observe.js} +174 -622
  6. package/frames/dist/client.dev.js +11 -3
  7. package/frames/dist/client.js +11 -3
  8. package/frames/dist/{server.cjs → server.dev.js} +375 -125
  9. package/frames/dist/server.js +253 -32
  10. package/frames/package.json +7 -15
  11. package/package.json +88 -251
  12. package/serialization/decode/package.json +3 -9
  13. package/serialization/dist/decode.js +18 -4
  14. package/serialization/dist/serialization.js +18 -4
  15. package/serialization/package.json +3 -9
  16. package/serialization/types/serializer-decode.d.ts +49 -2
  17. package/server-functions/dist/client.js +13 -14
  18. package/server-functions/dist/server.dev.js +359 -85
  19. package/server-functions/dist/server.js +352 -86
  20. package/server-functions/package.json +6 -24
  21. package/server-functions/rich-args/package.json +3 -9
  22. package/storage/package.json +3 -9
  23. package/types/client.d.ts +17 -3
  24. package/types/frames/frame-client.d.ts +1 -1
  25. package/types/frames/serializer-decode.d.ts +49 -2
  26. package/types/head.d.ts +3 -0
  27. package/types/index.d.ts +18 -7
  28. package/types/index.server.d.ts +31 -9
  29. package/types/render.d.ts +3 -1
  30. package/types/serializer-decode.d.ts +49 -2
  31. package/types/server-functions/flash.d.ts +12 -3
  32. package/types/server-functions/server.d.ts +50 -3
  33. package/types/server-mock.d.ts +43 -7
  34. package/types/server.d.ts +48 -6
  35. package/dist/dev.cjs +0 -2590
  36. package/frames/dist/client.cjs +0 -2035
  37. package/frames/dist/client.dev.cjs +0 -2055
  38. package/serialization/dist/decode.cjs +0 -141
  39. package/serialization/dist/serialization.cjs +0 -261
  40. package/serialization/types-cjs/index.d.cts +0 -101
  41. package/serialization/types-cjs/package.json +0 -3
  42. package/serialization/types-cjs/serializer-decode.d.cts +0 -172
  43. package/serialization/types-cjs/serializer.d.cts +0 -101
  44. package/server-functions/dist/client.cjs +0 -1070
  45. package/server-functions/dist/rich-args.cjs +0 -11
  46. package/server-functions/dist/server.cjs +0 -2133
  47. package/server-functions/dist/server.dev.cjs +0 -2153
  48. package/storage/dist/storage.cjs +0 -12
  49. package/storage/types-cjs/index.d.cts +0 -28
  50. package/storage/types-cjs/package.json +0 -3
  51. package/types/patch-driver.d.ts +0 -3
  52. package/types-cjs/client.d.cts +0 -200
  53. package/types-cjs/constants.d.cts +0 -20
  54. package/types-cjs/cookies.d.cts +0 -41
  55. package/types-cjs/frames/client.d.cts +0 -36
  56. package/types-cjs/frames/frame-client.d.cts +0 -370
  57. package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
  58. package/types-cjs/frames/frame-sink.d.cts +0 -92
  59. package/types-cjs/frames/frame-transport.d.cts +0 -189
  60. package/types-cjs/frames/serializer-decode.d.cts +0 -172
  61. package/types-cjs/frames/serializer.d.cts +0 -101
  62. package/types-cjs/frames/server.d.cts +0 -52
  63. package/types-cjs/head.d.cts +0 -16
  64. package/types-cjs/index.d.cts +0 -180
  65. package/types-cjs/index.server.d.cts +0 -125
  66. package/types-cjs/jsx-properties.d.cts +0 -93
  67. package/types-cjs/jsx.d.cts +0 -4146
  68. package/types-cjs/package.json +0 -3
  69. package/types-cjs/patch-driver.d.cts +0 -3
  70. package/types-cjs/reconcile.d.cts +0 -1
  71. package/types-cjs/render.d.cts +0 -4
  72. package/types-cjs/response.d.cts +0 -81
  73. package/types-cjs/serializer-decode.d.cts +0 -172
  74. package/types-cjs/serializer.d.cts +0 -101
  75. package/types-cjs/server-functions/client.d.cts +0 -184
  76. package/types-cjs/server-functions/flash.d.cts +0 -27
  77. package/types-cjs/server-functions/registry.d.cts +0 -100
  78. package/types-cjs/server-functions/rich-args.d.cts +0 -1
  79. package/types-cjs/server-functions/server.d.cts +0 -522
  80. package/types-cjs/server-functions/shared.d.cts +0 -283
  81. package/types-cjs/server-mock.d.cts +0 -301
  82. package/types-cjs/server.d.cts +0 -366
@@ -1,366 +0,0 @@
1
- import { sharedConfig, getOwner, createComponent, untrack, merge as mergeProps, ssrScope as scope } from "solid-js";
2
- import { effect, memo } from "./render.cjs";
3
- export { parseCookieHeader, serializeCookie } from "./cookies.cjs";
4
- export { clearFlashCookie, hasFlashCookie } from "./cookies.cjs";
5
- export { getServerFunctionMetadata, getServerFunctionRPC, isServerFunction } from "./server-functions/registry.cjs";
6
- import { JSX } from "./jsx.cjs";
7
- import { SerializerPlugin } from "./serializer-decode.cjs";
8
- /** An explicit `<link rel="preload">` emitted by the SSR asset pipeline. */
9
- export type PreloadLink = {
10
- href: string;
11
- as: JSX.HTMLPreloadAs;
12
- type?: string;
13
- crossorigin?: JSX.HTMLCrossorigin;
14
- integrity?: string;
15
- referrerpolicy?: JSX.HTMLReferrerPolicy;
16
- fetchpriority?: JSX.HTMLFetchPriority;
17
- media?: string;
18
- };
19
- /** Static asset manifest produced by a build (e.g. parsed Vite manifest.json). */
20
- export type AssetManifest = Record<string, {
21
- file: string;
22
- css?: string[];
23
- isEntry?: boolean;
24
- imports?: string[];
25
- preloads?: PreloadLink[];
26
- }> & {
27
- _base?: string;
28
- };
29
- /** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
30
- export type InlineStyleAsset = {
31
- id: string;
32
- content: string;
33
- attrs?: Record<string, string>;
34
- };
35
- export type ResolvedAssets = {
36
- js: string[];
37
- css: (string | InlineStyleAsset)[];
38
- preloads?: PreloadLink[];
39
- };
40
- /**
41
- * Resolver form of the manifest option — the primitive a dev server
42
- * implements against its live module graph (a static manifest object is
43
- * normalized into a sync resolver internally). `resolve` may return a
44
- * promise (async resolvers require streaming rendering); CSS entries may be
45
- * URL strings (emitted as load-gated `<link>` tags) or inline-style
46
- * descriptors (emitted as `<style>` tags), and `preloads` carries explicit
47
- * preload links selected by the integration. A bare `resolve`-shaped
48
- * function is accepted as shorthand for `{ resolve }`.
49
- */
50
- export type AssetResolver = {
51
- resolve(key: string): ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
52
- /**
53
- * Synchronous fast path answering with whatever is knowable without async
54
- * work (typically js URLs, omitting css). Sync consumers — e.g. a lazy
55
- * component's `moduleUrl` getter used by islands — use this when `resolve`
56
- * would return a promise, so adapters should provide it whenever possible.
57
- */
58
- resolveSync?(key: string): ResolvedAssets | null | undefined;
59
- };
60
- /** Bare-function shorthand for `AssetResolver` (no sync fast path). */
61
- export type AssetResolverFn = (key: string) => ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
62
- /**
63
- * CSP nonce for the tags a server render emits. A string applies to both
64
- * nonce-aware destinations. A `{ script, style }` pair routes each tag to
65
- * the directive governing its fetch (`script-src-elem` / `style-src-elem`,
66
- * falling back to `script-src` / `style-src` then `default-src`). Both
67
- * keys are required; `false` leaves that destination un-nonced. Worker
68
- * destinations take the script nonce, which only applies when their own
69
- * fallback reaches `script-src`. A nonce on a `useHead` tag's own props
70
- * always wins.
71
- *
72
- * Only `renderToString` / `renderToStream` take this shape. Surfaces that
73
- * emit one script (`HydrationScript`, `generateHydrationScript`,
74
- * `createSSRResponse`) take a string — project with `scriptNonce`.
75
- */
76
- export type CSPNonce = string | {
77
- script: string | false;
78
- style: string | false;
79
- };
80
- /**
81
- * A head tag descriptor. Props values may be getters (evaluated lazily on
82
- * the server — at the owning flush boundary — and reactively on the client);
83
- * `children` is the text body (title text, inline style/script content).
84
- * `key` overrides the built-in dedupe identity (`title` is a hard singleton
85
- * that `key` cannot fork).
86
- *
87
- * Getters must be plain reads: they evaluate at flush time here (under no
88
- * component owner) and inside registry-owned computations on the client, so
89
- * a getter that allocates a reactive owner (`createMemo`, a `children()`
90
- * helper) consumes a hydration id slot on one side only and desyncs every
91
- * id allocated after the `useHead` call. Create such helpers eagerly at
92
- * component position and read them from the getter. See
93
- * docs/head-management-rfc.md.
94
- */
95
- export type HeadTag = {
96
- tag: "title" | "meta" | "link" | "style" | "script" | "base";
97
- props: Record<string, any>;
98
- key?: string | (() => string);
99
- };
100
- /**
101
- * The mutable response head an integration's handler exposes on the request
102
- * event as `event.response`: status/statusText/headers it will apply when
103
- * sending the response. A scaffold, not a `Response` — application code
104
- * (e.g. JSX response components) writes to it during render, and the
105
- * handler reads it when the head goes out. Core does not declare the
106
- * `response` property on `RequestEvent` itself: integrations that provide
107
- * one declare it through module augmentation (as `@solidjs/router` does),
108
- * and this type names the shape they agree on. Core's server-function
109
- * handler folds it onto the outgoing response when present — its
110
- * `Set-Cookie` values (cookies appended during the call via
111
- * `serializeCookie`) append cookie-by-cookie, other headers fill gaps —
112
- * and reads it when folding single-flight cookies, but never requires it.
113
- */
114
- export interface ResponseStub {
115
- status?: number;
116
- statusText?: string;
117
- headers: Headers;
118
- /**
119
- * Set once the response head has been derived/sent from this stub —
120
- * status and headers can no longer change. Flip it through
121
- * `commitResponseStub`, which also instruments the stub's `headers` so
122
- * a post-commit write fails loudly (dev build throws, production
123
- * reports + no-ops) instead of silently missing the wire. `status`/
124
- * `statusText` stay plain fields: consumers that write response
125
- * metadata during render (e.g. JSX response components) must still
126
- * treat later status writes and cleanup-time retractions as no-ops.
127
- */
128
- committed?: boolean;
129
- }
130
- /**
131
- * The type of `RequestEvent.locals` — a module-augmentable interface so
132
- * applications can type the state their middleware hangs on the event.
133
- * Augment it through the package that re-exports the event (interface
134
- * identity flows through the re-export chain):
135
- *
136
- * ```ts
137
- * declare module "@solidjs/web" {
138
- * interface RequestEventLocals {
139
- * user: User;
140
- * }
141
- * }
142
- * ```
143
- *
144
- * The index signature keeps un-augmented usage permissive — `locals` is a
145
- * free-form bag by default — so augmentation adds precision for the keys
146
- * it names without gating existing code. The flip side: unaugmented keys
147
- * read as `any` rather than erroring, a deliberate trade (a strict-only
148
- * `locals` would break every untyped write that works today).
149
- */
150
- export interface RequestEventLocals {
151
- [key: string | number | symbol]: any;
152
- }
153
- /**
154
- * The per-request context available on the server: the incoming `Request`
155
- * and a `locals` bag integrations and middleware can hang state on (typed
156
- * through the augmentable `RequestEventLocals`). Frameworks typically
157
- * extend this shape with richer fields (e.g. a `response` head — see
158
- * `ResponseStub`).
159
- */
160
- export interface RequestEvent {
161
- request: Request;
162
- locals: RequestEventLocals;
163
- }
164
- export type { CookieOptions } from "./cookies.cjs";
165
- export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./server-functions/shared.cjs";
166
- export interface SSRResponseOptions {
167
- /** Base head; the stub's status/headers win over it. */
168
- responseInit?: ResponseInit;
169
- /** Nonce carried by the post-flush `<script>` redirect fallback. */
170
- nonce?: string;
171
- /** Rewrites each outgoing HTML chunk (entry script injection, ...). */
172
- transformChunk?: (chunk: string) => string;
173
- }
174
- /**
175
- * Fetch-style middleware: return a `Response` to answer the request, or
176
- * call `next()` (optionally with a substitute `Request`) to advance the
177
- * chain and observe/replace the eventual response.
178
- */
179
- export type FetchMiddleware = (request: Request, next: (request?: Request) => Promise<Response>) => Response | Promise<Response>;
180
- export { createComponent, effect, memo, untrack, mergeProps, scope, getOwner };
181
- export { sharedConfig };
182
- export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.cjs";
183
- export declare function scriptNonce(nonce?: CSPNonce): string | undefined;
184
- export declare function styleNonce(nonce?: CSPNonce): string | undefined;
185
- export declare function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | HeadTag[])): void;
186
- export declare function renderToString<T>(fn: () => T, options?: {
187
- nonce?: CSPNonce;
188
- renderId?: string;
189
- noScripts?: boolean;
190
- plugins?: SerializerPlugin[];
191
- manifest?: AssetManifest | AssetResolver | AssetResolverFn;
192
- onError?: (err: any) => void;
193
- /**
194
- * Embedded-render contract for hosts that own the document. When the
195
- * render output contains no `</head>`, everything head-bound (resolved
196
- * `useHead` winners, eager resources, tracked asset links, inline
197
- * styles) is delivered here as one HTML string — prelude (charset/base)
198
- * first — for the host to splice into its own `<head>` template, instead
199
- * of being dropped. Called synchronously before `renderToString`
200
- * returns; not called when the output has a `</head>` (splicing is
201
- * automatic then).
202
- */
203
- onHead?: (head: string) => void;
204
- }): string;
205
- export declare function renderToStream<T>(fn: () => T, options?: {
206
- nonce?: CSPNonce;
207
- renderId?: string;
208
- noScripts?: boolean;
209
- plugins?: SerializerPlugin[];
210
- manifest?: AssetManifest | AssetResolver | AssetResolverFn;
211
- onCompleteShell?: (info: {
212
- write: (v: string) => void;
213
- }) => void;
214
- onCompleteAll?: (info: {
215
- write: (v: string) => void;
216
- }) => void;
217
- onError?: (err: any) => void;
218
- /**
219
- * Embedded-render contract for hosts that own the document. When the
220
- * shell contains no `</head>`, everything head-bound at first flush
221
- * (resolved `useHead` winners, eager resources, tracked asset links,
222
- * inline styles) is delivered here as one HTML string — prelude first —
223
- * before the shell chunk is emitted, so the host can write its own
224
- * `<head>` ahead of piping the stream. Post-shell head updates flow
225
- * through the stream itself and apply in the browser. Not called when
226
- * the shell has a `</head>` (splicing is automatic then).
227
- */
228
- onHead?: (head: string) => void;
229
- }): {
230
- /**
231
- * Awaiting the stream resolves with the complete HTML once every boundary
232
- * settles — the fully-settled-string form of the render (`const html =
233
- * await renderToStream(...)`). Render errors route through `onError` and
234
- * the promise resolves with whatever HTML the render produced; it never
235
- * rejects.
236
- */
237
- then<TResult1 = string, TResult2 = never>(onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
238
- pipe: (writable: {
239
- write: (v: string) => void;
240
- end: () => void;
241
- }) => void;
242
- pipeTo: (writable: WritableStream) => Promise<void>;
243
- /**
244
- * Lazy `ReadableStream<Uint8Array>` view of the render — hand it straight
245
- * to `new Response(stream.readable)`. First access starts the render
246
- * piping through an internal `TransformStream` (chunks are UTF-8 encoded
247
- * bytes, the same as `pipeTo` writes) and the stream is cached, so
248
- * repeated access returns the same instance. Like `pipe`/`pipeTo`, this
249
- * consumes the render: use exactly one of the three — mixing distinct
250
- * consumers (`readable` after `pipe`/`pipeTo`, or vice versa) throws an
251
- * error naming the conflict.
252
- */
253
- readonly readable: ReadableStream<Uint8Array>;
254
- };
255
- export declare function HydrationScript(props: {
256
- nonce?: string;
257
- eventNames?: string[];
258
- }): JSX.Element;
259
- export declare function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
260
- /**
261
- * The live-hole engine for one frame response. Constructed by the frame
262
- * renderer (frame-sink) and published on the render context; `ssr()` and
263
- * `resolveSSRNode` route content holes through `content()` while it is
264
- * present. Bindings live in the sink's DR-2 ledger — same commit-driven
265
- * sweeps, same equality gating, same end-of-response latch as watched slot
266
- * args.
267
- *
268
- * Every state transition is commit-driven: the engine never chains its own
269
- * promises, so it cannot amplify commits or starve the event loop — a
270
- * pending re-evaluation simply waits for the next commit (async settles
271
- * commit through the render core, and the response's end-latch sweep is
272
- * always the last one).
273
- */
274
- export declare function createLiveHoles(sink: any, scoped: any): {
275
- suppressed: number;
276
- sweeping: boolean;
277
- parent: any;
278
- recordStamp: number;
279
- gateHit: boolean;
280
- /**
281
- * Intercept a thunk content hole: resolve it, and — when the evaluation
282
- * proves re-runnable — mint an id, wrap the output in its marker pair,
283
- * and open the ledger binding. Returns a string (sync resolve), a
284
- * marker-wrapped `{ t, h, p }` template (NotReady escalation — markers
285
- * ride the template so the retry's splice lands inside them), an
286
- * UNMARKED string/template (latched: slot positions, impure
287
- * evaluations), or null when interception is off for this evaluation.
288
- */
289
- content(hole: any): any;
290
- /** The shared id counter — `ssr()` mints an attr address at injection
291
- * time, before its capture completes. */
292
- mint(): number;
293
- /** Whether interception may arm at the current evaluation point —
294
- * `ssr()` asks before opening an attr capture (the `data-lha`
295
- * injection must not touch out-of-scope bytes; content holes are
296
- * gated inside `content()` itself). */
297
- active(): boolean;
298
- /**
299
- * Register an element's attr-hole capture (built by `ssr()`'s in-tag
300
- * scan): the tag's attribute area as alternating static strings and
301
- * re-runnable parts (`{ f }` thunks, `{ g, i }` group positions). Sweeps
302
- * rebuild the text, equality-gate against the baseline, and ship
303
- * changes as an element-keyed `attr` chunk. Names that vanish between
304
- * rebuilds ride an explicit `removed` list — the server holds the
305
- * previous text, so the client never tracks name history.
306
- */
307
- attr(cap: any): void;
308
- };
309
- export declare function ssr(template: string[] | string, ...nodes: any[]): {
310
- t: string;
311
- };
312
- export declare function ssrClassName(value: string | {
313
- [k: string]: boolean;
314
- } | Array<any>): string;
315
- export declare function ssrStyle(value: string | {
316
- [k: string]: string;
317
- }): string;
318
- export declare function ssrStyleProperty(name: string, value: any): string;
319
- export declare function ssrElement(name: string, props: any, children: any, needsId: boolean): {
320
- t: string;
321
- };
322
- export declare function ssrAttribute(key: string, value: any): string;
323
- export declare function ssrHydrationKey(): string;
324
- export declare const CLAIM_PROP: unique symbol;
325
- export declare const CLAIMS_STREAM = 1;
326
- export declare const CLAIMS_DOCUMENT = 2;
327
- export declare function ssrClaim(map: any): string;
328
- export declare function ssrSelectValues(): void;
329
- export declare function resolveSSRSelectValues(html: any): any;
330
- export declare function escape(s: any, attr?: boolean): any;
331
- export declare function getHydrationKey(): string | undefined;
332
- export declare function applyRef(r: ((element: any) => void) | ((element: any) => void)[], element: any): void;
333
- export declare function generateHydrationScript(options?: {
334
- nonce?: string;
335
- eventNames?: string[];
336
- }): string;
337
- export declare function resolveSSRNode(node: any, result?: any, top?: boolean): any;
338
- export declare const RequestContext: unique symbol; /**
339
- * The current request event, when called on the server inside a request
340
- * scope (established by `provideRequestEvent` from `@solidjs/web/storage`
341
- * or by the framework). Undefined on the client and outside a request.
342
- * Read it above `await` boundaries in partially-polyfilled environments.
343
- */
344
- export declare function getRequestEvent(): RequestEvent | undefined;
345
- export declare function createResponseStub(): ResponseStub;
346
- export declare function createRequestEvent<T extends object = {}>(request: Request, init?: T): RequestEvent & {
347
- response: ResponseStub;
348
- } & T;
349
- export declare function commitResponseStub(stub: ResponseStub, options?: {
350
- allowLateLocation?: boolean;
351
- }): ResponseStub;
352
- export declare function getExpectedRedirectStatus(response: ResponseStub): number;
353
- export declare function commitEventResponse(response: Response, event?: RequestEvent): Response;
354
- export declare function createSSRResponse(result: string, event: RequestEvent | undefined, options?: SSRResponseOptions): Response;
355
- export declare function createSSRResponse(result: {
356
- pipe(writable: {
357
- write: (v: string) => void;
358
- end: () => void;
359
- }): void;
360
- }, event: RequestEvent | undefined, options?: SSRResponseOptions): Promise<Response>;
361
- export declare function composeMiddleware(middlewares: FetchMiddleware[]): (request: Request, next: (request?: Request) => Response | Promise<Response>) => Promise<Response>;
362
- export declare function registerElementClaim(handler: (element: Element) => void): () => void;
363
- export declare function claimElement<T extends Element>(node: T): T;
364
- export declare function claimElementTree<T extends Node>(root: T): T;
365
- export { notSup as style, notSup as insert, notSup as spread, notSup as delegateEvents, notSup as registerDelegatedRoot, notSup as unregisterDelegatedRoot, notSup as registerDelegatedContainer, notSup as unregisterDelegatedContainer, notSup as getDelegatedRoot, notSup as dynamicProperty, notSup as setAttribute, notSup as setAttributeNS, notSup as addEvent, notSup as render, notSup as template, notSup as setProperty, notSup as className, notSup as assign, notSup as hydrate, notSup as getNextElement, notSup as getNextMatch, notSup as getNextMarker, notSup as runHydrationEvents, notSup as ref, notSup as setStyleProperty, notSup as acquireAsset };
366
- declare function notSup(): void;