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