jiek 2.3.1 → 2.3.2

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.
@@ -0,0 +1,4135 @@
1
+ 'use strict';
2
+
3
+ var require$$0 = require('util');
4
+ var require$$0$1 = require('path');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var require$$0__default = /*#__PURE__*/_interopDefault(require$$0);
9
+ var require$$0__default$1 = /*#__PURE__*/_interopDefault(require$$0$1);
10
+
11
+ var utils$1 = {};
12
+
13
+ var hasRequiredUtils$1;
14
+
15
+ function requireUtils$1 () {
16
+ if (hasRequiredUtils$1) return utils$1;
17
+ hasRequiredUtils$1 = 1;
18
+ (function (exports) {
19
+
20
+ exports.isInteger = num => {
21
+ if (typeof num === 'number') {
22
+ return Number.isInteger(num);
23
+ }
24
+ if (typeof num === 'string' && num.trim() !== '') {
25
+ return Number.isInteger(Number(num));
26
+ }
27
+ return false;
28
+ };
29
+
30
+ /**
31
+ * Find a node of the given type
32
+ */
33
+
34
+ exports.find = (node, type) => node.nodes.find(node => node.type === type);
35
+
36
+ /**
37
+ * Find a node of the given type
38
+ */
39
+
40
+ exports.exceedsLimit = (min, max, step = 1, limit) => {
41
+ if (limit === false) return false;
42
+ if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
43
+ return ((Number(max) - Number(min)) / Number(step)) >= limit;
44
+ };
45
+
46
+ /**
47
+ * Escape the given node with '\\' before node.value
48
+ */
49
+
50
+ exports.escapeNode = (block, n = 0, type) => {
51
+ let node = block.nodes[n];
52
+ if (!node) return;
53
+
54
+ if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
55
+ if (node.escaped !== true) {
56
+ node.value = '\\' + node.value;
57
+ node.escaped = true;
58
+ }
59
+ }
60
+ };
61
+
62
+ /**
63
+ * Returns true if the given brace node should be enclosed in literal braces
64
+ */
65
+
66
+ exports.encloseBrace = node => {
67
+ if (node.type !== 'brace') return false;
68
+ if ((node.commas >> 0 + node.ranges >> 0) === 0) {
69
+ node.invalid = true;
70
+ return true;
71
+ }
72
+ return false;
73
+ };
74
+
75
+ /**
76
+ * Returns true if a brace node is invalid.
77
+ */
78
+
79
+ exports.isInvalidBrace = block => {
80
+ if (block.type !== 'brace') return false;
81
+ if (block.invalid === true || block.dollar) return true;
82
+ if ((block.commas >> 0 + block.ranges >> 0) === 0) {
83
+ block.invalid = true;
84
+ return true;
85
+ }
86
+ if (block.open !== true || block.close !== true) {
87
+ block.invalid = true;
88
+ return true;
89
+ }
90
+ return false;
91
+ };
92
+
93
+ /**
94
+ * Returns true if a node is an open or close node
95
+ */
96
+
97
+ exports.isOpenOrClose = node => {
98
+ if (node.type === 'open' || node.type === 'close') {
99
+ return true;
100
+ }
101
+ return node.open === true || node.close === true;
102
+ };
103
+
104
+ /**
105
+ * Reduce an array of text nodes.
106
+ */
107
+
108
+ exports.reduce = nodes => nodes.reduce((acc, node) => {
109
+ if (node.type === 'text') acc.push(node.value);
110
+ if (node.type === 'range') node.type = 'text';
111
+ return acc;
112
+ }, []);
113
+
114
+ /**
115
+ * Flatten an array
116
+ */
117
+
118
+ exports.flatten = (...args) => {
119
+ const result = [];
120
+ const flat = arr => {
121
+ for (let i = 0; i < arr.length; i++) {
122
+ let ele = arr[i];
123
+ Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele);
124
+ }
125
+ return result;
126
+ };
127
+ flat(args);
128
+ return result;
129
+ };
130
+ } (utils$1));
131
+ return utils$1;
132
+ }
133
+
134
+ var stringify;
135
+ var hasRequiredStringify;
136
+
137
+ function requireStringify () {
138
+ if (hasRequiredStringify) return stringify;
139
+ hasRequiredStringify = 1;
140
+
141
+ const utils = requireUtils$1();
142
+
143
+ stringify = (ast, options = {}) => {
144
+ let stringify = (node, parent = {}) => {
145
+ let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
146
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
147
+ let output = '';
148
+
149
+ if (node.value) {
150
+ if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
151
+ return '\\' + node.value;
152
+ }
153
+ return node.value;
154
+ }
155
+
156
+ if (node.value) {
157
+ return node.value;
158
+ }
159
+
160
+ if (node.nodes) {
161
+ for (let child of node.nodes) {
162
+ output += stringify(child);
163
+ }
164
+ }
165
+ return output;
166
+ };
167
+
168
+ return stringify(ast);
169
+ };
170
+ return stringify;
171
+ }
172
+
173
+ /*!
174
+ * is-number <https://github.com/jonschlinkert/is-number>
175
+ *
176
+ * Copyright (c) 2014-present, Jon Schlinkert.
177
+ * Released under the MIT License.
178
+ */
179
+
180
+ var isNumber;
181
+ var hasRequiredIsNumber;
182
+
183
+ function requireIsNumber () {
184
+ if (hasRequiredIsNumber) return isNumber;
185
+ hasRequiredIsNumber = 1;
186
+
187
+ isNumber = function(num) {
188
+ if (typeof num === 'number') {
189
+ return num - num === 0;
190
+ }
191
+ if (typeof num === 'string' && num.trim() !== '') {
192
+ return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
193
+ }
194
+ return false;
195
+ };
196
+ return isNumber;
197
+ }
198
+
199
+ /*!
200
+ * to-regex-range <https://github.com/micromatch/to-regex-range>
201
+ *
202
+ * Copyright (c) 2015-present, Jon Schlinkert.
203
+ * Released under the MIT License.
204
+ */
205
+
206
+ var toRegexRange_1;
207
+ var hasRequiredToRegexRange;
208
+
209
+ function requireToRegexRange () {
210
+ if (hasRequiredToRegexRange) return toRegexRange_1;
211
+ hasRequiredToRegexRange = 1;
212
+
213
+ const isNumber = requireIsNumber();
214
+
215
+ const toRegexRange = (min, max, options) => {
216
+ if (isNumber(min) === false) {
217
+ throw new TypeError('toRegexRange: expected the first argument to be a number');
218
+ }
219
+
220
+ if (max === void 0 || min === max) {
221
+ return String(min);
222
+ }
223
+
224
+ if (isNumber(max) === false) {
225
+ throw new TypeError('toRegexRange: expected the second argument to be a number.');
226
+ }
227
+
228
+ let opts = { relaxZeros: true, ...options };
229
+ if (typeof opts.strictZeros === 'boolean') {
230
+ opts.relaxZeros = opts.strictZeros === false;
231
+ }
232
+
233
+ let relax = String(opts.relaxZeros);
234
+ let shorthand = String(opts.shorthand);
235
+ let capture = String(opts.capture);
236
+ let wrap = String(opts.wrap);
237
+ let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;
238
+
239
+ if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
240
+ return toRegexRange.cache[cacheKey].result;
241
+ }
242
+
243
+ let a = Math.min(min, max);
244
+ let b = Math.max(min, max);
245
+
246
+ if (Math.abs(a - b) === 1) {
247
+ let result = min + '|' + max;
248
+ if (opts.capture) {
249
+ return `(${result})`;
250
+ }
251
+ if (opts.wrap === false) {
252
+ return result;
253
+ }
254
+ return `(?:${result})`;
255
+ }
256
+
257
+ let isPadded = hasPadding(min) || hasPadding(max);
258
+ let state = { min, max, a, b };
259
+ let positives = [];
260
+ let negatives = [];
261
+
262
+ if (isPadded) {
263
+ state.isPadded = isPadded;
264
+ state.maxLen = String(state.max).length;
265
+ }
266
+
267
+ if (a < 0) {
268
+ let newMin = b < 0 ? Math.abs(b) : 1;
269
+ negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
270
+ a = state.a = 0;
271
+ }
272
+
273
+ if (b >= 0) {
274
+ positives = splitToPatterns(a, b, state, opts);
275
+ }
276
+
277
+ state.negatives = negatives;
278
+ state.positives = positives;
279
+ state.result = collatePatterns(negatives, positives);
280
+
281
+ if (opts.capture === true) {
282
+ state.result = `(${state.result})`;
283
+ } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) {
284
+ state.result = `(?:${state.result})`;
285
+ }
286
+
287
+ toRegexRange.cache[cacheKey] = state;
288
+ return state.result;
289
+ };
290
+
291
+ function collatePatterns(neg, pos, options) {
292
+ let onlyNegative = filterPatterns(neg, pos, '-', false) || [];
293
+ let onlyPositive = filterPatterns(pos, neg, '', false) || [];
294
+ let intersected = filterPatterns(neg, pos, '-?', true) || [];
295
+ let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
296
+ return subpatterns.join('|');
297
+ }
298
+
299
+ function splitToRanges(min, max) {
300
+ let nines = 1;
301
+ let zeros = 1;
302
+
303
+ let stop = countNines(min, nines);
304
+ let stops = new Set([max]);
305
+
306
+ while (min <= stop && stop <= max) {
307
+ stops.add(stop);
308
+ nines += 1;
309
+ stop = countNines(min, nines);
310
+ }
311
+
312
+ stop = countZeros(max + 1, zeros) - 1;
313
+
314
+ while (min < stop && stop <= max) {
315
+ stops.add(stop);
316
+ zeros += 1;
317
+ stop = countZeros(max + 1, zeros) - 1;
318
+ }
319
+
320
+ stops = [...stops];
321
+ stops.sort(compare);
322
+ return stops;
323
+ }
324
+
325
+ /**
326
+ * Convert a range to a regex pattern
327
+ * @param {Number} `start`
328
+ * @param {Number} `stop`
329
+ * @return {String}
330
+ */
331
+
332
+ function rangeToPattern(start, stop, options) {
333
+ if (start === stop) {
334
+ return { pattern: start, count: [], digits: 0 };
335
+ }
336
+
337
+ let zipped = zip(start, stop);
338
+ let digits = zipped.length;
339
+ let pattern = '';
340
+ let count = 0;
341
+
342
+ for (let i = 0; i < digits; i++) {
343
+ let [startDigit, stopDigit] = zipped[i];
344
+
345
+ if (startDigit === stopDigit) {
346
+ pattern += startDigit;
347
+
348
+ } else if (startDigit !== '0' || stopDigit !== '9') {
349
+ pattern += toCharacterClass(startDigit, stopDigit);
350
+
351
+ } else {
352
+ count++;
353
+ }
354
+ }
355
+
356
+ if (count) {
357
+ pattern += options.shorthand === true ? '\\d' : '[0-9]';
358
+ }
359
+
360
+ return { pattern, count: [count], digits };
361
+ }
362
+
363
+ function splitToPatterns(min, max, tok, options) {
364
+ let ranges = splitToRanges(min, max);
365
+ let tokens = [];
366
+ let start = min;
367
+ let prev;
368
+
369
+ for (let i = 0; i < ranges.length; i++) {
370
+ let max = ranges[i];
371
+ let obj = rangeToPattern(String(start), String(max), options);
372
+ let zeros = '';
373
+
374
+ if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
375
+ if (prev.count.length > 1) {
376
+ prev.count.pop();
377
+ }
378
+
379
+ prev.count.push(obj.count[0]);
380
+ prev.string = prev.pattern + toQuantifier(prev.count);
381
+ start = max + 1;
382
+ continue;
383
+ }
384
+
385
+ if (tok.isPadded) {
386
+ zeros = padZeros(max, tok, options);
387
+ }
388
+
389
+ obj.string = zeros + obj.pattern + toQuantifier(obj.count);
390
+ tokens.push(obj);
391
+ start = max + 1;
392
+ prev = obj;
393
+ }
394
+
395
+ return tokens;
396
+ }
397
+
398
+ function filterPatterns(arr, comparison, prefix, intersection, options) {
399
+ let result = [];
400
+
401
+ for (let ele of arr) {
402
+ let { string } = ele;
403
+
404
+ // only push if _both_ are negative...
405
+ if (!intersection && !contains(comparison, 'string', string)) {
406
+ result.push(prefix + string);
407
+ }
408
+
409
+ // or _both_ are positive
410
+ if (intersection && contains(comparison, 'string', string)) {
411
+ result.push(prefix + string);
412
+ }
413
+ }
414
+ return result;
415
+ }
416
+
417
+ /**
418
+ * Zip strings
419
+ */
420
+
421
+ function zip(a, b) {
422
+ let arr = [];
423
+ for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
424
+ return arr;
425
+ }
426
+
427
+ function compare(a, b) {
428
+ return a > b ? 1 : b > a ? -1 : 0;
429
+ }
430
+
431
+ function contains(arr, key, val) {
432
+ return arr.some(ele => ele[key] === val);
433
+ }
434
+
435
+ function countNines(min, len) {
436
+ return Number(String(min).slice(0, -len) + '9'.repeat(len));
437
+ }
438
+
439
+ function countZeros(integer, zeros) {
440
+ return integer - (integer % Math.pow(10, zeros));
441
+ }
442
+
443
+ function toQuantifier(digits) {
444
+ let [start = 0, stop = ''] = digits;
445
+ if (stop || start > 1) {
446
+ return `{${start + (stop ? ',' + stop : '')}}`;
447
+ }
448
+ return '';
449
+ }
450
+
451
+ function toCharacterClass(a, b, options) {
452
+ return `[${a}${(b - a === 1) ? '' : '-'}${b}]`;
453
+ }
454
+
455
+ function hasPadding(str) {
456
+ return /^-?(0+)\d/.test(str);
457
+ }
458
+
459
+ function padZeros(value, tok, options) {
460
+ if (!tok.isPadded) {
461
+ return value;
462
+ }
463
+
464
+ let diff = Math.abs(tok.maxLen - String(value).length);
465
+ let relax = options.relaxZeros !== false;
466
+
467
+ switch (diff) {
468
+ case 0:
469
+ return '';
470
+ case 1:
471
+ return relax ? '0?' : '0';
472
+ case 2:
473
+ return relax ? '0{0,2}' : '00';
474
+ default: {
475
+ return relax ? `0{0,${diff}}` : `0{${diff}}`;
476
+ }
477
+ }
478
+ }
479
+
480
+ /**
481
+ * Cache
482
+ */
483
+
484
+ toRegexRange.cache = {};
485
+ toRegexRange.clearCache = () => (toRegexRange.cache = {});
486
+
487
+ /**
488
+ * Expose `toRegexRange`
489
+ */
490
+
491
+ toRegexRange_1 = toRegexRange;
492
+ return toRegexRange_1;
493
+ }
494
+
495
+ /*!
496
+ * fill-range <https://github.com/jonschlinkert/fill-range>
497
+ *
498
+ * Copyright (c) 2014-present, Jon Schlinkert.
499
+ * Licensed under the MIT License.
500
+ */
501
+
502
+ var fillRange;
503
+ var hasRequiredFillRange;
504
+
505
+ function requireFillRange () {
506
+ if (hasRequiredFillRange) return fillRange;
507
+ hasRequiredFillRange = 1;
508
+
509
+ const util = require$$0__default.default;
510
+ const toRegexRange = requireToRegexRange();
511
+
512
+ const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
513
+
514
+ const transform = toNumber => {
515
+ return value => toNumber === true ? Number(value) : String(value);
516
+ };
517
+
518
+ const isValidValue = value => {
519
+ return typeof value === 'number' || (typeof value === 'string' && value !== '');
520
+ };
521
+
522
+ const isNumber = num => Number.isInteger(+num);
523
+
524
+ const zeros = input => {
525
+ let value = `${input}`;
526
+ let index = -1;
527
+ if (value[0] === '-') value = value.slice(1);
528
+ if (value === '0') return false;
529
+ while (value[++index] === '0');
530
+ return index > 0;
531
+ };
532
+
533
+ const stringify = (start, end, options) => {
534
+ if (typeof start === 'string' || typeof end === 'string') {
535
+ return true;
536
+ }
537
+ return options.stringify === true;
538
+ };
539
+
540
+ const pad = (input, maxLength, toNumber) => {
541
+ if (maxLength > 0) {
542
+ let dash = input[0] === '-' ? '-' : '';
543
+ if (dash) input = input.slice(1);
544
+ input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0'));
545
+ }
546
+ if (toNumber === false) {
547
+ return String(input);
548
+ }
549
+ return input;
550
+ };
551
+
552
+ const toMaxLen = (input, maxLength) => {
553
+ let negative = input[0] === '-' ? '-' : '';
554
+ if (negative) {
555
+ input = input.slice(1);
556
+ maxLength--;
557
+ }
558
+ while (input.length < maxLength) input = '0' + input;
559
+ return negative ? ('-' + input) : input;
560
+ };
561
+
562
+ const toSequence = (parts, options) => {
563
+ parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
564
+ parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
565
+
566
+ let prefix = options.capture ? '' : '?:';
567
+ let positives = '';
568
+ let negatives = '';
569
+ let result;
570
+
571
+ if (parts.positives.length) {
572
+ positives = parts.positives.join('|');
573
+ }
574
+
575
+ if (parts.negatives.length) {
576
+ negatives = `-(${prefix}${parts.negatives.join('|')})`;
577
+ }
578
+
579
+ if (positives && negatives) {
580
+ result = `${positives}|${negatives}`;
581
+ } else {
582
+ result = positives || negatives;
583
+ }
584
+
585
+ if (options.wrap) {
586
+ return `(${prefix}${result})`;
587
+ }
588
+
589
+ return result;
590
+ };
591
+
592
+ const toRange = (a, b, isNumbers, options) => {
593
+ if (isNumbers) {
594
+ return toRegexRange(a, b, { wrap: false, ...options });
595
+ }
596
+
597
+ let start = String.fromCharCode(a);
598
+ if (a === b) return start;
599
+
600
+ let stop = String.fromCharCode(b);
601
+ return `[${start}-${stop}]`;
602
+ };
603
+
604
+ const toRegex = (start, end, options) => {
605
+ if (Array.isArray(start)) {
606
+ let wrap = options.wrap === true;
607
+ let prefix = options.capture ? '' : '?:';
608
+ return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
609
+ }
610
+ return toRegexRange(start, end, options);
611
+ };
612
+
613
+ const rangeError = (...args) => {
614
+ return new RangeError('Invalid range arguments: ' + util.inspect(...args));
615
+ };
616
+
617
+ const invalidRange = (start, end, options) => {
618
+ if (options.strictRanges === true) throw rangeError([start, end]);
619
+ return [];
620
+ };
621
+
622
+ const invalidStep = (step, options) => {
623
+ if (options.strictRanges === true) {
624
+ throw new TypeError(`Expected step "${step}" to be a number`);
625
+ }
626
+ return [];
627
+ };
628
+
629
+ const fillNumbers = (start, end, step = 1, options = {}) => {
630
+ let a = Number(start);
631
+ let b = Number(end);
632
+
633
+ if (!Number.isInteger(a) || !Number.isInteger(b)) {
634
+ if (options.strictRanges === true) throw rangeError([start, end]);
635
+ return [];
636
+ }
637
+
638
+ // fix negative zero
639
+ if (a === 0) a = 0;
640
+ if (b === 0) b = 0;
641
+
642
+ let descending = a > b;
643
+ let startString = String(start);
644
+ let endString = String(end);
645
+ let stepString = String(step);
646
+ step = Math.max(Math.abs(step), 1);
647
+
648
+ let padded = zeros(startString) || zeros(endString) || zeros(stepString);
649
+ let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
650
+ let toNumber = padded === false && stringify(start, end, options) === false;
651
+ let format = options.transform || transform(toNumber);
652
+
653
+ if (options.toRegex && step === 1) {
654
+ return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
655
+ }
656
+
657
+ let parts = { negatives: [], positives: [] };
658
+ let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
659
+ let range = [];
660
+ let index = 0;
661
+
662
+ while (descending ? a >= b : a <= b) {
663
+ if (options.toRegex === true && step > 1) {
664
+ push(a);
665
+ } else {
666
+ range.push(pad(format(a, index), maxLen, toNumber));
667
+ }
668
+ a = descending ? a - step : a + step;
669
+ index++;
670
+ }
671
+
672
+ if (options.toRegex === true) {
673
+ return step > 1
674
+ ? toSequence(parts, options)
675
+ : toRegex(range, null, { wrap: false, ...options });
676
+ }
677
+
678
+ return range;
679
+ };
680
+
681
+ const fillLetters = (start, end, step = 1, options = {}) => {
682
+ if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
683
+ return invalidRange(start, end, options);
684
+ }
685
+
686
+
687
+ let format = options.transform || (val => String.fromCharCode(val));
688
+ let a = `${start}`.charCodeAt(0);
689
+ let b = `${end}`.charCodeAt(0);
690
+
691
+ let descending = a > b;
692
+ let min = Math.min(a, b);
693
+ let max = Math.max(a, b);
694
+
695
+ if (options.toRegex && step === 1) {
696
+ return toRange(min, max, false, options);
697
+ }
698
+
699
+ let range = [];
700
+ let index = 0;
701
+
702
+ while (descending ? a >= b : a <= b) {
703
+ range.push(format(a, index));
704
+ a = descending ? a - step : a + step;
705
+ index++;
706
+ }
707
+
708
+ if (options.toRegex === true) {
709
+ return toRegex(range, null, { wrap: false, options });
710
+ }
711
+
712
+ return range;
713
+ };
714
+
715
+ const fill = (start, end, step, options = {}) => {
716
+ if (end == null && isValidValue(start)) {
717
+ return [start];
718
+ }
719
+
720
+ if (!isValidValue(start) || !isValidValue(end)) {
721
+ return invalidRange(start, end, options);
722
+ }
723
+
724
+ if (typeof step === 'function') {
725
+ return fill(start, end, 1, { transform: step });
726
+ }
727
+
728
+ if (isObject(step)) {
729
+ return fill(start, end, 0, step);
730
+ }
731
+
732
+ let opts = { ...options };
733
+ if (opts.capture === true) opts.wrap = true;
734
+ step = step || opts.step || 1;
735
+
736
+ if (!isNumber(step)) {
737
+ if (step != null && !isObject(step)) return invalidStep(step, opts);
738
+ return fill(start, end, 1, step);
739
+ }
740
+
741
+ if (isNumber(start) && isNumber(end)) {
742
+ return fillNumbers(start, end, step, opts);
743
+ }
744
+
745
+ return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
746
+ };
747
+
748
+ fillRange = fill;
749
+ return fillRange;
750
+ }
751
+
752
+ var compile_1;
753
+ var hasRequiredCompile;
754
+
755
+ function requireCompile () {
756
+ if (hasRequiredCompile) return compile_1;
757
+ hasRequiredCompile = 1;
758
+
759
+ const fill = requireFillRange();
760
+ const utils = requireUtils$1();
761
+
762
+ const compile = (ast, options = {}) => {
763
+ let walk = (node, parent = {}) => {
764
+ let invalidBlock = utils.isInvalidBrace(parent);
765
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
766
+ let invalid = invalidBlock === true || invalidNode === true;
767
+ let prefix = options.escapeInvalid === true ? '\\' : '';
768
+ let output = '';
769
+
770
+ if (node.isOpen === true) {
771
+ return prefix + node.value;
772
+ }
773
+ if (node.isClose === true) {
774
+ return prefix + node.value;
775
+ }
776
+
777
+ if (node.type === 'open') {
778
+ return invalid ? (prefix + node.value) : '(';
779
+ }
780
+
781
+ if (node.type === 'close') {
782
+ return invalid ? (prefix + node.value) : ')';
783
+ }
784
+
785
+ if (node.type === 'comma') {
786
+ return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
787
+ }
788
+
789
+ if (node.value) {
790
+ return node.value;
791
+ }
792
+
793
+ if (node.nodes && node.ranges > 0) {
794
+ let args = utils.reduce(node.nodes);
795
+ let range = fill(...args, { ...options, wrap: false, toRegex: true });
796
+
797
+ if (range.length !== 0) {
798
+ return args.length > 1 && range.length > 1 ? `(${range})` : range;
799
+ }
800
+ }
801
+
802
+ if (node.nodes) {
803
+ for (let child of node.nodes) {
804
+ output += walk(child, node);
805
+ }
806
+ }
807
+ return output;
808
+ };
809
+
810
+ return walk(ast);
811
+ };
812
+
813
+ compile_1 = compile;
814
+ return compile_1;
815
+ }
816
+
817
+ var expand_1;
818
+ var hasRequiredExpand;
819
+
820
+ function requireExpand () {
821
+ if (hasRequiredExpand) return expand_1;
822
+ hasRequiredExpand = 1;
823
+
824
+ const fill = requireFillRange();
825
+ const stringify = requireStringify();
826
+ const utils = requireUtils$1();
827
+
828
+ const append = (queue = '', stash = '', enclose = false) => {
829
+ let result = [];
830
+
831
+ queue = [].concat(queue);
832
+ stash = [].concat(stash);
833
+
834
+ if (!stash.length) return queue;
835
+ if (!queue.length) {
836
+ return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
837
+ }
838
+
839
+ for (let item of queue) {
840
+ if (Array.isArray(item)) {
841
+ for (let value of item) {
842
+ result.push(append(value, stash, enclose));
843
+ }
844
+ } else {
845
+ for (let ele of stash) {
846
+ if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
847
+ result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
848
+ }
849
+ }
850
+ }
851
+ return utils.flatten(result);
852
+ };
853
+
854
+ const expand = (ast, options = {}) => {
855
+ let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
856
+
857
+ let walk = (node, parent = {}) => {
858
+ node.queue = [];
859
+
860
+ let p = parent;
861
+ let q = parent.queue;
862
+
863
+ while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
864
+ p = p.parent;
865
+ q = p.queue;
866
+ }
867
+
868
+ if (node.invalid || node.dollar) {
869
+ q.push(append(q.pop(), stringify(node, options)));
870
+ return;
871
+ }
872
+
873
+ if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
874
+ q.push(append(q.pop(), ['{}']));
875
+ return;
876
+ }
877
+
878
+ if (node.nodes && node.ranges > 0) {
879
+ let args = utils.reduce(node.nodes);
880
+
881
+ if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
882
+ throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
883
+ }
884
+
885
+ let range = fill(...args, options);
886
+ if (range.length === 0) {
887
+ range = stringify(node, options);
888
+ }
889
+
890
+ q.push(append(q.pop(), range));
891
+ node.nodes = [];
892
+ return;
893
+ }
894
+
895
+ let enclose = utils.encloseBrace(node);
896
+ let queue = node.queue;
897
+ let block = node;
898
+
899
+ while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
900
+ block = block.parent;
901
+ queue = block.queue;
902
+ }
903
+
904
+ for (let i = 0; i < node.nodes.length; i++) {
905
+ let child = node.nodes[i];
906
+
907
+ if (child.type === 'comma' && node.type === 'brace') {
908
+ if (i === 1) queue.push('');
909
+ queue.push('');
910
+ continue;
911
+ }
912
+
913
+ if (child.type === 'close') {
914
+ q.push(append(q.pop(), queue, enclose));
915
+ continue;
916
+ }
917
+
918
+ if (child.value && child.type !== 'open') {
919
+ queue.push(append(queue.pop(), child.value));
920
+ continue;
921
+ }
922
+
923
+ if (child.nodes) {
924
+ walk(child, node);
925
+ }
926
+ }
927
+
928
+ return queue;
929
+ };
930
+
931
+ return utils.flatten(walk(ast));
932
+ };
933
+
934
+ expand_1 = expand;
935
+ return expand_1;
936
+ }
937
+
938
+ var constants$1;
939
+ var hasRequiredConstants$1;
940
+
941
+ function requireConstants$1 () {
942
+ if (hasRequiredConstants$1) return constants$1;
943
+ hasRequiredConstants$1 = 1;
944
+
945
+ constants$1 = {
946
+ MAX_LENGTH: 1024 * 64,
947
+
948
+ // Digits
949
+ CHAR_0: '0', /* 0 */
950
+ CHAR_9: '9', /* 9 */
951
+
952
+ // Alphabet chars.
953
+ CHAR_UPPERCASE_A: 'A', /* A */
954
+ CHAR_LOWERCASE_A: 'a', /* a */
955
+ CHAR_UPPERCASE_Z: 'Z', /* Z */
956
+ CHAR_LOWERCASE_Z: 'z', /* z */
957
+
958
+ CHAR_LEFT_PARENTHESES: '(', /* ( */
959
+ CHAR_RIGHT_PARENTHESES: ')', /* ) */
960
+
961
+ CHAR_ASTERISK: '*', /* * */
962
+
963
+ // Non-alphabetic chars.
964
+ CHAR_AMPERSAND: '&', /* & */
965
+ CHAR_AT: '@', /* @ */
966
+ CHAR_BACKSLASH: '\\', /* \ */
967
+ CHAR_BACKTICK: '`', /* ` */
968
+ CHAR_CARRIAGE_RETURN: '\r', /* \r */
969
+ CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
970
+ CHAR_COLON: ':', /* : */
971
+ CHAR_COMMA: ',', /* , */
972
+ CHAR_DOLLAR: '$', /* . */
973
+ CHAR_DOT: '.', /* . */
974
+ CHAR_DOUBLE_QUOTE: '"', /* " */
975
+ CHAR_EQUAL: '=', /* = */
976
+ CHAR_EXCLAMATION_MARK: '!', /* ! */
977
+ CHAR_FORM_FEED: '\f', /* \f */
978
+ CHAR_FORWARD_SLASH: '/', /* / */
979
+ CHAR_HASH: '#', /* # */
980
+ CHAR_HYPHEN_MINUS: '-', /* - */
981
+ CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
982
+ CHAR_LEFT_CURLY_BRACE: '{', /* { */
983
+ CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
984
+ CHAR_LINE_FEED: '\n', /* \n */
985
+ CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
986
+ CHAR_PERCENT: '%', /* % */
987
+ CHAR_PLUS: '+', /* + */
988
+ CHAR_QUESTION_MARK: '?', /* ? */
989
+ CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
990
+ CHAR_RIGHT_CURLY_BRACE: '}', /* } */
991
+ CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
992
+ CHAR_SEMICOLON: ';', /* ; */
993
+ CHAR_SINGLE_QUOTE: '\'', /* ' */
994
+ CHAR_SPACE: ' ', /* */
995
+ CHAR_TAB: '\t', /* \t */
996
+ CHAR_UNDERSCORE: '_', /* _ */
997
+ CHAR_VERTICAL_LINE: '|', /* | */
998
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
999
+ };
1000
+ return constants$1;
1001
+ }
1002
+
1003
+ var parse_1$1;
1004
+ var hasRequiredParse$1;
1005
+
1006
+ function requireParse$1 () {
1007
+ if (hasRequiredParse$1) return parse_1$1;
1008
+ hasRequiredParse$1 = 1;
1009
+
1010
+ const stringify = requireStringify();
1011
+
1012
+ /**
1013
+ * Constants
1014
+ */
1015
+
1016
+ const {
1017
+ MAX_LENGTH,
1018
+ CHAR_BACKSLASH, /* \ */
1019
+ CHAR_BACKTICK, /* ` */
1020
+ CHAR_COMMA, /* , */
1021
+ CHAR_DOT, /* . */
1022
+ CHAR_LEFT_PARENTHESES, /* ( */
1023
+ CHAR_RIGHT_PARENTHESES, /* ) */
1024
+ CHAR_LEFT_CURLY_BRACE, /* { */
1025
+ CHAR_RIGHT_CURLY_BRACE, /* } */
1026
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
1027
+ CHAR_RIGHT_SQUARE_BRACKET, /* ] */
1028
+ CHAR_DOUBLE_QUOTE, /* " */
1029
+ CHAR_SINGLE_QUOTE, /* ' */
1030
+ CHAR_NO_BREAK_SPACE,
1031
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE
1032
+ } = requireConstants$1();
1033
+
1034
+ /**
1035
+ * parse
1036
+ */
1037
+
1038
+ const parse = (input, options = {}) => {
1039
+ if (typeof input !== 'string') {
1040
+ throw new TypeError('Expected a string');
1041
+ }
1042
+
1043
+ let opts = options || {};
1044
+ let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1045
+ if (input.length > max) {
1046
+ throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
1047
+ }
1048
+
1049
+ let ast = { type: 'root', input, nodes: [] };
1050
+ let stack = [ast];
1051
+ let block = ast;
1052
+ let prev = ast;
1053
+ let brackets = 0;
1054
+ let length = input.length;
1055
+ let index = 0;
1056
+ let depth = 0;
1057
+ let value;
1058
+
1059
+ /**
1060
+ * Helpers
1061
+ */
1062
+
1063
+ const advance = () => input[index++];
1064
+ const push = node => {
1065
+ if (node.type === 'text' && prev.type === 'dot') {
1066
+ prev.type = 'text';
1067
+ }
1068
+
1069
+ if (prev && prev.type === 'text' && node.type === 'text') {
1070
+ prev.value += node.value;
1071
+ return;
1072
+ }
1073
+
1074
+ block.nodes.push(node);
1075
+ node.parent = block;
1076
+ node.prev = prev;
1077
+ prev = node;
1078
+ return node;
1079
+ };
1080
+
1081
+ push({ type: 'bos' });
1082
+
1083
+ while (index < length) {
1084
+ block = stack[stack.length - 1];
1085
+ value = advance();
1086
+
1087
+ /**
1088
+ * Invalid chars
1089
+ */
1090
+
1091
+ if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
1092
+ continue;
1093
+ }
1094
+
1095
+ /**
1096
+ * Escaped chars
1097
+ */
1098
+
1099
+ if (value === CHAR_BACKSLASH) {
1100
+ push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
1101
+ continue;
1102
+ }
1103
+
1104
+ /**
1105
+ * Right square bracket (literal): ']'
1106
+ */
1107
+
1108
+ if (value === CHAR_RIGHT_SQUARE_BRACKET) {
1109
+ push({ type: 'text', value: '\\' + value });
1110
+ continue;
1111
+ }
1112
+
1113
+ /**
1114
+ * Left square bracket: '['
1115
+ */
1116
+
1117
+ if (value === CHAR_LEFT_SQUARE_BRACKET) {
1118
+ brackets++;
1119
+ let next;
1120
+
1121
+ while (index < length && (next = advance())) {
1122
+ value += next;
1123
+
1124
+ if (next === CHAR_LEFT_SQUARE_BRACKET) {
1125
+ brackets++;
1126
+ continue;
1127
+ }
1128
+
1129
+ if (next === CHAR_BACKSLASH) {
1130
+ value += advance();
1131
+ continue;
1132
+ }
1133
+
1134
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
1135
+ brackets--;
1136
+
1137
+ if (brackets === 0) {
1138
+ break;
1139
+ }
1140
+ }
1141
+ }
1142
+
1143
+ push({ type: 'text', value });
1144
+ continue;
1145
+ }
1146
+
1147
+ /**
1148
+ * Parentheses
1149
+ */
1150
+
1151
+ if (value === CHAR_LEFT_PARENTHESES) {
1152
+ block = push({ type: 'paren', nodes: [] });
1153
+ stack.push(block);
1154
+ push({ type: 'text', value });
1155
+ continue;
1156
+ }
1157
+
1158
+ if (value === CHAR_RIGHT_PARENTHESES) {
1159
+ if (block.type !== 'paren') {
1160
+ push({ type: 'text', value });
1161
+ continue;
1162
+ }
1163
+ block = stack.pop();
1164
+ push({ type: 'text', value });
1165
+ block = stack[stack.length - 1];
1166
+ continue;
1167
+ }
1168
+
1169
+ /**
1170
+ * Quotes: '|"|`
1171
+ */
1172
+
1173
+ if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
1174
+ let open = value;
1175
+ let next;
1176
+
1177
+ if (options.keepQuotes !== true) {
1178
+ value = '';
1179
+ }
1180
+
1181
+ while (index < length && (next = advance())) {
1182
+ if (next === CHAR_BACKSLASH) {
1183
+ value += next + advance();
1184
+ continue;
1185
+ }
1186
+
1187
+ if (next === open) {
1188
+ if (options.keepQuotes === true) value += next;
1189
+ break;
1190
+ }
1191
+
1192
+ value += next;
1193
+ }
1194
+
1195
+ push({ type: 'text', value });
1196
+ continue;
1197
+ }
1198
+
1199
+ /**
1200
+ * Left curly brace: '{'
1201
+ */
1202
+
1203
+ if (value === CHAR_LEFT_CURLY_BRACE) {
1204
+ depth++;
1205
+
1206
+ let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
1207
+ let brace = {
1208
+ type: 'brace',
1209
+ open: true,
1210
+ close: false,
1211
+ dollar,
1212
+ depth,
1213
+ commas: 0,
1214
+ ranges: 0,
1215
+ nodes: []
1216
+ };
1217
+
1218
+ block = push(brace);
1219
+ stack.push(block);
1220
+ push({ type: 'open', value });
1221
+ continue;
1222
+ }
1223
+
1224
+ /**
1225
+ * Right curly brace: '}'
1226
+ */
1227
+
1228
+ if (value === CHAR_RIGHT_CURLY_BRACE) {
1229
+ if (block.type !== 'brace') {
1230
+ push({ type: 'text', value });
1231
+ continue;
1232
+ }
1233
+
1234
+ let type = 'close';
1235
+ block = stack.pop();
1236
+ block.close = true;
1237
+
1238
+ push({ type, value });
1239
+ depth--;
1240
+
1241
+ block = stack[stack.length - 1];
1242
+ continue;
1243
+ }
1244
+
1245
+ /**
1246
+ * Comma: ','
1247
+ */
1248
+
1249
+ if (value === CHAR_COMMA && depth > 0) {
1250
+ if (block.ranges > 0) {
1251
+ block.ranges = 0;
1252
+ let open = block.nodes.shift();
1253
+ block.nodes = [open, { type: 'text', value: stringify(block) }];
1254
+ }
1255
+
1256
+ push({ type: 'comma', value });
1257
+ block.commas++;
1258
+ continue;
1259
+ }
1260
+
1261
+ /**
1262
+ * Dot: '.'
1263
+ */
1264
+
1265
+ if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
1266
+ let siblings = block.nodes;
1267
+
1268
+ if (depth === 0 || siblings.length === 0) {
1269
+ push({ type: 'text', value });
1270
+ continue;
1271
+ }
1272
+
1273
+ if (prev.type === 'dot') {
1274
+ block.range = [];
1275
+ prev.value += value;
1276
+ prev.type = 'range';
1277
+
1278
+ if (block.nodes.length !== 3 && block.nodes.length !== 5) {
1279
+ block.invalid = true;
1280
+ block.ranges = 0;
1281
+ prev.type = 'text';
1282
+ continue;
1283
+ }
1284
+
1285
+ block.ranges++;
1286
+ block.args = [];
1287
+ continue;
1288
+ }
1289
+
1290
+ if (prev.type === 'range') {
1291
+ siblings.pop();
1292
+
1293
+ let before = siblings[siblings.length - 1];
1294
+ before.value += prev.value + value;
1295
+ prev = before;
1296
+ block.ranges--;
1297
+ continue;
1298
+ }
1299
+
1300
+ push({ type: 'dot', value });
1301
+ continue;
1302
+ }
1303
+
1304
+ /**
1305
+ * Text
1306
+ */
1307
+
1308
+ push({ type: 'text', value });
1309
+ }
1310
+
1311
+ // Mark imbalanced braces and brackets as invalid
1312
+ do {
1313
+ block = stack.pop();
1314
+
1315
+ if (block.type !== 'root') {
1316
+ block.nodes.forEach(node => {
1317
+ if (!node.nodes) {
1318
+ if (node.type === 'open') node.isOpen = true;
1319
+ if (node.type === 'close') node.isClose = true;
1320
+ if (!node.nodes) node.type = 'text';
1321
+ node.invalid = true;
1322
+ }
1323
+ });
1324
+
1325
+ // get the location of the block on parent.nodes (block's siblings)
1326
+ let parent = stack[stack.length - 1];
1327
+ let index = parent.nodes.indexOf(block);
1328
+ // replace the (invalid) block with it's nodes
1329
+ parent.nodes.splice(index, 1, ...block.nodes);
1330
+ }
1331
+ } while (stack.length > 0);
1332
+
1333
+ push({ type: 'eos' });
1334
+ return ast;
1335
+ };
1336
+
1337
+ parse_1$1 = parse;
1338
+ return parse_1$1;
1339
+ }
1340
+
1341
+ var braces_1;
1342
+ var hasRequiredBraces;
1343
+
1344
+ function requireBraces () {
1345
+ if (hasRequiredBraces) return braces_1;
1346
+ hasRequiredBraces = 1;
1347
+
1348
+ const stringify = requireStringify();
1349
+ const compile = requireCompile();
1350
+ const expand = requireExpand();
1351
+ const parse = requireParse$1();
1352
+
1353
+ /**
1354
+ * Expand the given pattern or create a regex-compatible string.
1355
+ *
1356
+ * ```js
1357
+ * const braces = require('braces');
1358
+ * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
1359
+ * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
1360
+ * ```
1361
+ * @param {String} `str`
1362
+ * @param {Object} `options`
1363
+ * @return {String}
1364
+ * @api public
1365
+ */
1366
+
1367
+ const braces = (input, options = {}) => {
1368
+ let output = [];
1369
+
1370
+ if (Array.isArray(input)) {
1371
+ for (let pattern of input) {
1372
+ let result = braces.create(pattern, options);
1373
+ if (Array.isArray(result)) {
1374
+ output.push(...result);
1375
+ } else {
1376
+ output.push(result);
1377
+ }
1378
+ }
1379
+ } else {
1380
+ output = [].concat(braces.create(input, options));
1381
+ }
1382
+
1383
+ if (options && options.expand === true && options.nodupes === true) {
1384
+ output = [...new Set(output)];
1385
+ }
1386
+ return output;
1387
+ };
1388
+
1389
+ /**
1390
+ * Parse the given `str` with the given `options`.
1391
+ *
1392
+ * ```js
1393
+ * // braces.parse(pattern, [, options]);
1394
+ * const ast = braces.parse('a/{b,c}/d');
1395
+ * console.log(ast);
1396
+ * ```
1397
+ * @param {String} pattern Brace pattern to parse
1398
+ * @param {Object} options
1399
+ * @return {Object} Returns an AST
1400
+ * @api public
1401
+ */
1402
+
1403
+ braces.parse = (input, options = {}) => parse(input, options);
1404
+
1405
+ /**
1406
+ * Creates a braces string from an AST, or an AST node.
1407
+ *
1408
+ * ```js
1409
+ * const braces = require('braces');
1410
+ * let ast = braces.parse('foo/{a,b}/bar');
1411
+ * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
1412
+ * ```
1413
+ * @param {String} `input` Brace pattern or AST.
1414
+ * @param {Object} `options`
1415
+ * @return {Array} Returns an array of expanded values.
1416
+ * @api public
1417
+ */
1418
+
1419
+ braces.stringify = (input, options = {}) => {
1420
+ if (typeof input === 'string') {
1421
+ return stringify(braces.parse(input, options), options);
1422
+ }
1423
+ return stringify(input, options);
1424
+ };
1425
+
1426
+ /**
1427
+ * Compiles a brace pattern into a regex-compatible, optimized string.
1428
+ * This method is called by the main [braces](#braces) function by default.
1429
+ *
1430
+ * ```js
1431
+ * const braces = require('braces');
1432
+ * console.log(braces.compile('a/{b,c}/d'));
1433
+ * //=> ['a/(b|c)/d']
1434
+ * ```
1435
+ * @param {String} `input` Brace pattern or AST.
1436
+ * @param {Object} `options`
1437
+ * @return {Array} Returns an array of expanded values.
1438
+ * @api public
1439
+ */
1440
+
1441
+ braces.compile = (input, options = {}) => {
1442
+ if (typeof input === 'string') {
1443
+ input = braces.parse(input, options);
1444
+ }
1445
+ return compile(input, options);
1446
+ };
1447
+
1448
+ /**
1449
+ * Expands a brace pattern into an array. This method is called by the
1450
+ * main [braces](#braces) function when `options.expand` is true. Before
1451
+ * using this method it's recommended that you read the [performance notes](#performance))
1452
+ * and advantages of using [.compile](#compile) instead.
1453
+ *
1454
+ * ```js
1455
+ * const braces = require('braces');
1456
+ * console.log(braces.expand('a/{b,c}/d'));
1457
+ * //=> ['a/b/d', 'a/c/d'];
1458
+ * ```
1459
+ * @param {String} `pattern` Brace pattern
1460
+ * @param {Object} `options`
1461
+ * @return {Array} Returns an array of expanded values.
1462
+ * @api public
1463
+ */
1464
+
1465
+ braces.expand = (input, options = {}) => {
1466
+ if (typeof input === 'string') {
1467
+ input = braces.parse(input, options);
1468
+ }
1469
+
1470
+ let result = expand(input, options);
1471
+
1472
+ // filter out empty strings if specified
1473
+ if (options.noempty === true) {
1474
+ result = result.filter(Boolean);
1475
+ }
1476
+
1477
+ // filter out duplicates if specified
1478
+ if (options.nodupes === true) {
1479
+ result = [...new Set(result)];
1480
+ }
1481
+
1482
+ return result;
1483
+ };
1484
+
1485
+ /**
1486
+ * Processes a brace pattern and returns either an expanded array
1487
+ * (if `options.expand` is true), a highly optimized regex-compatible string.
1488
+ * This method is called by the main [braces](#braces) function.
1489
+ *
1490
+ * ```js
1491
+ * const braces = require('braces');
1492
+ * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
1493
+ * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
1494
+ * ```
1495
+ * @param {String} `pattern` Brace pattern
1496
+ * @param {Object} `options`
1497
+ * @return {Array} Returns an array of expanded values.
1498
+ * @api public
1499
+ */
1500
+
1501
+ braces.create = (input, options = {}) => {
1502
+ if (input === '' || input.length < 3) {
1503
+ return [input];
1504
+ }
1505
+
1506
+ return options.expand !== true
1507
+ ? braces.compile(input, options)
1508
+ : braces.expand(input, options);
1509
+ };
1510
+
1511
+ /**
1512
+ * Expose "braces"
1513
+ */
1514
+
1515
+ braces_1 = braces;
1516
+ return braces_1;
1517
+ }
1518
+
1519
+ var utils = {};
1520
+
1521
+ var constants;
1522
+ var hasRequiredConstants;
1523
+
1524
+ function requireConstants () {
1525
+ if (hasRequiredConstants) return constants;
1526
+ hasRequiredConstants = 1;
1527
+
1528
+ const path = require$$0__default$1.default;
1529
+ const WIN_SLASH = '\\\\/';
1530
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1531
+
1532
+ /**
1533
+ * Posix glob regex
1534
+ */
1535
+
1536
+ const DOT_LITERAL = '\\.';
1537
+ const PLUS_LITERAL = '\\+';
1538
+ const QMARK_LITERAL = '\\?';
1539
+ const SLASH_LITERAL = '\\/';
1540
+ const ONE_CHAR = '(?=.)';
1541
+ const QMARK = '[^/]';
1542
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
1543
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
1544
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
1545
+ const NO_DOT = `(?!${DOT_LITERAL})`;
1546
+ const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
1547
+ const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
1548
+ const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
1549
+ const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
1550
+ const STAR = `${QMARK}*?`;
1551
+
1552
+ const POSIX_CHARS = {
1553
+ DOT_LITERAL,
1554
+ PLUS_LITERAL,
1555
+ QMARK_LITERAL,
1556
+ SLASH_LITERAL,
1557
+ ONE_CHAR,
1558
+ QMARK,
1559
+ END_ANCHOR,
1560
+ DOTS_SLASH,
1561
+ NO_DOT,
1562
+ NO_DOTS,
1563
+ NO_DOT_SLASH,
1564
+ NO_DOTS_SLASH,
1565
+ QMARK_NO_DOT,
1566
+ STAR,
1567
+ START_ANCHOR
1568
+ };
1569
+
1570
+ /**
1571
+ * Windows glob regex
1572
+ */
1573
+
1574
+ const WINDOWS_CHARS = {
1575
+ ...POSIX_CHARS,
1576
+
1577
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
1578
+ QMARK: WIN_NO_SLASH,
1579
+ STAR: `${WIN_NO_SLASH}*?`,
1580
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
1581
+ NO_DOT: `(?!${DOT_LITERAL})`,
1582
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
1583
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
1584
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
1585
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
1586
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
1587
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
1588
+ };
1589
+
1590
+ /**
1591
+ * POSIX Bracket Regex
1592
+ */
1593
+
1594
+ const POSIX_REGEX_SOURCE = {
1595
+ alnum: 'a-zA-Z0-9',
1596
+ alpha: 'a-zA-Z',
1597
+ ascii: '\\x00-\\x7F',
1598
+ blank: ' \\t',
1599
+ cntrl: '\\x00-\\x1F\\x7F',
1600
+ digit: '0-9',
1601
+ graph: '\\x21-\\x7E',
1602
+ lower: 'a-z',
1603
+ print: '\\x20-\\x7E ',
1604
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
1605
+ space: ' \\t\\r\\n\\v\\f',
1606
+ upper: 'A-Z',
1607
+ word: 'A-Za-z0-9_',
1608
+ xdigit: 'A-Fa-f0-9'
1609
+ };
1610
+
1611
+ constants = {
1612
+ MAX_LENGTH: 1024 * 64,
1613
+ POSIX_REGEX_SOURCE,
1614
+
1615
+ // regular expressions
1616
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
1617
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
1618
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
1619
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
1620
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
1621
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
1622
+
1623
+ // Replace globs with equivalent patterns to reduce parsing time.
1624
+ REPLACEMENTS: {
1625
+ '***': '*',
1626
+ '**/**': '**',
1627
+ '**/**/**': '**'
1628
+ },
1629
+
1630
+ // Digits
1631
+ CHAR_0: 48, /* 0 */
1632
+ CHAR_9: 57, /* 9 */
1633
+
1634
+ // Alphabet chars.
1635
+ CHAR_UPPERCASE_A: 65, /* A */
1636
+ CHAR_LOWERCASE_A: 97, /* a */
1637
+ CHAR_UPPERCASE_Z: 90, /* Z */
1638
+ CHAR_LOWERCASE_Z: 122, /* z */
1639
+
1640
+ CHAR_LEFT_PARENTHESES: 40, /* ( */
1641
+ CHAR_RIGHT_PARENTHESES: 41, /* ) */
1642
+
1643
+ CHAR_ASTERISK: 42, /* * */
1644
+
1645
+ // Non-alphabetic chars.
1646
+ CHAR_AMPERSAND: 38, /* & */
1647
+ CHAR_AT: 64, /* @ */
1648
+ CHAR_BACKWARD_SLASH: 92, /* \ */
1649
+ CHAR_CARRIAGE_RETURN: 13, /* \r */
1650
+ CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
1651
+ CHAR_COLON: 58, /* : */
1652
+ CHAR_COMMA: 44, /* , */
1653
+ CHAR_DOT: 46, /* . */
1654
+ CHAR_DOUBLE_QUOTE: 34, /* " */
1655
+ CHAR_EQUAL: 61, /* = */
1656
+ CHAR_EXCLAMATION_MARK: 33, /* ! */
1657
+ CHAR_FORM_FEED: 12, /* \f */
1658
+ CHAR_FORWARD_SLASH: 47, /* / */
1659
+ CHAR_GRAVE_ACCENT: 96, /* ` */
1660
+ CHAR_HASH: 35, /* # */
1661
+ CHAR_HYPHEN_MINUS: 45, /* - */
1662
+ CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
1663
+ CHAR_LEFT_CURLY_BRACE: 123, /* { */
1664
+ CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
1665
+ CHAR_LINE_FEED: 10, /* \n */
1666
+ CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
1667
+ CHAR_PERCENT: 37, /* % */
1668
+ CHAR_PLUS: 43, /* + */
1669
+ CHAR_QUESTION_MARK: 63, /* ? */
1670
+ CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
1671
+ CHAR_RIGHT_CURLY_BRACE: 125, /* } */
1672
+ CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
1673
+ CHAR_SEMICOLON: 59, /* ; */
1674
+ CHAR_SINGLE_QUOTE: 39, /* ' */
1675
+ CHAR_SPACE: 32, /* */
1676
+ CHAR_TAB: 9, /* \t */
1677
+ CHAR_UNDERSCORE: 95, /* _ */
1678
+ CHAR_VERTICAL_LINE: 124, /* | */
1679
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
1680
+
1681
+ SEP: path.sep,
1682
+
1683
+ /**
1684
+ * Create EXTGLOB_CHARS
1685
+ */
1686
+
1687
+ extglobChars(chars) {
1688
+ return {
1689
+ '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
1690
+ '?': { type: 'qmark', open: '(?:', close: ')?' },
1691
+ '+': { type: 'plus', open: '(?:', close: ')+' },
1692
+ '*': { type: 'star', open: '(?:', close: ')*' },
1693
+ '@': { type: 'at', open: '(?:', close: ')' }
1694
+ };
1695
+ },
1696
+
1697
+ /**
1698
+ * Create GLOB_CHARS
1699
+ */
1700
+
1701
+ globChars(win32) {
1702
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
1703
+ }
1704
+ };
1705
+ return constants;
1706
+ }
1707
+
1708
+ var hasRequiredUtils;
1709
+
1710
+ function requireUtils () {
1711
+ if (hasRequiredUtils) return utils;
1712
+ hasRequiredUtils = 1;
1713
+ (function (exports) {
1714
+
1715
+ const path = require$$0__default$1.default;
1716
+ const win32 = process.platform === 'win32';
1717
+ const {
1718
+ REGEX_BACKSLASH,
1719
+ REGEX_REMOVE_BACKSLASH,
1720
+ REGEX_SPECIAL_CHARS,
1721
+ REGEX_SPECIAL_CHARS_GLOBAL
1722
+ } = requireConstants();
1723
+
1724
+ exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
1725
+ exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
1726
+ exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
1727
+ exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
1728
+ exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
1729
+
1730
+ exports.removeBackslashes = str => {
1731
+ return str.replace(REGEX_REMOVE_BACKSLASH, match => {
1732
+ return match === '\\' ? '' : match;
1733
+ });
1734
+ };
1735
+
1736
+ exports.supportsLookbehinds = () => {
1737
+ const segs = process.version.slice(1).split('.').map(Number);
1738
+ if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
1739
+ return true;
1740
+ }
1741
+ return false;
1742
+ };
1743
+
1744
+ exports.isWindows = options => {
1745
+ if (options && typeof options.windows === 'boolean') {
1746
+ return options.windows;
1747
+ }
1748
+ return win32 === true || path.sep === '\\';
1749
+ };
1750
+
1751
+ exports.escapeLast = (input, char, lastIdx) => {
1752
+ const idx = input.lastIndexOf(char, lastIdx);
1753
+ if (idx === -1) return input;
1754
+ if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
1755
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
1756
+ };
1757
+
1758
+ exports.removePrefix = (input, state = {}) => {
1759
+ let output = input;
1760
+ if (output.startsWith('./')) {
1761
+ output = output.slice(2);
1762
+ state.prefix = './';
1763
+ }
1764
+ return output;
1765
+ };
1766
+
1767
+ exports.wrapOutput = (input, state = {}, options = {}) => {
1768
+ const prepend = options.contains ? '' : '^';
1769
+ const append = options.contains ? '' : '$';
1770
+
1771
+ let output = `${prepend}(?:${input})${append}`;
1772
+ if (state.negated === true) {
1773
+ output = `(?:^(?!${output}).*$)`;
1774
+ }
1775
+ return output;
1776
+ };
1777
+ } (utils));
1778
+ return utils;
1779
+ }
1780
+
1781
+ var scan_1;
1782
+ var hasRequiredScan;
1783
+
1784
+ function requireScan () {
1785
+ if (hasRequiredScan) return scan_1;
1786
+ hasRequiredScan = 1;
1787
+
1788
+ const utils = requireUtils();
1789
+ const {
1790
+ CHAR_ASTERISK, /* * */
1791
+ CHAR_AT, /* @ */
1792
+ CHAR_BACKWARD_SLASH, /* \ */
1793
+ CHAR_COMMA, /* , */
1794
+ CHAR_DOT, /* . */
1795
+ CHAR_EXCLAMATION_MARK, /* ! */
1796
+ CHAR_FORWARD_SLASH, /* / */
1797
+ CHAR_LEFT_CURLY_BRACE, /* { */
1798
+ CHAR_LEFT_PARENTHESES, /* ( */
1799
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
1800
+ CHAR_PLUS, /* + */
1801
+ CHAR_QUESTION_MARK, /* ? */
1802
+ CHAR_RIGHT_CURLY_BRACE, /* } */
1803
+ CHAR_RIGHT_PARENTHESES, /* ) */
1804
+ CHAR_RIGHT_SQUARE_BRACKET /* ] */
1805
+ } = requireConstants();
1806
+
1807
+ const isPathSeparator = code => {
1808
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
1809
+ };
1810
+
1811
+ const depth = token => {
1812
+ if (token.isPrefix !== true) {
1813
+ token.depth = token.isGlobstar ? Infinity : 1;
1814
+ }
1815
+ };
1816
+
1817
+ /**
1818
+ * Quickly scans a glob pattern and returns an object with a handful of
1819
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
1820
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
1821
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
1822
+ *
1823
+ * ```js
1824
+ * const pm = require('picomatch');
1825
+ * console.log(pm.scan('foo/bar/*.js'));
1826
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
1827
+ * ```
1828
+ * @param {String} `str`
1829
+ * @param {Object} `options`
1830
+ * @return {Object} Returns an object with tokens and regex source string.
1831
+ * @api public
1832
+ */
1833
+
1834
+ const scan = (input, options) => {
1835
+ const opts = options || {};
1836
+
1837
+ const length = input.length - 1;
1838
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
1839
+ const slashes = [];
1840
+ const tokens = [];
1841
+ const parts = [];
1842
+
1843
+ let str = input;
1844
+ let index = -1;
1845
+ let start = 0;
1846
+ let lastIndex = 0;
1847
+ let isBrace = false;
1848
+ let isBracket = false;
1849
+ let isGlob = false;
1850
+ let isExtglob = false;
1851
+ let isGlobstar = false;
1852
+ let braceEscaped = false;
1853
+ let backslashes = false;
1854
+ let negated = false;
1855
+ let negatedExtglob = false;
1856
+ let finished = false;
1857
+ let braces = 0;
1858
+ let prev;
1859
+ let code;
1860
+ let token = { value: '', depth: 0, isGlob: false };
1861
+
1862
+ const eos = () => index >= length;
1863
+ const peek = () => str.charCodeAt(index + 1);
1864
+ const advance = () => {
1865
+ prev = code;
1866
+ return str.charCodeAt(++index);
1867
+ };
1868
+
1869
+ while (index < length) {
1870
+ code = advance();
1871
+ let next;
1872
+
1873
+ if (code === CHAR_BACKWARD_SLASH) {
1874
+ backslashes = token.backslashes = true;
1875
+ code = advance();
1876
+
1877
+ if (code === CHAR_LEFT_CURLY_BRACE) {
1878
+ braceEscaped = true;
1879
+ }
1880
+ continue;
1881
+ }
1882
+
1883
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
1884
+ braces++;
1885
+
1886
+ while (eos() !== true && (code = advance())) {
1887
+ if (code === CHAR_BACKWARD_SLASH) {
1888
+ backslashes = token.backslashes = true;
1889
+ advance();
1890
+ continue;
1891
+ }
1892
+
1893
+ if (code === CHAR_LEFT_CURLY_BRACE) {
1894
+ braces++;
1895
+ continue;
1896
+ }
1897
+
1898
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
1899
+ isBrace = token.isBrace = true;
1900
+ isGlob = token.isGlob = true;
1901
+ finished = true;
1902
+
1903
+ if (scanToEnd === true) {
1904
+ continue;
1905
+ }
1906
+
1907
+ break;
1908
+ }
1909
+
1910
+ if (braceEscaped !== true && code === CHAR_COMMA) {
1911
+ isBrace = token.isBrace = true;
1912
+ isGlob = token.isGlob = true;
1913
+ finished = true;
1914
+
1915
+ if (scanToEnd === true) {
1916
+ continue;
1917
+ }
1918
+
1919
+ break;
1920
+ }
1921
+
1922
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
1923
+ braces--;
1924
+
1925
+ if (braces === 0) {
1926
+ braceEscaped = false;
1927
+ isBrace = token.isBrace = true;
1928
+ finished = true;
1929
+ break;
1930
+ }
1931
+ }
1932
+ }
1933
+
1934
+ if (scanToEnd === true) {
1935
+ continue;
1936
+ }
1937
+
1938
+ break;
1939
+ }
1940
+
1941
+ if (code === CHAR_FORWARD_SLASH) {
1942
+ slashes.push(index);
1943
+ tokens.push(token);
1944
+ token = { value: '', depth: 0, isGlob: false };
1945
+
1946
+ if (finished === true) continue;
1947
+ if (prev === CHAR_DOT && index === (start + 1)) {
1948
+ start += 2;
1949
+ continue;
1950
+ }
1951
+
1952
+ lastIndex = index + 1;
1953
+ continue;
1954
+ }
1955
+
1956
+ if (opts.noext !== true) {
1957
+ const isExtglobChar = code === CHAR_PLUS
1958
+ || code === CHAR_AT
1959
+ || code === CHAR_ASTERISK
1960
+ || code === CHAR_QUESTION_MARK
1961
+ || code === CHAR_EXCLAMATION_MARK;
1962
+
1963
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
1964
+ isGlob = token.isGlob = true;
1965
+ isExtglob = token.isExtglob = true;
1966
+ finished = true;
1967
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
1968
+ negatedExtglob = true;
1969
+ }
1970
+
1971
+ if (scanToEnd === true) {
1972
+ while (eos() !== true && (code = advance())) {
1973
+ if (code === CHAR_BACKWARD_SLASH) {
1974
+ backslashes = token.backslashes = true;
1975
+ code = advance();
1976
+ continue;
1977
+ }
1978
+
1979
+ if (code === CHAR_RIGHT_PARENTHESES) {
1980
+ isGlob = token.isGlob = true;
1981
+ finished = true;
1982
+ break;
1983
+ }
1984
+ }
1985
+ continue;
1986
+ }
1987
+ break;
1988
+ }
1989
+ }
1990
+
1991
+ if (code === CHAR_ASTERISK) {
1992
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
1993
+ isGlob = token.isGlob = true;
1994
+ finished = true;
1995
+
1996
+ if (scanToEnd === true) {
1997
+ continue;
1998
+ }
1999
+ break;
2000
+ }
2001
+
2002
+ if (code === CHAR_QUESTION_MARK) {
2003
+ isGlob = token.isGlob = true;
2004
+ finished = true;
2005
+
2006
+ if (scanToEnd === true) {
2007
+ continue;
2008
+ }
2009
+ break;
2010
+ }
2011
+
2012
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
2013
+ while (eos() !== true && (next = advance())) {
2014
+ if (next === CHAR_BACKWARD_SLASH) {
2015
+ backslashes = token.backslashes = true;
2016
+ advance();
2017
+ continue;
2018
+ }
2019
+
2020
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
2021
+ isBracket = token.isBracket = true;
2022
+ isGlob = token.isGlob = true;
2023
+ finished = true;
2024
+ break;
2025
+ }
2026
+ }
2027
+
2028
+ if (scanToEnd === true) {
2029
+ continue;
2030
+ }
2031
+
2032
+ break;
2033
+ }
2034
+
2035
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
2036
+ negated = token.negated = true;
2037
+ start++;
2038
+ continue;
2039
+ }
2040
+
2041
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
2042
+ isGlob = token.isGlob = true;
2043
+
2044
+ if (scanToEnd === true) {
2045
+ while (eos() !== true && (code = advance())) {
2046
+ if (code === CHAR_LEFT_PARENTHESES) {
2047
+ backslashes = token.backslashes = true;
2048
+ code = advance();
2049
+ continue;
2050
+ }
2051
+
2052
+ if (code === CHAR_RIGHT_PARENTHESES) {
2053
+ finished = true;
2054
+ break;
2055
+ }
2056
+ }
2057
+ continue;
2058
+ }
2059
+ break;
2060
+ }
2061
+
2062
+ if (isGlob === true) {
2063
+ finished = true;
2064
+
2065
+ if (scanToEnd === true) {
2066
+ continue;
2067
+ }
2068
+
2069
+ break;
2070
+ }
2071
+ }
2072
+
2073
+ if (opts.noext === true) {
2074
+ isExtglob = false;
2075
+ isGlob = false;
2076
+ }
2077
+
2078
+ let base = str;
2079
+ let prefix = '';
2080
+ let glob = '';
2081
+
2082
+ if (start > 0) {
2083
+ prefix = str.slice(0, start);
2084
+ str = str.slice(start);
2085
+ lastIndex -= start;
2086
+ }
2087
+
2088
+ if (base && isGlob === true && lastIndex > 0) {
2089
+ base = str.slice(0, lastIndex);
2090
+ glob = str.slice(lastIndex);
2091
+ } else if (isGlob === true) {
2092
+ base = '';
2093
+ glob = str;
2094
+ } else {
2095
+ base = str;
2096
+ }
2097
+
2098
+ if (base && base !== '' && base !== '/' && base !== str) {
2099
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
2100
+ base = base.slice(0, -1);
2101
+ }
2102
+ }
2103
+
2104
+ if (opts.unescape === true) {
2105
+ if (glob) glob = utils.removeBackslashes(glob);
2106
+
2107
+ if (base && backslashes === true) {
2108
+ base = utils.removeBackslashes(base);
2109
+ }
2110
+ }
2111
+
2112
+ const state = {
2113
+ prefix,
2114
+ input,
2115
+ start,
2116
+ base,
2117
+ glob,
2118
+ isBrace,
2119
+ isBracket,
2120
+ isGlob,
2121
+ isExtglob,
2122
+ isGlobstar,
2123
+ negated,
2124
+ negatedExtglob
2125
+ };
2126
+
2127
+ if (opts.tokens === true) {
2128
+ state.maxDepth = 0;
2129
+ if (!isPathSeparator(code)) {
2130
+ tokens.push(token);
2131
+ }
2132
+ state.tokens = tokens;
2133
+ }
2134
+
2135
+ if (opts.parts === true || opts.tokens === true) {
2136
+ let prevIndex;
2137
+
2138
+ for (let idx = 0; idx < slashes.length; idx++) {
2139
+ const n = prevIndex ? prevIndex + 1 : start;
2140
+ const i = slashes[idx];
2141
+ const value = input.slice(n, i);
2142
+ if (opts.tokens) {
2143
+ if (idx === 0 && start !== 0) {
2144
+ tokens[idx].isPrefix = true;
2145
+ tokens[idx].value = prefix;
2146
+ } else {
2147
+ tokens[idx].value = value;
2148
+ }
2149
+ depth(tokens[idx]);
2150
+ state.maxDepth += tokens[idx].depth;
2151
+ }
2152
+ if (idx !== 0 || value !== '') {
2153
+ parts.push(value);
2154
+ }
2155
+ prevIndex = i;
2156
+ }
2157
+
2158
+ if (prevIndex && prevIndex + 1 < input.length) {
2159
+ const value = input.slice(prevIndex + 1);
2160
+ parts.push(value);
2161
+
2162
+ if (opts.tokens) {
2163
+ tokens[tokens.length - 1].value = value;
2164
+ depth(tokens[tokens.length - 1]);
2165
+ state.maxDepth += tokens[tokens.length - 1].depth;
2166
+ }
2167
+ }
2168
+
2169
+ state.slashes = slashes;
2170
+ state.parts = parts;
2171
+ }
2172
+
2173
+ return state;
2174
+ };
2175
+
2176
+ scan_1 = scan;
2177
+ return scan_1;
2178
+ }
2179
+
2180
+ var parse_1;
2181
+ var hasRequiredParse;
2182
+
2183
+ function requireParse () {
2184
+ if (hasRequiredParse) return parse_1;
2185
+ hasRequiredParse = 1;
2186
+
2187
+ const constants = requireConstants();
2188
+ const utils = requireUtils();
2189
+
2190
+ /**
2191
+ * Constants
2192
+ */
2193
+
2194
+ const {
2195
+ MAX_LENGTH,
2196
+ POSIX_REGEX_SOURCE,
2197
+ REGEX_NON_SPECIAL_CHARS,
2198
+ REGEX_SPECIAL_CHARS_BACKREF,
2199
+ REPLACEMENTS
2200
+ } = constants;
2201
+
2202
+ /**
2203
+ * Helpers
2204
+ */
2205
+
2206
+ const expandRange = (args, options) => {
2207
+ if (typeof options.expandRange === 'function') {
2208
+ return options.expandRange(...args, options);
2209
+ }
2210
+
2211
+ args.sort();
2212
+ const value = `[${args.join('-')}]`;
2213
+
2214
+ try {
2215
+ /* eslint-disable-next-line no-new */
2216
+ new RegExp(value);
2217
+ } catch (ex) {
2218
+ return args.map(v => utils.escapeRegex(v)).join('..');
2219
+ }
2220
+
2221
+ return value;
2222
+ };
2223
+
2224
+ /**
2225
+ * Create the message for a syntax error
2226
+ */
2227
+
2228
+ const syntaxError = (type, char) => {
2229
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
2230
+ };
2231
+
2232
+ /**
2233
+ * Parse the given input string.
2234
+ * @param {String} input
2235
+ * @param {Object} options
2236
+ * @return {Object}
2237
+ */
2238
+
2239
+ const parse = (input, options) => {
2240
+ if (typeof input !== 'string') {
2241
+ throw new TypeError('Expected a string');
2242
+ }
2243
+
2244
+ input = REPLACEMENTS[input] || input;
2245
+
2246
+ const opts = { ...options };
2247
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2248
+
2249
+ let len = input.length;
2250
+ if (len > max) {
2251
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
2252
+ }
2253
+
2254
+ const bos = { type: 'bos', value: '', output: opts.prepend || '' };
2255
+ const tokens = [bos];
2256
+
2257
+ const capture = opts.capture ? '' : '?:';
2258
+ const win32 = utils.isWindows(options);
2259
+
2260
+ // create constants based on platform, for windows or posix
2261
+ const PLATFORM_CHARS = constants.globChars(win32);
2262
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
2263
+
2264
+ const {
2265
+ DOT_LITERAL,
2266
+ PLUS_LITERAL,
2267
+ SLASH_LITERAL,
2268
+ ONE_CHAR,
2269
+ DOTS_SLASH,
2270
+ NO_DOT,
2271
+ NO_DOT_SLASH,
2272
+ NO_DOTS_SLASH,
2273
+ QMARK,
2274
+ QMARK_NO_DOT,
2275
+ STAR,
2276
+ START_ANCHOR
2277
+ } = PLATFORM_CHARS;
2278
+
2279
+ const globstar = opts => {
2280
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
2281
+ };
2282
+
2283
+ const nodot = opts.dot ? '' : NO_DOT;
2284
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
2285
+ let star = opts.bash === true ? globstar(opts) : STAR;
2286
+
2287
+ if (opts.capture) {
2288
+ star = `(${star})`;
2289
+ }
2290
+
2291
+ // minimatch options support
2292
+ if (typeof opts.noext === 'boolean') {
2293
+ opts.noextglob = opts.noext;
2294
+ }
2295
+
2296
+ const state = {
2297
+ input,
2298
+ index: -1,
2299
+ start: 0,
2300
+ dot: opts.dot === true,
2301
+ consumed: '',
2302
+ output: '',
2303
+ prefix: '',
2304
+ backtrack: false,
2305
+ negated: false,
2306
+ brackets: 0,
2307
+ braces: 0,
2308
+ parens: 0,
2309
+ quotes: 0,
2310
+ globstar: false,
2311
+ tokens
2312
+ };
2313
+
2314
+ input = utils.removePrefix(input, state);
2315
+ len = input.length;
2316
+
2317
+ const extglobs = [];
2318
+ const braces = [];
2319
+ const stack = [];
2320
+ let prev = bos;
2321
+ let value;
2322
+
2323
+ /**
2324
+ * Tokenizing helpers
2325
+ */
2326
+
2327
+ const eos = () => state.index === len - 1;
2328
+ const peek = state.peek = (n = 1) => input[state.index + n];
2329
+ const advance = state.advance = () => input[++state.index] || '';
2330
+ const remaining = () => input.slice(state.index + 1);
2331
+ const consume = (value = '', num = 0) => {
2332
+ state.consumed += value;
2333
+ state.index += num;
2334
+ };
2335
+
2336
+ const append = token => {
2337
+ state.output += token.output != null ? token.output : token.value;
2338
+ consume(token.value);
2339
+ };
2340
+
2341
+ const negate = () => {
2342
+ let count = 1;
2343
+
2344
+ while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
2345
+ advance();
2346
+ state.start++;
2347
+ count++;
2348
+ }
2349
+
2350
+ if (count % 2 === 0) {
2351
+ return false;
2352
+ }
2353
+
2354
+ state.negated = true;
2355
+ state.start++;
2356
+ return true;
2357
+ };
2358
+
2359
+ const increment = type => {
2360
+ state[type]++;
2361
+ stack.push(type);
2362
+ };
2363
+
2364
+ const decrement = type => {
2365
+ state[type]--;
2366
+ stack.pop();
2367
+ };
2368
+
2369
+ /**
2370
+ * Push tokens onto the tokens array. This helper speeds up
2371
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
2372
+ * and 2) helping us avoid creating extra tokens when consecutive
2373
+ * characters are plain text. This improves performance and simplifies
2374
+ * lookbehinds.
2375
+ */
2376
+
2377
+ const push = tok => {
2378
+ if (prev.type === 'globstar') {
2379
+ const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
2380
+ const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
2381
+
2382
+ if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
2383
+ state.output = state.output.slice(0, -prev.output.length);
2384
+ prev.type = 'star';
2385
+ prev.value = '*';
2386
+ prev.output = star;
2387
+ state.output += prev.output;
2388
+ }
2389
+ }
2390
+
2391
+ if (extglobs.length && tok.type !== 'paren') {
2392
+ extglobs[extglobs.length - 1].inner += tok.value;
2393
+ }
2394
+
2395
+ if (tok.value || tok.output) append(tok);
2396
+ if (prev && prev.type === 'text' && tok.type === 'text') {
2397
+ prev.value += tok.value;
2398
+ prev.output = (prev.output || '') + tok.value;
2399
+ return;
2400
+ }
2401
+
2402
+ tok.prev = prev;
2403
+ tokens.push(tok);
2404
+ prev = tok;
2405
+ };
2406
+
2407
+ const extglobOpen = (type, value) => {
2408
+ const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
2409
+
2410
+ token.prev = prev;
2411
+ token.parens = state.parens;
2412
+ token.output = state.output;
2413
+ const output = (opts.capture ? '(' : '') + token.open;
2414
+
2415
+ increment('parens');
2416
+ push({ type, value, output: state.output ? '' : ONE_CHAR });
2417
+ push({ type: 'paren', extglob: true, value: advance(), output });
2418
+ extglobs.push(token);
2419
+ };
2420
+
2421
+ const extglobClose = token => {
2422
+ let output = token.close + (opts.capture ? ')' : '');
2423
+ let rest;
2424
+
2425
+ if (token.type === 'negate') {
2426
+ let extglobStar = star;
2427
+
2428
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
2429
+ extglobStar = globstar(opts);
2430
+ }
2431
+
2432
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
2433
+ output = token.close = `)$))${extglobStar}`;
2434
+ }
2435
+
2436
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
2437
+ // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
2438
+ // In this case, we need to parse the string and use it in the output of the original pattern.
2439
+ // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
2440
+ //
2441
+ // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
2442
+ const expression = parse(rest, { ...options, fastpaths: false }).output;
2443
+
2444
+ output = token.close = `)${expression})${extglobStar})`;
2445
+ }
2446
+
2447
+ if (token.prev.type === 'bos') {
2448
+ state.negatedExtglob = true;
2449
+ }
2450
+ }
2451
+
2452
+ push({ type: 'paren', extglob: true, value, output });
2453
+ decrement('parens');
2454
+ };
2455
+
2456
+ /**
2457
+ * Fast paths
2458
+ */
2459
+
2460
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
2461
+ let backslashes = false;
2462
+
2463
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
2464
+ if (first === '\\') {
2465
+ backslashes = true;
2466
+ return m;
2467
+ }
2468
+
2469
+ if (first === '?') {
2470
+ if (esc) {
2471
+ return esc + first + (rest ? QMARK.repeat(rest.length) : '');
2472
+ }
2473
+ if (index === 0) {
2474
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
2475
+ }
2476
+ return QMARK.repeat(chars.length);
2477
+ }
2478
+
2479
+ if (first === '.') {
2480
+ return DOT_LITERAL.repeat(chars.length);
2481
+ }
2482
+
2483
+ if (first === '*') {
2484
+ if (esc) {
2485
+ return esc + first + (rest ? star : '');
2486
+ }
2487
+ return star;
2488
+ }
2489
+ return esc ? m : `\\${m}`;
2490
+ });
2491
+
2492
+ if (backslashes === true) {
2493
+ if (opts.unescape === true) {
2494
+ output = output.replace(/\\/g, '');
2495
+ } else {
2496
+ output = output.replace(/\\+/g, m => {
2497
+ return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
2498
+ });
2499
+ }
2500
+ }
2501
+
2502
+ if (output === input && opts.contains === true) {
2503
+ state.output = input;
2504
+ return state;
2505
+ }
2506
+
2507
+ state.output = utils.wrapOutput(output, state, options);
2508
+ return state;
2509
+ }
2510
+
2511
+ /**
2512
+ * Tokenize input until we reach end-of-string
2513
+ */
2514
+
2515
+ while (!eos()) {
2516
+ value = advance();
2517
+
2518
+ if (value === '\u0000') {
2519
+ continue;
2520
+ }
2521
+
2522
+ /**
2523
+ * Escaped characters
2524
+ */
2525
+
2526
+ if (value === '\\') {
2527
+ const next = peek();
2528
+
2529
+ if (next === '/' && opts.bash !== true) {
2530
+ continue;
2531
+ }
2532
+
2533
+ if (next === '.' || next === ';') {
2534
+ continue;
2535
+ }
2536
+
2537
+ if (!next) {
2538
+ value += '\\';
2539
+ push({ type: 'text', value });
2540
+ continue;
2541
+ }
2542
+
2543
+ // collapse slashes to reduce potential for exploits
2544
+ const match = /^\\+/.exec(remaining());
2545
+ let slashes = 0;
2546
+
2547
+ if (match && match[0].length > 2) {
2548
+ slashes = match[0].length;
2549
+ state.index += slashes;
2550
+ if (slashes % 2 !== 0) {
2551
+ value += '\\';
2552
+ }
2553
+ }
2554
+
2555
+ if (opts.unescape === true) {
2556
+ value = advance();
2557
+ } else {
2558
+ value += advance();
2559
+ }
2560
+
2561
+ if (state.brackets === 0) {
2562
+ push({ type: 'text', value });
2563
+ continue;
2564
+ }
2565
+ }
2566
+
2567
+ /**
2568
+ * If we're inside a regex character class, continue
2569
+ * until we reach the closing bracket.
2570
+ */
2571
+
2572
+ if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
2573
+ if (opts.posix !== false && value === ':') {
2574
+ const inner = prev.value.slice(1);
2575
+ if (inner.includes('[')) {
2576
+ prev.posix = true;
2577
+
2578
+ if (inner.includes(':')) {
2579
+ const idx = prev.value.lastIndexOf('[');
2580
+ const pre = prev.value.slice(0, idx);
2581
+ const rest = prev.value.slice(idx + 2);
2582
+ const posix = POSIX_REGEX_SOURCE[rest];
2583
+ if (posix) {
2584
+ prev.value = pre + posix;
2585
+ state.backtrack = true;
2586
+ advance();
2587
+
2588
+ if (!bos.output && tokens.indexOf(prev) === 1) {
2589
+ bos.output = ONE_CHAR;
2590
+ }
2591
+ continue;
2592
+ }
2593
+ }
2594
+ }
2595
+ }
2596
+
2597
+ if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
2598
+ value = `\\${value}`;
2599
+ }
2600
+
2601
+ if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
2602
+ value = `\\${value}`;
2603
+ }
2604
+
2605
+ if (opts.posix === true && value === '!' && prev.value === '[') {
2606
+ value = '^';
2607
+ }
2608
+
2609
+ prev.value += value;
2610
+ append({ value });
2611
+ continue;
2612
+ }
2613
+
2614
+ /**
2615
+ * If we're inside a quoted string, continue
2616
+ * until we reach the closing double quote.
2617
+ */
2618
+
2619
+ if (state.quotes === 1 && value !== '"') {
2620
+ value = utils.escapeRegex(value);
2621
+ prev.value += value;
2622
+ append({ value });
2623
+ continue;
2624
+ }
2625
+
2626
+ /**
2627
+ * Double quotes
2628
+ */
2629
+
2630
+ if (value === '"') {
2631
+ state.quotes = state.quotes === 1 ? 0 : 1;
2632
+ if (opts.keepQuotes === true) {
2633
+ push({ type: 'text', value });
2634
+ }
2635
+ continue;
2636
+ }
2637
+
2638
+ /**
2639
+ * Parentheses
2640
+ */
2641
+
2642
+ if (value === '(') {
2643
+ increment('parens');
2644
+ push({ type: 'paren', value });
2645
+ continue;
2646
+ }
2647
+
2648
+ if (value === ')') {
2649
+ if (state.parens === 0 && opts.strictBrackets === true) {
2650
+ throw new SyntaxError(syntaxError('opening', '('));
2651
+ }
2652
+
2653
+ const extglob = extglobs[extglobs.length - 1];
2654
+ if (extglob && state.parens === extglob.parens + 1) {
2655
+ extglobClose(extglobs.pop());
2656
+ continue;
2657
+ }
2658
+
2659
+ push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
2660
+ decrement('parens');
2661
+ continue;
2662
+ }
2663
+
2664
+ /**
2665
+ * Square brackets
2666
+ */
2667
+
2668
+ if (value === '[') {
2669
+ if (opts.nobracket === true || !remaining().includes(']')) {
2670
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
2671
+ throw new SyntaxError(syntaxError('closing', ']'));
2672
+ }
2673
+
2674
+ value = `\\${value}`;
2675
+ } else {
2676
+ increment('brackets');
2677
+ }
2678
+
2679
+ push({ type: 'bracket', value });
2680
+ continue;
2681
+ }
2682
+
2683
+ if (value === ']') {
2684
+ if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
2685
+ push({ type: 'text', value, output: `\\${value}` });
2686
+ continue;
2687
+ }
2688
+
2689
+ if (state.brackets === 0) {
2690
+ if (opts.strictBrackets === true) {
2691
+ throw new SyntaxError(syntaxError('opening', '['));
2692
+ }
2693
+
2694
+ push({ type: 'text', value, output: `\\${value}` });
2695
+ continue;
2696
+ }
2697
+
2698
+ decrement('brackets');
2699
+
2700
+ const prevValue = prev.value.slice(1);
2701
+ if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
2702
+ value = `/${value}`;
2703
+ }
2704
+
2705
+ prev.value += value;
2706
+ append({ value });
2707
+
2708
+ // when literal brackets are explicitly disabled
2709
+ // assume we should match with a regex character class
2710
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
2711
+ continue;
2712
+ }
2713
+
2714
+ const escaped = utils.escapeRegex(prev.value);
2715
+ state.output = state.output.slice(0, -prev.value.length);
2716
+
2717
+ // when literal brackets are explicitly enabled
2718
+ // assume we should escape the brackets to match literal characters
2719
+ if (opts.literalBrackets === true) {
2720
+ state.output += escaped;
2721
+ prev.value = escaped;
2722
+ continue;
2723
+ }
2724
+
2725
+ // when the user specifies nothing, try to match both
2726
+ prev.value = `(${capture}${escaped}|${prev.value})`;
2727
+ state.output += prev.value;
2728
+ continue;
2729
+ }
2730
+
2731
+ /**
2732
+ * Braces
2733
+ */
2734
+
2735
+ if (value === '{' && opts.nobrace !== true) {
2736
+ increment('braces');
2737
+
2738
+ const open = {
2739
+ type: 'brace',
2740
+ value,
2741
+ output: '(',
2742
+ outputIndex: state.output.length,
2743
+ tokensIndex: state.tokens.length
2744
+ };
2745
+
2746
+ braces.push(open);
2747
+ push(open);
2748
+ continue;
2749
+ }
2750
+
2751
+ if (value === '}') {
2752
+ const brace = braces[braces.length - 1];
2753
+
2754
+ if (opts.nobrace === true || !brace) {
2755
+ push({ type: 'text', value, output: value });
2756
+ continue;
2757
+ }
2758
+
2759
+ let output = ')';
2760
+
2761
+ if (brace.dots === true) {
2762
+ const arr = tokens.slice();
2763
+ const range = [];
2764
+
2765
+ for (let i = arr.length - 1; i >= 0; i--) {
2766
+ tokens.pop();
2767
+ if (arr[i].type === 'brace') {
2768
+ break;
2769
+ }
2770
+ if (arr[i].type !== 'dots') {
2771
+ range.unshift(arr[i].value);
2772
+ }
2773
+ }
2774
+
2775
+ output = expandRange(range, opts);
2776
+ state.backtrack = true;
2777
+ }
2778
+
2779
+ if (brace.comma !== true && brace.dots !== true) {
2780
+ const out = state.output.slice(0, brace.outputIndex);
2781
+ const toks = state.tokens.slice(brace.tokensIndex);
2782
+ brace.value = brace.output = '\\{';
2783
+ value = output = '\\}';
2784
+ state.output = out;
2785
+ for (const t of toks) {
2786
+ state.output += (t.output || t.value);
2787
+ }
2788
+ }
2789
+
2790
+ push({ type: 'brace', value, output });
2791
+ decrement('braces');
2792
+ braces.pop();
2793
+ continue;
2794
+ }
2795
+
2796
+ /**
2797
+ * Pipes
2798
+ */
2799
+
2800
+ if (value === '|') {
2801
+ if (extglobs.length > 0) {
2802
+ extglobs[extglobs.length - 1].conditions++;
2803
+ }
2804
+ push({ type: 'text', value });
2805
+ continue;
2806
+ }
2807
+
2808
+ /**
2809
+ * Commas
2810
+ */
2811
+
2812
+ if (value === ',') {
2813
+ let output = value;
2814
+
2815
+ const brace = braces[braces.length - 1];
2816
+ if (brace && stack[stack.length - 1] === 'braces') {
2817
+ brace.comma = true;
2818
+ output = '|';
2819
+ }
2820
+
2821
+ push({ type: 'comma', value, output });
2822
+ continue;
2823
+ }
2824
+
2825
+ /**
2826
+ * Slashes
2827
+ */
2828
+
2829
+ if (value === '/') {
2830
+ // if the beginning of the glob is "./", advance the start
2831
+ // to the current index, and don't add the "./" characters
2832
+ // to the state. This greatly simplifies lookbehinds when
2833
+ // checking for BOS characters like "!" and "." (not "./")
2834
+ if (prev.type === 'dot' && state.index === state.start + 1) {
2835
+ state.start = state.index + 1;
2836
+ state.consumed = '';
2837
+ state.output = '';
2838
+ tokens.pop();
2839
+ prev = bos; // reset "prev" to the first token
2840
+ continue;
2841
+ }
2842
+
2843
+ push({ type: 'slash', value, output: SLASH_LITERAL });
2844
+ continue;
2845
+ }
2846
+
2847
+ /**
2848
+ * Dots
2849
+ */
2850
+
2851
+ if (value === '.') {
2852
+ if (state.braces > 0 && prev.type === 'dot') {
2853
+ if (prev.value === '.') prev.output = DOT_LITERAL;
2854
+ const brace = braces[braces.length - 1];
2855
+ prev.type = 'dots';
2856
+ prev.output += value;
2857
+ prev.value += value;
2858
+ brace.dots = true;
2859
+ continue;
2860
+ }
2861
+
2862
+ if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
2863
+ push({ type: 'text', value, output: DOT_LITERAL });
2864
+ continue;
2865
+ }
2866
+
2867
+ push({ type: 'dot', value, output: DOT_LITERAL });
2868
+ continue;
2869
+ }
2870
+
2871
+ /**
2872
+ * Question marks
2873
+ */
2874
+
2875
+ if (value === '?') {
2876
+ const isGroup = prev && prev.value === '(';
2877
+ if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
2878
+ extglobOpen('qmark', value);
2879
+ continue;
2880
+ }
2881
+
2882
+ if (prev && prev.type === 'paren') {
2883
+ const next = peek();
2884
+ let output = value;
2885
+
2886
+ if (next === '<' && !utils.supportsLookbehinds()) {
2887
+ throw new Error('Node.js v10 or higher is required for regex lookbehinds');
2888
+ }
2889
+
2890
+ if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
2891
+ output = `\\${value}`;
2892
+ }
2893
+
2894
+ push({ type: 'text', value, output });
2895
+ continue;
2896
+ }
2897
+
2898
+ if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
2899
+ push({ type: 'qmark', value, output: QMARK_NO_DOT });
2900
+ continue;
2901
+ }
2902
+
2903
+ push({ type: 'qmark', value, output: QMARK });
2904
+ continue;
2905
+ }
2906
+
2907
+ /**
2908
+ * Exclamation
2909
+ */
2910
+
2911
+ if (value === '!') {
2912
+ if (opts.noextglob !== true && peek() === '(') {
2913
+ if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
2914
+ extglobOpen('negate', value);
2915
+ continue;
2916
+ }
2917
+ }
2918
+
2919
+ if (opts.nonegate !== true && state.index === 0) {
2920
+ negate();
2921
+ continue;
2922
+ }
2923
+ }
2924
+
2925
+ /**
2926
+ * Plus
2927
+ */
2928
+
2929
+ if (value === '+') {
2930
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
2931
+ extglobOpen('plus', value);
2932
+ continue;
2933
+ }
2934
+
2935
+ if ((prev && prev.value === '(') || opts.regex === false) {
2936
+ push({ type: 'plus', value, output: PLUS_LITERAL });
2937
+ continue;
2938
+ }
2939
+
2940
+ if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
2941
+ push({ type: 'plus', value });
2942
+ continue;
2943
+ }
2944
+
2945
+ push({ type: 'plus', value: PLUS_LITERAL });
2946
+ continue;
2947
+ }
2948
+
2949
+ /**
2950
+ * Plain text
2951
+ */
2952
+
2953
+ if (value === '@') {
2954
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
2955
+ push({ type: 'at', extglob: true, value, output: '' });
2956
+ continue;
2957
+ }
2958
+
2959
+ push({ type: 'text', value });
2960
+ continue;
2961
+ }
2962
+
2963
+ /**
2964
+ * Plain text
2965
+ */
2966
+
2967
+ if (value !== '*') {
2968
+ if (value === '$' || value === '^') {
2969
+ value = `\\${value}`;
2970
+ }
2971
+
2972
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
2973
+ if (match) {
2974
+ value += match[0];
2975
+ state.index += match[0].length;
2976
+ }
2977
+
2978
+ push({ type: 'text', value });
2979
+ continue;
2980
+ }
2981
+
2982
+ /**
2983
+ * Stars
2984
+ */
2985
+
2986
+ if (prev && (prev.type === 'globstar' || prev.star === true)) {
2987
+ prev.type = 'star';
2988
+ prev.star = true;
2989
+ prev.value += value;
2990
+ prev.output = star;
2991
+ state.backtrack = true;
2992
+ state.globstar = true;
2993
+ consume(value);
2994
+ continue;
2995
+ }
2996
+
2997
+ let rest = remaining();
2998
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
2999
+ extglobOpen('star', value);
3000
+ continue;
3001
+ }
3002
+
3003
+ if (prev.type === 'star') {
3004
+ if (opts.noglobstar === true) {
3005
+ consume(value);
3006
+ continue;
3007
+ }
3008
+
3009
+ const prior = prev.prev;
3010
+ const before = prior.prev;
3011
+ const isStart = prior.type === 'slash' || prior.type === 'bos';
3012
+ const afterStar = before && (before.type === 'star' || before.type === 'globstar');
3013
+
3014
+ if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
3015
+ push({ type: 'star', value, output: '' });
3016
+ continue;
3017
+ }
3018
+
3019
+ const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
3020
+ const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
3021
+ if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
3022
+ push({ type: 'star', value, output: '' });
3023
+ continue;
3024
+ }
3025
+
3026
+ // strip consecutive `/**/`
3027
+ while (rest.slice(0, 3) === '/**') {
3028
+ const after = input[state.index + 4];
3029
+ if (after && after !== '/') {
3030
+ break;
3031
+ }
3032
+ rest = rest.slice(3);
3033
+ consume('/**', 3);
3034
+ }
3035
+
3036
+ if (prior.type === 'bos' && eos()) {
3037
+ prev.type = 'globstar';
3038
+ prev.value += value;
3039
+ prev.output = globstar(opts);
3040
+ state.output = prev.output;
3041
+ state.globstar = true;
3042
+ consume(value);
3043
+ continue;
3044
+ }
3045
+
3046
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
3047
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
3048
+ prior.output = `(?:${prior.output}`;
3049
+
3050
+ prev.type = 'globstar';
3051
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
3052
+ prev.value += value;
3053
+ state.globstar = true;
3054
+ state.output += prior.output + prev.output;
3055
+ consume(value);
3056
+ continue;
3057
+ }
3058
+
3059
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
3060
+ const end = rest[1] !== void 0 ? '|$' : '';
3061
+
3062
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
3063
+ prior.output = `(?:${prior.output}`;
3064
+
3065
+ prev.type = 'globstar';
3066
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
3067
+ prev.value += value;
3068
+
3069
+ state.output += prior.output + prev.output;
3070
+ state.globstar = true;
3071
+
3072
+ consume(value + advance());
3073
+
3074
+ push({ type: 'slash', value: '/', output: '' });
3075
+ continue;
3076
+ }
3077
+
3078
+ if (prior.type === 'bos' && rest[0] === '/') {
3079
+ prev.type = 'globstar';
3080
+ prev.value += value;
3081
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
3082
+ state.output = prev.output;
3083
+ state.globstar = true;
3084
+ consume(value + advance());
3085
+ push({ type: 'slash', value: '/', output: '' });
3086
+ continue;
3087
+ }
3088
+
3089
+ // remove single star from output
3090
+ state.output = state.output.slice(0, -prev.output.length);
3091
+
3092
+ // reset previous token to globstar
3093
+ prev.type = 'globstar';
3094
+ prev.output = globstar(opts);
3095
+ prev.value += value;
3096
+
3097
+ // reset output with globstar
3098
+ state.output += prev.output;
3099
+ state.globstar = true;
3100
+ consume(value);
3101
+ continue;
3102
+ }
3103
+
3104
+ const token = { type: 'star', value, output: star };
3105
+
3106
+ if (opts.bash === true) {
3107
+ token.output = '.*?';
3108
+ if (prev.type === 'bos' || prev.type === 'slash') {
3109
+ token.output = nodot + token.output;
3110
+ }
3111
+ push(token);
3112
+ continue;
3113
+ }
3114
+
3115
+ if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
3116
+ token.output = value;
3117
+ push(token);
3118
+ continue;
3119
+ }
3120
+
3121
+ if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
3122
+ if (prev.type === 'dot') {
3123
+ state.output += NO_DOT_SLASH;
3124
+ prev.output += NO_DOT_SLASH;
3125
+
3126
+ } else if (opts.dot === true) {
3127
+ state.output += NO_DOTS_SLASH;
3128
+ prev.output += NO_DOTS_SLASH;
3129
+
3130
+ } else {
3131
+ state.output += nodot;
3132
+ prev.output += nodot;
3133
+ }
3134
+
3135
+ if (peek() !== '*') {
3136
+ state.output += ONE_CHAR;
3137
+ prev.output += ONE_CHAR;
3138
+ }
3139
+ }
3140
+
3141
+ push(token);
3142
+ }
3143
+
3144
+ while (state.brackets > 0) {
3145
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
3146
+ state.output = utils.escapeLast(state.output, '[');
3147
+ decrement('brackets');
3148
+ }
3149
+
3150
+ while (state.parens > 0) {
3151
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
3152
+ state.output = utils.escapeLast(state.output, '(');
3153
+ decrement('parens');
3154
+ }
3155
+
3156
+ while (state.braces > 0) {
3157
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
3158
+ state.output = utils.escapeLast(state.output, '{');
3159
+ decrement('braces');
3160
+ }
3161
+
3162
+ if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
3163
+ push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
3164
+ }
3165
+
3166
+ // rebuild the output if we had to backtrack at any point
3167
+ if (state.backtrack === true) {
3168
+ state.output = '';
3169
+
3170
+ for (const token of state.tokens) {
3171
+ state.output += token.output != null ? token.output : token.value;
3172
+
3173
+ if (token.suffix) {
3174
+ state.output += token.suffix;
3175
+ }
3176
+ }
3177
+ }
3178
+
3179
+ return state;
3180
+ };
3181
+
3182
+ /**
3183
+ * Fast paths for creating regular expressions for common glob patterns.
3184
+ * This can significantly speed up processing and has very little downside
3185
+ * impact when none of the fast paths match.
3186
+ */
3187
+
3188
+ parse.fastpaths = (input, options) => {
3189
+ const opts = { ...options };
3190
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
3191
+ const len = input.length;
3192
+ if (len > max) {
3193
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
3194
+ }
3195
+
3196
+ input = REPLACEMENTS[input] || input;
3197
+ const win32 = utils.isWindows(options);
3198
+
3199
+ // create constants based on platform, for windows or posix
3200
+ const {
3201
+ DOT_LITERAL,
3202
+ SLASH_LITERAL,
3203
+ ONE_CHAR,
3204
+ DOTS_SLASH,
3205
+ NO_DOT,
3206
+ NO_DOTS,
3207
+ NO_DOTS_SLASH,
3208
+ STAR,
3209
+ START_ANCHOR
3210
+ } = constants.globChars(win32);
3211
+
3212
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
3213
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
3214
+ const capture = opts.capture ? '' : '?:';
3215
+ const state = { negated: false, prefix: '' };
3216
+ let star = opts.bash === true ? '.*?' : STAR;
3217
+
3218
+ if (opts.capture) {
3219
+ star = `(${star})`;
3220
+ }
3221
+
3222
+ const globstar = opts => {
3223
+ if (opts.noglobstar === true) return star;
3224
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
3225
+ };
3226
+
3227
+ const create = str => {
3228
+ switch (str) {
3229
+ case '*':
3230
+ return `${nodot}${ONE_CHAR}${star}`;
3231
+
3232
+ case '.*':
3233
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
3234
+
3235
+ case '*.*':
3236
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
3237
+
3238
+ case '*/*':
3239
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
3240
+
3241
+ case '**':
3242
+ return nodot + globstar(opts);
3243
+
3244
+ case '**/*':
3245
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
3246
+
3247
+ case '**/*.*':
3248
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
3249
+
3250
+ case '**/.*':
3251
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
3252
+
3253
+ default: {
3254
+ const match = /^(.*?)\.(\w+)$/.exec(str);
3255
+ if (!match) return;
3256
+
3257
+ const source = create(match[1]);
3258
+ if (!source) return;
3259
+
3260
+ return source + DOT_LITERAL + match[2];
3261
+ }
3262
+ }
3263
+ };
3264
+
3265
+ const output = utils.removePrefix(input, state);
3266
+ let source = create(output);
3267
+
3268
+ if (source && opts.strictSlashes !== true) {
3269
+ source += `${SLASH_LITERAL}?`;
3270
+ }
3271
+
3272
+ return source;
3273
+ };
3274
+
3275
+ parse_1 = parse;
3276
+ return parse_1;
3277
+ }
3278
+
3279
+ var picomatch_1;
3280
+ var hasRequiredPicomatch$1;
3281
+
3282
+ function requirePicomatch$1 () {
3283
+ if (hasRequiredPicomatch$1) return picomatch_1;
3284
+ hasRequiredPicomatch$1 = 1;
3285
+
3286
+ const path = require$$0__default$1.default;
3287
+ const scan = requireScan();
3288
+ const parse = requireParse();
3289
+ const utils = requireUtils();
3290
+ const constants = requireConstants();
3291
+ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
3292
+
3293
+ /**
3294
+ * Creates a matcher function from one or more glob patterns. The
3295
+ * returned function takes a string to match as its first argument,
3296
+ * and returns true if the string is a match. The returned matcher
3297
+ * function also takes a boolean as the second argument that, when true,
3298
+ * returns an object with additional information.
3299
+ *
3300
+ * ```js
3301
+ * const picomatch = require('picomatch');
3302
+ * // picomatch(glob[, options]);
3303
+ *
3304
+ * const isMatch = picomatch('*.!(*a)');
3305
+ * console.log(isMatch('a.a')); //=> false
3306
+ * console.log(isMatch('a.b')); //=> true
3307
+ * ```
3308
+ * @name picomatch
3309
+ * @param {String|Array} `globs` One or more glob patterns.
3310
+ * @param {Object=} `options`
3311
+ * @return {Function=} Returns a matcher function.
3312
+ * @api public
3313
+ */
3314
+
3315
+ const picomatch = (glob, options, returnState = false) => {
3316
+ if (Array.isArray(glob)) {
3317
+ const fns = glob.map(input => picomatch(input, options, returnState));
3318
+ const arrayMatcher = str => {
3319
+ for (const isMatch of fns) {
3320
+ const state = isMatch(str);
3321
+ if (state) return state;
3322
+ }
3323
+ return false;
3324
+ };
3325
+ return arrayMatcher;
3326
+ }
3327
+
3328
+ const isState = isObject(glob) && glob.tokens && glob.input;
3329
+
3330
+ if (glob === '' || (typeof glob !== 'string' && !isState)) {
3331
+ throw new TypeError('Expected pattern to be a non-empty string');
3332
+ }
3333
+
3334
+ const opts = options || {};
3335
+ const posix = utils.isWindows(options);
3336
+ const regex = isState
3337
+ ? picomatch.compileRe(glob, options)
3338
+ : picomatch.makeRe(glob, options, false, true);
3339
+
3340
+ const state = regex.state;
3341
+ delete regex.state;
3342
+
3343
+ let isIgnored = () => false;
3344
+ if (opts.ignore) {
3345
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
3346
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
3347
+ }
3348
+
3349
+ const matcher = (input, returnObject = false) => {
3350
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
3351
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
3352
+
3353
+ if (typeof opts.onResult === 'function') {
3354
+ opts.onResult(result);
3355
+ }
3356
+
3357
+ if (isMatch === false) {
3358
+ result.isMatch = false;
3359
+ return returnObject ? result : false;
3360
+ }
3361
+
3362
+ if (isIgnored(input)) {
3363
+ if (typeof opts.onIgnore === 'function') {
3364
+ opts.onIgnore(result);
3365
+ }
3366
+ result.isMatch = false;
3367
+ return returnObject ? result : false;
3368
+ }
3369
+
3370
+ if (typeof opts.onMatch === 'function') {
3371
+ opts.onMatch(result);
3372
+ }
3373
+ return returnObject ? result : true;
3374
+ };
3375
+
3376
+ if (returnState) {
3377
+ matcher.state = state;
3378
+ }
3379
+
3380
+ return matcher;
3381
+ };
3382
+
3383
+ /**
3384
+ * Test `input` with the given `regex`. This is used by the main
3385
+ * `picomatch()` function to test the input string.
3386
+ *
3387
+ * ```js
3388
+ * const picomatch = require('picomatch');
3389
+ * // picomatch.test(input, regex[, options]);
3390
+ *
3391
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
3392
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
3393
+ * ```
3394
+ * @param {String} `input` String to test.
3395
+ * @param {RegExp} `regex`
3396
+ * @return {Object} Returns an object with matching info.
3397
+ * @api public
3398
+ */
3399
+
3400
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
3401
+ if (typeof input !== 'string') {
3402
+ throw new TypeError('Expected input to be a string');
3403
+ }
3404
+
3405
+ if (input === '') {
3406
+ return { isMatch: false, output: '' };
3407
+ }
3408
+
3409
+ const opts = options || {};
3410
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
3411
+ let match = input === glob;
3412
+ let output = (match && format) ? format(input) : input;
3413
+
3414
+ if (match === false) {
3415
+ output = format ? format(input) : input;
3416
+ match = output === glob;
3417
+ }
3418
+
3419
+ if (match === false || opts.capture === true) {
3420
+ if (opts.matchBase === true || opts.basename === true) {
3421
+ match = picomatch.matchBase(input, regex, options, posix);
3422
+ } else {
3423
+ match = regex.exec(output);
3424
+ }
3425
+ }
3426
+
3427
+ return { isMatch: Boolean(match), match, output };
3428
+ };
3429
+
3430
+ /**
3431
+ * Match the basename of a filepath.
3432
+ *
3433
+ * ```js
3434
+ * const picomatch = require('picomatch');
3435
+ * // picomatch.matchBase(input, glob[, options]);
3436
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
3437
+ * ```
3438
+ * @param {String} `input` String to test.
3439
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
3440
+ * @return {Boolean}
3441
+ * @api public
3442
+ */
3443
+
3444
+ picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3445
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
3446
+ return regex.test(path.basename(input));
3447
+ };
3448
+
3449
+ /**
3450
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
3451
+ *
3452
+ * ```js
3453
+ * const picomatch = require('picomatch');
3454
+ * // picomatch.isMatch(string, patterns[, options]);
3455
+ *
3456
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
3457
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
3458
+ * ```
3459
+ * @param {String|Array} str The string to test.
3460
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
3461
+ * @param {Object} [options] See available [options](#options).
3462
+ * @return {Boolean} Returns true if any patterns match `str`
3463
+ * @api public
3464
+ */
3465
+
3466
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3467
+
3468
+ /**
3469
+ * Parse a glob pattern to create the source string for a regular
3470
+ * expression.
3471
+ *
3472
+ * ```js
3473
+ * const picomatch = require('picomatch');
3474
+ * const result = picomatch.parse(pattern[, options]);
3475
+ * ```
3476
+ * @param {String} `pattern`
3477
+ * @param {Object} `options`
3478
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
3479
+ * @api public
3480
+ */
3481
+
3482
+ picomatch.parse = (pattern, options) => {
3483
+ if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
3484
+ return parse(pattern, { ...options, fastpaths: false });
3485
+ };
3486
+
3487
+ /**
3488
+ * Scan a glob pattern to separate the pattern into segments.
3489
+ *
3490
+ * ```js
3491
+ * const picomatch = require('picomatch');
3492
+ * // picomatch.scan(input[, options]);
3493
+ *
3494
+ * const result = picomatch.scan('!./foo/*.js');
3495
+ * console.log(result);
3496
+ * { prefix: '!./',
3497
+ * input: '!./foo/*.js',
3498
+ * start: 3,
3499
+ * base: 'foo',
3500
+ * glob: '*.js',
3501
+ * isBrace: false,
3502
+ * isBracket: false,
3503
+ * isGlob: true,
3504
+ * isExtglob: false,
3505
+ * isGlobstar: false,
3506
+ * negated: true }
3507
+ * ```
3508
+ * @param {String} `input` Glob pattern to scan.
3509
+ * @param {Object} `options`
3510
+ * @return {Object} Returns an object with
3511
+ * @api public
3512
+ */
3513
+
3514
+ picomatch.scan = (input, options) => scan(input, options);
3515
+
3516
+ /**
3517
+ * Compile a regular expression from the `state` object returned by the
3518
+ * [parse()](#parse) method.
3519
+ *
3520
+ * @param {Object} `state`
3521
+ * @param {Object} `options`
3522
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
3523
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
3524
+ * @return {RegExp}
3525
+ * @api public
3526
+ */
3527
+
3528
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
3529
+ if (returnOutput === true) {
3530
+ return state.output;
3531
+ }
3532
+
3533
+ const opts = options || {};
3534
+ const prepend = opts.contains ? '' : '^';
3535
+ const append = opts.contains ? '' : '$';
3536
+
3537
+ let source = `${prepend}(?:${state.output})${append}`;
3538
+ if (state && state.negated === true) {
3539
+ source = `^(?!${source}).*$`;
3540
+ }
3541
+
3542
+ const regex = picomatch.toRegex(source, options);
3543
+ if (returnState === true) {
3544
+ regex.state = state;
3545
+ }
3546
+
3547
+ return regex;
3548
+ };
3549
+
3550
+ /**
3551
+ * Create a regular expression from a parsed glob pattern.
3552
+ *
3553
+ * ```js
3554
+ * const picomatch = require('picomatch');
3555
+ * const state = picomatch.parse('*.js');
3556
+ * // picomatch.compileRe(state[, options]);
3557
+ *
3558
+ * console.log(picomatch.compileRe(state));
3559
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
3560
+ * ```
3561
+ * @param {String} `state` The object returned from the `.parse` method.
3562
+ * @param {Object} `options`
3563
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
3564
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
3565
+ * @return {RegExp} Returns a regex created from the given pattern.
3566
+ * @api public
3567
+ */
3568
+
3569
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
3570
+ if (!input || typeof input !== 'string') {
3571
+ throw new TypeError('Expected a non-empty string');
3572
+ }
3573
+
3574
+ let parsed = { negated: false, fastpaths: true };
3575
+
3576
+ if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
3577
+ parsed.output = parse.fastpaths(input, options);
3578
+ }
3579
+
3580
+ if (!parsed.output) {
3581
+ parsed = parse(input, options);
3582
+ }
3583
+
3584
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
3585
+ };
3586
+
3587
+ /**
3588
+ * Create a regular expression from the given regex source string.
3589
+ *
3590
+ * ```js
3591
+ * const picomatch = require('picomatch');
3592
+ * // picomatch.toRegex(source[, options]);
3593
+ *
3594
+ * const { output } = picomatch.parse('*.js');
3595
+ * console.log(picomatch.toRegex(output));
3596
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
3597
+ * ```
3598
+ * @param {String} `source` Regular expression source string.
3599
+ * @param {Object} `options`
3600
+ * @return {RegExp}
3601
+ * @api public
3602
+ */
3603
+
3604
+ picomatch.toRegex = (source, options) => {
3605
+ try {
3606
+ const opts = options || {};
3607
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
3608
+ } catch (err) {
3609
+ if (options && options.debug === true) throw err;
3610
+ return /$^/;
3611
+ }
3612
+ };
3613
+
3614
+ /**
3615
+ * Picomatch constants.
3616
+ * @return {Object}
3617
+ */
3618
+
3619
+ picomatch.constants = constants;
3620
+
3621
+ /**
3622
+ * Expose "picomatch"
3623
+ */
3624
+
3625
+ picomatch_1 = picomatch;
3626
+ return picomatch_1;
3627
+ }
3628
+
3629
+ var picomatch;
3630
+ var hasRequiredPicomatch;
3631
+
3632
+ function requirePicomatch () {
3633
+ if (hasRequiredPicomatch) return picomatch;
3634
+ hasRequiredPicomatch = 1;
3635
+
3636
+ picomatch = requirePicomatch$1();
3637
+ return picomatch;
3638
+ }
3639
+
3640
+ var micromatch_1;
3641
+ var hasRequiredMicromatch;
3642
+
3643
+ function requireMicromatch () {
3644
+ if (hasRequiredMicromatch) return micromatch_1;
3645
+ hasRequiredMicromatch = 1;
3646
+
3647
+ const util = require$$0__default.default;
3648
+ const braces = requireBraces();
3649
+ const picomatch = requirePicomatch();
3650
+ const utils = requireUtils();
3651
+ const isEmptyString = val => val === '' || val === './';
3652
+
3653
+ /**
3654
+ * Returns an array of strings that match one or more glob patterns.
3655
+ *
3656
+ * ```js
3657
+ * const mm = require('micromatch');
3658
+ * // mm(list, patterns[, options]);
3659
+ *
3660
+ * console.log(mm(['a.js', 'a.txt'], ['*.js']));
3661
+ * //=> [ 'a.js' ]
3662
+ * ```
3663
+ * @param {String|Array<string>} `list` List of strings to match.
3664
+ * @param {String|Array<string>} `patterns` One or more glob patterns to use for matching.
3665
+ * @param {Object} `options` See available [options](#options)
3666
+ * @return {Array} Returns an array of matches
3667
+ * @summary false
3668
+ * @api public
3669
+ */
3670
+
3671
+ const micromatch = (list, patterns, options) => {
3672
+ patterns = [].concat(patterns);
3673
+ list = [].concat(list);
3674
+
3675
+ let omit = new Set();
3676
+ let keep = new Set();
3677
+ let items = new Set();
3678
+ let negatives = 0;
3679
+
3680
+ let onResult = state => {
3681
+ items.add(state.output);
3682
+ if (options && options.onResult) {
3683
+ options.onResult(state);
3684
+ }
3685
+ };
3686
+
3687
+ for (let i = 0; i < patterns.length; i++) {
3688
+ let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
3689
+ let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
3690
+ if (negated) negatives++;
3691
+
3692
+ for (let item of list) {
3693
+ let matched = isMatch(item, true);
3694
+
3695
+ let match = negated ? !matched.isMatch : matched.isMatch;
3696
+ if (!match) continue;
3697
+
3698
+ if (negated) {
3699
+ omit.add(matched.output);
3700
+ } else {
3701
+ omit.delete(matched.output);
3702
+ keep.add(matched.output);
3703
+ }
3704
+ }
3705
+ }
3706
+
3707
+ let result = negatives === patterns.length ? [...items] : [...keep];
3708
+ let matches = result.filter(item => !omit.has(item));
3709
+
3710
+ if (options && matches.length === 0) {
3711
+ if (options.failglob === true) {
3712
+ throw new Error(`No matches found for "${patterns.join(', ')}"`);
3713
+ }
3714
+
3715
+ if (options.nonull === true || options.nullglob === true) {
3716
+ return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns;
3717
+ }
3718
+ }
3719
+
3720
+ return matches;
3721
+ };
3722
+
3723
+ /**
3724
+ * Backwards compatibility
3725
+ */
3726
+
3727
+ micromatch.match = micromatch;
3728
+
3729
+ /**
3730
+ * Returns a matcher function from the given glob `pattern` and `options`.
3731
+ * The returned function takes a string to match as its only argument and returns
3732
+ * true if the string is a match.
3733
+ *
3734
+ * ```js
3735
+ * const mm = require('micromatch');
3736
+ * // mm.matcher(pattern[, options]);
3737
+ *
3738
+ * const isMatch = mm.matcher('*.!(*a)');
3739
+ * console.log(isMatch('a.a')); //=> false
3740
+ * console.log(isMatch('a.b')); //=> true
3741
+ * ```
3742
+ * @param {String} `pattern` Glob pattern
3743
+ * @param {Object} `options`
3744
+ * @return {Function} Returns a matcher function.
3745
+ * @api public
3746
+ */
3747
+
3748
+ micromatch.matcher = (pattern, options) => picomatch(pattern, options);
3749
+
3750
+ /**
3751
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
3752
+ *
3753
+ * ```js
3754
+ * const mm = require('micromatch');
3755
+ * // mm.isMatch(string, patterns[, options]);
3756
+ *
3757
+ * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
3758
+ * console.log(mm.isMatch('a.a', 'b.*')); //=> false
3759
+ * ```
3760
+ * @param {String} `str` The string to test.
3761
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
3762
+ * @param {Object} `[options]` See available [options](#options).
3763
+ * @return {Boolean} Returns true if any patterns match `str`
3764
+ * @api public
3765
+ */
3766
+
3767
+ micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3768
+
3769
+ /**
3770
+ * Backwards compatibility
3771
+ */
3772
+
3773
+ micromatch.any = micromatch.isMatch;
3774
+
3775
+ /**
3776
+ * Returns a list of strings that _**do not match any**_ of the given `patterns`.
3777
+ *
3778
+ * ```js
3779
+ * const mm = require('micromatch');
3780
+ * // mm.not(list, patterns[, options]);
3781
+ *
3782
+ * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
3783
+ * //=> ['b.b', 'c.c']
3784
+ * ```
3785
+ * @param {Array} `list` Array of strings to match.
3786
+ * @param {String|Array} `patterns` One or more glob pattern to use for matching.
3787
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
3788
+ * @return {Array} Returns an array of strings that **do not match** the given patterns.
3789
+ * @api public
3790
+ */
3791
+
3792
+ micromatch.not = (list, patterns, options = {}) => {
3793
+ patterns = [].concat(patterns).map(String);
3794
+ let result = new Set();
3795
+ let items = [];
3796
+
3797
+ let onResult = state => {
3798
+ if (options.onResult) options.onResult(state);
3799
+ items.push(state.output);
3800
+ };
3801
+
3802
+ let matches = new Set(micromatch(list, patterns, { ...options, onResult }));
3803
+
3804
+ for (let item of items) {
3805
+ if (!matches.has(item)) {
3806
+ result.add(item);
3807
+ }
3808
+ }
3809
+ return [...result];
3810
+ };
3811
+
3812
+ /**
3813
+ * Returns true if the given `string` contains the given pattern. Similar
3814
+ * to [.isMatch](#isMatch) but the pattern can match any part of the string.
3815
+ *
3816
+ * ```js
3817
+ * var mm = require('micromatch');
3818
+ * // mm.contains(string, pattern[, options]);
3819
+ *
3820
+ * console.log(mm.contains('aa/bb/cc', '*b'));
3821
+ * //=> true
3822
+ * console.log(mm.contains('aa/bb/cc', '*d'));
3823
+ * //=> false
3824
+ * ```
3825
+ * @param {String} `str` The string to match.
3826
+ * @param {String|Array} `patterns` Glob pattern to use for matching.
3827
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
3828
+ * @return {Boolean} Returns true if any of the patterns matches any part of `str`.
3829
+ * @api public
3830
+ */
3831
+
3832
+ micromatch.contains = (str, pattern, options) => {
3833
+ if (typeof str !== 'string') {
3834
+ throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
3835
+ }
3836
+
3837
+ if (Array.isArray(pattern)) {
3838
+ return pattern.some(p => micromatch.contains(str, p, options));
3839
+ }
3840
+
3841
+ if (typeof pattern === 'string') {
3842
+ if (isEmptyString(str) || isEmptyString(pattern)) {
3843
+ return false;
3844
+ }
3845
+
3846
+ if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) {
3847
+ return true;
3848
+ }
3849
+ }
3850
+
3851
+ return micromatch.isMatch(str, pattern, { ...options, contains: true });
3852
+ };
3853
+
3854
+ /**
3855
+ * Filter the keys of the given object with the given `glob` pattern
3856
+ * and `options`. Does not attempt to match nested keys. If you need this feature,
3857
+ * use [glob-object][] instead.
3858
+ *
3859
+ * ```js
3860
+ * const mm = require('micromatch');
3861
+ * // mm.matchKeys(object, patterns[, options]);
3862
+ *
3863
+ * const obj = { aa: 'a', ab: 'b', ac: 'c' };
3864
+ * console.log(mm.matchKeys(obj, '*b'));
3865
+ * //=> { ab: 'b' }
3866
+ * ```
3867
+ * @param {Object} `object` The object with keys to filter.
3868
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
3869
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
3870
+ * @return {Object} Returns an object with only keys that match the given patterns.
3871
+ * @api public
3872
+ */
3873
+
3874
+ micromatch.matchKeys = (obj, patterns, options) => {
3875
+ if (!utils.isObject(obj)) {
3876
+ throw new TypeError('Expected the first argument to be an object');
3877
+ }
3878
+ let keys = micromatch(Object.keys(obj), patterns, options);
3879
+ let res = {};
3880
+ for (let key of keys) res[key] = obj[key];
3881
+ return res;
3882
+ };
3883
+
3884
+ /**
3885
+ * Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
3886
+ *
3887
+ * ```js
3888
+ * const mm = require('micromatch');
3889
+ * // mm.some(list, patterns[, options]);
3890
+ *
3891
+ * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
3892
+ * // true
3893
+ * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
3894
+ * // false
3895
+ * ```
3896
+ * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
3897
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
3898
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
3899
+ * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
3900
+ * @api public
3901
+ */
3902
+
3903
+ micromatch.some = (list, patterns, options) => {
3904
+ let items = [].concat(list);
3905
+
3906
+ for (let pattern of [].concat(patterns)) {
3907
+ let isMatch = picomatch(String(pattern), options);
3908
+ if (items.some(item => isMatch(item))) {
3909
+ return true;
3910
+ }
3911
+ }
3912
+ return false;
3913
+ };
3914
+
3915
+ /**
3916
+ * Returns true if every string in the given `list` matches
3917
+ * any of the given glob `patterns`.
3918
+ *
3919
+ * ```js
3920
+ * const mm = require('micromatch');
3921
+ * // mm.every(list, patterns[, options]);
3922
+ *
3923
+ * console.log(mm.every('foo.js', ['foo.js']));
3924
+ * // true
3925
+ * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
3926
+ * // true
3927
+ * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
3928
+ * // false
3929
+ * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
3930
+ * // false
3931
+ * ```
3932
+ * @param {String|Array} `list` The string or array of strings to test.
3933
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
3934
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
3935
+ * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
3936
+ * @api public
3937
+ */
3938
+
3939
+ micromatch.every = (list, patterns, options) => {
3940
+ let items = [].concat(list);
3941
+
3942
+ for (let pattern of [].concat(patterns)) {
3943
+ let isMatch = picomatch(String(pattern), options);
3944
+ if (!items.every(item => isMatch(item))) {
3945
+ return false;
3946
+ }
3947
+ }
3948
+ return true;
3949
+ };
3950
+
3951
+ /**
3952
+ * Returns true if **all** of the given `patterns` match
3953
+ * the specified string.
3954
+ *
3955
+ * ```js
3956
+ * const mm = require('micromatch');
3957
+ * // mm.all(string, patterns[, options]);
3958
+ *
3959
+ * console.log(mm.all('foo.js', ['foo.js']));
3960
+ * // true
3961
+ *
3962
+ * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
3963
+ * // false
3964
+ *
3965
+ * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
3966
+ * // true
3967
+ *
3968
+ * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
3969
+ * // true
3970
+ * ```
3971
+ * @param {String|Array} `str` The string to test.
3972
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
3973
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
3974
+ * @return {Boolean} Returns true if any patterns match `str`
3975
+ * @api public
3976
+ */
3977
+
3978
+ micromatch.all = (str, patterns, options) => {
3979
+ if (typeof str !== 'string') {
3980
+ throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
3981
+ }
3982
+
3983
+ return [].concat(patterns).every(p => picomatch(p, options)(str));
3984
+ };
3985
+
3986
+ /**
3987
+ * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
3988
+ *
3989
+ * ```js
3990
+ * const mm = require('micromatch');
3991
+ * // mm.capture(pattern, string[, options]);
3992
+ *
3993
+ * console.log(mm.capture('test/*.js', 'test/foo.js'));
3994
+ * //=> ['foo']
3995
+ * console.log(mm.capture('test/*.js', 'foo/bar.css'));
3996
+ * //=> null
3997
+ * ```
3998
+ * @param {String} `glob` Glob pattern to use for matching.
3999
+ * @param {String} `input` String to match
4000
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
4001
+ * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
4002
+ * @api public
4003
+ */
4004
+
4005
+ micromatch.capture = (glob, input, options) => {
4006
+ let posix = utils.isWindows(options);
4007
+ let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
4008
+ let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
4009
+
4010
+ if (match) {
4011
+ return match.slice(1).map(v => v === void 0 ? '' : v);
4012
+ }
4013
+ };
4014
+
4015
+ /**
4016
+ * Create a regular expression from the given glob `pattern`.
4017
+ *
4018
+ * ```js
4019
+ * const mm = require('micromatch');
4020
+ * // mm.makeRe(pattern[, options]);
4021
+ *
4022
+ * console.log(mm.makeRe('*.js'));
4023
+ * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
4024
+ * ```
4025
+ * @param {String} `pattern` A glob pattern to convert to regex.
4026
+ * @param {Object} `options`
4027
+ * @return {RegExp} Returns a regex created from the given pattern.
4028
+ * @api public
4029
+ */
4030
+
4031
+ micromatch.makeRe = (...args) => picomatch.makeRe(...args);
4032
+
4033
+ /**
4034
+ * Scan a glob pattern to separate the pattern into segments. Used
4035
+ * by the [split](#split) method.
4036
+ *
4037
+ * ```js
4038
+ * const mm = require('micromatch');
4039
+ * const state = mm.scan(pattern[, options]);
4040
+ * ```
4041
+ * @param {String} `pattern`
4042
+ * @param {Object} `options`
4043
+ * @return {Object} Returns an object with
4044
+ * @api public
4045
+ */
4046
+
4047
+ micromatch.scan = (...args) => picomatch.scan(...args);
4048
+
4049
+ /**
4050
+ * Parse a glob pattern to create the source string for a regular
4051
+ * expression.
4052
+ *
4053
+ * ```js
4054
+ * const mm = require('micromatch');
4055
+ * const state = mm.parse(pattern[, options]);
4056
+ * ```
4057
+ * @param {String} `glob`
4058
+ * @param {Object} `options`
4059
+ * @return {Object} Returns an object with useful properties and output to be used as regex source string.
4060
+ * @api public
4061
+ */
4062
+
4063
+ micromatch.parse = (patterns, options) => {
4064
+ let res = [];
4065
+ for (let pattern of [].concat(patterns || [])) {
4066
+ for (let str of braces(String(pattern), options)) {
4067
+ res.push(picomatch.parse(str, options));
4068
+ }
4069
+ }
4070
+ return res;
4071
+ };
4072
+
4073
+ /**
4074
+ * Process the given brace `pattern`.
4075
+ *
4076
+ * ```js
4077
+ * const { braces } = require('micromatch');
4078
+ * console.log(braces('foo/{a,b,c}/bar'));
4079
+ * //=> [ 'foo/(a|b|c)/bar' ]
4080
+ *
4081
+ * console.log(braces('foo/{a,b,c}/bar', { expand: true }));
4082
+ * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
4083
+ * ```
4084
+ * @param {String} `pattern` String with brace pattern to process.
4085
+ * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
4086
+ * @return {Array}
4087
+ * @api public
4088
+ */
4089
+
4090
+ micromatch.braces = (pattern, options) => {
4091
+ if (typeof pattern !== 'string') throw new TypeError('Expected a string');
4092
+ if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
4093
+ return [pattern];
4094
+ }
4095
+ return braces(pattern, options);
4096
+ };
4097
+
4098
+ /**
4099
+ * Expand braces
4100
+ */
4101
+
4102
+ micromatch.braceExpand = (pattern, options) => {
4103
+ if (typeof pattern !== 'string') throw new TypeError('Expected a string');
4104
+ return micromatch.braces(pattern, { ...options, expand: true });
4105
+ };
4106
+
4107
+ /**
4108
+ * Expose micromatch
4109
+ */
4110
+
4111
+ micromatch_1 = micromatch;
4112
+ return micromatch_1;
4113
+ }
4114
+
4115
+ var micromatchExports = requireMicromatch();
4116
+
4117
+ const definePlugin = (plugin) => plugin;
4118
+ function createFilter(options) {
4119
+ const { include = [], exclude = [] } = options;
4120
+ const resolvedInclude = Array.isArray(include) ? include : [include];
4121
+ const resolvedExclude = Array.isArray(exclude) ? exclude : [exclude];
4122
+ return (id) => {
4123
+ if (typeof id !== "string") return false;
4124
+ const isInclude = resolvedInclude.length === 0 || resolvedInclude.some((filter) => {
4125
+ return filter instanceof RegExp ? filter.test(id) : micromatchExports.isMatch(id, filter);
4126
+ });
4127
+ const isExclude = resolvedExclude.length > 0 && resolvedExclude.some((filter) => {
4128
+ return filter instanceof RegExp ? filter.test(id) : micromatchExports.isMatch(id, filter);
4129
+ });
4130
+ return !isInclude || isExclude;
4131
+ };
4132
+ }
4133
+
4134
+ exports.createFilter = createFilter;
4135
+ exports.definePlugin = definePlugin;