new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { Notification } from '../Notification';
|
||||
import { OperatorFunction } from '../types';
|
||||
/**
|
||||
* Represents all of the notifications from the source Observable as `next`
|
||||
* emissions marked with their original types within {@link Notification}
|
||||
* objects.
|
||||
*
|
||||
* <span class="informal">Wraps `next`, `error` and `complete` emissions in
|
||||
* {@link Notification} objects, emitted as `next` on the output Observable.
|
||||
* </span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `materialize` returns an Observable that emits a `next` notification for each
|
||||
* `next`, `error`, or `complete` emission of the source Observable. When the
|
||||
* source Observable emits `complete`, the output Observable will emit `next` as
|
||||
* a Notification of type "complete", and then it will emit `complete` as well.
|
||||
* When the source Observable emits `error`, the output will emit `next` as a
|
||||
* Notification of type "error", and then `complete`.
|
||||
*
|
||||
* This operator is useful for producing metadata of the source Observable, to
|
||||
* be consumed as `next` emissions. Use it in conjunction with
|
||||
* {@link dematerialize}.
|
||||
*
|
||||
* ## Example
|
||||
* Convert a faulty Observable to an Observable of Notifications
|
||||
* ```ts
|
||||
* import { of } from 'rxjs';
|
||||
* import { materialize, map } from 'rxjs/operators';
|
||||
*
|
||||
* const letters = of('a', 'b', 13, 'd');
|
||||
* const upperCase = letters.pipe(map(x => x.toUpperCase()));
|
||||
* const materialized = upperCase.pipe(materialize());
|
||||
* materialized.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // - Notification {kind: "N", value: "A", error: undefined, hasValue: true}
|
||||
* // - Notification {kind: "N", value: "B", error: undefined, hasValue: true}
|
||||
* // - Notification {kind: "E", value: undefined, error: TypeError:
|
||||
* // x.toUpperCase is not a function at MapSubscriber.letters.map.x
|
||||
* // [as project] (http://1…, hasValue: false}
|
||||
* ```
|
||||
*
|
||||
* @see {@link Notification}
|
||||
* @see {@link dematerialize}
|
||||
*
|
||||
* @return {Observable<Notification<T>>} An Observable that emits
|
||||
* {@link Notification} objects that wrap the original emissions from the source
|
||||
* Observable with metadata.
|
||||
* @method materialize
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function materialize<T>(): OperatorFunction<T, Notification<T>>;
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
// developer.mozilla.org/en/CSS/box-sizing
|
||||
// github.com/Modernizr/Modernizr/issues/248
|
||||
|
||||
Modernizr.addTest("boxsizing",function(){
|
||||
return Modernizr.testAllProps("boxSizing") && (document.documentMode === undefined || document.documentMode > 7);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"J E F G BC","132":"A"},B:{"1":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"CC tB DC EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"I u J"},E:{"1":"J E F G A B C K L H IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u GC zB","260":"HC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d SC rB","2":"G B OC PC QC RC qB 9B"},G:{"1":"F UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"zB TC","260":"AC"},H:{"1":"nC"},I:{"1":"I D rC AC sC tC","2":"tB oC pC qC"},J:{"1":"A","2":"E"},K:{"1":"C e rB","2":"A B qB 9B"},L:{"1":"D"},M:{"1":"D"},N:{"132":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:6,C:"Typed Arrays"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00571,"39":0,"40":0,"41":0,"42":0,"43":0.01142,"44":0.03426,"45":0.01142,"46":0,"47":0.00571,"48":0.00571,"49":0,"50":0,"51":0,"52":0.02284,"53":0,"54":0,"55":0.02284,"56":0,"57":0.01142,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.00571,"67":0,"68":0.00571,"69":0,"70":0,"71":0,"72":0.00571,"73":0,"74":0,"75":0,"76":0,"77":0.00571,"78":0.03997,"79":0.00571,"80":0.00571,"81":0.00571,"82":0.00571,"83":0.00571,"84":0,"85":0,"86":0,"87":0.01142,"88":0.00571,"89":0,"90":0,"91":0.00571,"92":0,"93":0,"94":0,"95":0.00571,"96":0,"97":0,"98":0,"99":0.00571,"100":0,"101":0.00571,"102":0.04568,"103":0.01142,"104":0.01142,"105":0.01713,"106":0.01713,"107":0.05139,"108":1.35898,"109":0.65094,"110":0.00571,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00571,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.00571,"48":0.09136,"49":0.0571,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.02284,"61":0,"62":0,"63":0,"64":0,"65":0.00571,"66":0.01713,"67":0.00571,"68":0.00571,"69":0.00571,"70":0.00571,"71":0.00571,"72":0.00571,"73":0.00571,"74":0.01142,"75":0.00571,"76":0.01142,"77":0.00571,"78":0.00571,"79":0.05139,"80":0.02855,"81":0.01142,"83":0.29692,"84":0.03997,"85":0.05139,"86":0.06281,"87":0.06281,"88":0.03426,"89":0.00571,"90":0.01142,"91":0.01713,"92":0.01713,"93":0.07423,"94":0.01713,"95":0.00571,"96":0.07994,"97":0.02284,"98":0.02284,"99":0.01713,"100":0.02284,"101":0.04568,"102":0.03426,"103":0.29692,"104":0.06281,"105":0.14846,"106":0.1142,"107":0.32547,"108":8.70775,"109":7.22315,"110":0.01142,"111":0.00571,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00571,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00571,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00571,"93":0.20556,"94":0.29692,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0.00571,"13":0.00571,"14":0,"15":0,"16":0,"17":0.00571,"18":0.01142,"79":0,"80":0,"81":0,"83":0.00571,"84":0.00571,"85":0.00571,"86":0.00571,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00571,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.00571,"101":0.00571,"102":0,"103":0.00571,"104":0.00571,"105":0.00571,"106":0.01142,"107":0.07994,"108":2.2269,"109":2.09557},E:{"4":0,"5":0,"6":0,"7":0,"8":0.00571,"9":0.01713,"10":0,"11":0,"12":0.00571,"13":0.01713,"14":0.13133,"15":0.02284,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0.01713,"10.1":0,"11.1":0.00571,"12.1":0.05139,"13.1":0.21127,"14.1":0.33689,"15.1":0.03997,"15.2-15.3":0.05139,"15.4":0.10849,"15.5":0.20556,"15.6":1.57596,"16.0":0.1713,"16.1":0.48535,"16.2":1.07919,"16.3":0.06852},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0.00403,"7.0-7.1":0.01612,"8.1-8.4":0.02015,"9.0-9.2":0.02015,"9.3":0.24183,"10.0-10.2":0.01209,"10.3":0.2378,"11.0-11.2":0.13704,"11.3-11.4":0.07255,"12.0-12.1":0.04434,"12.2-12.5":1.08422,"13.0-13.1":0.02418,"13.2":0.02015,"13.3":0.06449,"13.4-13.7":0.21362,"14.0-14.4":0.46351,"14.5-14.8":1.35024,"15.0-15.1":0.33857,"15.2-15.3":0.38693,"15.4":0.45948,"15.5":1.06004,"15.6":5.65891,"16.0":3.82097,"16.1":13.6112,"16.2":8.29086,"16.3":0.57637},P:{"4":0.11612,"5.0-5.4":0.02111,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0.01056,"11.1-11.2":0.02111,"12.0":0.01056,"13.0":0.02111,"14.0":0.01056,"15.0":0.01056,"16.0":0.04223,"17.0":0.04223,"18.0":0.05278,"19.0":2.73416},I:{"0":0,"3":0,"4":0.01485,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00742,"4.2-4.3":0.03712,"4.4":0,"4.4.3-4.4.4":0.23758},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.01246,"9":0.01246,"10":0,"11":0.11212,"5.5":0},J:{"7":0,"10":0.00429},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.4719},Q:{"13.1":0.00429},O:{"0":0.08151},H:{"0":0.15028},L:{"0":24.55658},S:{"2.5":0}};
|
||||
@@ -0,0 +1,549 @@
|
||||
/// <reference types="node"/>
|
||||
import {ChildProcess} from 'child_process';
|
||||
import {Stream, Readable as ReadableStream} from 'stream';
|
||||
|
||||
declare namespace execa {
|
||||
type StdioOption =
|
||||
| 'pipe'
|
||||
| 'ipc'
|
||||
| 'ignore'
|
||||
| 'inherit'
|
||||
| Stream
|
||||
| number
|
||||
| undefined;
|
||||
|
||||
interface CommonOptions<EncodingType> {
|
||||
/**
|
||||
Kill the spawned process when the parent process exits unless either:
|
||||
- the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
|
||||
- the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly cleanup?: boolean;
|
||||
|
||||
/**
|
||||
Prefer locally installed binaries when looking for a binary to execute.
|
||||
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly preferLocal?: boolean;
|
||||
|
||||
/**
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly localDir?: string;
|
||||
|
||||
/**
|
||||
Path to the Node.js executable to use in child processes.
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
Requires `preferLocal` to be `true`.
|
||||
|
||||
For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly buffer?: boolean;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdin?: StdioOption;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdout?: StdioOption;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stderr?: StdioOption;
|
||||
|
||||
/**
|
||||
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly reject?: boolean;
|
||||
|
||||
/**
|
||||
Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly all?: boolean;
|
||||
|
||||
/**
|
||||
Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly stripFinalNewline?: boolean;
|
||||
|
||||
/**
|
||||
Set to `false` if you don't want to extend the environment variables when providing the `env` property.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly extendEnv?: boolean;
|
||||
|
||||
/**
|
||||
Current working directory of the child process.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
|
||||
|
||||
@default process.env
|
||||
*/
|
||||
readonly env?: NodeJS.ProcessEnv;
|
||||
|
||||
/**
|
||||
Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
|
||||
*/
|
||||
readonly argv0?: string;
|
||||
|
||||
/**
|
||||
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdio?: 'pipe' | 'ignore' | 'inherit' | readonly StdioOption[];
|
||||
|
||||
/**
|
||||
Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execa.node()`:
|
||||
- `json`: Uses `JSON.stringify()` and `JSON.parse()`.
|
||||
- `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
|
||||
|
||||
Requires Node.js `13.2.0` or later.
|
||||
|
||||
[More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
|
||||
|
||||
@default 'json'
|
||||
*/
|
||||
readonly serialization?: 'json' | 'advanced';
|
||||
|
||||
/**
|
||||
Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly detached?: boolean;
|
||||
|
||||
/**
|
||||
Sets the user identity of the process.
|
||||
*/
|
||||
readonly uid?: number;
|
||||
|
||||
/**
|
||||
Sets the group identity of the process.
|
||||
*/
|
||||
readonly gid?: number;
|
||||
|
||||
/**
|
||||
If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.
|
||||
|
||||
We recommend against using this option since it is:
|
||||
- not cross-platform, encouraging shell-specific syntax.
|
||||
- slower, because of the additional shell interpretation.
|
||||
- unsafe, potentially allowing command injection.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly shell?: boolean | string;
|
||||
|
||||
/**
|
||||
Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.
|
||||
|
||||
@default 'utf8'
|
||||
*/
|
||||
readonly encoding?: EncodingType;
|
||||
|
||||
/**
|
||||
If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than `timeout` milliseconds.
|
||||
|
||||
@default 0
|
||||
*/
|
||||
readonly timeout?: number;
|
||||
|
||||
/**
|
||||
Largest amount of data in bytes allowed on `stdout` or `stderr`. Default: 100 MB.
|
||||
|
||||
@default 100_000_000
|
||||
*/
|
||||
readonly maxBuffer?: number;
|
||||
|
||||
/**
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
@default 'SIGTERM'
|
||||
*/
|
||||
readonly killSignal?: string | number;
|
||||
|
||||
/**
|
||||
If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly windowsVerbatimArguments?: boolean;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly windowsHide?: boolean;
|
||||
}
|
||||
|
||||
interface Options<EncodingType = string> extends CommonOptions<EncodingType> {
|
||||
/**
|
||||
Write some input to the `stdin` of your binary.
|
||||
*/
|
||||
readonly input?: string | Buffer | ReadableStream;
|
||||
}
|
||||
|
||||
interface SyncOptions<EncodingType = string> extends CommonOptions<EncodingType> {
|
||||
/**
|
||||
Write some input to the `stdin` of your binary.
|
||||
*/
|
||||
readonly input?: string | Buffer;
|
||||
}
|
||||
|
||||
interface NodeOptions<EncodingType = string> extends Options<EncodingType> {
|
||||
/**
|
||||
The Node.js executable to use.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly nodePath?: string;
|
||||
|
||||
/**
|
||||
List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
|
||||
|
||||
@default process.execArgv
|
||||
*/
|
||||
readonly nodeOptions?: string[];
|
||||
}
|
||||
|
||||
interface ExecaReturnBase<StdoutStderrType> {
|
||||
/**
|
||||
The file and arguments that were run.
|
||||
*/
|
||||
command: string;
|
||||
|
||||
/**
|
||||
The numeric exit code of the process that was run.
|
||||
*/
|
||||
exitCode: number;
|
||||
|
||||
/**
|
||||
The output of the process on stdout.
|
||||
*/
|
||||
stdout: StdoutStderrType;
|
||||
|
||||
/**
|
||||
The output of the process on stderr.
|
||||
*/
|
||||
stderr: StdoutStderrType;
|
||||
|
||||
/**
|
||||
Whether the process failed to run.
|
||||
*/
|
||||
failed: boolean;
|
||||
|
||||
/**
|
||||
Whether the process timed out.
|
||||
*/
|
||||
timedOut: boolean;
|
||||
|
||||
/**
|
||||
Whether the process was killed.
|
||||
*/
|
||||
killed: boolean;
|
||||
|
||||
/**
|
||||
The name of the signal that was used to terminate the process. For example, `SIGFPE`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
|
||||
*/
|
||||
signal?: string;
|
||||
|
||||
/**
|
||||
A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.
|
||||
*/
|
||||
signalDescription?: string;
|
||||
}
|
||||
|
||||
interface ExecaSyncReturnValue<StdoutErrorType = string>
|
||||
extends ExecaReturnBase<StdoutErrorType> {
|
||||
}
|
||||
|
||||
/**
|
||||
Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.
|
||||
|
||||
The child process fails when:
|
||||
- its exit code is not `0`
|
||||
- it was killed with a signal
|
||||
- timing out
|
||||
- being canceled
|
||||
- there's not enough memory or there are already too many child processes
|
||||
*/
|
||||
interface ExecaReturnValue<StdoutErrorType = string>
|
||||
extends ExecaSyncReturnValue<StdoutErrorType> {
|
||||
/**
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (default value)
|
||||
- `execa.sync()` was used
|
||||
*/
|
||||
all?: StdoutErrorType;
|
||||
|
||||
/**
|
||||
Whether the process was canceled.
|
||||
*/
|
||||
isCanceled: boolean;
|
||||
}
|
||||
|
||||
interface ExecaSyncError<StdoutErrorType = string>
|
||||
extends Error,
|
||||
ExecaReturnBase<StdoutErrorType> {
|
||||
/**
|
||||
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.
|
||||
|
||||
The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
This is the same as the `message` property except it does not include the child process stdout/stderr.
|
||||
*/
|
||||
shortMessage: string;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
This is `undefined` unless the child process exited due to an `error` event or a timeout.
|
||||
*/
|
||||
originalMessage?: string;
|
||||
}
|
||||
|
||||
interface ExecaError<StdoutErrorType = string>
|
||||
extends ExecaSyncError<StdoutErrorType> {
|
||||
/**
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (default value)
|
||||
- `execa.sync()` was used
|
||||
*/
|
||||
all?: StdoutErrorType;
|
||||
|
||||
/**
|
||||
Whether the process was canceled.
|
||||
*/
|
||||
isCanceled: boolean;
|
||||
}
|
||||
|
||||
interface KillOptions {
|
||||
/**
|
||||
Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
|
||||
|
||||
Can be disabled with `false`.
|
||||
|
||||
@default 5000
|
||||
*/
|
||||
forceKillAfterTimeout?: number | false;
|
||||
}
|
||||
|
||||
interface ExecaChildPromise<StdoutErrorType> {
|
||||
catch<ResultType = never>(
|
||||
onRejected?: (reason: ExecaError<StdoutErrorType>) => ResultType | PromiseLike<ResultType>
|
||||
): Promise<ExecaReturnValue<StdoutErrorType> | ResultType>;
|
||||
|
||||
/**
|
||||
Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`.
|
||||
*/
|
||||
kill(signal?: string, options?: execa.KillOptions): void;
|
||||
|
||||
/**
|
||||
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`.
|
||||
*/
|
||||
cancel(): void;
|
||||
|
||||
/**
|
||||
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).
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (the default value)
|
||||
- both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
|
||||
*/
|
||||
all?: ReadableStream;
|
||||
}
|
||||
|
||||
type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &
|
||||
ExecaChildPromise<StdoutErrorType> &
|
||||
Promise<ExecaReturnValue<StdoutErrorType>>;
|
||||
}
|
||||
|
||||
declare const execa: {
|
||||
/**
|
||||
Execute a file.
|
||||
|
||||
Think of this as a mix of `child_process.execFile` and `child_process.spawn`.
|
||||
|
||||
@param file - The program/script to execute.
|
||||
@param arguments - Arguments to pass to `file` on execution.
|
||||
@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.
|
||||
|
||||
@example
|
||||
```
|
||||
import execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
|
||||
// Cancelling a spawned process
|
||||
const subprocess = execa('node');
|
||||
setTimeout(() => { spawned.cancel() }, 1000);
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
})();
|
||||
|
||||
// Pipe the child process stdout to the current stdout
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
```
|
||||
*/
|
||||
(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options
|
||||
): execa.ExecaChildProcess;
|
||||
(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options<null>
|
||||
): execa.ExecaChildProcess<Buffer>;
|
||||
(file: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
(file: string, options?: execa.Options<null>): execa.ExecaChildProcess<
|
||||
Buffer
|
||||
>;
|
||||
|
||||
/**
|
||||
Execute a file synchronously.
|
||||
|
||||
This method throws an `Error` if the command fails.
|
||||
|
||||
@param file - The program/script to execute.
|
||||
@param arguments - Arguments to pass to `file` on execution.
|
||||
@returns A result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
sync(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.SyncOptions
|
||||
): execa.ExecaSyncReturnValue;
|
||||
sync(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.SyncOptions<null>
|
||||
): execa.ExecaSyncReturnValue<Buffer>;
|
||||
sync(file: string, options?: execa.SyncOptions): execa.ExecaSyncReturnValue;
|
||||
sync(
|
||||
file: string,
|
||||
options?: execa.SyncOptions<null>
|
||||
): execa.ExecaSyncReturnValue<Buffer>;
|
||||
|
||||
/**
|
||||
Same as `execa()` except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execa.command('echo unicorns')`.
|
||||
|
||||
If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed.
|
||||
|
||||
The `shell` option must be used if the `command` uses shell-specific features, as opposed to being a simple `file` followed by its `arguments`.
|
||||
|
||||
@param command - The program/script to execute and its arguments.
|
||||
@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.
|
||||
|
||||
@example
|
||||
```
|
||||
import execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa.command('echo unicorns');
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
})();
|
||||
```
|
||||
*/
|
||||
command(command: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
command(command: string, options?: execa.Options<null>): execa.ExecaChildProcess<Buffer>;
|
||||
|
||||
/**
|
||||
Same as `execa.command()` but synchronous.
|
||||
|
||||
@param command - The program/script to execute and its arguments.
|
||||
@returns A result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
commandSync(command: string, options?: execa.SyncOptions): execa.ExecaSyncReturnValue;
|
||||
commandSync(command: string, options?: execa.SyncOptions<null>): execa.ExecaSyncReturnValue<Buffer>;
|
||||
|
||||
/**
|
||||
Execute a Node.js script as a child process.
|
||||
|
||||
Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):
|
||||
- the current Node version and options are used. This can be overridden using the `nodePath` and `nodeArguments` options.
|
||||
- the `shell` option cannot be used
|
||||
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
||||
|
||||
@param scriptPath - Node.js script to execute.
|
||||
@param arguments - Arguments to pass to `scriptPath` on execution.
|
||||
@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.
|
||||
*/
|
||||
node(
|
||||
scriptPath: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.NodeOptions
|
||||
): execa.ExecaChildProcess;
|
||||
node(
|
||||
scriptPath: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options<null>
|
||||
): execa.ExecaChildProcess<Buffer>;
|
||||
node(scriptPath: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
node(scriptPath: string, options?: execa.Options<null>): execa.ExecaChildProcess<Buffer>;
|
||||
};
|
||||
|
||||
export = execa;
|
||||
@@ -0,0 +1,279 @@
|
||||
'use strict';
|
||||
const stringWidth = require('string-width');
|
||||
const chalk = require('chalk');
|
||||
const widestLine = require('widest-line');
|
||||
const cliBoxes = require('cli-boxes');
|
||||
const camelCase = require('camelcase');
|
||||
const ansiAlign = require('ansi-align');
|
||||
const wrapAnsi = require('wrap-ansi');
|
||||
|
||||
const NL = '\n';
|
||||
const PAD = ' ';
|
||||
|
||||
const terminalColumns = () => {
|
||||
const {env, stdout, stderr} = process;
|
||||
|
||||
if (stdout && stdout.columns) {
|
||||
return stdout.columns;
|
||||
}
|
||||
|
||||
if (stderr && stderr.columns) {
|
||||
return stderr.columns;
|
||||
}
|
||||
|
||||
if (env.COLUMNS) {
|
||||
return Number.parseInt(env.COLUMNS, 10);
|
||||
}
|
||||
|
||||
return 80;
|
||||
};
|
||||
|
||||
const getObject = detail => {
|
||||
return typeof detail === 'number' ? {
|
||||
top: detail,
|
||||
right: detail * 3,
|
||||
bottom: detail,
|
||||
left: detail * 3
|
||||
} : {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
...detail
|
||||
};
|
||||
};
|
||||
|
||||
const getBorderChars = borderStyle => {
|
||||
const sides = [
|
||||
'topLeft',
|
||||
'topRight',
|
||||
'bottomRight',
|
||||
'bottomLeft',
|
||||
'vertical',
|
||||
'horizontal'
|
||||
];
|
||||
|
||||
let chararacters;
|
||||
|
||||
if (typeof borderStyle === 'string') {
|
||||
chararacters = cliBoxes[borderStyle];
|
||||
|
||||
if (!chararacters) {
|
||||
throw new TypeError(`Invalid border style: ${borderStyle}`);
|
||||
}
|
||||
} else {
|
||||
for (const side of sides) {
|
||||
if (!borderStyle[side] || typeof borderStyle[side] !== 'string') {
|
||||
throw new TypeError(`Invalid border style: ${side}`);
|
||||
}
|
||||
}
|
||||
|
||||
chararacters = borderStyle;
|
||||
}
|
||||
|
||||
return chararacters;
|
||||
};
|
||||
|
||||
const makeTitle = (text, horizontal, alignement) => {
|
||||
let title = '';
|
||||
|
||||
const textWidth = stringWidth(text);
|
||||
|
||||
switch (alignement) {
|
||||
case 'left':
|
||||
title = text + horizontal.slice(textWidth);
|
||||
break;
|
||||
case 'right':
|
||||
title = horizontal.slice(textWidth) + text;
|
||||
break;
|
||||
default:
|
||||
horizontal = horizontal.slice(textWidth);
|
||||
|
||||
if (horizontal.length % 2 === 1) { // This is needed in case the length is odd
|
||||
horizontal = horizontal.slice(Math.floor(horizontal.length / 2));
|
||||
title = horizontal.slice(1) + text + horizontal; // We reduce the left part of one character to avoid the bar to go beyond its limit
|
||||
} else {
|
||||
horizontal = horizontal.slice(horizontal.length / 2);
|
||||
title = horizontal + text + horizontal;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return title;
|
||||
};
|
||||
|
||||
const makeContentText = (text, padding, columns, align) => {
|
||||
text = ansiAlign(text, {align});
|
||||
let lines = text.split(NL);
|
||||
const textWidth = widestLine(text);
|
||||
|
||||
const max = columns - padding.left - padding.right;
|
||||
|
||||
if (textWidth > max) {
|
||||
const newLines = [];
|
||||
for (const line of lines) {
|
||||
const createdLines = wrapAnsi(line, max, {hard: true});
|
||||
const alignedLines = ansiAlign(createdLines, {align});
|
||||
const alignedLinesArray = alignedLines.split('\n');
|
||||
const longestLength = Math.max(...alignedLinesArray.map(s => stringWidth(s)));
|
||||
|
||||
for (const alignedLine of alignedLinesArray) {
|
||||
let paddedLine;
|
||||
switch (align) {
|
||||
case 'center':
|
||||
paddedLine = PAD.repeat((max - longestLength) / 2) + alignedLine;
|
||||
break;
|
||||
case 'right':
|
||||
paddedLine = PAD.repeat(max - longestLength) + alignedLine;
|
||||
break;
|
||||
default:
|
||||
paddedLine = alignedLine;
|
||||
break;
|
||||
}
|
||||
|
||||
newLines.push(paddedLine);
|
||||
}
|
||||
}
|
||||
|
||||
lines = newLines;
|
||||
}
|
||||
|
||||
if (align === 'center' && textWidth < max) {
|
||||
lines = lines.map(line => PAD.repeat((max - textWidth) / 2) + line);
|
||||
} else if (align === 'right' && textWidth < max) {
|
||||
lines = lines.map(line => PAD.repeat(max - textWidth) + line);
|
||||
}
|
||||
|
||||
const paddingLeft = PAD.repeat(padding.left);
|
||||
const paddingRight = PAD.repeat(padding.right);
|
||||
|
||||
lines = lines.map(line => paddingLeft + line + paddingRight);
|
||||
|
||||
lines = lines.map(line => {
|
||||
if (columns - stringWidth(line) > 0) {
|
||||
switch (align) {
|
||||
case 'center':
|
||||
return line + PAD.repeat(columns - stringWidth(line));
|
||||
case 'right':
|
||||
return line + PAD.repeat(columns - stringWidth(line));
|
||||
default:
|
||||
return line + PAD.repeat(columns - stringWidth(line));
|
||||
}
|
||||
}
|
||||
|
||||
return line;
|
||||
});
|
||||
|
||||
if (padding.top > 0) {
|
||||
lines = new Array(padding.top).fill(PAD.repeat(columns)).concat(lines);
|
||||
}
|
||||
|
||||
if (padding.bottom > 0) {
|
||||
lines = lines.concat(new Array(padding.bottom).fill(PAD.repeat(columns)));
|
||||
}
|
||||
|
||||
return lines.join(NL);
|
||||
};
|
||||
|
||||
const isHex = color => color.match(/^#(?:[0-f]{3}){1,2}$/i);
|
||||
const isColorValid = color => typeof color === 'string' && ((chalk[color]) || isHex(color));
|
||||
const getColorFn = color => isHex(color) ? chalk.hex(color) : chalk[color];
|
||||
const getBGColorFn = color => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(['bg', color])];
|
||||
|
||||
module.exports = (text, options) => {
|
||||
options = {
|
||||
padding: 0,
|
||||
borderStyle: 'single',
|
||||
dimBorder: false,
|
||||
textAlignment: 'left',
|
||||
float: 'left',
|
||||
titleAlignment: 'left',
|
||||
...options
|
||||
};
|
||||
|
||||
// This option is deprecated
|
||||
if (options.align) {
|
||||
options.textAlignment = options.align;
|
||||
}
|
||||
|
||||
const BORDERS_WIDTH = 2;
|
||||
|
||||
if (options.borderColor && !isColorValid(options.borderColor)) {
|
||||
throw new Error(`${options.borderColor} is not a valid borderColor`);
|
||||
}
|
||||
|
||||
if (options.backgroundColor && !isColorValid(options.backgroundColor)) {
|
||||
throw new Error(`${options.backgroundColor} is not a valid backgroundColor`);
|
||||
}
|
||||
|
||||
const chars = getBorderChars(options.borderStyle);
|
||||
const padding = getObject(options.padding);
|
||||
const margin = getObject(options.margin);
|
||||
|
||||
const colorizeBorder = border => {
|
||||
const newBorder = options.borderColor ? getColorFn(options.borderColor)(border) : border;
|
||||
return options.dimBorder ? chalk.dim(newBorder) : newBorder;
|
||||
};
|
||||
|
||||
const colorizeContent = content => options.backgroundColor ? getBGColorFn(options.backgroundColor)(content) : content;
|
||||
|
||||
const columns = terminalColumns();
|
||||
|
||||
let contentWidth = widestLine(wrapAnsi(text, columns - BORDERS_WIDTH, {hard: true, trim: false})) + padding.left + padding.right;
|
||||
|
||||
// This prevents the title bar to exceed the console's width
|
||||
let title = options.title && options.title.slice(0, columns - 4 - margin.left - margin.right);
|
||||
|
||||
if (title) {
|
||||
title = ` ${title} `;
|
||||
// Make the box larger to fit a larger title
|
||||
if (stringWidth(title) > contentWidth) {
|
||||
contentWidth = stringWidth(title);
|
||||
}
|
||||
}
|
||||
|
||||
if ((margin.left && margin.right) && contentWidth + BORDERS_WIDTH + margin.left + margin.right > columns) {
|
||||
// Let's assume we have margins: left = 3, right = 5, in total = 8
|
||||
const spaceForMargins = columns - contentWidth - BORDERS_WIDTH;
|
||||
// Let's assume we have space = 4
|
||||
const multiplier = spaceForMargins / (margin.left + margin.right);
|
||||
// Here: multiplier = 4/8 = 0.5
|
||||
margin.left = Math.max(0, Math.floor(margin.left * multiplier));
|
||||
margin.right = Math.max(0, Math.floor(margin.right * multiplier));
|
||||
// Left: 3 * 0.5 = 1.5 -> 1
|
||||
// Right: 6 * 0.5 = 3
|
||||
}
|
||||
|
||||
// Prevent content from exceeding the console's width
|
||||
contentWidth = Math.min(contentWidth, columns - BORDERS_WIDTH - margin.left - margin.right);
|
||||
|
||||
text = makeContentText(text, padding, contentWidth, options.textAlignment);
|
||||
|
||||
let marginLeft = PAD.repeat(margin.left);
|
||||
|
||||
if (options.float === 'center') {
|
||||
const marginWidth = Math.max((columns - contentWidth - BORDERS_WIDTH) / 2, 0);
|
||||
marginLeft = PAD.repeat(marginWidth);
|
||||
} else if (options.float === 'right') {
|
||||
const marginWidth = Math.max(columns - contentWidth - margin.right - BORDERS_WIDTH, 0);
|
||||
marginLeft = PAD.repeat(marginWidth);
|
||||
}
|
||||
|
||||
const horizontal = chars.horizontal.repeat(contentWidth);
|
||||
const top = colorizeBorder(NL.repeat(margin.top) + marginLeft + chars.topLeft + (title ? makeTitle(title, horizontal, options.titleAlignment) : horizontal) + chars.topRight);
|
||||
const bottom = colorizeBorder(marginLeft + chars.bottomLeft + horizontal + chars.bottomRight + NL.repeat(margin.bottom));
|
||||
const side = colorizeBorder(chars.vertical);
|
||||
|
||||
const LINE_SEPARATOR = (contentWidth + BORDERS_WIDTH + margin.left >= columns) ? '' : NL;
|
||||
|
||||
const lines = text.split(NL);
|
||||
|
||||
const middle = lines.map(line => {
|
||||
return marginLeft + side + colorizeContent(line) + side;
|
||||
}).join(LINE_SEPARATOR);
|
||||
|
||||
return top + LINE_SEPARATOR + middle + LINE_SEPARATOR + bottom;
|
||||
};
|
||||
|
||||
module.exports._borderStyles = cliBoxes;
|
||||
@@ -0,0 +1,554 @@
|
||||
/// <reference types="node"/>
|
||||
import {ChildProcess} from 'child_process';
|
||||
import {Stream, Readable as ReadableStream} from 'stream';
|
||||
|
||||
declare namespace execa {
|
||||
type StdioOption =
|
||||
| 'pipe'
|
||||
| 'ipc'
|
||||
| 'ignore'
|
||||
| 'inherit'
|
||||
| Stream
|
||||
| number
|
||||
| undefined;
|
||||
|
||||
interface CommonOptions<EncodingType> {
|
||||
/**
|
||||
Kill the spawned process when the parent process exits unless either:
|
||||
- the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
|
||||
- the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly cleanup?: boolean;
|
||||
|
||||
/**
|
||||
Prefer locally installed binaries when looking for a binary to execute.
|
||||
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly preferLocal?: boolean;
|
||||
|
||||
/**
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly localDir?: string;
|
||||
|
||||
/**
|
||||
Path to the Node.js executable to use in child processes.
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
Requires `preferLocal` to be `true`.
|
||||
|
||||
For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly buffer?: boolean;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdin?: StdioOption;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdout?: StdioOption;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stderr?: StdioOption;
|
||||
|
||||
/**
|
||||
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly reject?: boolean;
|
||||
|
||||
/**
|
||||
Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly all?: boolean;
|
||||
|
||||
/**
|
||||
Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly stripFinalNewline?: boolean;
|
||||
|
||||
/**
|
||||
Set to `false` if you don't want to extend the environment variables when providing the `env` property.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly extendEnv?: boolean;
|
||||
|
||||
/**
|
||||
Current working directory of the child process.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
|
||||
|
||||
@default process.env
|
||||
*/
|
||||
readonly env?: NodeJS.ProcessEnv;
|
||||
|
||||
/**
|
||||
Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
|
||||
*/
|
||||
readonly argv0?: string;
|
||||
|
||||
/**
|
||||
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdio?: 'pipe' | 'ignore' | 'inherit' | readonly StdioOption[];
|
||||
|
||||
/**
|
||||
Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execa.node()`:
|
||||
- `json`: Uses `JSON.stringify()` and `JSON.parse()`.
|
||||
- `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
|
||||
|
||||
Requires Node.js `13.2.0` or later.
|
||||
|
||||
[More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
|
||||
|
||||
@default 'json'
|
||||
*/
|
||||
readonly serialization?: 'json' | 'advanced';
|
||||
|
||||
/**
|
||||
Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly detached?: boolean;
|
||||
|
||||
/**
|
||||
Sets the user identity of the process.
|
||||
*/
|
||||
readonly uid?: number;
|
||||
|
||||
/**
|
||||
Sets the group identity of the process.
|
||||
*/
|
||||
readonly gid?: number;
|
||||
|
||||
/**
|
||||
If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.
|
||||
|
||||
We recommend against using this option since it is:
|
||||
- not cross-platform, encouraging shell-specific syntax.
|
||||
- slower, because of the additional shell interpretation.
|
||||
- unsafe, potentially allowing command injection.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly shell?: boolean | string;
|
||||
|
||||
/**
|
||||
Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.
|
||||
|
||||
@default 'utf8'
|
||||
*/
|
||||
readonly encoding?: EncodingType;
|
||||
|
||||
/**
|
||||
If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than `timeout` milliseconds.
|
||||
|
||||
@default 0
|
||||
*/
|
||||
readonly timeout?: number;
|
||||
|
||||
/**
|
||||
Largest amount of data in bytes allowed on `stdout` or `stderr`. Default: 100 MB.
|
||||
|
||||
@default 100_000_000
|
||||
*/
|
||||
readonly maxBuffer?: number;
|
||||
|
||||
/**
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
@default 'SIGTERM'
|
||||
*/
|
||||
readonly killSignal?: string | number;
|
||||
|
||||
/**
|
||||
If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly windowsVerbatimArguments?: boolean;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly windowsHide?: boolean;
|
||||
}
|
||||
|
||||
interface Options<EncodingType = string> extends CommonOptions<EncodingType> {
|
||||
/**
|
||||
Write some input to the `stdin` of your binary.
|
||||
*/
|
||||
readonly input?: string | Buffer | ReadableStream;
|
||||
}
|
||||
|
||||
interface SyncOptions<EncodingType = string> extends CommonOptions<EncodingType> {
|
||||
/**
|
||||
Write some input to the `stdin` of your binary.
|
||||
*/
|
||||
readonly input?: string | Buffer;
|
||||
}
|
||||
|
||||
interface NodeOptions<EncodingType = string> extends Options<EncodingType> {
|
||||
/**
|
||||
The Node.js executable to use.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly nodePath?: string;
|
||||
|
||||
/**
|
||||
List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
|
||||
|
||||
@default process.execArgv
|
||||
*/
|
||||
readonly nodeOptions?: string[];
|
||||
}
|
||||
|
||||
interface ExecaReturnBase<StdoutStderrType> {
|
||||
/**
|
||||
The file and arguments that were run.
|
||||
*/
|
||||
command: string;
|
||||
|
||||
/**
|
||||
The numeric exit code of the process that was run.
|
||||
*/
|
||||
exitCode: number;
|
||||
|
||||
/**
|
||||
The output of the process on stdout.
|
||||
*/
|
||||
stdout: StdoutStderrType;
|
||||
|
||||
/**
|
||||
The output of the process on stderr.
|
||||
*/
|
||||
stderr: StdoutStderrType;
|
||||
|
||||
/**
|
||||
Whether the process failed to run.
|
||||
*/
|
||||
failed: boolean;
|
||||
|
||||
/**
|
||||
Whether the process timed out.
|
||||
*/
|
||||
timedOut: boolean;
|
||||
|
||||
/**
|
||||
Whether the process was killed.
|
||||
*/
|
||||
killed: boolean;
|
||||
|
||||
/**
|
||||
The name of the signal that was used to terminate the process. For example, `SIGFPE`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
|
||||
*/
|
||||
signal?: string;
|
||||
|
||||
/**
|
||||
A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.
|
||||
*/
|
||||
signalDescription?: string;
|
||||
}
|
||||
|
||||
interface ExecaSyncReturnValue<StdoutErrorType = string>
|
||||
extends ExecaReturnBase<StdoutErrorType> {
|
||||
}
|
||||
|
||||
/**
|
||||
Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.
|
||||
|
||||
The child process fails when:
|
||||
- its exit code is not `0`
|
||||
- it was killed with a signal
|
||||
- timing out
|
||||
- being canceled
|
||||
- there's not enough memory or there are already too many child processes
|
||||
*/
|
||||
interface ExecaReturnValue<StdoutErrorType = string>
|
||||
extends ExecaSyncReturnValue<StdoutErrorType> {
|
||||
/**
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (default value)
|
||||
- `execa.sync()` was used
|
||||
*/
|
||||
all?: StdoutErrorType;
|
||||
|
||||
/**
|
||||
Whether the process was canceled.
|
||||
*/
|
||||
isCanceled: boolean;
|
||||
}
|
||||
|
||||
interface ExecaSyncError<StdoutErrorType = string>
|
||||
extends Error,
|
||||
ExecaReturnBase<StdoutErrorType> {
|
||||
/**
|
||||
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.
|
||||
|
||||
The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
This is the same as the `message` property except it does not include the child process stdout/stderr.
|
||||
*/
|
||||
shortMessage: string;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
This is `undefined` unless the child process exited due to an `error` event or a timeout.
|
||||
*/
|
||||
originalMessage?: string;
|
||||
}
|
||||
|
||||
interface ExecaError<StdoutErrorType = string>
|
||||
extends ExecaSyncError<StdoutErrorType> {
|
||||
/**
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (default value)
|
||||
- `execa.sync()` was used
|
||||
*/
|
||||
all?: StdoutErrorType;
|
||||
|
||||
/**
|
||||
Whether the process was canceled.
|
||||
*/
|
||||
isCanceled: boolean;
|
||||
}
|
||||
|
||||
interface KillOptions {
|
||||
/**
|
||||
Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
|
||||
|
||||
Can be disabled with `false`.
|
||||
|
||||
@default 5000
|
||||
*/
|
||||
forceKillAfterTimeout?: number | false;
|
||||
}
|
||||
|
||||
interface ExecaChildPromise<StdoutErrorType> {
|
||||
/**
|
||||
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).
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (the default value)
|
||||
- both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
|
||||
*/
|
||||
all?: ReadableStream;
|
||||
|
||||
catch<ResultType = never>(
|
||||
onRejected?: (reason: ExecaError<StdoutErrorType>) => ResultType | PromiseLike<ResultType>
|
||||
): Promise<ExecaReturnValue<StdoutErrorType> | ResultType>;
|
||||
|
||||
/**
|
||||
Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`.
|
||||
*/
|
||||
kill(signal?: string, options?: KillOptions): void;
|
||||
|
||||
/**
|
||||
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`.
|
||||
*/
|
||||
cancel(): void;
|
||||
}
|
||||
|
||||
type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &
|
||||
ExecaChildPromise<StdoutErrorType> &
|
||||
Promise<ExecaReturnValue<StdoutErrorType>>;
|
||||
}
|
||||
|
||||
declare const execa: {
|
||||
/**
|
||||
Execute a file.
|
||||
|
||||
Think of this as a mix of `child_process.execFile` and `child_process.spawn`.
|
||||
|
||||
@param file - The program/script to execute.
|
||||
@param arguments - Arguments to pass to `file` on execution.
|
||||
@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.
|
||||
|
||||
@example
|
||||
```
|
||||
import execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
|
||||
// Cancelling a spawned process
|
||||
|
||||
const subprocess = execa('node');
|
||||
|
||||
setTimeout(() => {
|
||||
subprocess.cancel()
|
||||
}, 1000);
|
||||
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
})();
|
||||
|
||||
// Pipe the child process stdout to the current stdout
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
```
|
||||
*/
|
||||
(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options
|
||||
): execa.ExecaChildProcess;
|
||||
(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options<null>
|
||||
): execa.ExecaChildProcess<Buffer>;
|
||||
(file: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
(file: string, options?: execa.Options<null>): execa.ExecaChildProcess<
|
||||
Buffer
|
||||
>;
|
||||
|
||||
/**
|
||||
Execute a file synchronously.
|
||||
|
||||
This method throws an `Error` if the command fails.
|
||||
|
||||
@param file - The program/script to execute.
|
||||
@param arguments - Arguments to pass to `file` on execution.
|
||||
@returns A result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
sync(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.SyncOptions
|
||||
): execa.ExecaSyncReturnValue;
|
||||
sync(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.SyncOptions<null>
|
||||
): execa.ExecaSyncReturnValue<Buffer>;
|
||||
sync(file: string, options?: execa.SyncOptions): execa.ExecaSyncReturnValue;
|
||||
sync(
|
||||
file: string,
|
||||
options?: execa.SyncOptions<null>
|
||||
): execa.ExecaSyncReturnValue<Buffer>;
|
||||
|
||||
/**
|
||||
Same as `execa()` except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execa.command('echo unicorns')`.
|
||||
|
||||
If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed.
|
||||
|
||||
The `shell` option must be used if the `command` uses shell-specific features, as opposed to being a simple `file` followed by its `arguments`.
|
||||
|
||||
@param command - The program/script to execute and its arguments.
|
||||
@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.
|
||||
|
||||
@example
|
||||
```
|
||||
import execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa.command('echo unicorns');
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
})();
|
||||
```
|
||||
*/
|
||||
command(command: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
command(command: string, options?: execa.Options<null>): execa.ExecaChildProcess<Buffer>;
|
||||
|
||||
/**
|
||||
Same as `execa.command()` but synchronous.
|
||||
|
||||
@param command - The program/script to execute and its arguments.
|
||||
@returns A result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
commandSync(command: string, options?: execa.SyncOptions): execa.ExecaSyncReturnValue;
|
||||
commandSync(command: string, options?: execa.SyncOptions<null>): execa.ExecaSyncReturnValue<Buffer>;
|
||||
|
||||
/**
|
||||
Execute a Node.js script as a child process.
|
||||
|
||||
Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):
|
||||
- the current Node version and options are used. This can be overridden using the `nodePath` and `nodeArguments` options.
|
||||
- the `shell` option cannot be used
|
||||
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
||||
|
||||
@param scriptPath - Node.js script to execute.
|
||||
@param arguments - Arguments to pass to `scriptPath` on execution.
|
||||
@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.
|
||||
*/
|
||||
node(
|
||||
scriptPath: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.NodeOptions
|
||||
): execa.ExecaChildProcess;
|
||||
node(
|
||||
scriptPath: string,
|
||||
arguments?: readonly string[],
|
||||
options?: execa.Options<null>
|
||||
): execa.ExecaChildProcess<Buffer>;
|
||||
node(scriptPath: string, options?: execa.Options): execa.ExecaChildProcess;
|
||||
node(scriptPath: string, options?: execa.Options<null>): execa.ExecaChildProcess<Buffer>;
|
||||
};
|
||||
|
||||
export = execa;
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Subject } from '../Subject';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { Scheduler } from '../Scheduler';
|
||||
import { TestMessage } from './TestMessage';
|
||||
import { SubscriptionLog } from './SubscriptionLog';
|
||||
import { SubscriptionLoggable } from './SubscriptionLoggable';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export declare class HotObservable<T> extends Subject<T> implements SubscriptionLoggable {
|
||||
messages: TestMessage[];
|
||||
subscriptions: SubscriptionLog[];
|
||||
scheduler: Scheduler;
|
||||
logSubscribedFrame: () => number;
|
||||
logUnsubscribedFrame: (index: number) => void;
|
||||
constructor(messages: TestMessage[], scheduler: Scheduler);
|
||||
/** @deprecated This is an internal implementation detail, do not use. */
|
||||
_subscribe(subscriber: Subscriber<any>): Subscription;
|
||||
setup(): void;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operators/filter';
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "autoprefixer",
|
||||
"version": "10.2.5",
|
||||
"description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
},
|
||||
"keywords": [
|
||||
"autoprefixer",
|
||||
"css",
|
||||
"prefix",
|
||||
"postcss",
|
||||
"postcss-plugin"
|
||||
],
|
||||
"main": "lib/autoprefixer.js",
|
||||
"bin": "bin/autoprefixer",
|
||||
"types": "lib/autoprefixer.d.ts",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
||||
"license": "MIT",
|
||||
"repository": "postcss/autoprefixer",
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"browserslist": "^4.16.3",
|
||||
"caniuse-lite": "^1.0.30001196",
|
||||
"colorette": "^1.2.2",
|
||||
"fraction.js": "^4.0.13",
|
||||
"normalize-range": "^0.1.2",
|
||||
"postcss-value-parser": "^4.1.0"
|
||||
},
|
||||
"browser": {
|
||||
"colorette": false,
|
||||
"chalk": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Lars Kappert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _v = _interopRequireDefault(require("./v35.js"));
|
||||
|
||||
var _sha = _interopRequireDefault(require("./sha1.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
||||
var _default = v5;
|
||||
exports.default = _default;
|
||||
@@ -0,0 +1,33 @@
|
||||
const inquirer = require('inquirer');
|
||||
|
||||
class Prompt {
|
||||
constructor({ container }) {
|
||||
this.createPrompt = (container.inquirer || inquirer).prompt;
|
||||
this.prompts = {};
|
||||
}
|
||||
|
||||
register(pluginPrompts, namespace = 'default') {
|
||||
this.prompts[namespace] = this.prompts[namespace] || {};
|
||||
Object.assign(this.prompts[namespace], pluginPrompts);
|
||||
}
|
||||
|
||||
async show({ enabled = true, prompt: promptName, namespace = 'default', task, context }) {
|
||||
if (!enabled) return false;
|
||||
|
||||
const prompt = this.prompts[namespace][promptName];
|
||||
const options = Object.assign({}, prompt, {
|
||||
name: promptName,
|
||||
message: prompt.message(context),
|
||||
choices: 'choices' in prompt && prompt.choices(context),
|
||||
transformer: 'transformer' in prompt && prompt.transformer(context)
|
||||
});
|
||||
|
||||
const answers = await this.createPrompt([options]);
|
||||
|
||||
const doExecute = prompt.type === 'confirm' ? answers[promptName] : true;
|
||||
|
||||
return doExecute && task ? await task(answers[promptName]) : false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Prompt;
|
||||
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Subscriber_1 = require("../Subscriber");
|
||||
function refCount() {
|
||||
return function refCountOperatorFunction(source) {
|
||||
return source.lift(new RefCountOperator(source));
|
||||
};
|
||||
}
|
||||
exports.refCount = refCount;
|
||||
var RefCountOperator = (function () {
|
||||
function RefCountOperator(connectable) {
|
||||
this.connectable = connectable;
|
||||
}
|
||||
RefCountOperator.prototype.call = function (subscriber, source) {
|
||||
var connectable = this.connectable;
|
||||
connectable._refCount++;
|
||||
var refCounter = new RefCountSubscriber(subscriber, connectable);
|
||||
var subscription = source.subscribe(refCounter);
|
||||
if (!refCounter.closed) {
|
||||
refCounter.connection = connectable.connect();
|
||||
}
|
||||
return subscription;
|
||||
};
|
||||
return RefCountOperator;
|
||||
}());
|
||||
var RefCountSubscriber = (function (_super) {
|
||||
__extends(RefCountSubscriber, _super);
|
||||
function RefCountSubscriber(destination, connectable) {
|
||||
var _this = _super.call(this, destination) || this;
|
||||
_this.connectable = connectable;
|
||||
return _this;
|
||||
}
|
||||
RefCountSubscriber.prototype._unsubscribe = function () {
|
||||
var connectable = this.connectable;
|
||||
if (!connectable) {
|
||||
this.connection = null;
|
||||
return;
|
||||
}
|
||||
this.connectable = null;
|
||||
var refCount = connectable._refCount;
|
||||
if (refCount <= 0) {
|
||||
this.connection = null;
|
||||
return;
|
||||
}
|
||||
connectable._refCount = refCount - 1;
|
||||
if (refCount > 1) {
|
||||
this.connection = null;
|
||||
return;
|
||||
}
|
||||
var connection = this.connection;
|
||||
var sharedConnection = connectable._connection;
|
||||
this.connection = null;
|
||||
if (sharedConnection && (!connection || sharedConnection === connection)) {
|
||||
sharedConnection.unsubscribe();
|
||||
}
|
||||
};
|
||||
return RefCountSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=refCount.js.map
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction } from '../types';
|
||||
/**
|
||||
* Returns an Observable that emits whether or not every item of the source satisfies the condition specified.
|
||||
*
|
||||
* ## Example
|
||||
* A simple example emitting true if all elements are less than 5, false otherwise
|
||||
* ```ts
|
||||
* import { of } from 'rxjs';
|
||||
* import { every } from 'rxjs/operators';
|
||||
*
|
||||
* of(1, 2, 3, 4, 5, 6).pipe(
|
||||
* every(x => x < 5),
|
||||
* )
|
||||
* .subscribe(x => console.log(x)); // -> false
|
||||
* ```
|
||||
*
|
||||
* @param {function} predicate A function for determining if an item meets a specified condition.
|
||||
* @param {any} [thisArg] Optional object to use for `this` in the callback.
|
||||
* @return {Observable} An Observable of booleans that determines if all items of the source Observable meet the condition specified.
|
||||
* @method every
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function every<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): OperatorFunction<T, boolean>;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"J E BC","129":"F G A B"},B:{"1":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB DC EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC"},E:{"1":"I u J E F G A B C K L H HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"GC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"G B C OC PC QC RC qB 9B SC rB"},G:{"1":"F TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"zB"},H:{"2":"nC"},I:{"1":"tB I D oC pC qC rC AC sC tC"},J:{"1":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"2":"D"},N:{"129":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:7,C:"CSS zoom"};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"generate.js","sources":["../../src/internal/observable/generate.ts"],"names":[],"mappings":";;AAAA,4CAA2C;AAE3C,6CAA4C;AAE5C,mDAAkD;AA8PlD,SAAgB,QAAQ,CAAO,qBAAgD,EAChD,SAA4B,EAC5B,OAAwB,EACxB,0BAA+D,EAC/D,SAAyB;IAEtD,IAAI,cAAgC,CAAC;IACrC,IAAI,YAAe,CAAC;IAEpB,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE;QACzB,IAAM,OAAO,GAAG,qBAA8C,CAAC;QAC/D,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACpC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAC9B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC1B,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,mBAA4B,CAAC;QACxE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;KAC/B;SAAM,IAAI,0BAA0B,KAAK,SAAS,IAAI,yBAAW,CAAC,0BAA0B,CAAC,EAAE;QAC9F,YAAY,GAAG,qBAA0B,CAAC;QAC1C,cAAc,GAAG,mBAA4B,CAAC;QAC9C,SAAS,GAAG,0BAA2C,CAAC;KACzD;SAAM;QACL,YAAY,GAAG,qBAA0B,CAAC;QAC1C,cAAc,GAAG,0BAA8C,CAAC;KACjE;IAED,OAAO,IAAI,uBAAU,CAAI,UAAA,UAAU;QACjC,IAAI,KAAK,GAAG,YAAY,CAAC;QACzB,IAAI,SAAS,EAAE;YACb,OAAO,SAAS,CAAC,QAAQ,CAAuB,QAAQ,EAAE,CAAC,EAAE;gBAC3D,UAAU,YAAA;gBACV,OAAO,SAAA;gBACP,SAAS,WAAA;gBACT,cAAc,gBAAA;gBACd,KAAK,OAAA;aACN,CAAC,CAAC;SACJ;QAED,GAAG;YACD,IAAI,SAAS,EAAE;gBACb,IAAI,eAAe,SAAS,CAAC;gBAC7B,IAAI;oBACF,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;iBACpC;gBAAC,OAAO,GAAG,EAAE;oBACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACtB,OAAO,SAAS,CAAC;iBAClB;gBACD,IAAI,CAAC,eAAe,EAAE;oBACpB,UAAU,CAAC,QAAQ,EAAE,CAAC;oBACtB,MAAM;iBACP;aACF;YACD,IAAI,KAAK,SAAG,CAAC;YACb,IAAI;gBACF,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;aAC/B;YAAC,OAAO,GAAG,EAAE;gBACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACtB,OAAO,SAAS,CAAC;aAClB;YACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,IAAI,UAAU,CAAC,MAAM,EAAE;gBACrB,MAAM;aACP;YACD,IAAI;gBACF,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;aACxB;YAAC,OAAO,GAAG,EAAE;gBACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACtB,OAAO,SAAS,CAAC;aAClB;SACF,QAAQ,IAAI,EAAE;QAEf,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC;AAxED,4BAwEC;AAED,SAAS,QAAQ,CAAoD,KAA2B;IACtF,IAAA,6BAAU,EAAE,2BAAS,CAAW;IACxC,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,KAAK,CAAC,WAAW,EAAE;QACrB,IAAI;YACF,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1C;QAAC,OAAO,GAAG,EAAE;YACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACtB,OAAO,SAAS,CAAC;SAClB;KACF;SAAM;QACL,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;KAC1B;IACD,IAAI,SAAS,EAAE;QACb,IAAI,eAAe,SAAS,CAAC;QAC7B,IAAI;YACF,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1C;QAAC,OAAO,GAAG,EAAE;YACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACtB,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,eAAe,EAAE;YACpB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACtB,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,UAAU,CAAC,MAAM,EAAE;YACrB,OAAO,SAAS,CAAC;SAClB;KACF;IACD,IAAI,KAAQ,CAAC;IACb,IAAI;QACF,KAAK,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC3C;IAAC,OAAO,GAAG,EAAE;QACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvB,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/SubjectSubscription';
|
||||
@@ -0,0 +1 @@
|
||||
export const VERSION = "6.41.0";
|
||||
Reference in New Issue
Block a user