jiek 0.4.7-alpha.5 → 0.4.7-alpha.7

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