oxlint-plugin-vize 0.751.0 → 0.753.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.
@@ -606,6 +606,7 @@ const PRESET_ALIASES = new Map([
606
606
  ["strict", "opinionated"],
607
607
  ["nuxt", "nuxt"]
608
608
  ]);
609
+ const settingsCache = /* @__PURE__ */ new WeakMap();
609
610
  function getVizeSettings(context) {
610
611
  const settings = context.settings;
611
612
  return parseVizeSettings(settings.vize ?? settings.patina);
@@ -619,8 +620,11 @@ function parseVizeSettings(vize) {
619
620
  const showHelp = vizeRecord.showHelp;
620
621
  const typeAware = vizeRecord.typeAware;
621
622
  const corsaPath = vizeRecord.corsaPath;
623
+ const rules = vizeRecord.rules;
624
+ const cached = settingsCache.get(vize);
625
+ if (cached !== void 0 && cached.locale === locale && cached.helpLevel === helpLevel && cached.preset === preset && cached.showHelp === showHelp && cached.typeAware === typeAware && cached.corsaPath === corsaPath && cached.rules === rules) return cached.resolved;
622
626
  const resolved = {};
623
- if (Array.isArray(vizeRecord.rules) || typeof vizeRecord.rules === "object" && vizeRecord.rules !== null) resolved.rules = vizeRecord.rules;
627
+ if (Array.isArray(rules) || typeof rules === "object" && rules !== null) resolved.rules = rules;
624
628
  if (typeof locale === "string") resolved.locale = locale;
625
629
  if (typeof preset === "string") {
626
630
  const normalizedPreset = normalizePreset(preset);
@@ -628,11 +632,18 @@ function parseVizeSettings(vize) {
628
632
  }
629
633
  if (typeof typeAware === "boolean") resolved.typeAware = typeAware;
630
634
  if (typeof corsaPath === "string") resolved.corsaPath = corsaPath;
631
- if (typeof helpLevel === "string" && HELP_LEVELS.has(helpLevel)) {
632
- resolved.helpLevel = helpLevel;
633
- return resolved;
634
- }
635
- if (typeof showHelp === "boolean") resolved.helpLevel = showHelp ? "full" : "none";
635
+ if (typeof helpLevel === "string" && HELP_LEVELS.has(helpLevel)) resolved.helpLevel = helpLevel;
636
+ else if (typeof showHelp === "boolean") resolved.helpLevel = showHelp ? "full" : "none";
637
+ settingsCache.set(vize, {
638
+ locale,
639
+ helpLevel,
640
+ preset,
641
+ showHelp,
642
+ typeAware,
643
+ corsaPath,
644
+ rules,
645
+ resolved
646
+ });
636
647
  return resolved;
637
648
  }
638
649
  function getActivePreset(settings) {
@@ -709,6 +720,26 @@ if (import.meta.vitest) {
709
720
  expect(parseVizeSettings(null)).toEqual({});
710
721
  expect(parseVizeSettings("ja")).toEqual({});
711
722
  });
723
+ it("reuses one shallow projection across active rule contexts", () => {
724
+ const rules = { "vize/vue/no-v-html": "error" };
725
+ const authored = {
726
+ helpLevel: "none",
727
+ preset: "incremental",
728
+ rules
729
+ };
730
+ const first = parseVizeSettings(authored);
731
+ expect(parseVizeSettings(authored)).toBe(first);
732
+ rules["vize/vue/no-v-html"] = "warn";
733
+ expect(parseVizeSettings(authored)).toBe(first);
734
+ expect(first.rules).toBe(rules);
735
+ authored.helpLevel = "short";
736
+ expect(parseVizeSettings(authored)).not.toBe(first);
737
+ expect(parseVizeSettings(authored)).toEqual({
738
+ helpLevel: "short",
739
+ preset: "incremental",
740
+ rules
741
+ });
742
+ });
712
743
  });
713
744
  }
714
745
  //#endregion
