@vizejs/nuxt 0.503.0 → 0.506.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.
|
@@ -163,16 +163,22 @@ function spawnOxlint(node, entrypoint, args, cwd) {
|
|
|
163
163
|
});
|
|
164
164
|
child.on("close", (status) => {
|
|
165
165
|
const output = Buffer.concat(stdout).toString("utf8");
|
|
166
|
+
const details = Buffer.concat(stderr).toString("utf8");
|
|
166
167
|
if (output.trim()) {
|
|
167
|
-
resolve(
|
|
168
|
+
resolve({
|
|
169
|
+
stderr: details,
|
|
170
|
+
stdout: output
|
|
171
|
+
});
|
|
168
172
|
return;
|
|
169
173
|
}
|
|
170
|
-
const details = Buffer.concat(stderr).toString("utf8").trim();
|
|
171
174
|
if (status === 0) {
|
|
172
|
-
resolve(
|
|
175
|
+
resolve({
|
|
176
|
+
stderr: details,
|
|
177
|
+
stdout: "{\"diagnostics\":[]}\n"
|
|
178
|
+
});
|
|
173
179
|
return;
|
|
174
180
|
}
|
|
175
|
-
reject(/* @__PURE__ */ new Error(`oxlint exited with ${String(status)} without JSON output${details ? `: ${details}` : ""}`));
|
|
181
|
+
reject(/* @__PURE__ */ new Error(`oxlint exited with ${String(status)} without JSON output${details.trim() ? `: ${details.trim()}` : ""}`));
|
|
176
182
|
});
|
|
177
183
|
});
|
|
178
184
|
}
|
|
@@ -206,7 +212,7 @@ function formatNuxtLintCheckerDiagnostics(diagnostics, formatter) {
|
|
|
206
212
|
});
|
|
207
213
|
return lines.length > 0 ? `${lines.join("\n")}\n` : "";
|
|
208
214
|
}
|
|
209
|
-
function resultFromPayload(payload, task) {
|
|
215
|
+
function resultFromPayload(payload, task, stderr) {
|
|
210
216
|
const diagnostics = payload.diagnostics.filter((diagnostic) => {
|
|
211
217
|
const kind = diagnosticKind(diagnostic);
|
|
212
218
|
return kind === "error" && task.emitError || kind === "warning" && task.emitWarning;
|
|
@@ -217,11 +223,13 @@ function resultFromPayload(payload, task) {
|
|
|
217
223
|
...payload,
|
|
218
224
|
diagnostics
|
|
219
225
|
})}\n` : "" : formatNuxtLintCheckerDiagnostics(diagnostics, task.formatter);
|
|
226
|
+
const notice = stderr.trim();
|
|
220
227
|
return {
|
|
221
228
|
diagnostics,
|
|
222
229
|
diagnosticCount: diagnostics.length,
|
|
223
230
|
hasErrors,
|
|
224
231
|
hasWarnings,
|
|
232
|
+
notices: notice ? [notice] : [],
|
|
225
233
|
output
|
|
226
234
|
};
|
|
227
235
|
}
|
|
@@ -232,17 +240,18 @@ async function runNuxtLintCheckerTask(task) {
|
|
|
232
240
|
diagnosticCount: 0,
|
|
233
241
|
hasErrors: false,
|
|
234
242
|
hasWarnings: false,
|
|
243
|
+
notices: [],
|
|
235
244
|
output: ""
|
|
236
245
|
};
|
|
237
|
-
const
|
|
246
|
+
const execution = await executeOxlint(task.oxlintEntrypoint ?? resolveOxlintEntrypoint(), await checkerArgs(task), task.cwd);
|
|
238
247
|
let payload;
|
|
239
248
|
try {
|
|
240
|
-
payload = JSON.parse(stdout);
|
|
249
|
+
payload = JSON.parse(execution.stdout);
|
|
241
250
|
} catch (error) {
|
|
242
|
-
throw new Error(`oxlint returned invalid JSON: ${stdout.slice(0, 240)}`, { cause: error });
|
|
251
|
+
throw new Error(`oxlint returned invalid JSON: ${execution.stdout.slice(0, 240)}`, { cause: error });
|
|
243
252
|
}
|
|
244
253
|
if (!Array.isArray(payload.diagnostics)) throw new Error("oxlint JSON has no diagnostics array");
|
|
245
|
-
return resultFromPayload(payload, task);
|
|
254
|
+
return resultFromPayload(payload, task, execution.stderr);
|
|
246
255
|
}
|
|
247
256
|
function serializeError(error) {
|
|
248
257
|
if (error instanceof Error) return {
|
|
@@ -408,6 +417,7 @@ var NuxtLintChangeCollector = class {
|
|
|
408
417
|
return path.resolve(this.config.rootDir, file);
|
|
409
418
|
}
|
|
410
419
|
report(result, targets, full) {
|
|
420
|
+
for (const notice of result.notices) this.server.config.logger.warn(notice);
|
|
411
421
|
if (result.output) {
|
|
412
422
|
if (result.hasErrors) this.server.config.logger.error(result.output);
|
|
413
423
|
else if (result.hasWarnings) this.server.config.logger.warn(result.output);
|
|
@@ -467,6 +477,7 @@ function checkerError(message) {
|
|
|
467
477
|
return error;
|
|
468
478
|
}
|
|
469
479
|
function reportResult(compilation, result) {
|
|
480
|
+
for (const notice of result.notices) compilation.warnings.push(checkerError(notice));
|
|
470
481
|
if (result.hasErrors) compilation.errors.push(checkerError(result.output));
|
|
471
482
|
else if (result.hasWarnings) compilation.warnings.push(checkerError(result.output));
|
|
472
483
|
}
|
|
@@ -980,21 +991,28 @@ async function importConfigModuleWithDependencies(configPath, registerModuleHook
|
|
|
980
991
|
try {
|
|
981
992
|
const configURL = pathToFileURL(configPath);
|
|
982
993
|
const require = createRequire(configURL);
|
|
983
|
-
const
|
|
994
|
+
const engineNames = ["vite", "vite-plus"];
|
|
984
995
|
let candidate;
|
|
985
|
-
for (const
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
996
|
+
for (const engineName of engineNames) {
|
|
997
|
+
const searchPaths = require.resolve.paths(engineName) ?? [];
|
|
998
|
+
for (const directory of searchPaths.filter((path) => !globalPaths.includes(path))) {
|
|
999
|
+
const requested = join(directory, engineName);
|
|
1000
|
+
watchInputs.add(requested);
|
|
1001
|
+
await beforeRead?.([requested]);
|
|
1002
|
+
if (lstatSync(requested, { throwIfNoEntry: false }) !== void 0) {
|
|
1003
|
+
candidate = {
|
|
1004
|
+
engineName,
|
|
1005
|
+
directory: requested
|
|
1006
|
+
};
|
|
1007
|
+
watchInputs.add(join(candidate.directory, "package.json"));
|
|
1008
|
+
break;
|
|
1009
|
+
}
|
|
993
1010
|
}
|
|
1011
|
+
if (candidate !== void 0) break;
|
|
994
1012
|
}
|
|
995
1013
|
if (typeof registerModuleHooks !== "function") {
|
|
996
|
-
if (evaluate) throw new Error("Tracking imports while evaluating a Vite config requires Node.js 22.15 or newer. Upgrade Node.js; installed
|
|
997
|
-
if (candidate === void 0 && !withoutVite) throw new Error("Loading a Vite config without project Vite requires Node.js 22.15 or newer to track imported configuration files. Upgrade Node.js or install Vite in the project.");
|
|
1014
|
+
if (evaluate) throw new Error("Tracking imports while evaluating a Vite config requires Node.js 22.15 or newer. Upgrade Node.js; an installed config bundler alone cannot track runtime imports.");
|
|
1015
|
+
if (candidate === void 0 && !withoutVite) throw new Error("Loading a Vite config without project Vite or Vite+ requires Node.js 22.15 or newer to track imported configuration files. Upgrade Node.js or install Vite or Vite+ in the project.");
|
|
998
1016
|
}
|
|
999
1017
|
if (candidate === void 0) {
|
|
1000
1018
|
finishSelection();
|
|
@@ -1003,22 +1021,27 @@ async function importConfigModuleWithDependencies(configPath, registerModuleHook
|
|
|
1003
1021
|
result = await captureConfigEvaluation(async () => ({ namespace: await (withoutVite ? withoutVite(configURL) : import(configURL.href)) }), configPath, registerModuleHooks, evaluate, void 0, observe, void 0, timings);
|
|
1004
1022
|
return result;
|
|
1005
1023
|
}
|
|
1006
|
-
const
|
|
1007
|
-
watchInputs.add(join(
|
|
1008
|
-
await beforeRead?.([join(candidate, "package.json"), join(
|
|
1009
|
-
const resolvedEntry = require.resolve(
|
|
1024
|
+
const engineDirectory = realpathSync(candidate.directory);
|
|
1025
|
+
watchInputs.add(join(engineDirectory, "package.json"));
|
|
1026
|
+
await beforeRead?.([join(candidate.directory, "package.json"), join(engineDirectory, "package.json")]);
|
|
1027
|
+
const resolvedEntry = require.resolve(candidate.engineName);
|
|
1010
1028
|
watchInputs.add(resolvedEntry);
|
|
1011
|
-
const
|
|
1012
|
-
watchInputs.add(
|
|
1013
|
-
const entryPath = relative(
|
|
1014
|
-
if (entryPath === ".." || entryPath.startsWith(`..${sep}`) || isAbsolute(entryPath))
|
|
1015
|
-
|
|
1029
|
+
const engineEntry = realpathSync(resolvedEntry);
|
|
1030
|
+
watchInputs.add(engineEntry);
|
|
1031
|
+
const entryPath = relative(engineDirectory, engineEntry);
|
|
1032
|
+
if (entryPath === ".." || entryPath.startsWith(`..${sep}`) || isAbsolute(entryPath)) {
|
|
1033
|
+
const engineLabel = candidate.engineName === "vite" ? "Vite" : "Vite+";
|
|
1034
|
+
throw new Error(`Resolved loader escapes selected project ${engineLabel}: ${candidate.directory} -> ${engineEntry}`);
|
|
1035
|
+
}
|
|
1036
|
+
await beforeRead?.([resolvedEntry, engineEntry]);
|
|
1016
1037
|
finishSelection();
|
|
1017
1038
|
selectionFinished = true;
|
|
1018
1039
|
const finishImport = beginConfigTiming(timings, "engine_import");
|
|
1019
1040
|
let loadConfigFromFile;
|
|
1020
1041
|
try {
|
|
1021
|
-
|
|
1042
|
+
const engine = await import(pathToFileURL(engineEntry).href);
|
|
1043
|
+
loadConfigFromFile = engine.loadConfigFromFile ?? engine.default?.loadConfigFromFile;
|
|
1044
|
+
if (typeof loadConfigFromFile !== "function") throw new Error(`${candidate.engineName} does not export loadConfigFromFile`);
|
|
1022
1045
|
} finally {
|
|
1023
1046
|
finishImport();
|
|
1024
1047
|
}
|
|
@@ -1056,7 +1079,7 @@ async function importConfigModuleWithDependencies(configPath, registerModuleHook
|
|
|
1056
1079
|
finishLoad();
|
|
1057
1080
|
if (finishProfile) timings.find((row) => row.phase === "public_load").cpuProfile = await finishProfile();
|
|
1058
1081
|
}
|
|
1059
|
-
if (!loaded) throw new Error(
|
|
1082
|
+
if (!loaded) throw new Error(`${candidate.engineName} did not load the selected config: ${configPath}`);
|
|
1060
1083
|
return {
|
|
1061
1084
|
namespace: loaded.config.namespace,
|
|
1062
1085
|
dependencies: loaded.dependencies
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as setupLintInspector, l as setupNuxtLintChecker, m as hasNuxtViteCompilerSupport, n as setupNuxtLintConfigGeneration, p as getDetectedNuxtMajor } from "./generation-
|
|
1
|
+
import { i as setupLintInspector, l as setupNuxtLintChecker, m as hasNuxtViteCompilerSupport, n as setupNuxtLintConfigGeneration, p as getDetectedNuxtMajor } from "./generation-DJxmPezT.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path, { dirname, join, resolve } from "node:path";
|
package/dist/lint/index.d.mts
CHANGED
package/dist/lint/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as toNuxtLintProjectState, c as setupNuxtLintConfigAddons, d as createNuxtLintCheckerVitePlugin, f as resolveNuxtLintCheckerOptions, l as setupNuxtLintChecker, n as setupNuxtLintConfigGeneration, o as renderNuxtOxlintConfig, r as writeFileIfChanged, s as VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, t as ROOT_OXLINT_CONFIG_NAMES, u as createNuxtLintCheckerWebpackPlugin } from "../generation-
|
|
1
|
+
import { a as toNuxtLintProjectState, c as setupNuxtLintConfigAddons, d as createNuxtLintCheckerVitePlugin, f as resolveNuxtLintCheckerOptions, l as setupNuxtLintChecker, n as setupNuxtLintConfigGeneration, o as renderNuxtOxlintConfig, r as writeFileIfChanged, s as VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, t as ROOT_OXLINT_CONFIG_NAMES, u as createNuxtLintCheckerWebpackPlugin } from "../generation-DJxmPezT.mjs";
|
|
2
2
|
export * from "@vizejs/nuxt-lint-config";
|
|
3
3
|
export { ROOT_OXLINT_CONFIG_NAMES, VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, createNuxtLintCheckerVitePlugin, createNuxtLintCheckerWebpackPlugin, renderNuxtOxlintConfig, resolveNuxtLintCheckerOptions, setupNuxtLintChecker, setupNuxtLintConfigAddons, setupNuxtLintConfigGeneration, toNuxtLintProjectState, writeFileIfChanged };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.506.0",
|
|
4
4
|
"description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@nuxt/kit": "3.11.2",
|
|
52
|
-
"@vizejs/native": "0.
|
|
53
|
-
"@vizejs/nuxt-lint-config": "0.
|
|
54
|
-
"@vizejs/vite-plugin": "0.
|
|
55
|
-
"@vizejs/vite-plugin-musea": "0.
|
|
56
|
-
"oxlint-plugin-vize": "0.
|
|
57
|
-
"vize": "0.
|
|
52
|
+
"@vizejs/native": "0.474.0",
|
|
53
|
+
"@vizejs/nuxt-lint-config": "0.506.0",
|
|
54
|
+
"@vizejs/vite-plugin": "0.506.0",
|
|
55
|
+
"@vizejs/vite-plugin-musea": "0.506.0",
|
|
56
|
+
"oxlint-plugin-vize": "0.506.0",
|
|
57
|
+
"vize": "0.506.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"jiti-nuxt2": "npm:jiti@1.21.7",
|