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

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 (124) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +5065 -0
  3. package/dist/server.js +1757 -355
  4. package/dist/{server.cjs → server.observe.js} +1951 -558
  5. package/dist/{dev.cjs → web.dev.js} +945 -550
  6. package/dist/web.js +635 -332
  7. package/dist/{dev.js → web.observe.js} +688 -403
  8. package/frames/dist/assets.js +92 -0
  9. package/frames/dist/client.dev.js +1296 -1198
  10. package/frames/dist/client.js +1128 -1191
  11. package/frames/dist/client.observe.js +2041 -0
  12. package/frames/dist/regions.js +171 -0
  13. package/frames/dist/server.dev.js +2549 -0
  14. package/frames/dist/server.js +1688 -3005
  15. package/frames/dist/server.observe.js +2548 -0
  16. package/frames/dist/trace.js +45 -0
  17. package/frames/dist/wire.js +594 -0
  18. package/frames/package.json +2 -25
  19. package/package.json +244 -256
  20. package/performance-tracks/dist/performance-tracks.dev.js +679 -0
  21. package/performance-tracks/dist/performance-tracks.js +6 -0
  22. package/performance-tracks/dist/performance-tracks.observe.js +667 -0
  23. package/performance-tracks/package.json +7 -0
  24. package/performance-tracks/types/index.d.ts +69 -0
  25. package/serialization/decode/package.json +2 -15
  26. package/serialization/dist/decode.js +121 -25
  27. package/serialization/dist/serialization.js +242 -88
  28. package/serialization/package.json +2 -15
  29. package/serialization/types/index.d.ts +85 -158
  30. package/serialization/types/serializer-decode.d.ts +173 -114
  31. package/serialization/types/serializer.d.ts +109 -0
  32. package/server-functions/dist/client.dev.js +1462 -0
  33. package/server-functions/dist/client.js +667 -165
  34. package/server-functions/dist/client.observe.js +1441 -0
  35. package/server-functions/dist/rich-args.js +84 -1
  36. package/server-functions/dist/server.dev.js +2714 -297
  37. package/server-functions/dist/server.js +2595 -271
  38. package/server-functions/dist/server.observe.js +3594 -0
  39. package/server-functions/package.json +2 -35
  40. package/server-functions/rich-args/package.json +2 -15
  41. package/skills/server-components/SKILL.md +117 -0
  42. package/storage/package.json +2 -15
  43. package/types/client.d.ts +342 -288
  44. package/types/constants.d.ts +22 -0
  45. package/types/cookies.d.ts +32 -84
  46. package/types/diagnostics.d.ts +80 -0
  47. package/types/frames/assets-tier.d.ts +78 -0
  48. package/types/frames/client.d.ts +40 -1
  49. package/types/frames/frame-client.d.ts +443 -280
  50. package/types/frames/frame-container-plugin.d.ts +64 -0
  51. package/types/frames/frame-morph.d.ts +29 -0
  52. package/types/frames/frame-sink.d.ts +141 -161
  53. package/types/frames/frame-transport.d.ts +263 -184
  54. package/types/frames/regions-tier.d.ts +60 -0
  55. package/types/frames/serializer-decode.d.ts +241 -0
  56. package/types/frames/serializer.d.ts +85 -158
  57. package/types/frames/server.d.ts +2 -2
  58. package/types/frames/trace-tier.d.ts +2 -0
  59. package/types/frames/tree-rewrite.d.ts +39 -0
  60. package/types/frames/wire-tier.d.ts +169 -0
  61. package/types/head.d.ts +20 -0
  62. package/types/index.d.ts +98 -81
  63. package/types/index.server.d.ts +159 -0
  64. package/types/jsx.d.ts +49 -44
  65. package/types/observe.d.ts +535 -0
  66. package/types/reconcile.d.ts +1 -0
  67. package/types/render.d.ts +11 -0
  68. package/types/request-error-hook.d.ts +5 -0
  69. package/types/response.d.ts +95 -147
  70. package/types/serializer-decode.d.ts +173 -114
  71. package/types/serializer.d.ts +85 -158
  72. package/types/server-functions/argument-codec.d.ts +30 -0
  73. package/types/server-functions/client.d.ts +238 -223
  74. package/types/server-functions/flash.d.ts +28 -30
  75. package/types/server-functions/registry.d.ts +105 -0
  76. package/types/server-functions/rich-args.d.ts +1 -10
  77. package/types/server-functions/server.d.ts +539 -531
  78. package/types/server-functions/shared.d.ts +398 -425
  79. package/types/server-functions/uploads.d.ts +50 -0
  80. package/types/server-mock.d.ts +120 -13
  81. package/types/server-observe.d.ts +86 -0
  82. package/types/server.d.ts +571 -422
  83. package/types/trace.d.ts +127 -0
  84. package/LICENSE +0 -21
  85. package/dist/web.cjs +0 -2033
  86. package/frames/dist/client.cjs +0 -2002
  87. package/frames/dist/client.dev.cjs +0 -2022
  88. package/frames/dist/server.cjs +0 -3877
  89. package/serialization/dist/decode.cjs +0 -139
  90. package/serialization/dist/serialization.cjs +0 -261
  91. package/serialization/types-cjs/index.d.cts +0 -182
  92. package/serialization/types-cjs/package.json +0 -3
  93. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  94. package/server-functions/dist/client.cjs +0 -834
  95. package/server-functions/dist/rich-args.cjs +0 -11
  96. package/server-functions/dist/server.cjs +0 -1242
  97. package/server-functions/dist/server.dev.cjs +0 -1242
  98. package/storage/dist/storage.cjs +0 -12
  99. package/storage/types-cjs/index.d.cts +0 -28
  100. package/storage/types-cjs/package.json +0 -3
  101. package/types/core.d.ts +0 -9
  102. package/types-cjs/client.d.cts +0 -337
  103. package/types-cjs/cookies.d.cts +0 -93
  104. package/types-cjs/core.d.cts +0 -9
  105. package/types-cjs/frames/client.d.cts +0 -36
  106. package/types-cjs/frames/frame-client.d.cts +0 -356
  107. package/types-cjs/frames/frame-sink.d.cts +0 -194
  108. package/types-cjs/frames/frame-transport.d.cts +0 -222
  109. package/types-cjs/frames/serializer.d.cts +0 -182
  110. package/types-cjs/frames/server.d.cts +0 -52
  111. package/types-cjs/index.d.cts +0 -244
  112. package/types-cjs/jsx-properties.d.cts +0 -93
  113. package/types-cjs/jsx.d.cts +0 -4159
  114. package/types-cjs/package.json +0 -3
  115. package/types-cjs/response.d.cts +0 -174
  116. package/types-cjs/serializer-decode.d.cts +0 -182
  117. package/types-cjs/serializer.d.cts +0 -182
  118. package/types-cjs/server-functions/client.d.cts +0 -262
  119. package/types-cjs/server-functions/flash.d.cts +0 -38
  120. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  121. package/types-cjs/server-functions/server.d.cts +0 -681
  122. package/types-cjs/server-functions/shared.d.cts +0 -523
  123. package/types-cjs/server-mock.d.cts +0 -286
  124. package/types-cjs/server.d.cts +0 -544
