@vizejs/nuxt 0.575.0 → 0.577.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.
@@ -1207,6 +1207,7 @@ async function readProjectLintRuleSets(rootDir, loadPreset = loadPresetRules) {
1207
1207
  const linter = project.linter;
1208
1208
  const oxlint = explicitOxlintRules(project.oxlint);
1209
1209
  const jsPlugins = explicitOxlintJsPlugins(project.oxlint, project.oxlintConfigDir);
1210
+ const oxlintOverrides = explicitOxlintOverrides(project.oxlint, project.oxlintConfigDir);
1210
1211
  const warnings = [];
1211
1212
  let vize;
1212
1213
  if (linter) {
@@ -1231,6 +1232,7 @@ async function readProjectLintRuleSets(rootDir, loadPreset = loadPresetRules) {
1231
1232
  ...jsPlugins.length > 0 ? { jsPlugins } : {},
1232
1233
  ...vize ? { vize } : {},
1233
1234
  ...Object.keys(oxlint).length > 0 ? { oxlint } : {},
1235
+ ...oxlintOverrides.length > 0 ? { oxlintOverrides } : {},
1234
1236
  ...warnings.length > 0 ? { warnings } : {}
1235
1237
  };
1236
1238
  }
@@ -1309,14 +1311,51 @@ async function loadProjectViteConfigSource(rootDir) {
1309
1311
  directory = parent;
1310
1312
  }
1311
1313
  }
1314
+ const OXLINT_SEVERITIES = new Map([
1315
+ ["off", "off"],
1316
+ ["allow", "off"],
1317
+ [0, "off"],
1318
+ ["warn", "warn"],
1319
+ [1, "warn"],
1320
+ ["error", "error"],
1321
+ ["deny", "error"],
1322
+ [2, "error"]
1323
+ ]);
1312
1324
  function explicitOxlintRules(value) {
1313
1325
  if (!value || typeof value !== "object") return {};
1314
- const rules = "rules" in value ? value.rules : void 0;
1315
- if (!rules || typeof rules !== "object") return {};
1326
+ return oxlintRules("rules" in value ? value.rules : void 0);
1327
+ }
1328
+ /** Oxlint's `severity` and `[severity, ...options]` forms, with severity aliases normalized. */
1329
+ function oxlintRules(value) {
1330
+ if (!value || typeof value !== "object") return {};
1316
1331
  const result = {};
1317
- for (const [id, severity] of Object.entries(rules)) if (isSeverity(severity)) result[id] = severity;
1332
+ for (const [id, config] of Object.entries(value)) {
1333
+ const severity = OXLINT_SEVERITIES.get(Array.isArray(config) ? config[0] : config);
1334
+ if (!severity) continue;
1335
+ result[id] = Array.isArray(config) ? [severity, ...config.slice(1)] : severity;
1336
+ }
1318
1337
  return result;
1319
1338
  }
1339
+ function explicitOxlintOverrides(value, configDir) {
1340
+ if (!value || typeof value !== "object" || !configDir) return [];
1341
+ const overrides = "overrides" in value ? value.overrides : void 0;
1342
+ if (!Array.isArray(overrides)) return [];
1343
+ return overrides.flatMap((candidate) => {
1344
+ if (!candidate || typeof candidate !== "object") return [];
1345
+ const raw = candidate;
1346
+ const files = Array.isArray(raw.files) ? raw.files.flatMap((glob) => {
1347
+ if (typeof glob !== "string" || !glob) return [];
1348
+ const negated = glob.startsWith("!");
1349
+ const resolved = path$1.resolve(configDir, negated ? glob.slice(1) : glob);
1350
+ return [negated ? `!${resolved}` : resolved];
1351
+ }) : [];
1352
+ const rules = oxlintRules(raw.rules);
1353
+ return files.length > 0 && Object.keys(rules).length > 0 ? [{
1354
+ files,
1355
+ rules
1356
+ }] : [];
1357
+ });
1358
+ }
1320
1359
  function explicitOxlintJsPlugins(value, configDir) {
1321
1360
  if (!value || typeof value !== "object") return [];
1322
1361
  const jsPlugins = "jsPlugins" in value ? value.jsPlugins : void 0;
@@ -1953,6 +1992,11 @@ async function setupNuxtLintConfigGeneration(lint, nuxt, dependencies = {}) {
1953
1992
  ...entry.ignores ? { ignores: entry.ignores } : {},
1954
1993
  rules: entry.rules
1955
1994
  });
1995
+ for (const [index, override] of (projectRules.oxlintOverrides ?? []).entries()) projectItems.push({
1996
+ name: `project/oxlint-override-${String(index + 1)}`,
1997
+ files: override.files,
1998
+ nativeRules: override.rules
1999
+ });
1956
2000
  for (const warning of projectRules.warnings ?? []) {
1957
2001
  if (emittedWarnings.has(warning)) continue;
1958
2002
  emittedWarnings.add(warning);
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-D16tn9Im.mjs";
1
+ import { i as setupLintInspector, l as setupNuxtLintChecker, m as hasNuxtViteCompilerSupport, n as setupNuxtLintConfigGeneration, p as getDetectedNuxtMajor } from "./generation-4Z3oiBXo.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";
@@ -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-D16tn9Im.mjs";
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-4Z3oiBXo.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.575.0",
3
+ "version": "0.577.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.575.0",
53
- "@vizejs/nuxt-lint-config": "0.575.0",
54
- "@vizejs/vite-plugin": "0.575.0",
55
- "@vizejs/vite-plugin-musea": "0.575.0",
56
- "oxlint-plugin-vize": "0.575.0",
57
- "vize": "0.575.0"
52
+ "@vizejs/native": "0.577.0",
53
+ "@vizejs/nuxt-lint-config": "0.577.0",
54
+ "@vizejs/vite-plugin": "0.577.0",
55
+ "@vizejs/vite-plugin-musea": "0.577.0",
56
+ "oxlint-plugin-vize": "0.577.0",
57
+ "vize": "0.577.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "jiti-nuxt2": "npm:jiti@1.21.7",