@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.21
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.
- package/README.md +1 -1
- package/dist/server.dev.js +5165 -0
- package/dist/server.js +1876 -374
- package/dist/{server.cjs → server.observe.js} +2070 -577
- package/dist/{dev.cjs → web.dev.js} +955 -567
- package/dist/web.js +646 -350
- package/dist/{dev.js → web.observe.js} +699 -421
- package/frames/dist/assets.js +92 -0
- package/frames/dist/client.dev.js +1296 -1198
- package/frames/dist/client.js +1128 -1191
- package/frames/dist/client.observe.js +2041 -0
- package/frames/dist/regions.js +171 -0
- package/frames/dist/server.dev.js +2545 -0
- package/frames/dist/server.js +1683 -3004
- package/frames/dist/server.observe.js +2544 -0
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +594 -0
- package/frames/package.json +2 -25
- package/package.json +244 -256
- package/performance-tracks/dist/performance-tracks.dev.js +679 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +667 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +69 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +121 -25
- package/serialization/dist/serialization.js +282 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +115 -153
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +144 -0
- package/server-functions/dist/client.dev.js +1462 -0
- package/server-functions/dist/client.js +667 -165
- package/server-functions/dist/client.observe.js +1441 -0
- package/server-functions/dist/rich-args.js +102 -1
- package/server-functions/dist/server.dev.js +2802 -299
- package/server-functions/dist/server.js +2724 -314
- package/server-functions/dist/server.observe.js +3680 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/skills/server-components/SKILL.md +117 -0
- package/storage/package.json +2 -15
- package/types/client.d.ts +342 -288
- package/types/constants.d.ts +22 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +80 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/client.d.ts +40 -1
- package/types/frames/frame-client.d.ts +443 -280
- package/types/frames/frame-container-plugin.d.ts +64 -0
- package/types/frames/frame-morph.d.ts +29 -0
- package/types/frames/frame-sink.d.ts +141 -161
- package/types/frames/frame-transport.d.ts +263 -184
- package/types/frames/regions-tier.d.ts +60 -0
- package/types/frames/serializer-decode.d.ts +241 -0
- package/types/frames/serializer.d.ts +115 -153
- package/types/frames/server.d.ts +2 -2
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/frames/wire-tier.d.ts +169 -0
- package/types/head.d.ts +20 -0
- package/types/index.d.ts +98 -81
- package/types/index.server.d.ts +159 -0
- package/types/jsx.d.ts +49 -44
- package/types/observe.d.ts +535 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +11 -0
- package/types/request-error-hook.d.ts +5 -0
- package/types/response.d.ts +95 -147
- package/types/serializer-decode.d.ts +173 -114
- package/types/serializer.d.ts +115 -153
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +237 -223
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +105 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +538 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +53 -0
- package/types/server-mock.d.ts +154 -20
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +601 -422
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2033
- package/frames/dist/client.cjs +0 -2002
- package/frames/dist/client.dev.cjs +0 -2022
- package/frames/dist/server.cjs +0 -3877
- package/serialization/dist/decode.cjs +0 -139
- package/serialization/dist/serialization.cjs +0 -261
- package/serialization/types-cjs/index.d.cts +0 -182
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -182
- package/server-functions/dist/client.cjs +0 -834
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1242
- package/server-functions/dist/server.dev.cjs +0 -1242
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/core.d.ts +0 -9
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -9
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -356
- package/types-cjs/frames/frame-sink.d.cts +0 -194
- package/types-cjs/frames/frame-transport.d.cts +0 -222
- package/types-cjs/frames/serializer.d.cts +0 -182
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/index.d.cts +0 -244
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4159
- package/types-cjs/package.json +0 -3
- package/types-cjs/response.d.cts +0 -174
- package/types-cjs/serializer-decode.d.cts +0 -182
- package/types-cjs/serializer.d.cts +0 -182
- package/types-cjs/server-functions/client.d.cts +0 -262
- package/types-cjs/server-functions/flash.d.cts +0 -38
- package/types-cjs/server-functions/rich-args.d.cts +0 -10
- package/types-cjs/server-functions/server.d.cts +0 -681
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -286
- package/types-cjs/server.d.cts +0 -544
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const UPLOAD_ARGS_PART = "args";
|
|
2
|
+
export declare const UPLOAD_FILE_PART = "file";
|
|
3
|
+
/**
|
|
4
|
+
* True for a file or a blob. One from another frame is an instance of that
|
|
5
|
+
* frame's `Blob`, so its shape tells instead.
|
|
6
|
+
*/
|
|
7
|
+
declare function isBlob(value: any): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The client half. Each file or blob in the arguments serializes as its
|
|
10
|
+
* index in `files`. A file that appears twice is pushed once, so it arrives
|
|
11
|
+
* as one value.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createUploadSerializer(files: any): {
|
|
14
|
+
tag: string;
|
|
15
|
+
test: typeof isBlob;
|
|
16
|
+
parse: {
|
|
17
|
+
sync: (value: any, ctx: any) => {
|
|
18
|
+
i: any;
|
|
19
|
+
t: any;
|
|
20
|
+
};
|
|
21
|
+
async: (value: any, ctx: any) => Promise<{
|
|
22
|
+
i: any;
|
|
23
|
+
t: any;
|
|
24
|
+
}>;
|
|
25
|
+
stream: (value: any, ctx: any) => {
|
|
26
|
+
i: any;
|
|
27
|
+
t: any;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
serialize: (node: any, ctx: any) => any;
|
|
31
|
+
deserialize: () => never;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The server half, made for one request. Each index turns back into its
|
|
35
|
+
* part of `form`. A bad index or a missing part fails the decode.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createUploadDeserializer(form: any): {
|
|
38
|
+
tag: string;
|
|
39
|
+
test: () => boolean;
|
|
40
|
+
parse: {
|
|
41
|
+
sync: () => never;
|
|
42
|
+
async: () => never;
|
|
43
|
+
stream: () => never;
|
|
44
|
+
};
|
|
45
|
+
serialize: () => never;
|
|
46
|
+
deserialize: (node: any, ctx: any) => any;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The request body for a call with files. `FormData` only takes blobs of its
|
|
50
|
+
* own frame, so a blob from another frame is copied first.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createUploadBody(serialized: any, files: any): Promise<FormData>;
|
|
53
|
+
export {};
|
package/types/server-mock.d.ts
CHANGED
|
@@ -1,11 +1,91 @@
|
|
|
1
1
|
import type { RequestEvent, RequestEventLocals, ResponseStub } from "./client.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import type { JSX } from "./jsx.js";
|
|
3
|
+
import type { ServerErrorSite } from "solid-js";
|
|
4
|
+
/**
|
|
5
|
+
* Where a server-side failure was met, as the server error hook hears it —
|
|
6
|
+
* the client's view of the server entry's type (see `configureServerErrors`
|
|
7
|
+
* there). `kind: "render"`: `fallback`/`client`/`failed`; `kind:
|
|
8
|
+
* "server-function"`: `thrown`/`channel`; `kind: "request"`: `failed`.
|
|
9
|
+
*/
|
|
10
|
+
export interface ServerErrorContext extends Omit<ServerErrorSite, "event"> {
|
|
11
|
+
event?: RequestEvent;
|
|
12
|
+
}
|
|
13
|
+
/** The server error hook (see the server entry's `configureServerErrors`). Its return is the wire value; nothing for the default. */
|
|
14
|
+
export type ServerErrorHook = (error: unknown, context: ServerErrorContext) => unknown | void;
|
|
15
|
+
export interface ServerErrorsConfig {
|
|
16
|
+
onError?: ServerErrorHook;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Registers the ambient server error hook. Server-only; on the client this
|
|
20
|
+
* is a no-op so isomorphic setup code can call it unguarded.
|
|
21
|
+
*/
|
|
22
|
+
export declare function configureServerErrors(_config: ServerErrorsConfig): void;
|
|
23
|
+
/**
|
|
24
|
+
* Reports a failure that fails a request outside any render (see the
|
|
25
|
+
* server entry's `reportRequestFailure`). Server-only; on the client this is
|
|
26
|
+
* a no-op.
|
|
27
|
+
*/
|
|
28
|
+
export declare function reportRequestFailure(_error: unknown, _event: RequestEvent): void;
|
|
29
|
+
type PreloadLinkAttributes = {
|
|
30
|
+
type?: string;
|
|
31
|
+
crossorigin?: JSX.HTMLCrossorigin;
|
|
32
|
+
integrity?: string;
|
|
33
|
+
referrerpolicy?: JSX.HTMLReferrerPolicy;
|
|
34
|
+
fetchpriority?: JSX.HTMLFetchPriority;
|
|
35
|
+
media?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* An explicit `<link rel="preload">` emitted by the SSR asset pipeline.
|
|
39
|
+
*
|
|
40
|
+
* `as` is the HTML Standard's set of preload destinations exactly — anything
|
|
41
|
+
* else translates to null and the browser does nothing with the link.
|
|
42
|
+
*
|
|
43
|
+
* `imagesrcset` candidates must already be resolved by the integration: they
|
|
44
|
+
* are carried verbatim (a relative candidate resolves against the DOCUMENT
|
|
45
|
+
* URL, not the manifest base). Pair it with `imagesizes` whenever a candidate
|
|
46
|
+
* uses a width descriptor, which the spec requires — without it the source
|
|
47
|
+
* size falls back to `100vw` and the preload can miss the image the `<img>`
|
|
48
|
+
* selects. Omitting `href` is the spec's own recommendation for the source-set
|
|
49
|
+
* form: it would only serve browsers without `imagesrcset` support, and there
|
|
50
|
+
* it would likely preload the wrong candidate.
|
|
51
|
+
*/
|
|
52
|
+
export type PreloadLink = PreloadLinkAttributes & ({
|
|
53
|
+
href: string;
|
|
54
|
+
as: Exclude<JSX.HTMLPreloadAs, "image">;
|
|
55
|
+
imagesrcset?: never;
|
|
56
|
+
imagesizes?: never;
|
|
57
|
+
} | {
|
|
58
|
+
href: string;
|
|
59
|
+
as: "image";
|
|
60
|
+
imagesrcset?: string;
|
|
61
|
+
imagesizes?: string;
|
|
62
|
+
} | {
|
|
63
|
+
href?: never;
|
|
64
|
+
as: "image";
|
|
65
|
+
imagesrcset: string;
|
|
66
|
+
imagesizes?: string;
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Static asset graph consumed by the SSR pipeline. This is Solid's own
|
|
70
|
+
* contract — a parsed Vite client manifest satisfies it structurally
|
|
71
|
+
* (unknown fields pass through untyped), but any bundler integration can
|
|
72
|
+
* produce it. Only these fields are ever read: `preloads` is Solid's
|
|
73
|
+
* extension slot for explicit typed links the integration selects.
|
|
74
|
+
*
|
|
75
|
+
* Keys are module ids, except `_`-prefixed metadata strings: `_base` (the
|
|
76
|
+
* public base joined with every `file`), plus any an integration stamps,
|
|
77
|
+
* such as the vite plugin's `_entry`. The index signature carries both
|
|
78
|
+
* (solidjs/solid#4502), so a read by key is an entry only once narrowed,
|
|
79
|
+
* e.g. `typeof entry === "object"`.
|
|
80
|
+
*/
|
|
81
|
+
export type AssetManifest = {
|
|
82
|
+
[key: string]: {
|
|
83
|
+
file: string;
|
|
84
|
+
css?: string[];
|
|
85
|
+
isEntry?: boolean;
|
|
86
|
+
imports?: string[];
|
|
87
|
+
preloads?: PreloadLink[];
|
|
88
|
+
} | string | undefined;
|
|
9
89
|
_base?: string;
|
|
10
90
|
};
|
|
11
91
|
/** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
|
|
@@ -17,6 +97,7 @@ export type InlineStyleAsset = {
|
|
|
17
97
|
export type ResolvedAssets = {
|
|
18
98
|
js: string[];
|
|
19
99
|
css: (string | InlineStyleAsset)[];
|
|
100
|
+
preloads?: PreloadLink[];
|
|
20
101
|
};
|
|
21
102
|
/**
|
|
22
103
|
* Resolver form of the manifest option — the primitive a dev server
|
|
@@ -24,8 +105,9 @@ export type ResolvedAssets = {
|
|
|
24
105
|
* normalized into a sync resolver internally). `resolve` may return a
|
|
25
106
|
* promise (async resolvers require streaming rendering); CSS entries may be
|
|
26
107
|
* URL strings (emitted as load-gated `<link>` tags) or inline-style
|
|
27
|
-
* descriptors (emitted as `<style>` tags)
|
|
28
|
-
*
|
|
108
|
+
* descriptors (emitted as `<style>` tags), and `preloads` carries explicit
|
|
109
|
+
* preload links selected by the integration. A bare `resolve`-shaped
|
|
110
|
+
* function is accepted as shorthand for `{ resolve }`.
|
|
29
111
|
*/
|
|
30
112
|
export type AssetResolver = {
|
|
31
113
|
resolve(key: string): ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
|
|
@@ -69,7 +151,15 @@ export declare function renderToString<T>(fn: () => T, options?: {
|
|
|
69
151
|
noScripts?: boolean;
|
|
70
152
|
plugins?: any[];
|
|
71
153
|
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
72
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Server modulepreload hints for modules outside the entry's static import
|
|
156
|
+
* closure (lazy and route chunks) carry `fetchpriority="low"` so they do not
|
|
157
|
+
* compete with the modules hydration waits on. `false` emits them at default
|
|
158
|
+
* priority.
|
|
159
|
+
*/
|
|
160
|
+
lowPriorityPreloads?: boolean;
|
|
161
|
+
/** This render's server error hook, ahead of `configureServerErrors`' (see the server entry). */
|
|
162
|
+
onError?: ServerErrorHook;
|
|
73
163
|
/**
|
|
74
164
|
* Embedded-render contract for hosts that own the document. When the
|
|
75
165
|
* render output contains no `</head>`, everything head-bound (resolved
|
|
@@ -114,13 +204,21 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
114
204
|
noScripts?: boolean;
|
|
115
205
|
plugins?: any[];
|
|
116
206
|
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
207
|
+
/**
|
|
208
|
+
* Server modulepreload hints for modules outside the entry's static import
|
|
209
|
+
* closure (lazy and route chunks) carry `fetchpriority="low"` so they do not
|
|
210
|
+
* compete with the modules hydration waits on. `false` emits them at default
|
|
211
|
+
* priority.
|
|
212
|
+
*/
|
|
213
|
+
lowPriorityPreloads?: boolean;
|
|
117
214
|
onCompleteShell?: (info: {
|
|
118
215
|
write: (v: string) => void;
|
|
119
216
|
}) => void;
|
|
120
217
|
onCompleteAll?: (info: {
|
|
121
218
|
write: (v: string) => void;
|
|
122
219
|
}) => void;
|
|
123
|
-
|
|
220
|
+
/** This render's server error hook, ahead of `configureServerErrors`' (see the server entry). */
|
|
221
|
+
onError?: ServerErrorHook;
|
|
124
222
|
/**
|
|
125
223
|
* Embedded-render contract for hosts that own the document. When the
|
|
126
224
|
* shell contains no `</head>`, everything head-bound at first flush
|
|
@@ -132,12 +230,26 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
132
230
|
* the shell has a `</head>` (splicing is automatic then).
|
|
133
231
|
*/
|
|
134
232
|
onHead?: (head: string) => void;
|
|
233
|
+
/**
|
|
234
|
+
* The request's lifecycle. Aborting tears the render down exactly as a
|
|
235
|
+
* client disconnect does (`SSR_STREAM_ABANDONED`, `data.reason:
|
|
236
|
+
* "signal"`); the one teardown handle for a host whose transport cannot
|
|
237
|
+
* report a dead consumer through the sink or the readable view — pass
|
|
238
|
+
* `request.signal`.
|
|
239
|
+
* Awaiting the render rejects with `signal.reason` when this signal aborts;
|
|
240
|
+
* the streaming forms stop writing and end cleanly — a close, not an
|
|
241
|
+
* error, since bytes are already out: `pipe` ends its sink, `pipeTo`
|
|
242
|
+
* closes its writable (after the writes already handed to it) and
|
|
243
|
+
* resolves, and `readable` closes. `onError` and `onCompleteAll` are not
|
|
244
|
+
* called (#4646).
|
|
245
|
+
*/
|
|
246
|
+
signal?: AbortSignal;
|
|
135
247
|
}): {
|
|
136
248
|
/**
|
|
137
249
|
* Awaiting the stream resolves with the complete HTML once every boundary
|
|
138
250
|
* settles — the fully-settled-string form of the render. Render errors
|
|
139
251
|
* route through `onError` and the promise resolves with whatever HTML the
|
|
140
|
-
* render produced
|
|
252
|
+
* render produced. Signal cancellation rejects with `signal.reason`.
|
|
141
253
|
*/
|
|
142
254
|
then<TResult1 = string, TResult2 = never>(onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
143
255
|
pipe: (writable: {
|
|
@@ -180,12 +292,13 @@ export declare function getExpectedRedirectStatus(response: ResponseStub): numbe
|
|
|
180
292
|
* shell flush, a pre-flush `Location` becomes a real redirect
|
|
181
293
|
* (`getExpectedRedirectStatus`), and a post-flush one appends the
|
|
182
294
|
* nonce-aware `<script>window.location=...</script>` fallback. String
|
|
183
|
-
* results return a `Response` synchronously
|
|
184
|
-
*
|
|
295
|
+
* results return a `Response` synchronously (an awaited `renderToStream`
|
|
296
|
+
* result arrives already committed — its head froze at completion); stream
|
|
297
|
+
* results resolve at shell flush. Server-only.
|
|
185
298
|
*/
|
|
186
299
|
export declare function createSSRResponse(result: string, event: RequestEvent | undefined, options?: {
|
|
187
300
|
responseInit?: ResponseInit;
|
|
188
|
-
nonce?:
|
|
301
|
+
nonce?: CSPNonce;
|
|
189
302
|
transformChunk?: (chunk: string) => string;
|
|
190
303
|
}): Response;
|
|
191
304
|
export declare function createSSRResponse(result: {
|
|
@@ -195,7 +308,7 @@ export declare function createSSRResponse(result: {
|
|
|
195
308
|
}): void;
|
|
196
309
|
}, event: RequestEvent | undefined, options?: {
|
|
197
310
|
responseInit?: ResponseInit;
|
|
198
|
-
nonce?:
|
|
311
|
+
nonce?: CSPNonce;
|
|
199
312
|
transformChunk?: (chunk: string) => string;
|
|
200
313
|
}): Promise<Response>;
|
|
201
314
|
/**
|
|
@@ -217,7 +330,7 @@ export declare function commitEventResponse(response: Response, event?: RequestE
|
|
|
217
330
|
*/
|
|
218
331
|
export declare function composeMiddleware(middlewares: FetchMiddleware[]): (request: Request, next: (request?: Request) => Response | Promise<Response>) => Promise<Response>;
|
|
219
332
|
/**
|
|
220
|
-
* Compiler primitive — emitted by JSX
|
|
333
|
+
* Compiler primitive — emitted by Solid's JSX compiler for tagged-template
|
|
221
334
|
* SSR output. Not meant for hand-written code.
|
|
222
335
|
* @internal
|
|
223
336
|
*/
|
|
@@ -225,13 +338,27 @@ export declare function ssr(template: string[] | string, ...nodes: any[]): {
|
|
|
225
338
|
t: string;
|
|
226
339
|
};
|
|
227
340
|
/**
|
|
228
|
-
* Compiler primitive — emitted by JSX
|
|
341
|
+
* Compiler primitive — emitted by Solid's JSX compiler for SSR element
|
|
229
342
|
* output. Not meant for hand-written code.
|
|
230
343
|
* @internal
|
|
231
344
|
*/
|
|
232
|
-
export declare function ssrElement(name: string, props: any, children: any, needsId: boolean): {
|
|
345
|
+
export declare function ssrElement(name: string, props: any | any[] | (() => any | any[]), children: any, needsId: boolean, skip?: (key: string) => boolean, attrs?: string | (() => string)): {
|
|
233
346
|
t: string;
|
|
234
347
|
};
|
|
348
|
+
/**
|
|
349
|
+
* Compiler primitive — serializes one attribute of a spread element as
|
|
350
|
+
* `ssrElement` would, for a dynamic attribute after the element's last
|
|
351
|
+
* spread. Not meant for hand-written code.
|
|
352
|
+
* @internal
|
|
353
|
+
*/
|
|
354
|
+
export declare function ssrElementAttribute(key: string, value: any): string;
|
|
355
|
+
/**
|
|
356
|
+
* Compiler primitive — the hole after a candidate anchor's attributes in SSR
|
|
357
|
+
* output, the render's link handler's markup (see the server entry's
|
|
358
|
+
* `setLinkClaim`). Not meant for hand-written code.
|
|
359
|
+
* @internal
|
|
360
|
+
*/
|
|
361
|
+
export declare function ssrLinkClaim(attrs: Readonly<Record<string, unknown>>): string;
|
|
235
362
|
/**
|
|
236
363
|
* Compiler primitive — serializes a class value (string, object map, or
|
|
237
364
|
* array) for SSR output. Not meant for hand-written code.
|
|
@@ -254,6 +381,12 @@ export declare function ssrStyle(value: string | {
|
|
|
254
381
|
* @internal
|
|
255
382
|
*/
|
|
256
383
|
export declare function ssrStyleProperty(name: string, value: any): string;
|
|
384
|
+
/**
|
|
385
|
+
* Compiler primitive — serializes a style object's `name, value` pairs for
|
|
386
|
+
* SSR output. Not meant for hand-written code.
|
|
387
|
+
* @internal
|
|
388
|
+
*/
|
|
389
|
+
export declare function ssrStyleProperties(...entries: any[]): string;
|
|
257
390
|
/**
|
|
258
391
|
* Compiler primitive — serializes an attribute for SSR output. Not meant
|
|
259
392
|
* for hand-written code.
|
|
@@ -277,10 +410,11 @@ export declare function ssrHydrationKey(): string;
|
|
|
277
410
|
* Not meant for hand-written code.
|
|
278
411
|
* @internal
|
|
279
412
|
*/
|
|
280
|
-
export declare function resolveSSRNode(node: any, result?: any, top?: boolean): any;
|
|
413
|
+
export declare function resolveSSRNode(node: any, result?: any, top?: boolean, nested?: boolean): any;
|
|
281
414
|
/**
|
|
282
415
|
* Escapes a string for safe inclusion in HTML output. Used by the SSR
|
|
283
416
|
* runtime; not generally part of user code.
|
|
284
417
|
* @internal
|
|
285
418
|
*/
|
|
286
419
|
export declare function escape(s: any, attr?: boolean): any;
|
|
420
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type FrameProducedEvent, type RenderEvent } from "./observe.js";
|
|
2
|
+
import type { NavigationRef } from "solid-js";
|
|
3
|
+
import { type TraceRecord } from "./trace.js";
|
|
4
|
+
import type { RequestEvent } from "./server.js";
|
|
5
|
+
/**
|
|
6
|
+
* The one gate for a server record and the `Server-Timing` metric projected
|
|
7
|
+
* from it (`TimedWork` in trace.ts): whether the runtime builds the record
|
|
8
|
+
* of `type` — `"invocation"` (→ `solid-invocation`), `"render"` (→
|
|
9
|
+
* `solid-shell`), `"boundary"` (→ `solid-boundary`, gated in the reactive
|
|
10
|
+
* library's boundary with this same rule). Dev builds always: dev is the
|
|
11
|
+
* panel's home, and the boundary already measures for its dev checks.
|
|
12
|
+
* Observe builds while a listener is on the type (`observed`), so an app
|
|
13
|
+
* with no observer sees no wire change; the record is then delivered AND
|
|
14
|
+
* the metric written from it — one clock, one object. `false` in prod,
|
|
15
|
+
* where `records()` is `undefined`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function timesServerWork(type: "invocation" | "render" | "boundary"): boolean;
|
|
18
|
+
/** What the renderer holds while a render is being recorded. */
|
|
19
|
+
export interface RenderObservation {
|
|
20
|
+
/**
|
|
21
|
+
* The shell is complete — for a stream, handed to the sink; for a string,
|
|
22
|
+
* the document assembled: stamps `shellMs`, the `solid-shell` metric's
|
|
23
|
+
* duration. Once; a later call is ignored.
|
|
24
|
+
*/
|
|
25
|
+
shell(): void;
|
|
26
|
+
/** A `<Loading>` boundary the shell waited on settled: counts it (`boundaries`). */
|
|
27
|
+
boundary(): void;
|
|
28
|
+
/**
|
|
29
|
+
* The router declared the render's route (`_declareRoute` on the render
|
|
30
|
+
* context): keeps the ref, read at `settle` into `RenderEvent.route`. A
|
|
31
|
+
* later declaration replaces an earlier one (a router remounted by a
|
|
32
|
+
* boundary's second pass describes the same route again).
|
|
33
|
+
*/
|
|
34
|
+
route(ref: NavigationRef): void;
|
|
35
|
+
/** The render ended; delivers the record. Once. */
|
|
36
|
+
settle(outcome: RenderEvent["outcome"]): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Opens the `"render"` record for a render of `mode` — on the request's
|
|
40
|
+
* trace record, where the head commit reads it (`TraceRecord.render`) —
|
|
41
|
+
* when `timesServerWork("render")`; `undefined` otherwise, and the renderer
|
|
42
|
+
* then does nothing extra, not even read the clock. The record is built as
|
|
43
|
+
* the render proceeds and delivered at `settle`, to a listener if there is
|
|
44
|
+
* one; `event` is the request the render serves, the record's live half.
|
|
45
|
+
*/
|
|
46
|
+
export declare function observeRender(trace: TraceRecord, mode: RenderEvent["mode"], event: RequestEvent | undefined): RenderObservation | undefined;
|
|
47
|
+
/** What the runtime passes an observation from either dispatch leg. */
|
|
48
|
+
export interface InvocationContext {
|
|
49
|
+
id: string;
|
|
50
|
+
direct: boolean;
|
|
51
|
+
event: RequestEvent;
|
|
52
|
+
request?: Request;
|
|
53
|
+
args: unknown[];
|
|
54
|
+
}
|
|
55
|
+
/** What the frame producer hands an observation: the stream's identity. */
|
|
56
|
+
export interface FrameObservation {
|
|
57
|
+
/** Counts the chunk — call for every chunk written after `start`. */
|
|
58
|
+
chunk(message: {
|
|
59
|
+
type?: string;
|
|
60
|
+
id: string;
|
|
61
|
+
r?: Record<string, any>;
|
|
62
|
+
}): void;
|
|
63
|
+
/** Delivers the record. `error` is the value thrown on the synchronous failure path. */
|
|
64
|
+
settle(outcome: FrameProducedEvent["outcome"], error?: unknown): void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Opens the observation of one frame stream, at its `start`; the producer
|
|
68
|
+
* feeds it every chunk and settles it at `complete`. `undefined` with no
|
|
69
|
+
* listener or outside observe builds — the producer then does nothing
|
|
70
|
+
* extra, not even read the clock.
|
|
71
|
+
*/
|
|
72
|
+
export declare function observeFrame(frame: {
|
|
73
|
+
id: string;
|
|
74
|
+
version: number;
|
|
75
|
+
}): FrameObservation | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Runs `execute` — the wrapped server-function execution — and reports it
|
|
78
|
+
* as an `"invocation"` record once it settles: synchronously for a sync
|
|
79
|
+
* return or throw, at resolution/rejection for a promise. Returns
|
|
80
|
+
* `execute`'s value (a promise is re-wrapped, still a native Promise);
|
|
81
|
+
* throws what it throws. Timed while `timesServerWork("invocation")` — the
|
|
82
|
+
* duration also rides the response's `Server-Timing` — and, with no
|
|
83
|
+
* listener in an observe build or outside observe builds altogether, it is
|
|
84
|
+
* `execute()` and nothing else.
|
|
85
|
+
*/
|
|
86
|
+
export declare function observeInvocation<T>(context: InvocationContext, execute: () => T): T;
|