@vizejs/vite-plugin 0.77.0 → 0.78.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 +23 -12
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -870,6 +870,9 @@ function hasMacroQuery$1(id) {
|
|
|
870
870
|
function isMacroVirtualId(id) {
|
|
871
871
|
return id.startsWith("\0") && (hasMacroQuery$1(id) || hasQueryParam$1(id, "definePage"));
|
|
872
872
|
}
|
|
873
|
+
function isVueSfcPath$1(id) {
|
|
874
|
+
return (id.split("?")[0] ?? id).endsWith(".vue");
|
|
875
|
+
}
|
|
873
876
|
function normalizeRequireBase(importer) {
|
|
874
877
|
if (!importer) return null;
|
|
875
878
|
let normalized = importer;
|
|
@@ -930,7 +933,7 @@ async function resolveIdHook(ctx, state, id, importer, options) {
|
|
|
930
933
|
}
|
|
931
934
|
if (id === "virtual:vize-styles") return RESOLVED_CSS_MODULE;
|
|
932
935
|
if (isBuild && id.startsWith("/@fs/")) return normalizeFsIdForBuild(id);
|
|
933
|
-
if (hasMacroQuery$1(id) || hasQueryParam$1(id, "definePage")) {
|
|
936
|
+
if ((hasMacroQuery$1(id) || hasQueryParam$1(id, "definePage")) && isVueSfcPath$1(id)) {
|
|
934
937
|
const filePath = id.split("?")[0];
|
|
935
938
|
const querySuffix = id.slice(id.indexOf("?"));
|
|
936
939
|
const resolved = resolveVuePath(state, filePath, importer);
|
|
@@ -1094,6 +1097,9 @@ function hasMacroQuery(id) {
|
|
|
1094
1097
|
function normalizeMacroRealPath(realPath) {
|
|
1095
1098
|
return realPath.endsWith(".vue.ts") ? realPath.slice(0, -3) : realPath;
|
|
1096
1099
|
}
|
|
1100
|
+
function isVueSfcPath(realPath) {
|
|
1101
|
+
return normalizeMacroRealPath(realPath).endsWith(".vue");
|
|
1102
|
+
}
|
|
1097
1103
|
function stripVirtualQuery(id) {
|
|
1098
1104
|
return normalizeMacroRealPath(id.slice(1).split("?")[0] ?? "");
|
|
1099
1105
|
}
|
|
@@ -1160,22 +1166,27 @@ function loadHook(state, id, loadOptions) {
|
|
|
1160
1166
|
if (fallbackCompiled?.css) return resolveCssImports(fallbackCompiled.css, realPath, state.cssAliasRules, state.server !== null, currentBase);
|
|
1161
1167
|
return "";
|
|
1162
1168
|
}
|
|
1163
|
-
if (id.startsWith("\0") && hasQueryParam(id, "definePage"))
|
|
1169
|
+
if (id.startsWith("\0") && hasQueryParam(id, "definePage")) {
|
|
1170
|
+
const realPath = stripVirtualQuery(id);
|
|
1171
|
+
if (isVueSfcPath(realPath)) return loadDefinePageArtifact(state, realPath, !!loadOptions?.ssr);
|
|
1172
|
+
}
|
|
1164
1173
|
if (id.startsWith("\0") && hasMacroQuery(id)) {
|
|
1165
1174
|
const realPath = stripVirtualQuery(id);
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1175
|
+
if (isVueSfcPath(realPath)) {
|
|
1176
|
+
const artifactLoad = loadDefinePageMetaArtifact(state, realPath, !!loadOptions?.ssr);
|
|
1177
|
+
if (artifactLoad) return artifactLoad;
|
|
1178
|
+
if (fs.existsSync(realPath)) {
|
|
1179
|
+
const setupMatch = fs.readFileSync(realPath, "utf-8").match(/<script\s+setup[^>]*>([\s\S]*?)<\/script>/);
|
|
1180
|
+
if (setupMatch) return {
|
|
1181
|
+
code: `${setupMatch[1]}\nexport default {}`,
|
|
1182
|
+
map: null
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
return {
|
|
1186
|
+
code: "export default {}",
|
|
1172
1187
|
map: null
|
|
1173
1188
|
};
|
|
1174
1189
|
}
|
|
1175
|
-
return {
|
|
1176
|
-
code: "export default {}",
|
|
1177
|
-
map: null
|
|
1178
|
-
};
|
|
1179
1190
|
}
|
|
1180
1191
|
if (isVizeVirtual(id)) {
|
|
1181
1192
|
const realPath = fromVirtualId(id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.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.78.0",
|
|
37
37
|
"tinyglobby": "0.2.16",
|
|
38
|
-
"vize": "0.
|
|
38
|
+
"vize": "0.78.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "25.6.0",
|