Revamping to matrix style

This commit is contained in:
2026-02-16 16:37:35 -05:00
parent 71852ec99a
commit 9d0e3938e4
14958 changed files with 2089572 additions and 114 deletions

1
node_modules/@astrojs/check/dist/bin.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

9
node_modules/@astrojs/check/dist/bin.js generated vendored Executable file
View File

@@ -0,0 +1,9 @@
import path from 'node:path';
import { check, parseArgsAsCheckConfig } from './index.js';
const args = parseArgsAsCheckConfig(process.argv);
console.info(`Getting diagnostics for Astro files in ${path.resolve(args.root)}...`);
const result = await check(args);
if (typeof result === 'boolean') {
process.exit(result ? 1 : 0);
}
//# sourceMappingURL=bin.js.map

23
node_modules/@astrojs/check/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import { options } from './options.js';
/**
* Given a list of arguments from the command line (such as `process.argv`), return parsed and processed options
*/
export declare function parseArgsAsCheckConfig(args: string[]): {
[x: string]: unknown;
readonly root: string;
readonly watch: boolean;
readonly tsconfig: string | undefined;
readonly minimumFailingSeverity: "error" | "warning" | "hint";
readonly minimumSeverity: "error" | "warning" | "hint";
readonly preserveWatchOutput: boolean;
_: (string | number)[];
$0: string;
};
export type Flags = Pick<ReturnType<typeof parseArgsAsCheckConfig>, keyof typeof options>;
export declare function check(flags: Partial<Flags> & {
watch: true;
}): Promise<void>;
export declare function check(flags: Partial<Flags> & {
watch: false;
}): Promise<boolean>;
export declare function check(flags: Partial<Flags>): Promise<boolean | void>;

99
node_modules/@astrojs/check/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
import { createRequire } from 'node:module';
import path from 'node:path';
import { AstroCheck } from '@astrojs/language-server';
import { watch } from 'chokidar';
import { bold, dim, red, yellow } from 'kleur/colors';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { options } from './options.js';
/**
* Given a list of arguments from the command line (such as `process.argv`), return parsed and processed options
*/
export function parseArgsAsCheckConfig(args) {
return yargs(hideBin(args)).options(options).parseSync();
}
/**
* Print diagnostics according to the given flags, and return whether or not the program should exit with an error code.
*/
export async function check(flags) {
const workspaceRoot = path.resolve(flags.root ?? process.cwd());
const require = createRequire(import.meta.url);
const checker = new AstroCheck(workspaceRoot, require.resolve('typescript'), flags.tsconfig);
let req = 0;
if (flags.watch) {
function createWatcher(rootPath, extensions) {
return watch(`${rootPath}/**/*{${extensions.join(',')}}`, {
ignored: (ignoredPath) => ignoredPath.includes('node_modules'),
ignoreInitial: true,
});
}
// Dynamically get the list of extensions to watch from the files already included in the project
const checkedExtensions = Array.from(new Set(checker.linter.languageHost.getScriptFileNames().map((fileName) => path.extname(fileName))));
createWatcher(workspaceRoot, checkedExtensions)
.on('add', (fileName) => {
checker.linter.fileCreated(fileName);
update();
})
.on('unlink', (fileName) => {
checker.linter.fileDeleted(fileName);
update();
})
.on('change', (fileName) => {
checker.linter.fileUpdated(fileName);
update();
});
}
async function update() {
if (!flags.preserveWatchOutput)
process.stdout.write('\x1Bc');
await lint();
}
async function lint() {
const currentReq = ++req;
await new Promise((resolve) => setTimeout(resolve, 100));
const isCanceled = () => currentReq !== req;
if (isCanceled())
return;
const minimumSeverity = flags.minimumSeverity || 'hint';
const result = await checker.lint({
logErrors: {
level: minimumSeverity,
},
cancel: isCanceled,
});
console.info([
bold(`Result (${result.fileChecked} file${result.fileChecked === 1 ? '' : 's'}): `),
['error', 'warning', 'hint'].includes(minimumSeverity)
? bold(red(`${result.errors} ${result.errors === 1 ? 'error' : 'errors'}`))
: undefined,
['warning', 'hint'].includes(minimumSeverity)
? bold(yellow(`${result.warnings} ${result.warnings === 1 ? 'warning' : 'warnings'}`))
: undefined,
['hint'].includes(minimumSeverity)
? dim(`${result.hints} ${result.hints === 1 ? 'hint' : 'hints'}\n`)
: undefined,
]
.filter(Boolean)
.join(`\n${dim('-')} `));
if (flags.watch) {
console.info('Watching for changes...');
}
else {
switch (flags.minimumFailingSeverity) {
case 'error':
return result.errors > 0;
case 'warning':
return result.errors + result.warnings > 0;
case 'hint':
return result.errors + result.warnings + result.hints > 0;
default:
return result.errors > 0;
}
}
}
// Always lint on first run, even in watch mode.
const lintResult = await lint();
if (!flags.watch)
return lintResult;
}
//# sourceMappingURL=index.js.map

32
node_modules/@astrojs/check/dist/options.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
export declare const options: {
readonly root: {
readonly type: "string";
readonly default: string;
readonly description: "Manually specify a root dir to check in. By default, the current working directory is used.";
};
readonly watch: {
readonly type: "boolean";
readonly default: false;
readonly alias: "w";
};
readonly tsconfig: {
readonly type: "string";
readonly description: "Manually specify a path to a `tsconfig.json` or `jsconfig.json` to use. If not specified, the program will attempt to find a config, if it cannot it'll attempt to automatically infer the project's configuration.";
readonly default: undefined;
};
readonly minimumFailingSeverity: {
readonly choices: readonly ["error", "warning", "hint"];
readonly description: "Minimum error severity needed to exit with an error code. Choosing 'hint' will for example cause the program to exit with an error if there's any unfixed hints.";
readonly default: "error";
};
readonly minimumSeverity: {
readonly choices: readonly ["error", "warning", "hint"];
readonly description: "Minimum diagnostic severity to show. Choosing `warning` will, for example, show both errors and warnings, but not hints. ";
readonly default: "hint";
};
readonly preserveWatchOutput: {
readonly type: "boolean";
readonly description: "If set to false, output won't be cleared between checks in watch mode.";
readonly default: false;
};
};

29
node_modules/@astrojs/check/dist/options.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
export const options = {
root: {
type: 'string',
default: process.cwd(),
description: 'Manually specify a root dir to check in. By default, the current working directory is used.',
},
watch: { type: 'boolean', default: false, alias: 'w' },
tsconfig: {
type: 'string',
description: "Manually specify a path to a `tsconfig.json` or `jsconfig.json` to use. If not specified, the program will attempt to find a config, if it cannot it'll attempt to automatically infer the project's configuration.",
default: undefined,
},
minimumFailingSeverity: {
choices: ['error', 'warning', 'hint'],
description: "Minimum error severity needed to exit with an error code. Choosing 'hint' will for example cause the program to exit with an error if there's any unfixed hints.",
default: 'error',
},
minimumSeverity: {
choices: ['error', 'warning', 'hint'],
description: 'Minimum diagnostic severity to show. Choosing `warning` will, for example, show both errors and warnings, but not hints. ',
default: 'hint',
},
preserveWatchOutput: {
type: 'boolean',
description: "If set to false, output won't be cleared between checks in watch mode.",
default: false,
},
};
//# sourceMappingURL=options.js.map