oxlint-plugin-vize 0.290.0 → 0.291.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/README.md +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +33 -4
- package/dist/{workaround-1vv4vvr7.mjs → workaround-RlqLB_zL.mjs} +1 -0
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ The bridge is optimized around Oxlint's per-rule execution model:
|
|
|
24
24
|
|
|
25
25
|
- The first enabled Patina rule on a file runs native linting for that rule only.
|
|
26
26
|
- If a second Patina rule is encountered on the same file, the bridge upgrades to one shared full-file Patina pass and reuses that result for the remaining Patina rules.
|
|
27
|
-
-
|
|
27
|
+
- Exact source revisions and rule results are cached for up to 128 recently used file/settings pairs; edits replace revision-local diagnostics and reporting state.
|
|
28
28
|
|
|
29
29
|
## Installation
|
|
30
30
|
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isStandaloneHtmlFile, i as hasVueLikeExtension, n as hasScriptLikeBlock, t as appendScriptlessWorkaround } from "./workaround-
|
|
1
|
+
import { a as isStandaloneHtmlFile, i as hasVueLikeExtension, n as hasScriptLikeBlock, t as appendScriptlessWorkaround } from "./workaround-RlqLB_zL.mjs";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs from "node:fs";
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as extractSfcBlocks, l as formatBlockLabel, o as isVueLikeFile, r as resolveWorkaroundSource, s as compareLineColumn, u as getDiagnosticBlock } from "./workaround-
|
|
1
|
+
import { c as extractSfcBlocks, l as formatBlockLabel, o as isVueLikeFile, r as resolveWorkaroundSource, s as compareLineColumn, u as getDiagnosticBlock } from "./workaround-RlqLB_zL.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { definePlugin, defineRule } from "@oxlint/plugins";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
@@ -265,16 +265,27 @@ if (import.meta.vitest) {
|
|
|
265
265
|
}
|
|
266
266
|
//#endregion
|
|
267
267
|
//#region src/file-state.ts
|
|
268
|
+
const FILE_STATE_CACHE_CAPACITY = 128;
|
|
268
269
|
const fileStateCache = /* @__PURE__ */ new Map();
|
|
269
270
|
const EMPTY_DIAGNOSTICS = [];
|
|
270
271
|
const TYPE_AWARE_RUNTIME_RULE = "type/corsa-runtime";
|
|
272
|
+
let fileStateCacheClock = 0;
|
|
271
273
|
function getFileState(context) {
|
|
272
274
|
const settings = getVizeSettings(context);
|
|
273
|
-
const
|
|
275
|
+
const physicalSource = fs.readFileSync(context.physicalFilename, "utf8");
|
|
276
|
+
const resolvedSource = resolveWorkaroundSource(physicalSource, context.physicalFilename);
|
|
274
277
|
const cacheKey = getCacheKey(resolvedSource.filename, settings);
|
|
275
278
|
const cached = fileStateCache.get(cacheKey);
|
|
276
|
-
if (cached
|
|
279
|
+
if (cached && cached.state.revision.physicalSource === physicalSource) {
|
|
280
|
+
if (cached.state.extractedScript !== context.sourceCode.text) {
|
|
281
|
+
cached.state.extractedScript = context.sourceCode.text;
|
|
282
|
+
cached.state.scriptMap = void 0;
|
|
283
|
+
}
|
|
284
|
+
cached.lastUsed = nextFileStateCacheClock();
|
|
285
|
+
return cached.state;
|
|
286
|
+
}
|
|
277
287
|
const state = {
|
|
288
|
+
revision: { physicalSource },
|
|
278
289
|
filename: resolvedSource.filename,
|
|
279
290
|
source: resolvedSource.source,
|
|
280
291
|
extractedScript: context.sourceCode.text,
|
|
@@ -288,7 +299,11 @@ function getFileState(context) {
|
|
|
288
299
|
requestedRules: /* @__PURE__ */ new Set(),
|
|
289
300
|
reportedTypeAwareRuntimeDiagnostic: false
|
|
290
301
|
};
|
|
291
|
-
fileStateCache.set(cacheKey,
|
|
302
|
+
fileStateCache.set(cacheKey, {
|
|
303
|
+
state,
|
|
304
|
+
lastUsed: nextFileStateCacheClock()
|
|
305
|
+
});
|
|
306
|
+
evictLeastRecentlyUsedFileState();
|
|
292
307
|
return state;
|
|
293
308
|
}
|
|
294
309
|
function getDiagnosticsForRule(context, state, ruleName) {
|
|
@@ -349,6 +364,20 @@ function markRuleAsReported(state, ruleName) {
|
|
|
349
364
|
state.reportedRules.add(ruleName);
|
|
350
365
|
return true;
|
|
351
366
|
}
|
|
367
|
+
function nextFileStateCacheClock() {
|
|
368
|
+
fileStateCacheClock += 1;
|
|
369
|
+
return fileStateCacheClock;
|
|
370
|
+
}
|
|
371
|
+
function evictLeastRecentlyUsedFileState() {
|
|
372
|
+
if (fileStateCache.size <= FILE_STATE_CACHE_CAPACITY) return;
|
|
373
|
+
let oldestKey;
|
|
374
|
+
let oldestUse = Number.POSITIVE_INFINITY;
|
|
375
|
+
for (const [key, cached] of fileStateCache) if (cached.lastUsed < oldestUse) {
|
|
376
|
+
oldestKey = key;
|
|
377
|
+
oldestUse = cached.lastUsed;
|
|
378
|
+
}
|
|
379
|
+
if (oldestKey !== void 0) fileStateCache.delete(oldestKey);
|
|
380
|
+
}
|
|
352
381
|
function indexDiagnosticsByRule(diagnostics) {
|
|
353
382
|
const grouped = /* @__PURE__ */ new Map();
|
|
354
383
|
for (const diagnostic of diagnostics) {
|
|
@@ -112,6 +112,7 @@ function resolveWorkaroundSource(source, fallbackFilename) {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
function getPrependedWorkaroundBlock(source) {
|
|
115
|
+
if (!source.startsWith(SCRIPTLESS_WORKAROUND_OPEN_TAG_PREFIX)) return null;
|
|
115
116
|
const [firstBlock] = extractSfcBlocks(source);
|
|
116
117
|
if (!firstBlock || firstBlock.kind !== "script-setup") return null;
|
|
117
118
|
if (!isWhitespaceOnly(firstBlock.content)) return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-plugin-vize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.291.0",
|
|
4
4
|
"description": "Oxlint JS plugin bridge for Vize Patina",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -44,28 +44,28 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tsdown/css": "0.22.0",
|
|
46
46
|
"@types/node": "25.9.2",
|
|
47
|
-
"@vizejs/native": "0.
|
|
47
|
+
"@vizejs/native": "0.291.0",
|
|
48
48
|
"tsdown": "0.22.0",
|
|
49
49
|
"typescript": "6.0.3",
|
|
50
50
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.21",
|
|
51
51
|
"vite-plus": "0.1.21"
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@vizejs/native-darwin-arm64": "0.
|
|
55
|
-
"@vizejs/native-darwin-x64": "0.
|
|
56
|
-
"@vizejs/native-linux-arm64-gnu": "0.
|
|
57
|
-
"@vizejs/native-linux-arm64-musl": "0.
|
|
58
|
-
"@vizejs/native-linux-x64-gnu": "0.
|
|
59
|
-
"@vizejs/native-linux-x64-musl": "0.
|
|
60
|
-
"@vizejs/native-win32-arm64-msvc": "0.
|
|
61
|
-
"@vizejs/native-win32-x64-msvc": "0.
|
|
54
|
+
"@vizejs/native-darwin-arm64": "0.291.0",
|
|
55
|
+
"@vizejs/native-darwin-x64": "0.291.0",
|
|
56
|
+
"@vizejs/native-linux-arm64-gnu": "0.291.0",
|
|
57
|
+
"@vizejs/native-linux-arm64-musl": "0.291.0",
|
|
58
|
+
"@vizejs/native-linux-x64-gnu": "0.291.0",
|
|
59
|
+
"@vizejs/native-linux-x64-musl": "0.291.0",
|
|
60
|
+
"@vizejs/native-win32-arm64-msvc": "0.291.0",
|
|
61
|
+
"@vizejs/native-win32-x64-msvc": "0.291.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": "^22 || >= 24"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "vp pack",
|
|
68
|
-
"test": "vp pack && node src/test.ts",
|
|
68
|
+
"test": "vp pack && vp test run src/file-state.test.ts && node src/test.ts",
|
|
69
69
|
"check": "vp check src vite.config.ts",
|
|
70
70
|
"check:fix": "vp check --fix src vite.config.ts",
|
|
71
71
|
"fmt": "vp fmt --write src vite.config.ts"
|