oxlint-plugin-vize 0.134.0 → 0.135.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/cli.mjs +33 -4
- package/package.json +10 -10
package/dist/cli.mjs
CHANGED
|
@@ -116,15 +116,18 @@ if (import.meta.vitest) {
|
|
|
116
116
|
const { describe, expect, it } = import.meta.vitest;
|
|
117
117
|
describe("rewriteReportedPaths", () => {
|
|
118
118
|
it("rewrites both absolute and relative temporary filenames", () => {
|
|
119
|
-
const replacements = new Map([["/repo/
|
|
120
|
-
expect(rewriteReportedPaths(["
|
|
119
|
+
const replacements = new Map([["/repo/node_modules/.vize/oxlint-plugin-vize/100-abcd/0-Example.vue", "/repo/src/Example.vue"], ["node_modules/.vize/oxlint-plugin-vize/100-abcd/0-Example.vue", "/repo/src/Example.vue"]]);
|
|
120
|
+
expect(rewriteReportedPaths(["node_modules/.vize/oxlint-plugin-vize/100-abcd/0-Example.vue", "/repo/node_modules/.vize/oxlint-plugin-vize/100-abcd/0-Example.vue"].join("\n"), replacements)).toBe(["/repo/src/Example.vue", "/repo/src/Example.vue"].join("\n"));
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/cli/workaround-files.ts
|
|
126
126
|
function prepareScriptlessWorkaroundFiles(cwd, filenames) {
|
|
127
|
-
const
|
|
127
|
+
const nodeModulesDir = path.join(cwd, "node_modules");
|
|
128
|
+
const tempRoot = path.join(nodeModulesDir, ".vize", "oxlint-plugin-vize");
|
|
129
|
+
let tempDir;
|
|
130
|
+
let createdNodeModules = false;
|
|
128
131
|
const ignoreArgs = [];
|
|
129
132
|
const tempArgs = [];
|
|
130
133
|
const pathReplacements = /* @__PURE__ */ new Map();
|
|
@@ -134,6 +137,11 @@ function prepareScriptlessWorkaroundFiles(cwd, filenames) {
|
|
|
134
137
|
const isStandaloneHtml = isStandaloneHtmlFile(filename);
|
|
135
138
|
if (!isStandaloneHtml && hasScriptLikeBlock(source)) continue;
|
|
136
139
|
const relativeFilename = path.relative(cwd, filename);
|
|
140
|
+
if (tempDir == null) {
|
|
141
|
+
const created = createWorkaroundTempDir(nodeModulesDir, tempRoot);
|
|
142
|
+
tempDir = created.tempDir;
|
|
143
|
+
createdNodeModules = created.createdNodeModules;
|
|
144
|
+
}
|
|
137
145
|
const tempBasename = isStandaloneHtml ? `${path.basename(filename)}.vue` : path.basename(filename);
|
|
138
146
|
const tempFilename = path.join(tempDir, `${counter}-${tempBasename}`);
|
|
139
147
|
counter += 1;
|
|
@@ -146,16 +154,37 @@ function prepareScriptlessWorkaroundFiles(cwd, filenames) {
|
|
|
146
154
|
return {
|
|
147
155
|
appendedArgs: [...ignoreArgs, ...tempArgs],
|
|
148
156
|
cleanup() {
|
|
149
|
-
if (
|
|
157
|
+
if (tempDir == null) return;
|
|
150
158
|
fs.rmSync(tempDir, {
|
|
151
159
|
force: true,
|
|
152
160
|
recursive: true
|
|
153
161
|
});
|
|
162
|
+
removeEmptyDirectory(tempRoot);
|
|
163
|
+
removeEmptyDirectory(path.dirname(tempRoot));
|
|
164
|
+
if (createdNodeModules) removeEmptyDirectory(nodeModulesDir);
|
|
154
165
|
},
|
|
155
166
|
pathReplacements,
|
|
156
167
|
usedScriptlessWorkaround: pathReplacements.size > 0
|
|
157
168
|
};
|
|
158
169
|
}
|
|
170
|
+
function createWorkaroundTempDir(nodeModulesDir, tempRoot) {
|
|
171
|
+
const createdNodeModules = !fs.existsSync(nodeModulesDir);
|
|
172
|
+
fs.mkdirSync(tempRoot, { recursive: true });
|
|
173
|
+
return {
|
|
174
|
+
createdNodeModules,
|
|
175
|
+
tempDir: fs.mkdtempSync(path.join(tempRoot, `${process.pid}-`))
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function removeEmptyDirectory(dirname) {
|
|
179
|
+
try {
|
|
180
|
+
fs.rmdirSync(dirname);
|
|
181
|
+
} catch (error) {
|
|
182
|
+
if (!isIgnorableRemoveDirError(error)) throw error;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function isIgnorableRemoveDirError(error) {
|
|
186
|
+
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR" || error.code === "ENOTEMPTY" || error.code === "EEXIST");
|
|
187
|
+
}
|
|
159
188
|
function toCliPath(filename) {
|
|
160
189
|
return filename.split(path.sep).join("/");
|
|
161
190
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-plugin-vize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.135.0",
|
|
4
4
|
"description": "Oxlint JS plugin bridge for Vize Patina",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tsdown/css": "0.22.0",
|
|
46
46
|
"@types/node": "25.7.0",
|
|
47
|
-
"@vizejs/native": "0.
|
|
47
|
+
"@vizejs/native": "0.135.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.135.0",
|
|
55
|
+
"@vizejs/native-darwin-x64": "0.135.0",
|
|
56
|
+
"@vizejs/native-linux-arm64-gnu": "0.135.0",
|
|
57
|
+
"@vizejs/native-linux-arm64-musl": "0.135.0",
|
|
58
|
+
"@vizejs/native-linux-x64-gnu": "0.135.0",
|
|
59
|
+
"@vizejs/native-linux-x64-musl": "0.135.0",
|
|
60
|
+
"@vizejs/native-win32-arm64-msvc": "0.135.0",
|
|
61
|
+
"@vizejs/native-win32-x64-msvc": "0.135.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=24"
|