UNPKG

3.08 kBTypeScriptView Raw
1/// <reference types="node" />
2import { CpuInfo } from 'os';
3import { SpawnSyncOptions } from 'child_process';
4export declare type BufferEncoding = 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'base64' | 'latin1' | 'binary' | 'hex';
5export declare type NodeCallback = (err?: Error, data?: any) => void;
6export declare type NodeAnyCallback = (...args: any[]) => void;
7export declare type LogCallback = (type: string, msg: string, meta: IMap<any>, info: {
8 timestamp: string;
9 args: any[];
10 stackTrace?: IStacktraceFrame[];
11 error?: Error;
12}) => void;
13export declare type CopyTuple = [string, string];
14export declare type StringBuilderAdd = (str: any, styles: string | string[]) => IStringBuilderMethods;
15export declare type StringBuilderRender = (char?: string) => string;
16export declare type StringBuilderJoin = (char?: string) => IStringBuilderMethods;
17export declare type StringBuilderFormat = (...args: any[]) => IStringBuilderMethods;
18export declare type Colors = 'white' | 'black' | 'red' | 'green' | 'blue' | 'yellow' | 'magenta' | 'gray';
19export interface IMap<T> {
20 [key: string]: T;
21}
22export interface IMapAny {
23 [key: string]: any;
24}
25export interface ICopy {
26 src: string;
27 dest: string;
28}
29export interface IStringBuilderMethods {
30 add: StringBuilderAdd;
31 join: StringBuilderJoin;
32 format: StringBuilderFormat;
33 render: StringBuilderRender;
34}
35export interface ITSNodeOptions {
36 fast?: boolean | null;
37 cache?: boolean | null;
38 cacheDirectory?: string;
39 compiler?: string;
40 project?: boolean | string;
41 ignore?: boolean | string | string[];
42 ignoreWarnings?: number | string | Array<number | string>;
43 disableWarnings?: boolean | null;
44 getFile?: (path: string) => string;
45 fileExists?: (path: string) => boolean;
46 compilerOptions?: any;
47}
48export declare type NpmCommand = (...args: any[]) => any;
49export interface IUIOptions {
50 text: string;
51 width?: number;
52 padding?: number | number[];
53 align?: string;
54 border?: boolean;
55}
56export interface ICpu extends CpuInfo {
57 cores?: number;
58}
59export interface IExecMethods {
60 command(cmd: string, args: string | string[], options?: boolean | SpawnSyncOptions): any;
61 node(args: string | string[], options?: boolean | SpawnSyncOptions): any;
62 npm(args: string | string[], options?: boolean | SpawnSyncOptions): any;
63}
64export interface ILoggerOptions {
65 stream?: NodeJS.WritableStream;
66 level?: string | number;
67 depth?: number;
68 colors?: boolean;
69 errorExit?: boolean;
70 errorCapture?: boolean;
71 stackTrace?: boolean;
72 prettyStack?: boolean;
73 miniStack?: boolean;
74 timestamp?: boolean | 'date' | 'time';
75 colorMap?: {
76 error?: Colors;
77 warn?: Colors;
78 info?: Colors;
79 debug?: Colors;
80 };
81 onLogged?: LogCallback;
82}
83export interface IStacktraceFrame {
84 method: string;
85 filename: string;
86 relative: string;
87 line: number;
88 column: number;
89}
90export interface IStacktraceResult {
91 frames: IStacktraceFrame[];
92 stack: string[];
93 miniStack: string;
94}