@vizejs/vite-plugin 0.84.0 → 0.85.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 +31 -11
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -926,6 +926,32 @@ function resolveBareImportWithNode(state, id, importer) {
|
|
|
926
926
|
}
|
|
927
927
|
return null;
|
|
928
928
|
}
|
|
929
|
+
function normalizeResolvedVuePath(id) {
|
|
930
|
+
const pathPart = id.split("?")[0];
|
|
931
|
+
if (!pathPart?.endsWith(".vue")) return null;
|
|
932
|
+
return pathPart.startsWith("/@fs/") ? pathPart.slice(4) : pathPart;
|
|
933
|
+
}
|
|
934
|
+
async function resolveAliasedVueImport(ctx, state, id, importer, isSsrRequest, handleNodeModules) {
|
|
935
|
+
if (path.isAbsolute(id)) return null;
|
|
936
|
+
const viteImporter = normalizeRequireBase(importer) ?? importer;
|
|
937
|
+
const viteResolved = await ctx.resolve(id, viteImporter, { skipSelf: true });
|
|
938
|
+
const realPath = viteResolved ? normalizeResolvedVuePath(viteResolved.id) : null;
|
|
939
|
+
if (!realPath) return null;
|
|
940
|
+
const isResolvedNodeModules = realPath.includes("node_modules");
|
|
941
|
+
if (!handleNodeModules && isResolvedNodeModules) {
|
|
942
|
+
state.logger.log(`resolveId: skipping resolved node_modules path ${realPath}`);
|
|
943
|
+
return null;
|
|
944
|
+
}
|
|
945
|
+
if (!isResolvedNodeModules && state.filter && !state.filter(realPath)) {
|
|
946
|
+
state.logger.log(`resolveId: skipping filtered resolved path ${realPath}`);
|
|
947
|
+
return null;
|
|
948
|
+
}
|
|
949
|
+
if (state.cache.has(realPath) || fs.existsSync(realPath)) {
|
|
950
|
+
state.logger.log(`resolveId: resolved via Vite fallback ${id} to ${realPath}`);
|
|
951
|
+
return toVirtualId(realPath, isSsrRequest);
|
|
952
|
+
}
|
|
953
|
+
return null;
|
|
954
|
+
}
|
|
929
955
|
async function resolveIdHook(ctx, state, id, importer, options) {
|
|
930
956
|
const isBuild = state.server === null;
|
|
931
957
|
const isSsrRequest = !!options?.ssr || (importer ? isVizeSsrVirtual(importer) : false);
|
|
@@ -1062,6 +1088,11 @@ async function resolveIdHook(ctx, state, id, importer, options) {
|
|
|
1062
1088
|
return null;
|
|
1063
1089
|
}
|
|
1064
1090
|
const resolved = resolveVuePath(state, id, importer);
|
|
1091
|
+
const fileExists = fs.existsSync(resolved);
|
|
1092
|
+
if (!fileExists) {
|
|
1093
|
+
const aliased = await resolveAliasedVueImport(ctx, state, id, importer, isSsrRequest, handleNodeModules);
|
|
1094
|
+
if (aliased) return aliased;
|
|
1095
|
+
}
|
|
1065
1096
|
const isNodeModulesPath = resolved.includes("node_modules");
|
|
1066
1097
|
if (!handleNodeModules && isNodeModulesPath) {
|
|
1067
1098
|
state.logger.log(`resolveId: skipping node_modules path ${resolved}`);
|
|
@@ -1072,19 +1103,8 @@ async function resolveIdHook(ctx, state, id, importer, options) {
|
|
|
1072
1103
|
return null;
|
|
1073
1104
|
}
|
|
1074
1105
|
const hasCache = state.cache.has(resolved);
|
|
1075
|
-
const fileExists = fs.existsSync(resolved);
|
|
1076
1106
|
state.logger.log(`resolveId: id=${id}, resolved=${resolved}, hasCache=${hasCache}, fileExists=${fileExists}, importer=${importer ?? "none"}`);
|
|
1077
1107
|
if (hasCache || fileExists) return toVirtualId(resolved, isSsrRequest);
|
|
1078
|
-
if (!fileExists && !path.isAbsolute(id)) {
|
|
1079
|
-
const viteResolved = await ctx.resolve(id, importer, { skipSelf: true });
|
|
1080
|
-
if (viteResolved && viteResolved.id.endsWith(".vue")) {
|
|
1081
|
-
const realPath = viteResolved.id;
|
|
1082
|
-
if ((realPath.includes("node_modules") ? handleNodeModules : state.filter(realPath)) && (state.cache.has(realPath) || fs.existsSync(realPath))) {
|
|
1083
|
-
state.logger.log(`resolveId: resolved via Vite fallback ${id} to ${realPath}`);
|
|
1084
|
-
return toVirtualId(realPath, isSsrRequest);
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
1108
|
}
|
|
1089
1109
|
return null;
|
|
1090
1110
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@vizejs/native": "0.
|
|
36
|
+
"@vizejs/native": "0.85.0",
|
|
37
37
|
"tinyglobby": "0.2.16",
|
|
38
|
-
"vize": "0.
|
|
38
|
+
"vize": "0.85.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "25.7.0",
|