main
1// Generated by dts-bundle-generator v9.5.1
2
3/// <reference types="node" />
4
5import { Buffer } from 'node:buffer';
6import * as cp from 'node:child_process';
7import EventEmitter from 'node:events';
8import { Readable, Transform, Writable } from 'node:stream';
9
10type ColorSupportLevel = 0 | 1 | 2 | 3;
11export interface ChalkInstance {
12 (...text: unknown[]): string;
13 /**
14 The color support for Chalk.
15
16 By default, color support is automatically detected based on the environment.
17
18 Levels:
19 - `0` - All colors disabled.
20 - `1` - Basic 16 colors support.
21 - `2` - ANSI 256 colors support.
22 - `3` - Truecolor 16 million colors support.
23 */
24 level: ColorSupportLevel;
25 /**
26 Use RGB values to set text color.
27
28 @example
29 ```
30 import chalk from 'chalk';
31
32 chalk.rgb(222, 173, 237);
33 ```
34 */
35 rgb: (red: number, green: number, blue: number) => this;
36 /**
37 Use HEX value to set text color.
38
39 @param color - Hexadecimal value representing the desired color.
40
41 @example
42 ```
43 import chalk from 'chalk';
44
45 chalk.hex('#DEADED');
46 ```
47 */
48 hex: (color: string) => this;
49 /**
50 Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
51
52 @example
53 ```
54 import chalk from 'chalk';
55
56 chalk.ansi256(201);
57 ```
58 */
59 ansi256: (index: number) => this;
60 /**
61 Use RGB values to set background color.
62
63 @example
64 ```
65 import chalk from 'chalk';
66
67 chalk.bgRgb(222, 173, 237);
68 ```
69 */
70 bgRgb: (red: number, green: number, blue: number) => this;
71 /**
72 Use HEX value to set background color.
73
74 @param color - Hexadecimal value representing the desired color.
75
76 @example
77 ```
78 import chalk from 'chalk';
79
80 chalk.bgHex('#DEADED');
81 ```
82 */
83 bgHex: (color: string) => this;
84 /**
85 Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
86
87 @example
88 ```
89 import chalk from 'chalk';
90
91 chalk.bgAnsi256(201);
92 ```
93 */
94 bgAnsi256: (index: number) => this;
95 /**
96 Modifier: Reset the current style.
97 */
98 readonly reset: this;
99 /**
100 Modifier: Make the text bold.
101 */
102 readonly bold: this;
103 /**
104 Modifier: Make the text have lower opacity.
105 */
106 readonly dim: this;
107 /**
108 Modifier: Make the text italic. *(Not widely supported)*
109 */
110 readonly italic: this;
111 /**
112 Modifier: Put a horizontal line below the text. *(Not widely supported)*
113 */
114 readonly underline: this;
115 /**
116 Modifier: Put a horizontal line above the text. *(Not widely supported)*
117 */
118 readonly overline: this;
119 /**
120 Modifier: Invert background and foreground colors.
121 */
122 readonly inverse: this;
123 /**
124 Modifier: Print the text but make it invisible.
125 */
126 readonly hidden: this;
127 /**
128 Modifier: Puts a horizontal line through the center of the text. *(Not widely supported)*
129 */
130 readonly strikethrough: this;
131 /**
132 Modifier: Print the text only when Chalk has a color level above zero.
133
134 Can be useful for things that are purely cosmetic.
135 */
136 readonly visible: this;
137 readonly black: this;
138 readonly red: this;
139 readonly green: this;
140 readonly yellow: this;
141 readonly blue: this;
142 readonly magenta: this;
143 readonly cyan: this;
144 readonly white: this;
145 /*
146 Alias for `blackBright`.
147 */
148 readonly gray: this;
149 /*
150 Alias for `blackBright`.
151 */
152 readonly grey: this;
153 readonly blackBright: this;
154 readonly redBright: this;
155 readonly greenBright: this;
156 readonly yellowBright: this;
157 readonly blueBright: this;
158 readonly magentaBright: this;
159 readonly cyanBright: this;
160 readonly whiteBright: this;
161 readonly bgBlack: this;
162 readonly bgRed: this;
163 readonly bgGreen: this;
164 readonly bgYellow: this;
165 readonly bgBlue: this;
166 readonly bgMagenta: this;
167 readonly bgCyan: this;
168 readonly bgWhite: this;
169 /*
170 Alias for `bgBlackBright`.
171 */
172 readonly bgGray: this;
173 /*
174 Alias for `bgBlackBright`.
175 */
176 readonly bgGrey: this;
177 readonly bgBlackBright: this;
178 readonly bgRedBright: this;
179 readonly bgGreenBright: this;
180 readonly bgYellowBright: this;
181 readonly bgBlueBright: this;
182 readonly bgMagentaBright: this;
183 readonly bgCyanBright: this;
184 readonly bgWhiteBright: this;
185}
186declare const chalk: ChalkInstance;
187type AppendNullIfNothrow<TOptions, TRet> = TOptions extends {
188 nothrow: infer TVal;
189} ? TVal extends false ? TRet : TRet | null : TRet;
190type TransformToArrayIfAll<TOptions, TRet> = TOptions extends {
191 all: infer TVal;
192} ? TVal extends true ? readonly TRet[] : TVal extends false ? TRet : readonly TRet[] | TRet : TRet;
193type ReturnType$1<TOptions> = AppendNullIfNothrow<TOptions, TransformToArrayIfAll<TOptions, string>>;
194type Exact<T, U extends T> = {
195 [Key in keyof U]: Key extends keyof T ? U[Key] : never;
196};
197declare function which<TOptions extends which.Options>(cmd: string, options?: Exact<which.Options, TOptions>): Promise<ReturnType$1<Exact<which.Options, TOptions>>>;
198declare namespace which {
199 /** Finds all instances of a specified executable in the PATH environment variable */
200 function sync<TOptions extends Options>(cmd: string, options?: Exact<Options, TOptions>): ReturnType$1<Exact<Options, TOptions>>;
201 /** Options for which() API */
202 interface Options {
203 /** If true, return all matches, instead of just the first one. Note that this means the function returns an array of strings instead of a single string. */
204 all?: boolean | undefined;
205 /** Use instead of the PATH environment variable. */
206 path?: string | undefined;
207 /** Use instead of the PATHEXT environment variable. */
208 pathExt?: string | undefined;
209 /** Use instead of the platform's native path separator. */
210 delimiter?: string | undefined;
211 /** If true, returns null when not found */
212 nothrow?: boolean | undefined;
213 }
214}
215type TPsLookupCallback = (err: any, processList?: TPsLookupEntry[]) => void;
216type TPsLookupEntry = {
217 pid: string;
218 ppid?: string;
219 command: string;
220 arguments: string[];
221};
222type TPsLookupQuery = {
223 pid?: number | string | (string | number)[];
224 command?: string;
225 arguments?: string;
226 ppid?: number | string;
227};
228type TPsKillOptions = {
229 timeout?: number;
230 signal?: string | number | NodeJS.Signals;
231};
232type TPsNext = (err?: any, data?: any) => void;
233type TPsTreeOpts = {
234 pid: string | number;
235 recursive?: boolean;
236};
237declare const _default: {
238 kill: (pid: string | number, opts?: TPsNext | TPsKillOptions | TPsKillOptions["signal"], next?: TPsNext) => Promise<void>;
239 lookup: {
240 (query?: TPsLookupQuery, cb?: TPsLookupCallback): Promise<TPsLookupEntry[]>;
241 sync: (query?: TPsLookupQuery, cb?: TPsLookupCallback) => TPsLookupEntry[];
242 };
243 lookupSync: (query?: TPsLookupQuery, cb?: TPsLookupCallback) => TPsLookupEntry[];
244 tree: {
245 (opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback): Promise<TPsLookupEntry[]>;
246 sync: (opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback) => TPsLookupEntry[];
247 };
248 treeSync: (opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback) => TPsLookupEntry[];
249};
250export declare const isStringLiteral: (pieces: any, ...rest: any[]) => pieces is TemplateStringsArray;
251type TQuote = (input: string) => string;
252export declare const buildCmd: (quote: TQuote, pieces: TemplateStringsArray, args: any[], subs?: TSubstitute) => string | Promise<string>;
253type TSubstitute = (arg: any) => string;
254type TSpawnError = any;
255type TPushable<T = any> = {
256 push(...args: T[]): number;
257};
258type TJoinable = {
259 join(sep?: string): string;
260};
261type TReducible<T, R> = {
262 reduce<U>(fn: (acc: U, cur: T, i: number, arr: T[]) => U, init: U): R;
263};
264type TArrayLike<T> = Iterable<T> & TPushable<T> & TJoinable & TReducible<T, any> & {
265 length: number;
266 [i: number]: T | undefined;
267};
268type TSpawnStoreChunks = TArrayLike<string | Buffer>;
269export type TSpawnStore = {
270 stdout: TSpawnStoreChunks;
271 stderr: TSpawnStoreChunks;
272 stdall: TSpawnStoreChunks;
273};
274type TSpawnResult = {
275 stderr: string;
276 stdout: string;
277 stdall: string;
278 stdio: [
279 Readable | Writable,
280 Writable,
281 Writable
282 ];
283 status: number | null;
284 signal: NodeJS.Signals | null;
285 duration: number;
286 ctx: TSpawnCtxNormalized;
287 error?: TSpawnError;
288 child?: TChild;
289};
290type TSpawnListeners = {
291 start: (data: TChild, ctx: TSpawnCtxNormalized) => void;
292 stdout: (data: Buffer, ctx: TSpawnCtxNormalized) => void;
293 stderr: (data: Buffer, ctx: TSpawnCtxNormalized) => void;
294 stdall: (data: Buffer, ctx: TSpawnCtxNormalized) => void;
295 abort: (error: Event, ctx: TSpawnCtxNormalized) => void;
296 err: (error: Error, ctx: TSpawnCtxNormalized) => void;
297 end: (result: TSpawnResult, ctx: TSpawnCtxNormalized) => void;
298};
299type TSpawnCtx = Partial<Omit<TSpawnCtxNormalized, "child">>;
300type TChild = ReturnType<typeof cp.spawn>;
301type TInput = string | Buffer | Readable;
302interface TSpawnCtxNormalized {
303 id: string;
304 cwd: string;
305 cmd: string;
306 sync: boolean;
307 args: ReadonlyArray<string>;
308 input: TInput | null;
309 stdio: cp.StdioOptions;
310 detached: boolean;
311 env: Record<string, string | undefined>;
312 ee: EventEmitter;
313 on: Partial<TSpawnListeners>;
314 ac: AbortController;
315 signal: AbortController["signal"];
316 shell: string | boolean | undefined;
317 spawn: typeof cp.spawn;
318 spawnSync: typeof cp.spawnSync;
319 spawnOpts: Record<string, any>;
320 store: TSpawnStore;
321 callback: (err: TSpawnError, result: TSpawnResult) => void;
322 stdin: Readable;
323 stdout: Writable;
324 stderr: Writable;
325 child?: TChild;
326 fulfilled?: TSpawnResult;
327 error?: any;
328 run: (cb: () => void, ctx: TSpawnCtxNormalized) => void;
329 stack: string;
330}
331/**
332 * Transformer that emits data but does not consume it.
333 */
334export declare class VoidStream extends Transform {
335 _transform(chunk: any, _: string, cb: (err?: Error) => void): void;
336}
337/**
338 * Executes a child process
339 * @param ctx TSpawnCtx
340 * @returns TSpawnCtxNormalized
341 */
342export declare const exec: (ctx: TSpawnCtx) => TSpawnCtxNormalized;
343export type RequestInfo = Parameters<typeof globalThis.fetch>[0];
344type RequestInit$1 = Parameters<typeof globalThis.fetch>[1] & {
345 signal?: AbortSignal;
346};
347declare const chalk$1: typeof chalk;
348declare const which$1: typeof which;
349export declare const ps: typeof _default;
350
351export {
352 RequestInit$1 as RequestInit,
353 chalk$1 as chalk,
354 which$1 as which,
355};
356
357export {};