@vizejs/nuxt 0.537.0 → 0.538.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.
|
@@ -1143,7 +1143,7 @@ function rejectLegacyConfig(source) {
|
|
|
1143
1143
|
"lint",
|
|
1144
1144
|
"fmt",
|
|
1145
1145
|
"pack"
|
|
1146
|
-
]) if ((Array.isArray(source[key]) ? source[key] : [source[key]]).some((value) => object(value) && Object.hasOwn(value, "vize"))) throw new Error(
|
|
1146
|
+
]) if ((Array.isArray(source[key]) ? source[key] : [source[key]]).some((value) => object(value) && Object.hasOwn(value, "vize"))) throw new Error(key === "lint" ? "lint.vize is no longer supported; pass { lint: false } as defineConfig's integration options to disable the Vite+ native lint task while keeping CLI lint enabled, and put shared lint settings in vue.linter" : `${key}.vize: configuration is no longer supported; move Vue settings to vue: in vite.config.*`);
|
|
1147
1147
|
}
|
|
1148
1148
|
const VITE_CONFIG_FILE_NAMES = [
|
|
1149
1149
|
"vite.config.ts",
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as setupLintInspector, l as setupNuxtLintChecker, m as hasNuxtViteCompilerSupport, n as setupNuxtLintConfigGeneration, p as getDetectedNuxtMajor } from "./generation-
|
|
1
|
+
import { i as setupLintInspector, l as setupNuxtLintChecker, m as hasNuxtViteCompilerSupport, n as setupNuxtLintConfigGeneration, p as getDetectedNuxtMajor } from "./generation-Dm8lrkLT.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import fs from "node:fs";
|
|
3
|
+
import fs, { readFileSync, realpathSync } from "node:fs";
|
|
4
4
|
import path, { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { parseSync } from "vite";
|
|
6
|
-
import { pathToFileURL } from "node:url";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
//#region src/component-imports.ts
|
|
9
9
|
const COMPONENT_CALL_RE = /_?resolveComponent\s*\(\s*["'`]([^"'`]+)["'`]\s*(?:,\s*[^)]+)?\)/g;
|
|
@@ -1119,6 +1119,66 @@ function rewriteBareVueImportsToClientRuntime(code) {
|
|
|
1119
1119
|
});
|
|
1120
1120
|
}
|
|
1121
1121
|
//#endregion
|
|
1122
|
+
//#region src/vapor-vue.ts
|
|
1123
|
+
/**
|
|
1124
|
+
* Fail before Vite when Vapor would compile an SFC against Vue older than 3.6.
|
|
1125
|
+
* `3.6.0-rc.12` is new enough; do not apply semver's prerelease ordering.
|
|
1126
|
+
*/
|
|
1127
|
+
function assertNuxtVaporVue(rootDir, compiler) {
|
|
1128
|
+
if (compiler.vapor !== true) return compiler;
|
|
1129
|
+
const tooOld = vueCopiesForVapor(rootDir, compiler.handleNodeModulesVue !== false).filter((copy) => !vueVersionSupportsVapor(copy.version));
|
|
1130
|
+
if (tooOld.length === 0) return compiler;
|
|
1131
|
+
const details = tooOld.map((copy) => `vue@${copy.version} at ${copy.directory}`).join("; ");
|
|
1132
|
+
throw new Error(`@vizejs/nuxt: compiler.vapor requires Vue >= 3.6. Resolved ${details}.`);
|
|
1133
|
+
}
|
|
1134
|
+
function vueCopiesForVapor(rootDir, includeNuxtPackageVue) {
|
|
1135
|
+
const appPackageJson = join(rootDir, "package.json");
|
|
1136
|
+
const copies = [readVueCopy(resolveFromPackage(appPackageJson, "vue/package.json"))];
|
|
1137
|
+
if (includeNuxtPackageVue) {
|
|
1138
|
+
const nuxtPackageJson = resolveFromPackage(appPackageJson, "nuxt/package.json");
|
|
1139
|
+
copies.push(readVueCopy(resolveFromPackage(nuxtPackageJson, "vue/package.json")));
|
|
1140
|
+
}
|
|
1141
|
+
return uniqueVueCopies(copies);
|
|
1142
|
+
}
|
|
1143
|
+
function resolveFromPackage(packageJsonPath, specifier) {
|
|
1144
|
+
try {
|
|
1145
|
+
return createRequire(packageJsonPath).resolve(specifier);
|
|
1146
|
+
} catch (error) {
|
|
1147
|
+
throw new Error(`@vizejs/nuxt: compiler.vapor requires Vue >= 3.6, but ${specifier} could not be resolved from ${packageJsonPath}.`, { cause: error });
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
function readVueCopy(packageJsonPath) {
|
|
1151
|
+
let parsed;
|
|
1152
|
+
try {
|
|
1153
|
+
parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
1154
|
+
} catch (error) {
|
|
1155
|
+
throw new Error(`@vizejs/nuxt: compiler.vapor requires Vue >= 3.6, but ${packageJsonPath} could not be read.`, { cause: error });
|
|
1156
|
+
}
|
|
1157
|
+
if (typeof parsed.version !== "string" || parsed.version.length === 0) throw new Error(`@vizejs/nuxt: compiler.vapor requires Vue >= 3.6, but ${packageJsonPath} has no version.`);
|
|
1158
|
+
return {
|
|
1159
|
+
version: parsed.version,
|
|
1160
|
+
directory: realpathSync(dirname(packageJsonPath))
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
function uniqueVueCopies(copies) {
|
|
1164
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1165
|
+
const unique = [];
|
|
1166
|
+
for (const copy of copies) {
|
|
1167
|
+
if (seen.has(copy.directory)) continue;
|
|
1168
|
+
seen.add(copy.directory);
|
|
1169
|
+
unique.push(copy);
|
|
1170
|
+
}
|
|
1171
|
+
return unique;
|
|
1172
|
+
}
|
|
1173
|
+
/** Major above 3, or Vue 3.6+, including prereleases such as 3.6.0-rc.12. */
|
|
1174
|
+
function vueVersionSupportsVapor(version) {
|
|
1175
|
+
const match = /^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(version.trim());
|
|
1176
|
+
if (match == null) return false;
|
|
1177
|
+
const major = Number(match[1]);
|
|
1178
|
+
const minor = Number(match[2]);
|
|
1179
|
+
return major > 3 || major === 3 && minor >= 6;
|
|
1180
|
+
}
|
|
1181
|
+
//#endregion
|
|
1122
1182
|
//#region src/compiler-option-bridge.ts
|
|
1123
1183
|
function unsupportedNuxtVueCompilerOptions(options) {
|
|
1124
1184
|
return Object.entries(options ?? {}).filter(([key, value]) => value !== void 0 && (key !== "whitespace" || value !== "condense" && value !== "preserve")).map(([key]) => key);
|
|
@@ -1160,14 +1220,14 @@ function resolveNuxtCompilerOptions(rootDir, baseURL, buildAssetsDir, compiler,
|
|
|
1160
1220
|
if (unsupported.length > 0) compatibilityOptions.hostCompiler = true;
|
|
1161
1221
|
const hasCompatibilityOptions = Object.keys(compatibilityOptions).length > 0;
|
|
1162
1222
|
const overrides = typeof compiler === "object" && compiler != null ? compiler : {};
|
|
1163
|
-
return buildNuxtCompilerOptions(rootDir, baseURL, buildAssetsDir, {
|
|
1223
|
+
return assertNuxtVaporVue(rootDir, buildNuxtCompilerOptions(rootDir, baseURL, buildAssetsDir, {
|
|
1164
1224
|
vueVersion: compatibility.vueVersion,
|
|
1165
1225
|
...hasCompatibilityOptions ? { compatibility: compatibilityOptions } : {},
|
|
1166
1226
|
mode: compatibility.scriptSetupInStandalone === true ? "function" : void 0,
|
|
1167
1227
|
...vueCompilerOptions?.whitespace === "condense" || vueCompilerOptions?.whitespace === "preserve" ? { whitespace: vueCompilerOptions.whitespace } : {},
|
|
1168
1228
|
...overrides,
|
|
1169
1229
|
...unsupported.length > 0 ? { compatibility: compatibilityOptions } : {}
|
|
1170
|
-
});
|
|
1230
|
+
}));
|
|
1171
1231
|
}
|
|
1172
1232
|
//#endregion
|
|
1173
1233
|
//#region src/options.ts
|
|
@@ -1228,11 +1288,25 @@ function resolveNuxtMuseaOptions(musea) {
|
|
|
1228
1288
|
}
|
|
1229
1289
|
//#endregion
|
|
1230
1290
|
//#region src/resolver.ts
|
|
1231
|
-
const
|
|
1232
|
-
function createNuxtModuleResolver() {
|
|
1233
|
-
const moduleDir =
|
|
1291
|
+
const RUNNING_DIST_ENTRY = /((?:file:\/\/)?[^\s)]+?[/\\]dist[/\\](?:index\.mjs|nuxt2-entry\.cjs))/;
|
|
1292
|
+
function createNuxtModuleResolver(rootDir) {
|
|
1293
|
+
const moduleDir = resolveInstalledModuleDir(rootDir);
|
|
1234
1294
|
return { resolve: (...segments) => resolve(moduleDir, ...segments) };
|
|
1235
1295
|
}
|
|
1296
|
+
function resolveInstalledModuleDir(rootDir) {
|
|
1297
|
+
try {
|
|
1298
|
+
return dirname(createRequire(`${rootDir}/package.json`).resolve("@vizejs/nuxt"));
|
|
1299
|
+
} catch (error) {
|
|
1300
|
+
const running = runningModuleDir();
|
|
1301
|
+
if (running) return running;
|
|
1302
|
+
throw error;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
function runningModuleDir() {
|
|
1306
|
+
const found = (/* @__PURE__ */ new Error()).stack?.match(RUNNING_DIST_ENTRY)?.[1];
|
|
1307
|
+
if (!found) return void 0;
|
|
1308
|
+
return dirname(found.startsWith("file://") ? fileURLToPath(found) : found);
|
|
1309
|
+
}
|
|
1236
1310
|
//#endregion
|
|
1237
1311
|
//#region src/module-records.ts
|
|
1238
1312
|
function isPlainRecord(value) {
|
|
@@ -1484,7 +1558,7 @@ function patchNuxtAutoImportTransformPlugin(plugin, isBuild) {
|
|
|
1484
1558
|
async function setupVizeNuxtModule(options, nuxt) {
|
|
1485
1559
|
const lintGeneration = await setupNuxtLintConfigGeneration(options.lint, nuxt);
|
|
1486
1560
|
await setupNuxtLintChecker(options.checker, nuxt, lintGeneration);
|
|
1487
|
-
const resolver = createNuxtModuleResolver();
|
|
1561
|
+
const resolver = createNuxtModuleResolver(nuxt.options.rootDir);
|
|
1488
1562
|
const detectedNuxtMajor = options.compatibility?.nuxtVersion ?? getDetectedNuxtMajor(nuxt) ?? 3;
|
|
1489
1563
|
const vueVersion = options.compatibility?.vueVersion ?? (detectedNuxtMajor === 2 ? 2 : 3);
|
|
1490
1564
|
const nuxtWithBuilderOptions = nuxt;
|
package/dist/lint/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as toNuxtLintProjectState, c as setupNuxtLintConfigAddons, d as createNuxtLintCheckerVitePlugin, f as resolveNuxtLintCheckerOptions, l as setupNuxtLintChecker, n as setupNuxtLintConfigGeneration, o as renderNuxtOxlintConfig, r as writeFileIfChanged, s as VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, t as ROOT_OXLINT_CONFIG_NAMES, u as createNuxtLintCheckerWebpackPlugin } from "../generation-
|
|
1
|
+
import { a as toNuxtLintProjectState, c as setupNuxtLintConfigAddons, d as createNuxtLintCheckerVitePlugin, f as resolveNuxtLintCheckerOptions, l as setupNuxtLintChecker, n as setupNuxtLintConfigGeneration, o as renderNuxtOxlintConfig, r as writeFileIfChanged, s as VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, t as ROOT_OXLINT_CONFIG_NAMES, u as createNuxtLintCheckerWebpackPlugin } from "../generation-Dm8lrkLT.mjs";
|
|
2
2
|
export * from "@vizejs/nuxt-lint-config";
|
|
3
3
|
export { ROOT_OXLINT_CONFIG_NAMES, VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, createNuxtLintCheckerVitePlugin, createNuxtLintCheckerWebpackPlugin, renderNuxtOxlintConfig, resolveNuxtLintCheckerOptions, setupNuxtLintChecker, setupNuxtLintConfigAddons, setupNuxtLintConfigGeneration, toNuxtLintProjectState, writeFileIfChanged };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.538.0",
|
|
4
4
|
"description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@nuxt/kit": "3.11.2",
|
|
52
|
-
"@vizejs/native": "0.
|
|
53
|
-
"@vizejs/nuxt-lint-config": "0.
|
|
54
|
-
"@vizejs/vite-plugin": "0.
|
|
55
|
-
"@vizejs/vite-plugin-musea": "0.
|
|
56
|
-
"oxlint-plugin-vize": "0.
|
|
57
|
-
"vize": "0.
|
|
52
|
+
"@vizejs/native": "0.538.0",
|
|
53
|
+
"@vizejs/nuxt-lint-config": "0.538.0",
|
|
54
|
+
"@vizejs/vite-plugin": "0.538.0",
|
|
55
|
+
"@vizejs/vite-plugin-musea": "0.538.0",
|
|
56
|
+
"oxlint-plugin-vize": "0.538.0",
|
|
57
|
+
"vize": "0.538.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"jiti-nuxt2": "npm:jiti@1.21.7",
|