@vizejs/vite-plugin 0.151.0 → 0.153.0
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/index.mjs +22 -9
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -566,10 +566,13 @@ const vueResolvableFromRootCache = /* @__PURE__ */ new Map();
|
|
|
566
566
|
function isVueResolvableFromRoot(root) {
|
|
567
567
|
let cached = vueResolvableFromRootCache.get(root);
|
|
568
568
|
if (cached === void 0) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
569
|
+
const rootNodeModules = path.join(root, "node_modules");
|
|
570
|
+
const directPackageJson = path.join(rootNodeModules, "vue", "package.json");
|
|
571
|
+
cached = fs.existsSync(directPackageJson);
|
|
572
|
+
if (!cached) try {
|
|
573
|
+
const resolved = createRequire(path.join(root, "__vize_probe__.js")).resolve("vue/package.json");
|
|
574
|
+
const relative = path.relative(rootNodeModules, resolved);
|
|
575
|
+
cached = relative !== "" && !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
573
576
|
} catch {}
|
|
574
577
|
vueResolvableFromRootCache.set(root, cached);
|
|
575
578
|
}
|
|
@@ -1058,6 +1061,7 @@ function formatUnknownError(error) {
|
|
|
1058
1061
|
}
|
|
1059
1062
|
//#endregion
|
|
1060
1063
|
//#region src/plugin/hmr.ts
|
|
1064
|
+
const VIZE_COMPONENTS_CSS_FILE = "assets/vize-components.css";
|
|
1061
1065
|
async function handleHotUpdateHook(state, ctx) {
|
|
1062
1066
|
const { file, server, read } = ctx;
|
|
1063
1067
|
if (file.endsWith(".vue") && state.filter(file)) try {
|
|
@@ -1125,17 +1129,26 @@ async function handleHotUpdateHook(state, ctx) {
|
|
|
1125
1129
|
state.logger.error(`Re-compilation failed for ${file}:`, e);
|
|
1126
1130
|
}
|
|
1127
1131
|
}
|
|
1128
|
-
function handleGenerateBundleHook(state, emitFile) {
|
|
1132
|
+
function handleGenerateBundleHook(state, emitFile, bundle) {
|
|
1129
1133
|
if (!state.extractCss || state.collectedCss.size === 0) return;
|
|
1130
1134
|
let allCss = "";
|
|
1131
1135
|
for (const css of state.collectedCss.values()) allCss += allCss ? `\n\n${css}` : css;
|
|
1132
1136
|
if (allCss.trim()) {
|
|
1133
1137
|
emitFile({
|
|
1134
1138
|
type: "asset",
|
|
1135
|
-
fileName:
|
|
1139
|
+
fileName: VIZE_COMPONENTS_CSS_FILE,
|
|
1136
1140
|
source: allCss
|
|
1137
1141
|
});
|
|
1138
|
-
|
|
1142
|
+
attachComponentsCssToEntryChunks(bundle);
|
|
1143
|
+
state.logger.log(`Extracted CSS to ${VIZE_COMPONENTS_CSS_FILE} (${state.collectedCss.size} components)`);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
function attachComponentsCssToEntryChunks(bundle) {
|
|
1147
|
+
for (const item of Object.values(bundle)) {
|
|
1148
|
+
if (item.type !== "chunk" || !item.isEntry && !item.isDynamicEntry) continue;
|
|
1149
|
+
item.viteMetadata ??= {};
|
|
1150
|
+
item.viteMetadata.importedCss ??= /* @__PURE__ */ new Set();
|
|
1151
|
+
item.viteMetadata.importedCss.add(VIZE_COMPONENTS_CSS_FILE);
|
|
1139
1152
|
}
|
|
1140
1153
|
}
|
|
1141
1154
|
//#endregion
|
|
@@ -1498,8 +1511,8 @@ function vize(options = {}) {
|
|
|
1498
1511
|
async handleHotUpdate(ctx) {
|
|
1499
1512
|
return handleHotUpdateHook(state, ctx);
|
|
1500
1513
|
},
|
|
1501
|
-
generateBundle() {
|
|
1502
|
-
handleGenerateBundleHook(state, this.emitFile.bind(this));
|
|
1514
|
+
generateBundle(_, bundle) {
|
|
1515
|
+
handleGenerateBundleHook(state, this.emitFile.bind(this), bundle);
|
|
1503
1516
|
},
|
|
1504
1517
|
closeBundle() {
|
|
1505
1518
|
if (state.server === null) clearBuildCaches(state);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.153.0",
|
|
4
4
|
"description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@vizejs/native": "0.
|
|
42
|
+
"@vizejs/native": "0.153.0",
|
|
43
43
|
"tinyglobby": "0.2.16",
|
|
44
|
-
"vize": "0.
|
|
44
|
+
"vize": "0.153.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "25.7.0",
|