// Generated by dts-bundle-generator v5.9.0 /// import _chalk from 'chalk'; import { SpawnOptionsWithoutStdio } from 'child_process'; import EventEmitter from 'events'; /** * Change the current working directory of the Node.js process. * * Second argument is a file (or directory), relative to which chdir will be * performed. This is usually `import.meta.url`. */ export declare const chdir: (directory: string, relativeTo?: string | undefined) => void; export declare const logger: { log: (...args: unknown[]) => void; error: (...args: unknown[]) => void; action: (...args: unknown[]) => void; warn: (...args: unknown[]) => void; info: (...args: unknown[]) => void; debug: (...args: unknown[]) => void; }; export declare type ParameterType = (string | string[] | number | number[] | boolean | boolean[]); export declare type StringType = ("string" | "string[]" | "number" | "number[]" | "boolean" | "boolean[]"); export declare type TypeByString = (T extends "string" ? string : T extends "string[]" ? string[] : T extends "number" ? number : T extends "number[]" ? number[] : T extends "boolean" ? boolean : T extends "boolean[]" ? boolean[] : never); export declare type ParameterConfig = { /** * Parameter name, as it would be used in CLI. */ name?: string; /** * Parameter type, one of: * - `string` * - `string[]` * - `number` * - `number[]` * - `boolean` * - `boolean[]` */ type: T; /** * Short flag for use in CLI, can only be a single character. */ alias?: string; }; export interface Parameter { type: StringType; name?: string; alias?: string; __internalType?: T; isString(): this is Parameter; isNumber(): this is Parameter; isBoolean(): this is Parameter; isArray(): this is Parameter; toKebabCase(): string | undefined; toConstCase(): string | undefined; toCamelCase(): string | undefined; } export declare type ParameterCtor = { new (config: ParameterConfig): Parameter>; }; export declare const Parameter: ParameterCtor; export declare type ParameterCreator = (config: ParameterConfig) => Parameter>; export declare const createParameter: ParameterCreator; export declare type ExecutionContext = { /** Get parameter value. */ get: (parameter: Parameter) => (T extends Array ? T : T | null); args: string[]; }; export declare type BooleanLike = boolean | null | undefined; export declare type WithExecutionContext = (context: ExecutionContext) => R | Promise; export declare type WithOptionalExecutionContext = R | WithExecutionContext; export declare type DependsOn = WithOptionalExecutionContext<(Target | BooleanLike)[]>; export declare type ExecutesFn = WithExecutionContext; export declare type OnlyWhenFn = WithExecutionContext; export declare type FileIo = WithOptionalExecutionContext<(string | BooleanLike)[]>; export declare type TargetConfig = { /** * Target name. This parameter is required. */ name?: string; /** * Dependencies for this target. They will be ran before executing this * target, and may run in parallel. */ dependsOn?: DependsOn; /** * Function that is delegated to the execution engine for building this * target. It is normally an async function, which accepts a single * argument - execution context (contains `get` for interacting with * parameters). * * @example * executes: async ({ get }) => { * console.log(get(Parameter)); * }, */ executes?: ExecutesFn; /** * Files that are consumed by this target. */ inputs?: FileIo; /** * Files that are produced by this target. Additionally, they are also * touched every time target finishes executing in order to stop * this target from re-running. */ outputs?: FileIo; /** * Parameters that are local to this task. Can be retrieved via `get` * in the executor function. */ parameters?: Parameter[]; /** * Target will run only when this function returns true. It accepts a * single argument - execution context. */ onlyWhen?: OnlyWhenFn; }; export declare class Target { name?: string; dependsOn: DependsOn; executes?: ExecutesFn; inputs: FileIo; outputs: FileIo; parameters: Parameter[]; onlyWhen?: OnlyWhenFn; constructor(target: TargetConfig); } export declare type TargetCreator = (target: TargetConfig) => Target; export declare const createTarget: TargetCreator; export declare type RunnerConfig = { targets?: Target[]; default?: Target; parameters?: Parameter[]; singleTarget?: boolean; }; export declare const runner: { config: RunnerConfig; targets: Target[]; parameters: Parameter[]; workers: Worker[]; configure(config: RunnerConfig): void; start(): Promise; }; declare class Worker { readonly target: Target; readonly context: ExecutionContext; readonly dependsOn: Target[]; dependencies: Set; generator?: AsyncGenerator; emitter: EventEmitter; hasFailed: boolean; constructor(target: Target, context: ExecutionContext, dependsOn: Target[]); resolveDependency(target: Target): void; rejectDependency(target: Target): void; start(): void; onFinish(fn: () => void): void; onFail(fn: () => void): void; private debugLog; private process; } export declare class ExitCode extends Error { code: number | null; signal: string | null; constructor(code: number | null, signal?: string | null); } export declare type ExecOptions = SpawnOptionsWithoutStdio & { /** * If `true`, this exec call will not pipe its output to stdio. * @default false */ silent?: boolean; /** * Throw an exception on non-zero exit code. * @default true */ throw?: boolean; }; export declare type ExecReturn = { /** Exit code of the program. */ code: number | null; /** Signal received by the program which caused it to exit. */ signal: NodeJS.Signals | null; /** Output collected from `stdout` */ stdout: string; /** Output collected from `stderr` */ stderr: string; /** A combined output collected from `stdout` and `stderr`. */ combined: string; }; export declare const exec: (executable: string, args?: string[], options?: ExecOptions) => Promise; /** * Unix style pathname pattern expansion. * * Perform a search matching a specified pattern according to the rules of * the `glob` npm package. Path can be either absolute or relative, and can * contain shell-style wildcards. Broken symlinks are included in the results * (as in the shell). Whether or not the results are sorted depends on the * file system. * * @returns A possibly empty list of file paths. */ export declare const glob: (globPath: string) => string[]; export declare type RmOptions = { /** * If true, perform a recursive directory removal. */ recursive?: boolean; /** * If true, exceptions will be ignored if file or directory does not exist. */ force?: boolean; }; /** * Removes files and directories (synchronously). Supports globs. */ export declare const rm: (path: string, options?: RmOptions) => void; export declare const chalk: _chalk.Chalk & _chalk.ChalkFunction & { supportsColor: false | _chalk.ColorSupport; Level: _chalk.Level; Color: ("black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright") | ("bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright"); ForegroundColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright"; BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright"; Modifiers: "bold" | "reset" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible"; stderr: _chalk.Chalk & { supportsColor: false | _chalk.ColorSupport; }; }; export declare type SetupConfig = { file: string; /** * If true, CLI will only accept a single target to run and will receive all * passed arguments as is (not only flags). */ singleTarget?: boolean; }; /** * Configures Juke Build and starts executing targets. * * @param config Juke Build configuration. * @returns Exit code of the whole runner process. */ export declare const setup: (config: SetupConfig) => Promise; export declare const sleep: (time: number) => Promise; export {};