vite-doctor 0.1.1 → 0.1.2
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 +11 -1
- package/dist/{cli-BH4b9rUn.mjs → cli-DAyaFyYp.mjs} +1 -1
- package/dist/{cli-main-Qke7WWOU.mjs → cli-main-CyF0P2ec.mjs} +8 -8
- package/dist/cli.mjs +1 -1
- package/dist/{config-wMPOujpB.d.mts → config-Vi7rSzhn.d.mts} +8 -1
- package/dist/config.d.mts +1 -1
- package/dist/{core-BaWz6Sqw.mjs → core-CaB3tfE8.mjs} +77 -21
- package/dist/{doctor-BZ1dduKq.mjs → doctor-B_MuQCG9.mjs} +8 -8
- package/dist/{doctor-DZp2Nx91.mjs → doctor-keXSmA0d.mjs} +1 -1
- package/dist/doctor-process.mjs +1 -1
- package/dist/{extension-DlygaoWY.d.mts → extension-BWauKIzu.d.mts} +1 -1
- package/dist/extension.d.mts +2 -2
- package/dist/{index-C7xDcvOY.d.mts → index-B8J7duVA.d.mts} +1 -1
- package/dist/index-C-XOuvIV.d.mts +2 -0
- package/dist/index-CWqoD7Dt.d.mts +1 -0
- package/dist/{index-BcOraqZ_.d.mts → index-DEy2t14t.d.mts} +2 -2
- package/dist/{index-BTmWIb6U.d.mts → index-vyjK90RR.d.mts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{migration-BKAZDynf.mjs → migration-BKDeSg5K.mjs} +2 -2
- package/dist/{module-CdkPnJ0X.d.mts → module-BYcUuLDi.d.mts} +7 -3
- package/dist/{module-CoWauFE9.mjs → module-Dkz3TqoG.mjs} +25 -4
- package/dist/nitro-CPo75d0U.mjs +2 -0
- package/dist/{no-route-middleware-api-security-EjckFmwh.mjs → no-route-middleware-api-security-D8_B1fZx.mjs} +38 -5
- package/dist/nuxt-cli.mjs +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.mjs +1 -1
- package/dist/{package-BeniS7ot.mjs → package-C6h9Qtda.mjs} +1 -1
- package/dist/{pinia-CFZn5ipu.mjs → pinia-BOSWuj_L.mjs} +6 -6
- package/dist/plugin-Dd5QxPcQ.mjs +383 -0
- package/dist/{plugin-_V-dd4-g.d.mts → plugin-NkM7-RMx.d.mts} +3 -3
- package/dist/plugin-run-CzodTs31.mjs +2 -0
- package/dist/plugin-run-DVWUGgM8.mjs +55 -0
- package/dist/plugin-worker.mjs +1 -1
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.mjs +1 -1
- package/dist/{primitives-CxYw0KOu.d.mts → primitives-nC-P1qet.d.mts} +22 -1
- package/dist/{rule-authoring-B-rhkSVN.mjs → rule-authoring-BdNe410l.mjs} +1 -1
- package/dist/rule-packs/nitro/index.d.mts +2 -2
- package/dist/rule-packs/nitro/index.mjs +2 -2
- package/dist/rule-packs/nitro/rules.d.mts +1 -1
- package/dist/rule-packs/nitro/rules.mjs +1 -1
- package/dist/rule-packs/nuxt/index.d.mts +2 -2
- package/dist/rule-packs/nuxt/index.mjs +8 -7
- package/dist/rule-packs/nuxt/module.d.mts +2 -2
- package/dist/rule-packs/nuxt/module.mjs +1 -1
- package/dist/rule-packs/nuxt/rules/index.d.mts +5 -5
- package/dist/rule-packs/nuxt/rules/index.mjs +4118 -1580
- package/dist/rule-packs/package/index.d.mts +1 -1
- package/dist/rule-packs/package/index.mjs +1 -1
- package/dist/rule-packs/pinia/index.d.mts +2 -2
- package/dist/rule-packs/pinia/index.mjs +1 -1
- package/dist/rule-packs/shadcn/index.d.mts +2 -2
- package/dist/rule-packs/shadcn/index.mjs +1 -1
- package/dist/rule-packs/typescript/index.d.mts +1 -1
- package/dist/rule-packs/typescript/index.mjs +2 -2
- package/dist/rule-packs/typescript/rules/index.d.mts +1 -1
- package/dist/rule-packs/typescript/rules/index.mjs +1 -1
- package/dist/rule-packs/vite/index.d.mts +1 -1
- package/dist/rule-packs/vite/index.mjs +1 -1
- package/dist/rule-packs/vite/rules/index.d.mts +1 -1
- package/dist/rule-packs/vite/rules/index.mjs +1 -1
- package/dist/rule-packs/vue/index.d.mts +1 -1
- package/dist/rule-packs/vue/index.mjs +1 -1
- package/dist/rule-packs/vue/rules.d.mts +1 -1
- package/dist/rule-packs/vue/rules.mjs +1 -1
- package/dist/{rules-pThBWNKu.mjs → rules-BEz9as7i.mjs} +1 -1
- package/dist/rules-CW8Ec0h7.mjs +2 -0
- package/dist/{rules-BXDsc_vj.mjs → rules-DTXdi7Ka.mjs} +27 -51
- package/dist/{rules-Ck0qw9Y-.mjs → rules-DYeVClNx.mjs} +20 -65
- package/dist/{rules-D2b-8SNT.mjs → rules-Dg84VwNY.mjs} +15 -89
- package/dist/{rules-rM2Zb1Jk.d.mts → rules-NQvZWSQD.d.mts} +3 -3
- package/dist/rules.d.mts +1 -1
- package/dist/rules.mjs +2 -2
- package/dist/{runtime-graph-gvjT33RA.mjs → runtime-graph-DB9xVYJ4.mjs} +46 -1
- package/dist/script-scope-KkOa4q8R.mjs +136 -0
- package/dist/{server-DWVLUuR_.mjs → server-Ds24tvve.mjs} +1 -1
- package/dist/{shadcn-DakNoxOB.mjs → shadcn-CpFqGWl3.mjs} +1 -1
- package/dist/testkit.d.mts +3 -3
- package/dist/testkit.mjs +1 -1
- package/dist/typescript-DP3Wc7UQ.mjs +2 -0
- package/package.json +1 -1
- package/dist/index-cepLKshI.d.mts +0 -1
- package/dist/index-sXIP3SGR.d.mts +0 -2
- package/dist/nitro-DUeTKgju.mjs +0 -2
- package/dist/plugin-DpSQG2E-.mjs +0 -185
- package/dist/plugin-run-DizgqQx9.mjs +0 -33
- package/dist/plugin-run-Q3bXHe8_.mjs +0 -2
- package/dist/rules-NPAaR11O.mjs +0 -2
- package/dist/typescript-hosXLQAc.mjs +0 -2
package/README.md
CHANGED
|
@@ -11,9 +11,14 @@
|
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
|
-
<a href="https://vite-doctor.onmax.me">Docs</a>
|
|
14
|
+
<a href="https://vite-doctor.onmax.me">Docs</a> · <a href="https://comark-ui.onmax.me/lint/vite-doctor/">Comark UI extension</a>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
|
+
[](https://www.npmjs.com/package/vite-doctor)
|
|
18
|
+
[](https://www.npmjs.com/package/vite-doctor)
|
|
19
|
+
[](https://github.com/onmax/vite-doctor/blob/main/LICENSE)
|
|
20
|
+
[](https://vite-doctor.onmax.me)
|
|
21
|
+
|
|
17
22
|
## Usage
|
|
18
23
|
|
|
19
24
|
Run Vite Doctor from the project root:
|
|
@@ -181,6 +186,11 @@ unique within a Doctor Run. Shared final slash-delimited segments require full n
|
|
|
181
186
|
Config Extends; registering duplicate full names fails with the internal `DOC0023`
|
|
182
187
|
authoring diagnostic.
|
|
183
188
|
|
|
189
|
+
[`comark-linter`](https://comark-ui.onmax.me/lint/vite-doctor/) is a published Doctor
|
|
190
|
+
Extension: it checks [Comark](https://comark.dev) Markdown documents and the plugins from
|
|
191
|
+
[Comark UI](https://comark-ui.onmax.me). Register `comark()` from `comark-linter/doctor` in
|
|
192
|
+
`doctor.config.ts`, add `comark/recommended` to `extends`, and run with `--config`.
|
|
193
|
+
|
|
184
194
|
## Development
|
|
185
195
|
|
|
186
196
|
```bash
|
|
@@ -9,7 +9,7 @@ async function main(args = process.argv.slice(2), cwd = process.cwd(), surface =
|
|
|
9
9
|
process.stdout.write(`${viteDoctorVersion}\n`);
|
|
10
10
|
return 0;
|
|
11
11
|
}
|
|
12
|
-
return (await import("./cli-main-
|
|
12
|
+
return (await import("./cli-main-CyF0P2ec.mjs")).main(args, cwd, surface);
|
|
13
13
|
}
|
|
14
14
|
/** The `vite-doctor` binary: a Doctor Run goes through the long-lived Doctor process when opted in. */
|
|
15
15
|
async function runCli(args = process.argv.slice(2), cwd = process.cwd()) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as explainRule, n as createReport, r as createRulesReport, s as reportStatus } from "./core-CaB3tfE8.mjs";
|
|
2
2
|
import { t as viteDoctorVersion } from "./version-Qod0rU4x.mjs";
|
|
3
3
|
import { n as loadDoctorConfig } from "./config-CaJ0DqB3.mjs";
|
|
4
4
|
import { n as DOCTOR_PROCESS_ENV } from "./protocol-CcLGBETF.mjs";
|
|
@@ -135,7 +135,7 @@ async function main(args = process.argv.slice(2), cwd = process.cwd(), surface =
|
|
|
135
135
|
exitCode = 2;
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
|
-
const { createMigrationReport, formatMigrationReport } = await import("./migration-
|
|
138
|
+
const { createMigrationReport, formatMigrationReport } = await import("./migration-BKDeSg5K.mjs");
|
|
139
139
|
const report = await createMigrationReport(root, options.to ? [options.to] : []);
|
|
140
140
|
process.stdout.write(formatMigrationReport(report, format));
|
|
141
141
|
exitCode = report.summary.errors > 0 ? 1 : 0;
|
|
@@ -150,7 +150,7 @@ async function main(args = process.argv.slice(2), cwd = process.cwd(), surface =
|
|
|
150
150
|
applyHostExtensions(runOptions, surface, options);
|
|
151
151
|
validateCliRunOptions(runOptions);
|
|
152
152
|
runOptions.config = await loadCliConfig(cwd, stringFlag(options.config));
|
|
153
|
-
const { viteDoctorRulePacks } = await import("./doctor-
|
|
153
|
+
const { viteDoctorRulePacks } = await import("./doctor-keXSmA0d.mjs");
|
|
154
154
|
process.stdout.write(createRulesReport(await viteDoctorRulePacks(runOptions), format));
|
|
155
155
|
});
|
|
156
156
|
cli.command("explain <diagnostic>", "Explain a Doctor Diagnostic Code or Rule.").option("--config <path>", "Explicitly load an executable Doctor config.").option("--host-extensions", hostExtensionsHelp).option("--format <format>", "Output: text, json, or agent.").option("--framework <framework>", "Framework override.").action(async (diagnostic, options) => {
|
|
@@ -163,7 +163,7 @@ async function main(args = process.argv.slice(2), cwd = process.cwd(), surface =
|
|
|
163
163
|
applyHostExtensions(runOptions, surface, options);
|
|
164
164
|
validateCliRunOptions(runOptions);
|
|
165
165
|
runOptions.config = await loadCliConfig(cwd, stringFlag(options.config));
|
|
166
|
-
const { viteDoctorRulePacks } = await import("./doctor-
|
|
166
|
+
const { viteDoctorRulePacks } = await import("./doctor-keXSmA0d.mjs");
|
|
167
167
|
const report = explainRule(await viteDoctorRulePacks(runOptions), diagnostic, format);
|
|
168
168
|
if (!report) {
|
|
169
169
|
await writeCliError(`Unknown Diagnostic Code or Rule: ${diagnostic}`, format);
|
|
@@ -178,7 +178,7 @@ async function main(args = process.argv.slice(2), cwd = process.cwd(), surface =
|
|
|
178
178
|
const runOptions = { root: cwd };
|
|
179
179
|
applyDoctorOptions(runOptions, options);
|
|
180
180
|
validateCliRunOptions(runOptions);
|
|
181
|
-
const { viteDoctorCacheStatus } = await import("./doctor-
|
|
181
|
+
const { viteDoctorCacheStatus } = await import("./doctor-keXSmA0d.mjs");
|
|
182
182
|
const status = await viteDoctorCacheStatus(cwd, await loadCliConfig(cwd, stringFlag(options.config)), runOptions.framework === "auto" ? void 0 : runOptions.framework);
|
|
183
183
|
process.stdout.write(formatCacheStatus(status, format));
|
|
184
184
|
return;
|
|
@@ -187,7 +187,7 @@ async function main(args = process.argv.slice(2), cwd = process.cwd(), surface =
|
|
|
187
187
|
const runOptions = { root: cwd };
|
|
188
188
|
applyDoctorOptions(runOptions, options);
|
|
189
189
|
validateCliRunOptions(runOptions);
|
|
190
|
-
const { cleanViteDoctorCache } = await import("./doctor-
|
|
190
|
+
const { cleanViteDoctorCache } = await import("./doctor-keXSmA0d.mjs");
|
|
191
191
|
await cleanViteDoctorCache(cwd, await loadCliConfig(cwd, stringFlag(options.config)), runOptions.framework === "auto" ? void 0 : runOptions.framework);
|
|
192
192
|
consola.log("Doctor cache cleaned");
|
|
193
193
|
return;
|
|
@@ -316,7 +316,7 @@ function addDoctorRunCommand(cli, args, cwd, surface, setExitCode) {
|
|
|
316
316
|
}
|
|
317
317
|
async function watchDoctorCommand(args, cwd, surface, root, options) {
|
|
318
318
|
if (options.fix || options.unsafeFix || options.updateBaseline) throw new Error("--watch cannot be combined with --fix, --unsafe-fix, or --update-baseline.");
|
|
319
|
-
const [{ watchDoctorRuns }, { viteDoctorCacheStatus }] = await Promise.all([import("./watch-DMUy9-YX.mjs"), import("./doctor-
|
|
319
|
+
const [{ watchDoctorRuns }, { viteDoctorCacheStatus }] = await Promise.all([import("./watch-DMUy9-YX.mjs"), import("./doctor-keXSmA0d.mjs")]);
|
|
320
320
|
const cache = await viteDoctorCacheStatus(root, options.config, options.framework === "auto" ? void 0 : options.framework);
|
|
321
321
|
const runArgs = args.filter((arg) => arg !== "--watch");
|
|
322
322
|
const controller = new AbortController();
|
|
@@ -337,7 +337,7 @@ async function watchDoctorCommand(args, cwd, surface, root, options) {
|
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
async function runDoctorCommand(options, format, configFile) {
|
|
340
|
-
const { runViteDoctor, shouldFailDoctorRun } = await import("./doctor-
|
|
340
|
+
const { runViteDoctor, shouldFailDoctorRun } = await import("./doctor-keXSmA0d.mjs");
|
|
341
341
|
const result = await runViteDoctor(options);
|
|
342
342
|
process.stdout.write(createReport(result, format, {
|
|
343
343
|
runOptions: options,
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as DoctorReportFormat, d as DoctorSerializableConfig, i as DoctorExtensionInput, m as ProjectInfo, o as DoctorFramework, w as RuntimeTarget } from "./primitives-
|
|
1
|
+
import { c as DoctorReportFormat, d as DoctorSerializableConfig, i as DoctorExtensionInput, m as ProjectInfo, o as DoctorFramework, w as RuntimeTarget } from "./primitives-nC-P1qet.mjs";
|
|
2
2
|
//#region src/core/config.d.ts
|
|
3
3
|
interface DoctorConfig extends DoctorSerializableConfig {
|
|
4
4
|
extensions?: DoctorExtensionInput[];
|
|
@@ -11,6 +11,13 @@ interface DoctorRunOptions {
|
|
|
11
11
|
extends?: "auto" | string[];
|
|
12
12
|
changed?: boolean;
|
|
13
13
|
since?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Files whose Diagnostics this run reports, absolute or relative to `root`. Like `changed`, the
|
|
16
|
+
* run analyzes the whole project so cross-file Rules keep their context, but it reports only
|
|
17
|
+
* Diagnostics located in these files. Plugin Surfaces pass the files a dev server saw change.
|
|
18
|
+
* Combined with `changed` or `since`, the report narrows to changed lines in these files.
|
|
19
|
+
*/
|
|
20
|
+
affectedFiles?: string[];
|
|
14
21
|
format?: DoctorReportFormat;
|
|
15
22
|
baseline?: string;
|
|
16
23
|
updateBaseline?: boolean;
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as loadDoctorConfig, i as defineDoctorConfig, n as DoctorRunOptions, r as LoadDoctorConfigOptions, t as DoctorConfig } from "./config-
|
|
1
|
+
import { a as loadDoctorConfig, i as defineDoctorConfig, n as DoctorRunOptions, r as LoadDoctorConfigOptions, t as DoctorConfig } from "./config-Vi7rSzhn.mjs";
|
|
2
2
|
export { type DoctorConfig, type DoctorRunOptions, type LoadDoctorConfigOptions, defineDoctorConfig, loadDoctorConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as resolveNuxtCompatibility, d as parseScriptResult, f as parseScriptSync, i as isNuxtManifestCurrent, l as resolveRuntimeGraph, o as readNuxtConfigGranularCachedData, s as readNuxtConfigSsr, t as applyRuntimeTarget, u as parseScript } from "./runtime-graph-DB9xVYJ4.mjs";
|
|
2
2
|
import { a as codeForRuleId, c as diagnosticForCode, i as defineRulePack, l as doctorDiagnosticsHost, o as defineDoctorDiagnostics, u as DOCTOR_DIAGNOSTICS_DOCS_BASE } from "./primitives-QDMBsnjd.mjs";
|
|
3
3
|
import { t as doctorInternalDiagnostics } from "./internal-diagnostic-handles-R_2cBQaP.mjs";
|
|
4
4
|
import { t as RuleInputs } from "./rule-inputs-GzH5Uyjz.mjs";
|
|
@@ -1143,10 +1143,8 @@ function expandBraces(pattern) {
|
|
|
1143
1143
|
//#endregion
|
|
1144
1144
|
//#region src/core/internal/lazy-parsers.ts
|
|
1145
1145
|
const require = createRequire(import.meta.url);
|
|
1146
|
-
let typescriptESLintParser;
|
|
1147
1146
|
let typescript;
|
|
1148
1147
|
let vueCompilerSfc;
|
|
1149
|
-
const parseForESLint = (code, options) => (typescriptESLintParser ??= require("@typescript-eslint/parser")).parseForESLint(code, options);
|
|
1150
1148
|
function loadTypeScript() {
|
|
1151
1149
|
return typescript ??= require("typescript");
|
|
1152
1150
|
}
|
|
@@ -1395,6 +1393,11 @@ async function detectNuxt(root, version, deps, { manifest, manifestPath, manifes
|
|
|
1395
1393
|
priority: 0
|
|
1396
1394
|
}],
|
|
1397
1395
|
localLayerAliases: manifest?.localLayerAliases,
|
|
1396
|
+
productionBuildCache: manifestCurrent ? manifest?.productionBuildCache : void 0,
|
|
1397
|
+
granularCachedData: manifestCurrent && typeof manifest?.granularCachedData === "boolean" ? {
|
|
1398
|
+
enabled: manifest.granularCachedData,
|
|
1399
|
+
source: "manifest"
|
|
1400
|
+
} : readNuxtConfigGranularCachedData(root, configs),
|
|
1398
1401
|
routeRules: manifest?.routeRules ?? readRouteRules(config.primary),
|
|
1399
1402
|
ssr: (manifestCurrent ? manifest?.ssr : void 0) ?? readNuxtConfigSsr(root, configs),
|
|
1400
1403
|
runtimeConfig: manifest?.runtimeConfig,
|
|
@@ -2016,6 +2019,27 @@ var GitChangeUnavailableError = class extends Error {
|
|
|
2016
2019
|
}
|
|
2017
2020
|
};
|
|
2018
2021
|
async function selectSourceInventory(root, config, options, project, memo) {
|
|
2022
|
+
const affected = options.affectedFiles ? new Set(options.affectedFiles.map((file) => resolve(root, file))) : void 0;
|
|
2023
|
+
const selection = await selectGitOrAllFiles(root, config, options, project, memo);
|
|
2024
|
+
if (!affected || selection.git?.status === "unavailable") return selection;
|
|
2025
|
+
return {
|
|
2026
|
+
...selection,
|
|
2027
|
+
files: selection.files.map((file) => {
|
|
2028
|
+
if (!affected.has(file.path)) return omitEligibility(file);
|
|
2029
|
+
if (selection.git) return file;
|
|
2030
|
+
return {
|
|
2031
|
+
...file,
|
|
2032
|
+
reportEligibility: { kind: "file" }
|
|
2033
|
+
};
|
|
2034
|
+
})
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
function omitEligibility(file) {
|
|
2038
|
+
if (!file.reportEligibility) return file;
|
|
2039
|
+
const { reportEligibility: _, ...rest } = file;
|
|
2040
|
+
return rest;
|
|
2041
|
+
}
|
|
2042
|
+
async function selectGitOrAllFiles(root, config, options, project, memo) {
|
|
2019
2043
|
if (options.changed || options.since) {
|
|
2020
2044
|
const include = config.include ?? defaultIncludeForProject(project);
|
|
2021
2045
|
const exclude = [...DEFAULT_EXCLUDE, ...config.exclude ?? []];
|
|
@@ -2738,6 +2762,7 @@ async function createScanSession(options) {
|
|
|
2738
2762
|
project,
|
|
2739
2763
|
files,
|
|
2740
2764
|
gitChanges: sourceInventory.git,
|
|
2765
|
+
scopedReport: Boolean(sourceInventory.git || options.affectedFiles),
|
|
2741
2766
|
handles: [],
|
|
2742
2767
|
handlesByPath,
|
|
2743
2768
|
sourceTexts: /* @__PURE__ */ new Map(),
|
|
@@ -2780,10 +2805,10 @@ async function runPhase(session, name, run) {
|
|
|
2780
2805
|
}
|
|
2781
2806
|
function persistScanCache(session) {
|
|
2782
2807
|
const { options } = session;
|
|
2783
|
-
const subset = Boolean(options.rules) || Boolean(options.analyses) ||
|
|
2808
|
+
const subset = Boolean(options.rules) || Boolean(options.analyses) || session.scopedReport;
|
|
2784
2809
|
session.cache.persist({
|
|
2785
2810
|
files: session.files.length,
|
|
2786
|
-
activeRuleKeys: subset ? new Set(session.
|
|
2811
|
+
activeRuleKeys: subset ? new Set(session.scopedReport || options.analyses && !options.rules ? [] : session.ruleKeys.values()) : void 0
|
|
2787
2812
|
});
|
|
2788
2813
|
}
|
|
2789
2814
|
function cacheDirectory(root, config) {
|
|
@@ -4413,6 +4438,26 @@ const allDoctorDiagnosticRegistry = defineDoctorDiagnostics([
|
|
|
4413
4438
|
{
|
|
4414
4439
|
code: "NUXT0090",
|
|
4415
4440
|
ruleId: "nuxt/config/no-runtime-env-in-build-options"
|
|
4441
|
+
},
|
|
4442
|
+
{
|
|
4443
|
+
code: "NUXT0091",
|
|
4444
|
+
ruleId: "nuxt/config/no-per-build-value-in-cache-key"
|
|
4445
|
+
},
|
|
4446
|
+
{
|
|
4447
|
+
code: "NUXT0092",
|
|
4448
|
+
ruleId: "nuxt/fetch/cached-data-respects-refresh"
|
|
4449
|
+
},
|
|
4450
|
+
{
|
|
4451
|
+
code: "NUXT0093",
|
|
4452
|
+
ruleId: "nuxt/config/no-unhashed-build-cache-input"
|
|
4453
|
+
},
|
|
4454
|
+
{
|
|
4455
|
+
code: "NUXT0094",
|
|
4456
|
+
ruleId: "nuxt/routing/keepalive-requires-max"
|
|
4457
|
+
},
|
|
4458
|
+
{
|
|
4459
|
+
code: "NUXT0095",
|
|
4460
|
+
ruleId: "nuxt/fetch/no-ssr-refetch-of-shared-key"
|
|
4416
4461
|
}
|
|
4417
4462
|
]);
|
|
4418
4463
|
const allDiagnosticCodesByRuleId = allDoctorDiagnosticRegistry.codesByRuleId;
|
|
@@ -4471,7 +4516,7 @@ function reportStaleBaseline(session, baseline) {
|
|
|
4471
4516
|
}
|
|
4472
4517
|
function reportUnusedConfigSuppressions(session) {
|
|
4473
4518
|
const { options, root } = session;
|
|
4474
|
-
if (
|
|
4519
|
+
if (session.scopedReport || options.rules || options.analyses) return;
|
|
4475
4520
|
const ran = new Set(session.enabledRules.map((rule) => rule.meta.id));
|
|
4476
4521
|
const effectiveExtends = options.extends ?? session.config.extends;
|
|
4477
4522
|
const unscoped = (effectiveExtends === void 0 || effectiveExtends === "auto" || Array.isArray(effectiveExtends) && effectiveExtends.includes("auto")) && !Object.values(session.config.rules ?? {}).includes("off");
|
|
@@ -4597,7 +4642,7 @@ function suppressionEntryBounds(source, section, index) {
|
|
|
4597
4642
|
}
|
|
4598
4643
|
}
|
|
4599
4644
|
function applyReportEligibility(session) {
|
|
4600
|
-
if (!session.
|
|
4645
|
+
if (!session.scopedReport) return;
|
|
4601
4646
|
const eligibility = new Map(session.files.map((file) => [file.path, file.reportEligibility]));
|
|
4602
4647
|
const sources = { get: (file) => session.handlesByPath.get(file)?.text };
|
|
4603
4648
|
if (session.project.evidenceGaps) session.project.evidenceGaps = session.project.evidenceGaps.filter((gap) => gap.source !== "script-parser" && gap.source !== "vue-sfc-parser" || gap.files.some((file) => eligibility.get(file)));
|
|
@@ -4605,6 +4650,7 @@ function applyReportEligibility(session) {
|
|
|
4605
4650
|
return [diagnostic, ...diagnostic.related ?? []].some((location) => {
|
|
4606
4651
|
const fileEligibility = eligibility.get(location.file);
|
|
4607
4652
|
if (!fileEligibility) return false;
|
|
4653
|
+
if (fileEligibility.kind === "file") return true;
|
|
4608
4654
|
if (!location.range) return diagnostic.range === void 0;
|
|
4609
4655
|
const endLine = diagnosticEndLine(location.range, sources.get(location.file));
|
|
4610
4656
|
return fileEligibility.ranges.some((range) => location.range.line <= range.endLine && endLine >= range.startLine);
|
|
@@ -5504,7 +5550,7 @@ async function prepareSourceFile(session, file, fileId) {
|
|
|
5504
5550
|
fileId
|
|
5505
5551
|
});
|
|
5506
5552
|
}
|
|
5507
|
-
if (session.
|
|
5553
|
+
if (session.scopedReport && !file.reportEligibility) return createSourceHandle(session, file, content.hash, {
|
|
5508
5554
|
session,
|
|
5509
5555
|
entry: file,
|
|
5510
5556
|
text: content.text,
|
|
@@ -5545,7 +5591,7 @@ async function loadSourceFile(handle) {
|
|
|
5545
5591
|
}
|
|
5546
5592
|
/**
|
|
5547
5593
|
* Bit 1: SFC, bit 2: script AST, bit 4: template AST, known without parsing cached files.
|
|
5548
|
-
* Undefined for a file a
|
|
5594
|
+
* Undefined for a file a scoped run has not parsed yet.
|
|
5549
5595
|
*/
|
|
5550
5596
|
function sourceShape(handle) {
|
|
5551
5597
|
const state = sourceStates.get(handle);
|
|
@@ -6868,10 +6914,10 @@ async function runFileRules(session) {
|
|
|
6868
6914
|
files: 0
|
|
6869
6915
|
})) : void 0;
|
|
6870
6916
|
const workspacePackages = projectWorkspacePackages(session.project);
|
|
6871
|
-
const
|
|
6917
|
+
const reportedFiles = session.scopedReport ? new Set(session.files.flatMap((file) => file.reportEligibility ? [file.path] : [])) : void 0;
|
|
6872
6918
|
for (const file of session.handles) {
|
|
6873
6919
|
const owner = session.ruleScopes.size ? owningWorkspacePackage(workspacePackages, file.relativePath) : ".";
|
|
6874
|
-
const candidates =
|
|
6920
|
+
const candidates = reportedFiles && !reportedFiles.has(file.path) ? [...rules.keys()].filter((index) => rules[index].meta.reportScope === "project") : [...rules.keys()];
|
|
6875
6921
|
if (!candidates.length) continue;
|
|
6876
6922
|
if (sourceShape(file) === void 0) await loadSourceFile(file);
|
|
6877
6923
|
const pending = [];
|
|
@@ -7020,7 +7066,7 @@ function manifestRuleProjects(session, rule, nuxtRoots) {
|
|
|
7020
7066
|
async function buildGraphPhase(session) {
|
|
7021
7067
|
const analyses = selectedAnalyses(session);
|
|
7022
7068
|
const graphAnalyses = analyses.has("dead-code") || analyses.has("graph");
|
|
7023
|
-
if (session.
|
|
7069
|
+
if (session.scopedReport && !graphAnalyses) return;
|
|
7024
7070
|
const key = graphKey(session);
|
|
7025
7071
|
if (!graphAnalyses) {
|
|
7026
7072
|
const cached = session.cache.graph(key);
|
|
@@ -7513,14 +7559,7 @@ function createTextReport(result) {
|
|
|
7513
7559
|
const items = result.diagnostics.filter((diagnostic) => diagnostic.severity === severity);
|
|
7514
7560
|
if (!items.length) continue;
|
|
7515
7561
|
lines.push(pc.bold(labelSeverity(severity)));
|
|
7516
|
-
for (const diagnostic of items)
|
|
7517
|
-
const path = relative(result.root, diagnostic.file) || ".";
|
|
7518
|
-
const loc = diagnostic.range ? `${path}:${diagnostic.range.line}:${diagnostic.range.column}` : path;
|
|
7519
|
-
lines.push(indent(formatDiagnostic(diagnostic.diagnostic), " "));
|
|
7520
|
-
lines.push(` rule: ${diagnostic.ruleId}`);
|
|
7521
|
-
lines.push(` source: ${loc}`);
|
|
7522
|
-
lines.push(` confidence: ${diagnostic.confidence ?? "heuristic-medium"}`);
|
|
7523
|
-
}
|
|
7562
|
+
for (const diagnostic of items) lines.push(formatTextDiagnostic(result.root, diagnostic));
|
|
7524
7563
|
lines.push("");
|
|
7525
7564
|
}
|
|
7526
7565
|
lines.push("Summary");
|
|
@@ -7543,6 +7582,20 @@ function createTextReport(result) {
|
|
|
7543
7582
|
}
|
|
7544
7583
|
return lines.join("\n");
|
|
7545
7584
|
}
|
|
7585
|
+
/** One Diagnostic as the text report renders it, indented for a severity section. */
|
|
7586
|
+
function formatTextDiagnostic(root, diagnostic) {
|
|
7587
|
+
return [
|
|
7588
|
+
indent(formatDiagnostic(diagnostic.diagnostic), " "),
|
|
7589
|
+
` rule: ${diagnostic.ruleId}`,
|
|
7590
|
+
` source: ${diagnosticLocation(root, diagnostic)}`,
|
|
7591
|
+
` confidence: ${diagnostic.confidence ?? "heuristic-medium"}`
|
|
7592
|
+
].join("\n");
|
|
7593
|
+
}
|
|
7594
|
+
/** `path:line:column` relative to `root`, or the path alone for an unlocated Diagnostic. */
|
|
7595
|
+
function diagnosticLocation(root, diagnostic) {
|
|
7596
|
+
const path = relative(root, diagnostic.file) || ".";
|
|
7597
|
+
return diagnostic.range ? `${path}:${diagnostic.range.line}:${diagnostic.range.column}` : path;
|
|
7598
|
+
}
|
|
7546
7599
|
function confidenceMix(result) {
|
|
7547
7600
|
const mix = {
|
|
7548
7601
|
proven: 0,
|
|
@@ -7991,6 +8044,9 @@ async function executeDoctorRun(options) {
|
|
|
7991
8044
|
base: session.gitChanges.base,
|
|
7992
8045
|
files: session.files.filter((file) => file.reportEligibility).length,
|
|
7993
8046
|
deletedFiles: session.gitChanges.files.filter((file) => file.kind === "deleted").length
|
|
8047
|
+
} : options.affectedFiles ? {
|
|
8048
|
+
mode: "affected",
|
|
8049
|
+
files: session.files.filter((file) => file.reportEligibility).length
|
|
7994
8050
|
} : {
|
|
7995
8051
|
mode: "all",
|
|
7996
8052
|
files: session.files.length
|
|
@@ -8008,4 +8064,4 @@ async function executeDoctorRun(options) {
|
|
|
8008
8064
|
return result;
|
|
8009
8065
|
}
|
|
8010
8066
|
//#endregion
|
|
8011
|
-
export {
|
|
8067
|
+
export { findTemplateAttribute as A, nuxtInventoryOwner as C, parseSfcFile as D, createVueScriptForParsing as E, templateExpressionReferences as F, walkTemplate as I, getNodeVisitorKeys as L, parseTemplateExpression as M, startTagEnd as N, parseVueScripts as O, templateDirectiveBindings as P, detectWorkspacePackages as S, workspaceFramework as T, detectProject as _, explainRule as a, findDefaultNuxtModuleDefinition as b, namePattern as c, collectRulePacks as d, resolveProjectDoctorConfig as f, selectScanFiles as g, projectWorkspacePackages as h, diagnosticLocation as i, findTemplateDirective as j, TemplateNodeType as k, cacheStatus as l, evaluateRuntimeRange as m, createReport as n, formatTextDiagnostic as o, evaluateRuleApplicability as p, createRulesReport as r, reportStatus as s, runDoctor as t, cleanCache as u, loadTypeScript as v, owningWorkspacePackage as w, unwrapExpression as x, loadVueCompilerSfc as y };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as nuxtInventoryOwner, S as detectWorkspacePackages, T as workspaceFramework, _ as detectProject, d as collectRulePacks, f as resolveProjectDoctorConfig, l as cacheStatus, t as runDoctor, u as cleanCache } from "./core-CaB3tfE8.mjs";
|
|
2
2
|
import { n as defineDoctorExtension } from "./primitives-QDMBsnjd.mjs";
|
|
3
3
|
import { t as doctorInternalDiagnostics } from "./internal-diagnostic-handles-R_2cBQaP.mjs";
|
|
4
4
|
import { t as viteDoctorVersion } from "./version-Qod0rU4x.mjs";
|
|
5
|
-
import { t as packageRulePack } from "./package-
|
|
6
|
-
import { t as viteRulePack } from "./rules-
|
|
7
|
-
import "./rules-
|
|
8
|
-
import { t as typescriptRulePack } from "./rules-
|
|
9
|
-
import "./typescript-
|
|
10
|
-
import { t as shadcnRulePack } from "./shadcn-
|
|
11
|
-
import { t as piniaRulePack } from "./pinia-
|
|
5
|
+
import { t as packageRulePack } from "./package-C6h9Qtda.mjs";
|
|
6
|
+
import { t as viteRulePack } from "./rules-DYeVClNx.mjs";
|
|
7
|
+
import "./rules-CW8Ec0h7.mjs";
|
|
8
|
+
import { t as typescriptRulePack } from "./rules-BEz9as7i.mjs";
|
|
9
|
+
import "./typescript-DP3Wc7UQ.mjs";
|
|
10
|
+
import { t as shadcnRulePack } from "./shadcn-CpFqGWl3.mjs";
|
|
11
|
+
import { t as piniaRulePack } from "./pinia-BOSWuj_L.mjs";
|
|
12
12
|
import { readFileSync } from "node:fs";
|
|
13
13
|
import { isAbsolute, join } from "pathe";
|
|
14
14
|
import { pathToFileURL } from "node:url";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as viteDoctorCacheStatus, i as shouldFailDoctorRun, n as hostDoctorExtensions, o as viteDoctorExtensions, r as runViteDoctor, s as viteDoctorRulePacks, t as cleanViteDoctorCache } from "./doctor-
|
|
1
|
+
import { a as viteDoctorCacheStatus, i as shouldFailDoctorRun, n as hostDoctorExtensions, o as viteDoctorExtensions, r as runViteDoctor, s as viteDoctorRulePacks, t as cleanViteDoctorCache } from "./doctor-B_MuQCG9.mjs";
|
|
2
2
|
export { cleanViteDoctorCache, hostDoctorExtensions, runViteDoctor, shouldFailDoctorRun, viteDoctorCacheStatus, viteDoctorExtensions, viteDoctorRulePacks };
|
package/dist/doctor-process.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import module from "node:module";
|
|
2
2
|
//#region src/doctor-process.ts
|
|
3
3
|
module.enableCompileCache();
|
|
4
|
-
const { parseServerOptions, serveDoctorProcess } = await import("./server-
|
|
4
|
+
const { parseServerOptions, serveDoctorProcess } = await import("./server-Ds24tvve.mjs");
|
|
5
5
|
const server = await serveDoctorProcess(parseServerOptions(process.argv[2]));
|
|
6
6
|
if (server) {
|
|
7
7
|
for (const signal of [
|
package/dist/extension.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as DoctorDiagnosticHandle, A as SourceRange, B as TemplateNodeKinds, C as RuntimeEvidenceContributor, D as ScriptAstNodeType, E as ScriptAstNodeOf, F as TemplateDirectiveNode, G as TemplateTextNode, H as TemplateParentNode, I as TemplateElementNode, J as defineDoctorExtension, K as TemplateVisitor, L as TemplateExpressionNode, M as TemplateAttributeNode, N as TemplateChildNode, O as ScriptVisitor, P as TemplateCommentNode, Q as DoctorDiagnosticCodeEntry, R as TemplateInterpolationNode, S as RuleVisitor, T as ScriptAstNode, U as TemplateRootNode, V as TemplateNodeParents, W as TemplateSourceLocation, X as defineRulePack, Y as defineDoctorPluginApi, Z as DefineDoctorDiagnosticsOptions, _ as RuleLifecycleHooks, a as DoctorExtensionLoader, b as RulePrefilter, et as DoctorDiagnosticParams, g as RuleContext, h as ProjectInventoryContributor, i as DoctorExtensionInput, j as TemplateAstNode, k as SourceFileHandle, l as DoctorRule, m as ProjectInfo, n as DoctorExtension, nt as defineExtensionDiagnostics, q as createRule, r as DoctorExtensionApi, s as DoctorPluginApi, tt as DoctorDiagnosticRegistry, v as RuleMeta, x as RuleReportMetadata, y as RulePack, z as TemplateNodeKind } from "./primitives-
|
|
2
|
-
import { t as RESERVED_DIAGNOSTIC_CODE_PREFIXES } from "./extension-
|
|
1
|
+
import { $ as DoctorDiagnosticHandle, A as SourceRange, B as TemplateNodeKinds, C as RuntimeEvidenceContributor, D as ScriptAstNodeType, E as ScriptAstNodeOf, F as TemplateDirectiveNode, G as TemplateTextNode, H as TemplateParentNode, I as TemplateElementNode, J as defineDoctorExtension, K as TemplateVisitor, L as TemplateExpressionNode, M as TemplateAttributeNode, N as TemplateChildNode, O as ScriptVisitor, P as TemplateCommentNode, Q as DoctorDiagnosticCodeEntry, R as TemplateInterpolationNode, S as RuleVisitor, T as ScriptAstNode, U as TemplateRootNode, V as TemplateNodeParents, W as TemplateSourceLocation, X as defineRulePack, Y as defineDoctorPluginApi, Z as DefineDoctorDiagnosticsOptions, _ as RuleLifecycleHooks, a as DoctorExtensionLoader, b as RulePrefilter, et as DoctorDiagnosticParams, g as RuleContext, h as ProjectInventoryContributor, i as DoctorExtensionInput, j as TemplateAstNode, k as SourceFileHandle, l as DoctorRule, m as ProjectInfo, n as DoctorExtension, nt as defineExtensionDiagnostics, q as createRule, r as DoctorExtensionApi, s as DoctorPluginApi, tt as DoctorDiagnosticRegistry, v as RuleMeta, x as RuleReportMetadata, y as RulePack, z as TemplateNodeKind } from "./primitives-nC-P1qet.mjs";
|
|
2
|
+
import { t as RESERVED_DIAGNOSTIC_CODE_PREFIXES } from "./extension-BWauKIzu.mjs";
|
|
3
3
|
export { type DefineDoctorDiagnosticsOptions, type DoctorDiagnosticCodeEntry, type DoctorDiagnosticHandle, type DoctorDiagnosticParams, type DoctorDiagnosticRegistry, type DoctorExtension, type DoctorExtensionApi, type DoctorExtensionInput, type DoctorExtensionLoader, type DoctorPluginApi, type DoctorRule, type ProjectInfo, type ProjectInventoryContributor, RESERVED_DIAGNOSTIC_CODE_PREFIXES, type RuleContext, type RuleLifecycleHooks, type RuleMeta, type RulePack, type RulePrefilter, type RuleReportMetadata, type RuleVisitor, type RuntimeEvidenceContributor, type ScriptAstNode, type ScriptAstNodeOf, type ScriptAstNodeType, type ScriptVisitor, type SourceFileHandle, type SourceRange, type TemplateAstNode, type TemplateAttributeNode, type TemplateChildNode, type TemplateCommentNode, type TemplateDirectiveNode, type TemplateElementNode, type TemplateExpressionNode, type TemplateInterpolationNode, type TemplateNodeKind, type TemplateNodeKinds, type TemplateNodeParents, type TemplateParentNode, type TemplateRootNode, type TemplateSourceLocation, type TemplateTextNode, type TemplateVisitor, createRule, defineExtensionDiagnostics as defineDoctorDiagnostics, defineDoctorExtension, defineDoctorPluginApi, defineRulePack };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as DoctorRule, y as RulePack } from "./primitives-
|
|
1
|
+
import { l as DoctorRule, y as RulePack } from "./primitives-nC-P1qet.mjs";
|
|
2
2
|
//#region src/rule-packs/typescript/rules/no-array-filter-map.d.ts
|
|
3
3
|
declare const noArrayFilterMap: DoctorRule;
|
|
4
4
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index-DEy2t14t.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as DoctorRule, y as RulePack } from "./primitives-
|
|
2
|
-
import "./extension-
|
|
1
|
+
import { l as DoctorRule, y as RulePack } from "./primitives-nC-P1qet.mjs";
|
|
2
|
+
import "./extension-BWauKIzu.mjs";
|
|
3
3
|
//#region src/rule-packs/nitro/rules/no-use-nuxt-app-in-nitro.d.ts
|
|
4
4
|
declare const noUseNuxtAppInNitro: DoctorRule;
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as DoctorRule, y as RulePack } from "./primitives-
|
|
1
|
+
import { l as DoctorRule, y as RulePack } from "./primitives-nC-P1qet.mjs";
|
|
2
2
|
//#region src/rule-packs/vite/rules/define.d.ts
|
|
3
3
|
declare const noUnusedDefine: DoctorRule;
|
|
4
4
|
declare const noUntypedDefine: DoctorRule;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as defineDoctorConfig, n as DoctorRunOptions, t as DoctorConfig } from "./config-
|
|
2
|
-
import { n as doctor, t as ViteDoctorSurfaceOptions } from "./plugin-
|
|
1
|
+
import { i as defineDoctorConfig, n as DoctorRunOptions, t as DoctorConfig } from "./config-Vi7rSzhn.mjs";
|
|
2
|
+
import { n as doctor, t as ViteDoctorSurfaceOptions } from "./plugin-NkM7-RMx.mjs";
|
|
3
3
|
export { type DoctorConfig, type DoctorRunOptions, type ViteDoctorSurfaceOptions, defineDoctorConfig, doctor };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as detectProject, p as evaluateRuleApplicability } from "./core-CaB3tfE8.mjs";
|
|
2
2
|
import { t as viteDoctorVersion } from "./version-Qod0rU4x.mjs";
|
|
3
|
-
import { r as runViteDoctor, s as viteDoctorRulePacks } from "./doctor-
|
|
3
|
+
import { r as runViteDoctor, s as viteDoctorRulePacks } from "./doctor-B_MuQCG9.mjs";
|
|
4
4
|
import { relative } from "pathe";
|
|
5
5
|
//#region src/migration.ts
|
|
6
6
|
async function createMigrationReport(root, requestedTargets = []) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as NuxtDoctorManifest, p as NuxtModuleSource } from "./primitives-
|
|
2
|
-
import { t as DoctorConfig } from "./config-
|
|
3
|
-
import "./index-
|
|
1
|
+
import { f as NuxtDoctorManifest, p as NuxtModuleSource } from "./primitives-nC-P1qet.mjs";
|
|
2
|
+
import { t as DoctorConfig } from "./config-Vi7rSzhn.mjs";
|
|
3
|
+
import "./index-C-XOuvIV.mjs";
|
|
4
4
|
import { Nuxt, NuxtModule } from "nuxt/schema";
|
|
5
5
|
//#region src/rule-packs/nuxt/module.d.ts
|
|
6
6
|
type NuxtDoctorModuleOptions = DoctorConfig;
|
|
@@ -50,6 +50,10 @@ type NuxtDoctorEvidence = {
|
|
|
50
50
|
importDirs?: unknown[];
|
|
51
51
|
autoImportContext?: NuxtAutoImportContext;
|
|
52
52
|
autoImportEntries?: unknown[];
|
|
53
|
+
composableScan?: {
|
|
54
|
+
dirs: string;
|
|
55
|
+
entries: Promise<unknown[]>;
|
|
56
|
+
};
|
|
53
57
|
moduleSources?: NuxtModuleSource[];
|
|
54
58
|
extensions?: string[];
|
|
55
59
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as nuxtServerInventory, n as autoRegisteredNuxtLayers } from "./runtime-graph-
|
|
1
|
+
import { a as nuxtServerInventory, n as autoRegisteredNuxtLayers } from "./runtime-graph-DB9xVYJ4.mjs";
|
|
2
2
|
import { t as doctorInternalDiagnostics } from "./internal-diagnostic-handles-R_2cBQaP.mjs";
|
|
3
3
|
import { existsSync, mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, isAbsolute, join, normalize, relative, resolve } from "pathe";
|
|
@@ -20,6 +20,7 @@ async function setupNuxtDoctor(options, nuxt) {
|
|
|
20
20
|
importDirs: [],
|
|
21
21
|
autoImportContext: void 0,
|
|
22
22
|
autoImportEntries: void 0,
|
|
23
|
+
composableScan: void 0,
|
|
23
24
|
moduleSources: void 0,
|
|
24
25
|
extensions: void 0
|
|
25
26
|
};
|
|
@@ -79,6 +80,7 @@ async function setupNuxtDoctor(options, nuxt) {
|
|
|
79
80
|
});
|
|
80
81
|
nuxt.hook?.("imports:extend", (imports) => {
|
|
81
82
|
evidence.autoImportEntries = Array.isArray(imports) ? imports : [];
|
|
83
|
+
evidence.composableScan = void 0;
|
|
82
84
|
});
|
|
83
85
|
nuxt.hook?.("pages:resolved", (pages) => {
|
|
84
86
|
evidence.pages = flattenPages(pages).map((page) => ({
|
|
@@ -160,9 +162,19 @@ async function writeManifest(nuxt, evidence) {
|
|
|
160
162
|
if (evidence?.autoImportContext) {
|
|
161
163
|
scannedAutoImportEntries = [];
|
|
162
164
|
if (composableScanRoots.size && evidence.importDirs?.length) {
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
|
|
165
|
+
const dirs = evidence.importDirs.map(String);
|
|
166
|
+
const key = JSON.stringify(dirs);
|
|
167
|
+
if (evidence.composableScan?.dirs !== key) evidence.composableScan = {
|
|
168
|
+
dirs: key,
|
|
169
|
+
entries: scanImportDirs(nuxt, dirs)
|
|
170
|
+
};
|
|
171
|
+
const scan = evidence.composableScan;
|
|
172
|
+
try {
|
|
173
|
+
scannedAutoImportEntries = await scan.entries;
|
|
174
|
+
} catch (error) {
|
|
175
|
+
if (evidence.composableScan === scan) evidence.composableScan = void 0;
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
166
178
|
}
|
|
167
179
|
}
|
|
168
180
|
const manifest = {
|
|
@@ -186,12 +198,16 @@ async function writeManifest(nuxt, evidence) {
|
|
|
186
198
|
srcDir: resolve(layer.cwd ?? rootDir, layer.config?.srcDir ?? "."),
|
|
187
199
|
appMiddlewareDir: resolve(layerDirectories[index]?.appMiddleware ?? resolve(srcDir, nuxt.options.dir?.middleware || "middleware")),
|
|
188
200
|
serverDir: resolve(layerDirectories[index]?.server ?? resolve(layer.cwd ?? rootDir, layer.config?.serverDir ?? "server")),
|
|
201
|
+
sharedDir: layerDirectories[index]?.shared ? resolve(layerDirectories[index].shared) : void 0,
|
|
202
|
+
publicDir: layerDirectories[index]?.public ? resolve(layerDirectories[index].public) : void 0,
|
|
189
203
|
aliases: Object.fromEntries(Object.entries(layer.config?.alias ?? {}).map(([key, value]) => [key, String(value)])),
|
|
190
204
|
compilerScan: layer.config?.compiler?.scan !== false,
|
|
191
205
|
name: layer.config?.name,
|
|
192
206
|
priority: index
|
|
193
207
|
})),
|
|
194
208
|
localLayerAliases: nuxt.options.experimental?.localLayerAliases !== false,
|
|
209
|
+
productionBuildCache: nuxt.options.dev ? void 0 : nuxt.options.experimental?.buildCache === true,
|
|
210
|
+
granularCachedData: nuxt.options.experimental?.granularCachedData === true,
|
|
195
211
|
aliases: Object.fromEntries(Object.entries(nuxt.options.alias ?? {}).map(([key, value]) => [key, String(value)])),
|
|
196
212
|
routeRules: nuxt.options.routeRules ?? {},
|
|
197
213
|
ssr: nuxt.options.ssr !== false,
|
|
@@ -242,6 +258,11 @@ const lastManifestWrite = {
|
|
|
242
258
|
path: "",
|
|
243
259
|
signature: ""
|
|
244
260
|
};
|
|
261
|
+
async function scanImportDirs(nuxt, dirs) {
|
|
262
|
+
const { scanDirExports } = await importModule("unimport", { url: new URL(import.meta.resolve("nuxt")) });
|
|
263
|
+
const isIgnored = createIsIgnored(nuxt);
|
|
264
|
+
return scanDirExports(dirs, { fileFilter: (file) => !isIgnored(file) });
|
|
265
|
+
}
|
|
245
266
|
function nuxtConfigModifiedAt(root) {
|
|
246
267
|
for (const extension of [
|
|
247
268
|
"ts",
|