@vitejs/plugin-rsc 0.4.27 → 0.4.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/dist/{browser-QU10IP0-.js → browser--ZREVnM9.js} +1 -1
- package/dist/{browser-BhJd-Orx.js → browser-7NhxQxuk.js} +1 -1
- package/dist/{browser-mbRygLxB.d.ts → browser-DUDACP5e.d.ts} +1 -1
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +3 -3
- package/dist/core/browser.d.ts +1 -1
- package/dist/core/browser.js +2 -2
- package/dist/core/rsc.d.ts +2 -2
- package/dist/core/rsc.js +2 -2
- package/dist/core/ssr.d.ts +2 -2
- package/dist/core/ssr.js +2 -2
- package/dist/{encryption-runtime-CJUalqt3.js → encryption-runtime-CAmm02Ms.js} +2 -3
- package/dist/extra/browser.d.ts +1 -1
- package/dist/extra/browser.js +5 -6
- package/dist/extra/rsc.d.ts +1 -1
- package/dist/extra/rsc.js +11 -17
- package/dist/extra/ssr.js +8 -10
- package/dist/index-BH1wcQPN.d.ts +89 -0
- package/dist/index.d.ts +3 -24
- package/dist/index.js +5 -4
- package/dist/{plugin-Be24jgQb.d.ts → plugin-BDdwA9-Y.d.ts} +7 -10
- package/dist/{plugin-CtdHIozK.js → plugin-DB5WEabT.js} +38 -341
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.js +5 -4
- package/dist/react/browser.d.ts +3 -3
- package/dist/react/browser.js +2 -2
- package/dist/react/rsc.d.ts +3 -3
- package/dist/react/rsc.js +3 -3
- package/dist/react/ssr.d.ts +3 -3
- package/dist/react/ssr.js +3 -3
- package/dist/{rpc-tGuLT8PD.js → rpc-CUvSZurk.js} +2 -3
- package/dist/{rsc-CxDPDiLz.d.ts → rsc-BeJKxeMX.d.ts} +1 -1
- package/dist/{rsc-BwEwbLG4.js → rsc-D_DDN0W1.js} +1 -1
- package/dist/{rsc-VjVw_i-M.js → rsc-DdBcg-Lb.js} +1 -1
- package/dist/{rsc-BfBPoIV8.js → rsc-cp4EenMG.js} +2 -3
- package/dist/rsc-html-stream/browser.js +1 -1
- package/dist/rsc-html-stream/ssr.js +1 -1
- package/dist/rsc.d.ts +4 -4
- package/dist/rsc.js +5 -5
- package/dist/{shared-CEyKoKAb.js → shared-CXg_u-4h.js} +1 -2
- package/dist/{ssr-BoNKka-5.d.ts → ssr-Bv84RACl.d.ts} +1 -1
- package/dist/{ssr--rFiBtws.js → ssr-CMFFChNQ.js} +1 -1
- package/dist/{ssr-BEKKb_cw.js → ssr-D8iPOYvE.js} +1 -1
- package/dist/{ssr-CWjOQSe3.js → ssr-Y4u1WaMw.js} +2 -2
- package/dist/ssr.d.ts +3 -3
- package/dist/ssr.js +5 -5
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/index.js +4 -0
- package/dist/transforms-D1-2JfCh.js +330 -0
- package/dist/utils/encryption-runtime.d.ts +1 -1
- package/dist/utils/encryption-runtime.js +4 -4
- package/dist/utils/rpc.js +1 -1
- package/package.json +3 -2
- /package/dist/{browser-CuwQIlVY.d.ts → browser-CyGTajab.d.ts} +0 -0
- /package/dist/{client-C1J4FCf5.js → client-BPIq1kGs.js} +0 -0
- /package/dist/{encryption-runtime-SgJRa9yj.d.ts → encryption-runtime-BwOew_5N.d.ts} +0 -0
- /package/dist/{index-QWzVHuya.d.ts → index-CrcbP1rd.d.ts} +0 -0
- /package/dist/{rsc-CFtzqEG8.d.ts → rsc-CpPqIkYr.d.ts} +0 -0
- /package/dist/{rsc-Cv3XEZqB.d.ts → rsc-D-lnfNSa.d.ts} +0 -0
- /package/dist/{server-D0-DavPP.js → server-DoWzqBNF.js} +0 -0
- /package/dist/{shared-BWHxNw3Q.js → shared-Cwk6fxfN.js} +0 -0
- /package/dist/{ssr-D6GTzOzx.d.ts → ssr-CXrYz0RZ.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memoize } from "./dist-DiJnRA1C.js";
|
|
2
|
-
import { removeReferenceCacheTag, setInternalRequire } from "./shared-
|
|
2
|
+
import { removeReferenceCacheTag, setInternalRequire } from "./shared-CXg_u-4h.js";
|
|
3
3
|
|
|
4
4
|
//#region src/core/browser.ts
|
|
5
5
|
let init = false;
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallServerCallback } from "./index-
|
|
2
|
-
import { setRequireModule } from "./browser-
|
|
3
|
-
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "./browser-
|
|
1
|
+
import { CallServerCallback } from "./index-CrcbP1rd.js";
|
|
2
|
+
import { setRequireModule } from "./browser-CyGTajab.js";
|
|
3
|
+
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "./browser-DUDACP5e.js";
|
|
4
4
|
export { CallServerCallback, callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setRequireModule, setServerCallback };
|
package/dist/browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./dist-DiJnRA1C.js";
|
|
2
|
-
import "./shared-
|
|
3
|
-
import { setRequireModule } from "./browser-
|
|
2
|
+
import "./shared-CXg_u-4h.js";
|
|
3
|
+
import { setRequireModule } from "./browser-7NhxQxuk.js";
|
|
4
4
|
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "./browser-D8OPzpF5.js";
|
|
5
|
-
import "./browser
|
|
5
|
+
import "./browser--ZREVnM9.js";
|
|
6
6
|
|
|
7
7
|
export { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setRequireModule, setServerCallback };
|
package/dist/core/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { setRequireModule } from "../browser-
|
|
1
|
+
import { setRequireModule } from "../browser-CyGTajab.js";
|
|
2
2
|
export { setRequireModule };
|
package/dist/core/browser.js
CHANGED
package/dist/core/rsc.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-
|
|
1
|
+
import "../index-CrcbP1rd.js";
|
|
2
|
+
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-BeJKxeMX.js";
|
|
3
3
|
export { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule };
|
package/dist/core/rsc.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
|
-
import "../shared-
|
|
3
|
-
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-
|
|
2
|
+
import "../shared-CXg_u-4h.js";
|
|
3
|
+
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-cp4EenMG.js";
|
|
4
4
|
|
|
5
5
|
export { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule };
|
package/dist/core/ssr.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { createServerConsumerManifest, setRequireModule } from "../ssr-
|
|
1
|
+
import "../index-CrcbP1rd.js";
|
|
2
|
+
import { createServerConsumerManifest, setRequireModule } from "../ssr-Bv84RACl.js";
|
|
3
3
|
export { createServerConsumerManifest, setRequireModule };
|
package/dist/core/ssr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
|
-
import "../shared-
|
|
3
|
-
import { createServerConsumerManifest, setRequireModule } from "../ssr
|
|
2
|
+
import "../shared-CXg_u-4h.js";
|
|
3
|
+
import { createServerConsumerManifest, setRequireModule } from "../ssr-CMFFChNQ.js";
|
|
4
4
|
|
|
5
5
|
export { createServerConsumerManifest, setRequireModule };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { once } from "./dist-DiJnRA1C.js";
|
|
2
2
|
import { arrayToStream, concatArrayStream, decryptBuffer, encryptBuffer, fromBase64 } from "./encryption-utils-BDwwcMVT.js";
|
|
3
|
-
import { createFromReadableStream, renderToReadableStream } from "./rsc-
|
|
3
|
+
import { createFromReadableStream, renderToReadableStream } from "./rsc-DdBcg-Lb.js";
|
|
4
4
|
import encryptionKeySource from "virtual:vite-rsc/encryption-key";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/encryption-runtime.ts
|
|
@@ -16,8 +16,7 @@ async function decryptActionBoundArgs(encrypted) {
|
|
|
16
16
|
}
|
|
17
17
|
const getEncryptionKey = /* @__PURE__ */ once(async () => {
|
|
18
18
|
const resolved = await encryptionKeySource();
|
|
19
|
-
|
|
20
|
-
return key;
|
|
19
|
+
return await crypto.subtle.importKey("raw", fromBase64(resolved), { name: "AES-GCM" }, true, ["encrypt", "decrypt"]);
|
|
21
20
|
});
|
|
22
21
|
|
|
23
22
|
//#endregion
|
package/dist/extra/browser.d.ts
CHANGED
package/dist/extra/browser.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
|
-
import "../shared-
|
|
3
|
-
import "../browser-
|
|
2
|
+
import "../shared-CXg_u-4h.js";
|
|
3
|
+
import "../browser-7NhxQxuk.js";
|
|
4
4
|
import { createFromFetch, createFromReadableStream, createTemporaryReferenceSet, encodeReply, setServerCallback } from "../browser-D8OPzpF5.js";
|
|
5
|
-
import "../browser
|
|
6
|
-
import { rscStream } from "../client-
|
|
5
|
+
import "../browser--ZREVnM9.js";
|
|
6
|
+
import { rscStream } from "../client-BPIq1kGs.js";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import ReactDomClient from "react-dom/client";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -52,8 +52,7 @@ async function hydrate() {
|
|
|
52
52
|
* @deprecated Use `@vitejs/plugin-rsc/browser` API instead.
|
|
53
53
|
*/
|
|
54
54
|
async function fetchRSC(request) {
|
|
55
|
-
|
|
56
|
-
return payload.root;
|
|
55
|
+
return (await createFromFetch(fetch(request))).root;
|
|
57
56
|
}
|
|
58
57
|
function listenNavigation(onNavigation) {
|
|
59
58
|
window.addEventListener("popstate", onNavigation);
|
package/dist/extra/rsc.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RscPayload, renderRequest } from "../rsc-
|
|
1
|
+
import { RscPayload, renderRequest } from "../rsc-D-lnfNSa.js";
|
|
2
2
|
export { RscPayload, renderRequest };
|
package/dist/extra/rsc.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
|
-
import "../shared-
|
|
2
|
+
import "../shared-CXg_u-4h.js";
|
|
3
3
|
import "../encryption-utils-BDwwcMVT.js";
|
|
4
|
-
import { loadServerAction } from "../rsc-
|
|
5
|
-
import { createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, renderToReadableStream } from "../rsc-
|
|
6
|
-
import "../encryption-runtime-
|
|
7
|
-
import "../rsc-
|
|
4
|
+
import { loadServerAction } from "../rsc-cp4EenMG.js";
|
|
5
|
+
import { createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, renderToReadableStream } from "../rsc-DdBcg-Lb.js";
|
|
6
|
+
import "../encryption-runtime-CAmm02Ms.js";
|
|
7
|
+
import "../rsc-D_DDN0W1.js";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
//#region src/extra/rsc.tsx
|
|
@@ -28,32 +28,26 @@ async function renderRequest(request, root, options) {
|
|
|
28
28
|
if (isAction) {
|
|
29
29
|
const actionId = request.headers.get("x-rsc-action");
|
|
30
30
|
if (actionId) {
|
|
31
|
-
const
|
|
32
|
-
const body = contentType?.startsWith("multipart/form-data") ? await request.formData() : await request.text();
|
|
31
|
+
const body = request.headers.get("content-type")?.startsWith("multipart/form-data") ? await request.formData() : await request.text();
|
|
33
32
|
temporaryReferences = createTemporaryReferenceSet();
|
|
34
33
|
const args = await decodeReply(body, { temporaryReferences });
|
|
35
|
-
|
|
36
|
-
returnValue = await action.apply(null, args);
|
|
34
|
+
returnValue = await (await loadServerAction(actionId)).apply(null, args);
|
|
37
35
|
} else {
|
|
38
36
|
const formData = await request.formData();
|
|
39
|
-
const
|
|
40
|
-
const result = await decodedAction();
|
|
37
|
+
const result = await (await decodeAction(formData))();
|
|
41
38
|
formState = await decodeFormState(result, formData);
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
|
-
const
|
|
41
|
+
const rscStream = renderToReadableStream({
|
|
45
42
|
root: /* @__PURE__ */ jsx(RscRoot, {}),
|
|
46
43
|
formState,
|
|
47
44
|
returnValue
|
|
48
|
-
};
|
|
49
|
-
const rscOptions = { temporaryReferences };
|
|
50
|
-
const rscStream = renderToReadableStream(rscPayload, rscOptions);
|
|
45
|
+
}, { temporaryReferences });
|
|
51
46
|
if (isRscRequest) return new Response(rscStream, { headers: {
|
|
52
47
|
"content-type": "text/x-component;charset=utf-8",
|
|
53
48
|
vary: "accept"
|
|
54
49
|
} });
|
|
55
|
-
|
|
56
|
-
return ssrEntry.renderHtml(rscStream, {
|
|
50
|
+
return (await import.meta.viteRsc.loadModule("ssr", "index")).renderHtml(rscStream, {
|
|
57
51
|
formState,
|
|
58
52
|
nonce: options?.nonce,
|
|
59
53
|
debugNoJs: url.searchParams.has("__nojs")
|
package/dist/extra/ssr.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
|
-
import "../shared-
|
|
3
|
-
import "../shared-
|
|
4
|
-
import "../ssr
|
|
5
|
-
import { createFromReadableStream } from "../ssr-
|
|
6
|
-
import "../ssr-
|
|
7
|
-
import { injectRSCPayload } from "../server-
|
|
2
|
+
import "../shared-CXg_u-4h.js";
|
|
3
|
+
import "../shared-Cwk6fxfN.js";
|
|
4
|
+
import "../ssr-CMFFChNQ.js";
|
|
5
|
+
import { createFromReadableStream } from "../ssr-D8iPOYvE.js";
|
|
6
|
+
import "../ssr-Y4u1WaMw.js";
|
|
7
|
+
import { injectRSCPayload } from "../server-DoWzqBNF.js";
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
import ReactDomServer from "react-dom/server.edge";
|
|
@@ -18,16 +18,14 @@ async function renderHtml(rscStream, options) {
|
|
|
18
18
|
let payload;
|
|
19
19
|
function SsrRoot() {
|
|
20
20
|
payload ??= createFromReadableStream(rscStream1, { nonce: options?.nonce });
|
|
21
|
-
|
|
22
|
-
return root;
|
|
21
|
+
return React.use(payload).root;
|
|
23
22
|
}
|
|
24
23
|
const bootstrapScriptContent = await import.meta.viteRsc.loadBootstrapScriptContent("index");
|
|
25
|
-
|
|
24
|
+
let responseStream = await ReactDomServer.renderToReadableStream(/* @__PURE__ */ jsx(SsrRoot, {}), {
|
|
26
25
|
bootstrapScriptContent: options?.debugNoJs ? void 0 : bootstrapScriptContent,
|
|
27
26
|
nonce: options?.nonce,
|
|
28
27
|
formState: options?.formState
|
|
29
28
|
});
|
|
30
|
-
let responseStream = htmlStream;
|
|
31
29
|
if (!options?.debugNoJs) responseStream = responseStream.pipeThrough(injectRSCPayload(rscStream2, { nonce: options?.nonce }));
|
|
32
30
|
return new Response(responseStream, { headers: {
|
|
33
31
|
"content-type": "text/html;charset=utf-8",
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import MagicString from "magic-string";
|
|
2
|
+
import { Program } from "estree";
|
|
3
|
+
|
|
4
|
+
//#region src/transforms/hoist.d.ts
|
|
5
|
+
declare function transformHoistInlineDirective(input: string, ast: Program, {
|
|
6
|
+
runtime,
|
|
7
|
+
rejectNonAsyncFunction,
|
|
8
|
+
...options
|
|
9
|
+
}: {
|
|
10
|
+
runtime: (value: string, name: string, meta: {
|
|
11
|
+
directiveMatch: RegExpMatchArray;
|
|
12
|
+
}) => string;
|
|
13
|
+
directive: string | RegExp;
|
|
14
|
+
rejectNonAsyncFunction?: boolean;
|
|
15
|
+
encode?: (value: string) => string;
|
|
16
|
+
decode?: (value: string) => string;
|
|
17
|
+
noExport?: boolean;
|
|
18
|
+
}): {
|
|
19
|
+
output: MagicString;
|
|
20
|
+
names: string[];
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/transforms/wrap-export.d.ts
|
|
24
|
+
type ExportMeta = {
|
|
25
|
+
declName?: string;
|
|
26
|
+
isFunction?: boolean;
|
|
27
|
+
defaultExportIdentifierName?: string;
|
|
28
|
+
};
|
|
29
|
+
type TransformWrapExportFilter = (name: string, meta: ExportMeta) => boolean;
|
|
30
|
+
type TransformWrapExportOptions = {
|
|
31
|
+
runtime: (value: string, name: string, meta: ExportMeta) => string;
|
|
32
|
+
ignoreExportAllDeclaration?: boolean;
|
|
33
|
+
rejectNonAsyncFunction?: boolean;
|
|
34
|
+
filter?: TransformWrapExportFilter;
|
|
35
|
+
};
|
|
36
|
+
declare function transformWrapExport(input: string, ast: Program, options: TransformWrapExportOptions): {
|
|
37
|
+
exportNames: string[];
|
|
38
|
+
output: MagicString;
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/transforms/proxy-export.d.ts
|
|
42
|
+
type TransformProxyExportOptions = {
|
|
43
|
+
/** Required for source map and `keep` options */
|
|
44
|
+
code?: string;
|
|
45
|
+
runtime: (name: string, meta?: {
|
|
46
|
+
value: string;
|
|
47
|
+
}) => string;
|
|
48
|
+
ignoreExportAllDeclaration?: boolean;
|
|
49
|
+
rejectNonAsyncFunction?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* escape hatch for Waku's `allowServer`
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
keep?: boolean;
|
|
55
|
+
};
|
|
56
|
+
declare function transformDirectiveProxyExport(ast: Program, options: {
|
|
57
|
+
directive: string;
|
|
58
|
+
} & TransformProxyExportOptions): {
|
|
59
|
+
exportNames: string[];
|
|
60
|
+
output: MagicString;
|
|
61
|
+
} | undefined;
|
|
62
|
+
declare function transformProxyExport(ast: Program, options: TransformProxyExportOptions): {
|
|
63
|
+
exportNames: string[];
|
|
64
|
+
output: MagicString;
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/transforms/utils.d.ts
|
|
68
|
+
declare function hasDirective(body: Program["body"], directive: string): boolean;
|
|
69
|
+
declare function getExportNames(ast: Program, options: {
|
|
70
|
+
ignoreExportAllDeclaration?: boolean;
|
|
71
|
+
}): {
|
|
72
|
+
exportNames: string[];
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/transforms/server-action.d.ts
|
|
76
|
+
declare function transformServerActionServer(input: string, ast: Program, options: {
|
|
77
|
+
runtime: (value: string, name: string) => string;
|
|
78
|
+
rejectNonAsyncFunction?: boolean;
|
|
79
|
+
encode?: (value: string) => string;
|
|
80
|
+
decode?: (value: string) => string;
|
|
81
|
+
}): {
|
|
82
|
+
exportNames: string[];
|
|
83
|
+
output: MagicString;
|
|
84
|
+
} | {
|
|
85
|
+
output: MagicString;
|
|
86
|
+
names: string[];
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { TransformProxyExportOptions, TransformWrapExportFilter, TransformWrapExportOptions, getExportNames, hasDirective, transformDirectiveProxyExport, transformHoistInlineDirective, transformProxyExport, transformServerActionServer, transformWrapExport };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//#region src/transforms/hoist.d.ts
|
|
6
|
-
declare function transformHoistInlineDirective(input: string, ast: Program, {
|
|
7
|
-
runtime,
|
|
8
|
-
rejectNonAsyncFunction,
|
|
9
|
-
...options
|
|
10
|
-
}: {
|
|
11
|
-
runtime: (value: string, name: string, meta: {
|
|
12
|
-
directiveMatch: RegExpMatchArray;
|
|
13
|
-
}) => string;
|
|
14
|
-
directive: string | RegExp;
|
|
15
|
-
rejectNonAsyncFunction?: boolean;
|
|
16
|
-
encode?: (value: string) => string;
|
|
17
|
-
decode?: (value: string) => string;
|
|
18
|
-
noExport?: boolean;
|
|
19
|
-
}): {
|
|
20
|
-
output: MagicString;
|
|
21
|
-
names: string[];
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { type RscPluginOptions, vitePluginRsc as default, transformHoistInlineDirective };
|
|
1
|
+
import "./index-BH1wcQPN.js";
|
|
2
|
+
import { PluginApi, RscPluginOptions, getPluginApi, vitePluginRsc } from "./plugin-BDdwA9-Y.js";
|
|
3
|
+
export { type PluginApi, type RscPluginOptions, vitePluginRsc as default, getPluginApi };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "./dist-DiJnRA1C.js";
|
|
2
2
|
import "./plugin-CZbI4rhS.js";
|
|
3
|
-
import
|
|
3
|
+
import "./transforms-D1-2JfCh.js";
|
|
4
4
|
import "./encryption-utils-BDwwcMVT.js";
|
|
5
|
-
import "./rpc-
|
|
6
|
-
import "./
|
|
5
|
+
import "./rpc-CUvSZurk.js";
|
|
6
|
+
import { getPluginApi, vitePluginRsc } from "./plugin-DB5WEabT.js";
|
|
7
|
+
import "./shared-Cwk6fxfN.js";
|
|
7
8
|
|
|
8
|
-
export { vitePluginRsc as default,
|
|
9
|
+
export { vitePluginRsc as default, getPluginApi };
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
+
import { TransformWrapExportFilter } from "./index-BH1wcQPN.js";
|
|
1
2
|
import MagicString from "magic-string";
|
|
2
3
|
import { Plugin, ResolvedConfig, Rollup, ViteDevServer, parseAstAsync } from "vite";
|
|
3
|
-
import { Program } from "estree";
|
|
4
4
|
|
|
5
|
-
//#region src/transforms/wrap-export.d.ts
|
|
6
|
-
type ExportMeta = {
|
|
7
|
-
declName?: string;
|
|
8
|
-
isFunction?: boolean;
|
|
9
|
-
defaultExportIdentifierName?: string;
|
|
10
|
-
};
|
|
11
|
-
type TransformWrapExportFilter = (name: string, meta: ExportMeta) => boolean;
|
|
12
|
-
//#endregion
|
|
13
5
|
//#region src/plugin.d.ts
|
|
14
6
|
type ClientReferenceMeta = {
|
|
15
7
|
importId: string;
|
|
@@ -117,6 +109,11 @@ type RscPluginOptions = {
|
|
|
117
109
|
serverChunk: string;
|
|
118
110
|
}) => string | undefined;
|
|
119
111
|
};
|
|
112
|
+
type PluginApi = {
|
|
113
|
+
manager: RscPluginManager;
|
|
114
|
+
};
|
|
115
|
+
/** @experimental */
|
|
116
|
+
declare function getPluginApi(config: Pick<ResolvedConfig, "plugins">): PluginApi | undefined;
|
|
120
117
|
/** @experimental */
|
|
121
118
|
declare function vitePluginRscMinimal(rscPluginOptions?: RscPluginOptions, manager?: RscPluginManager): Plugin[];
|
|
122
119
|
declare function vitePluginRsc(rscPluginOptions?: RscPluginOptions): Plugin[];
|
|
@@ -151,4 +148,4 @@ declare function transformRscCssExport(options: {
|
|
|
151
148
|
output: MagicString;
|
|
152
149
|
} | undefined>;
|
|
153
150
|
//#endregion
|
|
154
|
-
export { AssetDeps, AssetsManifest, ResolvedAssetDeps, ResolvedAssetsManifest, type RscPluginManager, RscPluginOptions, transformRscCssExport, vitePluginRsc, vitePluginRscMinimal };
|
|
151
|
+
export { AssetDeps, AssetsManifest, PluginApi, ResolvedAssetDeps, ResolvedAssetsManifest, type RscPluginManager, RscPluginOptions, getPluginApi, transformRscCssExport, vitePluginRsc, vitePluginRscMinimal };
|