@markw65/monkeyc-optimizer 1.0.1 → 1.0.4
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.
- package/README.md +21 -0
- package/build/api.cjs +501 -0
- package/build/optimizer.cjs +418 -4296
- package/build/util.cjs +4159 -0
- package/package.json +9 -3
package/build/util.cjs
ADDED
|
@@ -0,0 +1,4159 @@
|
|
|
1
|
+
0 && (module.exports = {isWin,appSupport,connectiq,getSdkPath,globa,last_modified,first_modified,pushUnique,spawnByLine,readByLine,promiseAll,copyRecursiveAsNeeded});
|
|
2
|
+
/******/ (() => { // webpackBootstrap
|
|
3
|
+
/******/ var __webpack_modules__ = ({
|
|
4
|
+
|
|
5
|
+
/***/ 5623:
|
|
6
|
+
/***/ ((module) => {
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
|
|
10
|
+
module.exports = balanced;
|
|
11
|
+
function balanced(a, b, str) {
|
|
12
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
13
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
14
|
+
|
|
15
|
+
var r = range(a, b, str);
|
|
16
|
+
|
|
17
|
+
return r && {
|
|
18
|
+
start: r[0],
|
|
19
|
+
end: r[1],
|
|
20
|
+
pre: str.slice(0, r[0]),
|
|
21
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
22
|
+
post: str.slice(r[1] + b.length)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function maybeMatch(reg, str) {
|
|
27
|
+
var m = str.match(reg);
|
|
28
|
+
return m ? m[0] : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
balanced.range = range;
|
|
32
|
+
function range(a, b, str) {
|
|
33
|
+
var begs, beg, left, right, result;
|
|
34
|
+
var ai = str.indexOf(a);
|
|
35
|
+
var bi = str.indexOf(b, ai + 1);
|
|
36
|
+
var i = ai;
|
|
37
|
+
|
|
38
|
+
if (ai >= 0 && bi > 0) {
|
|
39
|
+
if(a===b) {
|
|
40
|
+
return [ai, bi];
|
|
41
|
+
}
|
|
42
|
+
begs = [];
|
|
43
|
+
left = str.length;
|
|
44
|
+
|
|
45
|
+
while (i >= 0 && !result) {
|
|
46
|
+
if (i == ai) {
|
|
47
|
+
begs.push(i);
|
|
48
|
+
ai = str.indexOf(a, i + 1);
|
|
49
|
+
} else if (begs.length == 1) {
|
|
50
|
+
result = [ begs.pop(), bi ];
|
|
51
|
+
} else {
|
|
52
|
+
beg = begs.pop();
|
|
53
|
+
if (beg < left) {
|
|
54
|
+
left = beg;
|
|
55
|
+
right = bi;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
bi = str.indexOf(b, i + 1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (begs.length) {
|
|
65
|
+
result = [ left, right ];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/***/ }),
|
|
74
|
+
|
|
75
|
+
/***/ 3644:
|
|
76
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
77
|
+
|
|
78
|
+
var concatMap = __webpack_require__(1048);
|
|
79
|
+
var balanced = __webpack_require__(5623);
|
|
80
|
+
|
|
81
|
+
module.exports = expandTop;
|
|
82
|
+
|
|
83
|
+
var escSlash = '\0SLASH'+Math.random()+'\0';
|
|
84
|
+
var escOpen = '\0OPEN'+Math.random()+'\0';
|
|
85
|
+
var escClose = '\0CLOSE'+Math.random()+'\0';
|
|
86
|
+
var escComma = '\0COMMA'+Math.random()+'\0';
|
|
87
|
+
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
|
88
|
+
|
|
89
|
+
function numeric(str) {
|
|
90
|
+
return parseInt(str, 10) == str
|
|
91
|
+
? parseInt(str, 10)
|
|
92
|
+
: str.charCodeAt(0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function escapeBraces(str) {
|
|
96
|
+
return str.split('\\\\').join(escSlash)
|
|
97
|
+
.split('\\{').join(escOpen)
|
|
98
|
+
.split('\\}').join(escClose)
|
|
99
|
+
.split('\\,').join(escComma)
|
|
100
|
+
.split('\\.').join(escPeriod);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function unescapeBraces(str) {
|
|
104
|
+
return str.split(escSlash).join('\\')
|
|
105
|
+
.split(escOpen).join('{')
|
|
106
|
+
.split(escClose).join('}')
|
|
107
|
+
.split(escComma).join(',')
|
|
108
|
+
.split(escPeriod).join('.');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
// Basically just str.split(","), but handling cases
|
|
113
|
+
// where we have nested braced sections, which should be
|
|
114
|
+
// treated as individual members, like {a,{b,c},d}
|
|
115
|
+
function parseCommaParts(str) {
|
|
116
|
+
if (!str)
|
|
117
|
+
return [''];
|
|
118
|
+
|
|
119
|
+
var parts = [];
|
|
120
|
+
var m = balanced('{', '}', str);
|
|
121
|
+
|
|
122
|
+
if (!m)
|
|
123
|
+
return str.split(',');
|
|
124
|
+
|
|
125
|
+
var pre = m.pre;
|
|
126
|
+
var body = m.body;
|
|
127
|
+
var post = m.post;
|
|
128
|
+
var p = pre.split(',');
|
|
129
|
+
|
|
130
|
+
p[p.length-1] += '{' + body + '}';
|
|
131
|
+
var postParts = parseCommaParts(post);
|
|
132
|
+
if (post.length) {
|
|
133
|
+
p[p.length-1] += postParts.shift();
|
|
134
|
+
p.push.apply(p, postParts);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
parts.push.apply(parts, p);
|
|
138
|
+
|
|
139
|
+
return parts;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function expandTop(str) {
|
|
143
|
+
if (!str)
|
|
144
|
+
return [];
|
|
145
|
+
|
|
146
|
+
// I don't know why Bash 4.3 does this, but it does.
|
|
147
|
+
// Anything starting with {} will have the first two bytes preserved
|
|
148
|
+
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
149
|
+
// but a{},b}c will be expanded to [a}c,abc].
|
|
150
|
+
// One could argue that this is a bug in Bash, but since the goal of
|
|
151
|
+
// this module is to match Bash's rules, we escape a leading {}
|
|
152
|
+
if (str.substr(0, 2) === '{}') {
|
|
153
|
+
str = '\\{\\}' + str.substr(2);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function identity(e) {
|
|
160
|
+
return e;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function embrace(str) {
|
|
164
|
+
return '{' + str + '}';
|
|
165
|
+
}
|
|
166
|
+
function isPadded(el) {
|
|
167
|
+
return /^-?0\d/.test(el);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function lte(i, y) {
|
|
171
|
+
return i <= y;
|
|
172
|
+
}
|
|
173
|
+
function gte(i, y) {
|
|
174
|
+
return i >= y;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function expand(str, isTop) {
|
|
178
|
+
var expansions = [];
|
|
179
|
+
|
|
180
|
+
var m = balanced('{', '}', str);
|
|
181
|
+
if (!m || /\$$/.test(m.pre)) return [str];
|
|
182
|
+
|
|
183
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
184
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
185
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
186
|
+
var isOptions = m.body.indexOf(',') >= 0;
|
|
187
|
+
if (!isSequence && !isOptions) {
|
|
188
|
+
// {a},b}
|
|
189
|
+
if (m.post.match(/,.*\}/)) {
|
|
190
|
+
str = m.pre + '{' + m.body + escClose + m.post;
|
|
191
|
+
return expand(str);
|
|
192
|
+
}
|
|
193
|
+
return [str];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
var n;
|
|
197
|
+
if (isSequence) {
|
|
198
|
+
n = m.body.split(/\.\./);
|
|
199
|
+
} else {
|
|
200
|
+
n = parseCommaParts(m.body);
|
|
201
|
+
if (n.length === 1) {
|
|
202
|
+
// x{{a,b}}y ==> x{a}y x{b}y
|
|
203
|
+
n = expand(n[0], false).map(embrace);
|
|
204
|
+
if (n.length === 1) {
|
|
205
|
+
var post = m.post.length
|
|
206
|
+
? expand(m.post, false)
|
|
207
|
+
: [''];
|
|
208
|
+
return post.map(function(p) {
|
|
209
|
+
return m.pre + n[0] + p;
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// at this point, n is the parts, and we know it's not a comma set
|
|
216
|
+
// with a single entry.
|
|
217
|
+
|
|
218
|
+
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
219
|
+
var pre = m.pre;
|
|
220
|
+
var post = m.post.length
|
|
221
|
+
? expand(m.post, false)
|
|
222
|
+
: [''];
|
|
223
|
+
|
|
224
|
+
var N;
|
|
225
|
+
|
|
226
|
+
if (isSequence) {
|
|
227
|
+
var x = numeric(n[0]);
|
|
228
|
+
var y = numeric(n[1]);
|
|
229
|
+
var width = Math.max(n[0].length, n[1].length)
|
|
230
|
+
var incr = n.length == 3
|
|
231
|
+
? Math.abs(numeric(n[2]))
|
|
232
|
+
: 1;
|
|
233
|
+
var test = lte;
|
|
234
|
+
var reverse = y < x;
|
|
235
|
+
if (reverse) {
|
|
236
|
+
incr *= -1;
|
|
237
|
+
test = gte;
|
|
238
|
+
}
|
|
239
|
+
var pad = n.some(isPadded);
|
|
240
|
+
|
|
241
|
+
N = [];
|
|
242
|
+
|
|
243
|
+
for (var i = x; test(i, y); i += incr) {
|
|
244
|
+
var c;
|
|
245
|
+
if (isAlphaSequence) {
|
|
246
|
+
c = String.fromCharCode(i);
|
|
247
|
+
if (c === '\\')
|
|
248
|
+
c = '';
|
|
249
|
+
} else {
|
|
250
|
+
c = String(i);
|
|
251
|
+
if (pad) {
|
|
252
|
+
var need = width - c.length;
|
|
253
|
+
if (need > 0) {
|
|
254
|
+
var z = new Array(need + 1).join('0');
|
|
255
|
+
if (i < 0)
|
|
256
|
+
c = '-' + z + c.slice(1);
|
|
257
|
+
else
|
|
258
|
+
c = z + c;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
N.push(c);
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
N = concatMap(n, function(el) { return expand(el, false) });
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
for (var j = 0; j < N.length; j++) {
|
|
269
|
+
for (var k = 0; k < post.length; k++) {
|
|
270
|
+
var expansion = pre + N[j] + post[k];
|
|
271
|
+
if (!isTop || isSequence || expansion)
|
|
272
|
+
expansions.push(expansion);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return expansions;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
/***/ }),
|
|
282
|
+
|
|
283
|
+
/***/ 1048:
|
|
284
|
+
/***/ ((module) => {
|
|
285
|
+
|
|
286
|
+
module.exports = function (xs, fn) {
|
|
287
|
+
var res = [];
|
|
288
|
+
for (var i = 0; i < xs.length; i++) {
|
|
289
|
+
var x = fn(xs[i], i);
|
|
290
|
+
if (isArray(x)) res.push.apply(res, x);
|
|
291
|
+
else res.push(x);
|
|
292
|
+
}
|
|
293
|
+
return res;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
var isArray = Array.isArray || function (xs) {
|
|
297
|
+
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
/***/ }),
|
|
302
|
+
|
|
303
|
+
/***/ 7187:
|
|
304
|
+
/***/ ((module) => {
|
|
305
|
+
|
|
306
|
+
"use strict";
|
|
307
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
308
|
+
//
|
|
309
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
310
|
+
// copy of this software and associated documentation files (the
|
|
311
|
+
// "Software"), to deal in the Software without restriction, including
|
|
312
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
313
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
314
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
315
|
+
// following conditions:
|
|
316
|
+
//
|
|
317
|
+
// The above copyright notice and this permission notice shall be included
|
|
318
|
+
// in all copies or substantial portions of the Software.
|
|
319
|
+
//
|
|
320
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
321
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
322
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
323
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
324
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
325
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
326
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
var R = typeof Reflect === 'object' ? Reflect : null
|
|
331
|
+
var ReflectApply = R && typeof R.apply === 'function'
|
|
332
|
+
? R.apply
|
|
333
|
+
: function ReflectApply(target, receiver, args) {
|
|
334
|
+
return Function.prototype.apply.call(target, receiver, args);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
var ReflectOwnKeys
|
|
338
|
+
if (R && typeof R.ownKeys === 'function') {
|
|
339
|
+
ReflectOwnKeys = R.ownKeys
|
|
340
|
+
} else if (Object.getOwnPropertySymbols) {
|
|
341
|
+
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
342
|
+
return Object.getOwnPropertyNames(target)
|
|
343
|
+
.concat(Object.getOwnPropertySymbols(target));
|
|
344
|
+
};
|
|
345
|
+
} else {
|
|
346
|
+
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
347
|
+
return Object.getOwnPropertyNames(target);
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function ProcessEmitWarning(warning) {
|
|
352
|
+
if (console && console.warn) console.warn(warning);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
|
|
356
|
+
return value !== value;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function EventEmitter() {
|
|
360
|
+
EventEmitter.init.call(this);
|
|
361
|
+
}
|
|
362
|
+
module.exports = EventEmitter;
|
|
363
|
+
module.exports.once = once;
|
|
364
|
+
|
|
365
|
+
// Backwards-compat with node 0.10.x
|
|
366
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
367
|
+
|
|
368
|
+
EventEmitter.prototype._events = undefined;
|
|
369
|
+
EventEmitter.prototype._eventsCount = 0;
|
|
370
|
+
EventEmitter.prototype._maxListeners = undefined;
|
|
371
|
+
|
|
372
|
+
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
373
|
+
// added to it. This is a useful default which helps finding memory leaks.
|
|
374
|
+
var defaultMaxListeners = 10;
|
|
375
|
+
|
|
376
|
+
function checkListener(listener) {
|
|
377
|
+
if (typeof listener !== 'function') {
|
|
378
|
+
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
|
383
|
+
enumerable: true,
|
|
384
|
+
get: function() {
|
|
385
|
+
return defaultMaxListeners;
|
|
386
|
+
},
|
|
387
|
+
set: function(arg) {
|
|
388
|
+
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
|
|
389
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
|
|
390
|
+
}
|
|
391
|
+
defaultMaxListeners = arg;
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
EventEmitter.init = function() {
|
|
396
|
+
|
|
397
|
+
if (this._events === undefined ||
|
|
398
|
+
this._events === Object.getPrototypeOf(this)._events) {
|
|
399
|
+
this._events = Object.create(null);
|
|
400
|
+
this._eventsCount = 0;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
this._maxListeners = this._maxListeners || undefined;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// Obviously not all Emitters should be limited to 10. This function allows
|
|
407
|
+
// that to be increased. Set to zero for unlimited.
|
|
408
|
+
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
409
|
+
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
|
|
410
|
+
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
|
|
411
|
+
}
|
|
412
|
+
this._maxListeners = n;
|
|
413
|
+
return this;
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
function _getMaxListeners(that) {
|
|
417
|
+
if (that._maxListeners === undefined)
|
|
418
|
+
return EventEmitter.defaultMaxListeners;
|
|
419
|
+
return that._maxListeners;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
423
|
+
return _getMaxListeners(this);
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
EventEmitter.prototype.emit = function emit(type) {
|
|
427
|
+
var args = [];
|
|
428
|
+
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
|
429
|
+
var doError = (type === 'error');
|
|
430
|
+
|
|
431
|
+
var events = this._events;
|
|
432
|
+
if (events !== undefined)
|
|
433
|
+
doError = (doError && events.error === undefined);
|
|
434
|
+
else if (!doError)
|
|
435
|
+
return false;
|
|
436
|
+
|
|
437
|
+
// If there is no 'error' event listener then throw.
|
|
438
|
+
if (doError) {
|
|
439
|
+
var er;
|
|
440
|
+
if (args.length > 0)
|
|
441
|
+
er = args[0];
|
|
442
|
+
if (er instanceof Error) {
|
|
443
|
+
// Note: The comments on the `throw` lines are intentional, they show
|
|
444
|
+
// up in Node's output if this results in an unhandled exception.
|
|
445
|
+
throw er; // Unhandled 'error' event
|
|
446
|
+
}
|
|
447
|
+
// At least give some kind of context to the user
|
|
448
|
+
var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
|
|
449
|
+
err.context = er;
|
|
450
|
+
throw err; // Unhandled 'error' event
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
var handler = events[type];
|
|
454
|
+
|
|
455
|
+
if (handler === undefined)
|
|
456
|
+
return false;
|
|
457
|
+
|
|
458
|
+
if (typeof handler === 'function') {
|
|
459
|
+
ReflectApply(handler, this, args);
|
|
460
|
+
} else {
|
|
461
|
+
var len = handler.length;
|
|
462
|
+
var listeners = arrayClone(handler, len);
|
|
463
|
+
for (var i = 0; i < len; ++i)
|
|
464
|
+
ReflectApply(listeners[i], this, args);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return true;
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
function _addListener(target, type, listener, prepend) {
|
|
471
|
+
var m;
|
|
472
|
+
var events;
|
|
473
|
+
var existing;
|
|
474
|
+
|
|
475
|
+
checkListener(listener);
|
|
476
|
+
|
|
477
|
+
events = target._events;
|
|
478
|
+
if (events === undefined) {
|
|
479
|
+
events = target._events = Object.create(null);
|
|
480
|
+
target._eventsCount = 0;
|
|
481
|
+
} else {
|
|
482
|
+
// To avoid recursion in the case that type === "newListener"! Before
|
|
483
|
+
// adding it to the listeners, first emit "newListener".
|
|
484
|
+
if (events.newListener !== undefined) {
|
|
485
|
+
target.emit('newListener', type,
|
|
486
|
+
listener.listener ? listener.listener : listener);
|
|
487
|
+
|
|
488
|
+
// Re-assign `events` because a newListener handler could have caused the
|
|
489
|
+
// this._events to be assigned to a new object
|
|
490
|
+
events = target._events;
|
|
491
|
+
}
|
|
492
|
+
existing = events[type];
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
if (existing === undefined) {
|
|
496
|
+
// Optimize the case of one listener. Don't need the extra array object.
|
|
497
|
+
existing = events[type] = listener;
|
|
498
|
+
++target._eventsCount;
|
|
499
|
+
} else {
|
|
500
|
+
if (typeof existing === 'function') {
|
|
501
|
+
// Adding the second element, need to change to array.
|
|
502
|
+
existing = events[type] =
|
|
503
|
+
prepend ? [listener, existing] : [existing, listener];
|
|
504
|
+
// If we've already got an array, just append.
|
|
505
|
+
} else if (prepend) {
|
|
506
|
+
existing.unshift(listener);
|
|
507
|
+
} else {
|
|
508
|
+
existing.push(listener);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Check for listener leak
|
|
512
|
+
m = _getMaxListeners(target);
|
|
513
|
+
if (m > 0 && existing.length > m && !existing.warned) {
|
|
514
|
+
existing.warned = true;
|
|
515
|
+
// No error code for this since it is a Warning
|
|
516
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
517
|
+
var w = new Error('Possible EventEmitter memory leak detected. ' +
|
|
518
|
+
existing.length + ' ' + String(type) + ' listeners ' +
|
|
519
|
+
'added. Use emitter.setMaxListeners() to ' +
|
|
520
|
+
'increase limit');
|
|
521
|
+
w.name = 'MaxListenersExceededWarning';
|
|
522
|
+
w.emitter = target;
|
|
523
|
+
w.type = type;
|
|
524
|
+
w.count = existing.length;
|
|
525
|
+
ProcessEmitWarning(w);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return target;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
533
|
+
return _addListener(this, type, listener, false);
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
537
|
+
|
|
538
|
+
EventEmitter.prototype.prependListener =
|
|
539
|
+
function prependListener(type, listener) {
|
|
540
|
+
return _addListener(this, type, listener, true);
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
function onceWrapper() {
|
|
544
|
+
if (!this.fired) {
|
|
545
|
+
this.target.removeListener(this.type, this.wrapFn);
|
|
546
|
+
this.fired = true;
|
|
547
|
+
if (arguments.length === 0)
|
|
548
|
+
return this.listener.call(this.target);
|
|
549
|
+
return this.listener.apply(this.target, arguments);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function _onceWrap(target, type, listener) {
|
|
554
|
+
var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
|
555
|
+
var wrapped = onceWrapper.bind(state);
|
|
556
|
+
wrapped.listener = listener;
|
|
557
|
+
state.wrapFn = wrapped;
|
|
558
|
+
return wrapped;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
EventEmitter.prototype.once = function once(type, listener) {
|
|
562
|
+
checkListener(listener);
|
|
563
|
+
this.on(type, _onceWrap(this, type, listener));
|
|
564
|
+
return this;
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
EventEmitter.prototype.prependOnceListener =
|
|
568
|
+
function prependOnceListener(type, listener) {
|
|
569
|
+
checkListener(listener);
|
|
570
|
+
this.prependListener(type, _onceWrap(this, type, listener));
|
|
571
|
+
return this;
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
// Emits a 'removeListener' event if and only if the listener was removed.
|
|
575
|
+
EventEmitter.prototype.removeListener =
|
|
576
|
+
function removeListener(type, listener) {
|
|
577
|
+
var list, events, position, i, originalListener;
|
|
578
|
+
|
|
579
|
+
checkListener(listener);
|
|
580
|
+
|
|
581
|
+
events = this._events;
|
|
582
|
+
if (events === undefined)
|
|
583
|
+
return this;
|
|
584
|
+
|
|
585
|
+
list = events[type];
|
|
586
|
+
if (list === undefined)
|
|
587
|
+
return this;
|
|
588
|
+
|
|
589
|
+
if (list === listener || list.listener === listener) {
|
|
590
|
+
if (--this._eventsCount === 0)
|
|
591
|
+
this._events = Object.create(null);
|
|
592
|
+
else {
|
|
593
|
+
delete events[type];
|
|
594
|
+
if (events.removeListener)
|
|
595
|
+
this.emit('removeListener', type, list.listener || listener);
|
|
596
|
+
}
|
|
597
|
+
} else if (typeof list !== 'function') {
|
|
598
|
+
position = -1;
|
|
599
|
+
|
|
600
|
+
for (i = list.length - 1; i >= 0; i--) {
|
|
601
|
+
if (list[i] === listener || list[i].listener === listener) {
|
|
602
|
+
originalListener = list[i].listener;
|
|
603
|
+
position = i;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (position < 0)
|
|
609
|
+
return this;
|
|
610
|
+
|
|
611
|
+
if (position === 0)
|
|
612
|
+
list.shift();
|
|
613
|
+
else {
|
|
614
|
+
spliceOne(list, position);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (list.length === 1)
|
|
618
|
+
events[type] = list[0];
|
|
619
|
+
|
|
620
|
+
if (events.removeListener !== undefined)
|
|
621
|
+
this.emit('removeListener', type, originalListener || listener);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
return this;
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
628
|
+
|
|
629
|
+
EventEmitter.prototype.removeAllListeners =
|
|
630
|
+
function removeAllListeners(type) {
|
|
631
|
+
var listeners, events, i;
|
|
632
|
+
|
|
633
|
+
events = this._events;
|
|
634
|
+
if (events === undefined)
|
|
635
|
+
return this;
|
|
636
|
+
|
|
637
|
+
// not listening for removeListener, no need to emit
|
|
638
|
+
if (events.removeListener === undefined) {
|
|
639
|
+
if (arguments.length === 0) {
|
|
640
|
+
this._events = Object.create(null);
|
|
641
|
+
this._eventsCount = 0;
|
|
642
|
+
} else if (events[type] !== undefined) {
|
|
643
|
+
if (--this._eventsCount === 0)
|
|
644
|
+
this._events = Object.create(null);
|
|
645
|
+
else
|
|
646
|
+
delete events[type];
|
|
647
|
+
}
|
|
648
|
+
return this;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// emit removeListener for all listeners on all events
|
|
652
|
+
if (arguments.length === 0) {
|
|
653
|
+
var keys = Object.keys(events);
|
|
654
|
+
var key;
|
|
655
|
+
for (i = 0; i < keys.length; ++i) {
|
|
656
|
+
key = keys[i];
|
|
657
|
+
if (key === 'removeListener') continue;
|
|
658
|
+
this.removeAllListeners(key);
|
|
659
|
+
}
|
|
660
|
+
this.removeAllListeners('removeListener');
|
|
661
|
+
this._events = Object.create(null);
|
|
662
|
+
this._eventsCount = 0;
|
|
663
|
+
return this;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
listeners = events[type];
|
|
667
|
+
|
|
668
|
+
if (typeof listeners === 'function') {
|
|
669
|
+
this.removeListener(type, listeners);
|
|
670
|
+
} else if (listeners !== undefined) {
|
|
671
|
+
// LIFO order
|
|
672
|
+
for (i = listeners.length - 1; i >= 0; i--) {
|
|
673
|
+
this.removeListener(type, listeners[i]);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
return this;
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
function _listeners(target, type, unwrap) {
|
|
681
|
+
var events = target._events;
|
|
682
|
+
|
|
683
|
+
if (events === undefined)
|
|
684
|
+
return [];
|
|
685
|
+
|
|
686
|
+
var evlistener = events[type];
|
|
687
|
+
if (evlistener === undefined)
|
|
688
|
+
return [];
|
|
689
|
+
|
|
690
|
+
if (typeof evlistener === 'function')
|
|
691
|
+
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
|
692
|
+
|
|
693
|
+
return unwrap ?
|
|
694
|
+
unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
EventEmitter.prototype.listeners = function listeners(type) {
|
|
698
|
+
return _listeners(this, type, true);
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
|
702
|
+
return _listeners(this, type, false);
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
EventEmitter.listenerCount = function(emitter, type) {
|
|
706
|
+
if (typeof emitter.listenerCount === 'function') {
|
|
707
|
+
return emitter.listenerCount(type);
|
|
708
|
+
} else {
|
|
709
|
+
return listenerCount.call(emitter, type);
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
EventEmitter.prototype.listenerCount = listenerCount;
|
|
714
|
+
function listenerCount(type) {
|
|
715
|
+
var events = this._events;
|
|
716
|
+
|
|
717
|
+
if (events !== undefined) {
|
|
718
|
+
var evlistener = events[type];
|
|
719
|
+
|
|
720
|
+
if (typeof evlistener === 'function') {
|
|
721
|
+
return 1;
|
|
722
|
+
} else if (evlistener !== undefined) {
|
|
723
|
+
return evlistener.length;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
return 0;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
731
|
+
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
function arrayClone(arr, n) {
|
|
735
|
+
var copy = new Array(n);
|
|
736
|
+
for (var i = 0; i < n; ++i)
|
|
737
|
+
copy[i] = arr[i];
|
|
738
|
+
return copy;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
function spliceOne(list, index) {
|
|
742
|
+
for (; index + 1 < list.length; index++)
|
|
743
|
+
list[index] = list[index + 1];
|
|
744
|
+
list.pop();
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function unwrapListeners(arr) {
|
|
748
|
+
var ret = new Array(arr.length);
|
|
749
|
+
for (var i = 0; i < ret.length; ++i) {
|
|
750
|
+
ret[i] = arr[i].listener || arr[i];
|
|
751
|
+
}
|
|
752
|
+
return ret;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
function once(emitter, name) {
|
|
756
|
+
return new Promise(function (resolve, reject) {
|
|
757
|
+
function errorListener(err) {
|
|
758
|
+
emitter.removeListener(name, resolver);
|
|
759
|
+
reject(err);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function resolver() {
|
|
763
|
+
if (typeof emitter.removeListener === 'function') {
|
|
764
|
+
emitter.removeListener('error', errorListener);
|
|
765
|
+
}
|
|
766
|
+
resolve([].slice.call(arguments));
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
|
|
770
|
+
if (name !== 'error') {
|
|
771
|
+
addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
|
|
777
|
+
if (typeof emitter.on === 'function') {
|
|
778
|
+
eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
783
|
+
if (typeof emitter.on === 'function') {
|
|
784
|
+
if (flags.once) {
|
|
785
|
+
emitter.once(name, listener);
|
|
786
|
+
} else {
|
|
787
|
+
emitter.on(name, listener);
|
|
788
|
+
}
|
|
789
|
+
} else if (typeof emitter.addEventListener === 'function') {
|
|
790
|
+
// EventTarget does not have `error` event semantics like Node
|
|
791
|
+
// EventEmitters, we do not listen for `error` events here.
|
|
792
|
+
emitter.addEventListener(name, function wrapListener(arg) {
|
|
793
|
+
// IE does not have builtin `{ once: true }` support so we
|
|
794
|
+
// have to do it manually.
|
|
795
|
+
if (flags.once) {
|
|
796
|
+
emitter.removeEventListener(name, wrapListener);
|
|
797
|
+
}
|
|
798
|
+
listener(arg);
|
|
799
|
+
});
|
|
800
|
+
} else {
|
|
801
|
+
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
/***/ }),
|
|
807
|
+
|
|
808
|
+
/***/ 7334:
|
|
809
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
810
|
+
|
|
811
|
+
module.exports = realpath
|
|
812
|
+
realpath.realpath = realpath
|
|
813
|
+
realpath.sync = realpathSync
|
|
814
|
+
realpath.realpathSync = realpathSync
|
|
815
|
+
realpath.monkeypatch = monkeypatch
|
|
816
|
+
realpath.unmonkeypatch = unmonkeypatch
|
|
817
|
+
|
|
818
|
+
var fs = __webpack_require__(6231)
|
|
819
|
+
var origRealpath = fs.realpath
|
|
820
|
+
var origRealpathSync = fs.realpathSync
|
|
821
|
+
|
|
822
|
+
var version = process.version
|
|
823
|
+
var ok = /^v[0-5]\./.test(version)
|
|
824
|
+
var old = __webpack_require__(7059)
|
|
825
|
+
|
|
826
|
+
function newError (er) {
|
|
827
|
+
return er && er.syscall === 'realpath' && (
|
|
828
|
+
er.code === 'ELOOP' ||
|
|
829
|
+
er.code === 'ENOMEM' ||
|
|
830
|
+
er.code === 'ENAMETOOLONG'
|
|
831
|
+
)
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
function realpath (p, cache, cb) {
|
|
835
|
+
if (ok) {
|
|
836
|
+
return origRealpath(p, cache, cb)
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
if (typeof cache === 'function') {
|
|
840
|
+
cb = cache
|
|
841
|
+
cache = null
|
|
842
|
+
}
|
|
843
|
+
origRealpath(p, cache, function (er, result) {
|
|
844
|
+
if (newError(er)) {
|
|
845
|
+
old.realpath(p, cache, cb)
|
|
846
|
+
} else {
|
|
847
|
+
cb(er, result)
|
|
848
|
+
}
|
|
849
|
+
})
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
function realpathSync (p, cache) {
|
|
853
|
+
if (ok) {
|
|
854
|
+
return origRealpathSync(p, cache)
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
try {
|
|
858
|
+
return origRealpathSync(p, cache)
|
|
859
|
+
} catch (er) {
|
|
860
|
+
if (newError(er)) {
|
|
861
|
+
return old.realpathSync(p, cache)
|
|
862
|
+
} else {
|
|
863
|
+
throw er
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
function monkeypatch () {
|
|
869
|
+
fs.realpath = realpath
|
|
870
|
+
fs.realpathSync = realpathSync
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
function unmonkeypatch () {
|
|
874
|
+
fs.realpath = origRealpath
|
|
875
|
+
fs.realpathSync = origRealpathSync
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
/***/ }),
|
|
880
|
+
|
|
881
|
+
/***/ 7059:
|
|
882
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
883
|
+
|
|
884
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
885
|
+
//
|
|
886
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
887
|
+
// copy of this software and associated documentation files (the
|
|
888
|
+
// "Software"), to deal in the Software without restriction, including
|
|
889
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
890
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
891
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
892
|
+
// following conditions:
|
|
893
|
+
//
|
|
894
|
+
// The above copyright notice and this permission notice shall be included
|
|
895
|
+
// in all copies or substantial portions of the Software.
|
|
896
|
+
//
|
|
897
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
898
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
899
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
900
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
901
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
902
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
903
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
904
|
+
|
|
905
|
+
var pathModule = __webpack_require__(1423);
|
|
906
|
+
var isWindows = process.platform === 'win32';
|
|
907
|
+
var fs = __webpack_require__(6231);
|
|
908
|
+
|
|
909
|
+
// JavaScript implementation of realpath, ported from node pre-v6
|
|
910
|
+
|
|
911
|
+
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
|
912
|
+
|
|
913
|
+
function rethrow() {
|
|
914
|
+
// Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
|
|
915
|
+
// is fairly slow to generate.
|
|
916
|
+
var callback;
|
|
917
|
+
if (DEBUG) {
|
|
918
|
+
var backtrace = new Error;
|
|
919
|
+
callback = debugCallback;
|
|
920
|
+
} else
|
|
921
|
+
callback = missingCallback;
|
|
922
|
+
|
|
923
|
+
return callback;
|
|
924
|
+
|
|
925
|
+
function debugCallback(err) {
|
|
926
|
+
if (err) {
|
|
927
|
+
backtrace.message = err.message;
|
|
928
|
+
err = backtrace;
|
|
929
|
+
missingCallback(err);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
function missingCallback(err) {
|
|
934
|
+
if (err) {
|
|
935
|
+
if (process.throwDeprecation)
|
|
936
|
+
throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
|
|
937
|
+
else if (!process.noDeprecation) {
|
|
938
|
+
var msg = 'fs: missing callback ' + (err.stack || err.message);
|
|
939
|
+
if (process.traceDeprecation)
|
|
940
|
+
console.trace(msg);
|
|
941
|
+
else
|
|
942
|
+
console.error(msg);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
function maybeCallback(cb) {
|
|
949
|
+
return typeof cb === 'function' ? cb : rethrow();
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
var normalize = pathModule.normalize;
|
|
953
|
+
|
|
954
|
+
// Regexp that finds the next partion of a (partial) path
|
|
955
|
+
// result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
|
|
956
|
+
if (isWindows) {
|
|
957
|
+
var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
|
|
958
|
+
} else {
|
|
959
|
+
var nextPartRe = /(.*?)(?:[\/]+|$)/g;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
// Regex to find the device root, including trailing slash. E.g. 'c:\\'.
|
|
963
|
+
if (isWindows) {
|
|
964
|
+
var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
|
|
965
|
+
} else {
|
|
966
|
+
var splitRootRe = /^[\/]*/;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
exports.realpathSync = function realpathSync(p, cache) {
|
|
970
|
+
// make p is absolute
|
|
971
|
+
p = pathModule.resolve(p);
|
|
972
|
+
|
|
973
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
|
974
|
+
return cache[p];
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
var original = p,
|
|
978
|
+
seenLinks = {},
|
|
979
|
+
knownHard = {};
|
|
980
|
+
|
|
981
|
+
// current character position in p
|
|
982
|
+
var pos;
|
|
983
|
+
// the partial path so far, including a trailing slash if any
|
|
984
|
+
var current;
|
|
985
|
+
// the partial path without a trailing slash (except when pointing at a root)
|
|
986
|
+
var base;
|
|
987
|
+
// the partial path scanned in the previous round, with slash
|
|
988
|
+
var previous;
|
|
989
|
+
|
|
990
|
+
start();
|
|
991
|
+
|
|
992
|
+
function start() {
|
|
993
|
+
// Skip over roots
|
|
994
|
+
var m = splitRootRe.exec(p);
|
|
995
|
+
pos = m[0].length;
|
|
996
|
+
current = m[0];
|
|
997
|
+
base = m[0];
|
|
998
|
+
previous = '';
|
|
999
|
+
|
|
1000
|
+
// On windows, check that the root exists. On unix there is no need.
|
|
1001
|
+
if (isWindows && !knownHard[base]) {
|
|
1002
|
+
fs.lstatSync(base);
|
|
1003
|
+
knownHard[base] = true;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// walk down the path, swapping out linked pathparts for their real
|
|
1008
|
+
// values
|
|
1009
|
+
// NB: p.length changes.
|
|
1010
|
+
while (pos < p.length) {
|
|
1011
|
+
// find the next part
|
|
1012
|
+
nextPartRe.lastIndex = pos;
|
|
1013
|
+
var result = nextPartRe.exec(p);
|
|
1014
|
+
previous = current;
|
|
1015
|
+
current += result[0];
|
|
1016
|
+
base = previous + result[1];
|
|
1017
|
+
pos = nextPartRe.lastIndex;
|
|
1018
|
+
|
|
1019
|
+
// continue if not a symlink
|
|
1020
|
+
if (knownHard[base] || (cache && cache[base] === base)) {
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
var resolvedLink;
|
|
1025
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
1026
|
+
// some known symbolic link. no need to stat again.
|
|
1027
|
+
resolvedLink = cache[base];
|
|
1028
|
+
} else {
|
|
1029
|
+
var stat = fs.lstatSync(base);
|
|
1030
|
+
if (!stat.isSymbolicLink()) {
|
|
1031
|
+
knownHard[base] = true;
|
|
1032
|
+
if (cache) cache[base] = base;
|
|
1033
|
+
continue;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
// read the link if it wasn't read before
|
|
1037
|
+
// dev/ino always return 0 on windows, so skip the check.
|
|
1038
|
+
var linkTarget = null;
|
|
1039
|
+
if (!isWindows) {
|
|
1040
|
+
var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
|
|
1041
|
+
if (seenLinks.hasOwnProperty(id)) {
|
|
1042
|
+
linkTarget = seenLinks[id];
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
if (linkTarget === null) {
|
|
1046
|
+
fs.statSync(base);
|
|
1047
|
+
linkTarget = fs.readlinkSync(base);
|
|
1048
|
+
}
|
|
1049
|
+
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
1050
|
+
// track this, if given a cache.
|
|
1051
|
+
if (cache) cache[base] = resolvedLink;
|
|
1052
|
+
if (!isWindows) seenLinks[id] = linkTarget;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// resolve the link, then start over
|
|
1056
|
+
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
1057
|
+
start();
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
if (cache) cache[original] = p;
|
|
1061
|
+
|
|
1062
|
+
return p;
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
exports.realpath = function realpath(p, cache, cb) {
|
|
1067
|
+
if (typeof cb !== 'function') {
|
|
1068
|
+
cb = maybeCallback(cache);
|
|
1069
|
+
cache = null;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// make p is absolute
|
|
1073
|
+
p = pathModule.resolve(p);
|
|
1074
|
+
|
|
1075
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
|
1076
|
+
return process.nextTick(cb.bind(null, null, cache[p]));
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
var original = p,
|
|
1080
|
+
seenLinks = {},
|
|
1081
|
+
knownHard = {};
|
|
1082
|
+
|
|
1083
|
+
// current character position in p
|
|
1084
|
+
var pos;
|
|
1085
|
+
// the partial path so far, including a trailing slash if any
|
|
1086
|
+
var current;
|
|
1087
|
+
// the partial path without a trailing slash (except when pointing at a root)
|
|
1088
|
+
var base;
|
|
1089
|
+
// the partial path scanned in the previous round, with slash
|
|
1090
|
+
var previous;
|
|
1091
|
+
|
|
1092
|
+
start();
|
|
1093
|
+
|
|
1094
|
+
function start() {
|
|
1095
|
+
// Skip over roots
|
|
1096
|
+
var m = splitRootRe.exec(p);
|
|
1097
|
+
pos = m[0].length;
|
|
1098
|
+
current = m[0];
|
|
1099
|
+
base = m[0];
|
|
1100
|
+
previous = '';
|
|
1101
|
+
|
|
1102
|
+
// On windows, check that the root exists. On unix there is no need.
|
|
1103
|
+
if (isWindows && !knownHard[base]) {
|
|
1104
|
+
fs.lstat(base, function(err) {
|
|
1105
|
+
if (err) return cb(err);
|
|
1106
|
+
knownHard[base] = true;
|
|
1107
|
+
LOOP();
|
|
1108
|
+
});
|
|
1109
|
+
} else {
|
|
1110
|
+
process.nextTick(LOOP);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
// walk down the path, swapping out linked pathparts for their real
|
|
1115
|
+
// values
|
|
1116
|
+
function LOOP() {
|
|
1117
|
+
// stop if scanned past end of path
|
|
1118
|
+
if (pos >= p.length) {
|
|
1119
|
+
if (cache) cache[original] = p;
|
|
1120
|
+
return cb(null, p);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
// find the next part
|
|
1124
|
+
nextPartRe.lastIndex = pos;
|
|
1125
|
+
var result = nextPartRe.exec(p);
|
|
1126
|
+
previous = current;
|
|
1127
|
+
current += result[0];
|
|
1128
|
+
base = previous + result[1];
|
|
1129
|
+
pos = nextPartRe.lastIndex;
|
|
1130
|
+
|
|
1131
|
+
// continue if not a symlink
|
|
1132
|
+
if (knownHard[base] || (cache && cache[base] === base)) {
|
|
1133
|
+
return process.nextTick(LOOP);
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
1137
|
+
// known symbolic link. no need to stat again.
|
|
1138
|
+
return gotResolvedLink(cache[base]);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
return fs.lstat(base, gotStat);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
function gotStat(err, stat) {
|
|
1145
|
+
if (err) return cb(err);
|
|
1146
|
+
|
|
1147
|
+
// if not a symlink, skip to the next path part
|
|
1148
|
+
if (!stat.isSymbolicLink()) {
|
|
1149
|
+
knownHard[base] = true;
|
|
1150
|
+
if (cache) cache[base] = base;
|
|
1151
|
+
return process.nextTick(LOOP);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
// stat & read the link if not read before
|
|
1155
|
+
// call gotTarget as soon as the link target is known
|
|
1156
|
+
// dev/ino always return 0 on windows, so skip the check.
|
|
1157
|
+
if (!isWindows) {
|
|
1158
|
+
var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
|
|
1159
|
+
if (seenLinks.hasOwnProperty(id)) {
|
|
1160
|
+
return gotTarget(null, seenLinks[id], base);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
fs.stat(base, function(err) {
|
|
1164
|
+
if (err) return cb(err);
|
|
1165
|
+
|
|
1166
|
+
fs.readlink(base, function(err, target) {
|
|
1167
|
+
if (!isWindows) seenLinks[id] = target;
|
|
1168
|
+
gotTarget(err, target);
|
|
1169
|
+
});
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
function gotTarget(err, target, base) {
|
|
1174
|
+
if (err) return cb(err);
|
|
1175
|
+
|
|
1176
|
+
var resolvedLink = pathModule.resolve(previous, target);
|
|
1177
|
+
if (cache) cache[base] = resolvedLink;
|
|
1178
|
+
gotResolvedLink(resolvedLink);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function gotResolvedLink(resolvedLink) {
|
|
1182
|
+
// resolve the link, then start over
|
|
1183
|
+
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
1184
|
+
start();
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
/***/ }),
|
|
1190
|
+
|
|
1191
|
+
/***/ 6772:
|
|
1192
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1193
|
+
|
|
1194
|
+
exports.setopts = setopts
|
|
1195
|
+
exports.ownProp = ownProp
|
|
1196
|
+
exports.makeAbs = makeAbs
|
|
1197
|
+
exports.finish = finish
|
|
1198
|
+
exports.mark = mark
|
|
1199
|
+
exports.isIgnored = isIgnored
|
|
1200
|
+
exports.childrenIgnored = childrenIgnored
|
|
1201
|
+
|
|
1202
|
+
function ownProp (obj, field) {
|
|
1203
|
+
return Object.prototype.hasOwnProperty.call(obj, field)
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
var fs = __webpack_require__(6231)
|
|
1207
|
+
var path = __webpack_require__(1423)
|
|
1208
|
+
var minimatch = __webpack_require__(1171)
|
|
1209
|
+
var isAbsolute = __webpack_require__(4095)
|
|
1210
|
+
var Minimatch = minimatch.Minimatch
|
|
1211
|
+
|
|
1212
|
+
function alphasort (a, b) {
|
|
1213
|
+
return a.localeCompare(b, 'en')
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
function setupIgnores (self, options) {
|
|
1217
|
+
self.ignore = options.ignore || []
|
|
1218
|
+
|
|
1219
|
+
if (!Array.isArray(self.ignore))
|
|
1220
|
+
self.ignore = [self.ignore]
|
|
1221
|
+
|
|
1222
|
+
if (self.ignore.length) {
|
|
1223
|
+
self.ignore = self.ignore.map(ignoreMap)
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
// ignore patterns are always in dot:true mode.
|
|
1228
|
+
function ignoreMap (pattern) {
|
|
1229
|
+
var gmatcher = null
|
|
1230
|
+
if (pattern.slice(-3) === '/**') {
|
|
1231
|
+
var gpattern = pattern.replace(/(\/\*\*)+$/, '')
|
|
1232
|
+
gmatcher = new Minimatch(gpattern, { dot: true })
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
return {
|
|
1236
|
+
matcher: new Minimatch(pattern, { dot: true }),
|
|
1237
|
+
gmatcher: gmatcher
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
function setopts (self, pattern, options) {
|
|
1242
|
+
if (!options)
|
|
1243
|
+
options = {}
|
|
1244
|
+
|
|
1245
|
+
// base-matching: just use globstar for that.
|
|
1246
|
+
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
|
1247
|
+
if (options.noglobstar) {
|
|
1248
|
+
throw new Error("base matching requires globstar")
|
|
1249
|
+
}
|
|
1250
|
+
pattern = "**/" + pattern
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
self.silent = !!options.silent
|
|
1254
|
+
self.pattern = pattern
|
|
1255
|
+
self.strict = options.strict !== false
|
|
1256
|
+
self.realpath = !!options.realpath
|
|
1257
|
+
self.realpathCache = options.realpathCache || Object.create(null)
|
|
1258
|
+
self.follow = !!options.follow
|
|
1259
|
+
self.dot = !!options.dot
|
|
1260
|
+
self.mark = !!options.mark
|
|
1261
|
+
self.nodir = !!options.nodir
|
|
1262
|
+
if (self.nodir)
|
|
1263
|
+
self.mark = true
|
|
1264
|
+
self.sync = !!options.sync
|
|
1265
|
+
self.nounique = !!options.nounique
|
|
1266
|
+
self.nonull = !!options.nonull
|
|
1267
|
+
self.nosort = !!options.nosort
|
|
1268
|
+
self.nocase = !!options.nocase
|
|
1269
|
+
self.stat = !!options.stat
|
|
1270
|
+
self.noprocess = !!options.noprocess
|
|
1271
|
+
self.absolute = !!options.absolute
|
|
1272
|
+
self.fs = options.fs || fs
|
|
1273
|
+
|
|
1274
|
+
self.maxLength = options.maxLength || Infinity
|
|
1275
|
+
self.cache = options.cache || Object.create(null)
|
|
1276
|
+
self.statCache = options.statCache || Object.create(null)
|
|
1277
|
+
self.symlinks = options.symlinks || Object.create(null)
|
|
1278
|
+
|
|
1279
|
+
setupIgnores(self, options)
|
|
1280
|
+
|
|
1281
|
+
self.changedCwd = false
|
|
1282
|
+
var cwd = process.cwd()
|
|
1283
|
+
if (!ownProp(options, "cwd"))
|
|
1284
|
+
self.cwd = cwd
|
|
1285
|
+
else {
|
|
1286
|
+
self.cwd = path.resolve(options.cwd)
|
|
1287
|
+
self.changedCwd = self.cwd !== cwd
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
self.root = options.root || path.resolve(self.cwd, "/")
|
|
1291
|
+
self.root = path.resolve(self.root)
|
|
1292
|
+
if (process.platform === "win32")
|
|
1293
|
+
self.root = self.root.replace(/\\/g, "/")
|
|
1294
|
+
|
|
1295
|
+
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
|
1296
|
+
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
|
1297
|
+
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
|
|
1298
|
+
if (process.platform === "win32")
|
|
1299
|
+
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
|
1300
|
+
self.nomount = !!options.nomount
|
|
1301
|
+
|
|
1302
|
+
// disable comments and negation in Minimatch.
|
|
1303
|
+
// Note that they are not supported in Glob itself anyway.
|
|
1304
|
+
options.nonegate = true
|
|
1305
|
+
options.nocomment = true
|
|
1306
|
+
|
|
1307
|
+
self.minimatch = new Minimatch(pattern, options)
|
|
1308
|
+
self.options = self.minimatch.options
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
function finish (self) {
|
|
1312
|
+
var nou = self.nounique
|
|
1313
|
+
var all = nou ? [] : Object.create(null)
|
|
1314
|
+
|
|
1315
|
+
for (var i = 0, l = self.matches.length; i < l; i ++) {
|
|
1316
|
+
var matches = self.matches[i]
|
|
1317
|
+
if (!matches || Object.keys(matches).length === 0) {
|
|
1318
|
+
if (self.nonull) {
|
|
1319
|
+
// do like the shell, and spit out the literal glob
|
|
1320
|
+
var literal = self.minimatch.globSet[i]
|
|
1321
|
+
if (nou)
|
|
1322
|
+
all.push(literal)
|
|
1323
|
+
else
|
|
1324
|
+
all[literal] = true
|
|
1325
|
+
}
|
|
1326
|
+
} else {
|
|
1327
|
+
// had matches
|
|
1328
|
+
var m = Object.keys(matches)
|
|
1329
|
+
if (nou)
|
|
1330
|
+
all.push.apply(all, m)
|
|
1331
|
+
else
|
|
1332
|
+
m.forEach(function (m) {
|
|
1333
|
+
all[m] = true
|
|
1334
|
+
})
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
if (!nou)
|
|
1339
|
+
all = Object.keys(all)
|
|
1340
|
+
|
|
1341
|
+
if (!self.nosort)
|
|
1342
|
+
all = all.sort(alphasort)
|
|
1343
|
+
|
|
1344
|
+
// at *some* point we statted all of these
|
|
1345
|
+
if (self.mark) {
|
|
1346
|
+
for (var i = 0; i < all.length; i++) {
|
|
1347
|
+
all[i] = self._mark(all[i])
|
|
1348
|
+
}
|
|
1349
|
+
if (self.nodir) {
|
|
1350
|
+
all = all.filter(function (e) {
|
|
1351
|
+
var notDir = !(/\/$/.test(e))
|
|
1352
|
+
var c = self.cache[e] || self.cache[makeAbs(self, e)]
|
|
1353
|
+
if (notDir && c)
|
|
1354
|
+
notDir = c !== 'DIR' && !Array.isArray(c)
|
|
1355
|
+
return notDir
|
|
1356
|
+
})
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
if (self.ignore.length)
|
|
1361
|
+
all = all.filter(function(m) {
|
|
1362
|
+
return !isIgnored(self, m)
|
|
1363
|
+
})
|
|
1364
|
+
|
|
1365
|
+
self.found = all
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
function mark (self, p) {
|
|
1369
|
+
var abs = makeAbs(self, p)
|
|
1370
|
+
var c = self.cache[abs]
|
|
1371
|
+
var m = p
|
|
1372
|
+
if (c) {
|
|
1373
|
+
var isDir = c === 'DIR' || Array.isArray(c)
|
|
1374
|
+
var slash = p.slice(-1) === '/'
|
|
1375
|
+
|
|
1376
|
+
if (isDir && !slash)
|
|
1377
|
+
m += '/'
|
|
1378
|
+
else if (!isDir && slash)
|
|
1379
|
+
m = m.slice(0, -1)
|
|
1380
|
+
|
|
1381
|
+
if (m !== p) {
|
|
1382
|
+
var mabs = makeAbs(self, m)
|
|
1383
|
+
self.statCache[mabs] = self.statCache[abs]
|
|
1384
|
+
self.cache[mabs] = self.cache[abs]
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
return m
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
// lotta situps...
|
|
1392
|
+
function makeAbs (self, f) {
|
|
1393
|
+
var abs = f
|
|
1394
|
+
if (f.charAt(0) === '/') {
|
|
1395
|
+
abs = path.join(self.root, f)
|
|
1396
|
+
} else if (isAbsolute(f) || f === '') {
|
|
1397
|
+
abs = f
|
|
1398
|
+
} else if (self.changedCwd) {
|
|
1399
|
+
abs = path.resolve(self.cwd, f)
|
|
1400
|
+
} else {
|
|
1401
|
+
abs = path.resolve(f)
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
if (process.platform === 'win32')
|
|
1405
|
+
abs = abs.replace(/\\/g, '/')
|
|
1406
|
+
|
|
1407
|
+
return abs
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
|
|
1412
|
+
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
|
|
1413
|
+
function isIgnored (self, path) {
|
|
1414
|
+
if (!self.ignore.length)
|
|
1415
|
+
return false
|
|
1416
|
+
|
|
1417
|
+
return self.ignore.some(function(item) {
|
|
1418
|
+
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
|
|
1419
|
+
})
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
function childrenIgnored (self, path) {
|
|
1423
|
+
if (!self.ignore.length)
|
|
1424
|
+
return false
|
|
1425
|
+
|
|
1426
|
+
return self.ignore.some(function(item) {
|
|
1427
|
+
return !!(item.gmatcher && item.gmatcher.match(path))
|
|
1428
|
+
})
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
/***/ }),
|
|
1433
|
+
|
|
1434
|
+
/***/ 2884:
|
|
1435
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1436
|
+
|
|
1437
|
+
// Approach:
|
|
1438
|
+
//
|
|
1439
|
+
// 1. Get the minimatch set
|
|
1440
|
+
// 2. For each pattern in the set, PROCESS(pattern, false)
|
|
1441
|
+
// 3. Store matches per-set, then uniq them
|
|
1442
|
+
//
|
|
1443
|
+
// PROCESS(pattern, inGlobStar)
|
|
1444
|
+
// Get the first [n] items from pattern that are all strings
|
|
1445
|
+
// Join these together. This is PREFIX.
|
|
1446
|
+
// If there is no more remaining, then stat(PREFIX) and
|
|
1447
|
+
// add to matches if it succeeds. END.
|
|
1448
|
+
//
|
|
1449
|
+
// If inGlobStar and PREFIX is symlink and points to dir
|
|
1450
|
+
// set ENTRIES = []
|
|
1451
|
+
// else readdir(PREFIX) as ENTRIES
|
|
1452
|
+
// If fail, END
|
|
1453
|
+
//
|
|
1454
|
+
// with ENTRIES
|
|
1455
|
+
// If pattern[n] is GLOBSTAR
|
|
1456
|
+
// // handle the case where the globstar match is empty
|
|
1457
|
+
// // by pruning it out, and testing the resulting pattern
|
|
1458
|
+
// PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
|
|
1459
|
+
// // handle other cases.
|
|
1460
|
+
// for ENTRY in ENTRIES (not dotfiles)
|
|
1461
|
+
// // attach globstar + tail onto the entry
|
|
1462
|
+
// // Mark that this entry is a globstar match
|
|
1463
|
+
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
|
|
1464
|
+
//
|
|
1465
|
+
// else // not globstar
|
|
1466
|
+
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
|
|
1467
|
+
// Test ENTRY against pattern[n]
|
|
1468
|
+
// If fails, continue
|
|
1469
|
+
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
|
|
1470
|
+
//
|
|
1471
|
+
// Caveat:
|
|
1472
|
+
// Cache all stats and readdirs results to minimize syscall. Since all
|
|
1473
|
+
// we ever care about is existence and directory-ness, we can just keep
|
|
1474
|
+
// `true` for files, and [children,...] for directories, or `false` for
|
|
1475
|
+
// things that don't exist.
|
|
1476
|
+
|
|
1477
|
+
module.exports = glob
|
|
1478
|
+
|
|
1479
|
+
var rp = __webpack_require__(7334)
|
|
1480
|
+
var minimatch = __webpack_require__(1171)
|
|
1481
|
+
var Minimatch = minimatch.Minimatch
|
|
1482
|
+
var inherits = __webpack_require__(5717)
|
|
1483
|
+
var EE = (__webpack_require__(7187).EventEmitter)
|
|
1484
|
+
var path = __webpack_require__(1423)
|
|
1485
|
+
var assert = __webpack_require__(9084)
|
|
1486
|
+
var isAbsolute = __webpack_require__(4095)
|
|
1487
|
+
var globSync = __webpack_require__(4751)
|
|
1488
|
+
var common = __webpack_require__(6772)
|
|
1489
|
+
var setopts = common.setopts
|
|
1490
|
+
var ownProp = common.ownProp
|
|
1491
|
+
var inflight = __webpack_require__(7844)
|
|
1492
|
+
var util = __webpack_require__(6464)
|
|
1493
|
+
var childrenIgnored = common.childrenIgnored
|
|
1494
|
+
var isIgnored = common.isIgnored
|
|
1495
|
+
|
|
1496
|
+
var once = __webpack_require__(778)
|
|
1497
|
+
|
|
1498
|
+
function glob (pattern, options, cb) {
|
|
1499
|
+
if (typeof options === 'function') cb = options, options = {}
|
|
1500
|
+
if (!options) options = {}
|
|
1501
|
+
|
|
1502
|
+
if (options.sync) {
|
|
1503
|
+
if (cb)
|
|
1504
|
+
throw new TypeError('callback provided to sync glob')
|
|
1505
|
+
return globSync(pattern, options)
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
return new Glob(pattern, options, cb)
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
glob.sync = globSync
|
|
1512
|
+
var GlobSync = glob.GlobSync = globSync.GlobSync
|
|
1513
|
+
|
|
1514
|
+
// old api surface
|
|
1515
|
+
glob.glob = glob
|
|
1516
|
+
|
|
1517
|
+
function extend (origin, add) {
|
|
1518
|
+
if (add === null || typeof add !== 'object') {
|
|
1519
|
+
return origin
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
var keys = Object.keys(add)
|
|
1523
|
+
var i = keys.length
|
|
1524
|
+
while (i--) {
|
|
1525
|
+
origin[keys[i]] = add[keys[i]]
|
|
1526
|
+
}
|
|
1527
|
+
return origin
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
glob.hasMagic = function (pattern, options_) {
|
|
1531
|
+
var options = extend({}, options_)
|
|
1532
|
+
options.noprocess = true
|
|
1533
|
+
|
|
1534
|
+
var g = new Glob(pattern, options)
|
|
1535
|
+
var set = g.minimatch.set
|
|
1536
|
+
|
|
1537
|
+
if (!pattern)
|
|
1538
|
+
return false
|
|
1539
|
+
|
|
1540
|
+
if (set.length > 1)
|
|
1541
|
+
return true
|
|
1542
|
+
|
|
1543
|
+
for (var j = 0; j < set[0].length; j++) {
|
|
1544
|
+
if (typeof set[0][j] !== 'string')
|
|
1545
|
+
return true
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
return false
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
glob.Glob = Glob
|
|
1552
|
+
inherits(Glob, EE)
|
|
1553
|
+
function Glob (pattern, options, cb) {
|
|
1554
|
+
if (typeof options === 'function') {
|
|
1555
|
+
cb = options
|
|
1556
|
+
options = null
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
if (options && options.sync) {
|
|
1560
|
+
if (cb)
|
|
1561
|
+
throw new TypeError('callback provided to sync glob')
|
|
1562
|
+
return new GlobSync(pattern, options)
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
if (!(this instanceof Glob))
|
|
1566
|
+
return new Glob(pattern, options, cb)
|
|
1567
|
+
|
|
1568
|
+
setopts(this, pattern, options)
|
|
1569
|
+
this._didRealPath = false
|
|
1570
|
+
|
|
1571
|
+
// process each pattern in the minimatch set
|
|
1572
|
+
var n = this.minimatch.set.length
|
|
1573
|
+
|
|
1574
|
+
// The matches are stored as {<filename>: true,...} so that
|
|
1575
|
+
// duplicates are automagically pruned.
|
|
1576
|
+
// Later, we do an Object.keys() on these.
|
|
1577
|
+
// Keep them as a list so we can fill in when nonull is set.
|
|
1578
|
+
this.matches = new Array(n)
|
|
1579
|
+
|
|
1580
|
+
if (typeof cb === 'function') {
|
|
1581
|
+
cb = once(cb)
|
|
1582
|
+
this.on('error', cb)
|
|
1583
|
+
this.on('end', function (matches) {
|
|
1584
|
+
cb(null, matches)
|
|
1585
|
+
})
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
var self = this
|
|
1589
|
+
this._processing = 0
|
|
1590
|
+
|
|
1591
|
+
this._emitQueue = []
|
|
1592
|
+
this._processQueue = []
|
|
1593
|
+
this.paused = false
|
|
1594
|
+
|
|
1595
|
+
if (this.noprocess)
|
|
1596
|
+
return this
|
|
1597
|
+
|
|
1598
|
+
if (n === 0)
|
|
1599
|
+
return done()
|
|
1600
|
+
|
|
1601
|
+
var sync = true
|
|
1602
|
+
for (var i = 0; i < n; i ++) {
|
|
1603
|
+
this._process(this.minimatch.set[i], i, false, done)
|
|
1604
|
+
}
|
|
1605
|
+
sync = false
|
|
1606
|
+
|
|
1607
|
+
function done () {
|
|
1608
|
+
--self._processing
|
|
1609
|
+
if (self._processing <= 0) {
|
|
1610
|
+
if (sync) {
|
|
1611
|
+
process.nextTick(function () {
|
|
1612
|
+
self._finish()
|
|
1613
|
+
})
|
|
1614
|
+
} else {
|
|
1615
|
+
self._finish()
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
Glob.prototype._finish = function () {
|
|
1622
|
+
assert(this instanceof Glob)
|
|
1623
|
+
if (this.aborted)
|
|
1624
|
+
return
|
|
1625
|
+
|
|
1626
|
+
if (this.realpath && !this._didRealpath)
|
|
1627
|
+
return this._realpath()
|
|
1628
|
+
|
|
1629
|
+
common.finish(this)
|
|
1630
|
+
this.emit('end', this.found)
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
Glob.prototype._realpath = function () {
|
|
1634
|
+
if (this._didRealpath)
|
|
1635
|
+
return
|
|
1636
|
+
|
|
1637
|
+
this._didRealpath = true
|
|
1638
|
+
|
|
1639
|
+
var n = this.matches.length
|
|
1640
|
+
if (n === 0)
|
|
1641
|
+
return this._finish()
|
|
1642
|
+
|
|
1643
|
+
var self = this
|
|
1644
|
+
for (var i = 0; i < this.matches.length; i++)
|
|
1645
|
+
this._realpathSet(i, next)
|
|
1646
|
+
|
|
1647
|
+
function next () {
|
|
1648
|
+
if (--n === 0)
|
|
1649
|
+
self._finish()
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
Glob.prototype._realpathSet = function (index, cb) {
|
|
1654
|
+
var matchset = this.matches[index]
|
|
1655
|
+
if (!matchset)
|
|
1656
|
+
return cb()
|
|
1657
|
+
|
|
1658
|
+
var found = Object.keys(matchset)
|
|
1659
|
+
var self = this
|
|
1660
|
+
var n = found.length
|
|
1661
|
+
|
|
1662
|
+
if (n === 0)
|
|
1663
|
+
return cb()
|
|
1664
|
+
|
|
1665
|
+
var set = this.matches[index] = Object.create(null)
|
|
1666
|
+
found.forEach(function (p, i) {
|
|
1667
|
+
// If there's a problem with the stat, then it means that
|
|
1668
|
+
// one or more of the links in the realpath couldn't be
|
|
1669
|
+
// resolved. just return the abs value in that case.
|
|
1670
|
+
p = self._makeAbs(p)
|
|
1671
|
+
rp.realpath(p, self.realpathCache, function (er, real) {
|
|
1672
|
+
if (!er)
|
|
1673
|
+
set[real] = true
|
|
1674
|
+
else if (er.syscall === 'stat')
|
|
1675
|
+
set[p] = true
|
|
1676
|
+
else
|
|
1677
|
+
self.emit('error', er) // srsly wtf right here
|
|
1678
|
+
|
|
1679
|
+
if (--n === 0) {
|
|
1680
|
+
self.matches[index] = set
|
|
1681
|
+
cb()
|
|
1682
|
+
}
|
|
1683
|
+
})
|
|
1684
|
+
})
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
Glob.prototype._mark = function (p) {
|
|
1688
|
+
return common.mark(this, p)
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
Glob.prototype._makeAbs = function (f) {
|
|
1692
|
+
return common.makeAbs(this, f)
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
Glob.prototype.abort = function () {
|
|
1696
|
+
this.aborted = true
|
|
1697
|
+
this.emit('abort')
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
Glob.prototype.pause = function () {
|
|
1701
|
+
if (!this.paused) {
|
|
1702
|
+
this.paused = true
|
|
1703
|
+
this.emit('pause')
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
Glob.prototype.resume = function () {
|
|
1708
|
+
if (this.paused) {
|
|
1709
|
+
this.emit('resume')
|
|
1710
|
+
this.paused = false
|
|
1711
|
+
if (this._emitQueue.length) {
|
|
1712
|
+
var eq = this._emitQueue.slice(0)
|
|
1713
|
+
this._emitQueue.length = 0
|
|
1714
|
+
for (var i = 0; i < eq.length; i ++) {
|
|
1715
|
+
var e = eq[i]
|
|
1716
|
+
this._emitMatch(e[0], e[1])
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
if (this._processQueue.length) {
|
|
1720
|
+
var pq = this._processQueue.slice(0)
|
|
1721
|
+
this._processQueue.length = 0
|
|
1722
|
+
for (var i = 0; i < pq.length; i ++) {
|
|
1723
|
+
var p = pq[i]
|
|
1724
|
+
this._processing--
|
|
1725
|
+
this._process(p[0], p[1], p[2], p[3])
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
|
1732
|
+
assert(this instanceof Glob)
|
|
1733
|
+
assert(typeof cb === 'function')
|
|
1734
|
+
|
|
1735
|
+
if (this.aborted)
|
|
1736
|
+
return
|
|
1737
|
+
|
|
1738
|
+
this._processing++
|
|
1739
|
+
if (this.paused) {
|
|
1740
|
+
this._processQueue.push([pattern, index, inGlobStar, cb])
|
|
1741
|
+
return
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
//console.error('PROCESS %d', this._processing, pattern)
|
|
1745
|
+
|
|
1746
|
+
// Get the first [n] parts of pattern that are all strings.
|
|
1747
|
+
var n = 0
|
|
1748
|
+
while (typeof pattern[n] === 'string') {
|
|
1749
|
+
n ++
|
|
1750
|
+
}
|
|
1751
|
+
// now n is the index of the first one that is *not* a string.
|
|
1752
|
+
|
|
1753
|
+
// see if there's anything else
|
|
1754
|
+
var prefix
|
|
1755
|
+
switch (n) {
|
|
1756
|
+
// if not, then this is rather simple
|
|
1757
|
+
case pattern.length:
|
|
1758
|
+
this._processSimple(pattern.join('/'), index, cb)
|
|
1759
|
+
return
|
|
1760
|
+
|
|
1761
|
+
case 0:
|
|
1762
|
+
// pattern *starts* with some non-trivial item.
|
|
1763
|
+
// going to readdir(cwd), but not include the prefix in matches.
|
|
1764
|
+
prefix = null
|
|
1765
|
+
break
|
|
1766
|
+
|
|
1767
|
+
default:
|
|
1768
|
+
// pattern has some string bits in the front.
|
|
1769
|
+
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
|
1770
|
+
// or 'relative' like '../baz'
|
|
1771
|
+
prefix = pattern.slice(0, n).join('/')
|
|
1772
|
+
break
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
var remain = pattern.slice(n)
|
|
1776
|
+
|
|
1777
|
+
// get the list of entries.
|
|
1778
|
+
var read
|
|
1779
|
+
if (prefix === null)
|
|
1780
|
+
read = '.'
|
|
1781
|
+
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
|
1782
|
+
if (!prefix || !isAbsolute(prefix))
|
|
1783
|
+
prefix = '/' + prefix
|
|
1784
|
+
read = prefix
|
|
1785
|
+
} else
|
|
1786
|
+
read = prefix
|
|
1787
|
+
|
|
1788
|
+
var abs = this._makeAbs(read)
|
|
1789
|
+
|
|
1790
|
+
//if ignored, skip _processing
|
|
1791
|
+
if (childrenIgnored(this, read))
|
|
1792
|
+
return cb()
|
|
1793
|
+
|
|
1794
|
+
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
|
1795
|
+
if (isGlobStar)
|
|
1796
|
+
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
|
|
1797
|
+
else
|
|
1798
|
+
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
1802
|
+
var self = this
|
|
1803
|
+
this._readdir(abs, inGlobStar, function (er, entries) {
|
|
1804
|
+
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
|
1805
|
+
})
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
1809
|
+
|
|
1810
|
+
// if the abs isn't a dir, then nothing can match!
|
|
1811
|
+
if (!entries)
|
|
1812
|
+
return cb()
|
|
1813
|
+
|
|
1814
|
+
// It will only match dot entries if it starts with a dot, or if
|
|
1815
|
+
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
|
1816
|
+
var pn = remain[0]
|
|
1817
|
+
var negate = !!this.minimatch.negate
|
|
1818
|
+
var rawGlob = pn._glob
|
|
1819
|
+
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
|
1820
|
+
|
|
1821
|
+
var matchedEntries = []
|
|
1822
|
+
for (var i = 0; i < entries.length; i++) {
|
|
1823
|
+
var e = entries[i]
|
|
1824
|
+
if (e.charAt(0) !== '.' || dotOk) {
|
|
1825
|
+
var m
|
|
1826
|
+
if (negate && !prefix) {
|
|
1827
|
+
m = !e.match(pn)
|
|
1828
|
+
} else {
|
|
1829
|
+
m = e.match(pn)
|
|
1830
|
+
}
|
|
1831
|
+
if (m)
|
|
1832
|
+
matchedEntries.push(e)
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
//console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
|
|
1837
|
+
|
|
1838
|
+
var len = matchedEntries.length
|
|
1839
|
+
// If there are no matched entries, then nothing matches.
|
|
1840
|
+
if (len === 0)
|
|
1841
|
+
return cb()
|
|
1842
|
+
|
|
1843
|
+
// if this is the last remaining pattern bit, then no need for
|
|
1844
|
+
// an additional stat *unless* the user has specified mark or
|
|
1845
|
+
// stat explicitly. We know they exist, since readdir returned
|
|
1846
|
+
// them.
|
|
1847
|
+
|
|
1848
|
+
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
1849
|
+
if (!this.matches[index])
|
|
1850
|
+
this.matches[index] = Object.create(null)
|
|
1851
|
+
|
|
1852
|
+
for (var i = 0; i < len; i ++) {
|
|
1853
|
+
var e = matchedEntries[i]
|
|
1854
|
+
if (prefix) {
|
|
1855
|
+
if (prefix !== '/')
|
|
1856
|
+
e = prefix + '/' + e
|
|
1857
|
+
else
|
|
1858
|
+
e = prefix + e
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
if (e.charAt(0) === '/' && !this.nomount) {
|
|
1862
|
+
e = path.join(this.root, e)
|
|
1863
|
+
}
|
|
1864
|
+
this._emitMatch(index, e)
|
|
1865
|
+
}
|
|
1866
|
+
// This was the last one, and no stats were needed
|
|
1867
|
+
return cb()
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
// now test all matched entries as stand-ins for that part
|
|
1871
|
+
// of the pattern.
|
|
1872
|
+
remain.shift()
|
|
1873
|
+
for (var i = 0; i < len; i ++) {
|
|
1874
|
+
var e = matchedEntries[i]
|
|
1875
|
+
var newPattern
|
|
1876
|
+
if (prefix) {
|
|
1877
|
+
if (prefix !== '/')
|
|
1878
|
+
e = prefix + '/' + e
|
|
1879
|
+
else
|
|
1880
|
+
e = prefix + e
|
|
1881
|
+
}
|
|
1882
|
+
this._process([e].concat(remain), index, inGlobStar, cb)
|
|
1883
|
+
}
|
|
1884
|
+
cb()
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
Glob.prototype._emitMatch = function (index, e) {
|
|
1888
|
+
if (this.aborted)
|
|
1889
|
+
return
|
|
1890
|
+
|
|
1891
|
+
if (isIgnored(this, e))
|
|
1892
|
+
return
|
|
1893
|
+
|
|
1894
|
+
if (this.paused) {
|
|
1895
|
+
this._emitQueue.push([index, e])
|
|
1896
|
+
return
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
var abs = isAbsolute(e) ? e : this._makeAbs(e)
|
|
1900
|
+
|
|
1901
|
+
if (this.mark)
|
|
1902
|
+
e = this._mark(e)
|
|
1903
|
+
|
|
1904
|
+
if (this.absolute)
|
|
1905
|
+
e = abs
|
|
1906
|
+
|
|
1907
|
+
if (this.matches[index][e])
|
|
1908
|
+
return
|
|
1909
|
+
|
|
1910
|
+
if (this.nodir) {
|
|
1911
|
+
var c = this.cache[abs]
|
|
1912
|
+
if (c === 'DIR' || Array.isArray(c))
|
|
1913
|
+
return
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
this.matches[index][e] = true
|
|
1917
|
+
|
|
1918
|
+
var st = this.statCache[abs]
|
|
1919
|
+
if (st)
|
|
1920
|
+
this.emit('stat', e, st)
|
|
1921
|
+
|
|
1922
|
+
this.emit('match', e)
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
|
1926
|
+
if (this.aborted)
|
|
1927
|
+
return
|
|
1928
|
+
|
|
1929
|
+
// follow all symlinked directories forever
|
|
1930
|
+
// just proceed as if this is a non-globstar situation
|
|
1931
|
+
if (this.follow)
|
|
1932
|
+
return this._readdir(abs, false, cb)
|
|
1933
|
+
|
|
1934
|
+
var lstatkey = 'lstat\0' + abs
|
|
1935
|
+
var self = this
|
|
1936
|
+
var lstatcb = inflight(lstatkey, lstatcb_)
|
|
1937
|
+
|
|
1938
|
+
if (lstatcb)
|
|
1939
|
+
self.fs.lstat(abs, lstatcb)
|
|
1940
|
+
|
|
1941
|
+
function lstatcb_ (er, lstat) {
|
|
1942
|
+
if (er && er.code === 'ENOENT')
|
|
1943
|
+
return cb()
|
|
1944
|
+
|
|
1945
|
+
var isSym = lstat && lstat.isSymbolicLink()
|
|
1946
|
+
self.symlinks[abs] = isSym
|
|
1947
|
+
|
|
1948
|
+
// If it's not a symlink or a dir, then it's definitely a regular file.
|
|
1949
|
+
// don't bother doing a readdir in that case.
|
|
1950
|
+
if (!isSym && lstat && !lstat.isDirectory()) {
|
|
1951
|
+
self.cache[abs] = 'FILE'
|
|
1952
|
+
cb()
|
|
1953
|
+
} else
|
|
1954
|
+
self._readdir(abs, false, cb)
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
|
1959
|
+
if (this.aborted)
|
|
1960
|
+
return
|
|
1961
|
+
|
|
1962
|
+
cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
|
|
1963
|
+
if (!cb)
|
|
1964
|
+
return
|
|
1965
|
+
|
|
1966
|
+
//console.error('RD %j %j', +inGlobStar, abs)
|
|
1967
|
+
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
1968
|
+
return this._readdirInGlobStar(abs, cb)
|
|
1969
|
+
|
|
1970
|
+
if (ownProp(this.cache, abs)) {
|
|
1971
|
+
var c = this.cache[abs]
|
|
1972
|
+
if (!c || c === 'FILE')
|
|
1973
|
+
return cb()
|
|
1974
|
+
|
|
1975
|
+
if (Array.isArray(c))
|
|
1976
|
+
return cb(null, c)
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
var self = this
|
|
1980
|
+
self.fs.readdir(abs, readdirCb(this, abs, cb))
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
function readdirCb (self, abs, cb) {
|
|
1984
|
+
return function (er, entries) {
|
|
1985
|
+
if (er)
|
|
1986
|
+
self._readdirError(abs, er, cb)
|
|
1987
|
+
else
|
|
1988
|
+
self._readdirEntries(abs, entries, cb)
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
Glob.prototype._readdirEntries = function (abs, entries, cb) {
|
|
1993
|
+
if (this.aborted)
|
|
1994
|
+
return
|
|
1995
|
+
|
|
1996
|
+
// if we haven't asked to stat everything, then just
|
|
1997
|
+
// assume that everything in there exists, so we can avoid
|
|
1998
|
+
// having to stat it a second time.
|
|
1999
|
+
if (!this.mark && !this.stat) {
|
|
2000
|
+
for (var i = 0; i < entries.length; i ++) {
|
|
2001
|
+
var e = entries[i]
|
|
2002
|
+
if (abs === '/')
|
|
2003
|
+
e = abs + e
|
|
2004
|
+
else
|
|
2005
|
+
e = abs + '/' + e
|
|
2006
|
+
this.cache[e] = true
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
this.cache[abs] = entries
|
|
2011
|
+
return cb(null, entries)
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
Glob.prototype._readdirError = function (f, er, cb) {
|
|
2015
|
+
if (this.aborted)
|
|
2016
|
+
return
|
|
2017
|
+
|
|
2018
|
+
// handle errors, and cache the information
|
|
2019
|
+
switch (er.code) {
|
|
2020
|
+
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
|
2021
|
+
case 'ENOTDIR': // totally normal. means it *does* exist.
|
|
2022
|
+
var abs = this._makeAbs(f)
|
|
2023
|
+
this.cache[abs] = 'FILE'
|
|
2024
|
+
if (abs === this.cwdAbs) {
|
|
2025
|
+
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
|
2026
|
+
error.path = this.cwd
|
|
2027
|
+
error.code = er.code
|
|
2028
|
+
this.emit('error', error)
|
|
2029
|
+
this.abort()
|
|
2030
|
+
}
|
|
2031
|
+
break
|
|
2032
|
+
|
|
2033
|
+
case 'ENOENT': // not terribly unusual
|
|
2034
|
+
case 'ELOOP':
|
|
2035
|
+
case 'ENAMETOOLONG':
|
|
2036
|
+
case 'UNKNOWN':
|
|
2037
|
+
this.cache[this._makeAbs(f)] = false
|
|
2038
|
+
break
|
|
2039
|
+
|
|
2040
|
+
default: // some unusual error. Treat as failure.
|
|
2041
|
+
this.cache[this._makeAbs(f)] = false
|
|
2042
|
+
if (this.strict) {
|
|
2043
|
+
this.emit('error', er)
|
|
2044
|
+
// If the error is handled, then we abort
|
|
2045
|
+
// if not, we threw out of here
|
|
2046
|
+
this.abort()
|
|
2047
|
+
}
|
|
2048
|
+
if (!this.silent)
|
|
2049
|
+
console.error('glob error', er)
|
|
2050
|
+
break
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
return cb()
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
2057
|
+
var self = this
|
|
2058
|
+
this._readdir(abs, inGlobStar, function (er, entries) {
|
|
2059
|
+
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
|
2060
|
+
})
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
|
|
2064
|
+
Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
2065
|
+
//console.error('pgs2', prefix, remain[0], entries)
|
|
2066
|
+
|
|
2067
|
+
// no entries means not a dir, so it can never have matches
|
|
2068
|
+
// foo.txt/** doesn't match foo.txt
|
|
2069
|
+
if (!entries)
|
|
2070
|
+
return cb()
|
|
2071
|
+
|
|
2072
|
+
// test without the globstar, and with every child both below
|
|
2073
|
+
// and replacing the globstar.
|
|
2074
|
+
var remainWithoutGlobStar = remain.slice(1)
|
|
2075
|
+
var gspref = prefix ? [ prefix ] : []
|
|
2076
|
+
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
|
2077
|
+
|
|
2078
|
+
// the noGlobStar pattern exits the inGlobStar state
|
|
2079
|
+
this._process(noGlobStar, index, false, cb)
|
|
2080
|
+
|
|
2081
|
+
var isSym = this.symlinks[abs]
|
|
2082
|
+
var len = entries.length
|
|
2083
|
+
|
|
2084
|
+
// If it's a symlink, and we're in a globstar, then stop
|
|
2085
|
+
if (isSym && inGlobStar)
|
|
2086
|
+
return cb()
|
|
2087
|
+
|
|
2088
|
+
for (var i = 0; i < len; i++) {
|
|
2089
|
+
var e = entries[i]
|
|
2090
|
+
if (e.charAt(0) === '.' && !this.dot)
|
|
2091
|
+
continue
|
|
2092
|
+
|
|
2093
|
+
// these two cases enter the inGlobStar state
|
|
2094
|
+
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
|
2095
|
+
this._process(instead, index, true, cb)
|
|
2096
|
+
|
|
2097
|
+
var below = gspref.concat(entries[i], remain)
|
|
2098
|
+
this._process(below, index, true, cb)
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
cb()
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
Glob.prototype._processSimple = function (prefix, index, cb) {
|
|
2105
|
+
// XXX review this. Shouldn't it be doing the mounting etc
|
|
2106
|
+
// before doing stat? kinda weird?
|
|
2107
|
+
var self = this
|
|
2108
|
+
this._stat(prefix, function (er, exists) {
|
|
2109
|
+
self._processSimple2(prefix, index, er, exists, cb)
|
|
2110
|
+
})
|
|
2111
|
+
}
|
|
2112
|
+
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
|
2113
|
+
|
|
2114
|
+
//console.error('ps2', prefix, exists)
|
|
2115
|
+
|
|
2116
|
+
if (!this.matches[index])
|
|
2117
|
+
this.matches[index] = Object.create(null)
|
|
2118
|
+
|
|
2119
|
+
// If it doesn't exist, then just mark the lack of results
|
|
2120
|
+
if (!exists)
|
|
2121
|
+
return cb()
|
|
2122
|
+
|
|
2123
|
+
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
2124
|
+
var trail = /[\/\\]$/.test(prefix)
|
|
2125
|
+
if (prefix.charAt(0) === '/') {
|
|
2126
|
+
prefix = path.join(this.root, prefix)
|
|
2127
|
+
} else {
|
|
2128
|
+
prefix = path.resolve(this.root, prefix)
|
|
2129
|
+
if (trail)
|
|
2130
|
+
prefix += '/'
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
if (process.platform === 'win32')
|
|
2135
|
+
prefix = prefix.replace(/\\/g, '/')
|
|
2136
|
+
|
|
2137
|
+
// Mark this as a match
|
|
2138
|
+
this._emitMatch(index, prefix)
|
|
2139
|
+
cb()
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
// Returns either 'DIR', 'FILE', or false
|
|
2143
|
+
Glob.prototype._stat = function (f, cb) {
|
|
2144
|
+
var abs = this._makeAbs(f)
|
|
2145
|
+
var needDir = f.slice(-1) === '/'
|
|
2146
|
+
|
|
2147
|
+
if (f.length > this.maxLength)
|
|
2148
|
+
return cb()
|
|
2149
|
+
|
|
2150
|
+
if (!this.stat && ownProp(this.cache, abs)) {
|
|
2151
|
+
var c = this.cache[abs]
|
|
2152
|
+
|
|
2153
|
+
if (Array.isArray(c))
|
|
2154
|
+
c = 'DIR'
|
|
2155
|
+
|
|
2156
|
+
// It exists, but maybe not how we need it
|
|
2157
|
+
if (!needDir || c === 'DIR')
|
|
2158
|
+
return cb(null, c)
|
|
2159
|
+
|
|
2160
|
+
if (needDir && c === 'FILE')
|
|
2161
|
+
return cb()
|
|
2162
|
+
|
|
2163
|
+
// otherwise we have to stat, because maybe c=true
|
|
2164
|
+
// if we know it exists, but not what it is.
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
var exists
|
|
2168
|
+
var stat = this.statCache[abs]
|
|
2169
|
+
if (stat !== undefined) {
|
|
2170
|
+
if (stat === false)
|
|
2171
|
+
return cb(null, stat)
|
|
2172
|
+
else {
|
|
2173
|
+
var type = stat.isDirectory() ? 'DIR' : 'FILE'
|
|
2174
|
+
if (needDir && type === 'FILE')
|
|
2175
|
+
return cb()
|
|
2176
|
+
else
|
|
2177
|
+
return cb(null, type, stat)
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
var self = this
|
|
2182
|
+
var statcb = inflight('stat\0' + abs, lstatcb_)
|
|
2183
|
+
if (statcb)
|
|
2184
|
+
self.fs.lstat(abs, statcb)
|
|
2185
|
+
|
|
2186
|
+
function lstatcb_ (er, lstat) {
|
|
2187
|
+
if (lstat && lstat.isSymbolicLink()) {
|
|
2188
|
+
// If it's a symlink, then treat it as the target, unless
|
|
2189
|
+
// the target does not exist, then treat it as a file.
|
|
2190
|
+
return self.fs.stat(abs, function (er, stat) {
|
|
2191
|
+
if (er)
|
|
2192
|
+
self._stat2(f, abs, null, lstat, cb)
|
|
2193
|
+
else
|
|
2194
|
+
self._stat2(f, abs, er, stat, cb)
|
|
2195
|
+
})
|
|
2196
|
+
} else {
|
|
2197
|
+
self._stat2(f, abs, er, lstat, cb)
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
|
2203
|
+
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
|
2204
|
+
this.statCache[abs] = false
|
|
2205
|
+
return cb()
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
var needDir = f.slice(-1) === '/'
|
|
2209
|
+
this.statCache[abs] = stat
|
|
2210
|
+
|
|
2211
|
+
if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
|
|
2212
|
+
return cb(null, false, stat)
|
|
2213
|
+
|
|
2214
|
+
var c = true
|
|
2215
|
+
if (stat)
|
|
2216
|
+
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
|
2217
|
+
this.cache[abs] = this.cache[abs] || c
|
|
2218
|
+
|
|
2219
|
+
if (needDir && c === 'FILE')
|
|
2220
|
+
return cb()
|
|
2221
|
+
|
|
2222
|
+
return cb(null, c, stat)
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
/***/ }),
|
|
2227
|
+
|
|
2228
|
+
/***/ 4751:
|
|
2229
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2230
|
+
|
|
2231
|
+
module.exports = globSync
|
|
2232
|
+
globSync.GlobSync = GlobSync
|
|
2233
|
+
|
|
2234
|
+
var rp = __webpack_require__(7334)
|
|
2235
|
+
var minimatch = __webpack_require__(1171)
|
|
2236
|
+
var Minimatch = minimatch.Minimatch
|
|
2237
|
+
var Glob = (__webpack_require__(2884).Glob)
|
|
2238
|
+
var util = __webpack_require__(6464)
|
|
2239
|
+
var path = __webpack_require__(1423)
|
|
2240
|
+
var assert = __webpack_require__(9084)
|
|
2241
|
+
var isAbsolute = __webpack_require__(4095)
|
|
2242
|
+
var common = __webpack_require__(6772)
|
|
2243
|
+
var setopts = common.setopts
|
|
2244
|
+
var ownProp = common.ownProp
|
|
2245
|
+
var childrenIgnored = common.childrenIgnored
|
|
2246
|
+
var isIgnored = common.isIgnored
|
|
2247
|
+
|
|
2248
|
+
function globSync (pattern, options) {
|
|
2249
|
+
if (typeof options === 'function' || arguments.length === 3)
|
|
2250
|
+
throw new TypeError('callback provided to sync glob\n'+
|
|
2251
|
+
'See: https://github.com/isaacs/node-glob/issues/167')
|
|
2252
|
+
|
|
2253
|
+
return new GlobSync(pattern, options).found
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
function GlobSync (pattern, options) {
|
|
2257
|
+
if (!pattern)
|
|
2258
|
+
throw new Error('must provide pattern')
|
|
2259
|
+
|
|
2260
|
+
if (typeof options === 'function' || arguments.length === 3)
|
|
2261
|
+
throw new TypeError('callback provided to sync glob\n'+
|
|
2262
|
+
'See: https://github.com/isaacs/node-glob/issues/167')
|
|
2263
|
+
|
|
2264
|
+
if (!(this instanceof GlobSync))
|
|
2265
|
+
return new GlobSync(pattern, options)
|
|
2266
|
+
|
|
2267
|
+
setopts(this, pattern, options)
|
|
2268
|
+
|
|
2269
|
+
if (this.noprocess)
|
|
2270
|
+
return this
|
|
2271
|
+
|
|
2272
|
+
var n = this.minimatch.set.length
|
|
2273
|
+
this.matches = new Array(n)
|
|
2274
|
+
for (var i = 0; i < n; i ++) {
|
|
2275
|
+
this._process(this.minimatch.set[i], i, false)
|
|
2276
|
+
}
|
|
2277
|
+
this._finish()
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
GlobSync.prototype._finish = function () {
|
|
2281
|
+
assert(this instanceof GlobSync)
|
|
2282
|
+
if (this.realpath) {
|
|
2283
|
+
var self = this
|
|
2284
|
+
this.matches.forEach(function (matchset, index) {
|
|
2285
|
+
var set = self.matches[index] = Object.create(null)
|
|
2286
|
+
for (var p in matchset) {
|
|
2287
|
+
try {
|
|
2288
|
+
p = self._makeAbs(p)
|
|
2289
|
+
var real = rp.realpathSync(p, self.realpathCache)
|
|
2290
|
+
set[real] = true
|
|
2291
|
+
} catch (er) {
|
|
2292
|
+
if (er.syscall === 'stat')
|
|
2293
|
+
set[self._makeAbs(p)] = true
|
|
2294
|
+
else
|
|
2295
|
+
throw er
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
})
|
|
2299
|
+
}
|
|
2300
|
+
common.finish(this)
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
|
|
2304
|
+
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
|
2305
|
+
assert(this instanceof GlobSync)
|
|
2306
|
+
|
|
2307
|
+
// Get the first [n] parts of pattern that are all strings.
|
|
2308
|
+
var n = 0
|
|
2309
|
+
while (typeof pattern[n] === 'string') {
|
|
2310
|
+
n ++
|
|
2311
|
+
}
|
|
2312
|
+
// now n is the index of the first one that is *not* a string.
|
|
2313
|
+
|
|
2314
|
+
// See if there's anything else
|
|
2315
|
+
var prefix
|
|
2316
|
+
switch (n) {
|
|
2317
|
+
// if not, then this is rather simple
|
|
2318
|
+
case pattern.length:
|
|
2319
|
+
this._processSimple(pattern.join('/'), index)
|
|
2320
|
+
return
|
|
2321
|
+
|
|
2322
|
+
case 0:
|
|
2323
|
+
// pattern *starts* with some non-trivial item.
|
|
2324
|
+
// going to readdir(cwd), but not include the prefix in matches.
|
|
2325
|
+
prefix = null
|
|
2326
|
+
break
|
|
2327
|
+
|
|
2328
|
+
default:
|
|
2329
|
+
// pattern has some string bits in the front.
|
|
2330
|
+
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
|
2331
|
+
// or 'relative' like '../baz'
|
|
2332
|
+
prefix = pattern.slice(0, n).join('/')
|
|
2333
|
+
break
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
var remain = pattern.slice(n)
|
|
2337
|
+
|
|
2338
|
+
// get the list of entries.
|
|
2339
|
+
var read
|
|
2340
|
+
if (prefix === null)
|
|
2341
|
+
read = '.'
|
|
2342
|
+
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
|
2343
|
+
if (!prefix || !isAbsolute(prefix))
|
|
2344
|
+
prefix = '/' + prefix
|
|
2345
|
+
read = prefix
|
|
2346
|
+
} else
|
|
2347
|
+
read = prefix
|
|
2348
|
+
|
|
2349
|
+
var abs = this._makeAbs(read)
|
|
2350
|
+
|
|
2351
|
+
//if ignored, skip processing
|
|
2352
|
+
if (childrenIgnored(this, read))
|
|
2353
|
+
return
|
|
2354
|
+
|
|
2355
|
+
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
|
2356
|
+
if (isGlobStar)
|
|
2357
|
+
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
|
|
2358
|
+
else
|
|
2359
|
+
this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
|
|
2363
|
+
GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
|
|
2364
|
+
var entries = this._readdir(abs, inGlobStar)
|
|
2365
|
+
|
|
2366
|
+
// if the abs isn't a dir, then nothing can match!
|
|
2367
|
+
if (!entries)
|
|
2368
|
+
return
|
|
2369
|
+
|
|
2370
|
+
// It will only match dot entries if it starts with a dot, or if
|
|
2371
|
+
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
|
2372
|
+
var pn = remain[0]
|
|
2373
|
+
var negate = !!this.minimatch.negate
|
|
2374
|
+
var rawGlob = pn._glob
|
|
2375
|
+
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
|
2376
|
+
|
|
2377
|
+
var matchedEntries = []
|
|
2378
|
+
for (var i = 0; i < entries.length; i++) {
|
|
2379
|
+
var e = entries[i]
|
|
2380
|
+
if (e.charAt(0) !== '.' || dotOk) {
|
|
2381
|
+
var m
|
|
2382
|
+
if (negate && !prefix) {
|
|
2383
|
+
m = !e.match(pn)
|
|
2384
|
+
} else {
|
|
2385
|
+
m = e.match(pn)
|
|
2386
|
+
}
|
|
2387
|
+
if (m)
|
|
2388
|
+
matchedEntries.push(e)
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
var len = matchedEntries.length
|
|
2393
|
+
// If there are no matched entries, then nothing matches.
|
|
2394
|
+
if (len === 0)
|
|
2395
|
+
return
|
|
2396
|
+
|
|
2397
|
+
// if this is the last remaining pattern bit, then no need for
|
|
2398
|
+
// an additional stat *unless* the user has specified mark or
|
|
2399
|
+
// stat explicitly. We know they exist, since readdir returned
|
|
2400
|
+
// them.
|
|
2401
|
+
|
|
2402
|
+
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
2403
|
+
if (!this.matches[index])
|
|
2404
|
+
this.matches[index] = Object.create(null)
|
|
2405
|
+
|
|
2406
|
+
for (var i = 0; i < len; i ++) {
|
|
2407
|
+
var e = matchedEntries[i]
|
|
2408
|
+
if (prefix) {
|
|
2409
|
+
if (prefix.slice(-1) !== '/')
|
|
2410
|
+
e = prefix + '/' + e
|
|
2411
|
+
else
|
|
2412
|
+
e = prefix + e
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
if (e.charAt(0) === '/' && !this.nomount) {
|
|
2416
|
+
e = path.join(this.root, e)
|
|
2417
|
+
}
|
|
2418
|
+
this._emitMatch(index, e)
|
|
2419
|
+
}
|
|
2420
|
+
// This was the last one, and no stats were needed
|
|
2421
|
+
return
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
// now test all matched entries as stand-ins for that part
|
|
2425
|
+
// of the pattern.
|
|
2426
|
+
remain.shift()
|
|
2427
|
+
for (var i = 0; i < len; i ++) {
|
|
2428
|
+
var e = matchedEntries[i]
|
|
2429
|
+
var newPattern
|
|
2430
|
+
if (prefix)
|
|
2431
|
+
newPattern = [prefix, e]
|
|
2432
|
+
else
|
|
2433
|
+
newPattern = [e]
|
|
2434
|
+
this._process(newPattern.concat(remain), index, inGlobStar)
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
|
|
2439
|
+
GlobSync.prototype._emitMatch = function (index, e) {
|
|
2440
|
+
if (isIgnored(this, e))
|
|
2441
|
+
return
|
|
2442
|
+
|
|
2443
|
+
var abs = this._makeAbs(e)
|
|
2444
|
+
|
|
2445
|
+
if (this.mark)
|
|
2446
|
+
e = this._mark(e)
|
|
2447
|
+
|
|
2448
|
+
if (this.absolute) {
|
|
2449
|
+
e = abs
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
if (this.matches[index][e])
|
|
2453
|
+
return
|
|
2454
|
+
|
|
2455
|
+
if (this.nodir) {
|
|
2456
|
+
var c = this.cache[abs]
|
|
2457
|
+
if (c === 'DIR' || Array.isArray(c))
|
|
2458
|
+
return
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
this.matches[index][e] = true
|
|
2462
|
+
|
|
2463
|
+
if (this.stat)
|
|
2464
|
+
this._stat(e)
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
|
|
2468
|
+
GlobSync.prototype._readdirInGlobStar = function (abs) {
|
|
2469
|
+
// follow all symlinked directories forever
|
|
2470
|
+
// just proceed as if this is a non-globstar situation
|
|
2471
|
+
if (this.follow)
|
|
2472
|
+
return this._readdir(abs, false)
|
|
2473
|
+
|
|
2474
|
+
var entries
|
|
2475
|
+
var lstat
|
|
2476
|
+
var stat
|
|
2477
|
+
try {
|
|
2478
|
+
lstat = this.fs.lstatSync(abs)
|
|
2479
|
+
} catch (er) {
|
|
2480
|
+
if (er.code === 'ENOENT') {
|
|
2481
|
+
// lstat failed, doesn't exist
|
|
2482
|
+
return null
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
var isSym = lstat && lstat.isSymbolicLink()
|
|
2487
|
+
this.symlinks[abs] = isSym
|
|
2488
|
+
|
|
2489
|
+
// If it's not a symlink or a dir, then it's definitely a regular file.
|
|
2490
|
+
// don't bother doing a readdir in that case.
|
|
2491
|
+
if (!isSym && lstat && !lstat.isDirectory())
|
|
2492
|
+
this.cache[abs] = 'FILE'
|
|
2493
|
+
else
|
|
2494
|
+
entries = this._readdir(abs, false)
|
|
2495
|
+
|
|
2496
|
+
return entries
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
|
2500
|
+
var entries
|
|
2501
|
+
|
|
2502
|
+
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
2503
|
+
return this._readdirInGlobStar(abs)
|
|
2504
|
+
|
|
2505
|
+
if (ownProp(this.cache, abs)) {
|
|
2506
|
+
var c = this.cache[abs]
|
|
2507
|
+
if (!c || c === 'FILE')
|
|
2508
|
+
return null
|
|
2509
|
+
|
|
2510
|
+
if (Array.isArray(c))
|
|
2511
|
+
return c
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
try {
|
|
2515
|
+
return this._readdirEntries(abs, this.fs.readdirSync(abs))
|
|
2516
|
+
} catch (er) {
|
|
2517
|
+
this._readdirError(abs, er)
|
|
2518
|
+
return null
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
GlobSync.prototype._readdirEntries = function (abs, entries) {
|
|
2523
|
+
// if we haven't asked to stat everything, then just
|
|
2524
|
+
// assume that everything in there exists, so we can avoid
|
|
2525
|
+
// having to stat it a second time.
|
|
2526
|
+
if (!this.mark && !this.stat) {
|
|
2527
|
+
for (var i = 0; i < entries.length; i ++) {
|
|
2528
|
+
var e = entries[i]
|
|
2529
|
+
if (abs === '/')
|
|
2530
|
+
e = abs + e
|
|
2531
|
+
else
|
|
2532
|
+
e = abs + '/' + e
|
|
2533
|
+
this.cache[e] = true
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
this.cache[abs] = entries
|
|
2538
|
+
|
|
2539
|
+
// mark and cache dir-ness
|
|
2540
|
+
return entries
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
GlobSync.prototype._readdirError = function (f, er) {
|
|
2544
|
+
// handle errors, and cache the information
|
|
2545
|
+
switch (er.code) {
|
|
2546
|
+
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
|
2547
|
+
case 'ENOTDIR': // totally normal. means it *does* exist.
|
|
2548
|
+
var abs = this._makeAbs(f)
|
|
2549
|
+
this.cache[abs] = 'FILE'
|
|
2550
|
+
if (abs === this.cwdAbs) {
|
|
2551
|
+
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
|
2552
|
+
error.path = this.cwd
|
|
2553
|
+
error.code = er.code
|
|
2554
|
+
throw error
|
|
2555
|
+
}
|
|
2556
|
+
break
|
|
2557
|
+
|
|
2558
|
+
case 'ENOENT': // not terribly unusual
|
|
2559
|
+
case 'ELOOP':
|
|
2560
|
+
case 'ENAMETOOLONG':
|
|
2561
|
+
case 'UNKNOWN':
|
|
2562
|
+
this.cache[this._makeAbs(f)] = false
|
|
2563
|
+
break
|
|
2564
|
+
|
|
2565
|
+
default: // some unusual error. Treat as failure.
|
|
2566
|
+
this.cache[this._makeAbs(f)] = false
|
|
2567
|
+
if (this.strict)
|
|
2568
|
+
throw er
|
|
2569
|
+
if (!this.silent)
|
|
2570
|
+
console.error('glob error', er)
|
|
2571
|
+
break
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
|
|
2576
|
+
|
|
2577
|
+
var entries = this._readdir(abs, inGlobStar)
|
|
2578
|
+
|
|
2579
|
+
// no entries means not a dir, so it can never have matches
|
|
2580
|
+
// foo.txt/** doesn't match foo.txt
|
|
2581
|
+
if (!entries)
|
|
2582
|
+
return
|
|
2583
|
+
|
|
2584
|
+
// test without the globstar, and with every child both below
|
|
2585
|
+
// and replacing the globstar.
|
|
2586
|
+
var remainWithoutGlobStar = remain.slice(1)
|
|
2587
|
+
var gspref = prefix ? [ prefix ] : []
|
|
2588
|
+
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
|
2589
|
+
|
|
2590
|
+
// the noGlobStar pattern exits the inGlobStar state
|
|
2591
|
+
this._process(noGlobStar, index, false)
|
|
2592
|
+
|
|
2593
|
+
var len = entries.length
|
|
2594
|
+
var isSym = this.symlinks[abs]
|
|
2595
|
+
|
|
2596
|
+
// If it's a symlink, and we're in a globstar, then stop
|
|
2597
|
+
if (isSym && inGlobStar)
|
|
2598
|
+
return
|
|
2599
|
+
|
|
2600
|
+
for (var i = 0; i < len; i++) {
|
|
2601
|
+
var e = entries[i]
|
|
2602
|
+
if (e.charAt(0) === '.' && !this.dot)
|
|
2603
|
+
continue
|
|
2604
|
+
|
|
2605
|
+
// these two cases enter the inGlobStar state
|
|
2606
|
+
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
|
2607
|
+
this._process(instead, index, true)
|
|
2608
|
+
|
|
2609
|
+
var below = gspref.concat(entries[i], remain)
|
|
2610
|
+
this._process(below, index, true)
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
GlobSync.prototype._processSimple = function (prefix, index) {
|
|
2615
|
+
// XXX review this. Shouldn't it be doing the mounting etc
|
|
2616
|
+
// before doing stat? kinda weird?
|
|
2617
|
+
var exists = this._stat(prefix)
|
|
2618
|
+
|
|
2619
|
+
if (!this.matches[index])
|
|
2620
|
+
this.matches[index] = Object.create(null)
|
|
2621
|
+
|
|
2622
|
+
// If it doesn't exist, then just mark the lack of results
|
|
2623
|
+
if (!exists)
|
|
2624
|
+
return
|
|
2625
|
+
|
|
2626
|
+
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
2627
|
+
var trail = /[\/\\]$/.test(prefix)
|
|
2628
|
+
if (prefix.charAt(0) === '/') {
|
|
2629
|
+
prefix = path.join(this.root, prefix)
|
|
2630
|
+
} else {
|
|
2631
|
+
prefix = path.resolve(this.root, prefix)
|
|
2632
|
+
if (trail)
|
|
2633
|
+
prefix += '/'
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
if (process.platform === 'win32')
|
|
2638
|
+
prefix = prefix.replace(/\\/g, '/')
|
|
2639
|
+
|
|
2640
|
+
// Mark this as a match
|
|
2641
|
+
this._emitMatch(index, prefix)
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
// Returns either 'DIR', 'FILE', or false
|
|
2645
|
+
GlobSync.prototype._stat = function (f) {
|
|
2646
|
+
var abs = this._makeAbs(f)
|
|
2647
|
+
var needDir = f.slice(-1) === '/'
|
|
2648
|
+
|
|
2649
|
+
if (f.length > this.maxLength)
|
|
2650
|
+
return false
|
|
2651
|
+
|
|
2652
|
+
if (!this.stat && ownProp(this.cache, abs)) {
|
|
2653
|
+
var c = this.cache[abs]
|
|
2654
|
+
|
|
2655
|
+
if (Array.isArray(c))
|
|
2656
|
+
c = 'DIR'
|
|
2657
|
+
|
|
2658
|
+
// It exists, but maybe not how we need it
|
|
2659
|
+
if (!needDir || c === 'DIR')
|
|
2660
|
+
return c
|
|
2661
|
+
|
|
2662
|
+
if (needDir && c === 'FILE')
|
|
2663
|
+
return false
|
|
2664
|
+
|
|
2665
|
+
// otherwise we have to stat, because maybe c=true
|
|
2666
|
+
// if we know it exists, but not what it is.
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
var exists
|
|
2670
|
+
var stat = this.statCache[abs]
|
|
2671
|
+
if (!stat) {
|
|
2672
|
+
var lstat
|
|
2673
|
+
try {
|
|
2674
|
+
lstat = this.fs.lstatSync(abs)
|
|
2675
|
+
} catch (er) {
|
|
2676
|
+
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
|
2677
|
+
this.statCache[abs] = false
|
|
2678
|
+
return false
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
if (lstat && lstat.isSymbolicLink()) {
|
|
2683
|
+
try {
|
|
2684
|
+
stat = this.fs.statSync(abs)
|
|
2685
|
+
} catch (er) {
|
|
2686
|
+
stat = lstat
|
|
2687
|
+
}
|
|
2688
|
+
} else {
|
|
2689
|
+
stat = lstat
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
this.statCache[abs] = stat
|
|
2694
|
+
|
|
2695
|
+
var c = true
|
|
2696
|
+
if (stat)
|
|
2697
|
+
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
|
2698
|
+
|
|
2699
|
+
this.cache[abs] = this.cache[abs] || c
|
|
2700
|
+
|
|
2701
|
+
if (needDir && c === 'FILE')
|
|
2702
|
+
return false
|
|
2703
|
+
|
|
2704
|
+
return c
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
GlobSync.prototype._mark = function (p) {
|
|
2708
|
+
return common.mark(this, p)
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
GlobSync.prototype._makeAbs = function (f) {
|
|
2712
|
+
return common.makeAbs(this, f)
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
|
|
2716
|
+
/***/ }),
|
|
2717
|
+
|
|
2718
|
+
/***/ 7844:
|
|
2719
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2720
|
+
|
|
2721
|
+
var wrappy = __webpack_require__(2479)
|
|
2722
|
+
var reqs = Object.create(null)
|
|
2723
|
+
var once = __webpack_require__(778)
|
|
2724
|
+
|
|
2725
|
+
module.exports = wrappy(inflight)
|
|
2726
|
+
|
|
2727
|
+
function inflight (key, cb) {
|
|
2728
|
+
if (reqs[key]) {
|
|
2729
|
+
reqs[key].push(cb)
|
|
2730
|
+
return null
|
|
2731
|
+
} else {
|
|
2732
|
+
reqs[key] = [cb]
|
|
2733
|
+
return makeres(key)
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
function makeres (key) {
|
|
2738
|
+
return once(function RES () {
|
|
2739
|
+
var cbs = reqs[key]
|
|
2740
|
+
var len = cbs.length
|
|
2741
|
+
var args = slice(arguments)
|
|
2742
|
+
|
|
2743
|
+
// XXX It's somewhat ambiguous whether a new callback added in this
|
|
2744
|
+
// pass should be queued for later execution if something in the
|
|
2745
|
+
// list of callbacks throws, or if it should just be discarded.
|
|
2746
|
+
// However, it's such an edge case that it hardly matters, and either
|
|
2747
|
+
// choice is likely as surprising as the other.
|
|
2748
|
+
// As it happens, we do go ahead and schedule it for later execution.
|
|
2749
|
+
try {
|
|
2750
|
+
for (var i = 0; i < len; i++) {
|
|
2751
|
+
cbs[i].apply(null, args)
|
|
2752
|
+
}
|
|
2753
|
+
} finally {
|
|
2754
|
+
if (cbs.length > len) {
|
|
2755
|
+
// added more in the interim.
|
|
2756
|
+
// de-zalgo, just in case, but don't call again.
|
|
2757
|
+
cbs.splice(0, len)
|
|
2758
|
+
process.nextTick(function () {
|
|
2759
|
+
RES.apply(null, args)
|
|
2760
|
+
})
|
|
2761
|
+
} else {
|
|
2762
|
+
delete reqs[key]
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
})
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
function slice (args) {
|
|
2769
|
+
var length = args.length
|
|
2770
|
+
var array = []
|
|
2771
|
+
|
|
2772
|
+
for (var i = 0; i < length; i++) array[i] = args[i]
|
|
2773
|
+
return array
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
/***/ }),
|
|
2778
|
+
|
|
2779
|
+
/***/ 5717:
|
|
2780
|
+
/***/ ((module) => {
|
|
2781
|
+
|
|
2782
|
+
if (typeof Object.create === 'function') {
|
|
2783
|
+
// implementation from standard node.js 'util' module
|
|
2784
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
2785
|
+
if (superCtor) {
|
|
2786
|
+
ctor.super_ = superCtor
|
|
2787
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
2788
|
+
constructor: {
|
|
2789
|
+
value: ctor,
|
|
2790
|
+
enumerable: false,
|
|
2791
|
+
writable: true,
|
|
2792
|
+
configurable: true
|
|
2793
|
+
}
|
|
2794
|
+
})
|
|
2795
|
+
}
|
|
2796
|
+
};
|
|
2797
|
+
} else {
|
|
2798
|
+
// old school shim for old browsers
|
|
2799
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
2800
|
+
if (superCtor) {
|
|
2801
|
+
ctor.super_ = superCtor
|
|
2802
|
+
var TempCtor = function () {}
|
|
2803
|
+
TempCtor.prototype = superCtor.prototype
|
|
2804
|
+
ctor.prototype = new TempCtor()
|
|
2805
|
+
ctor.prototype.constructor = ctor
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
/***/ }),
|
|
2812
|
+
|
|
2813
|
+
/***/ 1171:
|
|
2814
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2815
|
+
|
|
2816
|
+
module.exports = minimatch
|
|
2817
|
+
minimatch.Minimatch = Minimatch
|
|
2818
|
+
|
|
2819
|
+
var path = (function () { try { return __webpack_require__(1423) } catch (e) {}}()) || {
|
|
2820
|
+
sep: '/'
|
|
2821
|
+
}
|
|
2822
|
+
minimatch.sep = path.sep
|
|
2823
|
+
|
|
2824
|
+
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
|
|
2825
|
+
var expand = __webpack_require__(3644)
|
|
2826
|
+
|
|
2827
|
+
var plTypes = {
|
|
2828
|
+
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
|
|
2829
|
+
'?': { open: '(?:', close: ')?' },
|
|
2830
|
+
'+': { open: '(?:', close: ')+' },
|
|
2831
|
+
'*': { open: '(?:', close: ')*' },
|
|
2832
|
+
'@': { open: '(?:', close: ')' }
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
// any single thing other than /
|
|
2836
|
+
// don't need to escape / when using new RegExp()
|
|
2837
|
+
var qmark = '[^/]'
|
|
2838
|
+
|
|
2839
|
+
// * => any number of characters
|
|
2840
|
+
var star = qmark + '*?'
|
|
2841
|
+
|
|
2842
|
+
// ** when dots are allowed. Anything goes, except .. and .
|
|
2843
|
+
// not (^ or / followed by one or two dots followed by $ or /),
|
|
2844
|
+
// followed by anything, any number of times.
|
|
2845
|
+
var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
|
|
2846
|
+
|
|
2847
|
+
// not a ^ or / followed by a dot,
|
|
2848
|
+
// followed by anything, any number of times.
|
|
2849
|
+
var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
|
|
2850
|
+
|
|
2851
|
+
// characters that need to be escaped in RegExp.
|
|
2852
|
+
var reSpecials = charSet('().*{}+?[]^$\\!')
|
|
2853
|
+
|
|
2854
|
+
// "abc" -> { a:true, b:true, c:true }
|
|
2855
|
+
function charSet (s) {
|
|
2856
|
+
return s.split('').reduce(function (set, c) {
|
|
2857
|
+
set[c] = true
|
|
2858
|
+
return set
|
|
2859
|
+
}, {})
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
// normalizes slashes.
|
|
2863
|
+
var slashSplit = /\/+/
|
|
2864
|
+
|
|
2865
|
+
minimatch.filter = filter
|
|
2866
|
+
function filter (pattern, options) {
|
|
2867
|
+
options = options || {}
|
|
2868
|
+
return function (p, i, list) {
|
|
2869
|
+
return minimatch(p, pattern, options)
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
function ext (a, b) {
|
|
2874
|
+
b = b || {}
|
|
2875
|
+
var t = {}
|
|
2876
|
+
Object.keys(a).forEach(function (k) {
|
|
2877
|
+
t[k] = a[k]
|
|
2878
|
+
})
|
|
2879
|
+
Object.keys(b).forEach(function (k) {
|
|
2880
|
+
t[k] = b[k]
|
|
2881
|
+
})
|
|
2882
|
+
return t
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
minimatch.defaults = function (def) {
|
|
2886
|
+
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
|
|
2887
|
+
return minimatch
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
var orig = minimatch
|
|
2891
|
+
|
|
2892
|
+
var m = function minimatch (p, pattern, options) {
|
|
2893
|
+
return orig(p, pattern, ext(def, options))
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
m.Minimatch = function Minimatch (pattern, options) {
|
|
2897
|
+
return new orig.Minimatch(pattern, ext(def, options))
|
|
2898
|
+
}
|
|
2899
|
+
m.Minimatch.defaults = function defaults (options) {
|
|
2900
|
+
return orig.defaults(ext(def, options)).Minimatch
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
m.filter = function filter (pattern, options) {
|
|
2904
|
+
return orig.filter(pattern, ext(def, options))
|
|
2905
|
+
}
|
|
2906
|
+
|
|
2907
|
+
m.defaults = function defaults (options) {
|
|
2908
|
+
return orig.defaults(ext(def, options))
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
m.makeRe = function makeRe (pattern, options) {
|
|
2912
|
+
return orig.makeRe(pattern, ext(def, options))
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
m.braceExpand = function braceExpand (pattern, options) {
|
|
2916
|
+
return orig.braceExpand(pattern, ext(def, options))
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
m.match = function (list, pattern, options) {
|
|
2920
|
+
return orig.match(list, pattern, ext(def, options))
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
return m
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2926
|
+
Minimatch.defaults = function (def) {
|
|
2927
|
+
return minimatch.defaults(def).Minimatch
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
function minimatch (p, pattern, options) {
|
|
2931
|
+
assertValidPattern(pattern)
|
|
2932
|
+
|
|
2933
|
+
if (!options) options = {}
|
|
2934
|
+
|
|
2935
|
+
// shortcut: comments match nothing.
|
|
2936
|
+
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
2937
|
+
return false
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
return new Minimatch(pattern, options).match(p)
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
function Minimatch (pattern, options) {
|
|
2944
|
+
if (!(this instanceof Minimatch)) {
|
|
2945
|
+
return new Minimatch(pattern, options)
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
assertValidPattern(pattern)
|
|
2949
|
+
|
|
2950
|
+
if (!options) options = {}
|
|
2951
|
+
|
|
2952
|
+
pattern = pattern.trim()
|
|
2953
|
+
|
|
2954
|
+
// windows support: need to use /, not \
|
|
2955
|
+
if (!options.allowWindowsEscape && path.sep !== '/') {
|
|
2956
|
+
pattern = pattern.split(path.sep).join('/')
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
this.options = options
|
|
2960
|
+
this.set = []
|
|
2961
|
+
this.pattern = pattern
|
|
2962
|
+
this.regexp = null
|
|
2963
|
+
this.negate = false
|
|
2964
|
+
this.comment = false
|
|
2965
|
+
this.empty = false
|
|
2966
|
+
this.partial = !!options.partial
|
|
2967
|
+
|
|
2968
|
+
// make the set of regexps etc.
|
|
2969
|
+
this.make()
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
Minimatch.prototype.debug = function () {}
|
|
2973
|
+
|
|
2974
|
+
Minimatch.prototype.make = make
|
|
2975
|
+
function make () {
|
|
2976
|
+
var pattern = this.pattern
|
|
2977
|
+
var options = this.options
|
|
2978
|
+
|
|
2979
|
+
// empty patterns and comments match nothing.
|
|
2980
|
+
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
2981
|
+
this.comment = true
|
|
2982
|
+
return
|
|
2983
|
+
}
|
|
2984
|
+
if (!pattern) {
|
|
2985
|
+
this.empty = true
|
|
2986
|
+
return
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
// step 1: figure out negation, etc.
|
|
2990
|
+
this.parseNegate()
|
|
2991
|
+
|
|
2992
|
+
// step 2: expand braces
|
|
2993
|
+
var set = this.globSet = this.braceExpand()
|
|
2994
|
+
|
|
2995
|
+
if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
|
|
2996
|
+
|
|
2997
|
+
this.debug(this.pattern, set)
|
|
2998
|
+
|
|
2999
|
+
// step 3: now we have a set, so turn each one into a series of path-portion
|
|
3000
|
+
// matching patterns.
|
|
3001
|
+
// These will be regexps, except in the case of "**", which is
|
|
3002
|
+
// set to the GLOBSTAR object for globstar behavior,
|
|
3003
|
+
// and will not contain any / characters
|
|
3004
|
+
set = this.globParts = set.map(function (s) {
|
|
3005
|
+
return s.split(slashSplit)
|
|
3006
|
+
})
|
|
3007
|
+
|
|
3008
|
+
this.debug(this.pattern, set)
|
|
3009
|
+
|
|
3010
|
+
// glob --> regexps
|
|
3011
|
+
set = set.map(function (s, si, set) {
|
|
3012
|
+
return s.map(this.parse, this)
|
|
3013
|
+
}, this)
|
|
3014
|
+
|
|
3015
|
+
this.debug(this.pattern, set)
|
|
3016
|
+
|
|
3017
|
+
// filter out everything that didn't compile properly.
|
|
3018
|
+
set = set.filter(function (s) {
|
|
3019
|
+
return s.indexOf(false) === -1
|
|
3020
|
+
})
|
|
3021
|
+
|
|
3022
|
+
this.debug(this.pattern, set)
|
|
3023
|
+
|
|
3024
|
+
this.set = set
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
Minimatch.prototype.parseNegate = parseNegate
|
|
3028
|
+
function parseNegate () {
|
|
3029
|
+
var pattern = this.pattern
|
|
3030
|
+
var negate = false
|
|
3031
|
+
var options = this.options
|
|
3032
|
+
var negateOffset = 0
|
|
3033
|
+
|
|
3034
|
+
if (options.nonegate) return
|
|
3035
|
+
|
|
3036
|
+
for (var i = 0, l = pattern.length
|
|
3037
|
+
; i < l && pattern.charAt(i) === '!'
|
|
3038
|
+
; i++) {
|
|
3039
|
+
negate = !negate
|
|
3040
|
+
negateOffset++
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
if (negateOffset) this.pattern = pattern.substr(negateOffset)
|
|
3044
|
+
this.negate = negate
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
// Brace expansion:
|
|
3048
|
+
// a{b,c}d -> abd acd
|
|
3049
|
+
// a{b,}c -> abc ac
|
|
3050
|
+
// a{0..3}d -> a0d a1d a2d a3d
|
|
3051
|
+
// a{b,c{d,e}f}g -> abg acdfg acefg
|
|
3052
|
+
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
|
|
3053
|
+
//
|
|
3054
|
+
// Invalid sets are not expanded.
|
|
3055
|
+
// a{2..}b -> a{2..}b
|
|
3056
|
+
// a{b}c -> a{b}c
|
|
3057
|
+
minimatch.braceExpand = function (pattern, options) {
|
|
3058
|
+
return braceExpand(pattern, options)
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
Minimatch.prototype.braceExpand = braceExpand
|
|
3062
|
+
|
|
3063
|
+
function braceExpand (pattern, options) {
|
|
3064
|
+
if (!options) {
|
|
3065
|
+
if (this instanceof Minimatch) {
|
|
3066
|
+
options = this.options
|
|
3067
|
+
} else {
|
|
3068
|
+
options = {}
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
pattern = typeof pattern === 'undefined'
|
|
3073
|
+
? this.pattern : pattern
|
|
3074
|
+
|
|
3075
|
+
assertValidPattern(pattern)
|
|
3076
|
+
|
|
3077
|
+
// Thanks to Yeting Li <https://github.com/yetingli> for
|
|
3078
|
+
// improving this regexp to avoid a ReDOS vulnerability.
|
|
3079
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
3080
|
+
// shortcut. no need to expand.
|
|
3081
|
+
return [pattern]
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
return expand(pattern)
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
var MAX_PATTERN_LENGTH = 1024 * 64
|
|
3088
|
+
var assertValidPattern = function (pattern) {
|
|
3089
|
+
if (typeof pattern !== 'string') {
|
|
3090
|
+
throw new TypeError('invalid pattern')
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
3094
|
+
throw new TypeError('pattern is too long')
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
// parse a component of the expanded set.
|
|
3099
|
+
// At this point, no pattern may contain "/" in it
|
|
3100
|
+
// so we're going to return a 2d array, where each entry is the full
|
|
3101
|
+
// pattern, split on '/', and then turned into a regular expression.
|
|
3102
|
+
// A regexp is made at the end which joins each array with an
|
|
3103
|
+
// escaped /, and another full one which joins each regexp with |.
|
|
3104
|
+
//
|
|
3105
|
+
// Following the lead of Bash 4.1, note that "**" only has special meaning
|
|
3106
|
+
// when it is the *only* thing in a path portion. Otherwise, any series
|
|
3107
|
+
// of * is equivalent to a single *. Globstar behavior is enabled by
|
|
3108
|
+
// default, and can be disabled by setting options.noglobstar.
|
|
3109
|
+
Minimatch.prototype.parse = parse
|
|
3110
|
+
var SUBPARSE = {}
|
|
3111
|
+
function parse (pattern, isSub) {
|
|
3112
|
+
assertValidPattern(pattern)
|
|
3113
|
+
|
|
3114
|
+
var options = this.options
|
|
3115
|
+
|
|
3116
|
+
// shortcuts
|
|
3117
|
+
if (pattern === '**') {
|
|
3118
|
+
if (!options.noglobstar)
|
|
3119
|
+
return GLOBSTAR
|
|
3120
|
+
else
|
|
3121
|
+
pattern = '*'
|
|
3122
|
+
}
|
|
3123
|
+
if (pattern === '') return ''
|
|
3124
|
+
|
|
3125
|
+
var re = ''
|
|
3126
|
+
var hasMagic = !!options.nocase
|
|
3127
|
+
var escaping = false
|
|
3128
|
+
// ? => one single character
|
|
3129
|
+
var patternListStack = []
|
|
3130
|
+
var negativeLists = []
|
|
3131
|
+
var stateChar
|
|
3132
|
+
var inClass = false
|
|
3133
|
+
var reClassStart = -1
|
|
3134
|
+
var classStart = -1
|
|
3135
|
+
// . and .. never match anything that doesn't start with .,
|
|
3136
|
+
// even when options.dot is set.
|
|
3137
|
+
var patternStart = pattern.charAt(0) === '.' ? '' // anything
|
|
3138
|
+
// not (start or / followed by . or .. followed by / or end)
|
|
3139
|
+
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
|
|
3140
|
+
: '(?!\\.)'
|
|
3141
|
+
var self = this
|
|
3142
|
+
|
|
3143
|
+
function clearStateChar () {
|
|
3144
|
+
if (stateChar) {
|
|
3145
|
+
// we had some state-tracking character
|
|
3146
|
+
// that wasn't consumed by this pass.
|
|
3147
|
+
switch (stateChar) {
|
|
3148
|
+
case '*':
|
|
3149
|
+
re += star
|
|
3150
|
+
hasMagic = true
|
|
3151
|
+
break
|
|
3152
|
+
case '?':
|
|
3153
|
+
re += qmark
|
|
3154
|
+
hasMagic = true
|
|
3155
|
+
break
|
|
3156
|
+
default:
|
|
3157
|
+
re += '\\' + stateChar
|
|
3158
|
+
break
|
|
3159
|
+
}
|
|
3160
|
+
self.debug('clearStateChar %j %j', stateChar, re)
|
|
3161
|
+
stateChar = false
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
for (var i = 0, len = pattern.length, c
|
|
3166
|
+
; (i < len) && (c = pattern.charAt(i))
|
|
3167
|
+
; i++) {
|
|
3168
|
+
this.debug('%s\t%s %s %j', pattern, i, re, c)
|
|
3169
|
+
|
|
3170
|
+
// skip over any that are escaped.
|
|
3171
|
+
if (escaping && reSpecials[c]) {
|
|
3172
|
+
re += '\\' + c
|
|
3173
|
+
escaping = false
|
|
3174
|
+
continue
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3177
|
+
switch (c) {
|
|
3178
|
+
/* istanbul ignore next */
|
|
3179
|
+
case '/': {
|
|
3180
|
+
// completely not allowed, even escaped.
|
|
3181
|
+
// Should already be path-split by now.
|
|
3182
|
+
return false
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
case '\\':
|
|
3186
|
+
clearStateChar()
|
|
3187
|
+
escaping = true
|
|
3188
|
+
continue
|
|
3189
|
+
|
|
3190
|
+
// the various stateChar values
|
|
3191
|
+
// for the "extglob" stuff.
|
|
3192
|
+
case '?':
|
|
3193
|
+
case '*':
|
|
3194
|
+
case '+':
|
|
3195
|
+
case '@':
|
|
3196
|
+
case '!':
|
|
3197
|
+
this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
|
|
3198
|
+
|
|
3199
|
+
// all of those are literals inside a class, except that
|
|
3200
|
+
// the glob [!a] means [^a] in regexp
|
|
3201
|
+
if (inClass) {
|
|
3202
|
+
this.debug(' in class')
|
|
3203
|
+
if (c === '!' && i === classStart + 1) c = '^'
|
|
3204
|
+
re += c
|
|
3205
|
+
continue
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
// if we already have a stateChar, then it means
|
|
3209
|
+
// that there was something like ** or +? in there.
|
|
3210
|
+
// Handle the stateChar, then proceed with this one.
|
|
3211
|
+
self.debug('call clearStateChar %j', stateChar)
|
|
3212
|
+
clearStateChar()
|
|
3213
|
+
stateChar = c
|
|
3214
|
+
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
|
3215
|
+
// just clear the statechar *now*, rather than even diving into
|
|
3216
|
+
// the patternList stuff.
|
|
3217
|
+
if (options.noext) clearStateChar()
|
|
3218
|
+
continue
|
|
3219
|
+
|
|
3220
|
+
case '(':
|
|
3221
|
+
if (inClass) {
|
|
3222
|
+
re += '('
|
|
3223
|
+
continue
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
if (!stateChar) {
|
|
3227
|
+
re += '\\('
|
|
3228
|
+
continue
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
patternListStack.push({
|
|
3232
|
+
type: stateChar,
|
|
3233
|
+
start: i - 1,
|
|
3234
|
+
reStart: re.length,
|
|
3235
|
+
open: plTypes[stateChar].open,
|
|
3236
|
+
close: plTypes[stateChar].close
|
|
3237
|
+
})
|
|
3238
|
+
// negation is (?:(?!js)[^/]*)
|
|
3239
|
+
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
|
|
3240
|
+
this.debug('plType %j %j', stateChar, re)
|
|
3241
|
+
stateChar = false
|
|
3242
|
+
continue
|
|
3243
|
+
|
|
3244
|
+
case ')':
|
|
3245
|
+
if (inClass || !patternListStack.length) {
|
|
3246
|
+
re += '\\)'
|
|
3247
|
+
continue
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
clearStateChar()
|
|
3251
|
+
hasMagic = true
|
|
3252
|
+
var pl = patternListStack.pop()
|
|
3253
|
+
// negation is (?:(?!js)[^/]*)
|
|
3254
|
+
// The others are (?:<pattern>)<type>
|
|
3255
|
+
re += pl.close
|
|
3256
|
+
if (pl.type === '!') {
|
|
3257
|
+
negativeLists.push(pl)
|
|
3258
|
+
}
|
|
3259
|
+
pl.reEnd = re.length
|
|
3260
|
+
continue
|
|
3261
|
+
|
|
3262
|
+
case '|':
|
|
3263
|
+
if (inClass || !patternListStack.length || escaping) {
|
|
3264
|
+
re += '\\|'
|
|
3265
|
+
escaping = false
|
|
3266
|
+
continue
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
clearStateChar()
|
|
3270
|
+
re += '|'
|
|
3271
|
+
continue
|
|
3272
|
+
|
|
3273
|
+
// these are mostly the same in regexp and glob
|
|
3274
|
+
case '[':
|
|
3275
|
+
// swallow any state-tracking char before the [
|
|
3276
|
+
clearStateChar()
|
|
3277
|
+
|
|
3278
|
+
if (inClass) {
|
|
3279
|
+
re += '\\' + c
|
|
3280
|
+
continue
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
inClass = true
|
|
3284
|
+
classStart = i
|
|
3285
|
+
reClassStart = re.length
|
|
3286
|
+
re += c
|
|
3287
|
+
continue
|
|
3288
|
+
|
|
3289
|
+
case ']':
|
|
3290
|
+
// a right bracket shall lose its special
|
|
3291
|
+
// meaning and represent itself in
|
|
3292
|
+
// a bracket expression if it occurs
|
|
3293
|
+
// first in the list. -- POSIX.2 2.8.3.2
|
|
3294
|
+
if (i === classStart + 1 || !inClass) {
|
|
3295
|
+
re += '\\' + c
|
|
3296
|
+
escaping = false
|
|
3297
|
+
continue
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
// handle the case where we left a class open.
|
|
3301
|
+
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
|
3302
|
+
// split where the last [ was, make sure we don't have
|
|
3303
|
+
// an invalid re. if so, re-walk the contents of the
|
|
3304
|
+
// would-be class to re-translate any characters that
|
|
3305
|
+
// were passed through as-is
|
|
3306
|
+
// TODO: It would probably be faster to determine this
|
|
3307
|
+
// without a try/catch and a new RegExp, but it's tricky
|
|
3308
|
+
// to do safely. For now, this is safe and works.
|
|
3309
|
+
var cs = pattern.substring(classStart + 1, i)
|
|
3310
|
+
try {
|
|
3311
|
+
RegExp('[' + cs + ']')
|
|
3312
|
+
} catch (er) {
|
|
3313
|
+
// not a valid class!
|
|
3314
|
+
var sp = this.parse(cs, SUBPARSE)
|
|
3315
|
+
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
|
3316
|
+
hasMagic = hasMagic || sp[1]
|
|
3317
|
+
inClass = false
|
|
3318
|
+
continue
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
// finish up the class.
|
|
3322
|
+
hasMagic = true
|
|
3323
|
+
inClass = false
|
|
3324
|
+
re += c
|
|
3325
|
+
continue
|
|
3326
|
+
|
|
3327
|
+
default:
|
|
3328
|
+
// swallow any state char that wasn't consumed
|
|
3329
|
+
clearStateChar()
|
|
3330
|
+
|
|
3331
|
+
if (escaping) {
|
|
3332
|
+
// no need
|
|
3333
|
+
escaping = false
|
|
3334
|
+
} else if (reSpecials[c]
|
|
3335
|
+
&& !(c === '^' && inClass)) {
|
|
3336
|
+
re += '\\'
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
re += c
|
|
3340
|
+
|
|
3341
|
+
} // switch
|
|
3342
|
+
} // for
|
|
3343
|
+
|
|
3344
|
+
// handle the case where we left a class open.
|
|
3345
|
+
// "[abc" is valid, equivalent to "\[abc"
|
|
3346
|
+
if (inClass) {
|
|
3347
|
+
// split where the last [ was, and escape it
|
|
3348
|
+
// this is a huge pita. We now have to re-walk
|
|
3349
|
+
// the contents of the would-be class to re-translate
|
|
3350
|
+
// any characters that were passed through as-is
|
|
3351
|
+
cs = pattern.substr(classStart + 1)
|
|
3352
|
+
sp = this.parse(cs, SUBPARSE)
|
|
3353
|
+
re = re.substr(0, reClassStart) + '\\[' + sp[0]
|
|
3354
|
+
hasMagic = hasMagic || sp[1]
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
// handle the case where we had a +( thing at the *end*
|
|
3358
|
+
// of the pattern.
|
|
3359
|
+
// each pattern list stack adds 3 chars, and we need to go through
|
|
3360
|
+
// and escape any | chars that were passed through as-is for the regexp.
|
|
3361
|
+
// Go through and escape them, taking care not to double-escape any
|
|
3362
|
+
// | chars that were already escaped.
|
|
3363
|
+
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
3364
|
+
var tail = re.slice(pl.reStart + pl.open.length)
|
|
3365
|
+
this.debug('setting tail', re, pl)
|
|
3366
|
+
// maybe some even number of \, then maybe 1 \, followed by a |
|
|
3367
|
+
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
|
|
3368
|
+
if (!$2) {
|
|
3369
|
+
// the | isn't already escaped, so escape it.
|
|
3370
|
+
$2 = '\\'
|
|
3371
|
+
}
|
|
3372
|
+
|
|
3373
|
+
// need to escape all those slashes *again*, without escaping the
|
|
3374
|
+
// one that we need for escaping the | character. As it works out,
|
|
3375
|
+
// escaping an even number of slashes can be done by simply repeating
|
|
3376
|
+
// it exactly after itself. That's why this trick works.
|
|
3377
|
+
//
|
|
3378
|
+
// I am sorry that you have to see this.
|
|
3379
|
+
return $1 + $1 + $2 + '|'
|
|
3380
|
+
})
|
|
3381
|
+
|
|
3382
|
+
this.debug('tail=%j\n %s', tail, tail, pl, re)
|
|
3383
|
+
var t = pl.type === '*' ? star
|
|
3384
|
+
: pl.type === '?' ? qmark
|
|
3385
|
+
: '\\' + pl.type
|
|
3386
|
+
|
|
3387
|
+
hasMagic = true
|
|
3388
|
+
re = re.slice(0, pl.reStart) + t + '\\(' + tail
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
// handle trailing things that only matter at the very end.
|
|
3392
|
+
clearStateChar()
|
|
3393
|
+
if (escaping) {
|
|
3394
|
+
// trailing \\
|
|
3395
|
+
re += '\\\\'
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
// only need to apply the nodot start if the re starts with
|
|
3399
|
+
// something that could conceivably capture a dot
|
|
3400
|
+
var addPatternStart = false
|
|
3401
|
+
switch (re.charAt(0)) {
|
|
3402
|
+
case '[': case '.': case '(': addPatternStart = true
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
// Hack to work around lack of negative lookbehind in JS
|
|
3406
|
+
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
|
|
3407
|
+
// like 'a.xyz.yz' doesn't match. So, the first negative
|
|
3408
|
+
// lookahead, has to look ALL the way ahead, to the end of
|
|
3409
|
+
// the pattern.
|
|
3410
|
+
for (var n = negativeLists.length - 1; n > -1; n--) {
|
|
3411
|
+
var nl = negativeLists[n]
|
|
3412
|
+
|
|
3413
|
+
var nlBefore = re.slice(0, nl.reStart)
|
|
3414
|
+
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
|
|
3415
|
+
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
|
|
3416
|
+
var nlAfter = re.slice(nl.reEnd)
|
|
3417
|
+
|
|
3418
|
+
nlLast += nlAfter
|
|
3419
|
+
|
|
3420
|
+
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
|
3421
|
+
// mean that we should *not* include the ) in the bit that is considered
|
|
3422
|
+
// "after" the negated section.
|
|
3423
|
+
var openParensBefore = nlBefore.split('(').length - 1
|
|
3424
|
+
var cleanAfter = nlAfter
|
|
3425
|
+
for (i = 0; i < openParensBefore; i++) {
|
|
3426
|
+
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
|
|
3427
|
+
}
|
|
3428
|
+
nlAfter = cleanAfter
|
|
3429
|
+
|
|
3430
|
+
var dollar = ''
|
|
3431
|
+
if (nlAfter === '' && isSub !== SUBPARSE) {
|
|
3432
|
+
dollar = '$'
|
|
3433
|
+
}
|
|
3434
|
+
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
|
|
3435
|
+
re = newRe
|
|
3436
|
+
}
|
|
3437
|
+
|
|
3438
|
+
// if the re is not "" at this point, then we need to make sure
|
|
3439
|
+
// it doesn't match against an empty path part.
|
|
3440
|
+
// Otherwise a/* will match a/, which it should not.
|
|
3441
|
+
if (re !== '' && hasMagic) {
|
|
3442
|
+
re = '(?=.)' + re
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3445
|
+
if (addPatternStart) {
|
|
3446
|
+
re = patternStart + re
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
// parsing just a piece of a larger pattern.
|
|
3450
|
+
if (isSub === SUBPARSE) {
|
|
3451
|
+
return [re, hasMagic]
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
// skip the regexp for non-magical patterns
|
|
3455
|
+
// unescape anything in it, though, so that it'll be
|
|
3456
|
+
// an exact match against a file etc.
|
|
3457
|
+
if (!hasMagic) {
|
|
3458
|
+
return globUnescape(pattern)
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
var flags = options.nocase ? 'i' : ''
|
|
3462
|
+
try {
|
|
3463
|
+
var regExp = new RegExp('^' + re + '$', flags)
|
|
3464
|
+
} catch (er) /* istanbul ignore next - should be impossible */ {
|
|
3465
|
+
// If it was an invalid regular expression, then it can't match
|
|
3466
|
+
// anything. This trick looks for a character after the end of
|
|
3467
|
+
// the string, which is of course impossible, except in multi-line
|
|
3468
|
+
// mode, but it's not a /m regex.
|
|
3469
|
+
return new RegExp('$.')
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
regExp._glob = pattern
|
|
3473
|
+
regExp._src = re
|
|
3474
|
+
|
|
3475
|
+
return regExp
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3478
|
+
minimatch.makeRe = function (pattern, options) {
|
|
3479
|
+
return new Minimatch(pattern, options || {}).makeRe()
|
|
3480
|
+
}
|
|
3481
|
+
|
|
3482
|
+
Minimatch.prototype.makeRe = makeRe
|
|
3483
|
+
function makeRe () {
|
|
3484
|
+
if (this.regexp || this.regexp === false) return this.regexp
|
|
3485
|
+
|
|
3486
|
+
// at this point, this.set is a 2d array of partial
|
|
3487
|
+
// pattern strings, or "**".
|
|
3488
|
+
//
|
|
3489
|
+
// It's better to use .match(). This function shouldn't
|
|
3490
|
+
// be used, really, but it's pretty convenient sometimes,
|
|
3491
|
+
// when you just want to work with a regex.
|
|
3492
|
+
var set = this.set
|
|
3493
|
+
|
|
3494
|
+
if (!set.length) {
|
|
3495
|
+
this.regexp = false
|
|
3496
|
+
return this.regexp
|
|
3497
|
+
}
|
|
3498
|
+
var options = this.options
|
|
3499
|
+
|
|
3500
|
+
var twoStar = options.noglobstar ? star
|
|
3501
|
+
: options.dot ? twoStarDot
|
|
3502
|
+
: twoStarNoDot
|
|
3503
|
+
var flags = options.nocase ? 'i' : ''
|
|
3504
|
+
|
|
3505
|
+
var re = set.map(function (pattern) {
|
|
3506
|
+
return pattern.map(function (p) {
|
|
3507
|
+
return (p === GLOBSTAR) ? twoStar
|
|
3508
|
+
: (typeof p === 'string') ? regExpEscape(p)
|
|
3509
|
+
: p._src
|
|
3510
|
+
}).join('\\\/')
|
|
3511
|
+
}).join('|')
|
|
3512
|
+
|
|
3513
|
+
// must match entire pattern
|
|
3514
|
+
// ending in a * or ** will make it less strict.
|
|
3515
|
+
re = '^(?:' + re + ')$'
|
|
3516
|
+
|
|
3517
|
+
// can match anything, as long as it's not this.
|
|
3518
|
+
if (this.negate) re = '^(?!' + re + ').*$'
|
|
3519
|
+
|
|
3520
|
+
try {
|
|
3521
|
+
this.regexp = new RegExp(re, flags)
|
|
3522
|
+
} catch (ex) /* istanbul ignore next - should be impossible */ {
|
|
3523
|
+
this.regexp = false
|
|
3524
|
+
}
|
|
3525
|
+
return this.regexp
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
minimatch.match = function (list, pattern, options) {
|
|
3529
|
+
options = options || {}
|
|
3530
|
+
var mm = new Minimatch(pattern, options)
|
|
3531
|
+
list = list.filter(function (f) {
|
|
3532
|
+
return mm.match(f)
|
|
3533
|
+
})
|
|
3534
|
+
if (mm.options.nonull && !list.length) {
|
|
3535
|
+
list.push(pattern)
|
|
3536
|
+
}
|
|
3537
|
+
return list
|
|
3538
|
+
}
|
|
3539
|
+
|
|
3540
|
+
Minimatch.prototype.match = function match (f, partial) {
|
|
3541
|
+
if (typeof partial === 'undefined') partial = this.partial
|
|
3542
|
+
this.debug('match', f, this.pattern)
|
|
3543
|
+
// short-circuit in the case of busted things.
|
|
3544
|
+
// comments, etc.
|
|
3545
|
+
if (this.comment) return false
|
|
3546
|
+
if (this.empty) return f === ''
|
|
3547
|
+
|
|
3548
|
+
if (f === '/' && partial) return true
|
|
3549
|
+
|
|
3550
|
+
var options = this.options
|
|
3551
|
+
|
|
3552
|
+
// windows: need to use /, not \
|
|
3553
|
+
if (path.sep !== '/') {
|
|
3554
|
+
f = f.split(path.sep).join('/')
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3557
|
+
// treat the test path as a set of pathparts.
|
|
3558
|
+
f = f.split(slashSplit)
|
|
3559
|
+
this.debug(this.pattern, 'split', f)
|
|
3560
|
+
|
|
3561
|
+
// just ONE of the pattern sets in this.set needs to match
|
|
3562
|
+
// in order for it to be valid. If negating, then just one
|
|
3563
|
+
// match means that we have failed.
|
|
3564
|
+
// Either way, return on the first hit.
|
|
3565
|
+
|
|
3566
|
+
var set = this.set
|
|
3567
|
+
this.debug(this.pattern, 'set', set)
|
|
3568
|
+
|
|
3569
|
+
// Find the basename of the path by looking for the last non-empty segment
|
|
3570
|
+
var filename
|
|
3571
|
+
var i
|
|
3572
|
+
for (i = f.length - 1; i >= 0; i--) {
|
|
3573
|
+
filename = f[i]
|
|
3574
|
+
if (filename) break
|
|
3575
|
+
}
|
|
3576
|
+
|
|
3577
|
+
for (i = 0; i < set.length; i++) {
|
|
3578
|
+
var pattern = set[i]
|
|
3579
|
+
var file = f
|
|
3580
|
+
if (options.matchBase && pattern.length === 1) {
|
|
3581
|
+
file = [filename]
|
|
3582
|
+
}
|
|
3583
|
+
var hit = this.matchOne(file, pattern, partial)
|
|
3584
|
+
if (hit) {
|
|
3585
|
+
if (options.flipNegate) return true
|
|
3586
|
+
return !this.negate
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
// didn't get any hits. this is success if it's a negative
|
|
3591
|
+
// pattern, failure otherwise.
|
|
3592
|
+
if (options.flipNegate) return false
|
|
3593
|
+
return this.negate
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3596
|
+
// set partial to true to test if, for example,
|
|
3597
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
3598
|
+
// Partial means, if you run out of file before you run
|
|
3599
|
+
// out of pattern, then that's fine, as long as all
|
|
3600
|
+
// the parts match.
|
|
3601
|
+
Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
|
3602
|
+
var options = this.options
|
|
3603
|
+
|
|
3604
|
+
this.debug('matchOne',
|
|
3605
|
+
{ 'this': this, file: file, pattern: pattern })
|
|
3606
|
+
|
|
3607
|
+
this.debug('matchOne', file.length, pattern.length)
|
|
3608
|
+
|
|
3609
|
+
for (var fi = 0,
|
|
3610
|
+
pi = 0,
|
|
3611
|
+
fl = file.length,
|
|
3612
|
+
pl = pattern.length
|
|
3613
|
+
; (fi < fl) && (pi < pl)
|
|
3614
|
+
; fi++, pi++) {
|
|
3615
|
+
this.debug('matchOne loop')
|
|
3616
|
+
var p = pattern[pi]
|
|
3617
|
+
var f = file[fi]
|
|
3618
|
+
|
|
3619
|
+
this.debug(pattern, p, f)
|
|
3620
|
+
|
|
3621
|
+
// should be impossible.
|
|
3622
|
+
// some invalid regexp stuff in the set.
|
|
3623
|
+
/* istanbul ignore if */
|
|
3624
|
+
if (p === false) return false
|
|
3625
|
+
|
|
3626
|
+
if (p === GLOBSTAR) {
|
|
3627
|
+
this.debug('GLOBSTAR', [pattern, p, f])
|
|
3628
|
+
|
|
3629
|
+
// "**"
|
|
3630
|
+
// a/**/b/**/c would match the following:
|
|
3631
|
+
// a/b/x/y/z/c
|
|
3632
|
+
// a/x/y/z/b/c
|
|
3633
|
+
// a/b/x/b/x/c
|
|
3634
|
+
// a/b/c
|
|
3635
|
+
// To do this, take the rest of the pattern after
|
|
3636
|
+
// the **, and see if it would match the file remainder.
|
|
3637
|
+
// If so, return success.
|
|
3638
|
+
// If not, the ** "swallows" a segment, and try again.
|
|
3639
|
+
// This is recursively awful.
|
|
3640
|
+
//
|
|
3641
|
+
// a/**/b/**/c matching a/b/x/y/z/c
|
|
3642
|
+
// - a matches a
|
|
3643
|
+
// - doublestar
|
|
3644
|
+
// - matchOne(b/x/y/z/c, b/**/c)
|
|
3645
|
+
// - b matches b
|
|
3646
|
+
// - doublestar
|
|
3647
|
+
// - matchOne(x/y/z/c, c) -> no
|
|
3648
|
+
// - matchOne(y/z/c, c) -> no
|
|
3649
|
+
// - matchOne(z/c, c) -> no
|
|
3650
|
+
// - matchOne(c, c) yes, hit
|
|
3651
|
+
var fr = fi
|
|
3652
|
+
var pr = pi + 1
|
|
3653
|
+
if (pr === pl) {
|
|
3654
|
+
this.debug('** at the end')
|
|
3655
|
+
// a ** at the end will just swallow the rest.
|
|
3656
|
+
// We have found a match.
|
|
3657
|
+
// however, it will not swallow /.x, unless
|
|
3658
|
+
// options.dot is set.
|
|
3659
|
+
// . and .. are *never* matched by **, for explosively
|
|
3660
|
+
// exponential reasons.
|
|
3661
|
+
for (; fi < fl; fi++) {
|
|
3662
|
+
if (file[fi] === '.' || file[fi] === '..' ||
|
|
3663
|
+
(!options.dot && file[fi].charAt(0) === '.')) return false
|
|
3664
|
+
}
|
|
3665
|
+
return true
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
// ok, let's see if we can swallow whatever we can.
|
|
3669
|
+
while (fr < fl) {
|
|
3670
|
+
var swallowee = file[fr]
|
|
3671
|
+
|
|
3672
|
+
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
|
|
3673
|
+
|
|
3674
|
+
// XXX remove this slice. Just pass the start index.
|
|
3675
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
3676
|
+
this.debug('globstar found match!', fr, fl, swallowee)
|
|
3677
|
+
// found a match.
|
|
3678
|
+
return true
|
|
3679
|
+
} else {
|
|
3680
|
+
// can't swallow "." or ".." ever.
|
|
3681
|
+
// can only swallow ".foo" when explicitly asked.
|
|
3682
|
+
if (swallowee === '.' || swallowee === '..' ||
|
|
3683
|
+
(!options.dot && swallowee.charAt(0) === '.')) {
|
|
3684
|
+
this.debug('dot detected!', file, fr, pattern, pr)
|
|
3685
|
+
break
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
// ** swallows a segment, and continue.
|
|
3689
|
+
this.debug('globstar swallow a segment, and continue')
|
|
3690
|
+
fr++
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
|
|
3694
|
+
// no match was found.
|
|
3695
|
+
// However, in partial mode, we can't say this is necessarily over.
|
|
3696
|
+
// If there's more *pattern* left, then
|
|
3697
|
+
/* istanbul ignore if */
|
|
3698
|
+
if (partial) {
|
|
3699
|
+
// ran out of file
|
|
3700
|
+
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
|
|
3701
|
+
if (fr === fl) return true
|
|
3702
|
+
}
|
|
3703
|
+
return false
|
|
3704
|
+
}
|
|
3705
|
+
|
|
3706
|
+
// something other than **
|
|
3707
|
+
// non-magic patterns just have to match exactly
|
|
3708
|
+
// patterns with magic have been turned into regexps.
|
|
3709
|
+
var hit
|
|
3710
|
+
if (typeof p === 'string') {
|
|
3711
|
+
hit = f === p
|
|
3712
|
+
this.debug('string match', p, f, hit)
|
|
3713
|
+
} else {
|
|
3714
|
+
hit = f.match(p)
|
|
3715
|
+
this.debug('pattern match', p, f, hit)
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
if (!hit) return false
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
// Note: ending in / means that we'll get a final ""
|
|
3722
|
+
// at the end of the pattern. This can only match a
|
|
3723
|
+
// corresponding "" at the end of the file.
|
|
3724
|
+
// If the file ends in /, then it can only match a
|
|
3725
|
+
// a pattern that ends in /, unless the pattern just
|
|
3726
|
+
// doesn't have any more for it. But, a/b/ should *not*
|
|
3727
|
+
// match "a/b/*", even though "" matches against the
|
|
3728
|
+
// [^/]*? pattern, except in partial mode, where it might
|
|
3729
|
+
// simply not be reached yet.
|
|
3730
|
+
// However, a/b/ should still satisfy a/*
|
|
3731
|
+
|
|
3732
|
+
// now either we fell off the end of the pattern, or we're done.
|
|
3733
|
+
if (fi === fl && pi === pl) {
|
|
3734
|
+
// ran out of pattern and filename at the same time.
|
|
3735
|
+
// an exact hit!
|
|
3736
|
+
return true
|
|
3737
|
+
} else if (fi === fl) {
|
|
3738
|
+
// ran out of file, but still had pattern left.
|
|
3739
|
+
// this is ok if we're doing the match as part of
|
|
3740
|
+
// a glob fs traversal.
|
|
3741
|
+
return partial
|
|
3742
|
+
} else /* istanbul ignore else */ if (pi === pl) {
|
|
3743
|
+
// ran out of pattern, still have file left.
|
|
3744
|
+
// this is only acceptable if we're on the very last
|
|
3745
|
+
// empty segment of a file with a trailing slash.
|
|
3746
|
+
// a/* should match a/b/
|
|
3747
|
+
return (fi === fl - 1) && (file[fi] === '')
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
// should be unreachable.
|
|
3751
|
+
/* istanbul ignore next */
|
|
3752
|
+
throw new Error('wtf?')
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
// replace stuff like \* with *
|
|
3756
|
+
function globUnescape (s) {
|
|
3757
|
+
return s.replace(/\\(.)/g, '$1')
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
function regExpEscape (s) {
|
|
3761
|
+
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
|
|
3765
|
+
/***/ }),
|
|
3766
|
+
|
|
3767
|
+
/***/ 778:
|
|
3768
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3769
|
+
|
|
3770
|
+
var wrappy = __webpack_require__(2479)
|
|
3771
|
+
module.exports = wrappy(once)
|
|
3772
|
+
module.exports.strict = wrappy(onceStrict)
|
|
3773
|
+
|
|
3774
|
+
once.proto = once(function () {
|
|
3775
|
+
Object.defineProperty(Function.prototype, 'once', {
|
|
3776
|
+
value: function () {
|
|
3777
|
+
return once(this)
|
|
3778
|
+
},
|
|
3779
|
+
configurable: true
|
|
3780
|
+
})
|
|
3781
|
+
|
|
3782
|
+
Object.defineProperty(Function.prototype, 'onceStrict', {
|
|
3783
|
+
value: function () {
|
|
3784
|
+
return onceStrict(this)
|
|
3785
|
+
},
|
|
3786
|
+
configurable: true
|
|
3787
|
+
})
|
|
3788
|
+
})
|
|
3789
|
+
|
|
3790
|
+
function once (fn) {
|
|
3791
|
+
var f = function () {
|
|
3792
|
+
if (f.called) return f.value
|
|
3793
|
+
f.called = true
|
|
3794
|
+
return f.value = fn.apply(this, arguments)
|
|
3795
|
+
}
|
|
3796
|
+
f.called = false
|
|
3797
|
+
return f
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
function onceStrict (fn) {
|
|
3801
|
+
var f = function () {
|
|
3802
|
+
if (f.called)
|
|
3803
|
+
throw new Error(f.onceError)
|
|
3804
|
+
f.called = true
|
|
3805
|
+
return f.value = fn.apply(this, arguments)
|
|
3806
|
+
}
|
|
3807
|
+
var name = fn.name || 'Function wrapped with `once`'
|
|
3808
|
+
f.onceError = name + " shouldn't be called more than once"
|
|
3809
|
+
f.called = false
|
|
3810
|
+
return f
|
|
3811
|
+
}
|
|
3812
|
+
|
|
3813
|
+
|
|
3814
|
+
/***/ }),
|
|
3815
|
+
|
|
3816
|
+
/***/ 4095:
|
|
3817
|
+
/***/ ((module) => {
|
|
3818
|
+
|
|
3819
|
+
"use strict";
|
|
3820
|
+
|
|
3821
|
+
|
|
3822
|
+
function posix(path) {
|
|
3823
|
+
return path.charAt(0) === '/';
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
function win32(path) {
|
|
3827
|
+
// https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
|
|
3828
|
+
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
3829
|
+
var result = splitDeviceRe.exec(path);
|
|
3830
|
+
var device = result[1] || '';
|
|
3831
|
+
var isUnc = Boolean(device && device.charAt(1) !== ':');
|
|
3832
|
+
|
|
3833
|
+
// UNC paths are always absolute
|
|
3834
|
+
return Boolean(result[2] || isUnc);
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
module.exports = process.platform === 'win32' ? win32 : posix;
|
|
3838
|
+
module.exports.posix = posix;
|
|
3839
|
+
module.exports.win32 = win32;
|
|
3840
|
+
|
|
3841
|
+
|
|
3842
|
+
/***/ }),
|
|
3843
|
+
|
|
3844
|
+
/***/ 2479:
|
|
3845
|
+
/***/ ((module) => {
|
|
3846
|
+
|
|
3847
|
+
// Returns a wrapper function that returns a wrapped callback
|
|
3848
|
+
// The wrapper function should do some stuff, and return a
|
|
3849
|
+
// presumably different callback function.
|
|
3850
|
+
// This makes sure that own properties are retained, so that
|
|
3851
|
+
// decorations and such are not lost along the way.
|
|
3852
|
+
module.exports = wrappy
|
|
3853
|
+
function wrappy (fn, cb) {
|
|
3854
|
+
if (fn && cb) return wrappy(fn)(cb)
|
|
3855
|
+
|
|
3856
|
+
if (typeof fn !== 'function')
|
|
3857
|
+
throw new TypeError('need wrapper function')
|
|
3858
|
+
|
|
3859
|
+
Object.keys(fn).forEach(function (k) {
|
|
3860
|
+
wrapper[k] = fn[k]
|
|
3861
|
+
})
|
|
3862
|
+
|
|
3863
|
+
return wrapper
|
|
3864
|
+
|
|
3865
|
+
function wrapper() {
|
|
3866
|
+
var args = new Array(arguments.length)
|
|
3867
|
+
for (var i = 0; i < args.length; i++) {
|
|
3868
|
+
args[i] = arguments[i]
|
|
3869
|
+
}
|
|
3870
|
+
var ret = fn.apply(this, args)
|
|
3871
|
+
var cb = args[args.length-1]
|
|
3872
|
+
if (typeof ret === 'function' && ret !== cb) {
|
|
3873
|
+
Object.keys(cb).forEach(function (k) {
|
|
3874
|
+
ret[k] = cb[k]
|
|
3875
|
+
})
|
|
3876
|
+
}
|
|
3877
|
+
return ret
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
|
|
3881
|
+
|
|
3882
|
+
/***/ }),
|
|
3883
|
+
|
|
3884
|
+
/***/ 9084:
|
|
3885
|
+
/***/ ((module) => {
|
|
3886
|
+
|
|
3887
|
+
"use strict";
|
|
3888
|
+
module.exports = require("assert");
|
|
3889
|
+
|
|
3890
|
+
/***/ }),
|
|
3891
|
+
|
|
3892
|
+
/***/ 6231:
|
|
3893
|
+
/***/ ((module) => {
|
|
3894
|
+
|
|
3895
|
+
"use strict";
|
|
3896
|
+
module.exports = require("fs");
|
|
3897
|
+
|
|
3898
|
+
/***/ }),
|
|
3899
|
+
|
|
3900
|
+
/***/ 1423:
|
|
3901
|
+
/***/ ((module) => {
|
|
3902
|
+
|
|
3903
|
+
"use strict";
|
|
3904
|
+
module.exports = require("path");
|
|
3905
|
+
|
|
3906
|
+
/***/ }),
|
|
3907
|
+
|
|
3908
|
+
/***/ 6464:
|
|
3909
|
+
/***/ ((module) => {
|
|
3910
|
+
|
|
3911
|
+
"use strict";
|
|
3912
|
+
module.exports = require("util");
|
|
3913
|
+
|
|
3914
|
+
/***/ })
|
|
3915
|
+
|
|
3916
|
+
/******/ });
|
|
3917
|
+
/************************************************************************/
|
|
3918
|
+
/******/ // The module cache
|
|
3919
|
+
/******/ var __webpack_module_cache__ = {};
|
|
3920
|
+
/******/
|
|
3921
|
+
/******/ // The require function
|
|
3922
|
+
/******/ function __webpack_require__(moduleId) {
|
|
3923
|
+
/******/ // Check if module is in cache
|
|
3924
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
3925
|
+
/******/ if (cachedModule !== undefined) {
|
|
3926
|
+
/******/ return cachedModule.exports;
|
|
3927
|
+
/******/ }
|
|
3928
|
+
/******/ // Create a new module (and put it into the cache)
|
|
3929
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
3930
|
+
/******/ // no module.id needed
|
|
3931
|
+
/******/ // no module.loaded needed
|
|
3932
|
+
/******/ exports: {}
|
|
3933
|
+
/******/ };
|
|
3934
|
+
/******/
|
|
3935
|
+
/******/ // Execute the module function
|
|
3936
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
3937
|
+
/******/
|
|
3938
|
+
/******/ // Return the exports of the module
|
|
3939
|
+
/******/ return module.exports;
|
|
3940
|
+
/******/ }
|
|
3941
|
+
/******/
|
|
3942
|
+
/************************************************************************/
|
|
3943
|
+
/******/ /* webpack/runtime/define property getters */
|
|
3944
|
+
/******/ (() => {
|
|
3945
|
+
/******/ // define getter functions for harmony exports
|
|
3946
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
3947
|
+
/******/ for(var key in definition) {
|
|
3948
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
3949
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
3950
|
+
/******/ }
|
|
3951
|
+
/******/ }
|
|
3952
|
+
/******/ };
|
|
3953
|
+
/******/ })();
|
|
3954
|
+
/******/
|
|
3955
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
3956
|
+
/******/ (() => {
|
|
3957
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
3958
|
+
/******/ })();
|
|
3959
|
+
/******/
|
|
3960
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
3961
|
+
/******/ (() => {
|
|
3962
|
+
/******/ // define __esModule on exports
|
|
3963
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
3964
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
3965
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3966
|
+
/******/ }
|
|
3967
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
3968
|
+
/******/ };
|
|
3969
|
+
/******/ })();
|
|
3970
|
+
/******/
|
|
3971
|
+
/************************************************************************/
|
|
3972
|
+
var __webpack_exports__ = {};
|
|
3973
|
+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
3974
|
+
(() => {
|
|
3975
|
+
"use strict";
|
|
3976
|
+
// ESM COMPAT FLAG
|
|
3977
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3978
|
+
|
|
3979
|
+
// EXPORTS
|
|
3980
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
3981
|
+
"appSupport": () => (/* binding */ appSupport),
|
|
3982
|
+
"connectiq": () => (/* binding */ connectiq),
|
|
3983
|
+
"copyRecursiveAsNeeded": () => (/* binding */ copyRecursiveAsNeeded),
|
|
3984
|
+
"first_modified": () => (/* binding */ first_modified),
|
|
3985
|
+
"getSdkPath": () => (/* binding */ getSdkPath),
|
|
3986
|
+
"globa": () => (/* binding */ globa),
|
|
3987
|
+
"isWin": () => (/* binding */ isWin),
|
|
3988
|
+
"last_modified": () => (/* binding */ last_modified),
|
|
3989
|
+
"promiseAll": () => (/* binding */ promiseAll),
|
|
3990
|
+
"pushUnique": () => (/* binding */ pushUnique),
|
|
3991
|
+
"readByLine": () => (/* binding */ readByLine),
|
|
3992
|
+
"spawnByLine": () => (/* binding */ spawnByLine)
|
|
3993
|
+
});
|
|
3994
|
+
|
|
3995
|
+
;// CONCATENATED MODULE: external "child_process"
|
|
3996
|
+
const external_child_process_namespaceObject = require("child_process");
|
|
3997
|
+
// EXTERNAL MODULE: external "fs"
|
|
3998
|
+
var external_fs_ = __webpack_require__(6231);
|
|
3999
|
+
;// CONCATENATED MODULE: external "fs/promises"
|
|
4000
|
+
const promises_namespaceObject = require("fs/promises");
|
|
4001
|
+
// EXTERNAL MODULE: ./node_modules/glob/glob.js
|
|
4002
|
+
var glob = __webpack_require__(2884);
|
|
4003
|
+
// EXTERNAL MODULE: external "path"
|
|
4004
|
+
var external_path_ = __webpack_require__(1423);
|
|
4005
|
+
;// CONCATENATED MODULE: external "readline"
|
|
4006
|
+
const external_readline_namespaceObject = require("readline");
|
|
4007
|
+
;// CONCATENATED MODULE: ./src/util.js
|
|
4008
|
+
|
|
4009
|
+
|
|
4010
|
+
|
|
4011
|
+
|
|
4012
|
+
|
|
4013
|
+
|
|
4014
|
+
|
|
4015
|
+
const isWin = process.platform == "win32";
|
|
4016
|
+
|
|
4017
|
+
const appSupport = isWin
|
|
4018
|
+
? `${process.env.APPDATA}`.replace(/\\/g, "/")
|
|
4019
|
+
: `${process.env.HOME}/Library/Application Support`;
|
|
4020
|
+
|
|
4021
|
+
const connectiq = `${appSupport}/Garmin/ConnectIQ`;
|
|
4022
|
+
|
|
4023
|
+
function getSdkPath() {
|
|
4024
|
+
return promises_namespaceObject.readFile(connectiq + "/current-sdk.cfg")
|
|
4025
|
+
.then((contents) => contents.toString().replace(/^\s*(.*?)\s*$/s, "$1"));
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
function globa(pattern, options) {
|
|
4029
|
+
return new Promise((resolve, reject) => {
|
|
4030
|
+
glob.glob(pattern, options, (er, files) => {
|
|
4031
|
+
if (er) {
|
|
4032
|
+
reject(files);
|
|
4033
|
+
} else {
|
|
4034
|
+
resolve(files);
|
|
4035
|
+
}
|
|
4036
|
+
});
|
|
4037
|
+
});
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
async function modified_times(inputs, missing) {
|
|
4041
|
+
return Promise.all(
|
|
4042
|
+
inputs.map(async (path) => {
|
|
4043
|
+
try {
|
|
4044
|
+
const stat = await promises_namespaceObject.stat(path);
|
|
4045
|
+
return stat.mtimeMs;
|
|
4046
|
+
} catch (e) {
|
|
4047
|
+
return missing;
|
|
4048
|
+
}
|
|
4049
|
+
})
|
|
4050
|
+
);
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
async function last_modified(inputs) {
|
|
4054
|
+
return Math.max(...(await modified_times(inputs, Infinity)));
|
|
4055
|
+
}
|
|
4056
|
+
|
|
4057
|
+
async function first_modified(inputs) {
|
|
4058
|
+
return Math.min(...(await modified_times(inputs, 0)));
|
|
4059
|
+
}
|
|
4060
|
+
|
|
4061
|
+
function pushUnique(arr, value) {
|
|
4062
|
+
if (arr.find((v) => v === value) != null) return;
|
|
4063
|
+
arr.push(value);
|
|
4064
|
+
}
|
|
4065
|
+
|
|
4066
|
+
// return a promise that will process the output of command
|
|
4067
|
+
// line-by-line via lineHandlers.
|
|
4068
|
+
function spawnByLine(command, args, lineHandlers, options) {
|
|
4069
|
+
const [lineHandler, errHandler] = Array.isArray(lineHandlers)
|
|
4070
|
+
? lineHandlers
|
|
4071
|
+
: [lineHandlers, (data) => console.error(data.toString())];
|
|
4072
|
+
return new Promise((resolve, reject) => {
|
|
4073
|
+
const proc = external_child_process_namespaceObject.spawn(command, args, {
|
|
4074
|
+
...(options || {}),
|
|
4075
|
+
shell: false,
|
|
4076
|
+
});
|
|
4077
|
+
const rl = external_readline_namespaceObject.createInterface({
|
|
4078
|
+
input: proc.stdout,
|
|
4079
|
+
});
|
|
4080
|
+
const rle = external_readline_namespaceObject.createInterface({
|
|
4081
|
+
input: proc.stderr,
|
|
4082
|
+
});
|
|
4083
|
+
proc.on("error", reject);
|
|
4084
|
+
rle.on("line", errHandler);
|
|
4085
|
+
rl.on("line", lineHandler);
|
|
4086
|
+
proc.on("close", (code) => {
|
|
4087
|
+
if (code == 0) resolve();
|
|
4088
|
+
reject(code);
|
|
4089
|
+
});
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4093
|
+
// return a promise that will process file
|
|
4094
|
+
// line-by-line via lineHandler.
|
|
4095
|
+
function readByLine(file, lineHandler) {
|
|
4096
|
+
return promises_namespaceObject.open(file, "r").then(
|
|
4097
|
+
(fh) =>
|
|
4098
|
+
new Promise((resolve, _reject) => {
|
|
4099
|
+
const stream = fh.createReadStream();
|
|
4100
|
+
const rl = external_readline_namespaceObject.createInterface({
|
|
4101
|
+
input: stream,
|
|
4102
|
+
});
|
|
4103
|
+
rl.on("line", lineHandler);
|
|
4104
|
+
stream.on("close", resolve);
|
|
4105
|
+
})
|
|
4106
|
+
);
|
|
4107
|
+
}
|
|
4108
|
+
|
|
4109
|
+
async function promiseAll(promises, parallelism) {
|
|
4110
|
+
parallelism = parallelism || 4;
|
|
4111
|
+
const serializer = [];
|
|
4112
|
+
promises.forEach((p, i) => {
|
|
4113
|
+
if (serializer.length < parallelism) {
|
|
4114
|
+
serializer.push(p);
|
|
4115
|
+
} else {
|
|
4116
|
+
serializer[i % parallelism].then(() => p);
|
|
4117
|
+
}
|
|
4118
|
+
});
|
|
4119
|
+
return Promise.all(serializer);
|
|
4120
|
+
}
|
|
4121
|
+
|
|
4122
|
+
async function copyRecursiveAsNeeded(source, target, filter) {
|
|
4123
|
+
const fstat = promises_namespaceObject.stat;
|
|
4124
|
+
const sstat = await fstat(source);
|
|
4125
|
+
if (sstat.isDirectory()) {
|
|
4126
|
+
const stat = await fstat(target).catch(() => null);
|
|
4127
|
+
|
|
4128
|
+
if (!stat || !stat.isDirectory()) {
|
|
4129
|
+
stat && (await promises_namespaceObject.rm(target, { force: true }));
|
|
4130
|
+
await promises_namespaceObject.mkdir(target, { recursive: true });
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
const files = await promises_namespaceObject.readdir(source);
|
|
4134
|
+
return Promise.all(
|
|
4135
|
+
files.map((file) => {
|
|
4136
|
+
var src = external_path_.join(source, file);
|
|
4137
|
+
var tgt = external_path_.join(target, file);
|
|
4138
|
+
return copyRecursiveAsNeeded(src, tgt, filter);
|
|
4139
|
+
})
|
|
4140
|
+
);
|
|
4141
|
+
} else {
|
|
4142
|
+
if (filter && !filter(source, target)) {
|
|
4143
|
+
return;
|
|
4144
|
+
}
|
|
4145
|
+
const tstat = await fstat(target).catch(() => null);
|
|
4146
|
+
if (!tstat || tstat.mtimeMs < sstat.mtimeMs) {
|
|
4147
|
+
console.log(`Copying ${source} to ${target}...`);
|
|
4148
|
+
return promises_namespaceObject.copyFile(source, target, external_fs_.constants.COPYFILE_FICLONE);
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
})();
|
|
4154
|
+
|
|
4155
|
+
var __webpack_export_target__ = exports;
|
|
4156
|
+
for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
|
|
4157
|
+
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
|
|
4158
|
+
/******/ })()
|
|
4159
|
+
;
|