@@ -1,286 +0,0 @@
1
- import type { RequestEvent, RequestEventLocals, ResponseStub } from "./client.cjs";
2
- /** Static asset manifest produced by a build (e.g. parsed Vite manifest.json). */
3
- export type AssetManifest = Record<string, {
4
- file: string;
5
- css?: string[];
6
- isEntry?: boolean;
7
- imports?: string[];
8
- }> & {
9
- _base?: string;
10
- };
11
- /** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
12
- export type InlineStyleAsset = {
13
- id: string;
14
- content: string;
15
- attrs?: Record<string, string>;
16
- };
17
- export type ResolvedAssets = {
18
- js: string[];
19
- css: (string | InlineStyleAsset)[];
20
- };
21
- /**
22
- * Resolver form of the manifest option — the primitive a dev server
23
- * implements against its live module graph (a static manifest object is
24
- * normalized into a sync resolver internally). `resolve` may return a
25
- * promise (async resolvers require streaming rendering); CSS entries may be
26
- * URL strings (emitted as load-gated `<link>` tags) or inline-style
27
- * descriptors (emitted as `<style>` tags). A bare `resolve`-shaped function
28
- * is accepted as shorthand for `{ resolve }`.
29
- */
30
- export type AssetResolver = {
31
- resolve(key: string): ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
32
- /**
33
- * Synchronous fast path answering with whatever is knowable without async
34
- * work (typically js URLs, omitting css). Sync consumers — e.g. a lazy
35
- * component's `moduleUrl` getter used by islands — use this when `resolve`
36
- * would return a promise, so adapters should provide it whenever possible.
37
- */
38
- resolveSync?(key: string): ResolvedAssets | null | undefined;
39
- };
40
- /** Bare-function shorthand for `AssetResolver` (no sync fast path). */
41
- export type AssetResolverFn = (key: string) => ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
42
- /**
43
- * CSP nonce for the tags a server render emits. A string applies to both
44
- * nonce-aware destinations; a `{ script, style }` pair routes each tag to
45
- * its destination's nonce, with `false` leaving that destination un-nonced.
46
- */
47
- export type CSPNonce = string | {
48
- script: string | false;
49
- style: string | false;
50
- };
51
- /**
52
- * Renders a component tree synchronously to an HTML string. Async reads inside
53
- * `<Loading>` boundaries emit their `fallback` content; for full-graph
54
- * resolution await `renderToStream` instead.
55
- *
56
- * Pair the returned HTML with `hydrate()` on the client.
57
- *
58
- * @example
59
- * ```tsx
60
- * import { renderToString } from "@solidjs/web";
61
- *
62
- * const html = renderToString(() => <App />);
63
- * res.send(`<!doctype html><html><body><div id="root">${html}</div></body></html>`);
64
- * ```
65
- */
66
- export declare function renderToString<T>(fn: () => T, options?: {
67
- nonce?: CSPNonce;
68
- renderId?: string;
69
- noScripts?: boolean;
70
- plugins?: any[];
71
- manifest?: AssetManifest | AssetResolver | AssetResolverFn;
72
- onError?: (err: any) => void;
73
- /**
74
- * Embedded-render contract for hosts that own the document. When the
75
- * render output contains no `</head>`, everything head-bound (resolved
76
- * `useHead` winners, eager resources, tracked asset links, inline
77
- * styles) is delivered here as one HTML string — prelude (charset/base)
78
- * first — for the host to splice into its own `<head>` template, instead
79
- * of being dropped. Called synchronously before `renderToString`
80
- * returns; not called when the output has a `</head>` (splicing is
81
- * automatic then).
82
- */
83
- onHead?: (head: string) => void;
84
- }): string;
85
- /**
86
- * Streams an HTML response, flushing the synchronous shell first and then
87
- * progressively emitting async-resolved fragments as their `<Loading>`
88
- * boundaries settle. Good for time-to-first-byte sensitive pages.
89
- *
90
- * Returns an object with `pipe`/`pipeTo` for piping to a Node `Writable` or
91
- * a Web `WritableStream`, a lazy `readable` byte-stream view for
92
- * `new Response(stream.readable)`, plus a thenable for awaiting full
93
- * completion — `await renderToStream(...)` resolves with the settled HTML
94
- * (the fully-resolved-string form of the render). `pipe`, `pipeTo`, and
95
- * `readable` each consume the render — use exactly one of the three.
96
- *
97
- * @example
98
- * ```tsx
99
- * import { renderToStream } from "@solidjs/web";
100
- *
101
- * // Node:
102
- * renderToStream(() => <App />).pipe(res);
103
- *
104
- * // Web (Workers / Deno):
105
- * return new Response(renderToStream(() => <App />).readable);
106
- *
107
- * // Fully settled string:
108
- * const html = await renderToStream(() => <App />);
109
- * ```
110
- */
111
- export declare function renderToStream<T>(fn: () => T, options?: {
112
- nonce?: CSPNonce;
113
- renderId?: string;
114
- noScripts?: boolean;
115
- plugins?: any[];
116
- manifest?: AssetManifest | AssetResolver | AssetResolverFn;
117
- onCompleteShell?: (info: {
118
- write: (v: string) => void;
119
- }) => void;
120
- onCompleteAll?: (info: {
121
- write: (v: string) => void;
122
- }) => void;
123
- onError?: (err: any) => void;
124
- /**
125
- * Embedded-render contract for hosts that own the document. When the
126
- * shell contains no `</head>`, everything head-bound at first flush
127
- * (resolved `useHead` winners, eager resources, tracked asset links,
128
- * inline styles) is delivered here as one HTML string — prelude first —
129
- * before the shell chunk is emitted, so the host can write its own
130
- * `<head>` ahead of piping the stream. Post-shell head updates flow
131
- * through the stream itself and apply in the browser. Not called when
132
- * the shell has a `</head>` (splicing is automatic then).
133
- */
134
- onHead?: (head: string) => void;
135
- }): {
136
- /**
137
- * Awaiting the stream resolves with the complete HTML once every boundary
138
- * settles — the fully-settled-string form of the render. Render errors
139
- * route through `onError` and the promise resolves with whatever HTML the
140
- * render produced; it never rejects.
141
- */
142
- then<TResult1 = string, TResult2 = never>(onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
143
- pipe: (writable: {
144
- write: (v: string) => void;
145
- end: () => void;
146
- }) => void;
147
- pipeTo: (writable: WritableStream) => Promise<void>;
148
- readonly readable: ReadableStream<Uint8Array>;
149
- };
150
- /**
151
- * Fetch-style middleware: receives the `Request` and a `next` continuation
152
- * (pass a `Request` to substitute it downstream) and returns the `Response`.
153
- * Composed with `composeMiddleware`; runs inside the request-event scope, so
154
- * `getRequestEvent()` works exactly as in application code.
155
- */
156
- export type FetchMiddleware = (request: Request, next: (request?: Request) => Promise<Response>) => Response | Promise<Response>;
157
- /**
158
- * Creates a fresh, uncommitted {@link ResponseStub}. Server-only.
159
- */
160
- export declare function createResponseStub(): ResponseStub;
161
- /**
162
- * Builds the canonical request event — a web-standard `Request`, a `locals`
163
- * bag, and a stub-backed `response` head — for `provideRequestEvent`.
164
- * Server-only: on the client the request event belongs to the server that
165
- * rendered the page.
166
- */
167
- export declare function createRequestEvent<T extends object = {}>(request: Request, init?: T): {
168
- request: Request;
169
- locals: RequestEventLocals;
170
- response: ResponseStub;
171
- } & T;
172
- /**
173
- * The HTTP status a redirect should use: the stub's own status when it is a
174
- * redirect status (301/302/303/307/308), 302 otherwise. Server-only.
175
- */
176
- export declare function getExpectedRedirectStatus(response: ResponseStub): number;
177
- /**
178
- * Derives the outgoing `Response` for an SSR render result, running the
179
- * response-head lifecycle against `event.response`: the stub commits at
180
- * shell flush, a pre-flush `Location` becomes a real redirect
181
- * (`getExpectedRedirectStatus`), and a post-flush one appends the
182
- * nonce-aware `<script>window.location=...</script>` fallback. String
183
- * results return a `Response` synchronously; stream results resolve at
184
- * shell flush. Server-only.
185
- */
186
- export declare function createSSRResponse(result: string, event: RequestEvent | undefined, options?: {
187
- responseInit?: ResponseInit;
188
- nonce?: string;
189
- transformChunk?: (chunk: string) => string;
190
- }): Response;
191
- export declare function createSSRResponse(result: {
192
- pipe(writable: {
193
- write: (v: string) => void;
194
- end: () => void;
195
- }): void;
196
- }, event: RequestEvent | undefined, options?: {
197
- responseInit?: ResponseInit;
198
- nonce?: string;
199
- transformChunk?: (chunk: string) => string;
200
- }): Promise<Response>;
201
- /**
202
- * Handler-lifecycle plumbing — the exit for a `Response` that did not go
203
- * through `createSSRResponse` (a middleware early return, an API result):
204
- * folds the request event's response stub onto it (cookies append
205
- * entry-by-entry, other headers gap-fill, status never) and commits the
206
- * stub. Already-committed stubs pass the response through untouched, so
207
- * handlers apply it unconditionally after their middleware chain unwinds.
208
- * `event` defaults to the ambient `getRequestEvent()`. Application
209
- * middleware never calls this. Server-only.
210
- */
211
- export declare function commitEventResponse(response: Response, event?: RequestEvent): Response;
212
- /**
213
- * Composes fetch-style middleware — `(request, next) => Response` — into a
214
- * single function of the same shape. Nothing reaches the wire until the
215
- * outermost middleware returns, so headers on the returned `Response` stay
216
- * mutable through the whole unwind, streamed bodies included. Server-only.
217
- */
218
- export declare function composeMiddleware(middlewares: FetchMiddleware[]): (request: Request, next: (request?: Request) => Response | Promise<Response>) => Promise<Response>;
219
- /**
220
- * Compiler primitive — emitted by JSX-DOM-Expressions for tagged-template
221
- * SSR output. Not meant for hand-written code.
222
- * @internal
223
- */
224
- export declare function ssr(template: string[] | string, ...nodes: any[]): {
225
- t: string;
226
- };
227
- /**
228
- * Compiler primitive — emitted by JSX-DOM-Expressions for SSR element
229
- * output. Not meant for hand-written code.
230
- * @internal
231
- */
232
- export declare function ssrElement(name: string, props: any, children: any, needsId: boolean): {
233
- t: string;
234
- };
235
- /**
236
- * Compiler primitive — serializes a class value (string, object map, or
237
- * array) for SSR output. Not meant for hand-written code.
238
- * @internal
239
- */
240
- export declare function ssrClassName(value: string | {
241
- [k: string]: boolean;
242
- } | Array<any>): string;
243
- /**
244
- * Compiler primitive — serializes a style value for SSR output. Not meant
245
- * for hand-written code.
246
- * @internal
247
- */
248
- export declare function ssrStyle(value: string | {
249
- [k: string]: string;
250
- }): string;
251
- /**
252
- * Compiler primitive — serializes one style property for SSR output. Not
253
- * meant for hand-written code.
254
- * @internal
255
- */
256
- export declare function ssrStyleProperty(name: string, value: any): string;
257
- /**
258
- * Compiler primitive — serializes an attribute for SSR output. Not meant
259
- * for hand-written code.
260
- * @internal
261
- */
262
- export declare function ssrAttribute(key: string, value: any): string;
263
- /**
264
- * Compiler primitive — wraps a template-group closure for SSR output. Not
265
- * meant for hand-written code.
266
- * @internal
267
- */
268
- export declare function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
269
- /**
270
- * Compiler primitive — generates the hydration-key attribute for SSR
271
- * output. Not meant for hand-written code.
272
- * @internal
273
- */
274
- export declare function ssrHydrationKey(): string;
275
- /**
276
- * Compiler primitive — collapses an SSR-shaped node into its HTML string.
277
- * Not meant for hand-written code.
278
- * @internal
279
- */
280
- export declare function resolveSSRNode(node: any, result?: any, top?: boolean): any;
281
- /**
282
- * Escapes a string for safe inclusion in HTML output. Used by the SSR
283
- * runtime; not generally part of user code.
284
- * @internal
285
- */
286
- export declare function escape(s: any, attr?: boolean): any;