@vitejs/plugin-rsc 0.5.24 → 0.5.25
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.
|
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
11
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
12
|
key = keys[i];
|
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-BhzHKRFo.js";
|
|
2
2
|
export { vitePluginRsc as default, getPluginApi };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __commonJSMin } from "./chunk-
|
|
1
|
+
import { t as __commonJSMin } from "./chunk-DpdyVxdi.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
4
|
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __toESM } from "./chunk-
|
|
1
|
+
import { n as __toESM } from "./chunk-DpdyVxdi.js";
|
|
2
2
|
import { t as createDebug } from "./dist-rz-Bnebz.js";
|
|
3
3
|
import vitePluginRscCore from "./core/plugin.js";
|
|
4
4
|
import { a as hasDirective } from "./scope-DKCDtt0O.js";
|
|
@@ -63,9 +63,9 @@ function normalizeResolvedIdToUrl(environment, url, resolved) {
|
|
|
63
63
|
if (url[0] !== "." && url[0] !== "/") url = wrapId(resolved.id);
|
|
64
64
|
return url;
|
|
65
65
|
}
|
|
66
|
-
function normalizeViteImportAnalysisUrl(environment, id) {
|
|
66
|
+
function normalizeViteImportAnalysisUrl(environment, id, options) {
|
|
67
67
|
let url = normalizeResolvedIdToUrl(environment, id, { id });
|
|
68
|
-
if (environment.config.consumer === "client") {
|
|
68
|
+
if (options?.injectHMRTimestamp || environment.config.consumer === "client") {
|
|
69
69
|
const mod = environment.moduleGraph.getModuleById(id);
|
|
70
70
|
if (mod && mod.lastHMRTimestamp > 0) url = injectQuery(url, `t=${mod.lastHMRTimestamp}`);
|
|
71
71
|
}
|
|
@@ -605,7 +605,7 @@ function vitePluginRscMinimal(rscPluginOptions = {}, manager = new RscPluginMana
|
|
|
605
605
|
function vitePluginRsc(rscPluginOptions = {}) {
|
|
606
606
|
const manager = new RscPluginManager();
|
|
607
607
|
const buildApp = async (builder) => {
|
|
608
|
-
const colors = await import("./picocolors-
|
|
608
|
+
const colors = await import("./picocolors-BDx0CW3k.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
609
609
|
const logStep = (msg) => {
|
|
610
610
|
builder.config.logger.info(colors.blue(msg));
|
|
611
611
|
};
|
|
@@ -796,7 +796,10 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
796
796
|
environmentName: "rsc",
|
|
797
797
|
entryName: "index"
|
|
798
798
|
};
|
|
799
|
-
const handler = toNodeHandler(getFetchHandlerExport(await import(
|
|
799
|
+
const handler = toNodeHandler(getFetchHandlerExport(await import(
|
|
800
|
+
/* @vite-ignore */
|
|
801
|
+
pathToFileURL(path.join(manager.config.environments[options.environmentName].build.outDir, `${options.entryName}.js`)).href
|
|
802
|
+
)));
|
|
800
803
|
server.middlewares.use((req, _res, next) => {
|
|
801
804
|
delete req.headers["accept-encoding"];
|
|
802
805
|
next();
|
|
@@ -814,7 +817,10 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
814
817
|
},
|
|
815
818
|
async hotUpdate(ctx) {
|
|
816
819
|
if (isCSSRequest(ctx.file)) {
|
|
817
|
-
if (this.environment.name === "client")
|
|
820
|
+
if (this.environment.name === "client") {
|
|
821
|
+
if (rscPluginOptions.cssLinkPrecedence ?? true) return;
|
|
822
|
+
if (ctx.server.environments.rsc?.moduleGraph.getModuleById(ctx.file)) return ctx.modules.filter((mod) => mod.type !== "css");
|
|
823
|
+
}
|
|
818
824
|
}
|
|
819
825
|
if (ctx.modules.map((mod) => mod.id).filter((v) => v !== null).length === 0) return;
|
|
820
826
|
if (this.environment.name === "rsc") {
|
|
@@ -999,6 +1005,15 @@ export function createRpcClient(params) {
|
|
|
999
1005
|
}
|
|
1000
1006
|
}
|
|
1001
1007
|
},
|
|
1008
|
+
{
|
|
1009
|
+
name: "rsc:virtual:vite-rsc/track-bundles",
|
|
1010
|
+
generateBundle: {
|
|
1011
|
+
order: "post",
|
|
1012
|
+
handler(_options, bundle) {
|
|
1013
|
+
manager.bundles[this.environment.name] = bundle;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1002
1017
|
{
|
|
1003
1018
|
name: "rsc:virtual:vite-rsc/assets-manifest",
|
|
1004
1019
|
resolveId: {
|
|
@@ -1029,9 +1044,18 @@ export function createRpcClient(params) {
|
|
|
1029
1044
|
}
|
|
1030
1045
|
},
|
|
1031
1046
|
generateBundle(_options, bundle) {
|
|
1032
|
-
manager.bundles[this.environment.name] = bundle;
|
|
1033
1047
|
if (this.environment.name === "client") {
|
|
1034
1048
|
const rscBundle = manager.bundles["rsc"];
|
|
1049
|
+
if (!manager.config.environments.rsc.build.cssCodeSplit) {
|
|
1050
|
+
let cssBundleName;
|
|
1051
|
+
for (const output of Object.values(rscBundle)) if (output.type === "asset" && output.names.includes("style.css")) {
|
|
1052
|
+
cssBundleName = output.fileName;
|
|
1053
|
+
break;
|
|
1054
|
+
}
|
|
1055
|
+
if (cssBundleName) {
|
|
1056
|
+
for (const output of Object.values(rscBundle)) if (output.type === "chunk") output.viteMetadata.importedCss.add(cssBundleName);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1035
1059
|
const assets = new Set(Object.values(rscBundle).flatMap((output) => output.type === "chunk" ? [...output.viteMetadata?.importedCss ?? [], ...output.viteMetadata?.importedAssets ?? []] : []));
|
|
1036
1060
|
for (const fileName of assets) {
|
|
1037
1061
|
const asset = rscBundle[fileName];
|
|
@@ -1043,7 +1067,7 @@ export function createRpcClient(params) {
|
|
|
1043
1067
|
});
|
|
1044
1068
|
}
|
|
1045
1069
|
const serverResources = {};
|
|
1046
|
-
const rscAssetDeps = collectAssetDeps(
|
|
1070
|
+
const rscAssetDeps = collectAssetDeps(rscBundle);
|
|
1047
1071
|
for (const [id, meta] of Object.entries(manager.serverResourcesMetaMap)) serverResources[meta.key] = assetsURLOfDeps({
|
|
1048
1072
|
js: [],
|
|
1049
1073
|
css: rscAssetDeps[id]?.deps.css ?? []
|
|
@@ -1681,17 +1705,19 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1681
1705
|
const cssIds = /* @__PURE__ */ new Set();
|
|
1682
1706
|
const visitedFiles = /* @__PURE__ */ new Set();
|
|
1683
1707
|
function recurse(id) {
|
|
1684
|
-
if (visited.has(id)) return;
|
|
1708
|
+
if (visited.has(id) || parseCssVirtual(id)) return;
|
|
1685
1709
|
visited.add(id);
|
|
1686
1710
|
const mod = environment.moduleGraph.getModuleById(id);
|
|
1687
1711
|
if (mod?.file) visitedFiles.add(mod.file);
|
|
1688
1712
|
for (const next of mod?.importedModules ?? []) if (next.id) if (isCSSRequest(next.id)) {
|
|
1713
|
+
if (next.file) visitedFiles.add(next.file);
|
|
1689
1714
|
if (hasSpecialCssQuery(next.id)) continue;
|
|
1690
1715
|
cssIds.add(next.id);
|
|
1691
1716
|
} else recurse(next.id);
|
|
1692
1717
|
}
|
|
1693
1718
|
recurse(entryId);
|
|
1694
|
-
const
|
|
1719
|
+
const cssLinkPrecedence = rscCssOptions?.cssLinkPrecedence ?? true;
|
|
1720
|
+
const hrefs = [...cssIds].map((id) => normalizeViteImportAnalysisUrl(environment, id, { injectHMRTimestamp: !cssLinkPrecedence }));
|
|
1695
1721
|
return {
|
|
1696
1722
|
ids: [...cssIds],
|
|
1697
1723
|
hrefs,
|
package/dist/plugin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as vitePluginRscMinimal, n as transformRscCssExport, r as vitePluginRsc, t as getPluginApi } from "./plugin-
|
|
1
|
+
import { i as vitePluginRscMinimal, n as transformRscCssExport, r as vitePluginRsc, t as getPluginApi } from "./plugin-BhzHKRFo.js";
|
|
2
2
|
export { vitePluginRsc as default, getPluginApi, transformRscCssExport, vitePluginRscMinimal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/plugin-rsc",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.25",
|
|
4
4
|
"description": "React Server Components (RSC) support for Vite.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"prepack": "tsdown"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@rolldown/pluginutils": "1.0.0-rc.
|
|
42
|
+
"@rolldown/pluginutils": "1.0.0-rc.17",
|
|
43
43
|
"es-module-lexer": "^2.0.0",
|
|
44
44
|
"estree-walker": "^3.0.3",
|
|
45
45
|
"magic-string": "^0.30.21",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"react-dom": "^19.2.5",
|
|
65
65
|
"react-server-dom-webpack": "^19.2.5",
|
|
66
66
|
"tinyexec": "^1.1.1",
|
|
67
|
-
"tsdown": "^0.21.
|
|
67
|
+
"tsdown": "^0.21.10"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": "*",
|