main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

60
node_modules/next/dist/esm/lib/verifyAndLint.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import chalk from "next/dist/compiled/chalk";
import { Worker } from "next/dist/compiled/jest-worker";
import { existsSync } from "fs";
import { join } from "path";
import { ESLINT_DEFAULT_DIRS } from "./constants";
import { eventLintCheckCompleted } from "../telemetry/events";
import { CompileError } from "./compile-error";
import isError from "./is-error";
export async function verifyAndLint(dir, cacheLocation, configLintDirs, enableWorkerThreads, telemetry) {
try {
const lintWorkers = new Worker(require.resolve("./eslint/runLintCheck"), {
numWorkers: 1,
enableWorkerThreads,
maxRetries: 0
});
lintWorkers.getStdout().pipe(process.stdout);
lintWorkers.getStderr().pipe(process.stderr);
const lintDirs = (configLintDirs ?? ESLINT_DEFAULT_DIRS).reduce((res, d)=>{
const currDir = join(dir, d);
if (!existsSync(currDir)) return res;
res.push(currDir);
return res;
}, []);
const lintResults = await lintWorkers.runLintCheck(dir, lintDirs, {
lintDuringBuild: true,
eslintOptions: {
cacheLocation
}
});
const lintOutput = typeof lintResults === "string" ? lintResults : lintResults == null ? void 0 : lintResults.output;
if (typeof lintResults !== "string" && (lintResults == null ? void 0 : lintResults.eventInfo)) {
telemetry.record(eventLintCheckCompleted({
...lintResults.eventInfo,
buildLint: true
}));
}
if (typeof lintResults !== "string" && (lintResults == null ? void 0 : lintResults.isError) && lintOutput) {
await telemetry.flush();
throw new CompileError(lintOutput);
}
if (lintOutput) {
console.log(lintOutput);
}
lintWorkers.end();
} catch (err) {
if (isError(err)) {
if (err.type === "CompileError" || err instanceof CompileError) {
console.error(chalk.red("\nFailed to compile."));
console.error(err.message);
process.exit(1);
} else if (err.type === "FatalError") {
console.error(err.message);
process.exit(1);
}
}
throw err;
}
}
//# sourceMappingURL=verifyAndLint.js.map