serverless-spy 2.2.4 → 2.2.5

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.
Files changed (216) hide show
  1. package/.jsii +3 -3
  2. package/dist/releasetag.txt +1 -1
  3. package/lib/src/ServerlessSpy.js +1 -1
  4. package/node_modules/bundle-name/index.js +2 -2
  5. package/node_modules/bundle-name/package.json +6 -5
  6. package/node_modules/bundle-name/readme.md +2 -2
  7. package/node_modules/default-browser/index.d.ts +5 -4
  8. package/node_modules/default-browser/index.js +13 -11
  9. package/node_modules/default-browser/package.json +14 -12
  10. package/node_modules/default-browser/windows.js +11 -5
  11. package/node_modules/default-browser-id/index.js +8 -32
  12. package/node_modules/default-browser-id/package.json +5 -8
  13. package/node_modules/default-browser-id/readme.md +2 -2
  14. package/node_modules/open/index.js +10 -10
  15. package/node_modules/{is-wsl → open/node_modules/is-wsl}/index.d.ts +2 -2
  16. package/node_modules/open/node_modules/is-wsl/index.js +27 -0
  17. package/node_modules/{is-wsl → open/node_modules/is-wsl}/package.json +21 -9
  18. package/node_modules/open/node_modules/is-wsl/readme.md +21 -0
  19. package/node_modules/open/package.json +9 -8
  20. package/node_modules/open/xdg-open +338 -137
  21. package/node_modules/run-applescript/index.d.ts +28 -4
  22. package/node_modules/run-applescript/index.js +20 -7
  23. package/node_modules/run-applescript/package.json +10 -9
  24. package/node_modules/run-applescript/readme.md +44 -6
  25. package/package.json +2 -2
  26. package/node_modules/big-integer/BigInteger.d.ts +0 -2393
  27. package/node_modules/big-integer/BigInteger.js +0 -1453
  28. package/node_modules/big-integer/BigInteger.min.js +0 -1
  29. package/node_modules/big-integer/LICENSE +0 -24
  30. package/node_modules/big-integer/README.md +0 -589
  31. package/node_modules/big-integer/bower.json +0 -29
  32. package/node_modules/big-integer/package.json +0 -48
  33. package/node_modules/big-integer/tsconfig.json +0 -24
  34. package/node_modules/bplist-parser/README.md +0 -48
  35. package/node_modules/bplist-parser/bplistParser.js +0 -363
  36. package/node_modules/bplist-parser/package.json +0 -34
  37. package/node_modules/bplist-parser/test/airplay.bplist +0 -0
  38. package/node_modules/bplist-parser/test/iTunes-small.bplist +0 -0
  39. package/node_modules/bplist-parser/test/int64.bplist +0 -0
  40. package/node_modules/bplist-parser/test/int64.xml +0 -10
  41. package/node_modules/bplist-parser/test/parseTest.js +0 -104
  42. package/node_modules/bplist-parser/test/sample1.bplist +0 -0
  43. package/node_modules/bplist-parser/test/sample2.bplist +0 -0
  44. package/node_modules/bplist-parser/test/uid.bplist +0 -0
  45. package/node_modules/bplist-parser/test/utf16.bplist +0 -0
  46. package/node_modules/bplist-parser/test/utf16_chinese.plist +0 -0
  47. package/node_modules/cross-spawn/CHANGELOG.md +0 -130
  48. package/node_modules/cross-spawn/LICENSE +0 -21
  49. package/node_modules/cross-spawn/README.md +0 -96
  50. package/node_modules/cross-spawn/index.js +0 -39
  51. package/node_modules/cross-spawn/lib/enoent.js +0 -59
  52. package/node_modules/cross-spawn/lib/parse.js +0 -91
  53. package/node_modules/cross-spawn/lib/util/escape.js +0 -45
  54. package/node_modules/cross-spawn/lib/util/readShebang.js +0 -23
  55. package/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -52
  56. package/node_modules/cross-spawn/package.json +0 -73
  57. package/node_modules/default-browser/node_modules/execa/index.d.ts +0 -937
  58. package/node_modules/default-browser/node_modules/execa/index.js +0 -309
  59. package/node_modules/default-browser/node_modules/execa/lib/command.js +0 -120
  60. package/node_modules/default-browser/node_modules/execa/lib/error.js +0 -87
  61. package/node_modules/default-browser/node_modules/execa/lib/kill.js +0 -102
  62. package/node_modules/default-browser/node_modules/execa/lib/pipe.js +0 -42
  63. package/node_modules/default-browser/node_modules/execa/lib/promise.js +0 -36
  64. package/node_modules/default-browser/node_modules/execa/lib/stdio.js +0 -49
  65. package/node_modules/default-browser/node_modules/execa/lib/stream.js +0 -119
  66. package/node_modules/default-browser/node_modules/execa/lib/verbose.js +0 -19
  67. package/node_modules/default-browser/node_modules/execa/package.json +0 -87
  68. package/node_modules/default-browser/node_modules/execa/readme.md +0 -824
  69. package/node_modules/default-browser/node_modules/human-signals/LICENSE +0 -201
  70. package/node_modules/default-browser/node_modules/human-signals/README.md +0 -178
  71. package/node_modules/default-browser/node_modules/human-signals/build/src/core.js +0 -273
  72. package/node_modules/default-browser/node_modules/human-signals/build/src/main.d.ts +0 -73
  73. package/node_modules/default-browser/node_modules/human-signals/build/src/main.js +0 -70
  74. package/node_modules/default-browser/node_modules/human-signals/build/src/realtime.js +0 -16
  75. package/node_modules/default-browser/node_modules/human-signals/build/src/signals.js +0 -34
  76. package/node_modules/default-browser/node_modules/human-signals/package.json +0 -61
  77. package/node_modules/default-browser/node_modules/is-stream/index.d.ts +0 -81
  78. package/node_modules/default-browser/node_modules/is-stream/index.js +0 -29
  79. package/node_modules/default-browser/node_modules/is-stream/license +0 -9
  80. package/node_modules/default-browser/node_modules/is-stream/package.json +0 -44
  81. package/node_modules/default-browser/node_modules/is-stream/readme.md +0 -60
  82. package/node_modules/default-browser/node_modules/mimic-fn/index.d.ts +0 -52
  83. package/node_modules/default-browser/node_modules/mimic-fn/index.js +0 -71
  84. package/node_modules/default-browser/node_modules/mimic-fn/license +0 -9
  85. package/node_modules/default-browser/node_modules/mimic-fn/package.json +0 -45
  86. package/node_modules/default-browser/node_modules/mimic-fn/readme.md +0 -90
  87. package/node_modules/default-browser/node_modules/npm-run-path/index.d.ts +0 -90
  88. package/node_modules/default-browser/node_modules/npm-run-path/index.js +0 -52
  89. package/node_modules/default-browser/node_modules/npm-run-path/license +0 -9
  90. package/node_modules/default-browser/node_modules/npm-run-path/package.json +0 -49
  91. package/node_modules/default-browser/node_modules/npm-run-path/readme.md +0 -104
  92. package/node_modules/default-browser/node_modules/onetime/index.d.ts +0 -59
  93. package/node_modules/default-browser/node_modules/onetime/index.js +0 -41
  94. package/node_modules/default-browser/node_modules/onetime/license +0 -9
  95. package/node_modules/default-browser/node_modules/onetime/package.json +0 -45
  96. package/node_modules/default-browser/node_modules/onetime/readme.md +0 -94
  97. package/node_modules/default-browser/node_modules/path-key/index.d.ts +0 -31
  98. package/node_modules/default-browser/node_modules/path-key/index.js +0 -12
  99. package/node_modules/default-browser/node_modules/path-key/license +0 -9
  100. package/node_modules/default-browser/node_modules/path-key/package.json +0 -41
  101. package/node_modules/default-browser/node_modules/path-key/readme.md +0 -57
  102. package/node_modules/default-browser/node_modules/strip-final-newline/index.js +0 -14
  103. package/node_modules/default-browser/node_modules/strip-final-newline/license +0 -9
  104. package/node_modules/default-browser/node_modules/strip-final-newline/package.json +0 -43
  105. package/node_modules/default-browser/node_modules/strip-final-newline/readme.md +0 -35
  106. package/node_modules/execa/index.d.ts +0 -564
  107. package/node_modules/execa/index.js +0 -268
  108. package/node_modules/execa/lib/command.js +0 -52
  109. package/node_modules/execa/lib/error.js +0 -88
  110. package/node_modules/execa/lib/kill.js +0 -115
  111. package/node_modules/execa/lib/promise.js +0 -46
  112. package/node_modules/execa/lib/stdio.js +0 -52
  113. package/node_modules/execa/lib/stream.js +0 -97
  114. package/node_modules/execa/license +0 -9
  115. package/node_modules/execa/package.json +0 -74
  116. package/node_modules/execa/readme.md +0 -663
  117. package/node_modules/get-stream/buffer-stream.js +0 -52
  118. package/node_modules/get-stream/index.d.ts +0 -105
  119. package/node_modules/get-stream/index.js +0 -61
  120. package/node_modules/get-stream/license +0 -9
  121. package/node_modules/get-stream/package.json +0 -47
  122. package/node_modules/get-stream/readme.md +0 -124
  123. package/node_modules/human-signals/CHANGELOG.md +0 -11
  124. package/node_modules/human-signals/LICENSE +0 -201
  125. package/node_modules/human-signals/README.md +0 -165
  126. package/node_modules/human-signals/build/src/core.js +0 -273
  127. package/node_modules/human-signals/build/src/core.js.map +0 -1
  128. package/node_modules/human-signals/build/src/main.d.ts +0 -52
  129. package/node_modules/human-signals/build/src/main.js +0 -71
  130. package/node_modules/human-signals/build/src/main.js.map +0 -1
  131. package/node_modules/human-signals/build/src/realtime.js +0 -19
  132. package/node_modules/human-signals/build/src/realtime.js.map +0 -1
  133. package/node_modules/human-signals/build/src/signals.js +0 -35
  134. package/node_modules/human-signals/build/src/signals.js.map +0 -1
  135. package/node_modules/human-signals/package.json +0 -64
  136. package/node_modules/is-stream/index.d.ts +0 -79
  137. package/node_modules/is-stream/index.js +0 -28
  138. package/node_modules/is-stream/license +0 -9
  139. package/node_modules/is-stream/package.json +0 -42
  140. package/node_modules/is-stream/readme.md +0 -60
  141. package/node_modules/is-wsl/index.js +0 -31
  142. package/node_modules/is-wsl/license +0 -9
  143. package/node_modules/is-wsl/node_modules/is-docker/cli.js +0 -5
  144. package/node_modules/is-wsl/node_modules/is-docker/index.d.ts +0 -15
  145. package/node_modules/is-wsl/node_modules/is-docker/index.js +0 -29
  146. package/node_modules/is-wsl/node_modules/is-docker/license +0 -9
  147. package/node_modules/is-wsl/node_modules/is-docker/package.json +0 -42
  148. package/node_modules/is-wsl/node_modules/is-docker/readme.md +0 -27
  149. package/node_modules/is-wsl/readme.md +0 -36
  150. package/node_modules/isexe/.npmignore +0 -2
  151. package/node_modules/isexe/LICENSE +0 -15
  152. package/node_modules/isexe/README.md +0 -51
  153. package/node_modules/isexe/index.js +0 -57
  154. package/node_modules/isexe/mode.js +0 -41
  155. package/node_modules/isexe/package.json +0 -31
  156. package/node_modules/isexe/test/basic.js +0 -221
  157. package/node_modules/isexe/windows.js +0 -42
  158. package/node_modules/merge-stream/LICENSE +0 -21
  159. package/node_modules/merge-stream/README.md +0 -78
  160. package/node_modules/merge-stream/index.js +0 -41
  161. package/node_modules/merge-stream/package.json +0 -19
  162. package/node_modules/mimic-fn/index.d.ts +0 -54
  163. package/node_modules/mimic-fn/index.js +0 -13
  164. package/node_modules/mimic-fn/license +0 -9
  165. package/node_modules/mimic-fn/package.json +0 -42
  166. package/node_modules/mimic-fn/readme.md +0 -69
  167. package/node_modules/npm-run-path/index.d.ts +0 -89
  168. package/node_modules/npm-run-path/index.js +0 -47
  169. package/node_modules/npm-run-path/license +0 -9
  170. package/node_modules/npm-run-path/package.json +0 -44
  171. package/node_modules/npm-run-path/readme.md +0 -115
  172. package/node_modules/onetime/index.d.ts +0 -64
  173. package/node_modules/onetime/index.js +0 -44
  174. package/node_modules/onetime/license +0 -9
  175. package/node_modules/onetime/package.json +0 -43
  176. package/node_modules/onetime/readme.md +0 -94
  177. package/node_modules/path-key/index.d.ts +0 -40
  178. package/node_modules/path-key/index.js +0 -16
  179. package/node_modules/path-key/license +0 -9
  180. package/node_modules/path-key/package.json +0 -39
  181. package/node_modules/path-key/readme.md +0 -61
  182. package/node_modules/shebang-command/index.js +0 -19
  183. package/node_modules/shebang-command/license +0 -9
  184. package/node_modules/shebang-command/package.json +0 -34
  185. package/node_modules/shebang-command/readme.md +0 -34
  186. package/node_modules/shebang-regex/index.d.ts +0 -22
  187. package/node_modules/shebang-regex/index.js +0 -2
  188. package/node_modules/shebang-regex/license +0 -9
  189. package/node_modules/shebang-regex/package.json +0 -35
  190. package/node_modules/shebang-regex/readme.md +0 -33
  191. package/node_modules/signal-exit/LICENSE.txt +0 -16
  192. package/node_modules/signal-exit/README.md +0 -39
  193. package/node_modules/signal-exit/index.js +0 -202
  194. package/node_modules/signal-exit/package.json +0 -38
  195. package/node_modules/signal-exit/signals.js +0 -53
  196. package/node_modules/strip-final-newline/index.js +0 -16
  197. package/node_modules/strip-final-newline/license +0 -9
  198. package/node_modules/strip-final-newline/package.json +0 -40
  199. package/node_modules/strip-final-newline/readme.md +0 -30
  200. package/node_modules/titleize/index.d.ts +0 -17
  201. package/node_modules/titleize/index.js +0 -7
  202. package/node_modules/titleize/license +0 -9
  203. package/node_modules/titleize/package.json +0 -42
  204. package/node_modules/titleize/readme.md +0 -25
  205. package/node_modules/untildify/index.d.ts +0 -14
  206. package/node_modules/untildify/index.js +0 -12
  207. package/node_modules/untildify/license +0 -9
  208. package/node_modules/untildify/package.json +0 -43
  209. package/node_modules/untildify/readme.md +0 -30
  210. package/node_modules/which/CHANGELOG.md +0 -166
  211. package/node_modules/which/LICENSE +0 -15
  212. package/node_modules/which/README.md +0 -54
  213. package/node_modules/which/bin/node-which +0 -52
  214. package/node_modules/which/package.json +0 -43
  215. package/node_modules/which/which.js +0 -125
  216. /package/node_modules/{default-browser/node_modules/execa → open/node_modules/is-wsl}/license +0 -0
