verbose.d.ts
This file
Path
types/verbose.d.ts
100 lines · 2.6 KiB · TypeScript
Last changed by
Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
History of this fileTake it
Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 1–4why, one step back1import type {FdGenericOption} from './arguments/specific.js';2import type {Options, SyncOptions} from './arguments/options.js';3import type {Result, SyncResult} from './return/result.js';4Fix `VerboseOption` type not being properly exported (#1215)Norbert de Langenbefore adoption7891c39
line 5why, one step back5export type VerboseOption = FdGenericOption<Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
lines 6–9why, one step back6 | 'none'7 | 'short'8 | 'full'9 | VerboseFunctionAllow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 10–30why, one step back10>;1112type VerboseFunction = (verboseLine: string, verboseObject: MinimalVerboseObject) => string | void;1314type GenericVerboseObject = {15 /**16 Event type. This can be:17 - `'command'`: subprocess start18 - `'output'`: `stdout`/`stderr` output19 - `'ipc'`: IPC output20 - `'error'`: subprocess failure21 - `'duration'`: subprocess success or failure22 */23 type: 'command' | 'output' | 'ipc' | 'error' | 'duration';2425 /**26 Depending on `verboseObject.type`, this is:27 - `'command'`: the `result.escapedCommand`28 - `'output'`: one line from `result.stdout` or `result.stderr`29 - `'ipc'`: one IPC message from `result.ipcOutput`30 - `'error'`: the `error.shortMessage`Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
line 31why, one step back31 - `'duration'`: the `result.durationMs`, formatted as `(done in 29ms)`Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 32–54why, one step back32 */33 message: string;3435 /**36 The file and arguments that were run. This is the same as `result.escapedCommand`.37 */38 escapedCommand: string;3940 /**41 Serial number identifying the subprocess within the current process. It is incremented from `'0'`.4243 This is helpful when multiple subprocesses are running at the same time.4445 This is similar to a [PID](https://en.wikipedia.org/wiki/Process_identifier) except it has no maximum limit, which means it never repeats. Also, it is usually shorter.46 */47 commandId: string;4849 /**50 Event date/time.51 */52 timestamp: Date;5354 /**Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
line 55why, one step back55 Whether this subprocess is the destination of another subprocess' `pipe()` method. This is `true` when it was spawned using the template string or array syntax of `pipe()`, `false` otherwise.Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
lines 56–98why, one step back56 */57 piped: boolean;58};5960type MinimalVerboseObject = GenericVerboseObject & {61 // We cannot use the `CommonOptions` type because it would make this type recursive62 options: object;63 result?: never;64};6566/**67Subprocess event object, for logging purpose, using the `verbose` option and `execa()`.68*/69export type VerboseObject = GenericVerboseObject & {70 /**71 The options passed to the subprocess.72 */73 options: Options;7475 /**76 Subprocess result.7778 This is `undefined` if `verboseObject.type` is `'command'`, `'output'` or `'ipc'`.79 */80 result?: Result;81};8283/**84Subprocess event object, for logging purpose, using the `verbose` option and `execaSync()`.85*/86export type SyncVerboseObject = GenericVerboseObject & {87 /**88 The options passed to the subprocess.89 */90 options: SyncOptions;9192 /**93 Subprocess result.9495 This is `undefined` if `verboseObject.type` is `'command'`, `'output'` or `'ipc'`.96 */97 result?: SyncResult;98};Ensure all `d.ts` files are considered as ESM (#1216)Sindre Sorhusbefore adoption964f650
lines 99–100why, one step back99100export {};