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