@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.
- package/README.md +1 -1
- package/dist/server.dev.js +5065 -0
- package/dist/server.js +1757 -355
- package/dist/{server.cjs → server.observe.js} +1951 -558
- package/dist/{dev.cjs → web.dev.js} +945 -550
- package/dist/web.js +635 -332
- package/dist/{dev.js → web.observe.js} +688 -403
- 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 +2549 -0
- package/frames/dist/server.js +1688 -3005
- package/frames/dist/server.observe.js +2548 -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 +242 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +85 -158
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +109 -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 +84 -1
- package/server-functions/dist/server.dev.js +2714 -297
- package/server-functions/dist/server.js +2595 -271
- package/server-functions/dist/server.observe.js +3594 -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 +85 -158
- 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 +85 -158
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +238 -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 +539 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +50 -0
- package/types/server-mock.d.ts +120 -13
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +571 -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,50 @@
|
|
|
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
|
+
};
|
|
20
|
+
async: (value: any, ctx: any) => Promise<{
|
|
21
|
+
i: any;
|
|
22
|
+
}>;
|
|
23
|
+
stream: (value: any, ctx: any) => {
|
|
24
|
+
i: any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
serialize: (node: any, ctx: any) => any;
|
|
28
|
+
deserialize: () => never;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The server half, made for one request. Each index turns back into its
|
|
32
|
+
* part of `form`. A bad index or a missing part fails the decode.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createUploadDeserializer(form: any): {
|
|
35
|
+
tag: string;
|
|
36
|
+
test: () => boolean;
|
|
37
|
+
parse: {
|
|
38
|
+
sync: () => never;
|
|
39
|
+
async: () => never;
|
|
40
|
+
stream: () => never;
|
|
41
|
+
};
|
|
42
|
+
serialize: () => never;
|
|
43
|
+
deserialize: (node: any, ctx: any) => any;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The request body for a call with files. `FormData` only takes blobs of its
|
|
47
|
+
* own frame, so a blob from another frame is copied first.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createUploadBody(serialized: any, files: any): Promise<FormData>;
|
|
50
|
+
export {};
|
package/types/server-mock.d.ts
CHANGED
|
@@ -1,10 +1,83 @@
|
|
|
1
1
|
import type { RequestEvent, RequestEventLocals, ResponseStub } from "./client.js";
|
|
2
|
-
|
|
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
|
+
*/
|
|
3
75
|
export type AssetManifest = Record<string, {
|
|
4
76
|
file: string;
|
|
5
77
|
css?: string[];
|
|
6
78
|
isEntry?: boolean;
|
|
7
79
|
imports?: string[];
|
|
80
|
+
preloads?: PreloadLink[];
|
|
8
81
|
}> & {
|
|
9
82
|
_base?: string;
|
|
10
83
|
};
|
|
@@ -17,6 +90,7 @@ export type InlineStyleAsset = {
|
|
|
17
90
|
export type ResolvedAssets = {
|
|
18
91
|
js: string[];
|
|
19
92
|
css: (string | InlineStyleAsset)[];
|
|
93
|
+
preloads?: PreloadLink[];
|
|
20
94
|
};
|
|
21
95
|
/**
|
|
22
96
|
* Resolver form of the manifest option — the primitive a dev server
|
|
@@ -24,8 +98,9 @@ export type ResolvedAssets = {
|
|
|
24
98
|
* normalized into a sync resolver internally). `resolve` may return a
|
|
25
99
|
* promise (async resolvers require streaming rendering); CSS entries may be
|
|
26
100
|
* URL strings (emitted as load-gated `<link>` tags) or inline-style
|
|
27
|
-
* descriptors (emitted as `<style>` tags)
|
|
28
|
-
*
|
|
101
|
+
* descriptors (emitted as `<style>` tags), and `preloads` carries explicit
|
|
102
|
+
* preload links selected by the integration. A bare `resolve`-shaped
|
|
103
|
+
* function is accepted as shorthand for `{ resolve }`.
|
|
29
104
|
*/
|
|
30
105
|
export type AssetResolver = {
|
|
31
106
|
resolve(key: string): ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
|
|
@@ -69,7 +144,8 @@ export declare function renderToString<T>(fn: () => T, options?: {
|
|
|
69
144
|
noScripts?: boolean;
|
|
70
145
|
plugins?: any[];
|
|
71
146
|
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
72
|
-
|
|
147
|
+
/** This render's server error hook, ahead of `configureServerErrors`' (see the server entry). */
|
|
148
|
+
onError?: ServerErrorHook;
|
|
73
149
|
/**
|
|
74
150
|
* Embedded-render contract for hosts that own the document. When the
|
|
75
151
|
* render output contains no `</head>`, everything head-bound (resolved
|
|
@@ -120,7 +196,8 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
120
196
|
onCompleteAll?: (info: {
|
|
121
197
|
write: (v: string) => void;
|
|
122
198
|
}) => void;
|
|
123
|
-
|
|
199
|
+
/** This render's server error hook, ahead of `configureServerErrors`' (see the server entry). */
|
|
200
|
+
onError?: ServerErrorHook;
|
|
124
201
|
/**
|
|
125
202
|
* Embedded-render contract for hosts that own the document. When the
|
|
126
203
|
* shell contains no `</head>`, everything head-bound at first flush
|
|
@@ -132,6 +209,14 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
132
209
|
* the shell has a `</head>` (splicing is automatic then).
|
|
133
210
|
*/
|
|
134
211
|
onHead?: (head: string) => void;
|
|
212
|
+
/**
|
|
213
|
+
* The request's lifecycle. Aborting tears the render down exactly as a
|
|
214
|
+
* client disconnect does (`SSR_STREAM_ABANDONED`, `data.reason:
|
|
215
|
+
* "signal"`); the one teardown handle for a host whose transport cannot
|
|
216
|
+
* report a dead consumer through the sink or the readable view — pass
|
|
217
|
+
* `request.signal`.
|
|
218
|
+
*/
|
|
219
|
+
signal?: AbortSignal;
|
|
135
220
|
}): {
|
|
136
221
|
/**
|
|
137
222
|
* Awaiting the stream resolves with the complete HTML once every boundary
|
|
@@ -180,12 +265,13 @@ export declare function getExpectedRedirectStatus(response: ResponseStub): numbe
|
|
|
180
265
|
* shell flush, a pre-flush `Location` becomes a real redirect
|
|
181
266
|
* (`getExpectedRedirectStatus`), and a post-flush one appends the
|
|
182
267
|
* nonce-aware `<script>window.location=...</script>` fallback. String
|
|
183
|
-
* results return a `Response` synchronously
|
|
184
|
-
*
|
|
268
|
+
* results return a `Response` synchronously (an awaited `renderToStream`
|
|
269
|
+
* result arrives already committed — its head froze at completion); stream
|
|
270
|
+
* results resolve at shell flush. Server-only.
|
|
185
271
|
*/
|
|
186
272
|
export declare function createSSRResponse(result: string, event: RequestEvent | undefined, options?: {
|
|
187
273
|
responseInit?: ResponseInit;
|
|
188
|
-
nonce?:
|
|
274
|
+
nonce?: CSPNonce;
|
|
189
275
|
transformChunk?: (chunk: string) => string;
|
|
190
276
|
}): Response;
|
|
191
277
|
export declare function createSSRResponse(result: {
|
|
@@ -195,7 +281,7 @@ export declare function createSSRResponse(result: {
|
|
|
195
281
|
}): void;
|
|
196
282
|
}, event: RequestEvent | undefined, options?: {
|
|
197
283
|
responseInit?: ResponseInit;
|
|
198
|
-
nonce?:
|
|
284
|
+
nonce?: CSPNonce;
|
|
199
285
|
transformChunk?: (chunk: string) => string;
|
|
200
286
|
}): Promise<Response>;
|
|
201
287
|
/**
|
|
@@ -217,7 +303,7 @@ export declare function commitEventResponse(response: Response, event?: RequestE
|
|
|
217
303
|
*/
|
|
218
304
|
export declare function composeMiddleware(middlewares: FetchMiddleware[]): (request: Request, next: (request?: Request) => Response | Promise<Response>) => Promise<Response>;
|
|
219
305
|
/**
|
|
220
|
-
* Compiler primitive — emitted by JSX
|
|
306
|
+
* Compiler primitive — emitted by Solid's JSX compiler for tagged-template
|
|
221
307
|
* SSR output. Not meant for hand-written code.
|
|
222
308
|
* @internal
|
|
223
309
|
*/
|
|
@@ -225,13 +311,27 @@ export declare function ssr(template: string[] | string, ...nodes: any[]): {
|
|
|
225
311
|
t: string;
|
|
226
312
|
};
|
|
227
313
|
/**
|
|
228
|
-
* Compiler primitive — emitted by JSX
|
|
314
|
+
* Compiler primitive — emitted by Solid's JSX compiler for SSR element
|
|
229
315
|
* output. Not meant for hand-written code.
|
|
230
316
|
* @internal
|
|
231
317
|
*/
|
|
232
|
-
export declare function ssrElement(name: string, props: any, children: any, needsId: boolean): {
|
|
318
|
+
export declare function ssrElement(name: string, props: any | any[] | (() => any | any[]), children: any, needsId: boolean, skip?: (key: string) => boolean, attrs?: string | (() => string)): {
|
|
233
319
|
t: string;
|
|
234
320
|
};
|
|
321
|
+
/**
|
|
322
|
+
* Compiler primitive — serializes one attribute of a spread element as
|
|
323
|
+
* `ssrElement` would, for a dynamic attribute after the element's last
|
|
324
|
+
* spread. Not meant for hand-written code.
|
|
325
|
+
* @internal
|
|
326
|
+
*/
|
|
327
|
+
export declare function ssrElementAttribute(key: string, value: any): string;
|
|
328
|
+
/**
|
|
329
|
+
* Compiler primitive — the hole after a candidate anchor's attributes in SSR
|
|
330
|
+
* output, the render's link handler's markup (see the server entry's
|
|
331
|
+
* `setLinkClaim`). Not meant for hand-written code.
|
|
332
|
+
* @internal
|
|
333
|
+
*/
|
|
334
|
+
export declare function ssrLinkClaim(attrs: Readonly<Record<string, unknown>>): string;
|
|
235
335
|
/**
|
|
236
336
|
* Compiler primitive — serializes a class value (string, object map, or
|
|
237
337
|
* array) for SSR output. Not meant for hand-written code.
|
|
@@ -254,6 +354,12 @@ export declare function ssrStyle(value: string | {
|
|
|
254
354
|
* @internal
|
|
255
355
|
*/
|
|
256
356
|
export declare function ssrStyleProperty(name: string, value: any): string;
|
|
357
|
+
/**
|
|
358
|
+
* Compiler primitive — serializes a style object's `name, value` pairs for
|
|
359
|
+
* SSR output. Not meant for hand-written code.
|
|
360
|
+
* @internal
|
|
361
|
+
*/
|
|
362
|
+
export declare function ssrStyleProperties(...entries: any[]): string;
|
|
257
363
|
/**
|
|
258
364
|
* Compiler primitive — serializes an attribute for SSR output. Not meant
|
|
259
365
|
* for hand-written code.
|
|
@@ -277,10 +383,11 @@ export declare function ssrHydrationKey(): string;
|
|
|
277
383
|
* Not meant for hand-written code.
|
|
278
384
|
* @internal
|
|
279
385
|
*/
|
|
280
|
-
export declare function resolveSSRNode(node: any, result?: any, top?: boolean): any;
|
|
386
|
+
export declare function resolveSSRNode(node: any, result?: any, top?: boolean, nested?: boolean): any;
|
|
281
387
|
/**
|
|
282
388
|
* Escapes a string for safe inclusion in HTML output. Used by the SSR
|
|
283
389
|
* runtime; not generally part of user code.
|
|
284
390
|
* @internal
|
|
285
391
|
*/
|
|
286
392
|
export declare function escape(s: any, attr?: boolean): any;
|
|
393
|
+
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;
|