@vizejs/nuxt 0.571.0 → 0.572.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.
|
@@ -39,6 +39,13 @@ function getNuxtBuilderKind(builder) {
|
|
|
39
39
|
if (isWebpackNuxtBuilder(builder)) return "webpack";
|
|
40
40
|
return "unsupported";
|
|
41
41
|
}
|
|
42
|
+
/** Nuxt 2's default webpack builder has no Nuxt 3-style builder name. */
|
|
43
|
+
function getDetectedNuxtBuilderKind(nuxt) {
|
|
44
|
+
const builder = nuxt.options.builder;
|
|
45
|
+
if (builder !== void 0) return getNuxtBuilderKind(builder);
|
|
46
|
+
if (getDetectedNuxtMajor(nuxt) !== 2) return "unsupported";
|
|
47
|
+
return nuxt.options.bridge && nuxt.options.bridge.vite === true ? "vite" : "webpack";
|
|
48
|
+
}
|
|
42
49
|
//#endregion
|
|
43
50
|
//#region src/lint/checker/options.ts
|
|
44
51
|
/**
|
|
@@ -538,6 +545,17 @@ function createNuxtLintCheckerWebpackPlugin(config, dependencies = {}) {
|
|
|
538
545
|
}
|
|
539
546
|
//#endregion
|
|
540
547
|
//#region src/lint/checker/setup.ts
|
|
548
|
+
function registerNuxt2Checker(nuxt, builder, plugin) {
|
|
549
|
+
if (!nuxt.hook) throw new Error("Nuxt 2 checker registration requires the host hook API.");
|
|
550
|
+
if (builder === "webpack") nuxt.hook("webpack:config", (value) => {
|
|
551
|
+
for (const config of value) if (config.name === "client") (config.plugins ??= []).push(plugin);
|
|
552
|
+
});
|
|
553
|
+
else nuxt.hook("vite:extendConfig", (value, context) => {
|
|
554
|
+
if (context?.isServer) return;
|
|
555
|
+
const config = value;
|
|
556
|
+
(config.plugins ??= []).push(plugin);
|
|
557
|
+
});
|
|
558
|
+
}
|
|
541
559
|
async function addVitePlugin(plugin) {
|
|
542
560
|
(await import("@nuxt/kit")).addVitePlugin(plugin, { server: false });
|
|
543
561
|
}
|
|
@@ -560,10 +578,16 @@ async function setupNuxtLintChecker(checker, nuxt, generation, dependencies = {}
|
|
|
560
578
|
options,
|
|
561
579
|
rootDir
|
|
562
580
|
};
|
|
563
|
-
const builder =
|
|
564
|
-
if (builder === "vite")
|
|
565
|
-
|
|
566
|
-
|
|
581
|
+
const builder = getDetectedNuxtBuilderKind(nuxt);
|
|
582
|
+
if (builder === "vite") {
|
|
583
|
+
const plugin = createNuxtLintCheckerVitePlugin(config);
|
|
584
|
+
if (!dependencies.addVitePlugin && getDetectedNuxtMajor(nuxt) === 2) registerNuxt2Checker(nuxt, builder, plugin);
|
|
585
|
+
else await (dependencies.addVitePlugin ?? addVitePlugin)(plugin);
|
|
586
|
+
} else if (builder === "webpack") {
|
|
587
|
+
const plugin = createNuxtLintCheckerWebpackPlugin(config);
|
|
588
|
+
if (!dependencies.addWebpackPlugin && getDetectedNuxtMajor(nuxt) === 2) registerNuxt2Checker(nuxt, builder, plugin);
|
|
589
|
+
else await (dependencies.addWebpackPlugin ?? addWebpackPlugin)(plugin);
|
|
590
|
+
} else {
|
|
567
591
|
const label = typeof nuxt.options.builder === "string" ? nuxt.options.builder : "unknown";
|
|
568
592
|
(dependencies.warn ?? console.warn)(`Unsupported Nuxt builder ${label}; Vize lint checker is disabled.`);
|
|
569
593
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-D16tn9Im.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import fs, { readFileSync, realpathSync } from "node:fs";
|
|
4
4
|
import path, { dirname, join, resolve } from "node:path";
|
package/dist/lint/index.d.mts
CHANGED
|
@@ -173,9 +173,13 @@ declare function createNuxtLintCheckerWebpackPlugin(config: NuxtLintCheckerWebpa
|
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region src/lint/checker/setup.d.ts
|
|
175
175
|
interface NuxtLintCheckerNuxt {
|
|
176
|
+
hook?(name: string, callback: (...args: unknown[]) => unknown): void;
|
|
176
177
|
options: {
|
|
177
178
|
buildDir: string;
|
|
178
179
|
builder?: unknown;
|
|
180
|
+
bridge?: false | {
|
|
181
|
+
vite?: boolean;
|
|
182
|
+
};
|
|
179
183
|
dev?: boolean;
|
|
180
184
|
rootDir: string;
|
|
181
185
|
srcDir?: string;
|
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-D16tn9Im.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.572.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.572.0",
|
|
53
|
+
"@vizejs/nuxt-lint-config": "0.572.0",
|
|
54
|
+
"@vizejs/vite-plugin": "0.572.0",
|
|
55
|
+
"@vizejs/vite-plugin-musea": "0.572.0",
|
|
56
|
+
"oxlint-plugin-vize": "0.572.0",
|
|
57
|
+
"vize": "0.572.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"jiti-nuxt2": "npm:jiti@1.21.7",
|