@@ -956,7 +987,9 @@ function collectActiveRule(context, program, ruleName, options) {
956
987
  function getActiveRuleDiagnostics(context, program, ruleName) {
957
988
  const collection = programs.get(program);
958
989
  if (!collection?.optionsByRule.has(ruleName)) return void 0;
959
- if (!hasCurrentProgramInputs(context, collection)) {
990
+ const firstExit = collection.selection === void 0;
991
+ const finalExit = collection.remaining?.size === 1;
992
+ if (!hasCurrentProgramInputs(context, collection, firstExit || finalExit)) {
960
993
  programs.delete(program);
961
994
  throw new Error("Vize source or configuration changed before rule execution");
962
995
  }
@@ -1000,10 +1033,13 @@ function physicalIdentity(filename) {
1000
1033
  ctimeNs: stat.ctimeNs
1001
1034
  };
1002
1035
  }
1003
- function hasCurrentProgramInputs(context, collection) {
1004
- const currentIdentity = physicalIdentity(context.physicalFilename);
1005
- const expectedIdentity = collection.physicalIdentity;
1006
- if (currentIdentity.dev !== expectedIdentity.dev || currentIdentity.ino !== expectedIdentity.ino || currentIdentity.size !== expectedIdentity.size || currentIdentity.mtimeNs !== expectedIdentity.mtimeNs || currentIdentity.ctimeNs !== expectedIdentity.ctimeNs || context.sourceCode.text !== collection.state.extractedScript) return false;
1036
+ function hasCurrentProgramInputs(context, collection, checkPhysicalFile) {
1037
+ if (context.sourceCode.text !== collection.state.extractedScript) return false;
1038
+ if (checkPhysicalFile) {
1039
+ const currentIdentity = physicalIdentity(context.physicalFilename);
1040
+ const expectedIdentity = collection.physicalIdentity;
1041
+ if (currentIdentity.dev !== expectedIdentity.dev || currentIdentity.ino !== expectedIdentity.ino || currentIdentity.size !== expectedIdentity.size || currentIdentity.mtimeNs !== expectedIdentity.mtimeNs || currentIdentity.ctimeNs !== expectedIdentity.ctimeNs) return false;
1042
+ }
1007
1043
  const current = getVizeSettings(context);
1008
1044
  const expected = collection.runtimeSettings;
1009
1045
  return current.locale === expected.locale && current.helpLevel === expected.helpLevel && current.preset === expected.preset && current.typeAware === expected.typeAware && current.corsaPath === expected.corsaPath;
package/dist/eslint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as getPatinaRules, d as isTypeAwareRuleName, f as createRuleSelection, i as formatPatinaMessage, l as getActivePreset, m as getRuleOptions, n as createVizeRuleConfig, o as diagnosticsForRule, r as plugin_default, s as indexDiagnosticsByRule, t as configs, u as getVizeSettings } from "./configs-DY5MIYh4.mjs";
1
+ import { c as getPatinaRules, d as isTypeAwareRuleName, f as createRuleSelection, i as formatPatinaMessage, l as getActivePreset, m as getRuleOptions, n as createVizeRuleConfig, o as diagnosticsForRule, r as plugin_default, s as indexDiagnosticsByRule, t as configs, u as getVizeSettings } from "./configs-CAUSsiII.mjs";
2
2
  import { d as isPatinaFile, m as loadBinding } from "./workaround-Byh3ja-i.mjs";
3
3
  import { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
4
4
  //#region src/eslint-source.ts
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as getPatinaRules, n as createVizeRuleConfig, p as selectVizeRuleConfig, r as plugin_default, t as configs } from "./configs-DY5MIYh4.mjs";
1
+ import { c as getPatinaRules, n as createVizeRuleConfig, p as selectVizeRuleConfig, r as plugin_default, t as configs } from "./configs-CAUSsiII.mjs";
2
2
  //#region src/vite-plus.ts
3
3
  /**
4
4
  * Bare specifier Oxlint uses to load this bridge as a JS plugin.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-vize",
3
- "version": "0.751.0",
3
+ "version": "0.753.0",
4
4
  "description": "Oxlint JS plugin bridge for Vize Patina",
5
5
  "keywords": [
6
6
  "lint",
@@ -51,7 +51,7 @@
51
51
  "@tsdown/css": "0.22.14",
52
52
  "@types/node": "25.9.2",
53
53
  "@typescript-eslint/parser": "8.72.1",
54
- "@vizejs/native": "0.751.0",
54
+ "@vizejs/native": "0.753.0",
55
55
  "ajv": "8.20.0",
56
56
  "eslint": "10.14.0",
57
57
  "eslint-plugin-vue": "10.12.0",
@@ -63,14 +63,14 @@
63
63
  "vue-eslint-parser": "10.4.2"
64
64
  },
65
65
  "optionalDependencies": {
66
- "@vizejs/native-darwin-arm64": "0.751.0",
67
- "@vizejs/native-darwin-x64": "0.751.0",
68
- "@vizejs/native-linux-arm64-gnu": "0.751.0",
69
- "@vizejs/native-linux-arm64-musl": "0.751.0",
70
- "@vizejs/native-linux-x64-gnu": "0.751.0",
71
- "@vizejs/native-linux-x64-musl": "0.751.0",
72
- "@vizejs/native-win32-arm64-msvc": "0.751.0",
73
- "@vizejs/native-win32-x64-msvc": "0.751.0"
66
+ "@vizejs/native-darwin-arm64": "0.753.0",
67
+ "@vizejs/native-darwin-x64": "0.753.0",
68
+ "@vizejs/native-linux-arm64-gnu": "0.753.0",
69
+ "@vizejs/native-linux-arm64-musl": "0.753.0",
70
+ "@vizejs/native-linux-x64-gnu": "0.753.0",
71
+ "@vizejs/native-linux-x64-musl": "0.753.0",
72
+ "@vizejs/native-win32-arm64-msvc": "0.753.0",
73
+ "@vizejs/native-win32-x64-msvc": "0.753.0"
74
74
  },
75
75
  "engines": {
76
76
  "node": "^22 || >= 24"