vendor-index.2ae8040a.mjs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. import childProcess from 'child_process';
  2. import path$3 from 'path';
  3. import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
  4. import fs$1 from 'fs';
  5. import require$$0$1 from 'buffer';
  6. import require$$0 from 'stream';
  7. import util from 'util';
  8. var crossSpawn = {exports: {}};
  9. var windows;
  10. var hasRequiredWindows;
  11. function requireWindows () {
  12. if (hasRequiredWindows) return windows;
  13. hasRequiredWindows = 1;
  14. windows = isexe;
  15. isexe.sync = sync;
  16. var fs = fs$1;
  17. function checkPathExt (path, options) {
  18. var pathext = options.pathExt !== undefined ?
  19. options.pathExt : process.env.PATHEXT;
  20. if (!pathext) {
  21. return true
  22. }
  23. pathext = pathext.split(';');
  24. if (pathext.indexOf('') !== -1) {
  25. return true
  26. }
  27. for (var i = 0; i < pathext.length; i++) {
  28. var p = pathext[i].toLowerCase();
  29. if (p && path.substr(-p.length).toLowerCase() === p) {
  30. return true
  31. }
  32. }
  33. return false
  34. }
  35. function checkStat (stat, path, options) {
  36. if (!stat.isSymbolicLink() && !stat.isFile()) {
  37. return false
  38. }
  39. return checkPathExt(path, options)
  40. }
  41. function isexe (path, options, cb) {
  42. fs.stat(path, function (er, stat) {
  43. cb(er, er ? false : checkStat(stat, path, options));
  44. });
  45. }
  46. function sync (path, options) {
  47. return checkStat(fs.statSync(path), path, options)
  48. }
  49. return windows;
  50. }
  51. var mode;
  52. var hasRequiredMode;
  53. function requireMode () {
  54. if (hasRequiredMode) return mode;
  55. hasRequiredMode = 1;
  56. mode = isexe;
  57. isexe.sync = sync;
  58. var fs = fs$1;
  59. function isexe (path, options, cb) {
  60. fs.stat(path, function (er, stat) {
  61. cb(er, er ? false : checkStat(stat, options));
  62. });
  63. }
  64. function sync (path, options) {
  65. return checkStat(fs.statSync(path), options)
  66. }
  67. function checkStat (stat, options) {
  68. return stat.isFile() && checkMode(stat, options)
  69. }
  70. function checkMode (stat, options) {
  71. var mod = stat.mode;
  72. var uid = stat.uid;
  73. var gid = stat.gid;
  74. var myUid = options.uid !== undefined ?
  75. options.uid : process.getuid && process.getuid();
  76. var myGid = options.gid !== undefined ?
  77. options.gid : process.getgid && process.getgid();
  78. var u = parseInt('100', 8);
  79. var g = parseInt('010', 8);
  80. var o = parseInt('001', 8);
  81. var ug = u | g;
  82. var ret = (mod & o) ||
  83. (mod & g) && gid === myGid ||
  84. (mod & u) && uid === myUid ||
  85. (mod & ug) && myUid === 0;
  86. return ret
  87. }
  88. return mode;
  89. }
  90. var core;
  91. if (process.platform === 'win32' || commonjsGlobal.TESTING_WINDOWS) {
  92. core = requireWindows();
  93. } else {
  94. core = requireMode();
  95. }
  96. var isexe_1 = isexe$1;
  97. isexe$1.sync = sync;
  98. function isexe$1 (path, options, cb) {
  99. if (typeof options === 'function') {
  100. cb = options;
  101. options = {};
  102. }
  103. if (!cb) {
  104. if (typeof Promise !== 'function') {
  105. throw new TypeError('callback not provided')
  106. }
  107. return new Promise(function (resolve, reject) {
  108. isexe$1(path, options || {}, function (er, is) {
  109. if (er) {
  110. reject(er);
  111. } else {
  112. resolve(is);
  113. }
  114. });
  115. })
  116. }
  117. core(path, options || {}, function (er, is) {
  118. // ignore EACCES because that just means we aren't allowed to run it
  119. if (er) {
  120. if (er.code === 'EACCES' || options && options.ignoreErrors) {
  121. er = null;
  122. is = false;
  123. }
  124. }
  125. cb(er, is);
  126. });
  127. }
  128. function sync (path, options) {
  129. // my kingdom for a filtered catch
  130. try {
  131. return core.sync(path, options || {})
  132. } catch (er) {
  133. if (options && options.ignoreErrors || er.code === 'EACCES') {
  134. return false
  135. } else {
  136. throw er
  137. }
  138. }
  139. }
  140. const isWindows = process.platform === 'win32' ||
  141. process.env.OSTYPE === 'cygwin' ||
  142. process.env.OSTYPE === 'msys';
  143. const path$2 = path$3;
  144. const COLON = isWindows ? ';' : ':';
  145. const isexe = isexe_1;
  146. const getNotFoundError = (cmd) =>
  147. Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' });
  148. const getPathInfo = (cmd, opt) => {
  149. const colon = opt.colon || COLON;
  150. // If it has a slash, then we don't bother searching the pathenv.
  151. // just check the file itself, and that's it.
  152. const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
  153. : (
  154. [
  155. // windows always checks the cwd first
  156. ...(isWindows ? [process.cwd()] : []),
  157. ...(opt.path || process.env.PATH ||
  158. /* istanbul ignore next: very unusual */ '').split(colon),
  159. ]
  160. );
  161. const pathExtExe = isWindows
  162. ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
  163. : '';
  164. const pathExt = isWindows ? pathExtExe.split(colon) : [''];
  165. if (isWindows) {
  166. if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
  167. pathExt.unshift('');
  168. }
  169. return {
  170. pathEnv,
  171. pathExt,
  172. pathExtExe,
  173. }
  174. };
  175. const which$1 = (cmd, opt, cb) => {
  176. if (typeof opt === 'function') {
  177. cb = opt;
  178. opt = {};
  179. }
  180. if (!opt)
  181. opt = {};
  182. const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
  183. const found = [];
  184. const step = i => new Promise((resolve, reject) => {
  185. if (i === pathEnv.length)
  186. return opt.all && found.length ? resolve(found)
  187. : reject(getNotFoundError(cmd))
  188. const ppRaw = pathEnv[i];
  189. const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
  190. const pCmd = path$2.join(pathPart, cmd);
  191. const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
  192. : pCmd;
  193. resolve(subStep(p, i, 0));
  194. });
  195. const subStep = (p, i, ii) => new Promise((resolve, reject) => {
  196. if (ii === pathExt.length)
  197. return resolve(step(i + 1))
  198. const ext = pathExt[ii];
  199. isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
  200. if (!er && is) {
  201. if (opt.all)
  202. found.push(p + ext);
  203. else
  204. return resolve(p + ext)
  205. }
  206. return resolve(subStep(p, i, ii + 1))
  207. });
  208. });
  209. return cb ? step(0).then(res => cb(null, res), cb) : step(0)
  210. };
  211. const whichSync = (cmd, opt) => {
  212. opt = opt || {};
  213. const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
  214. const found = [];
  215. for (let i = 0; i < pathEnv.length; i ++) {
  216. const ppRaw = pathEnv[i];
  217. const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
  218. const pCmd = path$2.join(pathPart, cmd);
  219. const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
  220. : pCmd;
  221. for (let j = 0; j < pathExt.length; j ++) {
  222. const cur = p + pathExt[j];
  223. try {
  224. const is = isexe.sync(cur, { pathExt: pathExtExe });
  225. if (is) {
  226. if (opt.all)
  227. found.push(cur);
  228. else
  229. return cur
  230. }
  231. } catch (ex) {}
  232. }
  233. }
  234. if (opt.all && found.length)
  235. return found
  236. if (opt.nothrow)
  237. return null
  238. throw getNotFoundError(cmd)
  239. };
  240. var which_1 = which$1;
  241. which$1.sync = whichSync;
  242. var pathKey$1 = {exports: {}};
  243. const pathKey = (options = {}) => {
  244. const environment = options.env || process.env;
  245. const platform = options.platform || process.platform;
  246. if (platform !== 'win32') {
  247. return 'PATH';
  248. }
  249. return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
  250. };
  251. pathKey$1.exports = pathKey;
  252. // TODO: Remove this for the next major release
  253. pathKey$1.exports.default = pathKey;
  254. const path$1 = path$3;
  255. const which = which_1;
  256. const getPathKey = pathKey$1.exports;
  257. function resolveCommandAttempt(parsed, withoutPathExt) {
  258. const env = parsed.options.env || process.env;
  259. const cwd = process.cwd();
  260. const hasCustomCwd = parsed.options.cwd != null;
  261. // Worker threads do not have process.chdir()
  262. const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
  263. // If a custom `cwd` was specified, we need to change the process cwd
  264. // because `which` will do stat calls but does not support a custom cwd
  265. if (shouldSwitchCwd) {
  266. try {
  267. process.chdir(parsed.options.cwd);
  268. } catch (err) {
  269. /* Empty */
  270. }
  271. }
  272. let resolved;
  273. try {
  274. resolved = which.sync(parsed.command, {
  275. path: env[getPathKey({ env })],
  276. pathExt: withoutPathExt ? path$1.delimiter : undefined,
  277. });
  278. } catch (e) {
  279. /* Empty */
  280. } finally {
  281. if (shouldSwitchCwd) {
  282. process.chdir(cwd);
  283. }
  284. }
  285. // If we successfully resolved, ensure that an absolute path is returned
  286. // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
  287. if (resolved) {
  288. resolved = path$1.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
  289. }
  290. return resolved;
  291. }
  292. function resolveCommand$1(parsed) {
  293. return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
  294. }
  295. var resolveCommand_1 = resolveCommand$1;
  296. var _escape = {};
  297. // See http://www.robvanderwoude.com/escapechars.php
  298. const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
  299. function escapeCommand(arg) {
  300. // Escape meta chars
  301. arg = arg.replace(metaCharsRegExp, '^$1');
  302. return arg;
  303. }
  304. function escapeArgument(arg, doubleEscapeMetaChars) {
  305. // Convert to string
  306. arg = `${arg}`;
  307. // Algorithm below is based on https://qntm.org/cmd
  308. // Sequence of backslashes followed by a double quote:
  309. // double up all the backslashes and escape the double quote
  310. arg = arg.replace(/(\\*)"/g, '$1$1\\"');
  311. // Sequence of backslashes followed by the end of the string
  312. // (which will become a double quote later):
  313. // double up all the backslashes
  314. arg = arg.replace(/(\\*)$/, '$1$1');
  315. // All other backslashes occur literally
  316. // Quote the whole thing:
  317. arg = `"${arg}"`;
  318. // Escape meta chars
  319. arg = arg.replace(metaCharsRegExp, '^$1');
  320. // Double escape meta chars if necessary
  321. if (doubleEscapeMetaChars) {
  322. arg = arg.replace(metaCharsRegExp, '^$1');
  323. }
  324. return arg;
  325. }
  326. _escape.command = escapeCommand;
  327. _escape.argument = escapeArgument;
  328. var shebangRegex$1 = /^#!(.*)/;
  329. const shebangRegex = shebangRegex$1;
  330. var shebangCommand$1 = (string = '') => {
  331. const match = string.match(shebangRegex);
  332. if (!match) {
  333. return null;
  334. }
  335. const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
  336. const binary = path.split('/').pop();
  337. if (binary === 'env') {
  338. return argument;
  339. }
  340. return argument ? `${binary} ${argument}` : binary;
  341. };
  342. const fs = fs$1;
  343. const shebangCommand = shebangCommand$1;
  344. function readShebang$1(command) {
  345. // Read the first 150 bytes from the file
  346. const size = 150;
  347. const buffer = Buffer.alloc(size);
  348. let fd;
  349. try {
  350. fd = fs.openSync(command, 'r');
  351. fs.readSync(fd, buffer, 0, size, 0);
  352. fs.closeSync(fd);
  353. } catch (e) { /* Empty */ }
  354. // Attempt to extract shebang (null is returned if not a shebang)
  355. return shebangCommand(buffer.toString());
  356. }
  357. var readShebang_1 = readShebang$1;
  358. const path = path$3;
  359. const resolveCommand = resolveCommand_1;
  360. const escape = _escape;
  361. const readShebang = readShebang_1;
  362. const isWin$1 = process.platform === 'win32';
  363. const isExecutableRegExp = /\.(?:com|exe)$/i;
  364. const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
  365. function detectShebang(parsed) {
  366. parsed.file = resolveCommand(parsed);
  367. const shebang = parsed.file && readShebang(parsed.file);
  368. if (shebang) {
  369. parsed.args.unshift(parsed.file);
  370. parsed.command = shebang;
  371. return resolveCommand(parsed);
  372. }
  373. return parsed.file;
  374. }
  375. function parseNonShell(parsed) {
  376. if (!isWin$1) {
  377. return parsed;
  378. }
  379. // Detect & add support for shebangs
  380. const commandFile = detectShebang(parsed);
  381. // We don't need a shell if the command filename is an executable
  382. const needsShell = !isExecutableRegExp.test(commandFile);
  383. // If a shell is required, use cmd.exe and take care of escaping everything correctly
  384. // Note that `forceShell` is an hidden option used only in tests
  385. if (parsed.options.forceShell || needsShell) {
  386. // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
  387. // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
  388. // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
  389. // we need to double escape them
  390. const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
  391. // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
  392. // This is necessary otherwise it will always fail with ENOENT in those cases
  393. parsed.command = path.normalize(parsed.command);
  394. // Escape command & arguments
  395. parsed.command = escape.command(parsed.command);
  396. parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
  397. const shellCommand = [parsed.command].concat(parsed.args).join(' ');
  398. parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`];
  399. parsed.command = process.env.comspec || 'cmd.exe';
  400. parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
  401. }
  402. return parsed;
  403. }
  404. function parse$1(command, args, options) {
  405. // Normalize arguments, similar to nodejs
  406. if (args && !Array.isArray(args)) {
  407. options = args;
  408. args = null;
  409. }
  410. args = args ? args.slice(0) : []; // Clone array to avoid changing the original
  411. options = Object.assign({}, options); // Clone object to avoid changing the original
  412. // Build our parsed object
  413. const parsed = {
  414. command,
  415. args,
  416. options,
  417. file: undefined,
  418. original: {
  419. command,
  420. args,
  421. },
  422. };
  423. // Delegate further parsing to shell or non-shell
  424. return options.shell ? parsed : parseNonShell(parsed);
  425. }
  426. var parse_1 = parse$1;
  427. const isWin = process.platform === 'win32';
  428. function notFoundError(original, syscall) {
  429. return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
  430. code: 'ENOENT',
  431. errno: 'ENOENT',
  432. syscall: `${syscall} ${original.command}`,
  433. path: original.command,
  434. spawnargs: original.args,
  435. });
  436. }
  437. function hookChildProcess(cp, parsed) {
  438. if (!isWin) {
  439. return;
  440. }
  441. const originalEmit = cp.emit;
  442. cp.emit = function (name, arg1) {
  443. // If emitting "exit" event and exit code is 1, we need to check if
  444. // the command exists and emit an "error" instead
  445. // See https://github.com/IndigoUnited/node-cross-spawn/issues/16
  446. if (name === 'exit') {
  447. const err = verifyENOENT(arg1, parsed);
  448. if (err) {
  449. return originalEmit.call(cp, 'error', err);
  450. }
  451. }
  452. return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
  453. };
  454. }
  455. function verifyENOENT(status, parsed) {
  456. if (isWin && status === 1 && !parsed.file) {
  457. return notFoundError(parsed.original, 'spawn');
  458. }
  459. return null;
  460. }
  461. function verifyENOENTSync(status, parsed) {
  462. if (isWin && status === 1 && !parsed.file) {
  463. return notFoundError(parsed.original, 'spawnSync');
  464. }
  465. return null;
  466. }
  467. var enoent$1 = {
  468. hookChildProcess,
  469. verifyENOENT,
  470. verifyENOENTSync,
  471. notFoundError,
  472. };
  473. const cp = childProcess;
  474. const parse = parse_1;
  475. const enoent = enoent$1;
  476. function spawn(command, args, options) {
  477. // Parse the arguments
  478. const parsed = parse(command, args, options);
  479. // Spawn the child process
  480. const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
  481. // Hook into child process "exit" event to emit an error if the command
  482. // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
  483. enoent.hookChildProcess(spawned, parsed);
  484. return spawned;
  485. }
  486. function spawnSync(command, args, options) {
  487. // Parse the arguments
  488. const parsed = parse(command, args, options);
  489. // Spawn the child process
  490. const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
  491. // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
  492. result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
  493. return result;
  494. }
  495. crossSpawn.exports = spawn;
  496. crossSpawn.exports.spawn = spawn;
  497. crossSpawn.exports.sync = spawnSync;
  498. crossSpawn.exports._parse = parse;
  499. crossSpawn.exports._enoent = enoent;
  500. var getStream$1 = {exports: {}};
  501. const {PassThrough: PassThroughStream} = require$$0;
  502. var bufferStream$1 = options => {
  503. options = {...options};
  504. const {array} = options;
  505. let {encoding} = options;
  506. const isBuffer = encoding === 'buffer';
  507. let objectMode = false;
  508. if (array) {
  509. objectMode = !(encoding || isBuffer);
  510. } else {
  511. encoding = encoding || 'utf8';
  512. }
  513. if (isBuffer) {
  514. encoding = null;
  515. }
  516. const stream = new PassThroughStream({objectMode});
  517. if (encoding) {
  518. stream.setEncoding(encoding);
  519. }
  520. let length = 0;
  521. const chunks = [];
  522. stream.on('data', chunk => {
  523. chunks.push(chunk);
  524. if (objectMode) {
  525. length = chunks.length;
  526. } else {
  527. length += chunk.length;
  528. }
  529. });
  530. stream.getBufferedValue = () => {
  531. if (array) {
  532. return chunks;
  533. }
  534. return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
  535. };
  536. stream.getBufferedLength = () => length;
  537. return stream;
  538. };
  539. const {constants: BufferConstants} = require$$0$1;
  540. const stream = require$$0;
  541. const {promisify} = util;
  542. const bufferStream = bufferStream$1;
  543. const streamPipelinePromisified = promisify(stream.pipeline);
  544. class MaxBufferError extends Error {
  545. constructor() {
  546. super('maxBuffer exceeded');
  547. this.name = 'MaxBufferError';
  548. }
  549. }
  550. async function getStream(inputStream, options) {
  551. if (!inputStream) {
  552. throw new Error('Expected a stream');
  553. }
  554. options = {
  555. maxBuffer: Infinity,
  556. ...options
  557. };
  558. const {maxBuffer} = options;
  559. const stream = bufferStream(options);
  560. await new Promise((resolve, reject) => {
  561. const rejectPromise = error => {
  562. // Don't retrieve an oversized buffer.
  563. if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
  564. error.bufferedData = stream.getBufferedValue();
  565. }
  566. reject(error);
  567. };
  568. (async () => {
  569. try {
  570. await streamPipelinePromisified(inputStream, stream);
  571. resolve();
  572. } catch (error) {
  573. rejectPromise(error);
  574. }
  575. })();
  576. stream.on('data', () => {
  577. if (stream.getBufferedLength() > maxBuffer) {
  578. rejectPromise(new MaxBufferError());
  579. }
  580. });
  581. });
  582. return stream.getBufferedValue();
  583. }
  584. getStream$1.exports = getStream;
  585. getStream$1.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
  586. getStream$1.exports.array = (stream, options) => getStream(stream, {...options, array: true});
  587. getStream$1.exports.MaxBufferError = MaxBufferError;
  588. const { PassThrough } = require$$0;
  589. var mergeStream = function (/*streams...*/) {
  590. var sources = [];
  591. var output = new PassThrough({objectMode: true});
  592. output.setMaxListeners(0);
  593. output.add = add;
  594. output.isEmpty = isEmpty;
  595. output.on('unpipe', remove);
  596. Array.prototype.slice.call(arguments).forEach(add);
  597. return output
  598. function add (source) {
  599. if (Array.isArray(source)) {
  600. source.forEach(add);
  601. return this
  602. }
  603. sources.push(source);
  604. source.once('end', remove.bind(null, source));
  605. source.once('error', output.emit.bind(output, 'error'));
  606. source.pipe(output, {end: false});
  607. return this
  608. }
  609. function isEmpty () {
  610. return sources.length == 0;
  611. }
  612. function remove (source) {
  613. sources = sources.filter(function (it) { return it !== source });
  614. if (!sources.length && output.readable) { output.end(); }
  615. }
  616. };
  617. export { crossSpawn as c, getStream$1 as g, mergeStream as m, pathKey$1 as p };