oxlint-plugin-vize 0.571.0 → 0.573.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/{configs-C0vMZu6T.mjs → configs-BrKd8JK2.mjs} +26 -24
- package/dist/eslint.mjs +8 -10
- package/dist/index.mjs +1 -1
- package/package.json +10 -10
|
@@ -384,6 +384,31 @@ function getPatinaRules() {
|
|
|
384
384
|
return loadBinding().getPatinaRules();
|
|
385
385
|
}
|
|
386
386
|
//#endregion
|
|
387
|
+
//#region src/rule-diagnostics.ts
|
|
388
|
+
const TYPE_AWARE_RUNTIME_RULE = "type/corsa-runtime";
|
|
389
|
+
const EMPTY_DIAGNOSTICS = [];
|
|
390
|
+
function indexDiagnosticsByRule(diagnostics) {
|
|
391
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
392
|
+
for (const diagnostic of diagnostics) {
|
|
393
|
+
const existing = grouped.get(diagnostic.rule);
|
|
394
|
+
if (existing) {
|
|
395
|
+
existing.push(diagnostic);
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
grouped.set(diagnostic.rule, [diagnostic]);
|
|
399
|
+
}
|
|
400
|
+
return grouped;
|
|
401
|
+
}
|
|
402
|
+
function diagnosticsForRule(state, diagnosticsByRule, ruleName) {
|
|
403
|
+
const directDiagnostics = diagnosticsByRule.get(ruleName);
|
|
404
|
+
if (directDiagnostics && directDiagnostics.length > 0) return directDiagnostics;
|
|
405
|
+
if (!isTypeAwareRuleName(ruleName) || state.reportedTypeAwareRuntimeDiagnostic) return EMPTY_DIAGNOSTICS;
|
|
406
|
+
const runtimeDiagnostics = diagnosticsByRule.get(TYPE_AWARE_RUNTIME_RULE);
|
|
407
|
+
if (!runtimeDiagnostics || runtimeDiagnostics.length === 0) return EMPTY_DIAGNOSTICS;
|
|
408
|
+
state.reportedTypeAwareRuntimeDiagnostic = true;
|
|
409
|
+
return runtimeDiagnostics;
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
387
412
|
//#region src/script-map.ts
|
|
388
413
|
function createSingleScriptMap(source, extractedScript, sfcBlocks = extractSfcBlocks(source)) {
|
|
389
414
|
if (!extractedScript) return null;
|
|
@@ -454,8 +479,6 @@ function toScriptPosition(position, scriptStart) {
|
|
|
454
479
|
//#region src/file-state.ts
|
|
455
480
|
const FILE_STATE_CACHE_CAPACITY = 128;
|
|
456
481
|
const fileStateCache = /* @__PURE__ */ new Map();
|
|
457
|
-
const EMPTY_DIAGNOSTICS = [];
|
|
458
|
-
const TYPE_AWARE_RUNTIME_RULE = "type/corsa-runtime";
|
|
459
482
|
let fileStateCacheClock = 0;
|
|
460
483
|
function getFileState(context) {
|
|
461
484
|
const settings = getVizeSettings(context);
|
|
@@ -541,27 +564,6 @@ function evictLeastRecentlyUsedFileState() {
|
|
|
541
564
|
}
|
|
542
565
|
if (oldestKey !== void 0) fileStateCache.delete(oldestKey);
|
|
543
566
|
}
|
|
544
|
-
function indexDiagnosticsByRule(diagnostics) {
|
|
545
|
-
const grouped = /* @__PURE__ */ new Map();
|
|
546
|
-
for (const diagnostic of diagnostics) {
|
|
547
|
-
const existing = grouped.get(diagnostic.rule);
|
|
548
|
-
if (existing) {
|
|
549
|
-
existing.push(diagnostic);
|
|
550
|
-
continue;
|
|
551
|
-
}
|
|
552
|
-
grouped.set(diagnostic.rule, [diagnostic]);
|
|
553
|
-
}
|
|
554
|
-
return grouped;
|
|
555
|
-
}
|
|
556
|
-
function diagnosticsForRule(state, diagnosticsByRule, ruleName) {
|
|
557
|
-
const directDiagnostics = diagnosticsByRule.get(ruleName);
|
|
558
|
-
if (directDiagnostics && directDiagnostics.length > 0) return directDiagnostics;
|
|
559
|
-
if (!isTypeAwareRuleName(ruleName) || state.reportedTypeAwareRuntimeDiagnostic) return EMPTY_DIAGNOSTICS;
|
|
560
|
-
const runtimeDiagnostics = diagnosticsByRule.get(TYPE_AWARE_RUNTIME_RULE);
|
|
561
|
-
if (!runtimeDiagnostics || runtimeDiagnostics.length === 0) return EMPTY_DIAGNOSTICS;
|
|
562
|
-
state.reportedTypeAwareRuntimeDiagnostic = true;
|
|
563
|
-
return runtimeDiagnostics;
|
|
564
|
-
}
|
|
565
567
|
//#endregion
|
|
566
568
|
//#region src/active-rule-collection.ts
|
|
567
569
|
const programs = /* @__PURE__ */ new WeakMap();
|
|
@@ -1099,4 +1101,4 @@ if (import.meta.vitest) {
|
|
|
1099
1101
|
});
|
|
1100
1102
|
}
|
|
1101
1103
|
//#endregion
|
|
1102
|
-
export {
|
|
1104
|
+
export { TYPE_AWARE_RUNTIME_RULE as a, getPatinaRules as c, isTypeAwareRuleName as d, createRuleSelection as f, formatPatinaMessage as i, getActivePreset as l, getRuleOptions as m, createVizeRuleConfig as n, diagnosticsForRule as o, selectVizeRuleConfig as p, plugin_default as r, indexDiagnosticsByRule as s, configs as t, getVizeSettings as u };
|
package/dist/eslint.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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-BrKd8JK2.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
|
|
@@ -53,7 +53,8 @@ function collect(context, program, name) {
|
|
|
53
53
|
sourceCode: context.sourceCode,
|
|
54
54
|
filename: context.physicalFilename,
|
|
55
55
|
settings: structuredClone(getVizeSettings(context)),
|
|
56
|
-
options: /* @__PURE__ */ new Map()
|
|
56
|
+
options: /* @__PURE__ */ new Map(),
|
|
57
|
+
reportedTypeAwareRuntimeDiagnostic: false
|
|
57
58
|
};
|
|
58
59
|
programs.set(program, collected);
|
|
59
60
|
}
|
|
@@ -63,6 +64,7 @@ function collect(context, program, name) {
|
|
|
63
64
|
function run(collected) {
|
|
64
65
|
assertSourceText(collected.source);
|
|
65
66
|
const selection = createRuleSelection(collected.options);
|
|
67
|
+
const hasSelectedTypeAwareRule = selection.names.some(isTypeAwareRuleName);
|
|
66
68
|
const settings = collected.settings;
|
|
67
69
|
const result = loadBinding().lintPatinaSfc(collected.source, {
|
|
68
70
|
filename: collected.filename,
|
|
@@ -70,25 +72,21 @@ function run(collected) {
|
|
|
70
72
|
helpLevel: settings.helpLevel,
|
|
71
73
|
preset: getActivePreset(settings),
|
|
72
74
|
enabledRules: selection.names,
|
|
73
|
-
typeAware: settings.typeAware === true ||
|
|
75
|
+
typeAware: settings.typeAware === true || hasSelectedTypeAwareRule,
|
|
74
76
|
corsaPath: settings.corsaPath,
|
|
75
77
|
...selection.options,
|
|
76
78
|
includeFixes: true
|
|
77
79
|
});
|
|
78
80
|
if (result.filename !== collected.filename) throw new Error("Vize returned diagnostics for another ESLint source");
|
|
79
|
-
const diagnostics = /* @__PURE__ */ new Map();
|
|
80
81
|
const offsets = [];
|
|
81
82
|
for (const diagnostic of result.diagnostics) {
|
|
82
|
-
if (!selection.names.includes(diagnostic.rule)) throw new Error(`Vize returned an unselected ESLint rule: ${diagnostic.rule}`);
|
|
83
|
+
if (!selection.names.includes(diagnostic.rule) && !(hasSelectedTypeAwareRule && diagnostic.rule === "type/corsa-runtime")) throw new Error(`Vize returned an unselected ESLint rule: ${diagnostic.rule}`);
|
|
83
84
|
if (byName.get(diagnostic.rule)?.fixable && !Object.hasOwn(diagnostic, "fix")) throw new Error("The Vize native binding does not expose ESLint text edits; update it");
|
|
84
|
-
const current = diagnostics.get(diagnostic.rule) ?? [];
|
|
85
|
-
current.push(diagnostic);
|
|
86
|
-
diagnostics.set(diagnostic.rule, current);
|
|
87
85
|
offsets.push(diagnostic.location.start.offset, diagnostic.location.end.offset);
|
|
88
86
|
for (const edit of diagnostic.fix?.edits ?? []) offsets.push(edit.start, edit.end);
|
|
89
87
|
}
|
|
90
88
|
collected.offsets = mapSourceOffsets(collected.source, offsets);
|
|
91
|
-
collected.diagnostics = diagnostics;
|
|
89
|
+
collected.diagnostics = indexDiagnosticsByRule(result.diagnostics);
|
|
92
90
|
}
|
|
93
91
|
/** ESLint rules over the complete source supplied by the configured parser. */
|
|
94
92
|
var eslint_default = eslintCompatPlugin(definePlugin({
|
|
@@ -122,7 +120,7 @@ var eslint_default = eslintCompatPlugin(definePlugin({
|
|
|
122
120
|
if (collected.source !== context.sourceCode.text || collected.sourceCode !== context.sourceCode || collected.filename !== context.physicalFilename || JSON.stringify(collected.settings) !== JSON.stringify(getVizeSettings(context))) throw new Error("Vize source changed before ESLint rule execution");
|
|
123
121
|
if (!collected.diagnostics) run(collected);
|
|
124
122
|
const sourceCode = context.sourceCode;
|
|
125
|
-
for (const diagnostic of collected.diagnostics
|
|
123
|
+
for (const diagnostic of diagnosticsForRule(collected, collected.diagnostics, rule.name)) {
|
|
126
124
|
const start = collected.offsets.get(diagnostic.location.start.offset);
|
|
127
125
|
const end = collected.offsets.get(diagnostic.location.end.offset);
|
|
128
126
|
if (start > end) throw new Error("Vize returned a reversed diagnostic span");
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as getPatinaRules, n as createVizeRuleConfig, p as selectVizeRuleConfig, r as plugin_default, t as configs } from "./configs-BrKd8JK2.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.
|
|
3
|
+
"version": "0.573.0",
|
|
4
4
|
"description": "Oxlint JS plugin bridge for Vize Patina",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -48,21 +48,21 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@tsdown/css": "0.22.14",
|
|
50
50
|
"@types/node": "25.9.2",
|
|
51
|
-
"@vizejs/native": "0.
|
|
51
|
+
"@vizejs/native": "0.573.0",
|
|
52
52
|
"tsdown": "0.22.14",
|
|
53
53
|
"typescript": "6.0.3",
|
|
54
54
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.24",
|
|
55
55
|
"vite-plus": "0.1.24"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
|
-
"@vizejs/native-darwin-arm64": "0.
|
|
59
|
-
"@vizejs/native-darwin-x64": "0.
|
|
60
|
-
"@vizejs/native-linux-arm64-gnu": "0.
|
|
61
|
-
"@vizejs/native-linux-arm64-musl": "0.
|
|
62
|
-
"@vizejs/native-linux-x64-gnu": "0.
|
|
63
|
-
"@vizejs/native-linux-x64-musl": "0.
|
|
64
|
-
"@vizejs/native-win32-arm64-msvc": "0.
|
|
65
|
-
"@vizejs/native-win32-x64-msvc": "0.
|
|
58
|
+
"@vizejs/native-darwin-arm64": "0.573.0",
|
|
59
|
+
"@vizejs/native-darwin-x64": "0.573.0",
|
|
60
|
+
"@vizejs/native-linux-arm64-gnu": "0.573.0",
|
|
61
|
+
"@vizejs/native-linux-arm64-musl": "0.573.0",
|
|
62
|
+
"@vizejs/native-linux-x64-gnu": "0.573.0",
|
|
63
|
+
"@vizejs/native-linux-x64-musl": "0.573.0",
|
|
64
|
+
"@vizejs/native-win32-arm64-msvc": "0.573.0",
|
|
65
|
+
"@vizejs/native-win32-x64-msvc": "0.573.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": "^22 || >= 24"
|