@cmflow/cli 3.4.0-beta.30 → 3.4.0-beta.31
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/dist/bin/cm.mjs +13737 -6307
- package/dist/bin/cmrelease.mjs +12505 -5765
- package/dist/{common-CfQycsia.mjs → common-Dk_Pm7J8.mjs} +2 -2
- package/dist/{common-CfQycsia.mjs.map → common-Dk_Pm7J8.mjs.map} +1 -1
- package/dist/{compile-packages-B6nhQT4A.mjs → compile-packages-CPkDuiiR.mjs} +2 -2
- package/dist/compile-packages-CPkDuiiR.mjs.map +1 -0
- package/dist/docker-CwPUDL7v.mjs +42 -0
- package/dist/docker-CwPUDL7v.mjs.map +1 -0
- package/dist/{docker-clean-tags-ltkwDm3w.mjs → docker-clean-tags-4Z1VHhE4.mjs} +2 -2
- package/dist/{docker-clean-tags-ltkwDm3w.mjs.map → docker-clean-tags-4Z1VHhE4.mjs.map} +1 -1
- package/dist/{docker-publish-DQFIuqCn.mjs → docker-publish-BFuDmUA1.mjs} +2 -2
- package/dist/{docker-publish-DQFIuqCn.mjs.map → docker-publish-BFuDmUA1.mjs.map} +1 -1
- package/dist/find-packages-C6Y7bRd0.mjs +45 -0
- package/dist/find-packages-C6Y7bRd0.mjs.map +1 -0
- package/dist/get-config-DvDR_kk5.mjs +44 -0
- package/dist/get-config-DvDR_kk5.mjs.map +1 -0
- package/dist/index.d.mts +1616 -420
- package/dist/index.mjs +24 -20
- package/dist/index.mjs.map +1 -1
- package/dist/{npm-Ckg6sg0g.mjs → npm-CN1gb9zd.mjs} +2 -2
- package/dist/{npm-Ckg6sg0g.mjs.map → npm-CN1gb9zd.mjs.map} +1 -1
- package/dist/semantic/core/analyze-commits.mjs +1 -1
- package/dist/semantic/core/conditional.mjs +1 -1
- package/dist/semantic/core/exit.mjs +1 -1
- package/dist/semantic/core/prepare/artifacts.mjs +1 -1
- package/dist/semantic/core/prepare/bump-version.mjs +1 -1
- package/dist/semantic/core/prepare/commit.mjs +1 -1
- package/dist/semantic/core/publish-packages.mjs +1 -1
- package/dist/semantic/core/publish-packages.mjs.map +1 -1
- package/dist/semantic/core/push-release.mjs +1 -1
- package/dist/semantic/core/run.mjs +1 -1
- package/dist/semantic/core/sync-repository.mjs +1 -1
- package/dist/semantic/core/verify-conditions.mjs +1 -1
- package/dist/semantic/core/verify-release.mjs +1 -1
- package/dist/semantic/docker/publish.mjs +1 -1
- package/dist/semantic/docker/success.mjs +1 -1
- package/dist/{source-DS6vboEb.mjs → source-DKfioGh_.mjs} +2 -2
- package/dist/{source-DS6vboEb.mjs.map → source-DKfioGh_.mjs.map} +1 -1
- package/dist/write-package-D5eHzQug.mjs +10 -0
- package/dist/write-package-D5eHzQug.mjs.map +1 -0
- package/dist/{write-packages-iAGBE9Qr.mjs → write-packages-BuxaZvCH.mjs} +3 -3
- package/dist/write-packages-BuxaZvCH.mjs.map +1 -0
- package/package.json +9 -10
- package/dist/compile-packages-B6nhQT4A.mjs.map +0 -1
- package/dist/docker-COfShgcQ.mjs +0 -36
- package/dist/docker-COfShgcQ.mjs.map +0 -1
- package/dist/find-packages-CIHA2-RE.mjs +0 -44
- package/dist/find-packages-CIHA2-RE.mjs.map +0 -1
- package/dist/get-config-Bojgeyi0.mjs +0 -11
- package/dist/get-config-Bojgeyi0.mjs.map +0 -1
- package/dist/write-package-CZMoWfOT.mjs +0 -10
- package/dist/write-package-CZMoWfOT.mjs.map +0 -1
- package/dist/write-packages-iAGBE9Qr.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
/// <reference path="operators/index.d.ts" />
|
|
3
3
|
/// <reference path="testing/index.d.ts" />
|
|
4
|
-
/// <reference types="node"/>
|
|
5
4
|
import { a as SemanticContext, c as getConfig, i as CmContext, l as PackageJson, n as CommandConstructor, o as CliConfig, r as ICommand, s as getCI, t as CmTask } from "./index-B7dZdFg6.mjs";
|
|
6
|
-
import { ChildProcess } from "child_process";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { ChildProcess } from "node:child_process";
|
|
6
|
+
import { SignalConstants } from "node:os";
|
|
7
|
+
import { Duplex, Readable, Writable } from "node:stream";
|
|
8
|
+
import { NextRelease, Options } from "semantic-release";
|
|
9
|
+
import { ReadableStream, ReadableWritablePair, TransformStream, WritableStream } from "node:stream/web";
|
|
9
10
|
//#region ../../node_modules/commander/typings/index.d.ts
|
|
10
11
|
// Type definitions for commander
|
|
11
12
|
// Original definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
|
|
12
|
-
// Using method rather than property for method-signature-style, to document method overloads separately. Allow either.
|
|
13
|
-
/* eslint-disable @typescript-eslint/method-signature-style */
|
|
14
13
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
14
|
// This is a trick to encourage editor to suggest the known literals while still
|
|
16
15
|
// allowing any BaseType value.
|
|
@@ -45,6 +44,7 @@ declare class Argument {
|
|
|
45
44
|
variadic: boolean;
|
|
46
45
|
defaultValue?: any;
|
|
47
46
|
defaultValueDescription?: string;
|
|
47
|
+
parseArg?: <T>(value: string, previous: T) => T;
|
|
48
48
|
argChoices?: string[];
|
|
49
49
|
/**
|
|
50
50
|
* Initialize a new command argument with the given name and description.
|
|
@@ -94,6 +94,7 @@ declare class Option {
|
|
|
94
94
|
parseArg?: <T>(value: string, previous: T) => T;
|
|
95
95
|
hidden: boolean;
|
|
96
96
|
argChoices?: string[];
|
|
97
|
+
helpGroupHeading?: string;
|
|
97
98
|
constructor(flags: string, description?: string);
|
|
98
99
|
/**
|
|
99
100
|
* Set the default value, and optionally supply the description to be displayed in the help.
|
|
@@ -161,9 +162,13 @@ declare class Option {
|
|
|
161
162
|
name(): string;
|
|
162
163
|
/**
|
|
163
164
|
* Return option name, in a camelcase format that can be used
|
|
164
|
-
* as
|
|
165
|
+
* as an object attribute key.
|
|
165
166
|
*/
|
|
166
167
|
attributeName(): string;
|
|
168
|
+
/**
|
|
169
|
+
* Set the help group heading.
|
|
170
|
+
*/
|
|
171
|
+
helpGroup(heading: string): this;
|
|
167
172
|
/**
|
|
168
173
|
* Return whether a boolean option.
|
|
169
174
|
*
|
|
@@ -174,10 +179,22 @@ declare class Option {
|
|
|
174
179
|
declare class Help {
|
|
175
180
|
/** output helpWidth, long lines are wrapped to fit */
|
|
176
181
|
helpWidth?: number;
|
|
182
|
+
minWidthToWrap: number;
|
|
177
183
|
sortSubcommands: boolean;
|
|
178
184
|
sortOptions: boolean;
|
|
179
185
|
showGlobalOptions: boolean;
|
|
180
186
|
constructor();
|
|
187
|
+
/*
|
|
188
|
+
* prepareContext is called by Commander after applying overrides from `Command.configureHelp()`
|
|
189
|
+
* and just before calling `formatHelp()`.
|
|
190
|
+
*
|
|
191
|
+
* Commander just uses the helpWidth and the others are provided for subclasses.
|
|
192
|
+
*/
|
|
193
|
+
prepareContext(contextOptions: {
|
|
194
|
+
error?: boolean;
|
|
195
|
+
helpWidth?: number;
|
|
196
|
+
outputHasColors?: boolean;
|
|
197
|
+
}): void;
|
|
181
198
|
/** Get the command term to show in the list of subcommands. */
|
|
182
199
|
subcommandTerm(cmd: Command): string;
|
|
183
200
|
/** Get the command summary to show in the list of subcommands. */
|
|
@@ -210,13 +227,54 @@ declare class Help {
|
|
|
210
227
|
longestGlobalOptionTermLength(cmd: Command, helper: Help): number;
|
|
211
228
|
/** Get the longest argument term length. */
|
|
212
229
|
longestArgumentTermLength(cmd: Command, helper: Help): number;
|
|
230
|
+
/** Return display width of string, ignoring ANSI escape sequences. Used in padding and wrapping calculations. */
|
|
231
|
+
displayWidth(str: string): number;
|
|
232
|
+
/** Style the titles. Called with 'Usage:', 'Options:', etc. */
|
|
233
|
+
styleTitle(title: string): string;
|
|
234
|
+
/** Usage: <str> */
|
|
235
|
+
styleUsage(str: string): string;
|
|
236
|
+
/** Style for command name in usage string. */
|
|
237
|
+
styleCommandText(str: string): string;
|
|
238
|
+
styleCommandDescription(str: string): string;
|
|
239
|
+
styleOptionDescription(str: string): string;
|
|
240
|
+
styleSubcommandDescription(str: string): string;
|
|
241
|
+
styleArgumentDescription(str: string): string;
|
|
242
|
+
/** Base style used by descriptions. */
|
|
243
|
+
styleDescriptionText(str: string): string;
|
|
244
|
+
styleOptionTerm(str: string): string;
|
|
245
|
+
styleSubcommandTerm(str: string): string;
|
|
246
|
+
styleArgumentTerm(str: string): string;
|
|
247
|
+
/** Base style used in terms and usage for options. */
|
|
248
|
+
styleOptionText(str: string): string;
|
|
249
|
+
/** Base style used in terms and usage for subcommands. */
|
|
250
|
+
styleSubcommandText(str: string): string;
|
|
251
|
+
/** Base style used in terms and usage for arguments. */
|
|
252
|
+
styleArgumentText(str: string): string;
|
|
213
253
|
/** Calculate the pad width from the maximum term length. */
|
|
214
254
|
padWidth(cmd: Command, helper: Help): number;
|
|
215
255
|
/**
|
|
216
|
-
* Wrap
|
|
217
|
-
*
|
|
256
|
+
* Wrap a string at whitespace, preserving existing line breaks.
|
|
257
|
+
* Wrapping is skipped if the width is less than `minWidthToWrap`.
|
|
258
|
+
*/
|
|
259
|
+
boxWrap(str: string, width: number): string;
|
|
260
|
+
/** Detect manually wrapped and indented strings by checking for line break followed by whitespace. */
|
|
261
|
+
preformatted(str: string): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Format the "item", which consists of a term and description. Pad the term and wrap the description, indenting the following lines.
|
|
264
|
+
*
|
|
265
|
+
* So "TTT", 5, "DDD DDDD DD DDD" might be formatted for this.helpWidth=17 like so:
|
|
266
|
+
* TTT DDD DDDD
|
|
267
|
+
* DD DDD
|
|
268
|
+
*/
|
|
269
|
+
formatItem(term: string, termWidth: number, description: string, helper: Help): string;
|
|
270
|
+
/**
|
|
271
|
+
* Format a list of items, given a heading and an array of formatted items.
|
|
272
|
+
*/
|
|
273
|
+
formatItemList(heading: string, items: string[], helper: Help): string[];
|
|
274
|
+
/**
|
|
275
|
+
* Group items by their help group heading.
|
|
218
276
|
*/
|
|
219
|
-
|
|
277
|
+
groupItems<T extends Command | Option>(unsortedItems: T[], visibleItems: T[], getGroup: (item: T) => string): Map<string, T[]>;
|
|
220
278
|
/** Generate the built-in help text. */
|
|
221
279
|
formatHelp(cmd: Command, helper: Help): string;
|
|
222
280
|
}
|
|
@@ -236,9 +294,12 @@ interface AddHelpTextContext {
|
|
|
236
294
|
interface OutputConfiguration {
|
|
237
295
|
writeOut?(str: string): void;
|
|
238
296
|
writeErr?(str: string): void;
|
|
297
|
+
outputError?(str: string, write: (str: string) => void): void;
|
|
239
298
|
getOutHelpWidth?(): number;
|
|
240
299
|
getErrHelpWidth?(): number;
|
|
241
|
-
|
|
300
|
+
getOutHasColors?(): boolean;
|
|
301
|
+
getErrHasColors?(): boolean;
|
|
302
|
+
stripColor?(str: string): string;
|
|
242
303
|
}
|
|
243
304
|
type AddHelpTextPosition = 'beforeAll' | 'before' | 'after' | 'afterAll';
|
|
244
305
|
type HookEvent = 'preSubcommand' | 'preAction' | 'postAction';
|
|
@@ -342,7 +403,7 @@ declare class Command {
|
|
|
342
403
|
*
|
|
343
404
|
* @returns `this` command for chaining
|
|
344
405
|
*/
|
|
345
|
-
argument<T>(flags: string, description: string,
|
|
406
|
+
argument<T>(flags: string, description: string, parseArg: (value: string, previous: T) => T, defaultValue?: T): this;
|
|
346
407
|
argument(name: string, description?: string, defaultValue?: unknown): this;
|
|
347
408
|
/**
|
|
348
409
|
* Define argument syntax for command, adding a prepared argument.
|
|
@@ -456,7 +517,7 @@ declare class Command {
|
|
|
456
517
|
*
|
|
457
518
|
* @returns `this` command for chaining
|
|
458
519
|
*/
|
|
459
|
-
action(fn: (...args: any[]) => void | Promise<void>): this;
|
|
520
|
+
action(fn: (this: this, ...args: any[]) => void | Promise<void>): this;
|
|
460
521
|
/**
|
|
461
522
|
* Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.
|
|
462
523
|
*
|
|
@@ -470,7 +531,7 @@ declare class Command {
|
|
|
470
531
|
* ```js
|
|
471
532
|
* program
|
|
472
533
|
* .option('-p, --pepper', 'add pepper')
|
|
473
|
-
* .option('
|
|
534
|
+
* .option('--pt, --pizza-type <TYPE>', 'type of pizza') // required option-argument
|
|
474
535
|
* .option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default
|
|
475
536
|
* .option('-t, --tip <VALUE>', 'add tip to purchase cost', parseFloat) // custom parse function
|
|
476
537
|
* ```
|
|
@@ -619,10 +680,26 @@ declare class Command {
|
|
|
619
680
|
* @returns Promise
|
|
620
681
|
*/
|
|
621
682
|
parseAsync(argv?: readonly string[], parseOptions?: ParseOptions): Promise<this>;
|
|
683
|
+
/**
|
|
684
|
+
* Called the first time parse is called to save state and allow a restore before subsequent calls to parse.
|
|
685
|
+
* Not usually called directly, but available for subclasses to save their custom state.
|
|
686
|
+
*
|
|
687
|
+
* This is called in a lazy way. Only commands used in parsing chain will have state saved.
|
|
688
|
+
*/
|
|
689
|
+
saveStateBeforeParse(): void;
|
|
690
|
+
/**
|
|
691
|
+
* Restore state before parse for calls after the first.
|
|
692
|
+
* Not usually called directly, but available for subclasses to save their custom state.
|
|
693
|
+
*
|
|
694
|
+
* This is called in a lazy way. Only commands used in parsing chain will have state restored.
|
|
695
|
+
*/
|
|
696
|
+
restoreStateBeforeParse(): void;
|
|
622
697
|
/**
|
|
623
698
|
* Parse options from `argv` removing known options,
|
|
624
699
|
* and return argv split into operands and unknown arguments.
|
|
625
700
|
*
|
|
701
|
+
* Side effects: modifies command by storing options. Does not reset state if called again.
|
|
702
|
+
*
|
|
626
703
|
* argv => operands, unknown
|
|
627
704
|
* --known kkk op => [op], []
|
|
628
705
|
* op --known kkk => [op], []
|
|
@@ -706,13 +783,13 @@ declare class Command {
|
|
|
706
783
|
name(): string;
|
|
707
784
|
/**
|
|
708
785
|
* Set the name of the command from script filename, such as process.argv[1],
|
|
709
|
-
* or
|
|
786
|
+
* or import.meta.filename.
|
|
710
787
|
*
|
|
711
788
|
* (Used internally and public although not documented in README.)
|
|
712
789
|
*
|
|
713
790
|
* @example
|
|
714
791
|
* ```ts
|
|
715
|
-
* program.nameFromFilename(
|
|
792
|
+
* program.nameFromFilename(import.meta.filename);
|
|
716
793
|
* ```
|
|
717
794
|
*
|
|
718
795
|
* @returns `this` command for chaining
|
|
@@ -723,7 +800,7 @@ declare class Command {
|
|
|
723
800
|
*
|
|
724
801
|
* @example
|
|
725
802
|
* ```ts
|
|
726
|
-
* program.executableDir(
|
|
803
|
+
* program.executableDir(import.meta.dirname);
|
|
727
804
|
* // or
|
|
728
805
|
* program.executableDir('subcommands');
|
|
729
806
|
* ```
|
|
@@ -735,6 +812,50 @@ declare class Command {
|
|
|
735
812
|
* Get the executable search directory.
|
|
736
813
|
*/
|
|
737
814
|
executableDir(): string | null;
|
|
815
|
+
/**
|
|
816
|
+
* Set the help group heading for this subcommand in parent command's help.
|
|
817
|
+
*
|
|
818
|
+
* @returns `this` command for chaining
|
|
819
|
+
*/
|
|
820
|
+
helpGroup(heading: string): this;
|
|
821
|
+
/**
|
|
822
|
+
* Get the help group heading for this subcommand in parent command's help.
|
|
823
|
+
*/
|
|
824
|
+
helpGroup(): string;
|
|
825
|
+
/**
|
|
826
|
+
* Set the default help group heading for subcommands added to this command.
|
|
827
|
+
* (This does not override a group set directly on the subcommand using .helpGroup().)
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* program.commandsGroup('Development Commands:);
|
|
831
|
+
* program.command('watch')...
|
|
832
|
+
* program.command('lint')...
|
|
833
|
+
* ...
|
|
834
|
+
*
|
|
835
|
+
* @returns `this` command for chaining
|
|
836
|
+
*/
|
|
837
|
+
commandsGroup(heading: string): this;
|
|
838
|
+
/**
|
|
839
|
+
* Get the default help group heading for subcommands added to this command.
|
|
840
|
+
*/
|
|
841
|
+
commandsGroup(): string;
|
|
842
|
+
/**
|
|
843
|
+
* Set the default help group heading for options added to this command.
|
|
844
|
+
* (This does not override a group set directly on the option using .helpGroup().)
|
|
845
|
+
*
|
|
846
|
+
* @example
|
|
847
|
+
* program
|
|
848
|
+
* .optionsGroup('Development Options:')
|
|
849
|
+
* .option('-d, --debug', 'output extra debugging')
|
|
850
|
+
* .option('-p, --profile', 'output profiling information')
|
|
851
|
+
*
|
|
852
|
+
* @returns `this` command for chaining
|
|
853
|
+
*/
|
|
854
|
+
optionsGroup(heading: string): this;
|
|
855
|
+
/**
|
|
856
|
+
* Get the default help group heading for options added to this command.
|
|
857
|
+
*/
|
|
858
|
+
optionsGroup(): string;
|
|
738
859
|
/**
|
|
739
860
|
* Output help information for this command.
|
|
740
861
|
*
|
|
@@ -743,7 +864,7 @@ declare class Command {
|
|
|
743
864
|
*/
|
|
744
865
|
outputHelp(context?: HelpContext): void;
|
|
745
866
|
/** @deprecated since v7 */
|
|
746
|
-
outputHelp(cb
|
|
867
|
+
outputHelp(cb: (str: string) => string): void;
|
|
747
868
|
/**
|
|
748
869
|
* Return command help documentation.
|
|
749
870
|
*/
|
|
@@ -766,7 +887,7 @@ declare class Command {
|
|
|
766
887
|
*/
|
|
767
888
|
help(context?: HelpContext): never;
|
|
768
889
|
/** @deprecated since v7 */
|
|
769
|
-
help(cb
|
|
890
|
+
help(cb: (str: string) => string): never;
|
|
770
891
|
/**
|
|
771
892
|
* Add additional text to be displayed with the built-in help.
|
|
772
893
|
*
|
|
@@ -868,12 +989,9 @@ declare class Rebase extends Fetch implements ICommand {
|
|
|
868
989
|
* method, which will attach a child Subscription to the current Subscription.
|
|
869
990
|
* When a Subscription is unsubscribed, all its children (and its grandchildren)
|
|
870
991
|
* will be unsubscribed as well.
|
|
871
|
-
*
|
|
872
|
-
* @class Subscription
|
|
873
992
|
*/
|
|
874
993
|
declare class Subscription implements SubscriptionLike {
|
|
875
994
|
private initialTeardown?;
|
|
876
|
-
/** @nocollapse */
|
|
877
995
|
static EMPTY: Subscription;
|
|
878
996
|
/**
|
|
879
997
|
* A flag to indicate whether this Subscription has already been unsubscribed.
|
|
@@ -894,7 +1012,6 @@ declare class Subscription implements SubscriptionLike {
|
|
|
894
1012
|
* Disposes the resources held by the subscription. May, for instance, cancel
|
|
895
1013
|
* an ongoing Observable execution or cancel any other type of work that
|
|
896
1014
|
* started when the Subscription was created.
|
|
897
|
-
* @return {void}
|
|
898
1015
|
*/
|
|
899
1016
|
unsubscribe(): void;
|
|
900
1017
|
/**
|
|
@@ -1031,8 +1148,6 @@ interface Observer<T> {
|
|
|
1031
1148
|
* a Subscriber, in order to provide Subscription-like capabilities such as
|
|
1032
1149
|
* `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
|
|
1033
1150
|
* implementing operators, but it is rarely used as a public API.
|
|
1034
|
-
*
|
|
1035
|
-
* @class Subscriber<T>
|
|
1036
1151
|
*/
|
|
1037
1152
|
declare class Subscriber<T> extends Subscription implements Observer<T> {
|
|
1038
1153
|
/**
|
|
@@ -1045,7 +1160,6 @@ declare class Subscriber<T> extends Subscription implements Observer<T> {
|
|
|
1045
1160
|
* Observer.
|
|
1046
1161
|
* @return A Subscriber wrapping the (partially defined)
|
|
1047
1162
|
* Observer represented by the given arguments.
|
|
1048
|
-
* @nocollapse
|
|
1049
1163
|
* @deprecated Do not use. Will be removed in v8. There is no replacement for this
|
|
1050
1164
|
* method, and there is no reason to be creating instances of `Subscriber` directly.
|
|
1051
1165
|
* If you have a specific use case, please file an issue.
|
|
@@ -1064,23 +1178,20 @@ declare class Subscriber<T> extends Subscription implements Observer<T> {
|
|
|
1064
1178
|
* The {@link Observer} callback to receive notifications of type `next` from
|
|
1065
1179
|
* the Observable, with a value. The Observable may call this method 0 or more
|
|
1066
1180
|
* times.
|
|
1067
|
-
* @param
|
|
1068
|
-
* @return {void}
|
|
1181
|
+
* @param value The `next` value.
|
|
1069
1182
|
*/
|
|
1070
|
-
next(value
|
|
1183
|
+
next(value: T): void;
|
|
1071
1184
|
/**
|
|
1072
1185
|
* The {@link Observer} callback to receive notifications of type `error` from
|
|
1073
1186
|
* the Observable, with an attached `Error`. Notifies the Observer that
|
|
1074
1187
|
* the Observable has experienced an error condition.
|
|
1075
|
-
* @param
|
|
1076
|
-
* @return {void}
|
|
1188
|
+
* @param err The `error` exception.
|
|
1077
1189
|
*/
|
|
1078
1190
|
error(err?: any): void;
|
|
1079
1191
|
/**
|
|
1080
1192
|
* The {@link Observer} callback to receive a valueless notification of type
|
|
1081
1193
|
* `complete` from the Observable. Notifies the Observer that the Observable
|
|
1082
1194
|
* has finished sending push-based notifications.
|
|
1083
|
-
* @return {void}
|
|
1084
1195
|
*/
|
|
1085
1196
|
complete(): void;
|
|
1086
1197
|
unsubscribe(): void;
|
|
@@ -1101,8 +1212,6 @@ interface Operator<T, R> {
|
|
|
1101
1212
|
/**
|
|
1102
1213
|
* A representation of any set of values over any amount of time. This is the most basic building block
|
|
1103
1214
|
* of RxJS.
|
|
1104
|
-
*
|
|
1105
|
-
* @class Observable<T>
|
|
1106
1215
|
*/
|
|
1107
1216
|
declare class Observable<T> implements Subscribable<T> {
|
|
1108
1217
|
/**
|
|
@@ -1114,8 +1223,7 @@ declare class Observable<T> implements Subscribable<T> {
|
|
|
1114
1223
|
*/
|
|
1115
1224
|
operator: Operator<any, T> | undefined;
|
|
1116
1225
|
/**
|
|
1117
|
-
* @
|
|
1118
|
-
* @param {Function} subscribe the function that is called when the Observable is
|
|
1226
|
+
* @param subscribe The function that is called when the Observable is
|
|
1119
1227
|
* initially subscribed to. This function is given a Subscriber, to which new values
|
|
1120
1228
|
* can be `next`ed, or an `error` method can be called to raise an error, or
|
|
1121
1229
|
* `complete` can be called to notify of a successful completion.
|
|
@@ -1123,20 +1231,16 @@ declare class Observable<T> implements Subscribable<T> {
|
|
|
1123
1231
|
constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic);
|
|
1124
1232
|
/**
|
|
1125
1233
|
* Creates a new Observable by calling the Observable constructor
|
|
1126
|
-
* @
|
|
1127
|
-
* @
|
|
1128
|
-
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
|
|
1129
|
-
* @return {Observable} a new observable
|
|
1130
|
-
* @nocollapse
|
|
1234
|
+
* @param subscribe the subscriber function to be passed to the Observable constructor
|
|
1235
|
+
* @return A new observable.
|
|
1131
1236
|
* @deprecated Use `new Observable()` instead. Will be removed in v8.
|
|
1132
1237
|
*/
|
|
1133
1238
|
static create: (...args: any[]) => any;
|
|
1134
1239
|
/**
|
|
1135
1240
|
* Creates a new Observable, with this Observable instance as the source, and the passed
|
|
1136
1241
|
* operator defined as the new observable's operator.
|
|
1137
|
-
* @method lift
|
|
1138
1242
|
* @param operator the operator defining the operation to take on the observable
|
|
1139
|
-
* @return
|
|
1243
|
+
* @return A new observable with the Operator applied.
|
|
1140
1244
|
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
1141
1245
|
* If you have implemented an operator using `lift`, it is recommended that you create an
|
|
1142
1246
|
* operator by simply returning `new Observable()` directly. See "Creating new operators from
|
|
@@ -1186,9 +1290,9 @@ declare class Observable<T> implements Subscribable<T> {
|
|
|
1186
1290
|
* // 'Total: 6'
|
|
1187
1291
|
* ```
|
|
1188
1292
|
*
|
|
1189
|
-
* @param next
|
|
1190
|
-
* @return
|
|
1191
|
-
*
|
|
1293
|
+
* @param next A handler for each value emitted by the observable.
|
|
1294
|
+
* @return A promise that either resolves on observable completion or
|
|
1295
|
+
* rejects with the handled error.
|
|
1192
1296
|
*/
|
|
1193
1297
|
forEach(next: (value: T) => void): Promise<void>;
|
|
1194
1298
|
/**
|
|
@@ -1332,471 +1436,1563 @@ declare namespace index_d_exports {
|
|
|
1332
1436
|
//#region src/commands/release.d.ts
|
|
1333
1437
|
declare function release(options?: {}): void;
|
|
1334
1438
|
//#endregion
|
|
1335
|
-
//#region ../../node_modules/execa/
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1439
|
+
//#region ../../node_modules/execa/types/utils.d.ts
|
|
1440
|
+
type Not<Value extends boolean> = Value extends true ? false : true;
|
|
1441
|
+
type And<First extends boolean, Second extends boolean> = First extends true ? Second : false;
|
|
1442
|
+
type Unless<Condition extends boolean, ThenValue, ElseValue = never> = Condition extends true ? ElseValue : ThenValue;
|
|
1443
|
+
type AndUnless<Condition extends boolean, ThenValue, ElseValue = unknown> = Condition extends true ? ElseValue : ThenValue;
|
|
1444
|
+
// Whether any of T's union element is the same as one of U's union element.
|
|
1445
|
+
// `&` does not work here.
|
|
1446
|
+
type Intersects<T, U> = true extends (T extends U ? true : false) ? true : false;
|
|
1447
|
+
//#endregion
|
|
1448
|
+
//#region ../../node_modules/execa/types/transform/normalize.d.ts
|
|
1449
|
+
// `options.std*: Generator`
|
|
1450
|
+
// The `chunk` argument's type is based on the transform's mode:
|
|
1451
|
+
// - `binary: true` or binary `encoding`, with `objectMode: true` -> `unknown` for stdin, `Uint8Array` for stdout/stderr
|
|
1452
|
+
// - `binary: true` or binary `encoding` -> `Uint8Array`
|
|
1453
|
+
// - `objectMode: true` -> `unknown` for stdin, `string` for stdout/stderr
|
|
1454
|
+
// - otherwise -> `string`
|
|
1455
|
+
// The return type is kept as `unknown` since a transform can always yield either a `string` or an `Uint8Array`.
|
|
1456
|
+
// See https://github.com/sindresorhus/execa/issues/694
|
|
1457
|
+
type GeneratorTransform<IsSync extends boolean, Chunk = string> = (chunk: Chunk) => Unless<IsSync, AsyncGenerator<unknown, void, void>> | Generator<unknown, void, void>;
|
|
1458
|
+
type GeneratorTransformReturn<IsSync extends boolean> = ReturnType<GeneratorTransform<IsSync>>;
|
|
1459
|
+
type GeneratorFinal<IsSync extends boolean> = () => Unless<IsSync, AsyncGenerator<unknown, void, void>> | Generator<unknown, void, void>;
|
|
1460
|
+
type TransformCommon = {
|
|
1461
|
+
/**
|
|
1462
|
+
If `true`, allow `transformOptions.transform` and `transformOptions.final` to return any type, not just `string` or `Uint8Array`.
|
|
1463
|
+
*/
|
|
1464
|
+
readonly objectMode?: boolean;
|
|
1465
|
+
};
|
|
1466
|
+
// A `GeneratorTransformFull` shape whose `transform` narrows the `chunk` argument to `Chunk`.
|
|
1467
|
+
// The mode-independent documentation lives here.
|
|
1468
|
+
type GeneratorTransformBase<IsSync extends boolean, Chunk> = TransformCommon & {
|
|
1469
|
+
/**
|
|
1470
|
+
Map or filter the input or output of the subprocess.
|
|
1471
|
+
*/
|
|
1472
|
+
readonly transform: GeneratorTransform<IsSync, Chunk>;
|
|
1473
|
+
/**
|
|
1474
|
+
Create additional lines after the last one.
|
|
1475
|
+
*/
|
|
1476
|
+
readonly final?: GeneratorFinal<IsSync>;
|
|
1477
|
+
/**
|
|
1478
|
+
If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.
|
|
1479
|
+
*/
|
|
1480
|
+
readonly binary?: boolean;
|
|
1481
|
+
/**
|
|
1482
|
+
If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produce a single line.
|
|
1483
|
+
*/
|
|
1484
|
+
readonly preserveNewlines?: boolean;
|
|
1485
|
+
};
|
|
1486
|
+
// For stdout/stderr, this literal option pair accepts explicitly typed `Uint8Array` callbacks, matching runtime binary chunks, while still allowing stdin-style `unknown` object-mode callbacks.
|
|
1487
|
+
type GeneratorTransformBinaryObjectMode<IsSync extends boolean, ObjectModeChunk> = ObjectModeChunk extends string ? Omit<GeneratorTransformBase<IsSync, unknown>, 'transform' | 'objectMode' | 'binary'> & {
|
|
1488
|
+
/**
|
|
1489
|
+
Map or filter the input or output of the subprocess.
|
|
1345
1490
|
*/
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1491
|
+
transform(chunk: Uint8Array): GeneratorTransformReturn<IsSync>;
|
|
1492
|
+
// eslint-disable-next-line @typescript-eslint/unified-signatures -- Combining these as `unknown | Uint8Array` would collapse to `unknown` and reject explicitly typed `Uint8Array` callbacks.
|
|
1493
|
+
transform(chunk: unknown): GeneratorTransformReturn<IsSync>;
|
|
1494
|
+
readonly objectMode: true;
|
|
1495
|
+
readonly binary: true;
|
|
1496
|
+
} : GeneratorTransformBase<IsSync, unknown> & {
|
|
1497
|
+
readonly objectMode: true;
|
|
1498
|
+
readonly binary: true;
|
|
1499
|
+
};
|
|
1500
|
+
/**
|
|
1501
|
+
A transform or an array of transforms can be passed to the `stdin`, `stdout`, `stderr` or `stdio` option.
|
|
1502
|
+
|
|
1503
|
+
A transform is either a generator function or a plain object with the following members.
|
|
1504
|
+
*/
|
|
1505
|
+
type GeneratorTransformFull<IsSync extends boolean, ObjectModeChunk = unknown, TransformChunk = string> =
|
|
1506
|
+
// Non-literal `binary` or `objectMode` values are accepted at runtime, but their mode is unknown at compile time.
|
|
1507
|
+
(GeneratorTransformBase<IsSync, unknown> & {
|
|
1508
|
+
readonly objectMode?: boolean;
|
|
1509
|
+
readonly binary?: boolean;
|
|
1510
|
+
}) |
|
|
1511
|
+
// `binary: true` without `objectMode` -> the `chunk` argument is an `Uint8Array`.
|
|
1512
|
+
(GeneratorTransformBase<IsSync, Uint8Array> & {
|
|
1513
|
+
readonly objectMode?: false;
|
|
1514
|
+
readonly binary: true;
|
|
1515
|
+
}) |
|
|
1516
|
+
// `binary: true` with `objectMode` -> the `chunk` argument is `unknown` for stdin, `Uint8Array` for stdout/stderr.
|
|
1517
|
+
GeneratorTransformBinaryObjectMode<IsSync, ObjectModeChunk> |
|
|
1518
|
+
// `binary: false` without `objectMode` -> the `chunk` argument depends on the subprocess encoding.
|
|
1519
|
+
(GeneratorTransformBase<IsSync, TransformChunk> & {
|
|
1520
|
+
readonly objectMode?: false;
|
|
1521
|
+
readonly binary?: false;
|
|
1522
|
+
}) |
|
|
1523
|
+
// `objectMode: true` with `binary: false` -> the `chunk` argument depends on the stdio direction.
|
|
1524
|
+
(GeneratorTransformBase<IsSync, ObjectModeChunk> & {
|
|
1525
|
+
readonly objectMode: true;
|
|
1526
|
+
readonly binary?: false;
|
|
1527
|
+
});
|
|
1528
|
+
// `options.std*: Duplex`
|
|
1529
|
+
type DuplexTransform = TransformCommon & {
|
|
1530
|
+
readonly transform: Duplex;
|
|
1531
|
+
};
|
|
1532
|
+
// `options.std*: TransformStream`
|
|
1533
|
+
type WebTransform = TransformCommon & {
|
|
1534
|
+
readonly transform: TransformStream;
|
|
1535
|
+
};
|
|
1536
|
+
//#endregion
|
|
1537
|
+
//#region ../../node_modules/execa/types/stdio/type.d.ts
|
|
1538
|
+
type IsStandardStream<FdNumber extends string> = FdNumber extends keyof StandardStreams ? true : false;
|
|
1539
|
+
type StandardStreams = readonly ['stdin', 'stdout', 'stderr'];
|
|
1540
|
+
// When `options.stdin|stdout|stderr|stdio` is set to one of those values, no stream is created
|
|
1541
|
+
type NoStreamStdioOption<FdNumber extends string> = 'ignore' | 'inherit' | number | Readable | Writable | Unless<IsStandardStream<FdNumber>, undefined> | readonly [NoStreamStdioOption<FdNumber>] | {
|
|
1542
|
+
readonly value: 'inherit' | number;
|
|
1543
|
+
readonly input?: boolean;
|
|
1544
|
+
};
|
|
1545
|
+
// `options.stdio` when it is not an array
|
|
1546
|
+
type SimpleStdioOption<IsSync extends boolean, IsExtra extends boolean, IsArray extends boolean> = undefined | 'pipe' | Unless<And<And<Not<IsSync>, IsArray>, IsExtra>, 'inherit'> | Unless<IsArray, 'ignore'> | Unless<IsSync, 'overlapped'>;
|
|
1547
|
+
// The `{value, input}` object form wraps a direction-ambiguous value and sets its direction explicitly.
|
|
1548
|
+
type AmbiguousStdioOption<IsSync extends boolean, IsExtra extends boolean, IsArray extends boolean, ObjectModeChunk = unknown, TransformChunk = string> = {
|
|
1549
|
+
readonly value: AmbiguousStdioValue<IsSync, IsArray, ObjectModeChunk, TransformChunk>;
|
|
1550
|
+
readonly input?: Unless<And<IsSync, IsExtra>, boolean> | false;
|
|
1551
|
+
};
|
|
1552
|
+
// Values whose direction is ambiguous on additional file descriptors, so they default to output unless `input` is set.
|
|
1553
|
+
// This excludes values with a fixed direction (readable/writable streams, iterables, standard file descriptors).
|
|
1554
|
+
type AmbiguousStdioValue<IsSync extends boolean, IsArray extends boolean, ObjectModeChunk, TransformChunk> = 'pipe' | 'inherit' | Unless<IsSync, 'overlapped'> | URL | GeneratorTransform<IsSync, TransformChunk> | GeneratorTransformFull<IsSync, ObjectModeChunk, TransformChunk> | Unless<And<Not<IsSync>, IsArray>, 3 | 4 | 5 | 6 | 7 | 8 | 9> | Unless<IsSync, DuplexTransform | WebTransform | TransformStream> | {
|
|
1555
|
+
readonly file: string;
|
|
1556
|
+
readonly append?: boolean;
|
|
1557
|
+
};
|
|
1558
|
+
// Values available in both `options.stdin|stdio` and `options.stdout|stderr|stdio`
|
|
1559
|
+
type CommonStdioOption<IsSync extends boolean, IsExtra extends boolean, IsArray extends boolean, ObjectModeChunk = unknown, TransformChunk = string> =
|
|
1560
|
+
// TypeScript cannot contextually type inline full generator transform objects through this broad stdio union because the union also includes `{transform: Duplex | TransformStream}` wrapper objects. Users should annotate `chunk` when assigning an inline object directly to `StdinOption`, `StdoutStderrOption`, `Options['stdout']`, etc. Keep `GeneratorTransformFull` mode branches narrow, but do not add a broad full-object fallback here to try to recover contextual typing.
|
|
1561
|
+
SimpleStdioOption<IsSync, IsExtra, IsArray> | URL | GeneratorTransform<IsSync, TransformChunk> | GeneratorTransformFull<IsSync, ObjectModeChunk, TransformChunk> | Unless<And<Not<IsSync>, IsArray>, 3 | 4 | 5 | 6 | 7 | 8 | 9> | Unless<IsSync, DuplexTransform | WebTransform | TransformStream> | AmbiguousStdioOption<IsSync, IsExtra, IsArray, ObjectModeChunk, TransformChunk> | {
|
|
1562
|
+
readonly file: string;
|
|
1563
|
+
readonly append?: boolean;
|
|
1564
|
+
};
|
|
1565
|
+
// Synchronous iterables excluding strings, Uint8Arrays and Arrays
|
|
1566
|
+
type IterableObject<IsArray extends boolean> = Iterable<unknown> & object & AndUnless<IsArray, {
|
|
1567
|
+
readonly lastIndexOf?: never;
|
|
1568
|
+
}> & {
|
|
1569
|
+
readonly BYTES_PER_ELEMENT?: never;
|
|
1570
|
+
};
|
|
1571
|
+
// `process.stdin|stdout|stderr` are `Duplex` with a `fd` property.
|
|
1572
|
+
// This ensures they can only be passed to `stdin`/`stdout`/`stderr`, based on their direction.
|
|
1573
|
+
type ProcessStdinFd = {
|
|
1574
|
+
readonly fd?: 0;
|
|
1575
|
+
};
|
|
1576
|
+
type ProcessStdoutStderrFd = {
|
|
1577
|
+
readonly fd?: 1 | 2;
|
|
1578
|
+
};
|
|
1579
|
+
// Values available only in `options.stdin|stdio`
|
|
1580
|
+
type InputStdioOption<IsSync extends boolean = boolean, IsExtra extends boolean = boolean, IsArray extends boolean = boolean> = 0 | Unless<And<IsSync, IsExtra>, Uint8Array | IterableObject<IsArray>> | Unless<And<IsSync, IsArray>, Readable & ProcessStdinFd> | Unless<IsSync, (AsyncIterable<unknown> & ProcessStdinFd) | ReadableStream>;
|
|
1581
|
+
// Values available only in `options.stdout|stderr|stdio`
|
|
1582
|
+
type OutputStdioOption<IsSync extends boolean, IsArray extends boolean> = 1 | 2 | Unless<And<IsSync, IsArray>, Writable & ProcessStdoutStderrFd> | Unless<IsSync, WritableStream>;
|
|
1583
|
+
// `options.stdin` array items
|
|
1584
|
+
type StdinSingleOption<IsSync extends boolean, IsExtra extends boolean, IsArray extends boolean, TransformChunk = string> = CommonStdioOption<IsSync, IsExtra, IsArray, unknown, TransformChunk> | InputStdioOption<IsSync, IsExtra, IsArray>;
|
|
1585
|
+
// `options.stdin`
|
|
1586
|
+
type StdinOptionCommon<IsSync extends boolean = boolean, IsExtra extends boolean = boolean, TransformChunk = string> = TransformChunk extends unknown ? StdinSingleOption<IsSync, IsExtra, false, TransformChunk> | ReadonlyArray<StdinSingleOption<IsSync, IsExtra, true, TransformChunk>> : never;
|
|
1587
|
+
// `options.stdout|stderr` array items
|
|
1588
|
+
type StdoutStderrSingleOption<IsSync extends boolean, IsExtra extends boolean, IsArray extends boolean, TransformChunk = string> = CommonStdioOption<IsSync, IsExtra, IsArray, TransformChunk, TransformChunk> | OutputStdioOption<IsSync, IsArray>;
|
|
1589
|
+
// `options.stdout|stderr`
|
|
1590
|
+
// In `objectMode`, the `chunk` argument of every array item is typed as `string`, even though only the first transform in the pipeline receives subprocess lines. The array index cannot be used to infer the pipeline position, since non-transform items are filtered out and transforms are reordered at runtime.
|
|
1591
|
+
type StdoutStderrOptionCommon<IsSync extends boolean = boolean, IsExtra extends boolean = boolean, TransformChunk = string> = TransformChunk extends unknown ? StdoutStderrSingleOption<IsSync, IsExtra, false, TransformChunk> | ReadonlyArray<StdoutStderrSingleOption<IsSync, IsExtra, true, TransformChunk>> : never;
|
|
1592
|
+
// `options.stdio[3+]`
|
|
1593
|
+
type StdioExtraOptionCommon<IsSync extends boolean, TransformChunk = string> = StdinOptionCommon<IsSync, true, TransformChunk> | StdoutStderrOptionCommon<IsSync, true, TransformChunk>;
|
|
1594
|
+
// `options.stdin|stdout|stderr|stdio` array items
|
|
1595
|
+
type StdioSingleOption<IsSync extends boolean = boolean, IsExtra extends boolean = boolean, IsArray extends boolean = boolean, TransformChunk = string> = StdinSingleOption<IsSync, IsExtra, IsArray, TransformChunk> | StdoutStderrSingleOption<IsSync, IsExtra, IsArray, TransformChunk>;
|
|
1596
|
+
// Get `options.stdin|stdout|stderr|stdio` items if it is an array, else keep as is
|
|
1597
|
+
type StdioSingleOptionItems<StdioOptionType> = StdioOptionType extends readonly StdioSingleOption[] ? StdioOptionType[number] : StdioOptionType;
|
|
1598
|
+
// `options.stdin|stdout|stderr|stdio`
|
|
1599
|
+
type StdioOptionCommon<IsSync extends boolean = boolean, TransformChunk = string> = StdinOptionCommon<IsSync, boolean, TransformChunk> | StdoutStderrOptionCommon<IsSync, boolean, TransformChunk>;
|
|
1600
|
+
// `options.stdio` when it is an array
|
|
1601
|
+
type StdioOptionsArray<IsSync extends boolean = boolean, TransformChunk = string> = readonly [StdinOptionCommon<IsSync, false, TransformChunk>, StdoutStderrOptionCommon<IsSync, false, TransformChunk>, StdoutStderrOptionCommon<IsSync, false, TransformChunk>, ...ReadonlyArray<StdioExtraOptionCommon<IsSync, TransformChunk>>];
|
|
1602
|
+
// `options.stdio`
|
|
1603
|
+
type StdioOptionsProperty<IsSync extends boolean = boolean, TransformChunk = string> = TransformChunk extends unknown ? SimpleStdioOption<IsSync, false, false> | StdioOptionsArray<IsSync, TransformChunk> : never;
|
|
1604
|
+
//#endregion
|
|
1605
|
+
//#region ../../node_modules/execa/types/ipc.d.ts
|
|
1606
|
+
// Message when the `serialization` option is `'advanced'`
|
|
1607
|
+
type AdvancedMessage = string | number | boolean | null | object;
|
|
1608
|
+
// Message when the `serialization` option is `'json'`
|
|
1609
|
+
type JsonMessage = string | number | boolean | null | readonly JsonMessage[] | {
|
|
1610
|
+
readonly [key: string | number]: JsonMessage;
|
|
1611
|
+
};
|
|
1612
|
+
/**
|
|
1613
|
+
Type of messages exchanged between a process and its subprocess using `sendMessage()`, `getOneMessage()` and `getEachMessage()`.
|
|
1614
|
+
|
|
1615
|
+
This requires the `ipc` option to be `true`. The type of `message` depends on the `serialization` option.
|
|
1616
|
+
*/
|
|
1617
|
+
type Message<Serialization extends Options$1['serialization'] = Options$1['serialization']> = Serialization extends 'json' ? JsonMessage : AdvancedMessage;
|
|
1618
|
+
/**
|
|
1619
|
+
Options to `sendMessage()` and `subprocess.sendMessage()`
|
|
1620
|
+
*/
|
|
1621
|
+
type SendMessageOptions = {
|
|
1622
|
+
/**
|
|
1623
|
+
Throw when the other process is not receiving or listening to messages.
|
|
1624
|
+
|
|
1625
|
+
@default false
|
|
1626
|
+
*/
|
|
1627
|
+
readonly strict?: boolean;
|
|
1628
|
+
};
|
|
1629
|
+
/**
|
|
1630
|
+
Options to `getOneMessage()` and `subprocess.getOneMessage()`
|
|
1631
|
+
*/
|
|
1632
|
+
type GetOneMessageOptions<Serialization extends Options$1['serialization']> = {
|
|
1633
|
+
/**
|
|
1634
|
+
Ignore any `message` that returns `false`.
|
|
1635
|
+
*/
|
|
1636
|
+
readonly filter?: (message: Message<Serialization>) => boolean;
|
|
1637
|
+
/**
|
|
1638
|
+
Keep the subprocess alive while `getOneMessage()` is waiting.
|
|
1639
|
+
|
|
1640
|
+
@default true
|
|
1641
|
+
*/
|
|
1642
|
+
readonly reference?: boolean;
|
|
1643
|
+
};
|
|
1644
|
+
/**
|
|
1645
|
+
Options to `getEachMessage()` and `subprocess.getEachMessage()`
|
|
1646
|
+
*/
|
|
1647
|
+
type GetEachMessageOptions = {
|
|
1648
|
+
/**
|
|
1649
|
+
Keep the subprocess alive while `getEachMessage()` is waiting.
|
|
1349
1650
|
|
|
1350
|
-
|
|
1651
|
+
@default true
|
|
1652
|
+
*/
|
|
1653
|
+
readonly reference?: boolean;
|
|
1654
|
+
};
|
|
1655
|
+
// IPC methods in the subprocess
|
|
1656
|
+
type IpcMethods<IpcEnabled extends boolean, Serialization extends Options$1['serialization']> = IpcEnabled extends true ? {
|
|
1657
|
+
/**
|
|
1658
|
+
Send a `message` to the subprocess.
|
|
1351
1659
|
|
|
1352
|
-
|
|
1660
|
+
This requires the `ipc` option to be `true`. The type of `message` depends on the `serialization` option.
|
|
1353
1661
|
*/
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1662
|
+
sendMessage(message: Message<Serialization>, sendMessageOptions?: SendMessageOptions): Promise<void>;
|
|
1663
|
+
/**
|
|
1664
|
+
Receive a single `message` from the subprocess.
|
|
1357
1665
|
|
|
1358
|
-
|
|
1666
|
+
This requires the `ipc` option to be `true`. The type of `message` depends on the `serialization` option.
|
|
1359
1667
|
*/
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1668
|
+
getOneMessage(getOneMessageOptions?: GetOneMessageOptions<Serialization>): Promise<Message<Serialization>>;
|
|
1669
|
+
/**
|
|
1670
|
+
Iterate over each `message` from the subprocess.
|
|
1363
1671
|
|
|
1364
|
-
This
|
|
1672
|
+
This requires the `ipc` option to be `true`. The type of `message` depends on the `serialization` option.
|
|
1673
|
+
*/
|
|
1674
|
+
getEachMessage(getEachMessageOptions?: GetEachMessageOptions): AsyncIterableIterator<Message<Serialization>>;
|
|
1675
|
+
} :
|
|
1676
|
+
// Those methods only work if the `ipc` option is `true`.
|
|
1677
|
+
// At runtime, they are actually defined, in order to provide with a nice error message.
|
|
1678
|
+
// At type check time, they are typed as `undefined` to prevent calling them.
|
|
1679
|
+
{
|
|
1680
|
+
sendMessage: undefined;
|
|
1681
|
+
getOneMessage: undefined;
|
|
1682
|
+
getEachMessage: undefined;
|
|
1683
|
+
};
|
|
1684
|
+
// Whether IPC is enabled, based on the `ipc`, `ipcInput` and `gracefulCancel` options
|
|
1685
|
+
type HasIpc<OptionsType extends Options$1> = HasIpcOption<OptionsType['ipc'], 'ipcInput' extends keyof OptionsType ? OptionsType['ipcInput'] : undefined, 'gracefulCancel' extends keyof OptionsType ? OptionsType['gracefulCancel'] : undefined>;
|
|
1686
|
+
type HasIpcOption<IpcOption extends Options$1['ipc'], IpcInputOption extends Options$1['ipcInput'], GracefulCancelOption extends Options$1['gracefulCancel']> = IpcOption extends true ? true : IpcOption extends false ? false : IpcInputOption extends undefined ? GracefulCancelOption extends true ? true : false : true;
|
|
1687
|
+
//#endregion
|
|
1688
|
+
//#region ../../node_modules/execa/types/arguments/fd-options.d.ts
|
|
1689
|
+
type FileDescriptorOption = `fd${number}`;
|
|
1690
|
+
// `from` option of `subprocess.readable|duplex|iterable|pipe()`
|
|
1691
|
+
// Also used by fd-specific options
|
|
1692
|
+
type FromOption = 'stdout' | 'stderr' | 'all' | FileDescriptorOption;
|
|
1693
|
+
// `to` option of `subprocess.writable|duplex|pipe()`
|
|
1694
|
+
type ToOption = 'stdin' | FileDescriptorOption;
|
|
1695
|
+
//#endregion
|
|
1696
|
+
//#region ../../node_modules/execa/types/arguments/specific.d.ts
|
|
1697
|
+
// Options which can be fd-specific like `{verbose: {stdout: 'none', stderr: 'full'}}`
|
|
1698
|
+
type FdGenericOption<OptionType> = OptionType | GenericOptionObject<OptionType>;
|
|
1699
|
+
type GenericOptionObject<OptionType> = Readonly<Partial<Record<GenericFromOption, OptionType>>>;
|
|
1700
|
+
type GenericFromOption = FromOption | 'ipc';
|
|
1701
|
+
// Retrieve fd-specific option's value
|
|
1702
|
+
type FdSpecificOption<GenericOption extends FdGenericOption<unknown>, FdNumber extends string> = GenericOption extends GenericOptionObject<unknown> ? FdSpecificObjectOption<GenericOption, FdNumber> : GenericOption;
|
|
1703
|
+
type FdSpecificObjectOption<GenericOption extends GenericOptionObject<unknown>, FdNumber extends string> = keyof GenericOption extends GenericFromOption ? FdNumberToFromOption<FdNumber, keyof GenericOption> extends never ? undefined : GenericOption[FdNumberToFromOption<FdNumber, keyof GenericOption>] : GenericOption;
|
|
1704
|
+
type FdNumberToFromOption<FdNumber extends string, GenericOptionKeys extends GenericFromOption> = FdNumber extends 'ipc' ? 'ipc' extends GenericOptionKeys ? 'ipc' : never : FdNumber extends '1' ? 'stdout' extends GenericOptionKeys ? 'stdout' : 'fd1' extends GenericOptionKeys ? 'fd1' : 'all' extends GenericOptionKeys ? 'all' : never : FdNumber extends '2' ? 'stderr' extends GenericOptionKeys ? 'stderr' : 'fd2' extends GenericOptionKeys ? 'fd2' : 'all' extends GenericOptionKeys ? 'all' : never : `fd${FdNumber}` extends GenericOptionKeys ? `fd${FdNumber}` : never;
|
|
1705
|
+
//#endregion
|
|
1706
|
+
//#region ../../node_modules/execa/types/return/final-error.d.ts
|
|
1707
|
+
// `result.*` defined only on failure, i.e. on `error.*`
|
|
1708
|
+
type ErrorProperties = 'name' | 'message' | 'stack' | 'cause' | 'shortMessage' | 'originalMessage' | 'code';
|
|
1709
|
+
//#endregion
|
|
1710
|
+
//#region ../../node_modules/execa/types/stdio/array.d.ts
|
|
1711
|
+
// `options.stdio`, normalized as an array
|
|
1712
|
+
type StdioOptionNormalizedArray<OptionsType extends CommonOptions> = StdioOptionNormalized<OptionsType['stdio']>;
|
|
1713
|
+
type StdioOptionNormalized<StdioOption extends CommonOptions['stdio']> = StdioOption extends StdioOptionsArray ? StdioOption : StdioOption extends StdinOptionCommon ? StdioOption extends StdoutStderrOptionCommon ? readonly [StdioOption, StdioOption, StdioOption] : DefaultStdioOption : DefaultStdioOption;
|
|
1714
|
+
// `options.stdio` default value
|
|
1715
|
+
type DefaultStdioOption = readonly ['pipe', 'pipe', 'pipe'];
|
|
1716
|
+
//#endregion
|
|
1717
|
+
//#region ../../node_modules/execa/types/stdio/option.d.ts
|
|
1718
|
+
// `options.stdin|stdout|stderr|stdio` for a given file descriptor
|
|
1719
|
+
type FdStdioOption<FdNumber extends string, OptionsType extends CommonOptions> = FdStdioOptionProperty<FdNumber, OptionsType>;
|
|
1720
|
+
type FdStdioOptionProperty<FdNumber extends string, OptionsType extends CommonOptions> = string extends FdNumber ? StdioOptionCommon : FdNumber extends keyof StandardStreams ? StandardStreams[FdNumber] extends keyof OptionsType ? OptionsType[StandardStreams[FdNumber]] extends undefined ? FdStdioArrayOption<FdNumber, OptionsType> : OptionsType[StandardStreams[FdNumber]] : FdStdioArrayOption<FdNumber, OptionsType> : FdStdioArrayOption<FdNumber, OptionsType>;
|
|
1721
|
+
// `options.stdio[FdNumber]`, excluding `options.stdin|stdout|stderr`
|
|
1722
|
+
type FdStdioArrayOption<FdNumber extends string, OptionsType extends CommonOptions> = FdStdioArrayOptionProperty<FdNumber, StdioOptionNormalizedArray<OptionsType>>;
|
|
1723
|
+
type FdStdioArrayOptionProperty<FdNumber extends string, StdioOptionsType> = string extends FdNumber ? StdioOptionCommon | undefined : StdioOptionsType extends StdioOptionsArray ? FdNumber extends keyof StdioOptionsType ? StdioOptionsType[FdNumber] : StdioOptionNormalizedArray<CommonOptions> extends StdioOptionsType ? StdioOptionsType[number] : undefined : undefined;
|
|
1724
|
+
//#endregion
|
|
1725
|
+
//#region ../../node_modules/execa/types/transform/object-mode.d.ts
|
|
1726
|
+
// Whether a file descriptor is in object mode
|
|
1727
|
+
// I.e. whether `result.stdout|stderr|stdio|all` is an array of `unknown` due to `objectMode: true`
|
|
1728
|
+
type IsObjectFd<FdNumber extends string, OptionsType extends CommonOptions> = IsObjectStdioOption<FdStdioOption<FdNumber, OptionsType>>;
|
|
1729
|
+
type IsObjectStdioOption<StdioOptionType> = IsObjectStdioSingleOption<StdioSingleOptionItems<StdioOptionType>>;
|
|
1730
|
+
type IsObjectStdioSingleOption<StdioSingleOptionType> = StdioSingleOptionType extends TransformCommon ? BooleanObjectMode<StdioSingleOptionType['objectMode']> : StdioSingleOptionType extends DuplexTransform ? StdioSingleOptionType['transform']['readableObjectMode'] : false;
|
|
1731
|
+
type BooleanObjectMode<ObjectModeOption extends boolean | undefined> = ObjectModeOption extends true ? true : false;
|
|
1732
|
+
//#endregion
|
|
1733
|
+
//#region ../../node_modules/execa/types/stdio/direction.d.ts
|
|
1734
|
+
type AnyAmbiguousStdioOption = AmbiguousStdioOption<boolean, false, boolean>;
|
|
1735
|
+
type InputAmbiguousStdioOption = AnyAmbiguousStdioOption & {
|
|
1736
|
+
readonly input: true;
|
|
1737
|
+
};
|
|
1738
|
+
type AmbiguousStdioInputValue<StdioOptionType> = StdioOptionType extends AnyAmbiguousStdioOption ? AmbiguousStdioInputProperty<StdioOptionType> : never;
|
|
1739
|
+
type AmbiguousStdioInputProperty<StdioOptionType> = 'input' extends keyof StdioOptionType ? StdioOptionType extends {
|
|
1740
|
+
readonly input?: infer Input;
|
|
1741
|
+
} ? Input : never : never;
|
|
1742
|
+
// Whether `result.stdio[FdNumber]` is an input stream
|
|
1743
|
+
type IsInputFd<FdNumber extends string, OptionsType extends CommonOptions> = FdNumber extends '0' ? true : IsInputFdOption<FdNumber, StdioSingleOptionItems<FdStdioArrayOption<FdNumber, OptionsType>>>;
|
|
1744
|
+
type IsInputFdOption<FdNumber extends string, StdioOptionType> = Intersects<StdioOptionType, FdNumber extends '1' | '2' ? InputStdioOption : InputStdioOption | InputAmbiguousStdioOption> extends true ? true : FdNumber extends '1' | '2' ? false : true extends AmbiguousStdioInputValue<StdioOptionType> ? boolean : false;
|
|
1745
|
+
//#endregion
|
|
1746
|
+
//#region ../../node_modules/execa/types/return/ignore.d.ts
|
|
1747
|
+
// Whether `result.stdin|stdout|stderr|all|stdio[*]` is `undefined`
|
|
1748
|
+
type IgnoresResultOutput<FdNumber extends string, OptionsType extends CommonOptions> = FdSpecificOption<OptionsType['buffer'], FdNumber> extends false ? true : IgnoresResultOutputDirection<IsInputFd<FdNumber, OptionsType>, FdNumber, OptionsType>;
|
|
1749
|
+
type IgnoresResultOutputDirection<IsInput extends boolean, FdNumber extends string, OptionsType extends CommonOptions> = IsInput extends true ? true : IgnoresSubprocessOutput<FdNumber, OptionsType>;
|
|
1750
|
+
// Whether `subprocess.stdout|stderr|all` is `undefined|null`
|
|
1751
|
+
type IgnoresSubprocessOutput<FdNumber extends string, OptionsType extends CommonOptions> = IgnoresOutput<FdNumber, FdStdioOption<FdNumber, OptionsType>>;
|
|
1752
|
+
type IgnoresOutput<FdNumber extends string, StdioOptionType> = StdioOptionType extends NoStreamStdioOption<FdNumber> ? true : false;
|
|
1753
|
+
//#endregion
|
|
1754
|
+
//#region ../../node_modules/execa/types/arguments/encoding-option.d.ts
|
|
1755
|
+
type DefaultEncodingOption = 'utf8';
|
|
1756
|
+
type TextEncodingOption = DefaultEncodingOption | 'utf16le';
|
|
1757
|
+
type BufferEncodingOption = 'buffer';
|
|
1758
|
+
type BinaryEncodingOption = BufferEncodingOption | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii';
|
|
1759
|
+
// `options.encoding`
|
|
1760
|
+
type EncodingOption = TextEncodingOption | BinaryEncodingOption | undefined;
|
|
1761
|
+
//#endregion
|
|
1762
|
+
//#region ../../node_modules/execa/types/return/result-stdout.d.ts
|
|
1763
|
+
// `result.stdout|stderr|stdio`
|
|
1764
|
+
type ResultStdioNotAll<FdNumber extends string, OptionsType extends CommonOptions> = ResultStdio<FdNumber, FdNumber, FdNumber, OptionsType>;
|
|
1765
|
+
// `result.stdout|stderr|stdio|all`
|
|
1766
|
+
type ResultStdio<MainFdNumber extends string, ObjectFdNumber extends string, LinesFdNumber extends string, OptionsType extends CommonOptions> = ResultStdioProperty<ObjectFdNumber, LinesFdNumber, IgnoresResultOutput<MainFdNumber, OptionsType>, OptionsType>;
|
|
1767
|
+
type ResultStdioProperty<ObjectFdNumber extends string, LinesFdNumber extends string, StreamOutputIgnored, OptionsType extends CommonOptions> = StreamOutputIgnored extends true ? undefined : ResultStdioItem<IsObjectFd<ObjectFdNumber, OptionsType>, FdSpecificOption<OptionsType['lines'], LinesFdNumber>, OptionsType['encoding']>;
|
|
1768
|
+
type ResultStdioItem<IsObjectResult, LinesOption extends boolean | undefined, Encoding extends CommonOptions['encoding']> = IsObjectResult extends true ? unknown[] : Encoding extends BufferEncodingOption ? Uint8Array : LinesOption extends true ? Encoding extends BinaryEncodingOption ? string : string[] : string;
|
|
1769
|
+
//#endregion
|
|
1770
|
+
//#region ../../node_modules/execa/types/return/result-all.d.ts
|
|
1771
|
+
// `result.all`
|
|
1772
|
+
type ResultAll<OptionsType extends CommonOptions> = ResultAllProperty<OptionsType['all'], OptionsType>;
|
|
1773
|
+
type ResultAllProperty<AllOption extends CommonOptions['all'], OptionsType extends CommonOptions> = AllOption extends true ? ResultStdio<AllMainFd<OptionsType>, AllObjectFd<OptionsType>, AllLinesFd<OptionsType>, OptionsType> : undefined;
|
|
1774
|
+
type AllMainFd<OptionsType extends CommonOptions> = IgnoresResultOutput<'1', OptionsType> extends true ? '2' : '1';
|
|
1775
|
+
type AllObjectFd<OptionsType extends CommonOptions> = IsObjectFd<'1', OptionsType> extends true ? '1' : '2';
|
|
1776
|
+
type AllLinesFd<OptionsType extends CommonOptions> = FdSpecificOption<OptionsType['lines'], '1'> extends true ? '1' : '2';
|
|
1777
|
+
//#endregion
|
|
1778
|
+
//#region ../../node_modules/execa/types/return/result-stdio.d.ts
|
|
1779
|
+
// `result.stdio`
|
|
1780
|
+
type ResultStdioArray<OptionsType extends CommonOptions> = MapResultStdio<StdioOptionNormalizedArray<OptionsType>, OptionsType>;
|
|
1781
|
+
type MapResultStdio<StdioOptionsArrayType, OptionsType extends CommonOptions> = { -readonly [FdNumber in keyof StdioOptionsArrayType]: ResultStdioNotAll<FdNumber extends string ? FdNumber : string, OptionsType>; };
|
|
1782
|
+
//#endregion
|
|
1783
|
+
//#region ../../node_modules/execa/types/return/result-ipc.d.ts
|
|
1784
|
+
// `result.ipcOutput`
|
|
1785
|
+
// This is empty unless the `ipc` option is `true`.
|
|
1786
|
+
// Also, this is empty if the `buffer` option is `false`.
|
|
1787
|
+
type ResultIpcOutput<IsSync, OptionsType extends CommonOptions> = IsSync extends true ? [] : ResultIpcAsync<FdSpecificOption<OptionsType['buffer'], 'ipc'>, HasIpc<StricterOptions<OptionsType, Options$1>>, OptionsType['serialization']>;
|
|
1788
|
+
type ResultIpcAsync<BufferOption extends boolean | undefined, IpcEnabled extends boolean, SerializationOption extends CommonOptions['serialization']> = BufferOption extends false ? [] : IpcEnabled extends true ? Array<Message<SerializationOption>> : [];
|
|
1789
|
+
//#endregion
|
|
1790
|
+
//#region ../../node_modules/execa/types/return/result.d.ts
|
|
1791
|
+
declare abstract class CommonResult<IsSync extends boolean, OptionsType extends CommonOptions> {
|
|
1792
|
+
/**
|
|
1793
|
+
The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).
|
|
1365
1794
|
|
|
1366
|
-
|
|
1795
|
+
This is `undefined` if the `stdout` option is set to only `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.
|
|
1367
1796
|
|
|
1368
|
-
|
|
1797
|
+
This is an array if the `lines` option is `true`, or if the `stdout` option is a transform in object mode.
|
|
1798
|
+
*/
|
|
1799
|
+
stdout: ResultStdioNotAll<'1', OptionsType>;
|
|
1800
|
+
/**
|
|
1801
|
+
The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).
|
|
1369
1802
|
|
|
1370
|
-
|
|
1371
|
-
*/
|
|
1372
|
-
readonly execPath?: string;
|
|
1373
|
-
/**
|
|
1374
|
-
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.
|
|
1803
|
+
This is `undefined` if the `stderr` option is set to only `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.
|
|
1375
1804
|
|
|
1376
|
-
|
|
1805
|
+
This is an array if the `lines` option is `true`, or if the `stderr` option is a transform in object mode.
|
|
1806
|
+
*/
|
|
1807
|
+
stderr: ResultStdioNotAll<'2', OptionsType>;
|
|
1808
|
+
/**
|
|
1809
|
+
The output of the subprocess with `result.stdout` and `result.stderr` interleaved.
|
|
1377
1810
|
|
|
1378
|
-
|
|
1379
|
-
*/
|
|
1380
|
-
readonly buffer?: boolean;
|
|
1381
|
-
/**
|
|
1382
|
-
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
|
1811
|
+
This requires the `all` option to be `true`.
|
|
1383
1812
|
|
|
1384
|
-
|
|
1385
|
-
*/
|
|
1386
|
-
readonly stdin?: StdioOption;
|
|
1387
|
-
/**
|
|
1388
|
-
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
|
1813
|
+
This is `undefined` if both `stdout` and `stderr` options are set to only `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.
|
|
1389
1814
|
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1815
|
+
This is an array if the `lines` option is `true`, or if either the `stdout` or `stderr` option is a transform in object mode.
|
|
1816
|
+
*/
|
|
1817
|
+
all: ResultAll<OptionsType>;
|
|
1818
|
+
/**
|
|
1819
|
+
The output of the subprocess on `stdin`, `stdout`, `stderr` and other file descriptors.
|
|
1395
1820
|
|
|
1396
|
-
|
|
1397
|
-
*/
|
|
1398
|
-
readonly stderr?: StdioOption;
|
|
1399
|
-
/**
|
|
1400
|
-
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
|
1821
|
+
Items are `undefined` when their corresponding `stdio` option is set to only `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.
|
|
1401
1822
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1823
|
+
Items are arrays when their corresponding `stdio` option is a transform in object mode.
|
|
1824
|
+
*/
|
|
1825
|
+
stdio: ResultStdioArray<OptionsType>;
|
|
1826
|
+
/**
|
|
1827
|
+
All the messages sent by the subprocess to the current process.
|
|
1407
1828
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1829
|
+
This is empty unless the `ipc` option is `true`. Also, this is empty if the `buffer` option is `false`.
|
|
1830
|
+
*/
|
|
1831
|
+
ipcOutput: ResultIpcOutput<IsSync, OptionsType>;
|
|
1832
|
+
/**
|
|
1833
|
+
Results of the other subprocesses that were piped into this subprocess.
|
|
1413
1834
|
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1835
|
+
This array is initially empty and is populated each time the `subprocess.pipe()` method resolves.
|
|
1836
|
+
*/
|
|
1837
|
+
pipedFrom: Unless<IsSync, Result[], []>;
|
|
1838
|
+
/**
|
|
1839
|
+
The file and arguments that were run.
|
|
1840
|
+
*/
|
|
1841
|
+
command: string;
|
|
1842
|
+
/**
|
|
1843
|
+
Same as `command` but escaped.
|
|
1844
|
+
*/
|
|
1845
|
+
escapedCommand: string;
|
|
1846
|
+
/**
|
|
1847
|
+
The current directory in which the command was run.
|
|
1848
|
+
*/
|
|
1849
|
+
cwd: string;
|
|
1850
|
+
/**
|
|
1851
|
+
Duration of the subprocess, in milliseconds.
|
|
1852
|
+
*/
|
|
1853
|
+
durationMs: number;
|
|
1854
|
+
/**
|
|
1855
|
+
Whether the subprocess failed to run.
|
|
1419
1856
|
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1857
|
+
When this is `true`, the result is an `ExecaError` instance with additional error-related properties.
|
|
1858
|
+
*/
|
|
1859
|
+
failed: boolean;
|
|
1860
|
+
/**
|
|
1861
|
+
Whether the subprocess timed out due to the `timeout` option.
|
|
1862
|
+
*/
|
|
1863
|
+
timedOut: boolean;
|
|
1864
|
+
/**
|
|
1865
|
+
Whether the subprocess was canceled using the `cancelSignal` option.
|
|
1866
|
+
*/
|
|
1867
|
+
isCanceled: boolean;
|
|
1868
|
+
/**
|
|
1869
|
+
Whether the subprocess was canceled using both the `cancelSignal` and the `gracefulCancel` options.
|
|
1870
|
+
*/
|
|
1871
|
+
isGracefullyCanceled: boolean;
|
|
1872
|
+
/**
|
|
1873
|
+
Whether the subprocess failed because its output was larger than the `maxBuffer` option.
|
|
1874
|
+
*/
|
|
1875
|
+
isMaxBuffer: boolean;
|
|
1876
|
+
/**
|
|
1877
|
+
Whether the subprocess was terminated by a signal (like `SIGTERM`) sent by either:
|
|
1878
|
+
- The current process.
|
|
1879
|
+
- Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).
|
|
1880
|
+
*/
|
|
1881
|
+
isTerminated: boolean;
|
|
1882
|
+
/**
|
|
1883
|
+
Whether the subprocess was terminated by the `SIGKILL` signal sent by the `forceKillAfterDelay` option.
|
|
1884
|
+
*/
|
|
1885
|
+
isForcefullyTerminated: boolean;
|
|
1886
|
+
/**
|
|
1887
|
+
The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.
|
|
1425
1888
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1889
|
+
This is `undefined` when the subprocess could not be spawned or was terminated by a signal.
|
|
1890
|
+
*/
|
|
1891
|
+
exitCode?: number;
|
|
1892
|
+
/**
|
|
1893
|
+
The name of the signal (like `SIGTERM`) that terminated the subprocess, sent by either:
|
|
1894
|
+
- The current process.
|
|
1895
|
+
- Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).
|
|
1431
1896
|
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
*/
|
|
1438
|
-
readonly argv0?: string;
|
|
1439
|
-
/**
|
|
1440
|
-
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
|
1897
|
+
If a signal terminated the subprocess, this property is defined and included in the error message. Otherwise it is `undefined`.
|
|
1898
|
+
*/
|
|
1899
|
+
signal?: keyof SignalConstants;
|
|
1900
|
+
/**
|
|
1901
|
+
A human-friendly description of the signal that was used to terminate the subprocess.
|
|
1441
1902
|
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1903
|
+
If a signal terminated the subprocess, 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.
|
|
1904
|
+
*/
|
|
1905
|
+
signalDescription?: string;
|
|
1906
|
+
/**
|
|
1907
|
+
Error message when the subprocess failed to run.
|
|
1908
|
+
*/
|
|
1909
|
+
message?: string;
|
|
1910
|
+
/**
|
|
1911
|
+
This is the same as `error.message` except it does not include the subprocess output.
|
|
1912
|
+
*/
|
|
1913
|
+
shortMessage?: string;
|
|
1914
|
+
/**
|
|
1915
|
+
Original error message. This is the same as `error.message` excluding the subprocess output and some additional information added by Execa.
|
|
1449
1916
|
|
|
1450
|
-
|
|
1917
|
+
This exists only in specific instances, such as during a timeout.
|
|
1918
|
+
*/
|
|
1919
|
+
originalMessage?: string;
|
|
1920
|
+
/**
|
|
1921
|
+
Underlying error, if there is one. For example, this is set by `subprocess.kill(error)`.
|
|
1451
1922
|
|
|
1452
|
-
|
|
1923
|
+
This is usually an `Error` instance.
|
|
1924
|
+
*/
|
|
1925
|
+
cause?: unknown;
|
|
1926
|
+
/**
|
|
1927
|
+
Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.
|
|
1928
|
+
*/
|
|
1929
|
+
code?: string;
|
|
1930
|
+
// We cannot `extend Error` because `message` must be optional. So we copy its types here.
|
|
1931
|
+
readonly name?: Error['name'];
|
|
1932
|
+
stack?: Error['stack'];
|
|
1933
|
+
}
|
|
1934
|
+
type SuccessResult<IsSync extends boolean = boolean, OptionsType extends CommonOptions = CommonOptions> = InstanceType<typeof CommonResult<IsSync, OptionsType>> & OmitErrorIfReject<OptionsType['reject']>;
|
|
1935
|
+
type OmitErrorIfReject<RejectOption extends CommonOptions['reject']> = Record<ErrorProperties, RejectOption extends false ? unknown : never>;
|
|
1936
|
+
/**
|
|
1937
|
+
Result of a subprocess successful execution.
|
|
1453
1938
|
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1939
|
+
When the subprocess fails, it is rejected with an `ExecaError` instead.
|
|
1940
|
+
*/
|
|
1941
|
+
type Result<OptionsType extends Options$1 = Options$1> = SuccessResult<false, OptionsType>;
|
|
1942
|
+
/**
|
|
1943
|
+
Result of a subprocess successful execution.
|
|
1459
1944
|
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1945
|
+
When the subprocess fails, it is rejected with an `ExecaError` instead.
|
|
1946
|
+
*/
|
|
1947
|
+
type SyncResult<OptionsType extends SyncOptions = SyncOptions> = SuccessResult<true, OptionsType>;
|
|
1948
|
+
//#endregion
|
|
1949
|
+
//#region ../../node_modules/execa/types/verbose.d.ts
|
|
1950
|
+
type VerboseOption = FdGenericOption<'none' | 'short' | 'full' | VerboseFunction>;
|
|
1951
|
+
type VerboseFunction = (verboseLine: string, verboseObject: MinimalVerboseObject) => string | void;
|
|
1952
|
+
type GenericVerboseObject = {
|
|
1953
|
+
/**
|
|
1954
|
+
Event type. This can be:
|
|
1955
|
+
- `'command'`: subprocess start
|
|
1956
|
+
- `'output'`: `stdout`/`stderr` output
|
|
1957
|
+
- `'ipc'`: IPC output
|
|
1958
|
+
- `'error'`: subprocess failure
|
|
1959
|
+
- `'duration'`: subprocess success or failure
|
|
1960
|
+
*/
|
|
1961
|
+
type: 'command' | 'output' | 'ipc' | 'error' | 'duration';
|
|
1962
|
+
/**
|
|
1963
|
+
Depending on `verboseObject.type`, this is:
|
|
1964
|
+
- `'command'`: the `result.escapedCommand`
|
|
1965
|
+
- `'output'`: one line from `result.stdout` or `result.stderr`
|
|
1966
|
+
- `'ipc'`: one IPC message from `result.ipcOutput`
|
|
1967
|
+
- `'error'`: the `error.shortMessage`
|
|
1968
|
+
- `'duration'`: the `result.durationMs`
|
|
1969
|
+
*/
|
|
1970
|
+
message: string;
|
|
1971
|
+
/**
|
|
1972
|
+
The file and arguments that were run. This is the same as `result.escapedCommand`.
|
|
1973
|
+
*/
|
|
1974
|
+
escapedCommand: string;
|
|
1975
|
+
/**
|
|
1976
|
+
Serial number identifying the subprocess within the current process. It is incremented from `'0'`.
|
|
1473
1977
|
|
|
1474
|
-
|
|
1475
|
-
- not cross-platform, encouraging shell-specific syntax.
|
|
1476
|
-
- slower, because of the additional shell interpretation.
|
|
1477
|
-
- unsafe, potentially allowing command injection.
|
|
1978
|
+
This is helpful when multiple subprocesses are running at the same time.
|
|
1478
1979
|
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1980
|
+
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.
|
|
1981
|
+
*/
|
|
1982
|
+
commandId: string;
|
|
1983
|
+
/**
|
|
1984
|
+
Event date/time.
|
|
1985
|
+
*/
|
|
1986
|
+
timestamp: Date;
|
|
1987
|
+
/**
|
|
1988
|
+
Whether another subprocess is piped into this subprocess. This is `false` when `result.pipedFrom` is empty.
|
|
1989
|
+
*/
|
|
1990
|
+
piped: boolean;
|
|
1991
|
+
};
|
|
1992
|
+
type MinimalVerboseObject = GenericVerboseObject & {
|
|
1993
|
+
// We cannot use the `CommonOptions` type because it would make this type recursive
|
|
1994
|
+
options: object;
|
|
1995
|
+
result?: never;
|
|
1996
|
+
};
|
|
1997
|
+
//#endregion
|
|
1998
|
+
//#region ../../node_modules/execa/types/arguments/options.d.ts
|
|
1999
|
+
type ChunkForEncoding<Encoding extends EncodingOption> = Encoding extends BinaryEncodingOption ? Uint8Array : string;
|
|
2000
|
+
type CommonOptions<IsSync extends boolean = boolean, Encoding extends EncodingOption = EncodingOption> = {
|
|
2001
|
+
/**
|
|
2002
|
+
Prefer locally installed binaries when looking for a binary to execute.
|
|
1484
2003
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
2004
|
+
@default `true` with `$`, `false` otherwise
|
|
2005
|
+
*/
|
|
2006
|
+
readonly preferLocal?: boolean;
|
|
2007
|
+
/**
|
|
2008
|
+
Preferred path to find locally installed binaries, when using the `preferLocal` option.
|
|
1490
2009
|
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
2010
|
+
@default `cwd` option
|
|
2011
|
+
*/
|
|
2012
|
+
readonly localDir?: string | URL;
|
|
2013
|
+
/**
|
|
2014
|
+
If `true`, runs with Node.js. The first argument must be a Node.js file.
|
|
1496
2015
|
|
|
1497
|
-
|
|
1498
|
-
*/
|
|
1499
|
-
readonly maxBuffer?: number;
|
|
1500
|
-
/**
|
|
1501
|
-
Signal value to be used when the spawned process will be killed.
|
|
2016
|
+
The subprocess inherits the current Node.js [CLI flags](https://nodejs.org/api/cli.html#options) and version. This can be overridden using the `nodeOptions` and `nodePath` options.
|
|
1502
2017
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
2018
|
+
@default `true` with `execaNode()`, `false` otherwise
|
|
2019
|
+
*/
|
|
2020
|
+
readonly node?: boolean;
|
|
2021
|
+
/**
|
|
2022
|
+
List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
|
|
1508
2023
|
|
|
1509
|
-
|
|
1510
|
-
*/
|
|
1511
|
-
readonly windowsVerbatimArguments?: boolean;
|
|
1512
|
-
/**
|
|
1513
|
-
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.
|
|
2024
|
+
Requires the `node` option to be `true`.
|
|
1514
2025
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
/**
|
|
1521
|
-
Write some input to the `stdin` of your binary.
|
|
1522
|
-
*/
|
|
1523
|
-
readonly input?: string | Buffer | Readable;
|
|
1524
|
-
}
|
|
1525
|
-
interface SyncOptions<EncodingType = string> extends CommonOptions<EncodingType> {
|
|
1526
|
-
/**
|
|
1527
|
-
Write some input to the `stdin` of your binary.
|
|
1528
|
-
*/
|
|
1529
|
-
readonly input?: string | Buffer;
|
|
1530
|
-
}
|
|
1531
|
-
interface NodeOptions<EncodingType = string> extends Options<EncodingType> {
|
|
1532
|
-
/**
|
|
1533
|
-
The Node.js executable to use.
|
|
2026
|
+
@default [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI flags)
|
|
2027
|
+
*/
|
|
2028
|
+
readonly nodeOptions?: readonly string[];
|
|
2029
|
+
/**
|
|
2030
|
+
Path to the Node.js executable.
|
|
1534
2031
|
|
|
1535
|
-
|
|
1536
|
-
*/
|
|
1537
|
-
readonly nodePath?: string;
|
|
1538
|
-
/**
|
|
1539
|
-
List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
|
|
2032
|
+
Requires the `node` option to be `true`.
|
|
1540
2033
|
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
/**
|
|
1547
|
-
The file and arguments that were run, for logging purposes.
|
|
2034
|
+
@default [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)
|
|
2035
|
+
*/
|
|
2036
|
+
readonly nodePath?: string | URL;
|
|
2037
|
+
/**
|
|
2038
|
+
If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).
|
|
1548
2039
|
|
|
1549
|
-
|
|
1550
|
-
*/
|
|
1551
|
-
command: string;
|
|
1552
|
-
/**
|
|
1553
|
-
Same as `command` but escaped.
|
|
2040
|
+
Uses [`/bin/sh`](https://en.wikipedia.org/wiki/Unix_shell) on UNIX and [`cmd.exe`](https://en.wikipedia.org/wiki/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.
|
|
1554
2041
|
|
|
1555
|
-
|
|
1556
|
-
Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execa.command()`.
|
|
1557
|
-
*/
|
|
1558
|
-
escapedCommand: string;
|
|
1559
|
-
/**
|
|
1560
|
-
The numeric exit code of the process that was run.
|
|
1561
|
-
*/
|
|
1562
|
-
exitCode: number;
|
|
1563
|
-
/**
|
|
1564
|
-
The output of the process on stdout.
|
|
1565
|
-
*/
|
|
1566
|
-
stdout: StdoutStderrType;
|
|
1567
|
-
/**
|
|
1568
|
-
The output of the process on stderr.
|
|
1569
|
-
*/
|
|
1570
|
-
stderr: StdoutStderrType;
|
|
1571
|
-
/**
|
|
1572
|
-
Whether the process failed to run.
|
|
1573
|
-
*/
|
|
1574
|
-
failed: boolean;
|
|
1575
|
-
/**
|
|
1576
|
-
Whether the process timed out.
|
|
1577
|
-
*/
|
|
1578
|
-
timedOut: boolean;
|
|
1579
|
-
/**
|
|
1580
|
-
Whether the process was killed.
|
|
1581
|
-
*/
|
|
1582
|
-
killed: boolean;
|
|
1583
|
-
/**
|
|
1584
|
-
The name of the signal that was used to terminate the process. For example, `SIGFPE`.
|
|
2042
|
+
We recommend against using this option.
|
|
1585
2043
|
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
2044
|
+
@default false
|
|
2045
|
+
*/
|
|
2046
|
+
readonly shell?: boolean | string | URL;
|
|
2047
|
+
/**
|
|
2048
|
+
Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.
|
|
1591
2049
|
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
2050
|
+
This is also used to resolve the `nodePath` option when it is a relative path.
|
|
2051
|
+
|
|
2052
|
+
@default process.cwd()
|
|
2053
|
+
*/
|
|
2054
|
+
readonly cwd?: string | URL;
|
|
1597
2055
|
/**
|
|
1598
|
-
|
|
2056
|
+
[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).
|
|
2057
|
+
|
|
2058
|
+
Unless the `extendEnv` option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).
|
|
1599
2059
|
|
|
1600
|
-
|
|
1601
|
-
- its exit code is not `0`
|
|
1602
|
-
- it was killed with a signal
|
|
1603
|
-
- timing out
|
|
1604
|
-
- being canceled
|
|
1605
|
-
- there's not enough memory or there are already too many child processes
|
|
2060
|
+
@default [process.env](https://nodejs.org/api/process.html#processenv)
|
|
1606
2061
|
*/
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
2062
|
+
readonly env?: Readonly<Partial<Record<string, string>>>;
|
|
2063
|
+
/**
|
|
2064
|
+
If `true`, the subprocess uses both the `env` option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).
|
|
2065
|
+
If `false`, only the `env` option is used, not `process.env`.
|
|
1610
2066
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
/**
|
|
1617
|
-
Whether the process was canceled.
|
|
1618
|
-
*/
|
|
1619
|
-
isCanceled: boolean;
|
|
1620
|
-
}
|
|
1621
|
-
interface ExecaSyncError<StdoutErrorType = string> extends Error, ExecaReturnBase<StdoutErrorType> {
|
|
1622
|
-
/**
|
|
1623
|
-
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.
|
|
2067
|
+
@default true
|
|
2068
|
+
*/
|
|
2069
|
+
readonly extendEnv?: boolean;
|
|
2070
|
+
/**
|
|
2071
|
+
Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).
|
|
1624
2072
|
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
*/
|
|
1631
|
-
shortMessage: string;
|
|
1632
|
-
/**
|
|
1633
|
-
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.
|
|
2073
|
+
See also the `inputFile` and `stdin` options.
|
|
2074
|
+
*/
|
|
2075
|
+
readonly input?: string | Uint8Array | Readable;
|
|
2076
|
+
/**
|
|
2077
|
+
Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).
|
|
1634
2078
|
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
/**
|
|
1641
|
-
The output of the process with `stdout` and `stderr` interleaved.
|
|
2079
|
+
See also the `input` and `stdin` options.
|
|
2080
|
+
*/
|
|
2081
|
+
readonly inputFile?: string | URL;
|
|
2082
|
+
/**
|
|
2083
|
+
How to setup the subprocess' [standard input](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be `'pipe'`, `'overlapped'`, `'ignore`, `'inherit'`, a file descriptor integer, a Node.js `Readable` stream, a web `ReadableStream`, a `{ file: 'path' }` object, a file URL, an `Iterable`, an `AsyncIterable`, an `Uint8Array`, a generator function, a `Duplex` or a web `TransformStream`.
|
|
1642
2084
|
|
|
1643
|
-
|
|
1644
|
-
- the `all` option is `false` (default value)
|
|
1645
|
-
- `execa.sync()` was used
|
|
1646
|
-
*/
|
|
1647
|
-
all?: StdoutErrorType;
|
|
1648
|
-
/**
|
|
1649
|
-
Whether the process was canceled.
|
|
1650
|
-
*/
|
|
1651
|
-
isCanceled: boolean;
|
|
1652
|
-
}
|
|
1653
|
-
interface KillOptions {
|
|
1654
|
-
/**
|
|
1655
|
-
Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
|
|
2085
|
+
This can be an array of values such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.
|
|
1656
2086
|
|
|
1657
|
-
|
|
2087
|
+
@default `'inherit'` with `$`, `'pipe'` otherwise
|
|
2088
|
+
*/
|
|
2089
|
+
readonly stdin?: StdinOptionCommon<IsSync, boolean, ChunkForEncoding<Encoding>>;
|
|
2090
|
+
/**
|
|
2091
|
+
How to setup the subprocess' [standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be `'pipe'`, `'overlapped'`, `'ignore`, `'inherit'`, a file descriptor integer, a Node.js `Writable` stream, a web `WritableStream`, a `{ file: 'path' }` object, a file URL, a generator function, a `Duplex` or a web `TransformStream`.
|
|
1658
2092
|
|
|
1659
|
-
|
|
1660
|
-
*/
|
|
1661
|
-
forceKillAfterTimeout?: number | false;
|
|
1662
|
-
}
|
|
1663
|
-
interface ExecaChildPromise<StdoutErrorType> {
|
|
1664
|
-
/**
|
|
1665
|
-
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).
|
|
2093
|
+
This can be an array of values such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.
|
|
1666
2094
|
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`.
|
|
1679
|
-
*/
|
|
1680
|
-
cancel(): void;
|
|
1681
|
-
}
|
|
1682
|
-
type ExecaChildProcess<StdoutErrorType = string> = ChildProcess & ExecaChildPromise<StdoutErrorType> & Promise<ExecaReturnValue<StdoutErrorType>>;
|
|
1683
|
-
}
|
|
1684
|
-
declare const execa: {
|
|
2095
|
+
@default 'pipe'
|
|
2096
|
+
*/
|
|
2097
|
+
readonly stdout?: StdoutStderrOptionCommon<IsSync, boolean, ChunkForEncoding<Encoding>>;
|
|
2098
|
+
/**
|
|
2099
|
+
How to setup the subprocess' [standard error](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be `'pipe'`, `'overlapped'`, `'ignore`, `'inherit'`, a file descriptor integer, a Node.js `Writable` stream, a web `WritableStream`, a `{ file: 'path' }` object, a file URL, a generator function, a `Duplex` or a web `TransformStream`.
|
|
2100
|
+
|
|
2101
|
+
This can be an array of values such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.
|
|
2102
|
+
|
|
2103
|
+
@default 'pipe'
|
|
2104
|
+
*/
|
|
2105
|
+
readonly stderr?: StdoutStderrOptionCommon<IsSync, boolean, ChunkForEncoding<Encoding>>;
|
|
1685
2106
|
/**
|
|
1686
|
-
|
|
2107
|
+
Like the `stdin`, `stdout` and `stderr` options but for all [file descriptors](https://en.wikipedia.org/wiki/File_descriptor) at once. For example, `{stdio: ['ignore', 'pipe', 'pipe']}` is the same as `{stdin: 'ignore', stdout: 'pipe', stderr: 'pipe'}`.
|
|
1687
2108
|
|
|
1688
|
-
|
|
2109
|
+
A single string can be used as a shortcut.
|
|
1689
2110
|
|
|
1690
|
-
|
|
1691
|
-
@param arguments - Arguments to pass to `file` on execution.
|
|
1692
|
-
@returns A [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.
|
|
2111
|
+
The array can have more than 3 items, to create additional file descriptors beyond `stdin`/`stdout`/`stderr`.
|
|
1693
2112
|
|
|
1694
|
-
@
|
|
1695
|
-
|
|
1696
|
-
|
|
2113
|
+
@default 'pipe'
|
|
2114
|
+
*/
|
|
2115
|
+
readonly stdio?: StdioOptionsProperty<IsSync, ChunkForEncoding<Encoding>>;
|
|
2116
|
+
/**
|
|
2117
|
+
Add a `subprocess.all` stream and a `result.all` property. They contain the combined/interleaved output of the subprocess' `stdout` and `stderr`.
|
|
1697
2118
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
2119
|
+
@default false
|
|
2120
|
+
*/
|
|
2121
|
+
readonly all?: boolean;
|
|
2122
|
+
/**
|
|
2123
|
+
If the subprocess outputs text, specifies its character encoding, either [`'utf8'`](https://en.wikipedia.org/wiki/UTF-8) or [`'utf16le'`](https://en.wikipedia.org/wiki/UTF-16).
|
|
1702
2124
|
|
|
1703
|
-
|
|
2125
|
+
If it outputs binary data instead, this should be either:
|
|
2126
|
+
- `'buffer'`: returns the binary output as an `Uint8Array`.
|
|
2127
|
+
- [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#RFC_4648), [`'latin1'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) or [`'ascii'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings): encodes the binary output as a string.
|
|
1704
2128
|
|
|
1705
|
-
|
|
2129
|
+
The output is available with `result.stdout`, `result.stderr` and `result.stdio`.
|
|
1706
2130
|
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
2131
|
+
@default 'utf8'
|
|
2132
|
+
*/
|
|
2133
|
+
readonly encoding?: Encoding;
|
|
2134
|
+
/**
|
|
2135
|
+
Set `result.stdout`, `result.stderr`, `result.all` and `result.stdio` as arrays of strings, splitting the subprocess' output into lines.
|
|
1710
2136
|
|
|
1711
|
-
|
|
1712
|
-
await subprocess;
|
|
1713
|
-
} catch (error) {
|
|
1714
|
-
console.log(subprocess.killed); // true
|
|
1715
|
-
console.log(error.isCanceled); // true
|
|
1716
|
-
}
|
|
1717
|
-
})();
|
|
2137
|
+
This cannot be used if the `encoding` option is binary.
|
|
1718
2138
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
2139
|
+
By default, this applies to both `stdout` and `stderr`, but different values can also be passed.
|
|
2140
|
+
|
|
2141
|
+
@default false
|
|
2142
|
+
*/
|
|
2143
|
+
readonly lines?: FdGenericOption<boolean>;
|
|
2144
|
+
/**
|
|
2145
|
+
Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
|
|
2146
|
+
|
|
2147
|
+
If the `lines` option is true, this applies to each output line instead.
|
|
2148
|
+
|
|
2149
|
+
By default, this applies to both `stdout` and `stderr`, but different values can also be passed.
|
|
2150
|
+
|
|
2151
|
+
@default true
|
|
2152
|
+
*/
|
|
2153
|
+
readonly stripFinalNewline?: FdGenericOption<boolean>;
|
|
2154
|
+
/**
|
|
2155
|
+
Largest amount of data allowed on `stdout`, `stderr` and `stdio`.
|
|
2156
|
+
|
|
2157
|
+
By default, this applies to both `stdout` and `stderr`, but different values can also be passed.
|
|
2158
|
+
|
|
2159
|
+
When reached, `error.isMaxBuffer` becomes `true`.
|
|
2160
|
+
|
|
2161
|
+
@default 100_000_000
|
|
2162
|
+
*/
|
|
2163
|
+
readonly maxBuffer?: FdGenericOption<number>;
|
|
2164
|
+
/**
|
|
2165
|
+
When `buffer` is `false`, the `result.stdout`, `result.stderr`, `result.all` and `result.stdio` properties are not set.
|
|
2166
|
+
|
|
2167
|
+
By default, this applies to both `stdout` and `stderr`, but different values can also be passed.
|
|
2168
|
+
|
|
2169
|
+
@default true
|
|
2170
|
+
*/
|
|
2171
|
+
readonly buffer?: FdGenericOption<boolean>;
|
|
2172
|
+
/**
|
|
2173
|
+
Enables exchanging messages with the subprocess using `subprocess.sendMessage(message)`, `subprocess.getOneMessage()` and `subprocess.getEachMessage()`.
|
|
2174
|
+
|
|
2175
|
+
The subprocess must be a Node.js file.
|
|
2176
|
+
|
|
2177
|
+
@default `true` if the `node`, `ipcInput` or `gracefulCancel` option is set, `false` otherwise
|
|
2178
|
+
*/
|
|
2179
|
+
readonly ipc?: Unless<IsSync, boolean>;
|
|
2180
|
+
/**
|
|
2181
|
+
Specify the kind of serialization used for sending messages between subprocesses when using the `ipc` option.
|
|
2182
|
+
|
|
2183
|
+
@default 'advanced'
|
|
2184
|
+
*/
|
|
2185
|
+
readonly serialization?: Unless<IsSync, 'json' | 'advanced'>;
|
|
2186
|
+
/**
|
|
2187
|
+
Sends an IPC message when the subprocess starts.
|
|
2188
|
+
|
|
2189
|
+
The subprocess must be a Node.js file. The value's type depends on the `serialization` option.
|
|
1722
2190
|
*/
|
|
1723
|
-
|
|
1724
|
-
(file: string, arguments?: readonly string[], options?: execa.Options<null>): execa.ExecaChildProcess<Buffer>;
|
|
1725
|
-
(file: string, options?: execa.Options): execa.ExecaChildProcess;
|
|
1726
|
-
(file: string, options?: execa.Options<null>): execa.ExecaChildProcess<Buffer>;
|
|
2191
|
+
readonly ipcInput?: Unless<IsSync, Message>;
|
|
1727
2192
|
/**
|
|
1728
|
-
|
|
2193
|
+
If `verbose` is `'short'`, prints the command on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)): its file, arguments, duration and (if it failed) error message.
|
|
2194
|
+
|
|
2195
|
+
If `verbose` is `'full'` or a function, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)), `stderr` and IPC messages are also printed.
|
|
2196
|
+
|
|
2197
|
+
A function can be passed to customize logging.
|
|
2198
|
+
|
|
2199
|
+
By default, this applies to both `stdout` and `stderr`, but different values can also be passed.
|
|
1729
2200
|
|
|
1730
|
-
|
|
2201
|
+
@default 'none'
|
|
2202
|
+
*/
|
|
2203
|
+
readonly verbose?: VerboseOption;
|
|
2204
|
+
/**
|
|
2205
|
+
Setting this to `false` resolves the result's promise with the error instead of rejecting it.
|
|
1731
2206
|
|
|
1732
|
-
@
|
|
1733
|
-
@param arguments - Arguments to pass to `file` on execution.
|
|
1734
|
-
@returns A result `Object` with `stdout` and `stderr` properties.
|
|
2207
|
+
@default true
|
|
1735
2208
|
*/
|
|
1736
|
-
|
|
1737
|
-
sync(file: string, arguments?: readonly string[], options?: execa.SyncOptions<null>): execa.ExecaSyncReturnValue<Buffer>;
|
|
1738
|
-
sync(file: string, options?: execa.SyncOptions): execa.ExecaSyncReturnValue;
|
|
1739
|
-
sync(file: string, options?: execa.SyncOptions<null>): execa.ExecaSyncReturnValue<Buffer>;
|
|
2209
|
+
readonly reject?: boolean;
|
|
1740
2210
|
/**
|
|
1741
|
-
|
|
2211
|
+
If `timeout` is greater than `0`, the subprocess will be terminated if it runs for longer than that amount of milliseconds.
|
|
1742
2212
|
|
|
1743
|
-
|
|
2213
|
+
On timeout, `error.timedOut` becomes `true`.
|
|
1744
2214
|
|
|
1745
|
-
|
|
2215
|
+
@default 0
|
|
2216
|
+
*/
|
|
2217
|
+
readonly timeout?: number;
|
|
2218
|
+
/**
|
|
2219
|
+
When the `cancelSignal` is [aborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort), terminate the subprocess using a `SIGTERM` signal.
|
|
1746
2220
|
|
|
1747
|
-
|
|
1748
|
-
@returns A [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.
|
|
2221
|
+
When aborted, `error.isCanceled` becomes `true`.
|
|
1749
2222
|
|
|
1750
2223
|
@example
|
|
1751
2224
|
```
|
|
1752
|
-
import
|
|
2225
|
+
import {execaNode} from 'execa';
|
|
1753
2226
|
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
2227
|
+
const controller = new AbortController();
|
|
2228
|
+
const cancelSignal = controller.signal;
|
|
2229
|
+
|
|
2230
|
+
setTimeout(() => {
|
|
2231
|
+
controller.abort();
|
|
2232
|
+
}, 5000);
|
|
2233
|
+
|
|
2234
|
+
try {
|
|
2235
|
+
await execaNode({cancelSignal})`build.js`;
|
|
2236
|
+
} catch (error) {
|
|
2237
|
+
if (error.isCanceled) {
|
|
2238
|
+
console.error('Canceled by cancelSignal.');
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
throw error;
|
|
2242
|
+
}
|
|
1759
2243
|
```
|
|
1760
2244
|
*/
|
|
1761
|
-
|
|
1762
|
-
|
|
2245
|
+
readonly cancelSignal?: Unless<IsSync, AbortSignal>;
|
|
2246
|
+
/**
|
|
2247
|
+
When the `cancelSignal` option is [aborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort), do not send any `SIGTERM`. Instead, abort the [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) returned by `getCancelSignal()`. The subprocess should use it to terminate gracefully.
|
|
2248
|
+
|
|
2249
|
+
The subprocess must be a Node.js file.
|
|
2250
|
+
|
|
2251
|
+
When aborted, `error.isGracefullyCanceled` becomes `true`.
|
|
2252
|
+
|
|
2253
|
+
@default false
|
|
2254
|
+
*/
|
|
2255
|
+
readonly gracefulCancel?: Unless<IsSync, boolean>;
|
|
2256
|
+
/**
|
|
2257
|
+
If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).
|
|
2258
|
+
|
|
2259
|
+
When this happens, `error.isForcefullyTerminated` becomes `true`.
|
|
2260
|
+
|
|
2261
|
+
@default 5000
|
|
2262
|
+
*/
|
|
2263
|
+
readonly forceKillAfterDelay?: Unless<IsSync, number | boolean>;
|
|
2264
|
+
/**
|
|
2265
|
+
Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.
|
|
2266
|
+
|
|
2267
|
+
This can be either a name (like `'SIGTERM'`) or a number (like `9`).
|
|
2268
|
+
|
|
2269
|
+
@default 'SIGTERM'
|
|
2270
|
+
*/
|
|
2271
|
+
readonly killSignal?: keyof SignalConstants | number;
|
|
2272
|
+
/**
|
|
2273
|
+
Run the subprocess independently from the current process.
|
|
2274
|
+
|
|
2275
|
+
@default false
|
|
2276
|
+
*/
|
|
2277
|
+
readonly detached?: Unless<IsSync, boolean>;
|
|
2278
|
+
/**
|
|
2279
|
+
Kill the subprocess when the current process exits.
|
|
2280
|
+
|
|
2281
|
+
@default true
|
|
2282
|
+
*/
|
|
2283
|
+
readonly cleanup?: Unless<IsSync, boolean>;
|
|
2284
|
+
/**
|
|
2285
|
+
When the subprocess is terminated by Execa, also terminate all of its descendant processes, instead of only the subprocess itself.
|
|
2286
|
+
|
|
2287
|
+
This is useful when the subprocess spawns its own processes, such as when using the `shell` option.
|
|
2288
|
+
|
|
2289
|
+
On Unix, this spawns the subprocess in its own [process group](https://en.wikipedia.org/wiki/Process_group). On Windows, this uses [`taskkill`](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/taskkill).
|
|
2290
|
+
|
|
2291
|
+
This is best-effort: descendant processes that create their own process group or session are not terminated.
|
|
2292
|
+
|
|
2293
|
+
@default false
|
|
2294
|
+
*/
|
|
2295
|
+
readonly killDescendants?: Unless<IsSync, boolean>;
|
|
2296
|
+
/**
|
|
2297
|
+
Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.
|
|
2298
|
+
|
|
2299
|
+
@default current user identifier
|
|
2300
|
+
*/
|
|
2301
|
+
readonly uid?: number;
|
|
2302
|
+
/**
|
|
2303
|
+
Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.
|
|
2304
|
+
|
|
2305
|
+
@default current group identifier
|
|
2306
|
+
*/
|
|
2307
|
+
readonly gid?: number;
|
|
2308
|
+
/**
|
|
2309
|
+
Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.
|
|
2310
|
+
|
|
2311
|
+
@default file being executed
|
|
2312
|
+
*/
|
|
2313
|
+
readonly argv0?: string;
|
|
2314
|
+
/**
|
|
2315
|
+
On Windows, do not create a new console window.
|
|
2316
|
+
|
|
2317
|
+
@default true
|
|
2318
|
+
*/
|
|
2319
|
+
readonly windowsHide?: boolean;
|
|
2320
|
+
/**
|
|
2321
|
+
If `false`, escapes the command arguments on Windows.
|
|
2322
|
+
|
|
2323
|
+
@default `true` if the `shell` option is `true`, `false` otherwise
|
|
2324
|
+
*/
|
|
2325
|
+
readonly windowsVerbatimArguments?: boolean;
|
|
2326
|
+
};
|
|
2327
|
+
/**
|
|
2328
|
+
Subprocess options.
|
|
2329
|
+
|
|
2330
|
+
Some options are related to the subprocess output: `verbose`, `lines`, `stripFinalNewline`, `buffer`, `maxBuffer`. By default, those options apply to all file descriptors (`stdout`, `stderr`, etc.). A plain object can be passed instead to apply them to only `stdout`, `stderr`, `all` (both stdout and stderr), `ipc`, `fd3`, etc.
|
|
2331
|
+
|
|
2332
|
+
@example
|
|
2333
|
+
|
|
2334
|
+
```
|
|
2335
|
+
// Same value for stdout and stderr
|
|
2336
|
+
await execa({verbose: 'full'})`npm run build`;
|
|
2337
|
+
|
|
2338
|
+
// Different values for stdout and stderr
|
|
2339
|
+
await execa({verbose: {stdout: 'none', stderr: 'full'}})`npm run build`;
|
|
2340
|
+
```
|
|
2341
|
+
*/
|
|
2342
|
+
type TextOptions<IsSync extends boolean> = CommonOptions<IsSync, TextEncodingOption | undefined>;
|
|
2343
|
+
type BinaryOptions<IsSync extends boolean> = Omit<CommonOptions<IsSync, BinaryEncodingOption>, 'encoding'> & {
|
|
2344
|
+
readonly encoding: BinaryEncodingOption;
|
|
2345
|
+
};
|
|
2346
|
+
type Options$1 = TextOptions<false> | BinaryOptions<false>;
|
|
2347
|
+
/**
|
|
2348
|
+
Subprocess options, with synchronous methods.
|
|
2349
|
+
|
|
2350
|
+
Some options are related to the subprocess output: `verbose`, `lines`, `stripFinalNewline`, `buffer`, `maxBuffer`. By default, those options apply to all file descriptors (`stdout`, `stderr`, etc.). A plain object can be passed instead to apply them to only `stdout`, `stderr`, `all` (both stdout and stderr), `ipc`, `fd3`, etc.
|
|
2351
|
+
|
|
2352
|
+
@example
|
|
2353
|
+
|
|
2354
|
+
```
|
|
2355
|
+
// Same value for stdout and stderr
|
|
2356
|
+
execaSync({verbose: 'full'})`npm run build`;
|
|
2357
|
+
|
|
2358
|
+
// Different values for stdout and stderr
|
|
2359
|
+
execaSync({verbose: {stdout: 'none', stderr: 'full'}})`npm run build`;
|
|
2360
|
+
```
|
|
2361
|
+
*/
|
|
2362
|
+
type SyncOptions = TextOptions<true> | BinaryOptions<true>;
|
|
2363
|
+
type StricterOptions<WideOptions extends CommonOptions, StrictOptions extends CommonOptions> = WideOptions extends StrictOptions ? WideOptions : StrictOptions;
|
|
2364
|
+
//#endregion
|
|
2365
|
+
//#region ../../node_modules/execa/types/methods/template.d.ts
|
|
2366
|
+
type TemplateExpressionItem = string | number | Result | SyncResult;
|
|
2367
|
+
/**
|
|
2368
|
+
Value allowed inside `${...}` when using the template string syntax.
|
|
2369
|
+
*/
|
|
2370
|
+
type TemplateExpression = TemplateExpressionItem | readonly TemplateExpressionItem[];
|
|
2371
|
+
// `...${...}...` template syntax
|
|
2372
|
+
type TemplateString = readonly [TemplateStringsArray, ...readonly TemplateExpression[]];
|
|
2373
|
+
//#endregion
|
|
2374
|
+
//#region ../../node_modules/execa/types/pipe.d.ts
|
|
2375
|
+
// `subprocess.pipe()` options
|
|
2376
|
+
type PipeOptions = {
|
|
2377
|
+
/**
|
|
2378
|
+
Which stream to pipe from the source subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.
|
|
2379
|
+
|
|
2380
|
+
`"all"` pipes both `stdout` and `stderr`. This requires the `all` option to be `true`.
|
|
2381
|
+
*/
|
|
2382
|
+
readonly from?: FromOption;
|
|
2383
|
+
/**
|
|
2384
|
+
Which stream to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.
|
|
2385
|
+
*/
|
|
2386
|
+
readonly to?: ToOption;
|
|
2387
|
+
/**
|
|
2388
|
+
Unpipe the subprocess when the signal aborts.
|
|
2389
|
+
*/
|
|
2390
|
+
readonly unpipeSignal?: AbortSignal;
|
|
2391
|
+
};
|
|
2392
|
+
// Methods forwarded from the destination subprocess to the return value of `subprocess.pipe()`, so its output can be iterated, converted to a stream, or used for IPC.
|
|
2393
|
+
type PipeResultMethods<OptionsType extends Options$1> = SubprocessResultMethods<OptionsType> & IpcMethods<HasIpc<OptionsType>, OptionsType['serialization']>;
|
|
2394
|
+
// Same as `PipeResultMethods`, but when the destination is another `execa()` call, so its own option types are kept.
|
|
2395
|
+
// The base `Options` is only used to compute the property names, which do not depend on the specific options.
|
|
2396
|
+
type PipeResultMethodsFrom<Destination extends ResultPromise> = Pick<Destination, keyof PipeResultMethods<Options$1>>;
|
|
2397
|
+
// `subprocess.pipe()`
|
|
2398
|
+
type PipableSubprocess = {
|
|
2399
|
+
/**
|
|
2400
|
+
[Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the subprocess' `stdout` to a second Execa subprocess' `stdin`. This resolves with that second subprocess' result. If either subprocess is rejected, this is rejected with that subprocess' error instead.
|
|
2401
|
+
|
|
2402
|
+
This follows the same syntax as `execa(file, arguments?, options?)` except both regular options and pipe-specific options can be specified.
|
|
2403
|
+
|
|
2404
|
+
Like a subprocess, the return value can be [iterated](https://github.com/sindresorhus/execa/blob/main/docs/lines.md#progressive-splitting), [converted to a stream](https://github.com/sindresorhus/execa/blob/main/docs/streams.md#converting-a-subprocess-to-a-stream), or used for [IPC](https://github.com/sindresorhus/execa/blob/main/docs/ipc.md) with the destination subprocess.
|
|
2405
|
+
*/
|
|
2406
|
+
pipe<OptionsType extends Options$1 & PipeOptions = {}>(file: string | URL, arguments?: readonly string[], options?: OptionsType): Promise<Result<OptionsType>> & PipableSubprocess & PipeResultMethods<OptionsType>;
|
|
2407
|
+
pipe<OptionsType extends Options$1 & PipeOptions = {}>(file: string | URL, options?: OptionsType): Promise<Result<OptionsType>> & PipableSubprocess & PipeResultMethods<OptionsType>;
|
|
2408
|
+
/**
|
|
2409
|
+
Like `subprocess.pipe(file, arguments?, options?)` but using a `command` template string instead. This follows the same syntax as `$`.
|
|
2410
|
+
*/
|
|
2411
|
+
pipe(templates: TemplateStringsArray, ...expressions: readonly TemplateExpression[]): Promise<Result<{}>> & PipableSubprocess & PipeResultMethods<{}>;
|
|
2412
|
+
pipe<OptionsType extends Options$1 & PipeOptions = {}>(options: OptionsType): (templates: TemplateStringsArray, ...expressions: readonly TemplateExpression[]) => Promise<Result<OptionsType>> & PipableSubprocess & PipeResultMethods<OptionsType>;
|
|
2413
|
+
/**
|
|
2414
|
+
Like `subprocess.pipe(file, arguments?, options?)` but using the return value of another `execa()` call instead.
|
|
2415
|
+
*/
|
|
2416
|
+
pipe<Destination extends ResultPromise>(destination: Destination, options?: PipeOptions): Promise<Awaited<Destination>> & PipableSubprocess & PipeResultMethodsFrom<Destination>;
|
|
2417
|
+
};
|
|
2418
|
+
//#endregion
|
|
2419
|
+
//#region ../../node_modules/execa/types/convert.d.ts
|
|
2420
|
+
// `subprocess.readable|duplex|iterable()` options
|
|
2421
|
+
type ReadableOptions = {
|
|
2422
|
+
/**
|
|
2423
|
+
Which stream to read from the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.
|
|
2424
|
+
|
|
2425
|
+
`"all"` reads both `stdout` and `stderr`. This requires the `all` option to be `true`.
|
|
2426
|
+
|
|
2427
|
+
@default 'stdout'
|
|
2428
|
+
*/
|
|
2429
|
+
readonly from?: FromOption;
|
|
2430
|
+
/**
|
|
2431
|
+
If `false`, iterates over lines. Each line is a string.
|
|
2432
|
+
|
|
2433
|
+
If `true`, iterates over arbitrary chunks of data. Each line is an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) (with `subprocess.iterable()`) or a [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) (with `subprocess.readable()`/`subprocess.duplex()`).
|
|
2434
|
+
|
|
2435
|
+
This is always `true` when the `encoding` option is binary.
|
|
2436
|
+
|
|
2437
|
+
@default `false` with `subprocess.iterable()`, `true` otherwise
|
|
2438
|
+
*/
|
|
2439
|
+
readonly binary?: boolean;
|
|
2440
|
+
/**
|
|
2441
|
+
If both this option and the `binary` option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.
|
|
2442
|
+
|
|
2443
|
+
@default `false` with `subprocess.iterable()`, `true` otherwise
|
|
2444
|
+
*/
|
|
2445
|
+
readonly preserveNewlines?: boolean;
|
|
2446
|
+
};
|
|
2447
|
+
// `subprocess.writable|duplex()` options
|
|
2448
|
+
type WritableOptions = {
|
|
1763
2449
|
/**
|
|
1764
|
-
|
|
2450
|
+
Which stream to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.
|
|
1765
2451
|
|
|
1766
|
-
@
|
|
1767
|
-
@returns A result `Object` with `stdout` and `stderr` properties.
|
|
2452
|
+
@default 'stdin'
|
|
1768
2453
|
*/
|
|
1769
|
-
|
|
1770
|
-
|
|
2454
|
+
readonly to?: ToOption;
|
|
2455
|
+
};
|
|
2456
|
+
// `subprocess.duplex()` options
|
|
2457
|
+
type DuplexOptions = ReadableOptions & WritableOptions;
|
|
2458
|
+
// `subprocess.iterable()` return value
|
|
2459
|
+
type SubprocessAsyncIterable<BinaryOption extends boolean | undefined, EncodingOption extends Options$1['encoding']> = AsyncIterableIterator<EncodingOption extends BinaryEncodingOption ? Uint8Array : BinaryOption extends true ? Uint8Array : string>;
|
|
2460
|
+
//#endregion
|
|
2461
|
+
//#region ../../node_modules/execa/types/subprocess/stdout.d.ts
|
|
2462
|
+
// `subprocess.stdin|stdout|stderr|stdio`
|
|
2463
|
+
type SubprocessStdioStream<FdNumber extends string, OptionsType extends Options$1> = SubprocessStream<FdNumber, IgnoresSubprocessOutput<FdNumber, OptionsType>, OptionsType>;
|
|
2464
|
+
type SubprocessStream<FdNumber extends string, StreamResultIgnored, OptionsType extends Options$1> = StreamResultIgnored extends true ? null : InputOutputStream<IsInputFd<FdNumber, OptionsType>>;
|
|
2465
|
+
type InputOutputStream<IsInput extends boolean> = IsInput extends true ? Writable : Readable;
|
|
2466
|
+
//#endregion
|
|
2467
|
+
//#region ../../node_modules/execa/types/subprocess/stdio.d.ts
|
|
2468
|
+
// `subprocess.stdio`
|
|
2469
|
+
type SubprocessStdioArray<OptionsType extends Options$1> = MapStdioStreams<StdioOptionNormalizedArray<OptionsType>, OptionsType>;
|
|
2470
|
+
// We cannot use mapped types because it must be compatible with Node.js `ChildProcess["stdio"]` which uses a tuple with exactly 5 items
|
|
2471
|
+
type MapStdioStreams<StdioOptionsArrayType, OptionsType extends Options$1> = [SubprocessStdioStream<'0', OptionsType>, SubprocessStdioStream<'1', OptionsType>, SubprocessStdioStream<'2', OptionsType>, '3' extends keyof StdioOptionsArrayType ? SubprocessStdioStream<'3', OptionsType> : never, '4' extends keyof StdioOptionsArrayType ? SubprocessStdioStream<'4', OptionsType> : never];
|
|
2472
|
+
//#endregion
|
|
2473
|
+
//#region ../../node_modules/execa/types/subprocess/all.d.ts
|
|
2474
|
+
// `subprocess.all`
|
|
2475
|
+
type SubprocessAll<OptionsType extends Options$1> = AllStream<AllIgnored<OptionsType['all'], OptionsType>>;
|
|
2476
|
+
type AllStream<IsIgnored> = IsIgnored extends true ? undefined : Readable;
|
|
2477
|
+
type AllIgnored<AllOption, OptionsType extends Options$1> = AllOption extends true ? IgnoresSubprocessOutput<'1', OptionsType> extends true ? IgnoresSubprocessOutput<'2', OptionsType> : false : true;
|
|
2478
|
+
//#endregion
|
|
2479
|
+
//#region ../../node_modules/execa/types/subprocess/subprocess.d.ts
|
|
2480
|
+
// Read-side iteration, stream conversion and `all` methods.
|
|
2481
|
+
// These are shared between a subprocess and the return value of `subprocess.pipe()`, which forwards them from its destination subprocess.
|
|
2482
|
+
// `writable()`, `duplex()`, `writableStream()` and `transformStream()` are not included: they write to `stdin`, which the pipe already feeds from its source.
|
|
2483
|
+
type SubprocessResultMethods<OptionsType extends Options$1 = Options$1> = {
|
|
1771
2484
|
/**
|
|
1772
|
-
|
|
2485
|
+
Stream combining/interleaving `subprocess.stdout` and `subprocess.stderr`.
|
|
1773
2486
|
|
|
1774
|
-
|
|
1775
|
-
- the current Node version and options are used. This can be overridden using the `nodePath` and `nodeArguments` options.
|
|
1776
|
-
- the `shell` option cannot be used
|
|
1777
|
-
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
|
2487
|
+
This requires the `all` option to be `true`.
|
|
1778
2488
|
|
|
1779
|
-
|
|
1780
|
-
@param arguments - Arguments to pass to `scriptPath` on execution.
|
|
1781
|
-
@returns A [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.
|
|
2489
|
+
This is `undefined` if `stdout` and `stderr` options are set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.
|
|
1782
2490
|
*/
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
2491
|
+
all: SubprocessAll<OptionsType>;
|
|
2492
|
+
/**
|
|
2493
|
+
Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.
|
|
2494
|
+
*/
|
|
2495
|
+
[Symbol.asyncIterator](): SubprocessAsyncIterable<undefined, OptionsType['encoding']>;
|
|
2496
|
+
/**
|
|
2497
|
+
Same as `subprocess[Symbol.asyncIterator]` except options can be provided.
|
|
2498
|
+
*/
|
|
2499
|
+
iterable<IterableOptions extends ReadableOptions = {}>(readableOptions?: IterableOptions): SubprocessAsyncIterable<IterableOptions['binary'], OptionsType['encoding']>;
|
|
2500
|
+
/**
|
|
2501
|
+
Converts the subprocess to a readable stream.
|
|
2502
|
+
*/
|
|
2503
|
+
readable(readableOptions?: ReadableOptions): Readable;
|
|
2504
|
+
/**
|
|
2505
|
+
Converts the subprocess to a readable [web stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
|
|
2506
|
+
*/
|
|
2507
|
+
readableStream(readableOptions?: ReadableOptions): ReadableStream;
|
|
1787
2508
|
};
|
|
2509
|
+
type ExecaCustomSubprocess<OptionsType extends Options$1> = IpcMethods<HasIpc<OptionsType>, OptionsType['serialization']> & PipableSubprocess & SubprocessResultMethods<OptionsType> & {
|
|
2510
|
+
/**
|
|
2511
|
+
Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).
|
|
2512
|
+
|
|
2513
|
+
This is `undefined` if the subprocess failed to spawn.
|
|
2514
|
+
*/
|
|
2515
|
+
pid?: number;
|
|
2516
|
+
/**
|
|
2517
|
+
The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.
|
|
2518
|
+
|
|
2519
|
+
This is `null` if the `stdin` option is set to `'inherit'`, `'ignore'`, `Readable` or `integer`.
|
|
2520
|
+
*/
|
|
2521
|
+
stdin: SubprocessStdioStream<'0', OptionsType>;
|
|
2522
|
+
/**
|
|
2523
|
+
The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.
|
|
2524
|
+
|
|
2525
|
+
This is `null` if the `stdout` option is set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.
|
|
2526
|
+
*/
|
|
2527
|
+
stdout: SubprocessStdioStream<'1', OptionsType>;
|
|
2528
|
+
/**
|
|
2529
|
+
The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.
|
|
2530
|
+
|
|
2531
|
+
This is `null` if the `stderr` option is set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.
|
|
2532
|
+
*/
|
|
2533
|
+
stderr: SubprocessStdioStream<'2', OptionsType>;
|
|
2534
|
+
/**
|
|
2535
|
+
The subprocess `stdin`, `stdout`, `stderr` and other files descriptors as an array of streams.
|
|
2536
|
+
|
|
2537
|
+
Each array item is `null` if the corresponding `stdin`, `stdout`, `stderr` or `stdio` option is set to `'inherit'`, `'ignore'`, `Stream` or `integer`, or if the `buffer` option is `false`.
|
|
2538
|
+
*/
|
|
2539
|
+
stdio: SubprocessStdioArray<OptionsType>;
|
|
2540
|
+
/**
|
|
2541
|
+
Sends a [signal](https://nodejs.org/api/os.html#signal-constants) to the subprocess. The default signal is the `killSignal` option. `killSignal` defaults to `SIGTERM`, which terminates the subprocess.
|
|
2542
|
+
|
|
2543
|
+
This returns `false` when the signal could not be sent, for example when the subprocess has already exited.
|
|
2544
|
+
|
|
2545
|
+
When an error is passed as argument, it is set to the subprocess' `error.cause`. The subprocess is then terminated with the default signal. This does not emit the [`error` event](https://nodejs.org/api/child_process.html#event-error).
|
|
2546
|
+
|
|
2547
|
+
[More info.](https://nodejs.org/api/child_process.html#subprocesskillsignal)
|
|
2548
|
+
*/
|
|
2549
|
+
kill(signal?: keyof SignalConstants | number, error?: Error): boolean;
|
|
2550
|
+
kill(error?: Error): boolean;
|
|
2551
|
+
/**
|
|
2552
|
+
Converts the subprocess to a writable stream.
|
|
2553
|
+
*/
|
|
2554
|
+
writable(writableOptions?: WritableOptions): Writable;
|
|
2555
|
+
/**
|
|
2556
|
+
Converts the subprocess to a duplex stream.
|
|
2557
|
+
*/
|
|
2558
|
+
duplex(duplexOptions?: DuplexOptions): Duplex;
|
|
2559
|
+
/**
|
|
2560
|
+
Converts the subprocess to a writable [web stream](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).
|
|
2561
|
+
*/
|
|
2562
|
+
writableStream(writableOptions?: WritableOptions): WritableStream;
|
|
2563
|
+
/**
|
|
2564
|
+
Converts the subprocess to a [`{readable, writable}`](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream) pair of web streams.
|
|
2565
|
+
*/
|
|
2566
|
+
transformStream(duplexOptions?: DuplexOptions): ReadableWritablePair;
|
|
2567
|
+
/**
|
|
2568
|
+
Underlying Node.js [`ChildProcess`](https://nodejs.org/api/child_process.html#class-childprocess) instance.
|
|
2569
|
+
|
|
2570
|
+
This is an escape hatch for Node.js-specific APIs not documented by Execa, such as `.on()`, `.send()`, `.disconnect()`, `.ref()` or `.unref()`.
|
|
2571
|
+
*/
|
|
2572
|
+
nodeChildProcess: ChildProcess;
|
|
2573
|
+
};
|
|
2574
|
+
/**
|
|
2575
|
+
Subprocess with Execa-specific methods and properties. It is also a `Promise` either resolving with its successful `result`, or rejecting with its `error`.
|
|
2576
|
+
*/
|
|
2577
|
+
type Subprocess<OptionsType extends Options$1 = Options$1> = ExecaCustomSubprocess<OptionsType> & Promise<Result<OptionsType>>;
|
|
2578
|
+
/**
|
|
2579
|
+
The return value of all asynchronous methods is both:
|
|
2580
|
+
- the subprocess with Execa-specific methods and properties.
|
|
2581
|
+
- a `Promise` either resolving with its successful `result`, or rejecting with its `error`.
|
|
2582
|
+
*/
|
|
2583
|
+
type ResultPromise<OptionsType extends Options$1 = Options$1> = Subprocess<OptionsType>;
|
|
2584
|
+
//#endregion
|
|
2585
|
+
//#region ../../node_modules/execa/types/methods/main-async.d.ts
|
|
2586
|
+
/**
|
|
2587
|
+
Executes a command using `file ...arguments`.
|
|
2588
|
+
|
|
2589
|
+
When `command` is a template string, it includes both the `file` and its `arguments`.
|
|
2590
|
+
|
|
2591
|
+
`execa(options)` can be used to return a new instance of this method but with different default `options`. Consecutive calls are merged to previous ones.
|
|
2592
|
+
|
|
2593
|
+
@param file - The program/script to execute, as a string or file URL
|
|
2594
|
+
@param arguments - Arguments to pass to `file` on execution.
|
|
2595
|
+
@returns A `ResultPromise` that is both:
|
|
2596
|
+
- the subprocess.
|
|
2597
|
+
- a `Promise` either resolving with its successful `result`, or rejecting with its `error`.
|
|
2598
|
+
@throws `ExecaError`
|
|
2599
|
+
|
|
2600
|
+
@example <caption>Simple syntax</caption>
|
|
2601
|
+
|
|
2602
|
+
```
|
|
2603
|
+
import {execa} from 'execa';
|
|
2604
|
+
|
|
2605
|
+
const {stdout} = await execa`npm run build`;
|
|
2606
|
+
// Print command's output
|
|
2607
|
+
console.log(stdout);
|
|
2608
|
+
```
|
|
2609
|
+
|
|
2610
|
+
@example <caption>Script</caption>
|
|
2611
|
+
|
|
2612
|
+
```
|
|
2613
|
+
import {$} from 'execa';
|
|
2614
|
+
|
|
2615
|
+
const {stdout: name} = await $`cat package.json`.pipe`grep name`;
|
|
2616
|
+
console.log(name);
|
|
2617
|
+
|
|
2618
|
+
const branch = await $`git branch --show-current`;
|
|
2619
|
+
await $`dep deploy --branch=${branch}`;
|
|
2620
|
+
|
|
2621
|
+
await Promise.all([
|
|
2622
|
+
$`sleep 1`,
|
|
2623
|
+
$`sleep 2`,
|
|
2624
|
+
$`sleep 3`,
|
|
2625
|
+
]);
|
|
2626
|
+
|
|
2627
|
+
const directoryName = 'foo bar';
|
|
2628
|
+
await $`mkdir /tmp/${directoryName}`;
|
|
2629
|
+
```
|
|
2630
|
+
|
|
2631
|
+
@example <caption>Local binaries</caption>
|
|
2632
|
+
|
|
2633
|
+
```
|
|
2634
|
+
$ npm install -D eslint
|
|
2635
|
+
```
|
|
2636
|
+
|
|
2637
|
+
```
|
|
2638
|
+
await execa({preferLocal: true})`eslint`;
|
|
2639
|
+
```
|
|
2640
|
+
|
|
2641
|
+
@example <caption>Pipe multiple subprocesses</caption>
|
|
2642
|
+
|
|
2643
|
+
```
|
|
2644
|
+
const {stdout, pipedFrom} = await execa`npm run build`
|
|
2645
|
+
.pipe`sort`
|
|
2646
|
+
.pipe`head -n 2`;
|
|
2647
|
+
|
|
2648
|
+
// Output of `npm run build | sort | head -n 2`
|
|
2649
|
+
console.log(stdout);
|
|
2650
|
+
// Output of `npm run build | sort`
|
|
2651
|
+
console.log(pipedFrom[0].stdout);
|
|
2652
|
+
// Output of `npm run build`
|
|
2653
|
+
console.log(pipedFrom[0].pipedFrom[0].stdout);
|
|
2654
|
+
```
|
|
2655
|
+
|
|
2656
|
+
@example <caption>Interleaved output</caption>
|
|
2657
|
+
|
|
2658
|
+
```
|
|
2659
|
+
const {all} = await execa({all: true})`npm run build`;
|
|
2660
|
+
// stdout + stderr, interleaved
|
|
2661
|
+
console.log(all);
|
|
2662
|
+
```
|
|
2663
|
+
|
|
2664
|
+
@example <caption>Programmatic + terminal output</caption>
|
|
2665
|
+
|
|
2666
|
+
```
|
|
2667
|
+
const {stdout} = await execa({stdout: ['pipe', 'inherit']})`npm run build`;
|
|
2668
|
+
// stdout is also printed to the terminal
|
|
2669
|
+
console.log(stdout);
|
|
2670
|
+
```
|
|
2671
|
+
|
|
2672
|
+
@example <caption>Simple input</caption>
|
|
2673
|
+
|
|
2674
|
+
```
|
|
2675
|
+
const getInputString = () => { /* ... *\/ };
|
|
2676
|
+
const {stdout} = await execa({input: getInputString()})`sort`;
|
|
2677
|
+
console.log(stdout);
|
|
2678
|
+
```
|
|
2679
|
+
|
|
2680
|
+
@example <caption>File input</caption>
|
|
2681
|
+
|
|
2682
|
+
```
|
|
2683
|
+
// Similar to: npm run build < input.txt
|
|
2684
|
+
await execa({stdin: {file: 'input.txt'}})`npm run build`;
|
|
2685
|
+
```
|
|
2686
|
+
|
|
2687
|
+
@example <caption>File output</caption>
|
|
2688
|
+
|
|
2689
|
+
```
|
|
2690
|
+
// Similar to: npm run build > output.txt
|
|
2691
|
+
await execa({stdout: {file: 'output.txt'}})`npm run build`;
|
|
2692
|
+
```
|
|
2693
|
+
|
|
2694
|
+
@example <caption>Split into text lines</caption>
|
|
2695
|
+
|
|
2696
|
+
```
|
|
2697
|
+
const {stdout} = await execa({lines: true})`npm run build`;
|
|
2698
|
+
// Print first 10 lines
|
|
2699
|
+
console.log(stdout.slice(0, 10).join('\n'));
|
|
2700
|
+
```
|
|
2701
|
+
|
|
2702
|
+
@example <caption>Iterate over text lines</caption>
|
|
2703
|
+
|
|
2704
|
+
```
|
|
2705
|
+
for await (const line of execa`npm run build`) {
|
|
2706
|
+
if (line.includes('WARN')) {
|
|
2707
|
+
console.warn(line);
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
```
|
|
2711
|
+
|
|
2712
|
+
@example <caption>Transform/filter output</caption>
|
|
2713
|
+
|
|
2714
|
+
```
|
|
2715
|
+
let count = 0;
|
|
2716
|
+
|
|
2717
|
+
// Filter out secret lines, then prepend the line number
|
|
2718
|
+
const transform = function * (line) {
|
|
2719
|
+
if (!line.includes('secret')) {
|
|
2720
|
+
yield `[${count++}] ${line}`;
|
|
2721
|
+
}
|
|
2722
|
+
};
|
|
2723
|
+
|
|
2724
|
+
await execa({stdout: transform})`npm run build`;
|
|
2725
|
+
```
|
|
2726
|
+
|
|
2727
|
+
@example <caption>Web streams</caption>
|
|
2728
|
+
|
|
2729
|
+
```
|
|
2730
|
+
const response = await fetch('https://example.com');
|
|
2731
|
+
await execa({stdin: response.body})`sort`;
|
|
2732
|
+
```
|
|
2733
|
+
|
|
2734
|
+
@example <caption>Convert to Duplex stream</caption>
|
|
2735
|
+
|
|
2736
|
+
```
|
|
2737
|
+
import {execa} from 'execa';
|
|
2738
|
+
import {pipeline} from 'node:stream/promises';
|
|
2739
|
+
import {createReadStream, createWriteStream} from 'node:fs';
|
|
2740
|
+
|
|
2741
|
+
await pipeline(
|
|
2742
|
+
createReadStream('./input.txt'),
|
|
2743
|
+
execa`node ./transform.js`.duplex(),
|
|
2744
|
+
createWriteStream('./output.txt'),
|
|
2745
|
+
);
|
|
2746
|
+
```
|
|
2747
|
+
|
|
2748
|
+
@example <caption>Exchange messages</caption>
|
|
2749
|
+
|
|
2750
|
+
```
|
|
2751
|
+
// parent.js
|
|
2752
|
+
import {execaNode} from 'execa';
|
|
2753
|
+
|
|
2754
|
+
const subprocess = execaNode`child.js`;
|
|
2755
|
+
await subprocess.sendMessage('Hello from parent');
|
|
2756
|
+
const message = await subprocess.getOneMessage();
|
|
2757
|
+
console.log(message); // 'Hello from child'
|
|
2758
|
+
```
|
|
2759
|
+
|
|
2760
|
+
```
|
|
2761
|
+
// child.js
|
|
2762
|
+
import {getOneMessage, sendMessage} from 'execa';
|
|
2763
|
+
|
|
2764
|
+
const message = await getOneMessage(); // 'Hello from parent'
|
|
2765
|
+
const newMessage = message.replace('parent', 'child'); // 'Hello from child'
|
|
2766
|
+
await sendMessage(newMessage);
|
|
2767
|
+
```
|
|
2768
|
+
|
|
2769
|
+
@example <caption>Any input type</caption>
|
|
2770
|
+
|
|
2771
|
+
```
|
|
2772
|
+
// main.js
|
|
2773
|
+
import {execaNode} from 'execa';
|
|
2774
|
+
|
|
2775
|
+
const ipcInput = [
|
|
2776
|
+
{task: 'lint', ignore: /test\.js/},
|
|
2777
|
+
{task: 'copy', files: new Set(['main.js', 'index.js']),
|
|
2778
|
+
}];
|
|
2779
|
+
await execaNode({ipcInput})`build.js`;
|
|
2780
|
+
```
|
|
2781
|
+
|
|
2782
|
+
```
|
|
2783
|
+
// build.js
|
|
2784
|
+
import {getOneMessage} from 'execa';
|
|
2785
|
+
|
|
2786
|
+
const ipcInput = await getOneMessage();
|
|
2787
|
+
```
|
|
2788
|
+
|
|
2789
|
+
@example <caption>Any output type</caption>
|
|
2790
|
+
|
|
2791
|
+
```
|
|
2792
|
+
// main.js
|
|
2793
|
+
import {execaNode} from 'execa';
|
|
2794
|
+
|
|
2795
|
+
const {ipcOutput} = await execaNode`build.js`;
|
|
2796
|
+
console.log(ipcOutput[0]); // {kind: 'start', timestamp: date}
|
|
2797
|
+
console.log(ipcOutput[1]); // {kind: 'stop', timestamp: date}
|
|
2798
|
+
```
|
|
2799
|
+
|
|
2800
|
+
```
|
|
2801
|
+
// build.js
|
|
2802
|
+
import {sendMessage} from 'execa';
|
|
2803
|
+
|
|
2804
|
+
const runBuild = () => { /* ... *\/ };
|
|
2805
|
+
|
|
2806
|
+
await sendMessage({kind: 'start', timestamp: new Date()});
|
|
2807
|
+
await runBuild();
|
|
2808
|
+
await sendMessage({kind: 'stop', timestamp: new Date()});
|
|
2809
|
+
```
|
|
2810
|
+
|
|
2811
|
+
@example <caption>Graceful termination</caption>
|
|
2812
|
+
|
|
2813
|
+
```
|
|
2814
|
+
// main.js
|
|
2815
|
+
import {execaNode} from 'execa';
|
|
2816
|
+
|
|
2817
|
+
const controller = new AbortController();
|
|
2818
|
+
setTimeout(() => {
|
|
2819
|
+
controller.abort();
|
|
2820
|
+
}, 5000);
|
|
2821
|
+
|
|
2822
|
+
await execaNode({
|
|
2823
|
+
cancelSignal: controller.signal,
|
|
2824
|
+
gracefulCancel: true,
|
|
2825
|
+
})`build.js`;
|
|
2826
|
+
```
|
|
2827
|
+
|
|
2828
|
+
```
|
|
2829
|
+
// build.js
|
|
2830
|
+
import {getCancelSignal} from 'execa';
|
|
2831
|
+
|
|
2832
|
+
const cancelSignal = await getCancelSignal();
|
|
2833
|
+
const url = 'https://example.com/build/info';
|
|
2834
|
+
const response = await fetch(url, {signal: cancelSignal});
|
|
2835
|
+
```
|
|
2836
|
+
|
|
2837
|
+
@example <caption>Detailed error</caption>
|
|
2838
|
+
|
|
2839
|
+
```
|
|
2840
|
+
import {execa, ExecaError} from 'execa';
|
|
2841
|
+
|
|
2842
|
+
try {
|
|
2843
|
+
await execa`unknown command`;
|
|
2844
|
+
} catch (error) {
|
|
2845
|
+
if (error instanceof ExecaError) {
|
|
2846
|
+
console.log(error);
|
|
2847
|
+
}
|
|
2848
|
+
/*
|
|
2849
|
+
ExecaError: Command failed with ENOENT: unknown command
|
|
2850
|
+
spawn unknown ENOENT
|
|
2851
|
+
at ...
|
|
2852
|
+
at ... {
|
|
2853
|
+
shortMessage: 'Command failed with ENOENT: unknown command\nspawn unknown ENOENT',
|
|
2854
|
+
originalMessage: 'spawn unknown ENOENT',
|
|
2855
|
+
command: 'unknown command',
|
|
2856
|
+
escapedCommand: 'unknown command',
|
|
2857
|
+
cwd: '/path/to/cwd',
|
|
2858
|
+
durationMs: 28.217566,
|
|
2859
|
+
failed: true,
|
|
2860
|
+
timedOut: false,
|
|
2861
|
+
isCanceled: false,
|
|
2862
|
+
isTerminated: false,
|
|
2863
|
+
isMaxBuffer: false,
|
|
2864
|
+
code: 'ENOENT',
|
|
2865
|
+
stdout: '',
|
|
2866
|
+
stderr: '',
|
|
2867
|
+
stdio: [undefined, '', ''],
|
|
2868
|
+
pipedFrom: []
|
|
2869
|
+
[cause]: Error: spawn unknown ENOENT
|
|
2870
|
+
at ...
|
|
2871
|
+
at ... {
|
|
2872
|
+
errno: -2,
|
|
2873
|
+
code: 'ENOENT',
|
|
2874
|
+
syscall: 'spawn unknown',
|
|
2875
|
+
path: 'unknown',
|
|
2876
|
+
spawnargs: [ 'command' ]
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
*\/
|
|
2880
|
+
}
|
|
2881
|
+
```
|
|
2882
|
+
|
|
2883
|
+
@example <caption>Verbose mode</caption>
|
|
2884
|
+
|
|
2885
|
+
```
|
|
2886
|
+
await execa`npm run build`;
|
|
2887
|
+
await execa`npm run test`;
|
|
2888
|
+
```
|
|
2889
|
+
|
|
2890
|
+
```
|
|
2891
|
+
$ NODE_DEBUG=execa node build.js
|
|
2892
|
+
[00:57:44.581] [0] $ npm run build
|
|
2893
|
+
[00:57:44.653] [0] Building application...
|
|
2894
|
+
[00:57:44.653] [0] Done building.
|
|
2895
|
+
[00:57:44.658] [0] ✔ (done in 78ms)
|
|
2896
|
+
[00:57:44.658] [1] $ npm run test
|
|
2897
|
+
[00:57:44.740] [1] Running tests...
|
|
2898
|
+
[00:57:44.740] [1] Error: the entrypoint is invalid.
|
|
2899
|
+
[00:57:44.747] [1] ✘ Command failed with exit code 1: npm run test
|
|
2900
|
+
[00:57:44.747] [1] ✘ (done in 89ms)
|
|
2901
|
+
```
|
|
2902
|
+
|
|
2903
|
+
@example <caption>Custom logging</caption>
|
|
2904
|
+
|
|
2905
|
+
```
|
|
2906
|
+
import {execa as execa_} from 'execa';
|
|
2907
|
+
import {createLogger, transports} from 'winston';
|
|
2908
|
+
|
|
2909
|
+
// Log to a file using Winston
|
|
2910
|
+
const transport = new transports.File({filename: 'logs.txt'});
|
|
2911
|
+
const logger = createLogger({transports: [transport]});
|
|
2912
|
+
const LOG_LEVELS = {
|
|
2913
|
+
command: 'info',
|
|
2914
|
+
output: 'verbose',
|
|
2915
|
+
ipc: 'verbose',
|
|
2916
|
+
error: 'error',
|
|
2917
|
+
duration: 'info',
|
|
2918
|
+
};
|
|
2919
|
+
|
|
2920
|
+
const execa = execa_({
|
|
2921
|
+
verbose(verboseLine, {message, ...verboseObject}) {
|
|
2922
|
+
const level = LOG_LEVELS[verboseObject.type];
|
|
2923
|
+
logger[level](message, verboseObject);
|
|
2924
|
+
},
|
|
2925
|
+
});
|
|
2926
|
+
|
|
2927
|
+
await execa`npm run build`;
|
|
2928
|
+
await execa`npm run test`;
|
|
2929
|
+
```
|
|
2930
|
+
*/
|
|
2931
|
+
declare const execa: ExecaMethod<{}>;
|
|
2932
|
+
/**
|
|
2933
|
+
`execa()` method either exported by Execa, or bound using `execa(options)`.
|
|
2934
|
+
*/
|
|
2935
|
+
type ExecaMethod<OptionsType extends Options$1 = Options$1> = ExecaBind<OptionsType> & ExecaTemplate<OptionsType> & ExecaArrayLong<OptionsType> & ExecaArrayShort<OptionsType>;
|
|
2936
|
+
// `execa(options)` binding
|
|
2937
|
+
type ExecaBind<OptionsType extends Options$1> = <NewOptionsType extends Options$1 = {}>(options: NewOptionsType) => ExecaMethod<OptionsType & NewOptionsType>;
|
|
2938
|
+
// `execa`command`` template syntax
|
|
2939
|
+
type ExecaTemplate<OptionsType extends Options$1> = (...templateString: TemplateString) => ResultPromise<OptionsType>;
|
|
2940
|
+
// `execa('file', ['argument'], {})` array syntax
|
|
2941
|
+
type ExecaArrayLong<OptionsType extends Options$1> = <NewOptionsType extends Options$1 = {}>(file: string | URL, arguments?: readonly string[], options?: NewOptionsType) => ResultPromise<OptionsType & NewOptionsType>;
|
|
2942
|
+
// `execa('file', {})` array syntax
|
|
2943
|
+
type ExecaArrayShort<OptionsType extends Options$1> = <NewOptionsType extends Options$1 = {}>(file: string | URL, options?: NewOptionsType) => ResultPromise<OptionsType & NewOptionsType>;
|
|
2944
|
+
//#endregion
|
|
2945
|
+
//#region ../../node_modules/execa/types/methods/main-sync.d.ts
|
|
2946
|
+
/**
|
|
2947
|
+
Same as `execa()` but synchronous.
|
|
2948
|
+
|
|
2949
|
+
Returns a subprocess `result` or throws an `error`. The `subprocess` is not returned: its methods and properties are not available.
|
|
2950
|
+
|
|
2951
|
+
When `command` is a template string, it includes both the `file` and its `arguments`.
|
|
2952
|
+
|
|
2953
|
+
`execaSync(options)` can be used to return a new instance of this method but with different default `options`. Consecutive calls are merged to previous ones.
|
|
2954
|
+
|
|
2955
|
+
This method is discouraged as it holds the CPU and lacks multiple features.
|
|
2956
|
+
|
|
2957
|
+
@param file - The program/script to execute, as a string or file URL
|
|
2958
|
+
@param arguments - Arguments to pass to `file` on execution.
|
|
2959
|
+
@returns `SyncResult`
|
|
2960
|
+
@throws `ExecaSyncError`
|
|
2961
|
+
|
|
2962
|
+
@example
|
|
2963
|
+
|
|
2964
|
+
```
|
|
2965
|
+
import {execaSync} from 'execa';
|
|
2966
|
+
|
|
2967
|
+
const {stdout} = execaSync`npm run build`;
|
|
2968
|
+
// Print command's output
|
|
2969
|
+
console.log(stdout);
|
|
2970
|
+
```
|
|
2971
|
+
*/
|
|
2972
|
+
declare const execaSync: ExecaSyncMethod<{}>;
|
|
2973
|
+
// For the moment, we purposely do not export `ExecaSyncMethod` and `ExecaScriptSyncMethod`.
|
|
2974
|
+
// This is because synchronous invocation is discouraged.
|
|
2975
|
+
type ExecaSyncMethod<OptionsType extends SyncOptions = SyncOptions> = ExecaSyncBind<OptionsType> & ExecaSyncTemplate<OptionsType> & ExecaSyncArrayLong<OptionsType> & ExecaSyncArrayShort<OptionsType>;
|
|
2976
|
+
// `execaSync(options)` binding
|
|
2977
|
+
type ExecaSyncBind<OptionsType extends SyncOptions> = <NewOptionsType extends SyncOptions = {}>(options: NewOptionsType) => ExecaSyncMethod<OptionsType & NewOptionsType>;
|
|
2978
|
+
// `execaSync`command`` template syntax
|
|
2979
|
+
type ExecaSyncTemplate<OptionsType extends SyncOptions> = (...templateString: TemplateString) => SyncResult<OptionsType>;
|
|
2980
|
+
// `execaSync('file', ['argument'], {})` array syntax
|
|
2981
|
+
type ExecaSyncArrayLong<OptionsType extends SyncOptions> = <NewOptionsType extends SyncOptions = {}>(file: string | URL, arguments?: readonly string[], options?: NewOptionsType) => SyncResult<OptionsType & NewOptionsType>;
|
|
2982
|
+
// `execaSync('file', {})` array syntax
|
|
2983
|
+
type ExecaSyncArrayShort<OptionsType extends SyncOptions> = <NewOptionsType extends SyncOptions = {}>(file: string | URL, options?: NewOptionsType) => SyncResult<OptionsType & NewOptionsType>;
|
|
1788
2984
|
//#endregion
|
|
1789
2985
|
//#region src/common/cli/cli.d.ts
|
|
1790
2986
|
type RunOptions = Record<string, unknown>;
|
|
2987
|
+
type CliSyncResult = ReturnType<typeof execaSync>;
|
|
1791
2988
|
interface CliResult extends Promise<unknown> {
|
|
1792
2989
|
toObservable(opt?: RunOptions): Observable<string>;
|
|
1793
|
-
toStream(opt?: RunOptions): execa
|
|
2990
|
+
toStream(opt?: RunOptions): ReturnType<typeof execa>;
|
|
1794
2991
|
cwd(cwd: string): CliResult;
|
|
1795
|
-
sync(opt?: RunOptions):
|
|
2992
|
+
sync(opt?: RunOptions): CliSyncResult;
|
|
1796
2993
|
getRaw(opt?: RunOptions): string;
|
|
1797
2994
|
get(opt?: RunOptions): string;
|
|
1798
2995
|
}
|
|
1799
|
-
type CliSyncResult = execa.ExecaSyncReturnValue<string>;
|
|
1800
2996
|
declare class Cli {
|
|
1801
2997
|
cmd: string;
|
|
1802
2998
|
constructor(cmd: string);
|
|
@@ -1958,7 +3154,7 @@ interface ConditionalPluginOptions {
|
|
|
1958
3154
|
[key: string]: unknown;
|
|
1959
3155
|
}
|
|
1960
3156
|
type Plugin = string | [string, ConditionalPluginOptions];
|
|
1961
|
-
interface CmReleaseConfig extends Options
|
|
3157
|
+
interface CmReleaseConfig extends Options {
|
|
1962
3158
|
verifyConditions?: readonly Plugin[];
|
|
1963
3159
|
analyzeCommits?: readonly Plugin[];
|
|
1964
3160
|
verifyRelease?: readonly Plugin[];
|