@vitejs/plugin-rsc 0.5.5 → 0.5.6
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/{cjs-D5eQjp5l.js → cjs-DHD_0drE.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{plugin-BIGFumgz.js → plugin-BIsCR7Tu.js} +19 -2
- package/dist/plugin.js +3 -3
- package/dist/plugins/cjs.js +2 -2
- package/dist/rsc.js +13 -4
- package/dist/{shared-BbMae1Gg.js → shared-AtH_QTi7.js} +7 -1
- package/dist/ssr.js +19 -11
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createDebug } from "./dist-BRSdGcl7.js";
|
|
2
|
-
import { n as parseIdQuery } from "./shared-
|
|
2
|
+
import { n as parseIdQuery } from "./shared-AtH_QTi7.js";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import "./dist-BRSdGcl7.js";
|
|
|
3
3
|
import "./transforms-BcLQCXiC.js";
|
|
4
4
|
import "./encryption-utils-6p8t4Xqm.js";
|
|
5
5
|
import "./rpc-CRpYrgKq.js";
|
|
6
|
-
import { r as vitePluginRsc, t as getPluginApi } from "./plugin-
|
|
7
|
-
import "./cjs-
|
|
8
|
-
import "./shared-
|
|
6
|
+
import { r as vitePluginRsc, t as getPluginApi } from "./plugin-BIsCR7Tu.js";
|
|
7
|
+
import "./cjs-DHD_0drE.js";
|
|
8
|
+
import "./shared-AtH_QTi7.js";
|
|
9
9
|
|
|
10
10
|
export { vitePluginRsc as default, getPluginApi };
|
|
@@ -4,8 +4,8 @@ import { t as createDebug } from "./dist-BRSdGcl7.js";
|
|
|
4
4
|
import { a as hasDirective, n as transformDirectiveProxyExport, o as transformWrapExport, s as findDirectives, t as transformServerActionServer } from "./transforms-BcLQCXiC.js";
|
|
5
5
|
import { o as generateEncryptionKey, s as toBase64 } from "./encryption-utils-6p8t4Xqm.js";
|
|
6
6
|
import { n as createRpcServer } from "./rpc-CRpYrgKq.js";
|
|
7
|
-
import { t as cjsModuleRunnerPlugin } from "./cjs-
|
|
8
|
-
import { n as parseIdQuery, r as
|
|
7
|
+
import { t as cjsModuleRunnerPlugin } from "./cjs-DHD_0drE.js";
|
|
8
|
+
import { i as toCssVirtual, n as parseIdQuery, r as parseReferenceValidationVirtual, t as parseCssVirtual } from "./shared-AtH_QTi7.js";
|
|
9
9
|
import { createRequire } from "node:module";
|
|
10
10
|
import assert from "node:assert";
|
|
11
11
|
import fs from "node:fs";
|
|
@@ -383,6 +383,23 @@ function vitePluginRscMinimal(rscPluginOptions = {}, manager = new RscPluginMana
|
|
|
383
383
|
...vitePluginUseClient(rscPluginOptions, manager),
|
|
384
384
|
...vitePluginUseServer(rscPluginOptions, manager),
|
|
385
385
|
...vitePluginDefineEncryptionKey(rscPluginOptions),
|
|
386
|
+
{
|
|
387
|
+
name: "rsc:reference-validation",
|
|
388
|
+
apply: "serve",
|
|
389
|
+
load: { handler(id, _options) {
|
|
390
|
+
if (id.startsWith("\0virtual:vite-rsc/reference-validation?")) {
|
|
391
|
+
const parsed = parseReferenceValidationVirtual(id);
|
|
392
|
+
assert(parsed);
|
|
393
|
+
if (parsed.type === "client") {
|
|
394
|
+
if (Object.values(manager.clientReferenceMetaMap).find((meta) => meta.referenceKey === parsed.id)) return `export {}`;
|
|
395
|
+
}
|
|
396
|
+
if (parsed.type === "server") {
|
|
397
|
+
if (Object.values(manager.serverReferenceMetaMap).find((meta) => meta.referenceKey === parsed.id)) return `export {}`;
|
|
398
|
+
}
|
|
399
|
+
this.error(`[vite-rsc] invalid ${parsed.type} reference '${parsed.id}'`);
|
|
400
|
+
}
|
|
401
|
+
} }
|
|
402
|
+
},
|
|
386
403
|
scanBuildStripPlugin({ manager })
|
|
387
404
|
];
|
|
388
405
|
}
|
package/dist/plugin.js
CHANGED
|
@@ -3,8 +3,8 @@ import "./dist-BRSdGcl7.js";
|
|
|
3
3
|
import "./transforms-BcLQCXiC.js";
|
|
4
4
|
import "./encryption-utils-6p8t4Xqm.js";
|
|
5
5
|
import "./rpc-CRpYrgKq.js";
|
|
6
|
-
import { i as vitePluginRscMinimal, n as transformRscCssExport, r as vitePluginRsc, t as getPluginApi } from "./plugin-
|
|
7
|
-
import "./cjs-
|
|
8
|
-
import "./shared-
|
|
6
|
+
import { i as vitePluginRscMinimal, n as transformRscCssExport, r as vitePluginRsc, t as getPluginApi } from "./plugin-BIsCR7Tu.js";
|
|
7
|
+
import "./cjs-DHD_0drE.js";
|
|
8
|
+
import "./shared-AtH_QTi7.js";
|
|
9
9
|
|
|
10
10
|
export { vitePluginRsc as default, getPluginApi, transformRscCssExport, vitePluginRscMinimal };
|
package/dist/plugins/cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../dist-BRSdGcl7.js";
|
|
2
|
-
import { t as cjsModuleRunnerPlugin } from "../cjs-
|
|
3
|
-
import "../shared-
|
|
2
|
+
import { t as cjsModuleRunnerPlugin } from "../cjs-DHD_0drE.js";
|
|
3
|
+
import "../shared-AtH_QTi7.js";
|
|
4
4
|
|
|
5
5
|
export { cjsModuleRunnerPlugin };
|
package/dist/rsc.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./dist-BRSdGcl7.js";
|
|
2
2
|
import "./encryption-utils-6p8t4Xqm.js";
|
|
3
|
+
import { a as toReferenceValidationVirtual } from "./shared-AtH_QTi7.js";
|
|
3
4
|
import "./shared-DEpnONZf.js";
|
|
4
5
|
import { a as setRequireModule, i as loadServerAction, r as createServerManifest, t as createClientManifest } from "./rsc-BwsRzIFM.js";
|
|
5
6
|
import { a as decodeFormState, c as registerClientReference, i as decodeAction, l as registerServerReference, n as createFromReadableStream, o as decodeReply, r as createTemporaryReferenceSet, s as encodeReply, t as createClientTemporaryReferenceSet, u as renderToReadableStream } from "./rsc-BIM0wUrP.js";
|
|
@@ -10,11 +11,19 @@ import serverReferences from "virtual:vite-rsc/server-references";
|
|
|
10
11
|
initialize();
|
|
11
12
|
function initialize() {
|
|
12
13
|
setRequireModule({ load: async (id) => {
|
|
13
|
-
if (!import.meta.env.__vite_rsc_build__)
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if (!import.meta.env.__vite_rsc_build__) {
|
|
15
|
+
await import(
|
|
16
|
+
/* @vite-ignore */
|
|
17
|
+
"/@id/__x00__" + toReferenceValidationVirtual({
|
|
18
|
+
id,
|
|
19
|
+
type: "server"
|
|
20
|
+
})
|
|
16
21
|
);
|
|
17
|
-
|
|
22
|
+
return import(
|
|
23
|
+
/* @vite-ignore */
|
|
24
|
+
id
|
|
25
|
+
);
|
|
26
|
+
} else {
|
|
18
27
|
const import_ = serverReferences[id];
|
|
19
28
|
if (!import_) throw new Error(`server reference not found '${id}'`);
|
|
20
29
|
return import_();
|
|
@@ -16,6 +16,12 @@ function parseIdQuery(id) {
|
|
|
16
16
|
query: Object.fromEntries(new URLSearchParams(rawQuery))
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
function toReferenceValidationVirtual({ id, type }) {
|
|
20
|
+
return `virtual:vite-rsc/reference-validation?type=${type}&id=${encodeURIComponent(id)}&lang.js`;
|
|
21
|
+
}
|
|
22
|
+
function parseReferenceValidationVirtual(id) {
|
|
23
|
+
if (id.startsWith("\0virtual:vite-rsc/reference-validation?")) return parseIdQuery(id).query;
|
|
24
|
+
}
|
|
19
25
|
|
|
20
26
|
//#endregion
|
|
21
|
-
export { parseIdQuery as n,
|
|
27
|
+
export { toReferenceValidationVirtual as a, toCssVirtual as i, parseIdQuery as n, parseReferenceValidationVirtual as r, parseCssVirtual as t };
|
package/dist/ssr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./dist-BRSdGcl7.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as toReferenceValidationVirtual, i as toCssVirtual } from "./shared-AtH_QTi7.js";
|
|
3
3
|
import "./shared-DEpnONZf.js";
|
|
4
4
|
import { n as setRequireModule, t as createServerConsumerManifest } from "./ssr-CDPTWY93.js";
|
|
5
5
|
import { i as findSourceMapURL, n as createFromReadableStream, r as createServerReference, t as callServer } from "./ssr-B-bLmlbm.js";
|
|
@@ -11,20 +11,28 @@ import * as ReactDOM from "react-dom";
|
|
|
11
11
|
initialize();
|
|
12
12
|
function initialize() {
|
|
13
13
|
setRequireModule({ load: async (id) => {
|
|
14
|
-
if (!import.meta.env.__vite_rsc_build__)
|
|
15
|
-
|
|
16
|
-
id
|
|
17
|
-
), {
|
|
18
|
-
js: [],
|
|
19
|
-
css: (await import(
|
|
14
|
+
if (!import.meta.env.__vite_rsc_build__) {
|
|
15
|
+
await import(
|
|
20
16
|
/* @vite-ignore */
|
|
21
|
-
"/@id/__x00__" +
|
|
17
|
+
"/@id/__x00__" + toReferenceValidationVirtual({
|
|
22
18
|
id,
|
|
23
|
-
type: "
|
|
19
|
+
type: "client"
|
|
24
20
|
})
|
|
21
|
+
);
|
|
22
|
+
return wrapResourceProxy(await import(
|
|
23
|
+
/* @vite-ignore */
|
|
24
|
+
id
|
|
25
|
+
), {
|
|
26
|
+
js: [],
|
|
27
|
+
css: (await import(
|
|
28
|
+
/* @vite-ignore */
|
|
29
|
+
"/@id/__x00__" + toCssVirtual({
|
|
30
|
+
id,
|
|
31
|
+
type: "ssr"
|
|
32
|
+
})
|
|
25
33
|
)).default
|
|
26
|
-
|
|
27
|
-
else {
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
28
36
|
const import_ = clientReferences.default[id];
|
|
29
37
|
if (!import_) throw new Error(`client reference not found '${id}'`);
|
|
30
38
|
const deps = assetsManifest.clientReferenceDeps[id];
|