@@ -1,937 +0,0 @@
1
- import {type Buffer} from 'node:buffer';
2
- import {type ChildProcess} from 'node:child_process';
3
- import {type Stream, type Readable as ReadableStream, type Writable as WritableStream} from 'node:stream';
4
-
5
- export type StdioOption =
6
- | 'pipe'
7
- | 'overlapped'
8
- | 'ipc'
9
- | 'ignore'
10
- | 'inherit'
11
- | Stream
12
- | number
13
- | undefined;
14
-
15
- export type CommonOptions<EncodingType> = {
16
- /**
17
- Kill the spawned process when the parent process exits unless either:
18
- - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
19
- - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
20
-
21
- @default true
22
- */
23
- readonly cleanup?: boolean;
24
-
25
- /**
26
- Prefer locally installed binaries when looking for a binary to execute.
27
-
28
- If you `$ npm install foo`, you can then `execa('foo')`.
29
-
30
- @default `true` with `$`, `false` otherwise
31
- */
32
- readonly preferLocal?: boolean;
33
-
34
- /**
35
- Preferred path to find locally installed binaries in (use with `preferLocal`).
36
-
37
- @default process.cwd()
38
- */
39
- readonly localDir?: string | URL;
40
-
41
- /**
42
- Path to the Node.js executable to use in child processes.
43
-
44
- This can be either an absolute path or a path relative to the `cwd` option.
45
-
46
- Requires `preferLocal` to be `true`.
47
-
48
- 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.
49
-
50
- @default process.execPath
51
- */
52
- readonly execPath?: string;
53
-
54
- /**
55
- 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.
56
-
57
- If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
58
-
59
- @default true
60
- */
61
- readonly buffer?: boolean;
62
-
63
- /**
64
- Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
65
-
66
- @default `inherit` with `$`, `pipe` otherwise
67
- */
68
- readonly stdin?: StdioOption;
69
-
70
- /**
71
- Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
72
-
73
- @default 'pipe'
74
- */
75
- readonly stdout?: StdioOption;
76
-
77
- /**
78
- Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
79
-
80
- @default 'pipe'
81
- */
82
- readonly stderr?: StdioOption;
83
-
84
- /**
85
- Setting this to `false` resolves the promise with the error instead of rejecting it.
86
-
87
- @default true
88
- */
89
- readonly reject?: boolean;
90
-
91
- /**
92
- Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.
93
-
94
- @default false
95
- */
96
- readonly all?: boolean;
97
-
98
- /**
99
- Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
100
-
101
- @default true
102
- */
103
- readonly stripFinalNewline?: boolean;
104
-
105
- /**
106
- Set to `false` if you don't want to extend the environment variables when providing the `env` property.
107
-
108
- @default true
109
- */
110
- readonly extendEnv?: boolean;
111
-
112
- /**
113
- Current working directory of the child process.
114
-
115
- @default process.cwd()
116
- */
117
- readonly cwd?: string | URL;
118
-
119
- /**
120
- Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
121
-
122
- @default process.env
123
- */
124
- readonly env?: NodeJS.ProcessEnv;
125
-
126
- /**
127
- Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
128
- */
129
- readonly argv0?: string;
130
-
131
- /**
132
- Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
133
-
134
- @default 'pipe'
135
- */
136
- readonly stdio?: 'pipe' | 'overlapped' | 'ignore' | 'inherit' | readonly StdioOption[];
137
-
138
- /**
139
- Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:
140
- - `json`: Uses `JSON.stringify()` and `JSON.parse()`.
141
- - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
142
-
143
- [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
144
-
145
- @default 'json'
146
- */
147
- readonly serialization?: 'json' | 'advanced';
148
-
149
- /**
150
- 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).
151
-
152
- @default false
153
- */
154
- readonly detached?: boolean;
155
-
156
- /**
157
- Sets the user identity of the process.
158
- */
159
- readonly uid?: number;
160
-
161
- /**
162
- Sets the group identity of the process.
163
- */
164
- readonly gid?: number;
165
-
166
- /**
167
- 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.
168
-
169
- We recommend against using this option since it is:
170
- - not cross-platform, encouraging shell-specific syntax.
171
- - slower, because of the additional shell interpretation.
172
- - unsafe, potentially allowing command injection.
173
-
174
- @default false
175
- */
176
- readonly shell?: boolean | string;
177
-
178
- /**
179
- 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.
180
-
181
- @default 'utf8'
182
- */
183
- readonly encoding?: EncodingType;
184
-
185
- /**
186
- 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.
187
-
188
- @default 0
189
- */
190
- readonly timeout?: number;
191
-
192
- /**
193
- Largest amount of data in bytes allowed on `stdout` or `stderr`. Default: 100 MB.
194
-
195
- @default 100_000_000
196
- */
197
- readonly maxBuffer?: number;
198
-
199
- /**
200
- Signal value to be used when the spawned process will be killed.
201
-
202
- @default 'SIGTERM'
203
- */
204
- readonly killSignal?: string | number;
205
-
206
- /**
207
- You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
208
-
209
- When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `false`.
210
-
211
- *Requires Node.js 16 or later.*
212
-
213
- @example
214
- ```
215
- import {execa} from 'execa';
216
-
217
- const abortController = new AbortController();
218
- const subprocess = execa('node', [], {signal: abortController.signal});
219
-
220
- setTimeout(() => {
221
- abortController.abort();
222
- }, 1000);
223
-
224
- try {
225
- await subprocess;
226
- } catch (error) {
227
- console.log(subprocess.killed); // true
228
- console.log(error.isCanceled); // true
229
- }
230
- ```
231
- */
232
- readonly signal?: AbortSignal;
233
-
234
- /**
235
- 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`.
236
-
237
- @default false
238
- */
239
- readonly windowsVerbatimArguments?: boolean;
240
-
241
- /**
242
- 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.
243
-
244
- @default true
245
- */
246
- readonly windowsHide?: boolean;
247
-
248
- /**
249
- Print each command on `stderr` before executing it.
250
-
251
- This can also be enabled by setting the `NODE_DEBUG=execa` environment variable in the current process.
252
-
253
- @default false
254
- */
255
- readonly verbose?: boolean;
256
- };
257
-
258
- export type Options<EncodingType = string> = {
259
- /**
260
- Write some input to the `stdin` of your binary.
261
-
262
- If the input is a file, use the `inputFile` option instead.
263
- */
264
- readonly input?: string | Buffer | ReadableStream;
265
-
266
- /**
267
- Use a file as input to the the `stdin` of your binary.
268
-
269
- If the input is not a file, use the `input` option instead.
270
- */
271
- readonly inputFile?: string;
272
- } & CommonOptions<EncodingType>;
273
-
274
- export type SyncOptions<EncodingType = string> = {
275
- /**
276
- Write some input to the `stdin` of your binary.
277
-
278
- If the input is a file, use the `inputFile` option instead.
279
- */
280
- readonly input?: string | Buffer;
281
-
282
- /**
283
- Use a file as input to the the `stdin` of your binary.
284
-
285
- If the input is not a file, use the `input` option instead.
286
- */
287
- readonly inputFile?: string;
288
- } & CommonOptions<EncodingType>;
289
-
290
- export type NodeOptions<EncodingType = string> = {
291
- /**
292
- The Node.js executable to use.
293
-
294
- @default process.execPath
295
- */
296
- readonly nodePath?: string;
297
-
298
- /**
299
- List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
300
-
301
- @default process.execArgv
302
- */
303
- readonly nodeOptions?: string[];
304
- } & Options<EncodingType>;
305
-
306
- type StdoutStderrAll = string | Buffer | undefined;
307
-
308
- export type ExecaReturnBase<StdoutStderrType extends StdoutStderrAll> = {
309
- /**
310
- The file and arguments that were run, for logging purposes.
311
-
312
- This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
313
- */
314
- command: string;
315
-
316
- /**
317
- Same as `command` but escaped.
318
-
319
- This is meant to be copy and pasted into a shell, for debugging purposes.
320
- Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execaCommand()`.
321
- */
322
- escapedCommand: string;
323
-
324
- /**
325
- The numeric exit code of the process that was run.
326
- */
327
- exitCode: number;
328
-
329
- /**
330
- The output of the process on stdout.
331
- */
332
- stdout: StdoutStderrType;
333
-
334
- /**
335
- The output of the process on stderr.
336
- */
337
- stderr: StdoutStderrType;
338
-
339
- /**
340
- Whether the process failed to run.
341
- */
342
- failed: boolean;
343
-
344
- /**
345
- Whether the process timed out.
346
- */
347
- timedOut: boolean;
348
-
349
- /**
350
- Whether the process was killed.
351
- */
352
- killed: boolean;
353
-
354
- /**
355
- The name of the signal that was used to terminate the process. For example, `SIGFPE`.
356
-
357
- If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
358
- */
359
- signal?: string;
360
-
361
- /**
362
- A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.
363
-
364
- 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.
365
- */
366
- signalDescription?: string;
367
-
368
- /**
369
- The `cwd` of the command if provided in the command options. Otherwise it is `process.cwd()`.
370
- */
371
- cwd: string;
372
- };
373
-
374
- export type ExecaSyncReturnValue<StdoutStderrType extends StdoutStderrAll = string> = {
375
- } & ExecaReturnBase<StdoutStderrType>;
376
-
377
- /**
378
- Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.
379
-
380
- The child process fails when:
381
- - its exit code is not `0`
382
- - it was killed with a signal
383
- - timing out
384
- - being canceled
385
- - there's not enough memory or there are already too many child processes
386
- */
387
- export type ExecaReturnValue<StdoutStderrType extends StdoutStderrAll = string> = {
388
- /**
389
- The output of the process with `stdout` and `stderr` interleaved.
390
-
391
- This is `undefined` if either:
392
- - the `all` option is `false` (default value)
393
- - `execaSync()` was used
394
- */
395
- all?: StdoutStderrType;
396
-
397
- /**
398
- Whether the process was canceled.
399
-
400
- You can cancel the spawned process using the [`signal`](https://github.com/sindresorhus/execa#signal-1) option.
401
- */
402
- isCanceled: boolean;
403
- } & ExecaSyncReturnValue<StdoutStderrType>;
404
-
405
- export type ExecaSyncError<StdoutStderrType extends StdoutStderrAll = string> = {
406
- /**
407
- 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.
408
-
409
- The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
410
- */
411
- message: string;
412
-
413
- /**
414
- This is the same as the `message` property except it does not include the child process stdout/stderr.
415
- */
416
- shortMessage: string;
417
-
418
- /**
419
- 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.
420
-
421
- This is `undefined` unless the child process exited due to an `error` event or a timeout.
422
- */
423
- originalMessage?: string;
424
- } & Error & ExecaReturnBase<StdoutStderrType>;
425
-
426
- export type ExecaError<StdoutStderrType extends StdoutStderrAll = string> = {
427
- /**
428
- The output of the process with `stdout` and `stderr` interleaved.
429
-
430
- This is `undefined` if either:
431
- - the `all` option is `false` (default value)
432
- - `execaSync()` was used
433
- */
434
- all?: StdoutStderrType;
435
-
436
- /**
437
- Whether the process was canceled.
438
- */
439
- isCanceled: boolean;
440
- } & ExecaSyncError<StdoutStderrType>;
441
-
442
- export type KillOptions = {
443
- /**
444
- Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
445
-
446
- Can be disabled with `false`.
447
-
448
- @default 5000
449
- */
450
- forceKillAfterTimeout?: number | false;
451
- };
452
-
453
- export type ExecaChildPromise<StdoutStderrType extends StdoutStderrAll> = {
454
- /**
455
- 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).
456
-
457
- This is `undefined` if either:
458
- - the `all` option is `false` (the default value)
459
- - 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)
460
- */
461
- all?: ReadableStream;
462
-
463
- catch<ResultType = never>(
464
- onRejected?: (reason: ExecaError<StdoutStderrType>) => ResultType | PromiseLike<ResultType>
465
- ): Promise<ExecaReturnValue<StdoutStderrType> | ResultType>;
466
-
467
- /**
468
- Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`. Note that this graceful termination does not work on Windows, because Windows [doesn't support signals](https://nodejs.org/api/process.html#process_signal_events) (`SIGKILL` and `SIGTERM` has the same effect of force-killing the process immediately.) If you want to achieve graceful termination on Windows, you have to use other means, such as [`taskkill`](https://github.com/sindresorhus/taskkill).
469
- */
470
- kill(signal?: string, options?: KillOptions): void;
471
-
472
- /**
473
- Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This used to be preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`. But now this is deprecated and you should either use `.kill()` or the `signal` option when creating the child process.
474
- */
475
- cancel(): void;
476
-
477
- /**
478
- [Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the child process's `stdout` to `target`, which can be:
479
- - Another `execa()` return value
480
- - A writable stream
481
- - A file path string
482
-
483
- If the `target` is another `execa()` return value, it is returned. Otherwise, the original `execa()` return value is returned. This allows chaining `pipeStdout()` then `await`ing the final result.
484
-
485
- The `stdout` option] must be kept as `pipe`, its default value.
486
- */
487
- pipeStdout?<Target extends ExecaChildPromise<StdoutStderrAll>>(target: Target): Target;
488
- pipeStdout?(target: WritableStream | string): ExecaChildProcess<StdoutStderrType>;
489
-
490
- /**
491
- Like `pipeStdout()` but piping the child process's `stderr` instead.
492
-
493
- The `stderr` option must be kept as `pipe`, its default value.
494
- */
495
- pipeStderr?<Target extends ExecaChildPromise<StdoutStderrAll>>(target: Target): Target;
496
- pipeStderr?(target: WritableStream | string): ExecaChildProcess<StdoutStderrType>;
497
-
498
- /**
499
- Combines both `pipeStdout()` and `pipeStderr()`.
500
-
501
- Either the `stdout` option or the `stderr` option must be kept as `pipe`, their default value. Also, the `all` option must be set to `true`.
502
- */
503
- pipeAll?<Target extends ExecaChildPromise<StdoutStderrAll>>(target: Target): Target;
504
- pipeAll?(target: WritableStream | string): ExecaChildProcess<StdoutStderrType>;
505
- };
506
-
507
- export type ExecaChildProcess<StdoutStderrType extends StdoutStderrAll = string> = ChildProcess &
508
- ExecaChildPromise<StdoutStderrType> &
509
- Promise<ExecaReturnValue<StdoutStderrType>>;
510
-
511
- /**
512
- Executes a command using `file ...arguments`. `arguments` are specified as an array of strings. Returns a `childProcess`.
513
-
514
- Arguments are automatically escaped. They can contain any character, including spaces.
515
-
516
- This is the preferred method when executing single commands.
517
-
518
- @param file - The program/script to execute.
519
- @param arguments - Arguments to pass to `file` on execution.
520
- @returns An `ExecaChildProcess` that is both:
521
- - a `Promise` resolving or rejecting with a `childProcessResult`.
522
- - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.
523
- @throws A `childProcessResult` error
524
-
525
- @example <caption>Promise interface</caption>
526
- ```
527
- import {execa} from 'execa';
528
-
529
- const {stdout} = await execa('echo', ['unicorns']);
530
- console.log(stdout);
531
- //=> 'unicorns'
532
- ```
533
-
534
- @example <caption>Redirect output to a file</caption>
535
- ```
536
- import {execa} from 'execa';
537
-
538
- // Similar to `echo unicorns > stdout.txt` in Bash
539
- await execa('echo', ['unicorns']).pipeStdout('stdout.txt');
540
-
541
- // Similar to `echo unicorns 2> stdout.txt` in Bash
542
- await execa('echo', ['unicorns']).pipeStderr('stderr.txt');
543
-
544
- // Similar to `echo unicorns &> stdout.txt` in Bash
545
- await execa('echo', ['unicorns'], {all: true}).pipeAll('all.txt');
546
- ```
547
-
548
- @example <caption>Redirect input from a file</caption>
549
- ```
550
- import {execa} from 'execa';
551
-
552
- // Similar to `cat < stdin.txt` in Bash
553
- const {stdout} = await execa('cat', {inputFile: 'stdin.txt'});
554
- console.log(stdout);
555
- //=> 'unicorns'
556
- ```
557
-
558
- @example <caption>Save and pipe output from a child process</caption>
559
- ```
560
- import {execa} from 'execa';
561
-
562
- const {stdout} = await execa('echo', ['unicorns']).pipeStdout(process.stdout);
563
- // Prints `unicorns`
564
- console.log(stdout);
565
- // Also returns 'unicorns'
566
- ```
567
-
568
- @example <caption>Pipe multiple processes</caption>
569
- ```
570
- import {execa} from 'execa';
571
-
572
- // Similar to `echo unicorns | cat` in Bash
573
- const {stdout} = await execa('echo', ['unicorns']).pipeStdout(execa('cat'));
574
- console.log(stdout);
575
- //=> 'unicorns'
576
- ```
577
-
578
- @example <caption>Handling errors</caption>
579
- ```
580
- import {execa} from 'execa';
581
-
582
- // Catching an error
583
- try {
584
- await execa('unknown', ['command']);
585
- } catch (error) {
586
- console.log(error);
587
- /*
588
- {
589
- message: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
590
- errno: -2,
591
- code: 'ENOENT',
592
- syscall: 'spawn unknown',
593
- path: 'unknown',
594
- spawnargs: ['command'],
595
- originalMessage: 'spawn unknown ENOENT',
596
- shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
597
- command: 'unknown command',
598
- escapedCommand: 'unknown command',
599
- stdout: '',
600
- stderr: '',
601
- failed: true,
602
- timedOut: false,
603
- isCanceled: false,
604
- killed: false,
605
- cwd: '/path/to/cwd'
606
- }
607
- \*\/
608
- }
609
- ```
610
-
611
- @example <caption>Graceful termination</caption>
612
- ```
613
- const subprocess = execa('node');
614
-
615
- setTimeout(() => {
616
- subprocess.kill('SIGTERM', {
617
- forceKillAfterTimeout: 2000
618
- });
619
- }, 1000);
620
- ```
621
- */
622
- export function execa(
623
- file: string,
624
- arguments?: readonly string[],
625
- options?: Options
626
- ): ExecaChildProcess;
627
- export function execa(
628
- file: string,
629
- arguments?: readonly string[],
630
- options?: Options<null>
631
- ): ExecaChildProcess<Buffer>;
632
- export function execa(file: string, options?: Options): ExecaChildProcess;
633
- export function execa(file: string, options?: Options<null>): ExecaChildProcess<Buffer>;
634
-
635
- /**
636
- Same as `execa()` but synchronous.
637
-
638
- @param file - The program/script to execute.
639
- @param arguments - Arguments to pass to `file` on execution.
640
- @returns A `childProcessResult` object
641
- @throws A `childProcessResult` error
642
-
643
- @example <caption>Promise interface</caption>
644
- ```
645
- import {execa} from 'execa';
646
-
647
- const {stdout} = execaSync('echo', ['unicorns']);
648
- console.log(stdout);
649
- //=> 'unicorns'
650
- ```
651
-
652
- @example <caption>Redirect input from a file</caption>
653
- ```
654
- import {execa} from 'execa';
655
-
656
- // Similar to `cat < stdin.txt` in Bash
657
- const {stdout} = execaSync('cat', {inputFile: 'stdin.txt'});
658
- console.log(stdout);
659
- //=> 'unicorns'
660
- ```
661
-
662
- @example <caption>Handling errors</caption>
663
- ```
664
- import {execa} from 'execa';
665
-
666
- // Catching an error
667
- try {
668
- execaSync('unknown', ['command']);
669
- } catch (error) {
670
- console.log(error);
671
- /*
672
- {
673
- message: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',
674
- errno: -2,
675
- code: 'ENOENT',
676
- syscall: 'spawnSync unknown',
677
- path: 'unknown',
678
- spawnargs: ['command'],
679
- originalMessage: 'spawnSync unknown ENOENT',
680
- shortMessage: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',
681
- command: 'unknown command',
682
- escapedCommand: 'unknown command',
683
- stdout: '',
684
- stderr: '',
685
- failed: true,
686
- timedOut: false,
687
- isCanceled: false,
688
- killed: false,
689
- cwd: '/path/to/cwd'
690
- }
691
- \*\/
692
- }
693
- ```
694
- */
695
- export function execaSync(
696
- file: string,
697
- arguments?: readonly string[],
698
- options?: SyncOptions
699
- ): ExecaSyncReturnValue;
700
- export function execaSync(
701
- file: string,
702
- arguments?: readonly string[],
703
- options?: SyncOptions<null>
704
- ): ExecaSyncReturnValue<Buffer>;
705
- export function execaSync(file: string, options?: SyncOptions): ExecaSyncReturnValue;
706
- export function execaSync(
707
- file: string,
708
- options?: SyncOptions<null>
709
- ): ExecaSyncReturnValue<Buffer>;
710
-
711
- /**
712
- Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a `childProcess`.
713
-
714
- Arguments are automatically escaped. They can contain any character, but spaces must be escaped with a backslash like `execaCommand('echo has\\ space')`.
715
-
716
- This is the preferred method when executing a user-supplied `command` string, such as in a REPL.
717
-
718
- @param command - The program/script to execute and its arguments.
719
- @returns An `ExecaChildProcess` that is both:
720
- - a `Promise` resolving or rejecting with a `childProcessResult`.
721
- - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.
722
- @throws A `childProcessResult` error
723
-
724
- @example
725
- ```
726
- import {execaCommand} from 'execa';
727
-
728
- const {stdout} = await execaCommand('echo unicorns');
729
- console.log(stdout);
730
- //=> 'unicorns'
731
- ```
732
- */
733
- export function execaCommand(command: string, options?: Options): ExecaChildProcess;
734
- export function execaCommand(command: string, options?: Options<null>): ExecaChildProcess<Buffer>;
735
-
736
- /**
737
- Same as `execaCommand()` but synchronous.
738
-
739
- @param command - The program/script to execute and its arguments.
740
- @returns A `childProcessResult` object
741
- @throws A `childProcessResult` error
742
-
743
- @example
744
- ```
745
- import {execaCommandSync} from 'execa';
746
-
747
- const {stdout} = execaCommandSync('echo unicorns');
748
- console.log(stdout);
749
- //=> 'unicorns'
750
- ```
751
- */
752
- export function execaCommandSync(command: string, options?: SyncOptions): ExecaSyncReturnValue;
753
- export function execaCommandSync(command: string, options?: SyncOptions<null>): ExecaSyncReturnValue<Buffer>;
754
-
755
- type TemplateExpression =
756
- | string
757
- | number
758
- | ExecaReturnValue<string | Buffer>
759
- | ExecaSyncReturnValue<string | Buffer>
760
- | Array<string | number | ExecaReturnValue<string | Buffer> | ExecaSyncReturnValue<string | Buffer>>;
761
-
762
- type Execa$<StdoutStderrType extends StdoutStderrAll = string> = {
763
- /**
764
- Returns a new instance of `$` but with different default `options`. Consecutive calls are merged to previous ones.
765
-
766
- This can be used to either:
767
- - Set options for a specific command: `` $(options)`command` ``
768
- - Share options for multiple commands: `` const $$ = $(options); $$`command`; $$`otherCommand` ``
769
-
770
- @param options - Options to set
771
- @returns A new instance of `$` with those `options` set
772
-
773
- @example
774
- ```
775
- import {$} from 'execa';
776
-
777
- const $$ = $({stdio: 'inherit'});
778
-
779
- await $$`echo unicorns`;
780
- //=> 'unicorns'
781
-
782
- await $$`echo rainbows`;
783
- //=> 'rainbows'
784
- ```
785
- */
786
- (options: Options<undefined>): Execa$<StdoutStderrType>;
787
- (options: Options): Execa$;
788
- (options: Options<null>): Execa$<Buffer>;
789
- (
790
- templates: TemplateStringsArray,
791
- ...expressions: TemplateExpression[]
792
- ): ExecaChildProcess<StdoutStderrType>;
793
-
794
- /**
795
- Same as $\`command\` but synchronous.
796
-
797
- @returns A `childProcessResult` object
798
- @throws A `childProcessResult` error
799
-
800
- @example <caption>Basic</caption>
801
- ```
802
- import {$} from 'execa';
803
-
804
- const branch = $.sync`git branch --show-current`;
805
- $.sync`dep deploy --branch=${branch}`;
806
- ```
807
-
808
- @example <caption>Multiple arguments</caption>
809
- ```
810
- import {$} from 'execa';
811
-
812
- const args = ['unicorns', '&', 'rainbows!'];
813
- const {stdout} = $.sync`echo ${args}`;
814
- console.log(stdout);
815
- //=> 'unicorns & rainbows!'
816
- ```
817
-
818
- @example <caption>With options</caption>
819
- ```
820
- import {$} from 'execa';
821
-
822
- $.sync({stdio: 'inherit'})`echo unicorns`;
823
- //=> 'unicorns'
824
- ```
825
-
826
- @example <caption>Shared options</caption>
827
- ```
828
- import {$} from 'execa';
829
-
830
- const $$ = $({stdio: 'inherit'});
831
-
832
- $$.sync`echo unicorns`;
833
- //=> 'unicorns'
834
-
835
- $$.sync`echo rainbows`;
836
- //=> 'rainbows'
837
- ```
838
- */
839
- sync(
840
- templates: TemplateStringsArray,
841
- ...expressions: TemplateExpression[]
842
- ): ExecaSyncReturnValue<StdoutStderrType>;
843
- };
844
-
845
- /**
846
- Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a `childProcess`.
847
-
848
- Arguments are automatically escaped. They can contain any character, but spaces must use `${}` like `` $`echo ${'has space'}` ``.
849
-
850
- This is the preferred method when executing multiple commands in a script file.
851
-
852
- The `command` string can inject any `${value}` with the following types: string, number, `childProcess` or an array of those types. For example: `` $`echo one ${'two'} ${3} ${['four', 'five']}` ``. For `${childProcess}`, the process's `stdout` is used.
853
-
854
- @returns An `ExecaChildProcess` that is both:
855
- - a `Promise` resolving or rejecting with a `childProcessResult`.
856
- - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.
857
- @throws A `childProcessResult` error
858
-
859
- @example <caption>Basic</caption>
860
- ```
861
- import {$} from 'execa';
862
-
863
- const branch = await $`git branch --show-current`;
864
- await $`dep deploy --branch=${branch}`;
865
- ```
866
-
867
- @example <caption>Multiple arguments</caption>
868
- ```
869
- import {$} from 'execa';
870
-
871
- const args = ['unicorns', '&', 'rainbows!'];
872
- const {stdout} = await $`echo ${args}`;
873
- console.log(stdout);
874
- //=> 'unicorns & rainbows!'
875
- ```
876
-
877
- @example <caption>With options</caption>
878
- ```
879
- import {$} from 'execa';
880
-
881
- await $({stdio: 'inherit'})`echo unicorns`;
882
- //=> 'unicorns'
883
- ```
884
-
885
- @example <caption>Shared options</caption>
886
- ```
887
- import {$} from 'execa';
888
-
889
- const $$ = $({stdio: 'inherit'});
890
-
891
- await $$`echo unicorns`;
892
- //=> 'unicorns'
893
-
894
- await $$`echo rainbows`;
895
- //=> 'rainbows'
896
- ```
897
- */
898
- export const $: Execa$;
899
-
900
- /**
901
- Execute a Node.js script as a child process.
902
-
903
- Arguments are automatically escaped. They can contain any character, including spaces.
904
-
905
- This is the preferred method when executing Node.js files.
906
-
907
- Like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options):
908
- - the current Node version and options are used. This can be overridden using the `nodePath` and `nodeOptions` options.
909
- - the `shell` option cannot be used
910
- - an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to `stdio`
911
-
912
- @param scriptPath - Node.js script to execute.
913
- @param arguments - Arguments to pass to `scriptPath` on execution.
914
- @returns An `ExecaChildProcess` that is both:
915
- - a `Promise` resolving or rejecting with a `childProcessResult`.
916
- - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.
917
- @throws A `childProcessResult` error
918
-
919
- @example
920
- ```
921
- import {execa} from 'execa';
922
-
923
- await execaNode('scriptPath', ['argument']);
924
- ```
925
- */
926
- export function execaNode(
927
- scriptPath: string,
928
- arguments?: readonly string[],
929
- options?: NodeOptions
930
- ): ExecaChildProcess;
931
- export function execaNode(
932
- scriptPath: string,
933
- arguments?: readonly string[],
934
- options?: NodeOptions<null>
935
- ): ExecaChildProcess<Buffer>;
936
- export function execaNode(scriptPath: string, options?: NodeOptions): ExecaChildProcess;
937
- export function execaNode(scriptPath: string, options?: NodeOptions<null>): ExecaChildProcess<Buffer>;