@depot/cli 0.0.1-cli.2.36.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/main.d.ts ADDED
@@ -0,0 +1,415 @@
1
+ // Generated by dts-bundle-generator v8.0.1
2
+
3
+ import { ChildProcess } from 'node:child_process';
4
+ import { Readable as ReadableStream, Stream, Writable as WritableStream } from 'node:stream';
5
+
6
+ export type StdioOption = "pipe" | "overlapped" | "ipc" | "ignore" | "inherit" | Stream | number | undefined;
7
+ export type EncodingOption = "utf8"
8
+ // eslint-disable-next-line unicorn/text-encoding-identifier-case
9
+ | "utf-8" | "utf16le" | "utf-16le" | "ucs2" | "ucs-2" | "latin1" | "binary" | "ascii" | "hex" | "base64" | "base64url" | "buffer" | null | undefined;
10
+ export type DefaultEncodingOption = "utf8";
11
+ export type BufferEncodingOption = "buffer" | null;
12
+ export type CommonOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {
13
+ /**
14
+ Kill the spawned process when the parent process exits unless either:
15
+ - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
16
+ - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
17
+
18
+ @default true
19
+ */
20
+ readonly cleanup?: boolean;
21
+ /**
22
+ Prefer locally installed binaries when looking for a binary to execute.
23
+
24
+ If you `$ npm install foo`, you can then `execa('foo')`.
25
+
26
+ @default `true` with `$`, `false` otherwise
27
+ */
28
+ readonly preferLocal?: boolean;
29
+ /**
30
+ Preferred path to find locally installed binaries in (use with `preferLocal`).
31
+
32
+ @default process.cwd()
33
+ */
34
+ readonly localDir?: string | URL;
35
+ /**
36
+ Path to the Node.js executable to use in child processes.
37
+
38
+ This can be either an absolute path or a path relative to the `cwd` option.
39
+
40
+ Requires `preferLocal` to be `true`.
41
+
42
+ For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.
43
+
44
+ @default process.execPath
45
+ */
46
+ readonly execPath?: string;
47
+ /**
48
+ Buffer the output from the spawned process. When set to `false`, you must read the output of `stdout` and `stderr` (or `all` if the `all` option is `true`). Otherwise the returned promise will not be resolved/rejected.
49
+
50
+ If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
51
+
52
+ @default true
53
+ */
54
+ readonly buffer?: boolean;
55
+ /**
56
+ Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
57
+
58
+ @default `inherit` with `$`, `pipe` otherwise
59
+ */
60
+ readonly stdin?: StdioOption;
61
+ /**
62
+ Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
63
+
64
+ @default 'pipe'
65
+ */
66
+ readonly stdout?: StdioOption;
67
+ /**
68
+ Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
69
+
70
+ @default 'pipe'
71
+ */
72
+ readonly stderr?: StdioOption;
73
+ /**
74
+ Setting this to `false` resolves the promise with the error instead of rejecting it.
75
+
76
+ @default true
77
+ */
78
+ readonly reject?: boolean;
79
+ /**
80
+ Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.
81
+
82
+ @default false
83
+ */
84
+ readonly all?: boolean;
85
+ /**
86
+ Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
87
+
88
+ @default true
89
+ */
90
+ readonly stripFinalNewline?: boolean;
91
+ /**
92
+ Set to `false` if you don't want to extend the environment variables when providing the `env` property.
93
+
94
+ @default true
95
+ */
96
+ readonly extendEnv?: boolean;
97
+ /**
98
+ Current working directory of the child process.
99
+
100
+ @default process.cwd()
101
+ */
102
+ readonly cwd?: string | URL;
103
+ /**
104
+ Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
105
+
106
+ @default process.env
107
+ */
108
+ readonly env?: NodeJS.ProcessEnv;
109
+ /**
110
+ Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
111
+ */
112
+ readonly argv0?: string;
113
+ /**
114
+ Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
115
+
116
+ @default 'pipe'
117
+ */
118
+ readonly stdio?: "pipe" | "overlapped" | "ignore" | "inherit" | readonly StdioOption[];
119
+ /**
120
+ Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:
121
+ - `json`: Uses `JSON.stringify()` and `JSON.parse()`.
122
+ - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
123
+
124
+ [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
125
+
126
+ @default 'json'
127
+ */
128
+ readonly serialization?: "json" | "advanced";
129
+ /**
130
+ Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).
131
+
132
+ @default false
133
+ */
134
+ readonly detached?: boolean;
135
+ /**
136
+ Sets the user identity of the process.
137
+ */
138
+ readonly uid?: number;
139
+ /**
140
+ Sets the group identity of the process.
141
+ */
142
+ readonly gid?: number;
143
+ /**
144
+ If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.
145
+
146
+ We recommend against using this option since it is:
147
+ - not cross-platform, encouraging shell-specific syntax.
148
+ - slower, because of the additional shell interpretation.
149
+ - unsafe, potentially allowing command injection.
150
+
151
+ @default false
152
+ */
153
+ readonly shell?: boolean | string;
154
+ /**
155
+ Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `'buffer'` or `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.
156
+
157
+ @default 'utf8'
158
+ */
159
+ readonly encoding?: EncodingType;
160
+ /**
161
+ If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than `timeout` milliseconds.
162
+
163
+ @default 0
164
+ */
165
+ readonly timeout?: number;
166
+ /**
167
+ Largest amount of data in bytes allowed on `stdout` or `stderr`. Default: 100 MB.
168
+
169
+ @default 100_000_000
170
+ */
171
+ readonly maxBuffer?: number;
172
+ /**
173
+ Signal value to be used when the spawned process will be killed.
174
+
175
+ @default 'SIGTERM'
176
+ */
177
+ readonly killSignal?: string | number;
178
+ /**
179
+ You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
180
+
181
+ When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `true`.
182
+
183
+ @example
184
+ ```
185
+ import {execa} from 'execa';
186
+
187
+ const abortController = new AbortController();
188
+ const subprocess = execa('node', [], {signal: abortController.signal});
189
+
190
+ setTimeout(() => {
191
+ abortController.abort();
192
+ }, 1000);
193
+
194
+ try {
195
+ await subprocess;
196
+ } catch (error) {
197
+ console.log(subprocess.killed); // true
198
+ console.log(error.isCanceled); // true
199
+ }
200
+ ```
201
+ */
202
+ readonly signal?: AbortSignal;
203
+ /**
204
+ If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.
205
+
206
+ @default false
207
+ */
208
+ readonly windowsVerbatimArguments?: boolean;
209
+ /**
210
+ On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
211
+
212
+ @default true
213
+ */
214
+ readonly windowsHide?: boolean;
215
+ /**
216
+ Print each command on `stderr` before executing it.
217
+
218
+ This can also be enabled by setting the `NODE_DEBUG=execa` environment variable in the current process.
219
+
220
+ @default false
221
+ */
222
+ readonly verbose?: boolean;
223
+ };
224
+ export type Options<EncodingType extends EncodingOption = DefaultEncodingOption> = {
225
+ /**
226
+ Write some input to the `stdin` of your binary.
227
+
228
+ If the input is a file, use the `inputFile` option instead.
229
+ */
230
+ readonly input?: string | Buffer | ReadableStream;
231
+ /**
232
+ Use a file as input to the the `stdin` of your binary.
233
+
234
+ If the input is not a file, use the `input` option instead.
235
+ */
236
+ readonly inputFile?: string;
237
+ } & CommonOptions<EncodingType>;
238
+ export type StdoutStderrAll = string | Buffer | undefined;
239
+ export type ExecaReturnBase<StdoutStderrType extends StdoutStderrAll> = {
240
+ /**
241
+ The file and arguments that were run, for logging purposes.
242
+
243
+ This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
244
+ */
245
+ command: string;
246
+ /**
247
+ Same as `command` but escaped.
248
+
249
+ This is meant to be copy and pasted into a shell, for debugging purposes.
250
+ Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execaCommand()`.
251
+ */
252
+ escapedCommand: string;
253
+ /**
254
+ The numeric exit code of the process that was run.
255
+ */
256
+ exitCode: number;
257
+ /**
258
+ The output of the process on stdout.
259
+ */
260
+ stdout: StdoutStderrType;
261
+ /**
262
+ The output of the process on stderr.
263
+ */
264
+ stderr: StdoutStderrType;
265
+ /**
266
+ Whether the process failed to run.
267
+ */
268
+ failed: boolean;
269
+ /**
270
+ Whether the process timed out.
271
+ */
272
+ timedOut: boolean;
273
+ /**
274
+ Whether the process was killed.
275
+ */
276
+ killed: boolean;
277
+ /**
278
+ The name of the signal that was used to terminate the process. For example, `SIGFPE`.
279
+
280
+ If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
281
+ */
282
+ signal?: string;
283
+ /**
284
+ A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.
285
+
286
+ If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.
287
+ */
288
+ signalDescription?: string;
289
+ /**
290
+ The `cwd` of the command if provided in the command options. Otherwise it is `process.cwd()`.
291
+ */
292
+ cwd: string;
293
+ };
294
+ export type ExecaSyncReturnValue<StdoutStderrType extends StdoutStderrAll = string> = {} & ExecaReturnBase<StdoutStderrType>;
295
+ /**
296
+ Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.
297
+
298
+ The child process fails when:
299
+ - its exit code is not `0`
300
+ - it was killed with a signal
301
+ - timing out
302
+ - being canceled
303
+ - there's not enough memory or there are already too many child processes
304
+ */
305
+ export type ExecaReturnValue<StdoutStderrType extends StdoutStderrAll = string> = {
306
+ /**
307
+ The output of the process with `stdout` and `stderr` interleaved.
308
+
309
+ This is `undefined` if either:
310
+ - the `all` option is `false` (default value)
311
+ - `execaSync()` was used
312
+ */
313
+ all?: StdoutStderrType;
314
+ /**
315
+ Whether the process was canceled.
316
+
317
+ You can cancel the spawned process using the [`signal`](https://github.com/sindresorhus/execa#signal-1) option.
318
+ */
319
+ isCanceled: boolean;
320
+ } & ExecaSyncReturnValue<StdoutStderrType>;
321
+ export type ExecaSyncError<StdoutStderrType extends StdoutStderrAll = string> = {
322
+ /**
323
+ Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored.
324
+
325
+ The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
326
+ */
327
+ message: string;
328
+ /**
329
+ This is the same as the `message` property except it does not include the child process stdout/stderr.
330
+ */
331
+ shortMessage: string;
332
+ /**
333
+ Original error message. This is the same as the `message` property except it includes neither the child process stdout/stderr nor some additional information added by Execa.
334
+
335
+ This is `undefined` unless the child process exited due to an `error` event or a timeout.
336
+ */
337
+ originalMessage?: string;
338
+ } & Error & ExecaReturnBase<StdoutStderrType>;
339
+ export type ExecaError<StdoutStderrType extends StdoutStderrAll = string> = {
340
+ /**
341
+ The output of the process with `stdout` and `stderr` interleaved.
342
+
343
+ This is `undefined` if either:
344
+ - the `all` option is `false` (default value)
345
+ - `execaSync()` was used
346
+ */
347
+ all?: StdoutStderrType;
348
+ /**
349
+ Whether the process was canceled.
350
+ */
351
+ isCanceled: boolean;
352
+ } & ExecaSyncError<StdoutStderrType>;
353
+ export type KillOptions = {
354
+ /**
355
+ Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
356
+
357
+ Can be disabled with `false`.
358
+
359
+ @default 5000
360
+ */
361
+ forceKillAfterTimeout?: number | false;
362
+ };
363
+ export type ExecaChildPromise<StdoutStderrType extends StdoutStderrAll> = {
364
+ /**
365
+ Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).
366
+
367
+ This is `undefined` if either:
368
+ - the `all` option is `false` (the default value)
369
+ - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
370
+ */
371
+ all?: ReadableStream;
372
+ catch<ResultType = never>(onRejected?: (reason: ExecaError<StdoutStderrType>) => ResultType | PromiseLike<ResultType>): Promise<ExecaReturnValue<StdoutStderrType> | ResultType>;
373
+ /**
374
+ Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`. Note that this graceful termination does not work on Windows, because Windows [doesn't support signals](https://nodejs.org/api/process.html#process_signal_events) (`SIGKILL` and `SIGTERM` has the same effect of force-killing the process immediately.) If you want to achieve graceful termination on Windows, you have to use other means, such as [`taskkill`](https://github.com/sindresorhus/taskkill).
375
+ */
376
+ kill(signal?: string, options?: KillOptions): void;
377
+ /**
378
+ Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This used to be preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`. But now this is deprecated and you should either use `.kill()` or the `signal` option when creating the child process.
379
+ */
380
+ cancel(): void;
381
+ /**
382
+ [Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the child process's `stdout` to `target`, which can be:
383
+ - Another `execa()` return value
384
+ - A writable stream
385
+ - A file path string
386
+
387
+ If the `target` is another `execa()` return value, it is returned. Otherwise, the original `execa()` return value is returned. This allows chaining `pipeStdout()` then `await`ing the final result.
388
+
389
+ The `stdout` option] must be kept as `pipe`, its default value.
390
+ */
391
+ pipeStdout?<Target extends ExecaChildPromise<StdoutStderrAll>>(target: Target): Target;
392
+ pipeStdout?(target: WritableStream | string): ExecaChildProcess<StdoutStderrType>;
393
+ /**
394
+ Like `pipeStdout()` but piping the child process's `stderr` instead.
395
+
396
+ The `stderr` option must be kept as `pipe`, its default value.
397
+ */
398
+ pipeStderr?<Target extends ExecaChildPromise<StdoutStderrAll>>(target: Target): Target;
399
+ pipeStderr?(target: WritableStream | string): ExecaChildProcess<StdoutStderrType>;
400
+ /**
401
+ Combines both `pipeStdout()` and `pipeStderr()`.
402
+
403
+ Either the `stdout` option or the `stderr` option must be kept as `pipe`, their default value. Also, the `all` option must be set to `true`.
404
+ */
405
+ pipeAll?<Target extends ExecaChildPromise<StdoutStderrAll>>(target: Target): Target;
406
+ pipeAll?(target: WritableStream | string): ExecaChildProcess<StdoutStderrType>;
407
+ };
408
+ export type ExecaChildProcess<StdoutStderrType extends StdoutStderrAll = string> = ChildProcess & ExecaChildPromise<StdoutStderrType> & Promise<ExecaReturnValue<StdoutStderrType>>;
409
+ export declare function depotBinaryPath(): string;
410
+ export declare function depot(args?: readonly string[], options?: Options): ExecaChildProcess;
411
+ export declare function depot(args?: readonly string[], options?: Options<BufferEncodingOption>): ExecaChildProcess<Buffer>;
412
+ export declare function depot(options?: Options): ExecaChildProcess;
413
+ export declare function depot(options?: Options<BufferEncodingOption>): ExecaChildProcess<Buffer>;
414
+
415
+ export {};