Initial commit
This commit is contained in:
4
node_modules/astro/dist/cli/infra/build-time-astro-version-provider.d.ts
generated
vendored
Normal file
4
node_modules/astro/dist/cli/infra/build-time-astro-version-provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { AstroVersionProvider } from '../definitions.js';
|
||||
export declare class BuildTimeAstroVersionProvider implements AstroVersionProvider {
|
||||
readonly version: string;
|
||||
}
|
||||
7
node_modules/astro/dist/cli/infra/build-time-astro-version-provider.js
generated
vendored
Normal file
7
node_modules/astro/dist/cli/infra/build-time-astro-version-provider.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
class BuildTimeAstroVersionProvider {
|
||||
// Injected during the build through esbuild define
|
||||
version = "5.17.1";
|
||||
}
|
||||
export {
|
||||
BuildTimeAstroVersionProvider
|
||||
};
|
||||
9
node_modules/astro/dist/cli/infra/cli-command-runner.d.ts
generated
vendored
Normal file
9
node_modules/astro/dist/cli/infra/cli-command-runner.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { CommandRunner, HelpDisplay } from '../definitions.js';
|
||||
import type { AnyCommand } from '../domain/command.js';
|
||||
export declare class CliCommandRunner implements CommandRunner {
|
||||
#private;
|
||||
constructor({ helpDisplay, }: {
|
||||
helpDisplay: HelpDisplay;
|
||||
});
|
||||
run<T extends AnyCommand>(command: T, ...args: Parameters<T['run']>): ReturnType<T['run']> | undefined;
|
||||
}
|
||||
18
node_modules/astro/dist/cli/infra/cli-command-runner.js
generated
vendored
Normal file
18
node_modules/astro/dist/cli/infra/cli-command-runner.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
class CliCommandRunner {
|
||||
#helpDisplay;
|
||||
constructor({
|
||||
helpDisplay
|
||||
}) {
|
||||
this.#helpDisplay = helpDisplay;
|
||||
}
|
||||
run(command, ...args) {
|
||||
if (this.#helpDisplay.shouldFire()) {
|
||||
this.#helpDisplay.show(command.help);
|
||||
return;
|
||||
}
|
||||
return command.run(...args);
|
||||
}
|
||||
}
|
||||
export {
|
||||
CliCommandRunner
|
||||
};
|
||||
15
node_modules/astro/dist/cli/infra/logger-help-display.d.ts
generated
vendored
Normal file
15
node_modules/astro/dist/cli/infra/logger-help-display.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { Logger } from '../../core/logger/core.js';
|
||||
import type { AstroVersionProvider, HelpDisplay, TextStyler } from '../definitions.js';
|
||||
import type { HelpPayload } from '../domain/help-payload.js';
|
||||
import type { Flags } from '../flags.js';
|
||||
export declare class LoggerHelpDisplay implements HelpDisplay {
|
||||
#private;
|
||||
constructor({ logger, textStyler, astroVersionProvider, flags, }: {
|
||||
logger: Logger;
|
||||
textStyler: TextStyler;
|
||||
astroVersionProvider: AstroVersionProvider;
|
||||
flags: Flags;
|
||||
});
|
||||
shouldFire(): boolean;
|
||||
show({ commandName, description, headline, tables, usage }: HelpPayload): void;
|
||||
}
|
||||
71
node_modules/astro/dist/cli/infra/logger-help-display.js
generated
vendored
Normal file
71
node_modules/astro/dist/cli/infra/logger-help-display.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import { formatVersion } from "../utils/format-version.js";
|
||||
class LoggerHelpDisplay {
|
||||
#logger;
|
||||
#textStyler;
|
||||
#astroVersionProvider;
|
||||
// TODO: find something better
|
||||
#flags;
|
||||
constructor({
|
||||
logger,
|
||||
textStyler,
|
||||
astroVersionProvider,
|
||||
flags
|
||||
}) {
|
||||
this.#logger = logger;
|
||||
this.#textStyler = textStyler;
|
||||
this.#astroVersionProvider = astroVersionProvider;
|
||||
this.#flags = flags;
|
||||
}
|
||||
shouldFire() {
|
||||
return !!(this.#flags.help || this.#flags.h);
|
||||
}
|
||||
show({ commandName, description, headline, tables, usage }) {
|
||||
const linebreak = () => "";
|
||||
const title = (label) => ` ${this.#textStyler.bgWhite(this.#textStyler.black(` ${label} `))}`;
|
||||
const table = (rows, { padding }) => {
|
||||
const split = process.stdout.columns < 60;
|
||||
let raw = "";
|
||||
for (const row of rows) {
|
||||
if (split) {
|
||||
raw += ` ${row[0]}
|
||||
`;
|
||||
} else {
|
||||
raw += `${`${row[0]}`.padStart(padding)}`;
|
||||
}
|
||||
raw += " " + this.#textStyler.dim(row[1]) + "\n";
|
||||
}
|
||||
return raw.slice(0, -1);
|
||||
};
|
||||
let message = [];
|
||||
if (headline) {
|
||||
message.push(
|
||||
linebreak(),
|
||||
`${formatVersion({ name: commandName, textStyler: this.#textStyler, astroVersionProvider: this.#astroVersionProvider })} ${headline}`
|
||||
);
|
||||
}
|
||||
if (usage) {
|
||||
message.push(
|
||||
linebreak(),
|
||||
` ${this.#textStyler.green(commandName)} ${this.#textStyler.bold(usage)}`
|
||||
);
|
||||
}
|
||||
if (tables) {
|
||||
let calculateTablePadding2 = function(rows) {
|
||||
return rows.reduce((val, [first]) => Math.max(val, first.length), 0) + 2;
|
||||
};
|
||||
var calculateTablePadding = calculateTablePadding2;
|
||||
const tableEntries = Object.entries(tables);
|
||||
const padding = Math.max(...tableEntries.map(([, rows]) => calculateTablePadding2(rows)));
|
||||
for (const [tableTitle, tableRows] of tableEntries) {
|
||||
message.push(linebreak(), title(tableTitle), table(tableRows, { padding }));
|
||||
}
|
||||
}
|
||||
if (description) {
|
||||
message.push(linebreak(), `${description}`);
|
||||
}
|
||||
this.#logger.info("SKIP_FORMAT", message.join("\n") + "\n");
|
||||
}
|
||||
}
|
||||
export {
|
||||
LoggerHelpDisplay
|
||||
};
|
||||
9
node_modules/astro/dist/cli/infra/passthrough-text-styler.d.ts
generated
vendored
Normal file
9
node_modules/astro/dist/cli/infra/passthrough-text-styler.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { TextStyler } from '../definitions.js';
|
||||
export declare class PassthroughTextStyler implements TextStyler {
|
||||
bgWhite(msg: string): string;
|
||||
black(msg: string): string;
|
||||
dim(msg: string): string;
|
||||
green(msg: string): string;
|
||||
bold(msg: string): string;
|
||||
bgGreen(msg: string): string;
|
||||
}
|
||||
23
node_modules/astro/dist/cli/infra/passthrough-text-styler.js
generated
vendored
Normal file
23
node_modules/astro/dist/cli/infra/passthrough-text-styler.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
class PassthroughTextStyler {
|
||||
bgWhite(msg) {
|
||||
return msg;
|
||||
}
|
||||
black(msg) {
|
||||
return msg;
|
||||
}
|
||||
dim(msg) {
|
||||
return msg;
|
||||
}
|
||||
green(msg) {
|
||||
return msg;
|
||||
}
|
||||
bold(msg) {
|
||||
return msg;
|
||||
}
|
||||
bgGreen(msg) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
export {
|
||||
PassthroughTextStyler
|
||||
};
|
||||
2
node_modules/astro/dist/cli/infra/piccolore-text-styler.d.ts
generated
vendored
Normal file
2
node_modules/astro/dist/cli/infra/piccolore-text-styler.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { TextStyler } from '../definitions.js';
|
||||
export declare const piccoloreTextStyler: TextStyler;
|
||||
5
node_modules/astro/dist/cli/infra/piccolore-text-styler.js
generated
vendored
Normal file
5
node_modules/astro/dist/cli/infra/piccolore-text-styler.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import colors from "piccolore";
|
||||
const piccoloreTextStyler = colors;
|
||||
export {
|
||||
piccoloreTextStyler
|
||||
};
|
||||
6
node_modules/astro/dist/cli/infra/process-operating-system-provider.d.ts
generated
vendored
Normal file
6
node_modules/astro/dist/cli/infra/process-operating-system-provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { OperatingSystemProvider } from '../definitions.js';
|
||||
export declare class ProcessOperatingSystemProvider implements OperatingSystemProvider {
|
||||
#private;
|
||||
readonly name: NodeJS.Platform;
|
||||
readonly displayName: string;
|
||||
}
|
||||
12
node_modules/astro/dist/cli/infra/process-operating-system-provider.js
generated
vendored
Normal file
12
node_modules/astro/dist/cli/infra/process-operating-system-provider.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
class ProcessOperatingSystemProvider {
|
||||
#platformToOs = {
|
||||
darwin: "macOS",
|
||||
win32: "Windows",
|
||||
linux: "Linux"
|
||||
};
|
||||
name = process.platform;
|
||||
displayName = `${this.#platformToOs[this.name] ?? this.name} (${process.arch})`;
|
||||
}
|
||||
export {
|
||||
ProcessOperatingSystemProvider
|
||||
};
|
||||
6
node_modules/astro/dist/cli/infra/tinyexec-command-executor.d.ts
generated
vendored
Normal file
6
node_modules/astro/dist/cli/infra/tinyexec-command-executor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { CommandExecutor, CommandExecutorOptions } from '../definitions.js';
|
||||
export declare class TinyexecCommandExecutor implements CommandExecutor {
|
||||
execute(command: string, args?: Array<string>, options?: CommandExecutorOptions): Promise<{
|
||||
stdout: string;
|
||||
}>;
|
||||
}
|
||||
34
node_modules/astro/dist/cli/infra/tinyexec-command-executor.js
generated
vendored
Normal file
34
node_modules/astro/dist/cli/infra/tinyexec-command-executor.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { NonZeroExitError, x } from "tinyexec";
|
||||
class TinyexecCommandExecutor {
|
||||
async execute(command, args, options) {
|
||||
const proc = x(command, args, {
|
||||
throwOnError: true,
|
||||
nodeOptions: {
|
||||
cwd: options?.cwd,
|
||||
env: options?.env,
|
||||
shell: options?.shell,
|
||||
stdio: options?.stdio
|
||||
}
|
||||
});
|
||||
if (options?.input) {
|
||||
proc.process?.stdin?.end(options.input);
|
||||
}
|
||||
return await proc.then(
|
||||
(o) => o,
|
||||
(e) => {
|
||||
if (e instanceof NonZeroExitError) {
|
||||
const fullCommand = args?.length ? `${command} ${args.map((a) => a.includes(" ") ? `"${a}"` : a).join(" ")}` : command;
|
||||
const message = `The command \`${fullCommand}\` exited with code ${e.exitCode}`;
|
||||
const newError = new Error(message, e.cause ? { cause: e.cause } : void 0);
|
||||
newError.stderr = e.output?.stderr;
|
||||
newError.stdout = e.output?.stdout;
|
||||
throw newError;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
export {
|
||||
TinyexecCommandExecutor
|
||||
};
|
||||
Reference in New Issue
Block a user