@timber-js/app 0.2.0-alpha.219 → 0.2.0-alpha.220
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/dist/_chunks/chains-CDK1AWZQ.js +1 -0
- package/dist/_chunks/{chains-YKZ8WpIW.js → chains-e_Buf9vg.js} +2 -7
- package/dist/_chunks/{chains-YKZ8WpIW.js.map → chains-e_Buf9vg.js.map} +1 -1
- package/dist/_chunks/{cli-check-D2WtbNqo.js → cli-check-DDwCkeDY.js} +2 -2
- package/dist/_chunks/{cli-check-D2WtbNqo.js.map → cli-check-DDwCkeDY.js.map} +1 -1
- package/dist/_chunks/cli-context-BJQB6rtF.js +1 -0
- package/dist/_chunks/{cli-context-By7k2xVo.js → cli-context-_mPttGGY.js} +3 -3
- package/dist/_chunks/{cli-context-By7k2xVo.js.map → cli-context-_mPttGGY.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-CySLKrO3.js → cli-schema-sync-BdIebmk3.js} +3 -12
- package/dist/_chunks/{cli-schema-sync-CySLKrO3.js.map → cli-schema-sync-BdIebmk3.js.map} +1 -1
- package/dist/_chunks/cli-schema-sync-CLNfXQDK.js +1 -0
- package/dist/_chunks/dev-server-DkytOEG2.js +1 -0
- package/dist/_chunks/{dev-server-B8zsT-ee.js → dev-server-DnODXuNM.js} +31 -14
- package/dist/_chunks/{dev-server-B8zsT-ee.js.map → dev-server-DnODXuNM.js.map} +1 -1
- package/dist/_chunks/flight-source-node-0dE-t3kq.js +519 -0
- package/dist/_chunks/flight-source-node-0dE-t3kq.js.map +1 -0
- package/dist/_chunks/{live-graph-BhtrZpRd.js → live-graph-tSWrv8eH.js} +2 -2
- package/dist/_chunks/{live-graph-BhtrZpRd.js.map → live-graph-tSWrv8eH.js.map} +1 -1
- package/dist/_chunks/node-response-Dibufw_b.js +187 -0
- package/dist/_chunks/node-response-Dibufw_b.js.map +1 -0
- package/dist/_chunks/{plugin-context-BPBPc3lL.js → plugin-context-DxMMvjUt.js} +2 -18
- package/dist/_chunks/{plugin-context-BPBPc3lL.js.map → plugin-context-DxMMvjUt.js.map} +1 -1
- package/dist/_chunks/plugin-context-uDHFqHHJ.js +1 -0
- package/dist/_chunks/{walkers-Ber9bamD.js → walkers-qu8TpiLh.js} +2 -2
- package/dist/_chunks/{walkers-Ber9bamD.js.map → walkers-qu8TpiLh.js.map} +1 -1
- package/dist/adapters/nitro-preview.d.ts.map +1 -1
- package/dist/adapters/nitro.js +40 -1
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/analyze/crawl-entry.js +2 -2
- package/dist/analyze/graph-command.js +3 -3
- package/dist/analyze/graph-command.js.map +1 -1
- package/dist/cli.js +5 -5
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-entry/form-state.d.ts.map +1 -1
- package/dist/client/browser-entry/index.d.ts +1 -1
- package/dist/client/browser-entry/rsc-stream.d.ts +4 -1
- package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -1
- package/dist/client/react-root.d.ts +6 -0
- package/dist/client/react-root.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -5
- package/dist/index.js.map +1 -1
- package/dist/plugins/encryption-runtime.d.ts +13 -0
- package/dist/plugins/encryption-runtime.d.ts.map +1 -0
- package/dist/plugins/entries.d.ts +1 -0
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/server-bundle.d.ts +1 -1
- package/dist/plugins/server-bundle.d.ts.map +1 -1
- package/dist/routing/index.js +1 -1
- package/dist/rsc-runtime/encryption-runtime.d.ts +25 -0
- package/dist/rsc-runtime/encryption-runtime.d.ts.map +1 -0
- package/dist/rsc-runtime/render-flight.d.ts +14 -0
- package/dist/rsc-runtime/render-flight.d.ts.map +1 -0
- package/dist/rsc-runtime/rsc.d.ts +6 -2
- package/dist/rsc-runtime/rsc.d.ts.map +1 -1
- package/dist/rsc-runtime/ssr.d.ts +6 -12
- package/dist/rsc-runtime/ssr.d.ts.map +1 -1
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/compress.d.ts +2 -0
- package/dist/server/compress.d.ts.map +1 -1
- package/dist/server/deny-renderer.d.ts +2 -1
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/flight-injector-core.d.ts +125 -0
- package/dist/server/flight-injector-core.d.ts.map +1 -0
- package/dist/server/flight-scripts.d.ts +9 -0
- package/dist/server/flight-scripts.d.ts.map +1 -1
- package/dist/server/flight-source-node.d.ts +105 -0
- package/dist/server/flight-source-node.d.ts.map +1 -0
- package/dist/server/flight-source.d.ts +136 -0
- package/dist/server/flight-source.d.ts.map +1 -0
- package/dist/server/head-response.d.ts.map +1 -1
- package/dist/server/html-injector-core.d.ts +3 -91
- package/dist/server/html-injector-core.d.ts.map +1 -1
- package/dist/server/html-injectors.d.ts +5 -17
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/internal.js +78 -138
- package/dist/server/internal.js.map +1 -1
- package/dist/server/node-body-response.d.ts +55 -0
- package/dist/server/node-body-response.d.ts.map +1 -0
- package/dist/server/node-response.d.ts +62 -0
- package/dist/server/node-response.d.ts.map +1 -0
- package/dist/server/node-stream-transforms.d.ts +24 -21
- package/dist/server/node-stream-transforms.d.ts.map +1 -1
- package/dist/server/node-streams-platform.d.ts +21 -0
- package/dist/server/node-streams-platform.d.ts.map +1 -0
- package/dist/server/pipeline-helpers.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/prebuilt-runtime.d.ts +2 -3
- package/dist/server/prebuilt-runtime.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +4 -1
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-payload.d.ts +9 -6
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +9 -4
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts +2 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +2 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/ssr-bridge-types.d.ts +9 -4
- package/dist/server/ssr-bridge-types.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts +8 -5
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-render.d.ts +7 -16
- package/dist/server/ssr-render.d.ts.map +1 -1
- package/dist/server/stream-utils.d.ts +44 -10
- package/dist/server/stream-utils.d.ts.map +1 -1
- package/dist/shared/flight-base64.d.ts +13 -0
- package/dist/shared/flight-base64.d.ts.map +1 -0
- package/dist/shared/flight-segment.d.ts +18 -0
- package/dist/shared/flight-segment.d.ts.map +1 -0
- package/dist/shared/form-state-flight.d.ts +0 -4
- package/dist/shared/form-state-flight.d.ts.map +1 -1
- package/docs/learn/12-error-handling.mdx +1 -1
- package/package.json +1 -1
- package/src/adapters/nitro-preview.ts +39 -0
- package/src/client/browser-entry/form-state.ts +3 -2
- package/src/client/browser-entry/index.ts +14 -8
- package/src/client/browser-entry/rsc-stream.ts +14 -14
- package/src/client/react-root.ts +25 -2
- package/src/index.ts +2 -0
- package/src/plugins/encryption-runtime.ts +31 -0
- package/src/plugins/entries.ts +1 -1
- package/src/plugins/server-bundle.ts +17 -2
- package/src/rsc-runtime/encryption-runtime.ts +78 -0
- package/src/rsc-runtime/render-flight.ts +26 -0
- package/src/rsc-runtime/rsc.ts +7 -4
- package/src/rsc-runtime/ssr.ts +10 -48
- package/src/rsc-runtime/vendor-types.d.ts +31 -2
- package/src/server/action-handler.ts +43 -44
- package/src/server/compress.ts +49 -12
- package/src/server/deny-renderer.ts +14 -7
- package/src/server/flight-injector-core.ts +328 -0
- package/src/server/flight-scripts.ts +14 -2
- package/src/server/flight-source-node.ts +430 -0
- package/src/server/flight-source.ts +288 -0
- package/src/server/form-state-flight.ts +4 -4
- package/src/server/head-response.ts +6 -10
- package/src/server/html-injector-core.ts +24 -216
- package/src/server/html-injectors.ts +12 -71
- package/src/server/node-body-response.ts +236 -0
- package/src/server/node-response.ts +93 -0
- package/src/server/node-stream-transforms.ts +70 -53
- package/src/server/node-streams-platform.ts +23 -0
- package/src/server/pipeline-helpers.ts +3 -1
- package/src/server/pipeline.ts +14 -6
- package/src/server/prebuilt/capture-render.ts +5 -5
- package/src/server/prebuilt-runtime.ts +7 -10
- package/src/server/rsc-entry/error-renderer.ts +8 -4
- package/src/server/rsc-entry/index.ts +4 -2
- package/src/server/rsc-entry/render-route.ts +5 -2
- package/src/server/rsc-entry/rsc-payload.ts +52 -73
- package/src/server/rsc-entry/rsc-stream.ts +102 -106
- package/src/server/rsc-entry/ssr-bridge.ts +32 -10
- package/src/server/rsc-entry/ssr-renderer.ts +15 -18
- package/src/server/ssr-bridge-types.ts +10 -4
- package/src/server/ssr-entry.ts +56 -52
- package/src/server/ssr-render.ts +41 -76
- package/src/server/stream-utils.ts +125 -70
- package/src/shared/flight-base64.ts +23 -0
- package/src/shared/flight-segment.ts +35 -0
- package/src/shared/form-state-flight.ts +0 -15
- package/dist/_chunks/rolldown-runtime-D7D4PA-g.js +0 -13
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `NodeBodyResponse` — a `Response` whose body is a Node `Readable`, so a
|
|
3
|
+
* response built on Node streams reaches the socket without a Web Streams
|
|
4
|
+
* round trip (LOCAL-1475). Node only: loaded behind `nodeStreamsPlatform`.
|
|
5
|
+
*
|
|
6
|
+
* The status and headers are an ordinary `Response`'s. The body stays a Node
|
|
7
|
+
* stream until one of two things takes it:
|
|
8
|
+
*
|
|
9
|
+
* - **An adapter**, through `_toNodeResponse()` — srvx's protocol (nitro and
|
|
10
|
+
* the dev server send with srvx; nitro-preview's sender speaks it too). The
|
|
11
|
+
* stream is piped straight into `ServerResponse`.
|
|
12
|
+
* - **Web-API code** reading `body`, `text()`, `arrayBuffer()`, `clone()`, …
|
|
13
|
+
* The response then converts its body once, with `Readable.toWeb`, and
|
|
14
|
+
* behaves as a native `Response` from then on. Correct anywhere, so code
|
|
15
|
+
* that does not know about Node bodies keeps working; pipeline code on the
|
|
16
|
+
* hot path goes through `node-response.ts` instead, which never converts.
|
|
17
|
+
*
|
|
18
|
+
* Pattern from srvx's `NodeResponse` (`FastResponse`).
|
|
19
|
+
*
|
|
20
|
+
* Design doc: 02-rendering-pipeline.md §"Response Bodies on Node"
|
|
21
|
+
*/
|
|
22
|
+
import { Readable } from 'node:stream';
|
|
23
|
+
import { NODE_BODY, type NodeBodyOps } from './node-response.ts';
|
|
24
|
+
export declare class NodeBodyResponse extends Response {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(body: Readable, init?: ResponseInit);
|
|
27
|
+
get [NODE_BODY](): NodeBodyOps;
|
|
28
|
+
/**
|
|
29
|
+
* srvx's protocol for a response with a Node body: srvx pipes `body` into
|
|
30
|
+
* `ServerResponse` with `pipeline()`. Headers as a flat `[name, value, …]`
|
|
31
|
+
* list, as srvx's own `NodeResponse` returns them.
|
|
32
|
+
*/
|
|
33
|
+
_toNodeResponse(): {
|
|
34
|
+
status: number;
|
|
35
|
+
statusText: string;
|
|
36
|
+
headers: string[];
|
|
37
|
+
body: Readable | ReadableStream<Uint8Array> | null;
|
|
38
|
+
};
|
|
39
|
+
get body(): Response['body'];
|
|
40
|
+
get bodyUsed(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The other half of srvx's protocol: srvx/bun and srvx/deno send
|
|
43
|
+
* `res._response` for anything with `_toNodeResponse` (`toNativeResponse`),
|
|
44
|
+
* and their runtimes stream Web bodies natively. Converts once.
|
|
45
|
+
*/
|
|
46
|
+
get _response(): Response;
|
|
47
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
48
|
+
blob(): Promise<Blob>;
|
|
49
|
+
bytes(): Promise<Uint8Array<ArrayBuffer>>;
|
|
50
|
+
formData(): Promise<FormData>;
|
|
51
|
+
json(): Promise<unknown>;
|
|
52
|
+
text(): Promise<string>;
|
|
53
|
+
clone(): Response;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=node-body-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-body-response.d.ts","sourceRoot":"","sources":["../../src/server/node-body-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAoC,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAcjE,qBAAa,gBAAiB,SAAQ,QAAQ;;IAM5C,YAAY,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY,EAQ9C;IAgCD,IAAI,CAAC,SAAS,CAAC,IAAI,WAAW,CAqC7B;IAED;;;;OAIG;IACH,eAAe,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,IAAI,EAAE,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;KACpD,CASA;IAID,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE3B;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;;OAIG;IACH,IAAI,SAAS,IAAI,QAAQ,CAExB;IAED,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAElC;IAED,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpB;IAID,KAAK,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAIxC;IAED,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CAE5B;IAED,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAEvB;IAED,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAEtB;IAED,KAAK,IAAI,QAAQ,CAEhB;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responses with a Node body — the platform-neutral half.
|
|
3
|
+
*
|
|
4
|
+
* On Node, SSR's HTML and Flight payload bodies are Node `Readable`s. They
|
|
5
|
+
* travel the pipeline as a `NodeBodyResponse` (`node-body-response.ts`, Node
|
|
6
|
+
* only): a real `Response` whose body stays a Node stream until the adapter
|
|
7
|
+
* pipes it to the socket, so a response is never converted Node → Web → Node
|
|
8
|
+
* (LOCAL-1475). srvx (nitro, the dev server) and nitro-preview's sender take
|
|
9
|
+
* the Node body through `_toNodeResponse()`. Any code that reads the body
|
|
10
|
+
* through the Web API still works: the response then converts once.
|
|
11
|
+
*
|
|
12
|
+
* Pipeline code shared with Workers re-wraps, strips, or times a response
|
|
13
|
+
* through the helpers here, which ask the response itself to do the Node
|
|
14
|
+
* work, so this module never imports `node:stream`. A response is recognised
|
|
15
|
+
* by a `Symbol.for` brand, not `instanceof`: the RSC and SSR environments
|
|
16
|
+
* load separate copies of the class.
|
|
17
|
+
*
|
|
18
|
+
* Design doc: 02-rendering-pipeline.md §"Response Bodies on Node"
|
|
19
|
+
*/
|
|
20
|
+
import type { Duplex } from 'node:stream';
|
|
21
|
+
/** The brand a Node-body response carries, keyed by a registry symbol. */
|
|
22
|
+
export declare const NODE_BODY: unique symbol;
|
|
23
|
+
/**
|
|
24
|
+
* What a Node-body response can do with its body, for code that cannot import
|
|
25
|
+
* the class: platform-neutral modules, and the standalone `_compress.mjs`,
|
|
26
|
+
* which reaches these through the same registry symbol. Each one takes the
|
|
27
|
+
* body: the response it was called on no longer has one.
|
|
28
|
+
*/
|
|
29
|
+
export interface NodeBodyOps {
|
|
30
|
+
/**
|
|
31
|
+
* Whether the response still owns a body. False for a null-body status
|
|
32
|
+
* (204, 205, 304, …) and once the body was taken. Being branded says
|
|
33
|
+
* nothing about this — ask here instead of reading `.body`, which would
|
|
34
|
+
* convert it.
|
|
35
|
+
*/
|
|
36
|
+
readonly hasBody: boolean;
|
|
37
|
+
/** The same body under a new status and headers. */
|
|
38
|
+
rewrap(init: ResponseInit): Response;
|
|
39
|
+
/** Release the body unread (HEAD, a discarded document), aborting its producer. */
|
|
40
|
+
discard(): void;
|
|
41
|
+
/** The same body, reporting stream timing when it ends (detailed Server-Timing). */
|
|
42
|
+
timed(startTime: number): Response;
|
|
43
|
+
/**
|
|
44
|
+
* The body piped through `stream` (gzip), as a Node-body response under
|
|
45
|
+
* `init`. An error or destroy on either end tears down both.
|
|
46
|
+
*/
|
|
47
|
+
through(stream: Duplex, init: ResponseInit): Response;
|
|
48
|
+
}
|
|
49
|
+
/** The Node-body operations of `response`, or `null` for a Web-body response. */
|
|
50
|
+
export declare function nodeBodyOps(response: Response): NodeBodyOps | null;
|
|
51
|
+
/**
|
|
52
|
+
* `response`'s body under a new status and headers. A Node body moves to the
|
|
53
|
+
* new response without converting; a Web body is reused as is.
|
|
54
|
+
*/
|
|
55
|
+
export declare function withResponseInit(response: Response, init: ResponseInit): Response;
|
|
56
|
+
/**
|
|
57
|
+
* Release a response's body unread. A live producer (an SSR render, a Flight
|
|
58
|
+
* render) is behind it; dropping the reference without this leaks it for the
|
|
59
|
+
* lifetime of the render (design/13-security.md A4).
|
|
60
|
+
*/
|
|
61
|
+
export declare function discardResponseBody(response: Response): void;
|
|
62
|
+
//# sourceMappingURL=node-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-response.d.ts","sourceRoot":"","sources":["../../src/server/node-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,0EAA0E;AAC1E,eAAO,MAAM,SAAS,eAAyC,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oDAAoD;IACpD,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAC;IACrC,mFAAmF;IACnF,OAAO,IAAI,IAAI,CAAC;IAChB,oFAAoF;IACpF,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IACnC;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAC;CACvD;AAUD,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,CAElE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAEjF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAc5D"}
|
|
@@ -12,13 +12,16 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Architecture:
|
|
14
14
|
* renderToPipeableStream → pipe(errorHandler) → pipe(headInjector)
|
|
15
|
-
* → pipe(flightInjector) →
|
|
15
|
+
* → pipe(flightInjector) → NodeBodyResponse → adapter → socket
|
|
16
16
|
*
|
|
17
|
-
* All chunks stay in
|
|
18
|
-
*
|
|
17
|
+
* All chunks stay in Node streams to the socket: the document is a
|
|
18
|
+
* `NodeBodyResponse` (node-body-response.ts), which the adapter pipes into
|
|
19
|
+
* `ServerResponse` with no Web Streams round trip.
|
|
19
20
|
*/
|
|
20
21
|
import { PassThrough, Transform, type Readable } from 'node:stream';
|
|
21
|
-
import {
|
|
22
|
+
import { SUFFIX_BYTES } from './html-injector-core.ts';
|
|
23
|
+
import { type FlightInjectorOptions } from './flight-injector-core.ts';
|
|
24
|
+
import type { FlightSource } from './flight-source.ts';
|
|
22
25
|
export interface NodeBufferedTransformOptions {
|
|
23
26
|
/**
|
|
24
27
|
* Flush synchronously once the buffer reaches this many bytes.
|
|
@@ -71,11 +74,10 @@ export declare function createNodeHeadInjector(headHtml: string): Transform;
|
|
|
71
74
|
* HTML chunk) or `flush()` — never mid-tag. See design/02
|
|
72
75
|
* §"Scripts at Chunk Boundaries Only".
|
|
73
76
|
*
|
|
74
|
-
* The
|
|
75
|
-
*
|
|
76
|
-
* bridge point between Web Streams and Node.js streams in the pipeline.
|
|
77
|
+
* The inline Flight source is a Node `Readable` on Node (the tee'd branch
|
|
78
|
+
* of the Node Flight render), read by the core through `openFlightReader`.
|
|
77
79
|
*/
|
|
78
|
-
export declare function createNodeFlightInjector(
|
|
80
|
+
export declare function createNodeFlightInjector(rscSource: FlightSource | undefined, options?: FlightInjectorOptions): Transform;
|
|
79
81
|
/**
|
|
80
82
|
* Run the Node SSR post-processing pipeline with post-shell error handling.
|
|
81
83
|
*
|
|
@@ -86,20 +88,21 @@ export declare function createNodeFlightInjector(rscStream: ReadableStream<Uint8
|
|
|
86
88
|
* aborting the connection mid-body. Abort errors (client disconnect,
|
|
87
89
|
* render-timeout abort) close the output silently — no noindex, no log.
|
|
88
90
|
*
|
|
89
|
-
* Why this is a pump function and not a Transform stage (TIM-1019):
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* pipeline() call: the last stage pipes into it (pipe() ends the output
|
|
96
|
-
* on upstream success but leaves it open on upstream error), and the
|
|
97
|
-
* pipeline's rejection handler appends the noindex script.
|
|
91
|
+
* Why this is a pump function and not a Transform stage (TIM-1019): a
|
|
92
|
+
* failing stage takes the whole chain down, so a Transform *inside* it can
|
|
93
|
+
* never append bytes after a failure. The output PassThrough therefore lives
|
|
94
|
+
* outside the chain: the last stage pipes into it (pipe() ends the output on
|
|
95
|
+
* upstream success but leaves it open on upstream error), and the failure
|
|
96
|
+
* handler appends the noindex script.
|
|
98
97
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
98
|
+
* The stages are chained with `.pipe()` and wired by hand rather than with
|
|
99
|
+
* `stream.pipeline()`, as Next.js does: `pipeline()` allocates an
|
|
100
|
+
* AbortController and a premature-close error on every finish, a fixed cost
|
|
101
|
+
* that showed in profiles of small pages (LOCAL-1476). `pipe()` forwards
|
|
102
|
+
* neither errors nor early closes, so both are handled here: an error, or a
|
|
103
|
+
* stage closing before it ended, destroys every stage (tearing down Fizz and
|
|
104
|
+
* the Flight injector) and ends the output. A consumer that destroys the
|
|
105
|
+
* output before the end (client disconnect) destroys every stage too.
|
|
103
106
|
*/
|
|
104
107
|
export declare function runNodePipelineWithErrorHandling(source: Readable, transforms: readonly [Transform, ...Transform[]], signal?: AbortSignal, nonce?: string): PassThrough;
|
|
105
108
|
//# sourceMappingURL=node-stream-transforms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-stream-transforms.d.ts","sourceRoot":"","sources":["../../src/server/node-stream-transforms.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node-stream-transforms.d.ts","sourceRoot":"","sources":["../../src/server/node-stream-transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAEL,YAAY,EAOb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOvD,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,4BAAiC,GAAG,SAAS,CA2BjG;AAID;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,IAAI,SAAS,CAyBzD;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC;AAIxB;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CA2BlE;AAID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,YAAY,GAAG,SAAS,EACnC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,SAAS,CAkEX;AAID;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,QAAQ,EAChB,UAAU,EAAE,SAAS,CAAC,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC,EAChD,MAAM,CAAC,EAAE,WAAW,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,WAAW,CAgDb"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this runtime streams with native Node streams — the one probe every
|
|
3
|
+
* stream-kind decision reads: the Flight renderer (`rsc-runtime/rsc.ts`), the
|
|
4
|
+
* Flight source helpers (`flight-source.ts`), SSR's Flight decoder
|
|
5
|
+
* (`rsc-runtime/ssr.ts`), and SSR's HTML pipeline (`ssr-render.ts`,
|
|
6
|
+
* `ssr-entry.ts`). The RSC and SSR environments evaluate this module
|
|
7
|
+
* separately, and agree because it is a pure function of the runtime: a Node
|
|
8
|
+
* Flight source must only ever meet SSR's Node pipeline (TIM-1585).
|
|
9
|
+
*
|
|
10
|
+
* On Node, Bun, and Deno, `node:stream` is native. Cloudflare Workers with
|
|
11
|
+
* `nodejs_compat` also report `process.release.name === 'node'` (workerd's
|
|
12
|
+
* native `node:process`, compatibility dates from 2025 on), but implement
|
|
13
|
+
* `node:stream` in JS on top of Web Streams, which are the native path there;
|
|
14
|
+
* workerd identifies itself through `navigator.userAgent`.
|
|
15
|
+
*
|
|
16
|
+
* No other runtime check may decide a stream kind. Loading the Node entries
|
|
17
|
+
* on a runtime this accepts is not optional: an import failure is a build or
|
|
18
|
+
* install bug, and fails loudly where the import happens.
|
|
19
|
+
*/
|
|
20
|
+
export declare const nodeStreamsPlatform: boolean;
|
|
21
|
+
//# sourceMappingURL=node-streams-platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-streams-platform.d.ts","sourceRoot":"","sources":["../../src/server/node-streams-platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAGmD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-helpers.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAsC,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAuC,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline-helpers.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAsC,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE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OG;IACH,KAAK,CAAC,EAAE,UAAU,KACf,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,CAAC,EAAE,CACf,GAAG,EAAE,OAAO,EACZ,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,QAAQ,CAAC,KACnE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,wEAAwE;IACxE,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAID;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CA8R1F"}
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
* signals, Suspense, and error boundaries behave exactly as an unwrapped
|
|
33
33
|
* component. `fallbackOnMissingSegmentParams: false` throws instead.
|
|
34
34
|
*/
|
|
35
|
+
import { type RenderFlight } from './flight-source.ts';
|
|
35
36
|
/**
|
|
36
37
|
* Set the timeout for component re-render captures. Called at boot from
|
|
37
38
|
* the RSC entry with renderTimeoutMs from timber.config.ts.
|
|
@@ -80,9 +81,7 @@ export interface PrebuiltRegistration {
|
|
|
80
81
|
}
|
|
81
82
|
interface RscFunctions {
|
|
82
83
|
createFromReadableStream: (stream: ReadableStream<Uint8Array>) => Promise<unknown>;
|
|
83
|
-
|
|
84
|
-
onError?: (error: unknown) => string;
|
|
85
|
-
}) => ReadableStream<Uint8Array>;
|
|
84
|
+
renderFlight: RenderFlight;
|
|
86
85
|
}
|
|
87
86
|
/**
|
|
88
87
|
* Wire the RSC flight client/server functions. Called once at server
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prebuilt-runtime.d.ts","sourceRoot":"","sources":["../../src/server/prebuilt-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"prebuilt-runtime.d.ts","sourceRoot":"","sources":["../../src/server/prebuilt-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAoCH,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAkB3E;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGlE;AAYD;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;IACjE,2EAA2E;IAC3E,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;;OAIG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED,2DAA2D;AAE3D,KAAK,eAAe,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC;AAY/C,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,EAAE,wBAAwB,CAAC;CACnC;AA0GD,UAAU,YAAY;IACpB,wBAAwB,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnF,YAAY,EAAE,YAAY,CAAC;CAC5B;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAEvD;AA4YD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,eAAe,EAClD,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,CAAC,EACZ,OAAO,GAAE,wBAA6B,GACrC,CAAC,CAoEH;AAED,qDAAqD;AACrD,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAEpF;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,IAAI,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAE/E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,eAAe,EACrD,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,EACZ,OAAO,GAAE,wBAA6B,GACrC,CAAC,CAmCH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AA+ClE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAEjD;AAgVD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAInE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAItE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,wBAAwB,EAAE,cAAc,GACvD,OAAO,CAAC,OAAO,wBAAwB,EAAE,cAAc,CAAC,CAE1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,wBAAwB,EAAE,uBAAuB,GAChE,OAAO,CAAC,OAAO,wBAAwB,EAAE,uBAAuB,CAAC,CAQnE;8BAyCoB,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC"}
|
|
@@ -31,7 +31,10 @@ export interface RenderRouteDeps {
|
|
|
31
31
|
clientSegmentCache: boolean;
|
|
32
32
|
renderDenyFallback: DenyFallbackRenderer;
|
|
33
33
|
buildManifest: BuildManifest;
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The resolved `renderTimeoutMs`: bounds the page's Flight render (on Node)
|
|
36
|
+
* and encoding a no-JS form state.
|
|
37
|
+
*/
|
|
35
38
|
renderTimeoutMs: number;
|
|
36
39
|
globalError?: {
|
|
37
40
|
load: () => Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-route.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/render-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAS1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAQ/D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB,EAAE,oBAAoB,CAAC;IACzC,aAAa,EAAE,aAAa,CAAC;IAC7B
|
|
1
|
+
{"version":3,"file":"render-route.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/render-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAS1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAQ/D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB,EAAE,oBAAoB,CAAC;IACzC,aAAa,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,OAAO,EACxB,IAAI,EAAE,eAAe,EACrB,YAAY,CAAC,EAAE,mBAAmB,GACjC,OAAO,CAAC,QAAQ,CAAC,CAwKnB"}
|
|
@@ -22,14 +22,17 @@ import type { LayoutComponentEntry } from '../route-element-builder.ts';
|
|
|
22
22
|
import type { ManifestSegmentNode } from '../route-matcher.ts';
|
|
23
23
|
import type { SlotSkipEntry } from '../slot-resolver.ts';
|
|
24
24
|
import type { RenderSignals } from './render-signals.ts';
|
|
25
|
+
import { type FlightSource } from '../flight-source.ts';
|
|
25
26
|
/**
|
|
26
27
|
* Build an RSC payload Response for a client-side navigation request.
|
|
27
28
|
*
|
|
28
|
-
*
|
|
29
|
-
* Async components throw during stream consumption, not
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* Waits for the first chunk of the Flight source before committing headers.
|
|
30
|
+
* Async components throw during stream consumption, not when the render
|
|
31
|
+
* starts. Waiting for one chunk lets the initial component tree render,
|
|
32
|
+
* allowing onError to capture DenySignal/RedirectSignal before we commit the
|
|
33
|
+
* response. See TIM-344. The chunk is not consumed (`peekFlight`): on Node
|
|
34
|
+
* it stays in the source, which becomes the response through `flightResponse`
|
|
35
|
+
* — a Node body, piped to the socket as is.
|
|
33
36
|
*
|
|
34
37
|
* The commit point is the close of Flight's opening window: the first chunk
|
|
35
38
|
* plus one macrotask turn. Nothing is held for it. A signal that lands
|
|
@@ -45,5 +48,5 @@ import type { RenderSignals } from './render-signals.ts';
|
|
|
45
48
|
* the payload path pretend to a status contract it could not keep for
|
|
46
49
|
* nested components, and was removed in TIM-1495.
|
|
47
50
|
*/
|
|
48
|
-
export declare function buildRscPayloadResponse(rscStream:
|
|
51
|
+
export declare function buildRscPayloadResponse(rscStream: FlightSource, signals: RenderSignals, segments: ManifestSegmentNode[], layoutComponents: LayoutComponentEntry[], responseHeaders: Headers, skippedSegments?: string[], slotSkipInfo?: SlotSkipEntry[]): Promise<Response>;
|
|
49
52
|
//# sourceMappingURL=rsc-payload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-payload.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/rsc-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"rsc-payload.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/rsc-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAW7B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,gBAAgB,EAAE,oBAAoB,EAAE,EACxC,eAAe,EAAE,OAAO,EACxB,eAAe,CAAC,EAAE,MAAM,EAAE,EAC1B,YAAY,CAAC,EAAE,aAAa,EAAE,GAC7B,OAAO,CAAC,QAAQ,CAAC,CAyLnB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RSC Stream Renderer — Creates the RSC Flight stream with signal tracking.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Renders through `renderFlight` (`rsc-runtime/rsc.ts`) and captures
|
|
5
5
|
* render-phase signals (DenySignal, RedirectSignal) thrown by
|
|
6
6
|
* components during streaming. These signals are tracked in a shared
|
|
7
7
|
* read-only `RenderSignals` object so the caller can decide the HTTP response.
|
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
* Design docs: 02-rendering-pipeline.md §"Single-Pass Rendering",
|
|
10
10
|
* 13-security.md §"Errors don't leak"
|
|
11
11
|
*/
|
|
12
|
+
import type { FlightSource } from '../flight-source.ts';
|
|
12
13
|
import type { RscPayloadRoot } from '../../shared/payload-root.ts';
|
|
13
14
|
import { type DenyPageEntry } from '../deny-boundary.ts';
|
|
14
15
|
import { type RenderSignals } from './render-signals.ts';
|
|
15
16
|
export interface RscStreamResult {
|
|
16
|
-
rscStream:
|
|
17
|
+
rscStream: FlightSource;
|
|
17
18
|
signals: RenderSignals;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
|
-
* Render a payload root (tree plus its params) to
|
|
21
|
+
* Render a payload root (tree plus its params) to a Flight source.
|
|
21
22
|
*
|
|
22
23
|
* The stream serializes server components as rendered output and client
|
|
23
24
|
* components ("use client") as serialized references with module ID + export name.
|
|
@@ -26,6 +27,10 @@ export interface RscStreamResult {
|
|
|
26
27
|
* handle. Every one arrives through `onError`, never as a throw from this
|
|
27
28
|
* call: Flight starts rendering in a microtask after the stream is created,
|
|
28
29
|
* so even a component that throws synchronously is reported asynchronously.
|
|
30
|
+
*
|
|
31
|
+
* The render is aborted when the client disconnects and, on Node, once
|
|
32
|
+
* `renderTimeoutMs` passes with it still running (design/02 §"Always Wire
|
|
33
|
+
* abort() to Both Request Signal AND Timeout").
|
|
29
34
|
*/
|
|
30
|
-
export declare function renderRscStream(payload: RscPayloadRoot, req: Request, leafDenyChain?: DenyPageEntry[]): RscStreamResult;
|
|
35
|
+
export declare function renderRscStream(payload: RscPayloadRoot, req: Request, renderTimeoutMs: number, leafDenyChain?: DenyPageEntry[]): RscStreamResult;
|
|
31
36
|
//# sourceMappingURL=rsc-stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-stream.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/rsc-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKnE,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQ3E,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG/E,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"rsc-stream.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/rsc-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKnE,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQ3E,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG/E,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,YAAY,CAAC;IACxB,OAAO,EAAE,aAAa,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,OAAO,EACZ,eAAe,EAAE,MAAM,EACvB,aAAa,CAAC,EAAE,aAAa,EAAE,GAC9B,eAAe,CAuGjB"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Vite module graphs; `NavContext` is the serializable contract that crosses
|
|
6
6
|
* the boundary. See `../ssr-bridge-types.ts` for the contract definition.
|
|
7
7
|
*/
|
|
8
|
+
import type { FlightSource } from '../flight-source.ts';
|
|
8
9
|
import type { NavContext, SsrRenderResult } from '../ssr-bridge-types.ts';
|
|
9
|
-
export declare function callSsr(
|
|
10
|
+
export declare function callSsr(rscSource: FlightSource, navContext: NavContext): Promise<SsrRenderResult>;
|
|
10
11
|
//# sourceMappingURL=ssr-bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-bridge.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/ssr-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"ssr-bridge.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/ssr-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAmC1E,wBAAsB,OAAO,CAC3B,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,eAAe,CAAC,CAE1B"}
|
|
@@ -18,6 +18,7 @@ import type { ManifestSegmentNode } from '../route-matcher.ts';
|
|
|
18
18
|
import type { SlotSkipEntry } from '../slot-resolver.ts';
|
|
19
19
|
import { type GlobalErrorFile } from './error-renderer.ts';
|
|
20
20
|
import type { RenderSignals } from './render-signals.ts';
|
|
21
|
+
import { type FlightSource } from '../flight-source.ts';
|
|
21
22
|
/**
|
|
22
23
|
* Test-only observable: records how many microtask yields were consumed
|
|
23
24
|
* during the last signal promotion check. Import this in tests to assert
|
|
@@ -47,7 +48,7 @@ export declare const __test_only_signalPromotionCapHit: {
|
|
|
47
48
|
};
|
|
48
49
|
interface SsrRenderOptions {
|
|
49
50
|
req: Request;
|
|
50
|
-
rscStream:
|
|
51
|
+
rscStream: FlightSource;
|
|
51
52
|
signals: RenderSignals;
|
|
52
53
|
segments: ManifestSegmentNode[];
|
|
53
54
|
layoutComponents: LayoutComponentEntry[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-renderer.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/ssr-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAMlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA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,KAAK,EAAE,UAAU,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6QjF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This file defines what crosses the RSC ↔ SSR environment boundary: the
|
|
5
5
|
* `NavContext` input and the `SsrRenderResult` output. The RSC
|
|
6
|
-
* environment calls `handleSsr(
|
|
6
|
+
* environment calls `handleSsr(rscSource, navContext)`
|
|
7
7
|
* in the SSR environment via `import.meta.viteRsc.import(...)` (see
|
|
8
8
|
* `rsc-entry/ssr-bridge.ts`). RSC and SSR are separate Vite module graphs
|
|
9
9
|
* with separate module instances, so every per-request field that SSR
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
*
|
|
24
24
|
* 1. **Structurally serializable shape.** Fields must be values that can
|
|
25
25
|
* cross the environment boundary as plain data or as platform-neutral
|
|
26
|
-
* primitives (`Headers`, `ReadableStream`, `AbortSignal`, `Map
|
|
26
|
+
* primitives (`Headers`, `ReadableStream`, `AbortSignal`, `Map`, and a
|
|
27
|
+
* `FlightSource`'s Node `Readable` — both environments share a process). Do
|
|
27
28
|
* not add closures, class instances tied to RSC-only modules, or
|
|
28
29
|
* anything whose identity must be preserved across the bridge. The one
|
|
29
30
|
* sanctioned exception is `NavContext.getHeadSegmentScript`.
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
* See `design/02-rendering-pipeline.md` §"RSC → SSR → Client Hydration"
|
|
50
51
|
* and `CLAUDE.md` §"RSC and SSR Are Separate Vite Environments".
|
|
51
52
|
*/
|
|
53
|
+
import type { FlightSource } from './flight-source.ts';
|
|
52
54
|
/**
|
|
53
55
|
* Navigation context passed from the RSC environment to SSR.
|
|
54
56
|
*
|
|
@@ -88,8 +90,11 @@ export interface NavContext {
|
|
|
88
90
|
* See design/13-security.md §"Content Security Policy" (TIM-1414).
|
|
89
91
|
*/
|
|
90
92
|
nonce?: string;
|
|
91
|
-
/**
|
|
92
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The tee'd Flight source inlined into the HTML for client-side hydration.
|
|
95
|
+
* A Node stream on Node, a Web stream elsewhere (`flight-source.ts`).
|
|
96
|
+
*/
|
|
97
|
+
rscStream?: FlightSource;
|
|
93
98
|
/** Max Suspense hold window (ms). SSR delays the first flush by this
|
|
94
99
|
* duration, racing allReady so that fast-resolving boundaries render inline
|
|
95
100
|
* without ever showing a fallback. Derived from route `deferSuspenseFor` exports.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-bridge-types.d.ts","sourceRoot":"","sources":["../../src/server/ssr-bridge-types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ssr-bridge-types.d.ts","sourceRoot":"","sources":["../../src/server/ssr-bridge-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;OAUG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB;;;0DAGsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;iFAE6E;IAC7E,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;4DACwD;IACxD,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;;;;;;;;;;;;;;;OAiBG;IACH,oBAAoB,CAAC,EAAE,MAAM,MAAM,CAAC;IAEpC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,UAAU,CAAC;IACpB;;;;;;;;;;;;;;;;OAgBG;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
* Design docs: 18-build-system.md §"Entry Files", 02-rendering-pipeline.md
|
|
13
13
|
*/
|
|
14
14
|
import type { NavContext, SsrRenderResult } from './ssr-bridge-types.ts';
|
|
15
|
+
import type { FlightSource } from './flight-source.ts';
|
|
15
16
|
/**
|
|
16
|
-
* Handle SSR: decode
|
|
17
|
+
* Handle SSR: decode a Flight source and render it to hydration-ready HTML.
|
|
17
18
|
*
|
|
18
19
|
* Steps:
|
|
19
|
-
* 1. Decode the
|
|
20
|
-
* (
|
|
20
|
+
* 1. Decode the Flight source into a React element tree via createFromNodeStream
|
|
21
|
+
* (Node) or createFromReadableStream (Workers), resolving "use client"
|
|
22
|
+
* references to actual component modules for SSR
|
|
21
23
|
* 2. Render the decoded tree to HTML via renderToReadableStream (streaming)
|
|
22
24
|
* 3. Wait for onShellReady before flushing (handled by renderSsrStream)
|
|
23
25
|
* 4. Inject metadata into <head> and client scripts before </body>
|
|
@@ -32,10 +34,11 @@ import type { NavContext, SsrRenderResult } from './ssr-bridge-types.ts';
|
|
|
32
34
|
* the deny page. For deny() inside Suspense, the shell
|
|
33
35
|
* succeeds and the error streams as a React error boundary after flush.
|
|
34
36
|
*
|
|
35
|
-
* @param
|
|
37
|
+
* @param rscSource - The Flight source from the RSC environment: a Node stream
|
|
38
|
+
* on Node, a Web stream elsewhere, matching the HTML pipeline SSR runs
|
|
36
39
|
* @param navContext - Per-request state passed across RSC→SSR boundary
|
|
37
40
|
* @returns The HTML Response with hydration markers, plus SSR diagnostics
|
|
38
41
|
*/
|
|
39
|
-
export declare function handleSsr(
|
|
42
|
+
export declare function handleSsr(rscSource: FlightSource, navContext: NavContext): Promise<SsrRenderResult>;
|
|
40
43
|
export default handleSsr;
|
|
41
44
|
//# sourceMappingURL=ssr-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-entry.d.ts","sourceRoot":"","sources":["../../src/server/ssr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"ssr-entry.d.ts","sourceRoot":"","sources":["../../src/server/ssr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4BH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA4CvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,eAAe,CAAC,CAkN1B;eAEc,SAAS"}
|
|
@@ -49,7 +49,7 @@ export interface SsrStreamOptions {
|
|
|
49
49
|
* Render a React element tree to a ReadableStream of HTML.
|
|
50
50
|
*
|
|
51
51
|
* Automatically selects the optimal rendering path for the platform:
|
|
52
|
-
* - Node.js/Bun: `renderToPipeableStream` → Node.js native streams
|
|
52
|
+
* - Node.js/Bun: `renderToPipeableStream` → Node.js native streams (a `NodeBodyResponse`)
|
|
53
53
|
* - CF Workers/Edge: `renderToReadableStream` → native Web Streams
|
|
54
54
|
*
|
|
55
55
|
* The returned stream begins yielding after onShellReady — everything
|
|
@@ -66,12 +66,9 @@ export declare const useNodeStreams: boolean;
|
|
|
66
66
|
* Render via renderToPipeableStream, returning a Node.js Readable.
|
|
67
67
|
*
|
|
68
68
|
* The entire HTML rendering + post-processing pipeline stays in native
|
|
69
|
-
* Node.js streams (
|
|
70
|
-
* at the very end for the Response body.
|
|
69
|
+
* Node.js streams, to the socket (node-body-response.ts).
|
|
71
70
|
*/
|
|
72
71
|
export declare function renderSsrNodeStream(element: ReactNode, options?: SsrStreamOptions): Promise<import('node:stream').Readable>;
|
|
73
|
-
/** Convert a Node.js Readable to a Web ReadableStream (zero-copy bridge). */
|
|
74
|
-
export declare function nodeReadableToWeb(readable: import('node:stream').Readable): ReadableStream<Uint8Array>;
|
|
75
72
|
/**
|
|
76
73
|
* Wrap an HTML stream with error handling for the streaming phase.
|
|
77
74
|
*
|
|
@@ -88,16 +85,10 @@ export declare function nodeReadableToWeb(readable: import('node:stream').Readab
|
|
|
88
85
|
/** @internal Exported for testing only. */
|
|
89
86
|
export declare function wrapStreamWithErrorHandling(stream: ReadableStream<Uint8Array>, signal?: AbortSignal, nonce?: string): ReadableStream<Uint8Array>;
|
|
90
87
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* element is `<html>`, so no framework-level doctype prepending is needed.
|
|
96
|
-
*
|
|
97
|
-
* Sets content-type to text/html if not already set by middleware. The
|
|
98
|
-
* default goes on a response-local copy: `responseHeaders` is the
|
|
99
|
-
* pipeline's shared bag, handed over on `NavContext`, and SSR only reads
|
|
100
|
-
* it (design/49 §"A2").
|
|
88
|
+
* Status and headers for an SSR document: the pipeline's headers, copied (SSR
|
|
89
|
+
* never writes through `NavContext.responseHeaders`), with an HTML content
|
|
90
|
+
* type unless the app set one. The Node pipeline sends its body as a
|
|
91
|
+
* `NodeBodyResponse`; the Web pipeline as a `Response`.
|
|
101
92
|
*/
|
|
102
|
-
export declare function
|
|
93
|
+
export declare function ssrResponseInit(statusCode: number, responseHeaders: Headers): ResponseInit;
|
|
103
94
|
//# sourceMappingURL=ssr-render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-render.d.ts","sourceRoot":"","sources":["../../src/server/ssr-render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ssr-render.d.ts","sourceRoot":"","sources":["../../src/server/ssr-render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwEvD,8EAA8E;AAC9E,MAAM,W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