jiek 0.4.7-alpha.4 → 0.4.7-alpha.6

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