Skip to content
Myr

index.js

This file

Path

index.js

355 lines · 8.9 KiB · JavaScript

Last changed by

Fix `reject` option with early spawning errors (#734)ehmickybefore adoption8a18881

History of this file

Take it

The walk stopped after 200 commits: lines older than 408904b point at it.

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 1–4why, one step back
1import {Buffer} from 'node:buffer';
2import path from 'node:path';3import childProcess from 'node:child_process';4import process from 'node:process';

Allow the first argument of `execa()` to be a file URL (#631)ehmickybefore adoption3bbd8ae

line 5why, one step back
5import {fileURLToPath} from 'node:url';

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 6–9why, one step back
6import crossSpawn from 'cross-spawn';
7import stripFinalNewline from 'strip-final-newline';8import {npmRunPathEnv} from 'npm-run-path';9import {makeError} from './lib/error.js';

Refactor `stdio` options (#623)ehmickybefore adoption2d76897

lines 10–12why, one step back
10import {handleInputAsync, pipeOutputAsync} from './lib/stdio/async.js';
11import {handleInputSync, pipeOutputSync} from './lib/stdio/sync.js';12import {normalizeStdioNode} from './lib/stdio/normalize.js';

Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34

line 13why, one step back
13import {spawnedKill, validateTimeout, normalizeForceKillAfterDelay} from './lib/kill.js';

Add `pipeStdout()`-related methods (#531)ehmickybefore adoption06287c8

line 14why, one step back
14import {addPipeMethods} from './lib/pipe.js';

Handle `inputFile` missing file (#609)ehmickybefore adoption8638ce7

line 15why, one step back
15import {getSpawnedResult, makeAllStream} from './lib/stream.js';

Use `async/await` instead of direct `Promise` manipulation (#659)ehmickybefore adoption7122767

line 16why, one step back
16import {mergePromise} from './lib/promise.js';

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 17why, one step back
17import {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';

Add `verbose` option (#532)ehmickybefore adoption69ce814

line 18why, one step back
18import {logCommand, verboseDefault} from './lib/verbose.js';

Validate `input` option's type (#668)ehmickybefore adoption65742c6

line 19why, one step back
19import {bufferToUint8Array} from './lib/stdio/utils.js';

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 20–26why, one step back
20
21const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;2223const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {24 const env = extendEnv ? {...process.env, ...envOption} : envOption;2526 if (preferLocal) {

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 27why, one step back
27 return npmRunPathEnv({env, cwd: localDir, execPath});

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 28–32why, one step back
28 }
2930 return env;31};32

Allow `shell` option to be a file URL (#635)ehmickybefore adoption189d486

lines 33–34why, one step back
33const normalizeFileUrl = file => file instanceof URL ? fileURLToPath(file) : file;
34

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

lines 35–36why, one step back
35const getFilePath = rawFile => {
36 const fileString = normalizeFileUrl(rawFile);

Allow the first argument of `execa()` to be a file URL (#631)ehmickybefore adoption3bbd8ae

line 37why, one step back
37

Allow `shell` option to be a file URL (#635)ehmickybefore adoption189d486

line 38why, one step back
38 if (typeof fileString !== 'string') {

Allow the first argument of `execa()` to be a file URL (#631)ehmickybefore adoption3bbd8ae

lines 39–41why, one step back
39 throw new TypeError('First argument must be a string or a file URL.');
40 }41

Allow `shell` option to be a file URL (#635)ehmickybefore adoption189d486

line 42why, one step back
42 return fileString;

Allow the first argument of `execa()` to be a file URL (#631)ehmickybefore adoption3bbd8ae

lines 43–44why, one step back
43};
44

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

lines 45–48why, one step back
45const handleArguments = (rawFile, rawArgs, rawOptions = {}) => {
46 const filePath = getFilePath(rawFile);47 const command = joinCommand(filePath, rawArgs);48 const escapedCommand = getEscapedCommand(filePath, rawArgs);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 49why, one step back
49

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

lines 50–51why, one step back
50 const {command: file, args, options: initialOptions} = crossSpawn._parse(filePath, rawArgs, rawOptions);
51

Fix passing `undefined` options (#712)ehmickybefore adoption472c065

line 52why, one step back
52 const options = addDefaultOptions(initialOptions);

Improve `timeout` option validation (#715)ehmickybefore adoption0fbd3a2

line 53why, one step back
53 validateTimeout(options);

Fix passing `undefined` options (#712)ehmickybefore adoption472c065

line 54why, one step back
54 options.shell = normalizeFileUrl(options.shell);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 55why, one step back
55 options.env = getEnv(options);

Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34

line 56why, one step back
56 options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 57–62why, one step back
57
58 if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {59 // #11660 args.unshift('/q');61 }62

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

lines 63–65why, one step back
63 logCommand(escapedCommand, options);
6465 return {file, args, command, escapedCommand, options};

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 66why, one step back
66};

Fix passing `undefined` options (#712)ehmickybefore adoption472c065

lines 67–83why, one step back
67
68const addDefaultOptions = ({69 maxBuffer = DEFAULT_MAX_BUFFER,70 buffer = true,71 stripFinalNewline = true,72 extendEnv = true,73 preferLocal = false,74 cwd = process.cwd(),75 localDir = cwd,76 execPath = process.execPath,77 encoding = 'utf8',78 reject = true,79 cleanup = true,80 all = false,81 windowsHide = true,82 verbose = verboseDefault,83 killSignal = 'SIGTERM',

Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34

line 84why, one step back
84 forceKillAfterDelay = true,

Fix passing `undefined` options (#712)ehmickybefore adoption472c065

lines 85–102why, one step back
85 ...options
86}) => ({87 ...options,88 maxBuffer,89 buffer,90 stripFinalNewline,91 extendEnv,92 preferLocal,93 cwd,94 localDir,95 execPath,96 encoding,97 reject,98 cleanup,99 all,100 windowsHide,101 verbose,102 killSignal,

Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34

line 103why, one step back
103 forceKillAfterDelay,

Fix passing `undefined` options (#712)ehmickybefore adoption472c065

line 104why, one step back
104});

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 105why, one step back
105

Fix `timeout` option (#727)ehmickybefore adoptiona61a028

lines 106–108why, one step back
106// Prevent passing the `timeout` option directly to `child_process.spawn()`
107const handleAsyncOptions = ({timeout, ...options}) => ({...options, timeoutDuration: timeout});108

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 109why, one step back
109const handleOutput = (options, value) => {

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

line 110why, one step back
110 if (value === undefined || value === null) {

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 111why, one step back
111 return;

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 112–113why, one step back
112 }
113

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

lines 114–117why, one step back
114 if (Array.isArray(value)) {
115 return value;116 }117

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

lines 118–119why, one step back
118 if (Buffer.isBuffer(value)) {
119 value = bufferToUint8Array(value);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 120–121why, one step back
120 }
121

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 122why, one step back
122 return options.stripFinalNewline ? stripFinalNewline(value) : value;

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 123–124why, one step back
123};
124

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

line 125why, one step back
125export function execa(rawFile, rawArgs, rawOptions) {

Fix `timeout` option (#727)ehmickybefore adoptiona61a028

lines 126–127why, one step back
126 const {file, args, command, escapedCommand, options: normalizedOptions} = handleArguments(rawFile, rawArgs, rawOptions);
127 const options = handleAsyncOptions(normalizedOptions);

Handle `inputFile` missing file (#609)ehmickybefore adoption8638ce7

line 128why, one step back
128

Simplify `std*` options logic (#691)ehmickybefore adoption98b0ee3

line 129why, one step back
129 const stdioStreamsGroups = handleInputAsync(options);

Fix `timeout` option validation (#463)ehmickybefore adoption427c5c2

line 130why, one step back
130

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 131–132why, one step back
131 let spawned;
132 try {

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

line 133why, one step back
133 spawned = childProcess.spawn(file, args, options);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 134–136why, one step back
134 } catch (error) {
135 // Ensure the returned error is always both a promise and a child process136 const dummySpawned = new childProcess.ChildProcess();

Fix `reject` option with early spawning errors (#734)ehmickybefore adoption8a18881

line 137why, one step back
137 const errorInstance = makeError({

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 138why, one step back
138 error,

Simplify `std*` options logic (#691)ehmickybefore adoption98b0ee3

line 139why, one step back
139 stdio: Array.from({length: stdioStreamsGroups.length}),

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 140why, one step back
140 command,

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

line 141why, one step back
141 escapedCommand,

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

line 142why, one step back
142 options,

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 143–144why, one step back
143 timedOut: false,
144 isCanceled: false,

Fix `reject` option with early spawning errors (#734)ehmickybefore adoption8a18881

lines 145–146why, one step back
145 });
146 const errorPromise = options.reject ? Promise.reject(errorInstance) : Promise.resolve(errorInstance);

Add `pipeStdout()`-related methods (#531)ehmickybefore adoption06287c8

lines 147–148why, one step back
147 mergePromise(dummySpawned, errorPromise);
148 return dummySpawned;

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 149–150why, one step back
149 }
150

Improve graceful exit (#714)ehmickybefore adoption5eeaab5

lines 151–152why, one step back
151 const controller = new AbortController();
152

Simplify `std*` options logic (#691)ehmickybefore adoption98b0ee3

lines 153–154why, one step back
153 pipeOutputAsync(spawned, stdioStreamsGroups);
154

Improve graceful exit (#714)ehmickybefore adoption5eeaab5

line 155why, one step back
155 spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned), options, controller);

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

line 156why, one step back
156 spawned.all = makeAllStream(spawned, options);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 157why, one step back
157

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

line 158why, one step back
158 addPipeMethods(spawned);

Fix unhandled rejections and missing data (#658)ehmickybefore adoption20b2ee6

line 159why, one step back
159

Improve graceful exit (#714)ehmickybefore adoption5eeaab5

line 160why, one step back
160 const promise = handlePromise({spawned, options, stdioStreamsGroups, command, escapedCommand, controller});

Fix unhandled rejections and missing data (#658)ehmickybefore adoption20b2ee6

line 161why, one step back
161 mergePromise(spawned, promise);

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 162–163why, one step back
162 return spawned;
163}

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 164why, one step back
164

Improve graceful exit (#714)ehmickybefore adoption5eeaab5

line 165why, one step back
165const handlePromise = async ({spawned, options, stdioStreamsGroups, command, escapedCommand, controller}) => {

Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6

lines 166–167why, one step back
166 const context = {timedOut: false};
167

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

line 168why, one step back
168 const [

Improve process termination (#724)ehmickybefore adoption1c48d37

lines 169–170why, one step back
169 error,
170 [, exitCode, signal],

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 171why, one step back
171 stdioResults,

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

line 172why, one step back
172 allResult,

Improve graceful exit (#714)ehmickybefore adoption5eeaab5

line 173why, one step back
173 ] = await getSpawnedResult({spawned, options, context, stdioStreamsGroups, controller});

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 174why, one step back
174 const stdio = stdioResults.map(stdioResult => handleOutput(options, stdioResult));

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 175–177why, one step back
175 const all = handleOutput(options, allResult);
176177 if (error || exitCode !== 0 || signal !== null) {

Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6

line 178why, one step back
178 const isCanceled = options.signal?.aborted === true;

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 179–182why, one step back
179 const returnedError = makeError({
180 error,181 exitCode,182 signal,

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 183why, one step back
183 stdio,

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 184why, one step back
184 all,

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 185–187why, one step back
185 command,
186 escapedCommand,187 options,

Use `async/await` instead of direct `Promise` manipulation (#659)ehmickybefore adoption7122767

line 188why, one step back
188 timedOut: context.timedOut,

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 189–190why, one step back
189 isCanceled,
190 });

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 191why, one step back
191

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 192–194why, one step back
192 if (!options.reject) {
193 return returnedError;194 }

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 195why, one step back
195

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 196–197why, one step back
196 throw returnedError;
197 }

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 198why, one step back
198

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 199–202why, one step back
199 return {
200 command,201 escapedCommand,202 exitCode: 0,

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

lines 203–205why, one step back
203 stdio,
204 stdout: stdio[1],205 stderr: stdio[2],

Refactoring: move inner function to outer scope (#654)ehmickybefore adoptiond78348d

lines 206–212why, one step back
206 all,
207 failed: false,208 timedOut: false,209 isCanceled: false,210 isTerminated: false,211 };212};

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 213why, one step back
213

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

lines 214–215why, one step back
214export function execaSync(rawFile, rawArgs, rawOptions) {
215 const {file, args, command, escapedCommand, options} = handleArguments(rawFile, rawArgs, rawOptions);

Handle `inputFile` missing file (#609)ehmickybefore adoption8638ce7

line 216why, one step back
216

Simplify `std*` options logic (#691)ehmickybefore adoption98b0ee3

line 217why, one step back
217 const stdioStreamsGroups = handleInputSync(options);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 218–220why, one step back
218
219 let result;220 try {

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

line 221why, one step back
221 result = childProcess.spawnSync(file, args, options);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 222why, one step back
222 } catch (error) {

Fix `reject` option with early spawning errors (#734)ehmickybefore adoption8a18881

line 223why, one step back
223 const errorInstance = makeError({

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 224why, one step back
224 error,

Simplify `std*` options logic (#691)ehmickybefore adoption98b0ee3

line 225why, one step back
225 stdio: Array.from({length: stdioStreamsGroups.stdioLength}),

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 226why, one step back
226 command,

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

line 227why, one step back
227 escapedCommand,

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

line 228why, one step back
228 options,

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 229–231why, one step back
229 timedOut: false,
230 isCanceled: false,231 });

Fix `reject` option with early spawning errors (#734)ehmickybefore adoption8a18881

lines 232–237why, one step back
232
233 if (!options.reject) {234 return errorInstance;235 }236237 throw errorInstance;

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 238–239why, one step back
238 }
239

Simplify `std*` options logic (#691)ehmickybefore adoption98b0ee3

line 240why, one step back
240 pipeOutputSync(stdioStreamsGroups, result);

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 241why, one step back
241

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

line 242why, one step back
242 const output = result.output || Array.from({length: 3});

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

lines 243–244why, one step back
243 const stdio = output.map(stdioOutput => handleOutput(options, stdioOutput));
244

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 245–246why, one step back
245 if (result.error || result.status !== 0 || result.signal !== null) {
246 const error = makeError({

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 247why, one step back
247 stdio,

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 248–251why, one step back
248 error: result.error,
249 signal: result.signal,250 exitCode: result.status,251 command,

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

line 252why, one step back
252 escapedCommand,

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

line 253why, one step back
253 options,

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 254–257why, one step back
254 timedOut: result.error && result.error.code === 'ETIMEDOUT',
255 isCanceled: false,256 });257

Refactor duplicate code between `execa()` and `execaSync()` (#648)ehmickybefore adoption4fb84f0

line 258why, one step back
258 if (!options.reject) {

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 259–266why, one step back
259 return error;
260 }261262 throw error;263 }264265 return {266 command,

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

line 267why, one step back
267 escapedCommand,

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 268why, one step back
268 exitCode: 0,

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

lines 269–271why, one step back
269 stdio,
270 stdout: stdio[1],271 stderr: stdio[2],

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 272–274why, one step back
272 failed: false,
273 timedOut: false,274 isCanceled: false,

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 275why, one step back
275 isTerminated: false,

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 276why, one step back
276 };

Minor tweaksSindre Sorhusbefore adoption244e87a

line 277why, one step back
277}

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 278why, one step back
278

Fix default value of `stdin` with `$` (#550)ehmickybefore adoption6fe7e51

lines 279–288why, one step back
279const normalizeScriptStdin = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined
280 ? {stdin: 'inherit'}281 : {};282283const normalizeScriptOptions = (options = {}) => ({284 preferLocal: true,285 ...normalizeScriptStdin(options),286 ...options,287});288

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 289–290why, one step back
289function create$(options) {
290 function $(templatesOrOptions, ...expressions) {

Improve validation of `$.sync` options binding (#551)ehmickybefore adoption881fbad

lines 291–292why, one step back
291 if (!Array.isArray(templatesOrOptions)) {
292 return create$({...options, ...templatesOrOptions});

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 293–294why, one step back
293 }
294

Improve validation of `$.sync` options binding (#551)ehmickybefore adoption881fbad

line 295why, one step back
295 const [file, ...args] = parseTemplates(templatesOrOptions, expressions);

Fix default value of `stdin` with `$` (#550)ehmickybefore adoption6fe7e51

line 296why, one step back
296 return execa(file, args, normalizeScriptOptions(options));

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 297–299why, one step back
297 }
298299 $.sync = (templates, ...expressions) => {

Improve validation of `$.sync` options binding (#551)ehmickybefore adoption881fbad

lines 300–303why, one step back
300 if (!Array.isArray(templates)) {
301 throw new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');302 }303

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 304why, one step back
304 const [file, ...args] = parseTemplates(templates, expressions);

Fix default value of `stdin` with `$` (#550)ehmickybefore adoption6fe7e51

line 305why, one step back
305 return execaSync(file, args, normalizeScriptOptions(options));

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 306–307why, one step back
306 };
307

Add `$.s` as an alias for `$.sync` (#594)ehmickybefore adoptionb719fb0

lines 308–309why, one step back
308 $.s = $.sync;
309

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 310–312why, one step back
310 return $;
311}312

Fix default value of `stdin` with `$` (#550)ehmickybefore adoption6fe7e51

line 313why, one step back
313export const $ = create$();

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 314why, one step back
314

Minor tweaksSindre Sorhusbefore adoption244e87a

line 315why, one step back
315export function execaCommand(command, options) {

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 316–317why, one step back
316 const [file, ...args] = parseCommand(command);
317 return execa(file, args, options);

Minor tweaksSindre Sorhusbefore adoption244e87a

line 318why, one step back
318}

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 319why, one step back
319

Minor tweaksSindre Sorhusbefore adoption244e87a

line 320why, one step back
320export function execaCommandSync(command, options) {

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 321why, one step back
321 const [file, ...args] = parseCommand(command);

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 322why, one step back
322 return execaSync(file, args, options);

Minor tweaksSindre Sorhusbefore adoption244e87a

line 323why, one step back
323}

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 324why, one step back
324

Minor tweaksSindre Sorhusbefore adoption244e87a

line 325why, one step back
325export function execaNode(scriptPath, args, options = {}) {

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 326–330why, one step back
326 if (args && !Array.isArray(args) && typeof args === 'object') {
327 options = args;328 args = [];329 }330

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 331why, one step back
331 const stdio = normalizeStdioNode(options);

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

line 332why, one step back
332 const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 333why, one step back
333

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 334–335why, one step back
334 const {
335 nodePath = process.execPath,

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 336why, one step back
336 nodeOptions = defaultExecArgv,

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

line 337why, one step back
337 } = options;

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 338–342why, one step back
338
339 return execa(340 nodePath,341 [342 ...nodeOptions,

Allow the first argument of `execa()` to be a file URL (#631)ehmickybefore adoption3bbd8ae

line 343why, one step back
343 getFilePath(scriptPath),

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 344why, one step back
344 ...(Array.isArray(args) ? args : []),

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

lines 345–351why, one step back
345 ],
346 {347 ...options,348 stdin: undefined,349 stdout: undefined,350 stderr: undefined,351 stdio,

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 352–353why, one step back
352 shell: false,
353 },

Clean up outdated code in tests (#405)fisker Cheungbefore adoption408904b

line 354why, one step back
354 );

Minor tweaksSindre Sorhusbefore adoption244e87a

line 355why, one step back
355}