๐Ÿ“ฆ google / zx

๐Ÿ“„ log.d.ts ยท 60 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60import { type RequestInfo, type RequestInit } from './vendor-core.js';
import { type Buffer } from 'node:buffer';
export type LogEntry = {
    verbose?: boolean;
} & ({
    kind: 'cmd';
    cmd: string;
    cwd: string;
    id: string;
} | {
    kind: 'stdout';
    data: Buffer;
    id: string;
} | {
    kind: 'stderr';
    data: Buffer;
    id: string;
} | {
    kind: 'end';
    exitCode: number | null;
    signal: NodeJS.Signals | null;
    duration: number;
    error: null | Error;
    id: string;
} | {
    kind: 'cd';
    dir: string;
} | {
    kind: 'fetch';
    url: RequestInfo;
    init?: RequestInit;
} | {
    kind: 'retry';
    attempt: number;
    total: number;
    delay: number;
    exception: unknown;
    error?: string;
} | {
    kind: 'custom';
    data: any;
} | {
    kind: 'kill';
    pid: number | `${number}`;
    signal: NodeJS.Signals | null;
});
type LogFormatters = {
    [key in LogEntry['kind']]: (entry: Extract<LogEntry, {
        kind: key;
    }>) => string | Buffer;
};
type Log = {
    (entry: LogEntry): void;
    formatters?: Partial<LogFormatters>;
    output?: NodeJS.WriteStream;
};
export declare const log: Log;
export declare function formatCmd(cmd: string): string;
export {};