oxlint-plugin-vize 0.386.0 → 0.388.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 +3 -4
- package/dist/cli.mjs +68 -6
- package/dist/index.mjs +51 -23
- package/dist/{workaround-DaqWylnm.mjs → workaround-DRe3y2CB.mjs} +62 -7
- package/package.json +48 -48
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ The bridge is optimized around Oxlint's per-rule execution model:
|
|
|
34
34
|
```bash
|
|
35
35
|
vp install
|
|
36
36
|
vp run --filter './npm/native' build
|
|
37
|
-
vp run --filter './npm/
|
|
37
|
+
vp run --filter './npm/oxlint' build
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
Install `vp` once from the [Vite+ install guide](https://viteplus.dev/guide/install), then add it with:
|
|
@@ -155,8 +155,7 @@ You can pass Patina settings through `settings.vize`:
|
|
|
155
155
|
"locale": "ja",
|
|
156
156
|
"preset": "essential",
|
|
157
157
|
"helpLevel": "short",
|
|
158
|
-
"typeAware": true
|
|
159
|
-
"corsaPath": "./node_modules/.bin/tsgo"
|
|
158
|
+
"typeAware": true
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
161
|
}
|
|
@@ -172,7 +171,7 @@ You can pass Patina settings through `settings.vize`:
|
|
|
172
171
|
- `helpLevel` accepts `"full"`, `"short"`, or `"none"`. Short help keeps one actionable sentence and removes inline examples and trailing rationale.
|
|
173
172
|
- `helpLevel: "full"` only expands the Patina remediation text. It does not restore original-SFC formatter anchors or machine-readable range fidelity.
|
|
174
173
|
- `typeAware: true` enables Corsa-backed `vize/type/*` rules during shared Patina passes.
|
|
175
|
-
- `corsaPath` selects
|
|
174
|
+
- `corsaPath` selects a Corsa or TypeScript 7 native executable for type-aware linting. Omit it to use Vize's normal resolver.
|
|
176
175
|
- `showHelp` is still accepted for backward compatibility, but `helpLevel` is the preferred setting.
|
|
177
176
|
|
|
178
177
|
For example, this keeps Oxlint focused on correctness-only Vize diagnostics while still allowing your existing Oxlint rules to run unchanged:
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as hasVueLikeExtension, n as hasScriptLikeBlock, s as isStandaloneHtmlFile, t as appendScriptlessWorkaround } from "./workaround-
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { i as hasVueLikeExtension, n as hasScriptLikeBlock, s as isStandaloneHtmlFile, t as appendScriptlessWorkaround } from "./workaround-DRe3y2CB.mjs";
|
|
2
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
//#region src/cli/args.ts
|
|
@@ -12,7 +12,6 @@ const OPTION_NAMES_WITH_VALUES = new Set([
|
|
|
12
12
|
"--config",
|
|
13
13
|
"--cwd",
|
|
14
14
|
"--deny",
|
|
15
|
-
"--fix-suggestions",
|
|
16
15
|
"--format",
|
|
17
16
|
"--ignore-path",
|
|
18
17
|
"--ignore-pattern",
|
|
@@ -31,6 +30,35 @@ const OPTION_NAMES_WITH_VALUES = new Set([
|
|
|
31
30
|
"--vitest-plugin",
|
|
32
31
|
"--warn"
|
|
33
32
|
]);
|
|
33
|
+
/**
|
|
34
|
+
* Formats whose reports contain output even for a completely clean run.
|
|
35
|
+
*
|
|
36
|
+
* The auto, stylish, and unix formats legitimately print nothing when no
|
|
37
|
+
* diagnostics are found, so an empty report proves nothing for them. These
|
|
38
|
+
* formats always emit at least a summary or document skeleton, which makes a
|
|
39
|
+
* fully silent exit-0 run attributable to a child that never linted at all.
|
|
40
|
+
*/
|
|
41
|
+
const ALWAYS_REPORTING_FORMATS = new Set([
|
|
42
|
+
"checkstyle",
|
|
43
|
+
"default",
|
|
44
|
+
"json",
|
|
45
|
+
"junit"
|
|
46
|
+
]);
|
|
47
|
+
/** Whether the requested output format guarantees a non-empty report. */
|
|
48
|
+
function expectsLintReport(argv) {
|
|
49
|
+
let format = null;
|
|
50
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
51
|
+
const arg = argv[index];
|
|
52
|
+
if (arg === "--") break;
|
|
53
|
+
if (arg === "-f" || arg === "--format") {
|
|
54
|
+
format = argv[index + 1] ?? null;
|
|
55
|
+
index += 1;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (arg.startsWith("--format=")) format = arg.slice(9);
|
|
59
|
+
}
|
|
60
|
+
return format != null && ALWAYS_REPORTING_FORMATS.has(format);
|
|
61
|
+
}
|
|
34
62
|
function getLintTargets(argv) {
|
|
35
63
|
const targets = [];
|
|
36
64
|
let collectEverything = false;
|
|
@@ -110,6 +138,31 @@ function resolveOxlintCliEntrypoint(cwd) {
|
|
|
110
138
|
currentDir = parentDir;
|
|
111
139
|
}
|
|
112
140
|
}
|
|
141
|
+
/** Real oxlint prints `Version: <semver>`; any semver-shaped token passes. */
|
|
142
|
+
const VERSION_HANDSHAKE_PATTERN = /\b\d+\.\d+\.\d+/u;
|
|
143
|
+
/**
|
|
144
|
+
* Confirms the resolved entrypoint actually behaves like the oxlint CLI.
|
|
145
|
+
*
|
|
146
|
+
* Workspaces can place a non-lint wrapper at the oxlint bin path — vite-plus
|
|
147
|
+
* ships an LSP-only shim there, for example. Spawning such a wrapper yields no
|
|
148
|
+
* diagnostics, which the caller would otherwise forward as a clean lint run: a
|
|
149
|
+
* silent false green. A `--version` handshake separates the real CLI from
|
|
150
|
+
* wrappers before any lint output is trusted.
|
|
151
|
+
*/
|
|
152
|
+
function verifyOxlintCliEntrypoint(executable, entrypoint) {
|
|
153
|
+
const handshake = spawnSync(executable, [entrypoint, "--version"], {
|
|
154
|
+
encoding: "utf8",
|
|
155
|
+
stdio: [
|
|
156
|
+
"ignore",
|
|
157
|
+
"pipe",
|
|
158
|
+
"pipe"
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
const output = `${handshake.stdout ?? ""}${handshake.stderr ?? ""}`.trim();
|
|
162
|
+
if (handshake.error == null && handshake.status === 0 && VERSION_HANDSHAKE_PATTERN.test(output)) return;
|
|
163
|
+
const detail = handshake.error == null ? `exit ${String(handshake.status)}${output === "" ? " with no output" : `: ${output.split("\n", 1)[0]}`}` : handshake.error.message;
|
|
164
|
+
throw new Error(`The oxlint entrypoint at ${entrypoint} did not answer the \`--version\` handshake (${detail}). It appears to be a non-lint wrapper shim, so its runs cannot be trusted as lint results. Install the real \`oxlint\` package where \`oxlint-vize\` can resolve it.`);
|
|
165
|
+
}
|
|
113
166
|
//#endregion
|
|
114
167
|
//#region src/cli/output.ts
|
|
115
168
|
function rewriteReportedPaths(output, replacements) {
|
|
@@ -224,9 +277,12 @@ function getReportedOriginalFilename(cwd, filename) {
|
|
|
224
277
|
async function main() {
|
|
225
278
|
const cwd = process.cwd();
|
|
226
279
|
const forwardedArgs = process.argv.slice(2);
|
|
227
|
-
const
|
|
280
|
+
const lintFiles = collectVueLikeFilesFromTargets(cwd, getLintTargets(forwardedArgs));
|
|
281
|
+
const oxlintEntrypoint = resolveOxlintCliEntrypoint(cwd);
|
|
282
|
+
verifyOxlintCliEntrypoint(process.execPath, oxlintEntrypoint);
|
|
283
|
+
const prepared = prepareScriptlessWorkaroundFiles(cwd, lintFiles);
|
|
228
284
|
const args = [
|
|
229
|
-
|
|
285
|
+
oxlintEntrypoint,
|
|
230
286
|
...forwardedArgs,
|
|
231
287
|
...prepared.appendedArgs
|
|
232
288
|
];
|
|
@@ -236,7 +292,13 @@ async function main() {
|
|
|
236
292
|
const stderr = rewriteReportedPaths(result.stderr, prepared.pathReplacements);
|
|
237
293
|
if (stdout) await writeStream(process.stdout, stdout);
|
|
238
294
|
if (stderr) await writeStream(process.stderr, stderr);
|
|
239
|
-
if (
|
|
295
|
+
if (result.status === 0 && stdout === "" && stderr === "" && expectsLintReport(forwardedArgs)) {
|
|
296
|
+
await writeStream(process.stderr, `The oxlint run at ${oxlintEntrypoint} exited 0 but produced no report, although the requested format always emits one. Refusing to treat the silent run as a clean lint result.
|
|
297
|
+
`);
|
|
298
|
+
process.exitCode = 1;
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (prepared.usedScriptlessWorkaround && (forwardedArgs.includes("--fix") || forwardedArgs.includes("--fix-suggestions"))) await writeStream(process.stderr, "\n[oxlint-plugin-vize] Temporary Vue workaround is active; fixes are not applied back to original files yet.\n");
|
|
240
302
|
process.exitCode = result.status ?? 1;
|
|
241
303
|
} finally {
|
|
242
304
|
prepared.cleanup();
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isPatinaFile, c as compareLineColumn, d as getDiagnosticBlock, l as extractSfcBlocks, o as isScriptLikeFile, r as resolveWorkaroundSource, u as formatBlockLabel } from "./workaround-
|
|
1
|
+
import { a as isPatinaFile, c as compareLineColumn, d as getDiagnosticBlock, l as extractSfcBlocks, o as isScriptLikeFile, r as resolveWorkaroundSource, u as formatBlockLabel } from "./workaround-DRe3y2CB.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { definePlugin, defineRule } from "@oxlint/plugins";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
@@ -111,17 +111,20 @@ function getPatinaRules() {
|
|
|
111
111
|
}
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/script-map.ts
|
|
114
|
-
function createSingleScriptMap(source, extractedScript) {
|
|
114
|
+
function createSingleScriptMap(source, extractedScript, sfcBlocks = extractSfcBlocks(source)) {
|
|
115
115
|
if (!extractedScript) return null;
|
|
116
|
-
const blocks =
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
const blocks = sfcBlocks.filter((block) => block.kind === "script" || block.kind === "script-setup");
|
|
117
|
+
let match = null;
|
|
118
|
+
for (const block of blocks) {
|
|
119
|
+
const skipped = countSkippedPrefix(block.content, extractedScript);
|
|
120
|
+
if (skipped === null) continue;
|
|
121
|
+
if (match !== null) return null;
|
|
122
|
+
match = {
|
|
123
|
+
block,
|
|
124
|
+
scriptStart: advancePosition(block.contentStart, block.content.slice(0, skipped))
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return match;
|
|
125
128
|
}
|
|
126
129
|
/**
|
|
127
130
|
* Oxlint trims the leading newline (and any indentation on that line) from a
|
|
@@ -256,13 +259,13 @@ if (import.meta.vitest) {
|
|
|
256
259
|
helpLevel: "short",
|
|
257
260
|
preset: "essential",
|
|
258
261
|
typeAware: true,
|
|
259
|
-
corsaPath: "./node_modules
|
|
262
|
+
corsaPath: "./node_modules/@typescript/typescript-linux-x64/lib/tsc"
|
|
260
263
|
})).toEqual({
|
|
261
264
|
locale: "ja",
|
|
262
265
|
helpLevel: "short",
|
|
263
266
|
preset: "essential",
|
|
264
267
|
typeAware: true,
|
|
265
|
-
corsaPath: "./node_modules
|
|
268
|
+
corsaPath: "./node_modules/@typescript/typescript-linux-x64/lib/tsc"
|
|
266
269
|
});
|
|
267
270
|
});
|
|
268
271
|
it("normalizes preset aliases", () => {
|
|
@@ -326,7 +329,7 @@ function getFileState(context) {
|
|
|
326
329
|
source: resolvedSource.source,
|
|
327
330
|
extractedScript: context.sourceCode.text,
|
|
328
331
|
usesOriginalLocations: resolvedSource.usesOriginalLocations || isScriptLikeFile(resolvedSource.filename),
|
|
329
|
-
|
|
332
|
+
reportedDiagnostics: /* @__PURE__ */ new Set(),
|
|
330
333
|
sfcBlocks: void 0,
|
|
331
334
|
scriptMap: void 0,
|
|
332
335
|
allDiagnosticsByRule: null,
|
|
@@ -387,7 +390,7 @@ function getDiagnosticsForRule(context, state, ruleName) {
|
|
|
387
390
|
}
|
|
388
391
|
function getScriptMap(state) {
|
|
389
392
|
if (state.scriptMap !== void 0) return state.scriptMap;
|
|
390
|
-
state.scriptMap = createSingleScriptMap(state.source, state.extractedScript);
|
|
393
|
+
state.scriptMap = createSingleScriptMap(state.source, state.extractedScript, getSfcBlocks(state));
|
|
391
394
|
return state.scriptMap;
|
|
392
395
|
}
|
|
393
396
|
function getSfcBlocks(state) {
|
|
@@ -395,11 +398,26 @@ function getSfcBlocks(state) {
|
|
|
395
398
|
state.sfcBlocks = extractSfcBlocks(state.source);
|
|
396
399
|
return state.sfcBlocks;
|
|
397
400
|
}
|
|
398
|
-
function
|
|
399
|
-
|
|
400
|
-
state.
|
|
401
|
+
function markDiagnosticAsReported(state, diagnostic) {
|
|
402
|
+
const key = diagnosticIdentity(diagnostic);
|
|
403
|
+
if (state.reportedDiagnostics.has(key)) return false;
|
|
404
|
+
state.reportedDiagnostics.add(key);
|
|
401
405
|
return true;
|
|
402
406
|
}
|
|
407
|
+
function diagnosticIdentity(diagnostic) {
|
|
408
|
+
const { start, end } = diagnostic.location;
|
|
409
|
+
return [
|
|
410
|
+
diagnostic.rule,
|
|
411
|
+
diagnostic.severity,
|
|
412
|
+
diagnostic.message,
|
|
413
|
+
start.line,
|
|
414
|
+
start.column,
|
|
415
|
+
start.offset,
|
|
416
|
+
end.line,
|
|
417
|
+
end.column,
|
|
418
|
+
end.offset
|
|
419
|
+
].join("\0");
|
|
420
|
+
}
|
|
403
421
|
function nextFileStateCacheClock() {
|
|
404
422
|
fileStateCacheClock += 1;
|
|
405
423
|
return fileStateCacheClock;
|
|
@@ -491,8 +509,7 @@ function createSummaryLine(message) {
|
|
|
491
509
|
}
|
|
492
510
|
//#endregion
|
|
493
511
|
//#region src/plugin.ts
|
|
494
|
-
function createOxlintDiagnostic(diagnostic, state, helpLevel) {
|
|
495
|
-
const scriptMap = getScriptMap(state);
|
|
512
|
+
function createOxlintDiagnostic(diagnostic, state, scriptMap, helpLevel) {
|
|
496
513
|
const loc = state.usesOriginalLocations ? createOriginalSfcLoc(diagnostic) : mapToScriptLoc(diagnostic, scriptMap);
|
|
497
514
|
const block = loc === null ? getDiagnosticBlock(diagnostic, getSfcBlocks(state)) : null;
|
|
498
515
|
return {
|
|
@@ -513,6 +530,14 @@ function createOxlintDiagnostic(diagnostic, state, helpLevel) {
|
|
|
513
530
|
})
|
|
514
531
|
};
|
|
515
532
|
}
|
|
533
|
+
function shouldReportForCurrentProgram(diagnostic, state, scriptMap) {
|
|
534
|
+
if (state.usesOriginalLocations || scriptMap == null) return true;
|
|
535
|
+
const block = getDiagnosticBlock(diagnostic, getSfcBlocks(state));
|
|
536
|
+
return !isScriptBlock(block) || block === scriptMap.block;
|
|
537
|
+
}
|
|
538
|
+
function isScriptBlock(block) {
|
|
539
|
+
return block?.kind === "script" || block?.kind === "script-setup";
|
|
540
|
+
}
|
|
516
541
|
function createOriginalSfcLoc(diagnostic) {
|
|
517
542
|
return {
|
|
518
543
|
start: {
|
|
@@ -539,10 +564,13 @@ function createPatinaRule(ruleMeta) {
|
|
|
539
564
|
if (ruleMeta.presets.length > 0 && !isIncrementalPreset(settings) && !ruleMeta.presets.includes(activePreset)) return;
|
|
540
565
|
const helpLevel = settings.helpLevel ?? "full";
|
|
541
566
|
const state = getFileState(context);
|
|
542
|
-
const
|
|
567
|
+
const scriptMap = getScriptMap(state);
|
|
568
|
+
const diagnostics = getDiagnosticsForRule(context, state, ruleMeta.name).filter((diagnostic) => shouldReportForCurrentProgram(diagnostic, state, scriptMap));
|
|
543
569
|
if (diagnostics.length === 0) return;
|
|
544
|
-
|
|
545
|
-
|
|
570
|
+
for (const diagnostic of diagnostics) {
|
|
571
|
+
if (!markDiagnosticAsReported(state, diagnostic)) continue;
|
|
572
|
+
context.report(createOxlintDiagnostic(diagnostic, state, scriptMap, helpLevel));
|
|
573
|
+
}
|
|
546
574
|
} };
|
|
547
575
|
}
|
|
548
576
|
});
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
//#region src/sfc-blocks.ts
|
|
2
|
-
const rootBlockPattern = /<([A-Za-z][\w-]*)\b[^>]*>/gu;
|
|
3
2
|
function extractSfcBlocks(source) {
|
|
4
3
|
const blocks = [];
|
|
5
4
|
const lineStarts = createLineStartOffsets(source);
|
|
6
5
|
let cursor = 0;
|
|
7
6
|
for (;;) {
|
|
8
|
-
|
|
9
|
-
const match = rootBlockPattern.exec(source);
|
|
7
|
+
const match = findNextOpenTag(source, cursor);
|
|
10
8
|
if (match == null) return blocks;
|
|
11
|
-
const tagName = match
|
|
12
|
-
const openTag = match[0];
|
|
13
|
-
const openTagEnd = match.index + openTag.length;
|
|
9
|
+
const { tagName, openTag, openTagEnd } = match;
|
|
14
10
|
const closeTag = `</${tagName}>`;
|
|
15
11
|
const closeTagStart = source.indexOf(closeTag, openTagEnd);
|
|
16
12
|
if (closeTagStart === -1) {
|
|
@@ -27,6 +23,47 @@ function extractSfcBlocks(source) {
|
|
|
27
23
|
cursor = closeTagStart + closeTag.length;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
26
|
+
function findNextOpenTag(source, cursor) {
|
|
27
|
+
let index = cursor;
|
|
28
|
+
for (;;) {
|
|
29
|
+
const openTagStart = source.indexOf("<", index);
|
|
30
|
+
if (openTagStart === -1) return null;
|
|
31
|
+
const tagNameStart = openTagStart + 1;
|
|
32
|
+
if (!isAsciiLetter(source.charCodeAt(tagNameStart))) {
|
|
33
|
+
index = tagNameStart;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
let tagNameEnd = tagNameStart + 1;
|
|
37
|
+
while (isTagNameCharacter(source.charCodeAt(tagNameEnd))) tagNameEnd += 1;
|
|
38
|
+
if (!isTagNameBoundary(source.charCodeAt(tagNameEnd))) {
|
|
39
|
+
index = tagNameEnd;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const openTagEnd = findOpenTagEnd(source, tagNameEnd);
|
|
43
|
+
if (openTagEnd == null) return null;
|
|
44
|
+
return {
|
|
45
|
+
tagName: source.slice(tagNameStart, tagNameEnd),
|
|
46
|
+
openTag: source.slice(openTagStart, openTagEnd),
|
|
47
|
+
openTagEnd
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function findOpenTagEnd(source, from) {
|
|
52
|
+
let quote = null;
|
|
53
|
+
for (let index = from; index < source.length; index += 1) {
|
|
54
|
+
const code = source.charCodeAt(index);
|
|
55
|
+
if (quote != null) {
|
|
56
|
+
if (code === quote) quote = null;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (code === 34 || code === 39) {
|
|
60
|
+
quote = code;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (code === 62) return index + 1;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
30
67
|
function getDiagnosticBlock(diagnostic, blocks) {
|
|
31
68
|
for (const block of blocks) if (compareLineColumn(diagnostic.location.start, block.contentStart) >= 0 && compareLineColumn(diagnostic.location.end, block.contentEnd) <= 0) return block;
|
|
32
69
|
return null;
|
|
@@ -45,6 +82,15 @@ function compareLineColumn(left, right) {
|
|
|
45
82
|
if (left.line !== right.line) return left.line - right.line;
|
|
46
83
|
return left.column - right.column;
|
|
47
84
|
}
|
|
85
|
+
function isAsciiLetter(code) {
|
|
86
|
+
return code >= 65 && code <= 90 || code >= 97 && code <= 122;
|
|
87
|
+
}
|
|
88
|
+
function isTagNameCharacter(code) {
|
|
89
|
+
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code === 45 || code === 95 || code >= 97 && code <= 122;
|
|
90
|
+
}
|
|
91
|
+
function isTagNameBoundary(code) {
|
|
92
|
+
return code === 9 || code === 10 || code === 12 || code === 13 || code === 32 || code === 47 || code === 62;
|
|
93
|
+
}
|
|
48
94
|
function createLineStartOffsets(source) {
|
|
49
95
|
const lineStarts = [0];
|
|
50
96
|
for (let index = 0; index < source.length; index += 1) if (source.charCodeAt(index) === 10) lineStarts.push(index + 1);
|
|
@@ -126,11 +172,20 @@ function getPrependedWorkaroundBlock(source) {
|
|
|
126
172
|
const contentEnd = offsetFromLineColumn(source, firstBlock.contentEnd);
|
|
127
173
|
const encodedFilename = encodedFilenameFromWorkaroundOpenTag(source.slice(0, contentStart));
|
|
128
174
|
if (encodedFilename == null) return null;
|
|
175
|
+
const closeTagEnd = contentEnd + 9;
|
|
176
|
+
const strippedSourceStart = sourceStartAfterSyntheticBlock(source, closeTagEnd);
|
|
177
|
+
if (strippedSourceStart == null) return null;
|
|
178
|
+
if (firstBlock.content !== createWhitespaceMirror(source.slice(strippedSourceStart))) return null;
|
|
129
179
|
return {
|
|
130
|
-
closeTagEnd
|
|
180
|
+
closeTagEnd,
|
|
131
181
|
encodedFilename
|
|
132
182
|
};
|
|
133
183
|
}
|
|
184
|
+
function sourceStartAfterSyntheticBlock(source, closeTagEnd) {
|
|
185
|
+
if (source.charCodeAt(closeTagEnd) === 13 && source.charCodeAt(closeTagEnd + 1) === 10) return closeTagEnd + 2;
|
|
186
|
+
if (source.charCodeAt(closeTagEnd) === 10) return closeTagEnd + 1;
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
134
189
|
function encodedFilenameFromWorkaroundOpenTag(openTag) {
|
|
135
190
|
if (!openTag.startsWith(SCRIPTLESS_WORKAROUND_OPEN_TAG_PREFIX)) return null;
|
|
136
191
|
const encodedFilenameStart = openTag.indexOf(SCRIPTLESS_WORKAROUND_FILENAME_ATTR) + SCRIPTLESS_WORKAROUND_FILENAME_ATTR.length;
|
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "oxlint-plugin-vize",
|
|
3
|
-
"version": "0.386.0",
|
|
4
|
-
"description": "Oxlint JS plugin bridge for Vize Patina",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"lint",
|
|
7
|
-
"oxlint",
|
|
8
|
-
"plugin",
|
|
9
|
-
"vize",
|
|
10
|
-
"vue"
|
|
11
|
-
],
|
|
12
|
-
"homepage": "https://github.com/ubugeeei-prod/vize",
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/ubugeeei-prod/vize/issues"
|
|
15
|
-
},
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "https://github.com/ubugeeei-prod/vize",
|
|
20
|
-
"directory": "npm/oxint"
|
|
21
|
-
},
|
|
22
2
|
"bin": {
|
|
23
3
|
"oxlint-vize": "bin/oxlint-vize"
|
|
24
4
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"dist"
|
|
28
|
-
],
|
|
29
|
-
"type": "module",
|
|
30
|
-
"main": "./dist/index.mjs",
|
|
31
|
-
"types": "./dist/index.d.mts",
|
|
32
|
-
"exports": {
|
|
33
|
-
".": {
|
|
34
|
-
"import": "./dist/index.mjs",
|
|
35
|
-
"types": "./dist/index.d.mts"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"publishConfig": {
|
|
39
|
-
"access": "public"
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/ubugeeei-prod/vize/issues"
|
|
40
7
|
},
|
|
41
8
|
"dependencies": {
|
|
42
9
|
"@oxlint/plugins": "1.78.0"
|
|
43
10
|
},
|
|
11
|
+
"description": "Oxlint JS plugin bridge for Vize Patina",
|
|
44
12
|
"devDependencies": {
|
|
45
13
|
"@tsdown/css": "0.22.14",
|
|
46
14
|
"@types/node": "25.9.2",
|
|
47
|
-
"@vizejs/native": "0.
|
|
15
|
+
"@vizejs/native": "0.388.0",
|
|
48
16
|
"tsdown": "0.22.14",
|
|
49
17
|
"typescript": "6.0.3",
|
|
50
18
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.24",
|
|
51
19
|
"vite-plus": "0.1.24"
|
|
52
20
|
},
|
|
53
|
-
"optionalDependencies": {
|
|
54
|
-
"@vizejs/native-darwin-arm64": "0.386.0",
|
|
55
|
-
"@vizejs/native-darwin-x64": "0.386.0",
|
|
56
|
-
"@vizejs/native-linux-arm64-gnu": "0.386.0",
|
|
57
|
-
"@vizejs/native-linux-arm64-musl": "0.386.0",
|
|
58
|
-
"@vizejs/native-linux-x64-gnu": "0.386.0",
|
|
59
|
-
"@vizejs/native-linux-x64-musl": "0.386.0",
|
|
60
|
-
"@vizejs/native-win32-arm64-msvc": "0.386.0",
|
|
61
|
-
"@vizejs/native-win32-x64-msvc": "0.386.0"
|
|
62
|
-
},
|
|
63
21
|
"engines": {
|
|
64
22
|
"node": "^22 || >= 24"
|
|
65
23
|
},
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"types": "./dist/index.d.mts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"bin",
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"homepage": "https://github.com/ubugeeei-prod/vize",
|
|
35
|
+
"keywords": [
|
|
36
|
+
"lint",
|
|
37
|
+
"oxlint",
|
|
38
|
+
"plugin",
|
|
39
|
+
"vize",
|
|
40
|
+
"vue"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"main": "./dist/index.mjs",
|
|
44
|
+
"name": "oxlint-plugin-vize",
|
|
45
|
+
"optionalDependencies": {
|
|
46
|
+
"@vizejs/native-darwin-arm64": "0.388.0",
|
|
47
|
+
"@vizejs/native-darwin-x64": "0.388.0",
|
|
48
|
+
"@vizejs/native-linux-arm64-gnu": "0.388.0",
|
|
49
|
+
"@vizejs/native-linux-arm64-musl": "0.388.0",
|
|
50
|
+
"@vizejs/native-linux-x64-gnu": "0.388.0",
|
|
51
|
+
"@vizejs/native-linux-x64-musl": "0.388.0",
|
|
52
|
+
"@vizejs/native-win32-arm64-msvc": "0.388.0",
|
|
53
|
+
"@vizejs/native-win32-x64-msvc": "0.388.0"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"directory": "npm/oxlint",
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "https://github.com/ubugeeei-prod/vize"
|
|
62
|
+
},
|
|
63
|
+
"type": "module",
|
|
64
|
+
"types": "./dist/index.d.mts",
|
|
65
|
+
"version": "0.388.0",
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "vp pack",
|
|
68
|
-
"test": "vp pack && vp test run src/file-state.test.ts && node src/test.ts && node src/script-location.test.ts",
|
|
69
68
|
"check": "vp check src vite.config.ts",
|
|
70
69
|
"check:fix": "vp check --fix src vite.config.ts",
|
|
71
|
-
"fmt": "vp fmt --write src vite.config.ts"
|
|
70
|
+
"fmt": "vp fmt --write src vite.config.ts",
|
|
71
|
+
"test": "vp pack && vp test run src/file-state.test.ts && node src/test.ts && node src/script-location.test.ts"
|
|
72
72
|
}
|
|
73
73
|
}
|