cross-spawn-cb 0.6.4 → 0.6.7

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.
@@ -1,1660 +0,0 @@
1
- 'use strict';
2
-
3
- function _typeof(obj) {
4
- '@babel/helpers - typeof';
5
- return (
6
- (_typeof =
7
- 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
8
- ? function (obj) {
9
- return typeof obj;
10
- }
11
- : function (obj) {
12
- return obj && 'function' == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
13
- }),
14
- _typeof(obj)
15
- );
16
- }
17
-
18
- Object.defineProperty(exports, '__esModule', {
19
- value: true,
20
- });
21
-
22
- var require$$0$2 = require('child_process');
23
-
24
- var require$$0 = require('fs');
25
-
26
- var require$$1 = require('util');
27
-
28
- var require$$0$1 = require('path');
29
-
30
- function _interopDefaultLegacy(e) {
31
- return e && _typeof(e) === 'object' && 'default' in e
32
- ? e
33
- : {
34
- default: e,
35
- };
36
- }
37
-
38
- var require$$0__default$2 = /*#__PURE__*/ _interopDefaultLegacy(require$$0$2);
39
-
40
- var require$$0__default = /*#__PURE__*/ _interopDefaultLegacy(require$$0);
41
-
42
- var require$$1__default = /*#__PURE__*/ _interopDefaultLegacy(require$$1);
43
-
44
- var require$$0__default$1 = /*#__PURE__*/ _interopDefaultLegacy(require$$0$1);
45
-
46
- var commonjsGlobal =
47
- typeof globalThis !== 'undefined'
48
- ? globalThis
49
- : typeof window !== 'undefined'
50
- ? window
51
- : typeof global !== 'undefined'
52
- ? global
53
- : typeof self !== 'undefined'
54
- ? self
55
- : {};
56
- var crossSpawn = {
57
- exports: {},
58
- };
59
- var map = {
60
- exports: {},
61
- };
62
- var pseudomap;
63
- var hasRequiredPseudomap;
64
-
65
- function requirePseudomap() {
66
- if (hasRequiredPseudomap) return pseudomap;
67
- hasRequiredPseudomap = 1;
68
- var hasOwnProperty = Object.prototype.hasOwnProperty;
69
- pseudomap = PseudoMap;
70
-
71
- function PseudoMap(set) {
72
- if (!(this instanceof PseudoMap))
73
- // whyyyyyyy
74
- throw new TypeError("Constructor PseudoMap requires 'new'");
75
- this.clear();
76
-
77
- if (set) {
78
- if (set instanceof PseudoMap || (typeof Map === 'function' && set instanceof Map))
79
- set.forEach(function (value, key) {
80
- this.set(key, value);
81
- }, this);
82
- else if (Array.isArray(set))
83
- set.forEach(function (kv) {
84
- this.set(kv[0], kv[1]);
85
- }, this);
86
- else throw new TypeError('invalid argument');
87
- }
88
- }
89
-
90
- PseudoMap.prototype.forEach = function (fn, thisp) {
91
- thisp = thisp || this;
92
- Object.keys(this._data).forEach(function (k) {
93
- if (k !== 'size') fn.call(thisp, this._data[k].value, this._data[k].key);
94
- }, this);
95
- };
96
-
97
- PseudoMap.prototype.has = function (k) {
98
- return !!find(this._data, k);
99
- };
100
-
101
- PseudoMap.prototype.get = function (k) {
102
- var res = find(this._data, k);
103
- return res && res.value;
104
- };
105
-
106
- PseudoMap.prototype.set = function (k, v) {
107
- set(this._data, k, v);
108
- };
109
-
110
- PseudoMap.prototype['delete'] = function (k) {
111
- var res = find(this._data, k);
112
-
113
- if (res) {
114
- delete this._data[res._index];
115
- this._data.size--;
116
- }
117
- };
118
-
119
- PseudoMap.prototype.clear = function () {
120
- var data = Object.create(null);
121
- data.size = 0;
122
- Object.defineProperty(this, '_data', {
123
- value: data,
124
- enumerable: false,
125
- configurable: true,
126
- writable: false,
127
- });
128
- };
129
-
130
- Object.defineProperty(PseudoMap.prototype, 'size', {
131
- get: function get() {
132
- return this._data.size;
133
- },
134
- set: function set(n) {},
135
- enumerable: true,
136
- configurable: true,
137
- });
138
-
139
- PseudoMap.prototype.values =
140
- PseudoMap.prototype.keys =
141
- PseudoMap.prototype.entries =
142
- function () {
143
- throw new Error('iterators are not implemented in this version');
144
- }; // Either identical, or both NaN
145
-
146
- function same(a, b) {
147
- return a === b || (a !== a && b !== b);
148
- }
149
-
150
- function Entry(k, v, i) {
151
- this.key = k;
152
- this.value = v;
153
- this._index = i;
154
- }
155
-
156
- function find(data, k) {
157
- for (var i = 0, s = '_' + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
158
- if (same(data[key].key, k)) return data[key];
159
- }
160
- }
161
-
162
- function set(data, k, v) {
163
- for (var i = 0, s = '_' + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
164
- if (same(data[key].key, k)) {
165
- data[key].value = v;
166
- return;
167
- }
168
- }
169
-
170
- data.size++;
171
- data[key] = new Entry(k, v, key);
172
- }
173
-
174
- return pseudomap;
175
- }
176
-
177
- (function (module) {
178
- if (process.env.npm_package_name === 'pseudomap' && process.env.npm_lifecycle_script === 'test') process.env.TEST_PSEUDOMAP = 'true';
179
-
180
- if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {
181
- module.exports = Map;
182
- } else {
183
- module.exports = requirePseudomap();
184
- }
185
- })(map);
186
-
187
- var yallist = Yallist$1;
188
- Yallist$1.Node = Node;
189
- Yallist$1.create = Yallist$1;
190
-
191
- function Yallist$1(list) {
192
- var self = this;
193
-
194
- if (!(self instanceof Yallist$1)) {
195
- self = new Yallist$1();
196
- }
197
-
198
- self.tail = null;
199
- self.head = null;
200
- self.length = 0;
201
-
202
- if (list && typeof list.forEach === 'function') {
203
- list.forEach(function (item) {
204
- self.push(item);
205
- });
206
- } else if (arguments.length > 0) {
207
- for (var i = 0, l = arguments.length; i < l; i++) {
208
- self.push(arguments[i]);
209
- }
210
- }
211
-
212
- return self;
213
- }
214
-
215
- Yallist$1.prototype.removeNode = function (node) {
216
- if (node.list !== this) {
217
- throw new Error('removing node which does not belong to this list');
218
- }
219
-
220
- var next = node.next;
221
- var prev = node.prev;
222
-
223
- if (next) {
224
- next.prev = prev;
225
- }
226
-
227
- if (prev) {
228
- prev.next = next;
229
- }
230
-
231
- if (node === this.head) {
232
- this.head = next;
233
- }
234
-
235
- if (node === this.tail) {
236
- this.tail = prev;
237
- }
238
-
239
- node.list.length--;
240
- node.next = null;
241
- node.prev = null;
242
- node.list = null;
243
- };
244
-
245
- Yallist$1.prototype.unshiftNode = function (node) {
246
- if (node === this.head) {
247
- return;
248
- }
249
-
250
- if (node.list) {
251
- node.list.removeNode(node);
252
- }
253
-
254
- var head = this.head;
255
- node.list = this;
256
- node.next = head;
257
-
258
- if (head) {
259
- head.prev = node;
260
- }
261
-
262
- this.head = node;
263
-
264
- if (!this.tail) {
265
- this.tail = node;
266
- }
267
-
268
- this.length++;
269
- };
270
-
271
- Yallist$1.prototype.pushNode = function (node) {
272
- if (node === this.tail) {
273
- return;
274
- }
275
-
276
- if (node.list) {
277
- node.list.removeNode(node);
278
- }
279
-
280
- var tail = this.tail;
281
- node.list = this;
282
- node.prev = tail;
283
-
284
- if (tail) {
285
- tail.next = node;
286
- }
287
-
288
- this.tail = node;
289
-
290
- if (!this.head) {
291
- this.head = node;
292
- }
293
-
294
- this.length++;
295
- };
296
-
297
- Yallist$1.prototype.push = function () {
298
- for (var i = 0, l = arguments.length; i < l; i++) {
299
- push(this, arguments[i]);
300
- }
301
-
302
- return this.length;
303
- };
304
-
305
- Yallist$1.prototype.unshift = function () {
306
- for (var i = 0, l = arguments.length; i < l; i++) {
307
- unshift(this, arguments[i]);
308
- }
309
-
310
- return this.length;
311
- };
312
-
313
- Yallist$1.prototype.pop = function () {
314
- if (!this.tail) {
315
- return undefined;
316
- }
317
-
318
- var res = this.tail.value;
319
- this.tail = this.tail.prev;
320
-
321
- if (this.tail) {
322
- this.tail.next = null;
323
- } else {
324
- this.head = null;
325
- }
326
-
327
- this.length--;
328
- return res;
329
- };
330
-
331
- Yallist$1.prototype.shift = function () {
332
- if (!this.head) {
333
- return undefined;
334
- }
335
-
336
- var res = this.head.value;
337
- this.head = this.head.next;
338
-
339
- if (this.head) {
340
- this.head.prev = null;
341
- } else {
342
- this.tail = null;
343
- }
344
-
345
- this.length--;
346
- return res;
347
- };
348
-
349
- Yallist$1.prototype.forEach = function (fn, thisp) {
350
- thisp = thisp || this;
351
-
352
- for (var walker = this.head, i = 0; walker !== null; i++) {
353
- fn.call(thisp, walker.value, i, this);
354
- walker = walker.next;
355
- }
356
- };
357
-
358
- Yallist$1.prototype.forEachReverse = function (fn, thisp) {
359
- thisp = thisp || this;
360
-
361
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
362
- fn.call(thisp, walker.value, i, this);
363
- walker = walker.prev;
364
- }
365
- };
366
-
367
- Yallist$1.prototype.get = function (n) {
368
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
369
- // abort out of the list early if we hit a cycle
370
- walker = walker.next;
371
- }
372
-
373
- if (i === n && walker !== null) {
374
- return walker.value;
375
- }
376
- };
377
-
378
- Yallist$1.prototype.getReverse = function (n) {
379
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
380
- // abort out of the list early if we hit a cycle
381
- walker = walker.prev;
382
- }
383
-
384
- if (i === n && walker !== null) {
385
- return walker.value;
386
- }
387
- };
388
-
389
- Yallist$1.prototype.map = function (fn, thisp) {
390
- thisp = thisp || this;
391
- var res = new Yallist$1();
392
-
393
- for (var walker = this.head; walker !== null; ) {
394
- res.push(fn.call(thisp, walker.value, this));
395
- walker = walker.next;
396
- }
397
-
398
- return res;
399
- };
400
-
401
- Yallist$1.prototype.mapReverse = function (fn, thisp) {
402
- thisp = thisp || this;
403
- var res = new Yallist$1();
404
-
405
- for (var walker = this.tail; walker !== null; ) {
406
- res.push(fn.call(thisp, walker.value, this));
407
- walker = walker.prev;
408
- }
409
-
410
- return res;
411
- };
412
-
413
- Yallist$1.prototype.reduce = function (fn, initial) {
414
- var acc;
415
- var walker = this.head;
416
-
417
- if (arguments.length > 1) {
418
- acc = initial;
419
- } else if (this.head) {
420
- walker = this.head.next;
421
- acc = this.head.value;
422
- } else {
423
- throw new TypeError('Reduce of empty list with no initial value');
424
- }
425
-
426
- for (var i = 0; walker !== null; i++) {
427
- acc = fn(acc, walker.value, i);
428
- walker = walker.next;
429
- }
430
-
431
- return acc;
432
- };
433
-
434
- Yallist$1.prototype.reduceReverse = function (fn, initial) {
435
- var acc;
436
- var walker = this.tail;
437
-
438
- if (arguments.length > 1) {
439
- acc = initial;
440
- } else if (this.tail) {
441
- walker = this.tail.prev;
442
- acc = this.tail.value;
443
- } else {
444
- throw new TypeError('Reduce of empty list with no initial value');
445
- }
446
-
447
- for (var i = this.length - 1; walker !== null; i--) {
448
- acc = fn(acc, walker.value, i);
449
- walker = walker.prev;
450
- }
451
-
452
- return acc;
453
- };
454
-
455
- Yallist$1.prototype.toArray = function () {
456
- var arr = new Array(this.length);
457
-
458
- for (var i = 0, walker = this.head; walker !== null; i++) {
459
- arr[i] = walker.value;
460
- walker = walker.next;
461
- }
462
-
463
- return arr;
464
- };
465
-
466
- Yallist$1.prototype.toArrayReverse = function () {
467
- var arr = new Array(this.length);
468
-
469
- for (var i = 0, walker = this.tail; walker !== null; i++) {
470
- arr[i] = walker.value;
471
- walker = walker.prev;
472
- }
473
-
474
- return arr;
475
- };
476
-
477
- Yallist$1.prototype.slice = function (from, to) {
478
- to = to || this.length;
479
-
480
- if (to < 0) {
481
- to += this.length;
482
- }
483
-
484
- from = from || 0;
485
-
486
- if (from < 0) {
487
- from += this.length;
488
- }
489
-
490
- var ret = new Yallist$1();
491
-
492
- if (to < from || to < 0) {
493
- return ret;
494
- }
495
-
496
- if (from < 0) {
497
- from = 0;
498
- }
499
-
500
- if (to > this.length) {
501
- to = this.length;
502
- }
503
-
504
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
505
- walker = walker.next;
506
- }
507
-
508
- for (; walker !== null && i < to; i++, walker = walker.next) {
509
- ret.push(walker.value);
510
- }
511
-
512
- return ret;
513
- };
514
-
515
- Yallist$1.prototype.sliceReverse = function (from, to) {
516
- to = to || this.length;
517
-
518
- if (to < 0) {
519
- to += this.length;
520
- }
521
-
522
- from = from || 0;
523
-
524
- if (from < 0) {
525
- from += this.length;
526
- }
527
-
528
- var ret = new Yallist$1();
529
-
530
- if (to < from || to < 0) {
531
- return ret;
532
- }
533
-
534
- if (from < 0) {
535
- from = 0;
536
- }
537
-
538
- if (to > this.length) {
539
- to = this.length;
540
- }
541
-
542
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
543
- walker = walker.prev;
544
- }
545
-
546
- for (; walker !== null && i > from; i--, walker = walker.prev) {
547
- ret.push(walker.value);
548
- }
549
-
550
- return ret;
551
- };
552
-
553
- Yallist$1.prototype.reverse = function () {
554
- var head = this.head;
555
- var tail = this.tail;
556
-
557
- for (var walker = head; walker !== null; walker = walker.prev) {
558
- var p = walker.prev;
559
- walker.prev = walker.next;
560
- walker.next = p;
561
- }
562
-
563
- this.head = tail;
564
- this.tail = head;
565
- return this;
566
- };
567
-
568
- function push(self, item) {
569
- self.tail = new Node(item, self.tail, null, self);
570
-
571
- if (!self.head) {
572
- self.head = self.tail;
573
- }
574
-
575
- self.length++;
576
- }
577
-
578
- function unshift(self, item) {
579
- self.head = new Node(item, null, self.head, self);
580
-
581
- if (!self.tail) {
582
- self.tail = self.head;
583
- }
584
-
585
- self.length++;
586
- }
587
-
588
- function Node(value, prev, next, list) {
589
- if (!(this instanceof Node)) {
590
- return new Node(value, prev, next, list);
591
- }
592
-
593
- this.list = list;
594
- this.value = value;
595
-
596
- if (prev) {
597
- prev.next = this;
598
- this.prev = prev;
599
- } else {
600
- this.prev = null;
601
- }
602
-
603
- if (next) {
604
- next.prev = this;
605
- this.next = next;
606
- } else {
607
- this.next = null;
608
- }
609
- }
610
-
611
- var lruCache = LRUCache; // This will be a proper iterable 'Map' in engines that support it,
612
- // or a fakey-fake PseudoMap in older versions.
613
-
614
- var Map$1 = map.exports;
615
- var util = require$$1__default['default']; // A linked list to keep track of recently-used-ness
616
-
617
- var Yallist = yallist; // use symbols if possible, otherwise just _props
618
-
619
- var hasSymbol = typeof Symbol === 'function' && process.env._nodeLRUCacheForceNoSymbol !== '1';
620
- var makeSymbol;
621
-
622
- if (hasSymbol) {
623
- makeSymbol = function makeSymbol(key) {
624
- return Symbol(key);
625
- };
626
- } else {
627
- makeSymbol = function makeSymbol(key) {
628
- return '_' + key;
629
- };
630
- }
631
-
632
- var MAX = makeSymbol('max');
633
- var LENGTH = makeSymbol('length');
634
- var LENGTH_CALCULATOR = makeSymbol('lengthCalculator');
635
- var ALLOW_STALE = makeSymbol('allowStale');
636
- var MAX_AGE = makeSymbol('maxAge');
637
- var DISPOSE = makeSymbol('dispose');
638
- var NO_DISPOSE_ON_SET = makeSymbol('noDisposeOnSet');
639
- var LRU_LIST = makeSymbol('lruList');
640
- var CACHE = makeSymbol('cache');
641
-
642
- function naiveLength() {
643
- return 1;
644
- } // lruList is a yallist where the head is the youngest
645
- // item, and the tail is the oldest. the list contains the Hit
646
- // objects as the entries.
647
- // Each Hit object has a reference to its Yallist.Node. This
648
- // never changes.
649
- //
650
- // cache is a Map (or PseudoMap) that matches the keys to
651
- // the Yallist.Node object.
652
-
653
- function LRUCache(options) {
654
- if (!(this instanceof LRUCache)) {
655
- return new LRUCache(options);
656
- }
657
-
658
- if (typeof options === 'number') {
659
- options = {
660
- max: options,
661
- };
662
- }
663
-
664
- if (!options) {
665
- options = {};
666
- }
667
-
668
- var max = (this[MAX] = options.max); // Kind of weird to have a default max of Infinity, but oh well.
669
-
670
- if (!max || !(typeof max === 'number') || max <= 0) {
671
- this[MAX] = Infinity;
672
- }
673
-
674
- var lc = options.length || naiveLength;
675
-
676
- if (typeof lc !== 'function') {
677
- lc = naiveLength;
678
- }
679
-
680
- this[LENGTH_CALCULATOR] = lc;
681
- this[ALLOW_STALE] = options.stale || false;
682
- this[MAX_AGE] = options.maxAge || 0;
683
- this[DISPOSE] = options.dispose;
684
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
685
- this.reset();
686
- } // resize the cache when the max changes.
687
-
688
- Object.defineProperty(LRUCache.prototype, 'max', {
689
- set: function set(mL) {
690
- if (!mL || !(typeof mL === 'number') || mL <= 0) {
691
- mL = Infinity;
692
- }
693
-
694
- this[MAX] = mL;
695
- trim(this);
696
- },
697
- get: function get() {
698
- return this[MAX];
699
- },
700
- enumerable: true,
701
- });
702
- Object.defineProperty(LRUCache.prototype, 'allowStale', {
703
- set: function set(allowStale) {
704
- this[ALLOW_STALE] = !!allowStale;
705
- },
706
- get: function get() {
707
- return this[ALLOW_STALE];
708
- },
709
- enumerable: true,
710
- });
711
- Object.defineProperty(LRUCache.prototype, 'maxAge', {
712
- set: function set(mA) {
713
- if (!mA || !(typeof mA === 'number') || mA < 0) {
714
- mA = 0;
715
- }
716
-
717
- this[MAX_AGE] = mA;
718
- trim(this);
719
- },
720
- get: function get() {
721
- return this[MAX_AGE];
722
- },
723
- enumerable: true,
724
- }); // resize the cache when the lengthCalculator changes.
725
-
726
- Object.defineProperty(LRUCache.prototype, 'lengthCalculator', {
727
- set: function set(lC) {
728
- if (typeof lC !== 'function') {
729
- lC = naiveLength;
730
- }
731
-
732
- if (lC !== this[LENGTH_CALCULATOR]) {
733
- this[LENGTH_CALCULATOR] = lC;
734
- this[LENGTH] = 0;
735
- this[LRU_LIST].forEach(function (hit) {
736
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
737
- this[LENGTH] += hit.length;
738
- }, this);
739
- }
740
-
741
- trim(this);
742
- },
743
- get: function get() {
744
- return this[LENGTH_CALCULATOR];
745
- },
746
- enumerable: true,
747
- });
748
- Object.defineProperty(LRUCache.prototype, 'length', {
749
- get: function get() {
750
- return this[LENGTH];
751
- },
752
- enumerable: true,
753
- });
754
- Object.defineProperty(LRUCache.prototype, 'itemCount', {
755
- get: function get() {
756
- return this[LRU_LIST].length;
757
- },
758
- enumerable: true,
759
- });
760
-
761
- LRUCache.prototype.rforEach = function (fn, thisp) {
762
- thisp = thisp || this;
763
-
764
- for (var walker = this[LRU_LIST].tail; walker !== null; ) {
765
- var prev = walker.prev;
766
- forEachStep(this, fn, walker, thisp);
767
- walker = prev;
768
- }
769
- };
770
-
771
- function forEachStep(self, fn, node, thisp) {
772
- var hit = node.value;
773
-
774
- if (isStale(self, hit)) {
775
- del(self, node);
776
-
777
- if (!self[ALLOW_STALE]) {
778
- hit = undefined;
779
- }
780
- }
781
-
782
- if (hit) {
783
- fn.call(thisp, hit.value, hit.key, self);
784
- }
785
- }
786
-
787
- LRUCache.prototype.forEach = function (fn, thisp) {
788
- thisp = thisp || this;
789
-
790
- for (var walker = this[LRU_LIST].head; walker !== null; ) {
791
- var next = walker.next;
792
- forEachStep(this, fn, walker, thisp);
793
- walker = next;
794
- }
795
- };
796
-
797
- LRUCache.prototype.keys = function () {
798
- return this[LRU_LIST].toArray().map(function (k) {
799
- return k.key;
800
- }, this);
801
- };
802
-
803
- LRUCache.prototype.values = function () {
804
- return this[LRU_LIST].toArray().map(function (k) {
805
- return k.value;
806
- }, this);
807
- };
808
-
809
- LRUCache.prototype.reset = function () {
810
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
811
- this[LRU_LIST].forEach(function (hit) {
812
- this[DISPOSE](hit.key, hit.value);
813
- }, this);
814
- }
815
-
816
- this[CACHE] = new Map$1(); // hash of items by key
817
-
818
- this[LRU_LIST] = new Yallist(); // list of items in order of use recency
819
-
820
- this[LENGTH] = 0; // length of items in the list
821
- };
822
-
823
- LRUCache.prototype.dump = function () {
824
- return this[LRU_LIST].map(function (hit) {
825
- if (!isStale(this, hit)) {
826
- return {
827
- k: hit.key,
828
- v: hit.value,
829
- e: hit.now + (hit.maxAge || 0),
830
- };
831
- }
832
- }, this)
833
- .toArray()
834
- .filter(function (h) {
835
- return h;
836
- });
837
- };
838
-
839
- LRUCache.prototype.dumpLru = function () {
840
- return this[LRU_LIST];
841
- };
842
- /* istanbul ignore next */
843
-
844
- LRUCache.prototype.inspect = function (n, opts) {
845
- var str = 'LRUCache {';
846
- var extras = false;
847
- var as = this[ALLOW_STALE];
848
-
849
- if (as) {
850
- str += '\n allowStale: true';
851
- extras = true;
852
- }
853
-
854
- var max = this[MAX];
855
-
856
- if (max && max !== Infinity) {
857
- if (extras) {
858
- str += ',';
859
- }
860
-
861
- str += '\n max: ' + util.inspect(max, opts);
862
- extras = true;
863
- }
864
-
865
- var maxAge = this[MAX_AGE];
866
-
867
- if (maxAge) {
868
- if (extras) {
869
- str += ',';
870
- }
871
-
872
- str += '\n maxAge: ' + util.inspect(maxAge, opts);
873
- extras = true;
874
- }
875
-
876
- var lc = this[LENGTH_CALCULATOR];
877
-
878
- if (lc && lc !== naiveLength) {
879
- if (extras) {
880
- str += ',';
881
- }
882
-
883
- str += '\n length: ' + util.inspect(this[LENGTH], opts);
884
- extras = true;
885
- }
886
-
887
- var didFirst = false;
888
- this[LRU_LIST].forEach(function (item) {
889
- if (didFirst) {
890
- str += ',\n ';
891
- } else {
892
- if (extras) {
893
- str += ',\n';
894
- }
895
-
896
- didFirst = true;
897
- str += '\n ';
898
- }
899
-
900
- var key = util.inspect(item.key).split('\n').join('\n ');
901
- var val = {
902
- value: item.value,
903
- };
904
-
905
- if (item.maxAge !== maxAge) {
906
- val.maxAge = item.maxAge;
907
- }
908
-
909
- if (lc !== naiveLength) {
910
- val.length = item.length;
911
- }
912
-
913
- if (isStale(this, item)) {
914
- val.stale = true;
915
- }
916
-
917
- val = util.inspect(val, opts).split('\n').join('\n ');
918
- str += key + ' => ' + val;
919
- });
920
-
921
- if (didFirst || extras) {
922
- str += '\n';
923
- }
924
-
925
- str += '}';
926
- return str;
927
- };
928
-
929
- LRUCache.prototype.set = function (key, value, maxAge) {
930
- maxAge = maxAge || this[MAX_AGE];
931
- var now = maxAge ? Date.now() : 0;
932
- var len = this[LENGTH_CALCULATOR](value, key);
933
-
934
- if (this[CACHE].has(key)) {
935
- if (len > this[MAX]) {
936
- del(this, this[CACHE].get(key));
937
- return false;
938
- }
939
-
940
- var node = this[CACHE].get(key);
941
- var item = node.value; // dispose of the old one before overwriting
942
- // split out into 2 ifs for better coverage tracking
943
-
944
- if (this[DISPOSE]) {
945
- if (!this[NO_DISPOSE_ON_SET]) {
946
- this[DISPOSE](key, item.value);
947
- }
948
- }
949
-
950
- item.now = now;
951
- item.maxAge = maxAge;
952
- item.value = value;
953
- this[LENGTH] += len - item.length;
954
- item.length = len;
955
- this.get(key);
956
- trim(this);
957
- return true;
958
- }
959
-
960
- var hit = new Entry(key, value, len, now, maxAge); // oversized objects fall out of cache automatically.
961
-
962
- if (hit.length > this[MAX]) {
963
- if (this[DISPOSE]) {
964
- this[DISPOSE](key, value);
965
- }
966
-
967
- return false;
968
- }
969
-
970
- this[LENGTH] += hit.length;
971
- this[LRU_LIST].unshift(hit);
972
- this[CACHE].set(key, this[LRU_LIST].head);
973
- trim(this);
974
- return true;
975
- };
976
-
977
- LRUCache.prototype.has = function (key) {
978
- if (!this[CACHE].has(key)) return false;
979
- var hit = this[CACHE].get(key).value;
980
-
981
- if (isStale(this, hit)) {
982
- return false;
983
- }
984
-
985
- return true;
986
- };
987
-
988
- LRUCache.prototype.get = function (key) {
989
- return get(this, key, true);
990
- };
991
-
992
- LRUCache.prototype.peek = function (key) {
993
- return get(this, key, false);
994
- };
995
-
996
- LRUCache.prototype.pop = function () {
997
- var node = this[LRU_LIST].tail;
998
- if (!node) return null;
999
- del(this, node);
1000
- return node.value;
1001
- };
1002
-
1003
- LRUCache.prototype.del = function (key) {
1004
- del(this, this[CACHE].get(key));
1005
- };
1006
-
1007
- LRUCache.prototype.load = function (arr) {
1008
- // reset the cache
1009
- this.reset();
1010
- var now = Date.now(); // A previous serialized cache has the most recent items first
1011
-
1012
- for (var l = arr.length - 1; l >= 0; l--) {
1013
- var hit = arr[l];
1014
- var expiresAt = hit.e || 0;
1015
-
1016
- if (expiresAt === 0) {
1017
- // the item was created without expiration in a non aged cache
1018
- this.set(hit.k, hit.v);
1019
- } else {
1020
- var maxAge = expiresAt - now; // dont add already expired items
1021
-
1022
- if (maxAge > 0) {
1023
- this.set(hit.k, hit.v, maxAge);
1024
- }
1025
- }
1026
- }
1027
- };
1028
-
1029
- LRUCache.prototype.prune = function () {
1030
- var self = this;
1031
- this[CACHE].forEach(function (value, key) {
1032
- get(self, key, false);
1033
- });
1034
- };
1035
-
1036
- function get(self, key, doUse) {
1037
- var node = self[CACHE].get(key);
1038
-
1039
- if (node) {
1040
- var hit = node.value;
1041
-
1042
- if (isStale(self, hit)) {
1043
- del(self, node);
1044
- if (!self[ALLOW_STALE]) hit = undefined;
1045
- } else {
1046
- if (doUse) {
1047
- self[LRU_LIST].unshiftNode(node);
1048
- }
1049
- }
1050
-
1051
- if (hit) hit = hit.value;
1052
- }
1053
-
1054
- return hit;
1055
- }
1056
-
1057
- function isStale(self, hit) {
1058
- if (!hit || (!hit.maxAge && !self[MAX_AGE])) {
1059
- return false;
1060
- }
1061
-
1062
- var stale = false;
1063
- var diff = Date.now() - hit.now;
1064
-
1065
- if (hit.maxAge) {
1066
- stale = diff > hit.maxAge;
1067
- } else {
1068
- stale = self[MAX_AGE] && diff > self[MAX_AGE];
1069
- }
1070
-
1071
- return stale;
1072
- }
1073
-
1074
- function trim(self) {
1075
- if (self[LENGTH] > self[MAX]) {
1076
- for (var walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null; ) {
1077
- // We know that we're about to delete this one, and also
1078
- // what the next least recently used key will be, so just
1079
- // go ahead and set it now.
1080
- var prev = walker.prev;
1081
- del(self, walker);
1082
- walker = prev;
1083
- }
1084
- }
1085
- }
1086
-
1087
- function del(self, node) {
1088
- if (node) {
1089
- var hit = node.value;
1090
-
1091
- if (self[DISPOSE]) {
1092
- self[DISPOSE](hit.key, hit.value);
1093
- }
1094
-
1095
- self[LENGTH] -= hit.length;
1096
- self[CACHE]['delete'](hit.key);
1097
- self[LRU_LIST].removeNode(node);
1098
- }
1099
- } // classy, since V8 prefers predictable objects.
1100
-
1101
- function Entry(key, value, length, now, maxAge) {
1102
- this.key = key;
1103
- this.value = value;
1104
- this.length = length;
1105
- this.now = now;
1106
- this.maxAge = maxAge || 0;
1107
- }
1108
-
1109
- var windows;
1110
- var hasRequiredWindows;
1111
-
1112
- function requireWindows() {
1113
- if (hasRequiredWindows) return windows;
1114
- hasRequiredWindows = 1;
1115
- windows = isexe;
1116
- isexe.sync = sync;
1117
- var fs = require$$0__default['default'];
1118
-
1119
- function checkPathExt(path, options) {
1120
- var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
1121
-
1122
- if (!pathext) {
1123
- return true;
1124
- }
1125
-
1126
- pathext = pathext.split(';');
1127
-
1128
- if (pathext.indexOf('') !== -1) {
1129
- return true;
1130
- }
1131
-
1132
- for (var i = 0; i < pathext.length; i++) {
1133
- var p = pathext[i].toLowerCase();
1134
-
1135
- if (p && path.substr(-p.length).toLowerCase() === p) {
1136
- return true;
1137
- }
1138
- }
1139
-
1140
- return false;
1141
- }
1142
-
1143
- function checkStat(stat, path, options) {
1144
- if (!stat.isSymbolicLink() && !stat.isFile()) {
1145
- return false;
1146
- }
1147
-
1148
- return checkPathExt(path, options);
1149
- }
1150
-
1151
- function isexe(path, options, cb) {
1152
- fs.stat(path, function (er, stat) {
1153
- cb(er, er ? false : checkStat(stat, path, options));
1154
- });
1155
- }
1156
-
1157
- function sync(path, options) {
1158
- return checkStat(fs.statSync(path), path, options);
1159
- }
1160
-
1161
- return windows;
1162
- }
1163
-
1164
- var mode;
1165
- var hasRequiredMode;
1166
-
1167
- function requireMode() {
1168
- if (hasRequiredMode) return mode;
1169
- hasRequiredMode = 1;
1170
- mode = isexe;
1171
- isexe.sync = sync;
1172
- var fs = require$$0__default['default'];
1173
-
1174
- function isexe(path, options, cb) {
1175
- fs.stat(path, function (er, stat) {
1176
- cb(er, er ? false : checkStat(stat, options));
1177
- });
1178
- }
1179
-
1180
- function sync(path, options) {
1181
- return checkStat(fs.statSync(path), options);
1182
- }
1183
-
1184
- function checkStat(stat, options) {
1185
- return stat.isFile() && checkMode(stat, options);
1186
- }
1187
-
1188
- function checkMode(stat, options) {
1189
- var mod = stat.mode;
1190
- var uid = stat.uid;
1191
- var gid = stat.gid;
1192
- var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
1193
- var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
1194
- var u = parseInt('100', 8);
1195
- var g = parseInt('010', 8);
1196
- var o = parseInt('001', 8);
1197
- var ug = u | g;
1198
- var ret = mod & o || (mod & g && gid === myGid) || (mod & u && uid === myUid) || (mod & ug && myUid === 0);
1199
- return ret;
1200
- }
1201
-
1202
- return mode;
1203
- }
1204
-
1205
- var core;
1206
-
1207
- if (process.platform === 'win32' || commonjsGlobal.TESTING_WINDOWS) {
1208
- core = requireWindows();
1209
- } else {
1210
- core = requireMode();
1211
- }
1212
-
1213
- var isexe_1 = isexe$1;
1214
- isexe$1.sync = sync$1;
1215
-
1216
- function isexe$1(path, options, cb) {
1217
- if (typeof options === 'function') {
1218
- cb = options;
1219
- options = {};
1220
- }
1221
-
1222
- if (!cb) {
1223
- if (typeof Promise !== 'function') {
1224
- throw new TypeError('callback not provided');
1225
- }
1226
-
1227
- return new Promise(function (resolve, reject) {
1228
- isexe$1(path, options || {}, function (er, is) {
1229
- if (er) {
1230
- reject(er);
1231
- } else {
1232
- resolve(is);
1233
- }
1234
- });
1235
- });
1236
- }
1237
-
1238
- core(path, options || {}, function (er, is) {
1239
- // ignore EACCES because that just means we aren't allowed to run it
1240
- if (er) {
1241
- if (er.code === 'EACCES' || (options && options.ignoreErrors)) {
1242
- er = null;
1243
- is = false;
1244
- }
1245
- }
1246
-
1247
- cb(er, is);
1248
- });
1249
- }
1250
-
1251
- function sync$1(path, options) {
1252
- // my kingdom for a filtered catch
1253
- try {
1254
- return core.sync(path, options || {});
1255
- } catch (er) {
1256
- if ((options && options.ignoreErrors) || er.code === 'EACCES') {
1257
- return false;
1258
- } else {
1259
- throw er;
1260
- }
1261
- }
1262
- }
1263
-
1264
- var which_1 = which$1;
1265
- which$1.sync = whichSync;
1266
- var isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys';
1267
- var path$1 = require$$0__default$1['default'];
1268
- var COLON = isWindows ? ';' : ':';
1269
- var isexe = isexe_1;
1270
-
1271
- function getNotFoundError(cmd) {
1272
- var er = new Error('not found: ' + cmd);
1273
- er.code = 'ENOENT';
1274
- return er;
1275
- }
1276
-
1277
- function getPathInfo(cmd, opt) {
1278
- var colon = opt.colon || COLON;
1279
- var pathEnv = opt.path || process.env.PATH || '';
1280
- var pathExt = [''];
1281
- pathEnv = pathEnv.split(colon);
1282
- var pathExtExe = '';
1283
-
1284
- if (isWindows) {
1285
- pathEnv.unshift(process.cwd());
1286
- pathExtExe = opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM';
1287
- pathExt = pathExtExe.split(colon); // Always test the cmd itself first. isexe will check to make sure
1288
- // it's found in the pathExt set.
1289
-
1290
- if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift('');
1291
- } // If it has a slash, then we don't bother searching the pathenv.
1292
- // just check the file itself, and that's it.
1293
-
1294
- if (cmd.match(/\//) || (isWindows && cmd.match(/\\/))) pathEnv = [''];
1295
- return {
1296
- env: pathEnv,
1297
- ext: pathExt,
1298
- extExe: pathExtExe,
1299
- };
1300
- }
1301
-
1302
- function which$1(cmd, opt, cb) {
1303
- if (typeof opt === 'function') {
1304
- cb = opt;
1305
- opt = {};
1306
- }
1307
-
1308
- var info = getPathInfo(cmd, opt);
1309
- var pathEnv = info.env;
1310
- var pathExt = info.ext;
1311
- var pathExtExe = info.extExe;
1312
- var found = [];
1313
-
1314
- (function F(i, l) {
1315
- if (i === l) {
1316
- if (opt.all && found.length) return cb(null, found);
1317
- else return cb(getNotFoundError(cmd));
1318
- }
1319
-
1320
- var pathPart = pathEnv[i];
1321
- if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
1322
- var p = path$1.join(pathPart, cmd);
1323
-
1324
- if (!pathPart && /^\.[\\\/]/.test(cmd)) {
1325
- p = cmd.slice(0, 2) + p;
1326
- }
1327
-
1328
- (function E(ii, ll) {
1329
- if (ii === ll) return F(i + 1, l);
1330
- var ext = pathExt[ii];
1331
- isexe(
1332
- p + ext,
1333
- {
1334
- pathExt: pathExtExe,
1335
- },
1336
- function (er, is) {
1337
- if (!er && is) {
1338
- if (opt.all) found.push(p + ext);
1339
- else return cb(null, p + ext);
1340
- }
1341
-
1342
- return E(ii + 1, ll);
1343
- }
1344
- );
1345
- })(0, pathExt.length);
1346
- })(0, pathEnv.length);
1347
- }
1348
-
1349
- function whichSync(cmd, opt) {
1350
- opt = opt || {};
1351
- var info = getPathInfo(cmd, opt);
1352
- var pathEnv = info.env;
1353
- var pathExt = info.ext;
1354
- var pathExtExe = info.extExe;
1355
- var found = [];
1356
-
1357
- for (var i = 0, l = pathEnv.length; i < l; i++) {
1358
- var pathPart = pathEnv[i];
1359
- if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
1360
- var p = path$1.join(pathPart, cmd);
1361
-
1362
- if (!pathPart && /^\.[\\\/]/.test(cmd)) {
1363
- p = cmd.slice(0, 2) + p;
1364
- }
1365
-
1366
- for (var j = 0, ll = pathExt.length; j < ll; j++) {
1367
- var cur = p + pathExt[j];
1368
- var is;
1369
-
1370
- try {
1371
- is = isexe.sync(cur, {
1372
- pathExt: pathExtExe,
1373
- });
1374
-
1375
- if (is) {
1376
- if (opt.all) found.push(cur);
1377
- else return cur;
1378
- }
1379
- } catch (ex) {}
1380
- }
1381
- }
1382
-
1383
- if (opt.all && found.length) return found;
1384
- if (opt.nothrow) return null;
1385
- throw getNotFoundError(cmd);
1386
- }
1387
-
1388
- var path = require$$0__default$1['default'];
1389
- var which = which_1;
1390
- var LRU$1 = lruCache;
1391
- var commandCache = new LRU$1({
1392
- max: 50,
1393
- maxAge: 30 * 1000,
1394
- }); // Cache just for 30sec
1395
-
1396
- function resolveCommand$2(command, noExtension) {
1397
- var resolved;
1398
- noExtension = !!noExtension;
1399
- resolved = commandCache.get(command + '!' + noExtension); // Check if its resolved in the cache
1400
-
1401
- if (commandCache.has(command)) {
1402
- return commandCache.get(command);
1403
- }
1404
-
1405
- try {
1406
- resolved = !noExtension
1407
- ? which.sync(command)
1408
- : which.sync(command, {
1409
- pathExt: path.delimiter + (process.env.PATHEXT || ''),
1410
- });
1411
- } catch (e) {
1412
- /* empty */
1413
- }
1414
-
1415
- commandCache.set(command + '!' + noExtension, resolved);
1416
- return resolved;
1417
- }
1418
-
1419
- var resolveCommand_1 = resolveCommand$2;
1420
- var fs = require$$0__default['default'];
1421
- var LRU = lruCache;
1422
- var resolveCommand$1 = resolveCommand_1;
1423
- var isWin$1 = process.platform === 'win32';
1424
- var shebangCache = new LRU({
1425
- max: 50,
1426
- maxAge: 30 * 1000,
1427
- }); // Cache just for 30sec
1428
-
1429
- function readShebang(command) {
1430
- var buffer;
1431
- var fd;
1432
- var match;
1433
- var shebang; // Check if it is in the cache first
1434
-
1435
- if (shebangCache.has(command)) {
1436
- return shebangCache.get(command);
1437
- } // Read the first 150 bytes from the file
1438
-
1439
- buffer = new Buffer(150);
1440
-
1441
- try {
1442
- fd = fs.openSync(command, 'r');
1443
- fs.readSync(fd, buffer, 0, 150, 0);
1444
- fs.closeSync(fd);
1445
- } catch (e) {
1446
- /* empty */
1447
- } // Check if it is a shebang
1448
-
1449
- match = buffer
1450
- .toString()
1451
- .trim()
1452
- .match(/#!(.+)/i);
1453
-
1454
- if (match) {
1455
- shebang = match[1].replace(/\/usr\/bin\/env\s+/i, ''); // Remove /usr/bin/env
1456
- } // Store the shebang in the cache
1457
-
1458
- shebangCache.set(command, shebang);
1459
- return shebang;
1460
- }
1461
-
1462
- function escapeArg(arg, quote) {
1463
- // Convert to string
1464
- arg = '' + arg; // If we are not going to quote the argument,
1465
- // escape shell metacharacters, including double and single quotes:
1466
-
1467
- if (!quote) {
1468
- arg = arg.replace(/([\(\)%!\^<>&|;,"'\s])/g, '^$1');
1469
- } else {
1470
- // Sequence of backslashes followed by a double quote:
1471
- // double up all the backslashes and escape the double quote
1472
- arg = arg.replace(/(\\*)"/g, '$1$1\\"'); // Sequence of backslashes followed by the end of the string
1473
- // (which will become a double quote later):
1474
- // double up all the backslashes
1475
-
1476
- arg = arg.replace(/(\\*)$/, '$1$1'); // All other backslashes occur literally
1477
- // Quote the whole thing:
1478
-
1479
- arg = '"' + arg + '"';
1480
- }
1481
-
1482
- return arg;
1483
- }
1484
-
1485
- function escapeCommand(command) {
1486
- // Do not escape if this command is not dangerous..
1487
- // We do this so that commands like "echo" or "ifconfig" work
1488
- // Quoting them, will make them unaccessible
1489
- return /^[a-z0-9_-]+$/i.test(command) ? command : escapeArg(command, true);
1490
- }
1491
-
1492
- function parse$1(command, args, options) {
1493
- var shebang;
1494
- var applyQuotes;
1495
- var file;
1496
- var original; // Normalize arguments, similar to nodejs
1497
-
1498
- if (args && !Array.isArray(args)) {
1499
- options = args;
1500
- args = null;
1501
- }
1502
-
1503
- args = args ? args.slice(0) : []; // Clone array to avoid changing the original
1504
-
1505
- options = options || {};
1506
- original = command;
1507
-
1508
- if (isWin$1) {
1509
- // Detect & add support for shebangs
1510
- file = resolveCommand$1(command);
1511
- file = file || resolveCommand$1(command, true);
1512
- shebang = file && readShebang(file);
1513
-
1514
- if (shebang) {
1515
- args.unshift(file);
1516
- command = shebang;
1517
- } // Escape command & arguments
1518
-
1519
- applyQuotes = command !== 'echo'; // Do not quote arguments for the special "echo" command
1520
-
1521
- command = escapeCommand(command);
1522
- args = args.map(function (arg) {
1523
- return escapeArg(arg, applyQuotes);
1524
- }); // Use cmd.exe
1525
-
1526
- args = ['/s', '/c', '"' + command + (args.length ? ' ' + args.join(' ') : '') + '"'];
1527
- command = process.env.comspec || 'cmd.exe'; // Tell node's spawn that the arguments are already escaped
1528
-
1529
- options.windowsVerbatimArguments = true;
1530
- }
1531
-
1532
- return {
1533
- command: command,
1534
- args: args,
1535
- options: options,
1536
- file: file,
1537
- original: original,
1538
- };
1539
- }
1540
-
1541
- var parse_1 = parse$1;
1542
- var enoent$1 = {};
1543
- var isWin = process.platform === 'win32';
1544
- var resolveCommand = resolveCommand_1;
1545
- var isNode10 = process.version.indexOf('v0.10.') === 0;
1546
-
1547
- function notFoundError(command, syscall) {
1548
- var err;
1549
- err = new Error(syscall + ' ' + command + ' ENOENT');
1550
- err.code = err.errno = 'ENOENT';
1551
- err.syscall = syscall + ' ' + command;
1552
- return err;
1553
- }
1554
-
1555
- function hookChildProcess(cp, parsed) {
1556
- var originalEmit;
1557
-
1558
- if (!isWin) {
1559
- return;
1560
- }
1561
-
1562
- originalEmit = cp.emit;
1563
-
1564
- cp.emit = function (name, arg1) {
1565
- var err; // If emitting "exit" event and exit code is 1, we need to check if
1566
- // the command exists and emit an "error" instead
1567
- // See: https://github.com/IndigoUnited/node-cross-spawn/issues/16
1568
-
1569
- if (name === 'exit') {
1570
- err = verifyENOENT(arg1, parsed);
1571
-
1572
- if (err) {
1573
- return originalEmit.call(cp, 'error', err);
1574
- }
1575
- }
1576
-
1577
- return originalEmit.apply(cp, arguments);
1578
- };
1579
- }
1580
-
1581
- function verifyENOENT(status, parsed) {
1582
- if (isWin && status === 1 && !parsed.file) {
1583
- return notFoundError(parsed.original, 'spawn');
1584
- }
1585
-
1586
- return null;
1587
- }
1588
-
1589
- function verifyENOENTSync(status, parsed) {
1590
- if (isWin && status === 1 && !parsed.file) {
1591
- return notFoundError(parsed.original, 'spawnSync');
1592
- } // If we are in node 10, then we are using spawn-sync; if it exited
1593
- // with -1 it probably means that the command does not exist
1594
-
1595
- if (isNode10 && status === -1) {
1596
- parsed.file = isWin ? parsed.file : resolveCommand(parsed.original);
1597
-
1598
- if (!parsed.file) {
1599
- return notFoundError(parsed.original, 'spawnSync');
1600
- }
1601
- }
1602
-
1603
- return null;
1604
- }
1605
-
1606
- enoent$1.hookChildProcess = hookChildProcess;
1607
- enoent$1.verifyENOENT = verifyENOENT;
1608
- enoent$1.verifyENOENTSync = verifyENOENTSync;
1609
- enoent$1.notFoundError = notFoundError;
1610
- var cp = require$$0__default$2['default'];
1611
- var parse = parse_1;
1612
- var enoent = enoent$1;
1613
- var cpSpawnSync = cp.spawnSync;
1614
-
1615
- function spawn(command, args, options) {
1616
- var parsed;
1617
- var spawned; // Parse the arguments
1618
-
1619
- parsed = parse(command, args, options); // Spawn the child process
1620
-
1621
- spawned = cp.spawn(parsed.command, parsed.args, parsed.options); // Hook into child process "exit" event to emit an error if the command
1622
- // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
1623
-
1624
- enoent.hookChildProcess(spawned, parsed);
1625
- return spawned;
1626
- }
1627
-
1628
- function spawnSync(command, args, options) {
1629
- var parsed;
1630
- var result;
1631
-
1632
- if (!cpSpawnSync) {
1633
- // try {
1634
- // cpSpawnSync = require('spawn-sync'); // eslint-disable-line global-require
1635
- // } catch (ex) {
1636
- throw new Error('In order to use spawnSync on node 0.10 or older, you must ' + 'install spawn-sync:\n\n' + ' npm install spawn-sync --save');
1637
- // }
1638
- } // Parse the arguments
1639
-
1640
- parsed = parse(command, args, options); // Spawn the child process
1641
-
1642
- result = cpSpawnSync(parsed.command, parsed.args, parsed.options); // Analyze if the command does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
1643
-
1644
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
1645
- return result;
1646
- }
1647
-
1648
- crossSpawn.exports = spawn;
1649
- var spawn_1 = (crossSpawn.exports.spawn = spawn);
1650
- var sync = (crossSpawn.exports.sync = spawnSync);
1651
-
1652
- var _parse = (crossSpawn.exports._parse = parse);
1653
-
1654
- var _enoent = (crossSpawn.exports._enoent = enoent);
1655
-
1656
- exports._enoent = _enoent;
1657
- exports._parse = _parse;
1658
- exports['default'] = crossSpawn.exports;
1659
- exports.spawn = spawn_1;
1660
- exports.sync = sync;