@vitejs/plugin-rsc 0.5.27 → 0.5.29
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 +44 -18
- package/dist/browser.d.ts +3 -3
- package/dist/{cjs-BspwazE6.js → cjs-Cxg_7upE.js} +3 -3
- package/dist/client-Bhch3O41.d.ts +19 -0
- package/dist/client-reference-CCekXxax.js +16 -0
- package/dist/client-reference-DT0MYgPn.d.ts +8 -0
- package/dist/core/browser.d.ts +1 -1
- package/dist/core/browser.js +2 -2
- package/dist/core/plugin.d.ts +0 -1
- package/dist/core/rsc.d.ts +2 -20
- package/dist/core/rsc.js +20 -4
- package/dist/core/ssr.d.ts +1 -2
- package/dist/core/ssr.js +2 -2
- package/dist/{encryption-utils-CRBgMeBq.js → encryption-utils-BNbYHtC4.js} +1 -1
- package/dist/{index-DViteJjw.d.ts → index-BjJe9jqG.d.ts} +35 -12
- package/dist/{index-BrXJaflA.d.ts → index-C5IY2S-e.d.ts} +16 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{picocolors-CEw5D0BV.js → picocolors-nYPB6lHj.js} +4 -2
- package/dist/{plugin-Bm-Fb4g7.d.ts → plugin-CaLiN8ED.d.ts} +71 -64
- package/dist/{plugin-BK29Va7z.js → plugin-DPZnhMn5.js} +30 -15
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.js +1 -1
- package/dist/plugins/cjs.d.ts +0 -1
- package/dist/plugins/cjs.js +1 -1
- package/dist/react/browser.d.ts +2 -3
- package/dist/react/rsc/client.d.ts +2 -0
- package/dist/react/rsc/client.js +16 -0
- package/dist/react/rsc/server.d.ts +3 -0
- package/dist/react/rsc/server.js +20 -0
- package/dist/react/rsc/static.d.ts +6 -0
- package/dist/react/rsc/static.js +8 -0
- package/dist/react/rsc.d.ts +3 -24
- package/dist/react/rsc.js +3 -31
- package/dist/react/ssr.d.ts +4 -3
- package/dist/react/ssr.js +3 -1
- package/dist/rsc/client.d.ts +2 -0
- package/dist/rsc/client.js +3 -0
- package/dist/rsc/server.d.ts +12 -0
- package/dist/rsc/server.js +10 -0
- package/dist/rsc/static.d.ts +11 -0
- package/dist/rsc/static.js +9 -0
- package/dist/rsc-C3UdJLOW.d.ts +20 -0
- package/dist/rsc.d.ts +4 -16
- package/dist/rsc.js +4 -41
- package/dist/{scope-Bwt9GVLP.js → scope-Do08R7C2.js} +1 -1
- package/dist/server-ZBjqNTqU.d.ts +13 -0
- package/dist/shared-D42sHPD1.js +25 -0
- package/dist/{shared-BVLpj0Y8.js → shared-Y4B6DJ99.js} +2 -1
- package/dist/ssr.d.ts +12 -12
- package/dist/ssr.js +12 -7
- package/dist/transforms/index.d.ts +1 -1
- package/dist/transforms/index.js +39 -28
- package/dist/utils/encryption-runtime.js +5 -5
- package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.development.js +2 -2
- package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.development.js +29 -29
- package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.production.js +26 -29
- package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.development.js +31 -31
- package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.production.js +30 -33
- package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.development.js +101 -64
- package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.production.js +99 -62
- package/dist/vendor/react-server-dom/package.json +5 -5
- package/package.json +11 -11
- /package/dist/{browser-C_qguV-a.d.ts → browser-DI_Wyg5Y.d.ts} +0 -0
- /package/dist/{dist-rz-Bnebz.js → dist-uqdtSkzK.js} +0 -0
- /package/dist/{shared-DeahDSXi.js → shared-B6H2TbnP.js} +0 -0
package/README.md
CHANGED
|
@@ -444,14 +444,41 @@ export default defineConfig({
|
|
|
444
444
|
|
|
445
445
|
## RSC runtime (react-server-dom) API
|
|
446
446
|
|
|
447
|
-
### `@vitejs/plugin-rsc/rsc`
|
|
447
|
+
### `@vitejs/plugin-rsc/rsc/server`
|
|
448
448
|
|
|
449
|
-
This module
|
|
449
|
+
This module provides Vite-integrated RSC runtime APIs based on
|
|
450
|
+
`react-server-dom/server.edge` for use in the RSC environment:
|
|
450
451
|
|
|
451
452
|
- `renderToReadableStream`: RSC serialization (React VDOM -> RSC stream)
|
|
452
|
-
- `
|
|
453
|
-
- `
|
|
454
|
-
- `
|
|
453
|
+
- `decodeAction/decodeReply/decodeFormState/loadServerAction`
|
|
454
|
+
- `registerClientReference/registerServerReference`
|
|
455
|
+
- `createTemporaryReferenceSet`
|
|
456
|
+
|
|
457
|
+
### `@vitejs/plugin-rsc/rsc/static`
|
|
458
|
+
|
|
459
|
+
This module provides a Vite-integrated RSC runtime API based on
|
|
460
|
+
`react-server-dom/static.edge` for use in the RSC environment:
|
|
461
|
+
|
|
462
|
+
- `prerender`: static RSC serialization (React VDOM -> RSC stream)
|
|
463
|
+
|
|
464
|
+
`prerender` supports the same Vite-specific `onClientReference` extension as
|
|
465
|
+
`renderToReadableStream`.
|
|
466
|
+
|
|
467
|
+
### `@vitejs/plugin-rsc/rsc/client`
|
|
468
|
+
|
|
469
|
+
This module provides Vite-integrated RSC runtime APIs based on
|
|
470
|
+
`react-server-dom/client.edge` for use in the RSC environment:
|
|
471
|
+
|
|
472
|
+
- `createFromReadableStream`: RSC deserialization (RSC stream -> React VDOM)
|
|
473
|
+
- `encodeReply`
|
|
474
|
+
- `createClientTemporaryReferenceSet`
|
|
475
|
+
|
|
476
|
+
Together, these APIs allow a React VDOM to be serialized, saved as an RSC stream, and later deserialized within the same `rsc` environment.
|
|
477
|
+
|
|
478
|
+
### `@vitejs/plugin-rsc/rsc`
|
|
479
|
+
|
|
480
|
+
This module re-exports `@vitejs/plugin-rsc/rsc/server` and
|
|
481
|
+
`@vitejs/plugin-rsc/rsc/client`.
|
|
455
482
|
|
|
456
483
|
#### Vite-specific extension: `renderToReadableStream` (experimental)
|
|
457
484
|
|
|
@@ -479,17 +506,23 @@ function renderToReadableStream<T>(
|
|
|
479
506
|
|
|
480
507
|
### `@vitejs/plugin-rsc/ssr`
|
|
481
508
|
|
|
482
|
-
This module
|
|
509
|
+
This module provides Vite-integrated RSC runtime APIs based on
|
|
510
|
+
`react-server-dom/client.edge` for use in the SSR environment:
|
|
483
511
|
|
|
484
|
-
- `createFromReadableStream`:
|
|
512
|
+
- `createFromReadableStream`: Deserializes an RSC stream into a React VDOM
|
|
513
|
+
- `encodeReply`: Serializes server function arguments
|
|
514
|
+
- `createTemporaryReferenceSet`: Creates a temporary reference set shared by deserialization and reply serialization
|
|
485
515
|
|
|
486
516
|
### `@vitejs/plugin-rsc/browser`
|
|
487
517
|
|
|
488
|
-
This module
|
|
518
|
+
This module provides Vite-integrated RSC runtime APIs based on
|
|
519
|
+
`react-server-dom/client.browser` for use in the browser environment:
|
|
489
520
|
|
|
490
|
-
- `createFromReadableStream`:
|
|
491
|
-
- `createFromFetch`:
|
|
492
|
-
- `encodeReply
|
|
521
|
+
- `createFromReadableStream`: Deserializes an RSC stream into a React VDOM
|
|
522
|
+
- `createFromFetch`: Deserializes an RSC response from a fetch promise
|
|
523
|
+
- `encodeReply`: Serializes server function arguments
|
|
524
|
+
- `createTemporaryReferenceSet`: Creates a temporary reference set shared by deserialization and reply serialization
|
|
525
|
+
- `setServerCallback`: Configures how server functions are called
|
|
493
526
|
|
|
494
527
|
## Tips
|
|
495
528
|
|
|
@@ -667,13 +700,6 @@ Note that while there are official npm packages [`server-only`](https://www.npmj
|
|
|
667
700
|
|
|
668
701
|
This build-time validation is enabled by default and can be disabled by setting `validateImports: false` in the plugin options.
|
|
669
702
|
|
|
670
|
-
## Architecture Documentation
|
|
671
|
-
|
|
672
|
-
For developers interested in the internal architecture:
|
|
673
|
-
|
|
674
|
-
- **[docs/architecture.md](docs/architecture.md)** - Build pipeline, data flow, and key components
|
|
675
|
-
- **[docs/bundler-comparison.md](docs/bundler-comparison.md)** - How different bundlers approach RSC
|
|
676
|
-
|
|
677
703
|
## Credits
|
|
678
704
|
|
|
679
705
|
This project builds on fundamental techniques and insights from pioneering Vite RSC implementations.
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as CallServerCallback } from "./index-
|
|
2
|
-
import { t as setRequireModule } from "./browser-
|
|
1
|
+
import { n as CallServerCallback } from "./index-C5IY2S-e.js";
|
|
2
|
+
import { t as setRequireModule } from "./browser-DI_Wyg5Y.js";
|
|
3
3
|
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "./react/browser.js";
|
|
4
|
-
export { CallServerCallback, callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setRequireModule, setServerCallback };
|
|
4
|
+
export { type CallServerCallback, callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setRequireModule, setServerCallback };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createDebug } from "./dist-
|
|
2
|
-
import { t as buildScopeTree } from "./scope-
|
|
3
|
-
import { n as parseIdQuery } from "./shared-
|
|
1
|
+
import { t as createDebug } from "./dist-uqdtSkzK.js";
|
|
2
|
+
import { t as buildScopeTree } from "./scope-Do08R7C2.js";
|
|
3
|
+
import { n as parseIdQuery } from "./shared-B6H2TbnP.js";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { a as CreateFromReadableStreamEdgeOptions, c as EncodeReplyFunction, r as ClientTemporaryReferenceSet } from "./index-C5IY2S-e.js";
|
|
2
|
+
//#region src/react/rsc/client.d.ts
|
|
3
|
+
declare function createFromReadableStream<T>(stream: ReadableStream<Uint8Array>, options?: CreateFromReadableStreamEdgeOptions, extraOptions?: {
|
|
4
|
+
/**
|
|
5
|
+
* Preserve server references for re-serialization without loading their modules.
|
|
6
|
+
* Preserved references cannot be invoked in the current RSC environment.
|
|
7
|
+
*
|
|
8
|
+
* Disabled by default because this API also decodes bound server action
|
|
9
|
+
* arguments, which must revive references as callable implementations.
|
|
10
|
+
*
|
|
11
|
+
* @experimental
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
preserveServerReferences?: boolean;
|
|
15
|
+
}): Promise<T>;
|
|
16
|
+
declare const encodeReply: EncodeReplyFunction;
|
|
17
|
+
declare const createClientTemporaryReferenceSet: () => ClientTemporaryReferenceSet;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { createFromReadableStream as n, encodeReply as r, createClientTemporaryReferenceSet as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import assetsManifest from "virtual:vite-rsc/assets-manifest";
|
|
2
|
+
//#region src/rsc/client-reference.ts
|
|
3
|
+
function createOnClientReference(onClientReference) {
|
|
4
|
+
return (metadata) => {
|
|
5
|
+
const deps = assetsManifest.clientReferenceDeps[metadata.id] ?? {
|
|
6
|
+
js: [],
|
|
7
|
+
css: []
|
|
8
|
+
};
|
|
9
|
+
onClientReference({
|
|
10
|
+
...metadata,
|
|
11
|
+
deps
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { createOnClientReference as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as ClientReferenceMetadata } from "./rsc-C3UdJLOW.js";
|
|
2
|
+
import { i as ResolvedAssetDeps } from "./plugin-CaLiN8ED.js";
|
|
3
|
+
//#region src/rsc/client-reference.d.ts
|
|
4
|
+
type OnClientReference = (metadata: ClientReferenceMetadata & {
|
|
5
|
+
deps: ResolvedAssetDeps;
|
|
6
|
+
}) => void;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { OnClientReference as t };
|
package/dist/core/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as setRequireModule } from "../browser-
|
|
1
|
+
import { t as setRequireModule } from "../browser-DI_Wyg5Y.js";
|
|
2
2
|
export { setRequireModule };
|
package/dist/core/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as memoize } from "../dist-
|
|
2
|
-
import { a as
|
|
1
|
+
import { n as memoize } from "../dist-uqdtSkzK.js";
|
|
2
|
+
import { a as removeReferenceCacheTag, o as setInternalRequire } from "../shared-Y4B6DJ99.js";
|
|
3
3
|
//#region src/core/browser.ts
|
|
4
4
|
let init = false;
|
|
5
5
|
function setRequireModule(options) {
|
package/dist/core/plugin.d.ts
CHANGED
package/dist/core/rsc.d.ts
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/core/rsc.d.ts
|
|
4
|
-
declare function setRequireModule(options: {
|
|
5
|
-
load: (id: string) => unknown;
|
|
6
|
-
}): void;
|
|
7
|
-
declare function loadServerAction(id: string): Promise<Function>;
|
|
8
|
-
declare function createServerManifest(): BundlerConfig;
|
|
9
|
-
declare function createServerDecodeClientManifest(): ModuleMap;
|
|
10
|
-
declare function createClientManifest(options?: {
|
|
11
|
-
/**
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
onClientReference?: (metadata: {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
}) => void;
|
|
18
|
-
}): BundlerConfig;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule };
|
|
1
|
+
import { a as createServerManifest, i as createServerDecodeClientManifest, n as CreateClientManifestOptions, o as loadServerAction, r as createClientManifest, s as setRequireModule, t as ClientReferenceMetadata } from "../rsc-C3UdJLOW.js";
|
|
2
|
+
export { ClientReferenceMetadata, CreateClientManifestOptions, createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule };
|
package/dist/core/rsc.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as tinyassert, n as memoize } from "../dist-
|
|
2
|
-
import { a as
|
|
1
|
+
import { i as tinyassert, n as memoize } from "../dist-uqdtSkzK.js";
|
|
2
|
+
import { a as removeReferenceCacheTag, i as createReferenceCacheTag, n as SERVER_REFERENCE_PREFIX, o as setInternalRequire, r as SERVER_REFERENCE_PRESERVE_PREFIX, t as SERVER_DECODE_CLIENT_PREFIX } from "../shared-Y4B6DJ99.js";
|
|
3
3
|
import * as ReactServer from "@vitejs/plugin-rsc/vendor/react-server-dom/server.edge";
|
|
4
4
|
//#region src/core/rsc.ts
|
|
5
5
|
let init = false;
|
|
@@ -11,6 +11,21 @@ function setRequireModule(options) {
|
|
|
11
11
|
return options.load(removeReferenceCacheTag(id));
|
|
12
12
|
};
|
|
13
13
|
globalThis.__vite_rsc_server_require__ = memoize(async (id) => {
|
|
14
|
+
if (id.startsWith("$$preserve:")) {
|
|
15
|
+
id = id.slice(SERVER_REFERENCE_PRESERVE_PREFIX.length);
|
|
16
|
+
id = removeReferenceCacheTag(id);
|
|
17
|
+
const target = {};
|
|
18
|
+
const getOrCreateServerReference = (name) => {
|
|
19
|
+
return target[name] ??= ReactServer.registerServerReference(() => {
|
|
20
|
+
throw new Error(`Unexpectedly decoded server reference '${id}#${name}' is called on server`);
|
|
21
|
+
}, id, name);
|
|
22
|
+
};
|
|
23
|
+
return new Proxy(target, { getOwnPropertyDescriptor(_target, name) {
|
|
24
|
+
if (typeof name !== "string" || name === "then") return Reflect.getOwnPropertyDescriptor(target, name);
|
|
25
|
+
getOrCreateServerReference(name);
|
|
26
|
+
return Reflect.getOwnPropertyDescriptor(target, name);
|
|
27
|
+
} });
|
|
28
|
+
}
|
|
14
29
|
if (id.startsWith("$$decode-client:")) {
|
|
15
30
|
id = id.slice(SERVER_DECODE_CLIENT_PREFIX.length);
|
|
16
31
|
id = removeReferenceCacheTag(id);
|
|
@@ -34,7 +49,8 @@ async function loadServerAction(id) {
|
|
|
34
49
|
const [file, name] = id.split("#");
|
|
35
50
|
return (await requireModule(file))[name];
|
|
36
51
|
}
|
|
37
|
-
function createServerManifest() {
|
|
52
|
+
function createServerManifest(options) {
|
|
53
|
+
const prefix = options?.preserveServerReferences ? SERVER_REFERENCE_PRESERVE_PREFIX : "";
|
|
38
54
|
const cacheTag = import.meta.env.DEV ? createReferenceCacheTag() : "";
|
|
39
55
|
return new Proxy({}, { get(_target, $$id, _receiver) {
|
|
40
56
|
tinyassert(typeof $$id === "string");
|
|
@@ -42,7 +58,7 @@ function createServerManifest() {
|
|
|
42
58
|
tinyassert(id);
|
|
43
59
|
tinyassert(name);
|
|
44
60
|
return {
|
|
45
|
-
id: SERVER_REFERENCE_PREFIX + id + cacheTag,
|
|
61
|
+
id: SERVER_REFERENCE_PREFIX + prefix + id + cacheTag,
|
|
46
62
|
name,
|
|
47
63
|
chunks: [],
|
|
48
64
|
async: true
|
package/dist/core/ssr.d.ts
CHANGED
package/dist/core/ssr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as memoize } from "../dist-
|
|
2
|
-
import { a as
|
|
1
|
+
import { n as memoize } from "../dist-uqdtSkzK.js";
|
|
2
|
+
import { a as removeReferenceCacheTag, o as setInternalRequire } from "../shared-Y4B6DJ99.js";
|
|
3
3
|
//#region src/core/ssr.ts
|
|
4
4
|
let init = false;
|
|
5
5
|
function setRequireModule(options) {
|
|
@@ -52,7 +52,7 @@ async function generateEncryptionKey() {
|
|
|
52
52
|
return new Uint8Array(exported);
|
|
53
53
|
}
|
|
54
54
|
async function encryptBuffer(data, key) {
|
|
55
|
-
const iv = crypto.getRandomValues(new Uint8Array(16));
|
|
55
|
+
const iv = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
|
|
56
56
|
const encrypted = await crypto.subtle.encrypt({
|
|
57
57
|
name: "AES-GCM",
|
|
58
58
|
iv
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import MagicString from "magic-string";
|
|
2
|
-
|
|
3
2
|
//#region ../../node_modules/.pnpm/@types+estree@1.0.9/node_modules/@types/estree/index.d.ts
|
|
4
3
|
// This definition file follows a somewhat unusual format. ESTree allows
|
|
5
4
|
// runtime type checks based on the `type` parameter. In order to explain this
|
|
@@ -84,7 +83,8 @@ interface Directive extends BaseNode {
|
|
|
84
83
|
interface BaseFunction extends BaseNode {
|
|
85
84
|
params: Pattern[];
|
|
86
85
|
generator?: boolean | undefined;
|
|
87
|
-
async?: boolean | undefined;
|
|
86
|
+
async?: boolean | undefined;
|
|
87
|
+
// The body is either BlockStatement or Expression because arrow functions
|
|
88
88
|
// can have a body that's either. FunctionDeclarations and
|
|
89
89
|
// FunctionExpressions have only BlockStatement bodies.
|
|
90
90
|
body: BlockStatement | Expression;
|
|
@@ -405,7 +405,8 @@ interface TemplateElement extends BaseNode {
|
|
|
405
405
|
type: "TemplateElement";
|
|
406
406
|
tail: boolean;
|
|
407
407
|
value: {
|
|
408
|
-
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */
|
|
408
|
+
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */
|
|
409
|
+
cooked?: string | null | undefined;
|
|
409
410
|
raw: string;
|
|
410
411
|
};
|
|
411
412
|
}
|
|
@@ -525,11 +526,7 @@ interface AwaitExpression extends BaseExpression {
|
|
|
525
526
|
}
|
|
526
527
|
//#endregion
|
|
527
528
|
//#region src/transforms/hoist.d.ts
|
|
528
|
-
declare function transformHoistInlineDirective(input: string, ast: Program, {
|
|
529
|
-
runtime,
|
|
530
|
-
rejectNonAsyncFunction,
|
|
531
|
-
...options
|
|
532
|
-
}: {
|
|
529
|
+
declare function transformHoistInlineDirective(input: string, ast: Program, { runtime, rejectNonAsyncFunction, ...options }: {
|
|
533
530
|
runtime: (value: string, name: string, meta: {
|
|
534
531
|
directiveMatch: RegExpMatchArray;
|
|
535
532
|
}) => string;
|
|
@@ -546,8 +543,33 @@ declare function findDirectives(ast: Program, directive: string): Literal[];
|
|
|
546
543
|
//#endregion
|
|
547
544
|
//#region src/transforms/wrap-export.d.ts
|
|
548
545
|
type ExportMeta = {
|
|
546
|
+
/**
|
|
547
|
+
* The local declaration name when statically available.
|
|
548
|
+
*
|
|
549
|
+
* - `"Page"` for `export function Page() {}`
|
|
550
|
+
* - `"Page"` for `export const Page = () => {}`
|
|
551
|
+
* - `undefined` for `export default () => {}`
|
|
552
|
+
* - `undefined` for `export { Page }`
|
|
553
|
+
*/
|
|
549
554
|
declName?: string;
|
|
555
|
+
/**
|
|
556
|
+
* Whether the exported value is statically known to be a function.
|
|
557
|
+
*
|
|
558
|
+
* - `true` for `export const Page = () => {}`
|
|
559
|
+
* - `false` for `export const value = 1`
|
|
560
|
+
* - `undefined` for `export const value = getValue()`
|
|
561
|
+
* - `undefined` for `export default Page`
|
|
562
|
+
*/
|
|
550
563
|
isFunction?: boolean;
|
|
564
|
+
/**
|
|
565
|
+
* The local identifier referenced by a default export.
|
|
566
|
+
* The RSC CSS transform uses this to detect a component by its capitalized
|
|
567
|
+
* local name and preserve that name on the generated wrapper.
|
|
568
|
+
*
|
|
569
|
+
* - `"Page"` for `const Page = () => {}; export default Page`
|
|
570
|
+
* - `undefined` for `export default function Page() {}`
|
|
571
|
+
* - `undefined` for `export default () => {}`
|
|
572
|
+
*/
|
|
551
573
|
defaultExportIdentifierName?: string;
|
|
552
574
|
};
|
|
553
575
|
type TransformWrapExportFilter = (name: string, meta: ExportMeta) => boolean;
|
|
@@ -564,16 +586,17 @@ declare function transformWrapExport(input: string, ast: Program, options: Trans
|
|
|
564
586
|
//#endregion
|
|
565
587
|
//#region src/transforms/proxy-export.d.ts
|
|
566
588
|
type TransformProxyExportOptions = {
|
|
567
|
-
/** Required for source map and `keep` options */
|
|
589
|
+
/** Required for source map and `keep` options */
|
|
590
|
+
code?: string;
|
|
568
591
|
runtime: (name: string, meta?: {
|
|
569
592
|
value: string;
|
|
570
593
|
}) => string;
|
|
571
594
|
ignoreExportAllDeclaration?: boolean;
|
|
572
595
|
rejectNonAsyncFunction?: boolean;
|
|
573
596
|
/**
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
597
|
+
* escape hatch for Waku's `allowServer`
|
|
598
|
+
* @default false
|
|
599
|
+
*/
|
|
577
600
|
keep?: boolean;
|
|
578
601
|
};
|
|
579
602
|
declare function transformDirectiveProxyExport(ast: Program, options: {
|
|
@@ -31,10 +31,15 @@ interface RenderToReadableStreamOptions {
|
|
|
31
31
|
startTime?: number;
|
|
32
32
|
temporaryReferences?: ServerTemporaryReferenceSet;
|
|
33
33
|
onError?: (error: unknown) => void;
|
|
34
|
+
onPostpone?: (reason: string) => void;
|
|
35
|
+
}
|
|
36
|
+
interface PrerenderResult {
|
|
37
|
+
prelude: ReadableStream<Uint8Array>;
|
|
34
38
|
}
|
|
35
39
|
interface CreateFromReadableStreamBrowserOptions {
|
|
36
40
|
callServer?: CallServerCallback;
|
|
37
41
|
debugChannel?: DebugChannel;
|
|
42
|
+
encodeFormAction?: EncodeFormActionCallback;
|
|
38
43
|
endTime?: number;
|
|
39
44
|
environmentName?: string;
|
|
40
45
|
replayConsoleLogs?: boolean;
|
|
@@ -43,6 +48,7 @@ interface CreateFromReadableStreamBrowserOptions {
|
|
|
43
48
|
}
|
|
44
49
|
interface CreateFromReadableStreamEdgeOptions {
|
|
45
50
|
debugChannel?: DebugChannel;
|
|
51
|
+
encodeFormAction?: EncodeFormActionCallback;
|
|
46
52
|
endTime?: number;
|
|
47
53
|
environmentName?: string;
|
|
48
54
|
nonce?: string;
|
|
@@ -58,6 +64,15 @@ interface EncodeReplyOptions {
|
|
|
58
64
|
temporaryReferences?: ClientTemporaryReferenceSet;
|
|
59
65
|
signal?: AbortSignal;
|
|
60
66
|
}
|
|
67
|
+
type EncodeFormActionCallback = (id: string, args: Promise<unknown[]>) => ReactCustomFormAction;
|
|
68
|
+
type ReactCustomFormAction = {
|
|
69
|
+
name?: string;
|
|
70
|
+
action?: string;
|
|
71
|
+
encType?: string;
|
|
72
|
+
method?: string;
|
|
73
|
+
target?: string;
|
|
74
|
+
data?: FormData | null;
|
|
75
|
+
};
|
|
61
76
|
type EncodeReplyFunction = (value: unknown[], options?: EncodeReplyOptions) => Promise<string | FormData>;
|
|
62
77
|
type DecodeReplyFunction = (body: string | FormData, options?: DecodeReplyOptions) => Promise<unknown[]>;
|
|
63
78
|
type DebugChannel = {
|
|
@@ -67,4 +82,4 @@ type DebugChannel = {
|
|
|
67
82
|
type ServerTemporaryReferenceSet = unknown;
|
|
68
83
|
type ClientTemporaryReferenceSet = unknown;
|
|
69
84
|
//#endregion
|
|
70
|
-
export { CreateFromReadableStreamEdgeOptions as a,
|
|
85
|
+
export { CreateFromReadableStreamEdgeOptions as a, EncodeReplyFunction as c, RenderToReadableStreamOptions as d, ServerConsumerManifest as f, CreateFromReadableStreamBrowserOptions as i, ModuleMap as l, CallServerCallback as n, DecodeReplyFunction as o, ServerTemporaryReferenceSet as p, ClientTemporaryReferenceSet as r, EncodeFormActionCallback as s, BundlerConfig as t, PrerenderResult as u };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as getPluginApi, r as PluginApi, s as RscPluginOptions, u as vitePluginRsc } from "./plugin-
|
|
1
|
+
import { c as getPluginApi, r as PluginApi, s as RscPluginOptions, u as vitePluginRsc } from "./plugin-CaLiN8ED.js";
|
|
2
2
|
export { type PluginApi, type RscPluginOptions, vitePluginRsc as default, getPluginApi };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as vitePluginRsc, t as getPluginApi } from "./plugin-
|
|
1
|
+
import { r as vitePluginRsc, t as getPluginApi } from "./plugin-DPZnhMn5.js";
|
|
2
2
|
export { vitePluginRsc as default, getPluginApi };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { a as __commonJSMin } from "./plugin-
|
|
1
|
+
import { a as __commonJSMin } from "./plugin-DPZnhMn5.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
3
3
|
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
-
let p = process || {}
|
|
4
|
+
let p = process || {};
|
|
5
|
+
let argv = p.argv || [];
|
|
6
|
+
let env = p.env || {};
|
|
5
7
|
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
6
8
|
let formatter = (open, close, replace = open) => (input) => {
|
|
7
9
|
let string = "" + input, index = string.indexOf(close, open.length);
|