@saasmakers/eslint 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/chunks/formatters.cjs +248 -0
  2. package/dist/chunks/formatters.mjs +246 -0
  3. package/dist/chunks/import.cjs +53 -0
  4. package/dist/chunks/import.mjs +51 -0
  5. package/dist/chunks/index.cjs +120 -0
  6. package/dist/chunks/index.mjs +101 -0
  7. package/dist/chunks/index2.cjs +880 -0
  8. package/dist/chunks/index2.mjs +868 -0
  9. package/dist/chunks/index3.cjs +982 -0
  10. package/dist/chunks/index3.mjs +979 -0
  11. package/dist/chunks/index4.cjs +12099 -0
  12. package/dist/chunks/index4.mjs +12077 -0
  13. package/dist/chunks/jsdoc.cjs +38398 -0
  14. package/dist/chunks/jsdoc.mjs +38391 -0
  15. package/dist/chunks/regexp.cjs +18518 -0
  16. package/dist/chunks/regexp.mjs +18511 -0
  17. package/dist/chunks/stylistic.cjs +23935 -0
  18. package/dist/chunks/stylistic.mjs +23932 -0
  19. package/dist/chunks/typescript.cjs +56168 -0
  20. package/dist/chunks/typescript.mjs +56154 -0
  21. package/dist/chunks/unicorn.cjs +82775 -0
  22. package/dist/chunks/unicorn.mjs +82764 -0
  23. package/dist/chunks/vue.cjs +96233 -0
  24. package/dist/chunks/vue.mjs +96220 -0
  25. package/dist/eslint.config.cjs +19 -10875
  26. package/dist/eslint.config.d.cts +3898 -16
  27. package/dist/eslint.config.d.mts +3898 -16
  28. package/dist/eslint.config.d.ts +3898 -16
  29. package/dist/eslint.config.mjs +18 -10853
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.cts +6 -2
  32. package/dist/index.d.mts +6 -2
  33. package/dist/index.d.ts +6 -2
  34. package/dist/index.mjs +1 -1
  35. package/dist/shared/eslint.05nu4VbT.mjs +9 -0
  36. package/dist/shared/eslint.07qTxm9w.mjs +3352 -0
  37. package/dist/shared/eslint.6MAvpL4q.cjs +2141 -0
  38. package/dist/shared/{eslint.CohBuu1-.mjs → eslint.B3ywQ3NK.mjs} +157 -331
  39. package/dist/shared/eslint.BGpVg2tt.cjs +13 -0
  40. package/dist/shared/eslint.BL4sYiVQ.cjs +820 -0
  41. package/dist/shared/eslint.BOOP2x9L.cjs +67 -0
  42. package/dist/shared/eslint.Bf7aat-e.mjs +10 -0
  43. package/dist/shared/eslint.Bl69eiyD.cjs +7073 -0
  44. package/dist/shared/eslint.BtkqW7nC.mjs +818 -0
  45. package/dist/shared/eslint.C12_M0Cw.cjs +9 -0
  46. package/dist/shared/eslint.CMfxPSSy.cjs +14 -0
  47. package/dist/shared/eslint.COweQ1RR.mjs +5 -0
  48. package/dist/shared/eslint.CUi9znUC.mjs +13 -0
  49. package/dist/shared/eslint.Cg6Ty7p7.mjs +2699 -0
  50. package/dist/shared/eslint.Ct3Vg5Bb.cjs +37182 -0
  51. package/dist/shared/eslint.CxAZpd0w.cjs +3365 -0
  52. package/dist/shared/eslint.CyJA7jO6.cjs +3813 -0
  53. package/dist/shared/eslint.DDD2xc4l.cjs +25 -0
  54. package/dist/shared/eslint.DHV9wVWi.mjs +37141 -0
  55. package/dist/shared/eslint.DI7QBrVD.mjs +6 -0
  56. package/dist/shared/eslint.DUamuDzp.cjs +7 -0
  57. package/dist/shared/eslint.DV_fpPxQ.mjs +3805 -0
  58. package/dist/shared/{eslint.DhFjwkxh.cjs → eslint.Dhg0jKDi.cjs} +167 -330
  59. package/dist/shared/eslint.Difk5awg.mjs +2139 -0
  60. package/dist/shared/eslint.Dlgr3LGM.mjs +7070 -0
  61. package/dist/shared/eslint.DoYGbUIG.cjs +2724 -0
  62. package/dist/shared/eslint.Dprsk9zl.mjs +65 -0
  63. package/dist/shared/eslint.MfgVmFE7.cjs +3054 -0
  64. package/dist/shared/eslint.W7RM7aEw.mjs +3052 -0
  65. package/package.json +2 -1
@@ -0,0 +1,2139 @@
1
+ var utils = {};
2
+
3
+ var constants;
4
+ var hasRequiredConstants;
5
+
6
+ function requireConstants () {
7
+ if (hasRequiredConstants) return constants;
8
+ hasRequiredConstants = 1;
9
+
10
+ const WIN_SLASH = '\\\\/';
11
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
12
+
13
+ /**
14
+ * Posix glob regex
15
+ */
16
+
17
+ const DOT_LITERAL = '\\.';
18
+ const PLUS_LITERAL = '\\+';
19
+ const QMARK_LITERAL = '\\?';
20
+ const SLASH_LITERAL = '\\/';
21
+ const ONE_CHAR = '(?=.)';
22
+ const QMARK = '[^/]';
23
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
24
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
25
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
26
+ const NO_DOT = `(?!${DOT_LITERAL})`;
27
+ const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
28
+ const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
29
+ const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
30
+ const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
31
+ const STAR = `${QMARK}*?`;
32
+ const SEP = '/';
33
+
34
+ const POSIX_CHARS = {
35
+ DOT_LITERAL,
36
+ PLUS_LITERAL,
37
+ QMARK_LITERAL,
38
+ SLASH_LITERAL,
39
+ ONE_CHAR,
40
+ QMARK,
41
+ END_ANCHOR,
42
+ DOTS_SLASH,
43
+ NO_DOT,
44
+ NO_DOTS,
45
+ NO_DOT_SLASH,
46
+ NO_DOTS_SLASH,
47
+ QMARK_NO_DOT,
48
+ STAR,
49
+ START_ANCHOR,
50
+ SEP
51
+ };
52
+
53
+ /**
54
+ * Windows glob regex
55
+ */
56
+
57
+ const WINDOWS_CHARS = {
58
+ ...POSIX_CHARS,
59
+
60
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
61
+ QMARK: WIN_NO_SLASH,
62
+ STAR: `${WIN_NO_SLASH}*?`,
63
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
64
+ NO_DOT: `(?!${DOT_LITERAL})`,
65
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
66
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
67
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
68
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
69
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
70
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
71
+ SEP: '\\'
72
+ };
73
+
74
+ /**
75
+ * POSIX Bracket Regex
76
+ */
77
+
78
+ const POSIX_REGEX_SOURCE = {
79
+ alnum: 'a-zA-Z0-9',
80
+ alpha: 'a-zA-Z',
81
+ ascii: '\\x00-\\x7F',
82
+ blank: ' \\t',
83
+ cntrl: '\\x00-\\x1F\\x7F',
84
+ digit: '0-9',
85
+ graph: '\\x21-\\x7E',
86
+ lower: 'a-z',
87
+ print: '\\x20-\\x7E ',
88
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
89
+ space: ' \\t\\r\\n\\v\\f',
90
+ upper: 'A-Z',
91
+ word: 'A-Za-z0-9_',
92
+ xdigit: 'A-Fa-f0-9'
93
+ };
94
+
95
+ constants = {
96
+ MAX_LENGTH: 1024 * 64,
97
+ POSIX_REGEX_SOURCE,
98
+
99
+ // regular expressions
100
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
101
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
102
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
103
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
104
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
105
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
106
+
107
+ // Replace globs with equivalent patterns to reduce parsing time.
108
+ REPLACEMENTS: {
109
+ __proto__: null,
110
+ '***': '*',
111
+ '**/**': '**',
112
+ '**/**/**': '**'
113
+ },
114
+
115
+ // Digits
116
+ CHAR_0: 48, /* 0 */
117
+ CHAR_9: 57, /* 9 */
118
+
119
+ // Alphabet chars.
120
+ CHAR_UPPERCASE_A: 65, /* A */
121
+ CHAR_LOWERCASE_A: 97, /* a */
122
+ CHAR_UPPERCASE_Z: 90, /* Z */
123
+ CHAR_LOWERCASE_Z: 122, /* z */
124
+
125
+ CHAR_LEFT_PARENTHESES: 40, /* ( */
126
+ CHAR_RIGHT_PARENTHESES: 41, /* ) */
127
+
128
+ CHAR_ASTERISK: 42, /* * */
129
+
130
+ // Non-alphabetic chars.
131
+ CHAR_AMPERSAND: 38, /* & */
132
+ CHAR_AT: 64, /* @ */
133
+ CHAR_BACKWARD_SLASH: 92, /* \ */
134
+ CHAR_CARRIAGE_RETURN: 13, /* \r */
135
+ CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
136
+ CHAR_COLON: 58, /* : */
137
+ CHAR_COMMA: 44, /* , */
138
+ CHAR_DOT: 46, /* . */
139
+ CHAR_DOUBLE_QUOTE: 34, /* " */
140
+ CHAR_EQUAL: 61, /* = */
141
+ CHAR_EXCLAMATION_MARK: 33, /* ! */
142
+ CHAR_FORM_FEED: 12, /* \f */
143
+ CHAR_FORWARD_SLASH: 47, /* / */
144
+ CHAR_GRAVE_ACCENT: 96, /* ` */
145
+ CHAR_HASH: 35, /* # */
146
+ CHAR_HYPHEN_MINUS: 45, /* - */
147
+ CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
148
+ CHAR_LEFT_CURLY_BRACE: 123, /* { */
149
+ CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
150
+ CHAR_LINE_FEED: 10, /* \n */
151
+ CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
152
+ CHAR_PERCENT: 37, /* % */
153
+ CHAR_PLUS: 43, /* + */
154
+ CHAR_QUESTION_MARK: 63, /* ? */
155
+ CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
156
+ CHAR_RIGHT_CURLY_BRACE: 125, /* } */
157
+ CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
158
+ CHAR_SEMICOLON: 59, /* ; */
159
+ CHAR_SINGLE_QUOTE: 39, /* ' */
160
+ CHAR_SPACE: 32, /* */
161
+ CHAR_TAB: 9, /* \t */
162
+ CHAR_UNDERSCORE: 95, /* _ */
163
+ CHAR_VERTICAL_LINE: 124, /* | */
164
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
165
+
166
+ /**
167
+ * Create EXTGLOB_CHARS
168
+ */
169
+
170
+ extglobChars(chars) {
171
+ return {
172
+ '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
173
+ '?': { type: 'qmark', open: '(?:', close: ')?' },
174
+ '+': { type: 'plus', open: '(?:', close: ')+' },
175
+ '*': { type: 'star', open: '(?:', close: ')*' },
176
+ '@': { type: 'at', open: '(?:', close: ')' }
177
+ };
178
+ },
179
+
180
+ /**
181
+ * Create GLOB_CHARS
182
+ */
183
+
184
+ globChars(win32) {
185
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
186
+ }
187
+ };
188
+ return constants;
189
+ }
190
+
191
+ /*global navigator*/
192
+
193
+ var hasRequiredUtils;
194
+
195
+ function requireUtils () {
196
+ if (hasRequiredUtils) return utils;
197
+ hasRequiredUtils = 1;
198
+ (function (exports$1) {
199
+
200
+ const {
201
+ REGEX_BACKSLASH,
202
+ REGEX_REMOVE_BACKSLASH,
203
+ REGEX_SPECIAL_CHARS,
204
+ REGEX_SPECIAL_CHARS_GLOBAL
205
+ } = /*@__PURE__*/ requireConstants();
206
+
207
+ exports$1.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
208
+ exports$1.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
209
+ exports$1.isRegexChar = str => str.length === 1 && exports$1.hasRegexChars(str);
210
+ exports$1.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
211
+ exports$1.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
212
+
213
+ exports$1.isWindows = () => {
214
+ if (typeof navigator !== 'undefined' && navigator.platform) {
215
+ const platform = navigator.platform.toLowerCase();
216
+ return platform === 'win32' || platform === 'windows';
217
+ }
218
+
219
+ if (typeof process !== 'undefined' && process.platform) {
220
+ return process.platform === 'win32';
221
+ }
222
+
223
+ return false;
224
+ };
225
+
226
+ exports$1.removeBackslashes = str => {
227
+ return str.replace(REGEX_REMOVE_BACKSLASH, match => {
228
+ return match === '\\' ? '' : match;
229
+ });
230
+ };
231
+
232
+ exports$1.escapeLast = (input, char, lastIdx) => {
233
+ const idx = input.lastIndexOf(char, lastIdx);
234
+ if (idx === -1) return input;
235
+ if (input[idx - 1] === '\\') return exports$1.escapeLast(input, char, idx - 1);
236
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
237
+ };
238
+
239
+ exports$1.removePrefix = (input, state = {}) => {
240
+ let output = input;
241
+ if (output.startsWith('./')) {
242
+ output = output.slice(2);
243
+ state.prefix = './';
244
+ }
245
+ return output;
246
+ };
247
+
248
+ exports$1.wrapOutput = (input, state = {}, options = {}) => {
249
+ const prepend = options.contains ? '' : '^';
250
+ const append = options.contains ? '' : '$';
251
+
252
+ let output = `${prepend}(?:${input})${append}`;
253
+ if (state.negated === true) {
254
+ output = `(?:^(?!${output}).*$)`;
255
+ }
256
+ return output;
257
+ };
258
+
259
+ exports$1.basename = (path, { windows } = {}) => {
260
+ const segs = path.split(windows ? /[\\/]/ : '/');
261
+ const last = segs[segs.length - 1];
262
+
263
+ if (last === '') {
264
+ return segs[segs.length - 2];
265
+ }
266
+
267
+ return last;
268
+ };
269
+ } (utils));
270
+ return utils;
271
+ }
272
+
273
+ var scan_1;
274
+ var hasRequiredScan;
275
+
276
+ function requireScan () {
277
+ if (hasRequiredScan) return scan_1;
278
+ hasRequiredScan = 1;
279
+
280
+ const utils = /*@__PURE__*/ requireUtils();
281
+ const {
282
+ CHAR_ASTERISK, /* * */
283
+ CHAR_AT, /* @ */
284
+ CHAR_BACKWARD_SLASH, /* \ */
285
+ CHAR_COMMA, /* , */
286
+ CHAR_DOT, /* . */
287
+ CHAR_EXCLAMATION_MARK, /* ! */
288
+ CHAR_FORWARD_SLASH, /* / */
289
+ CHAR_LEFT_CURLY_BRACE, /* { */
290
+ CHAR_LEFT_PARENTHESES, /* ( */
291
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
292
+ CHAR_PLUS, /* + */
293
+ CHAR_QUESTION_MARK, /* ? */
294
+ CHAR_RIGHT_CURLY_BRACE, /* } */
295
+ CHAR_RIGHT_PARENTHESES, /* ) */
296
+ CHAR_RIGHT_SQUARE_BRACKET /* ] */
297
+ } = /*@__PURE__*/ requireConstants();
298
+
299
+ const isPathSeparator = code => {
300
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
301
+ };
302
+
303
+ const depth = token => {
304
+ if (token.isPrefix !== true) {
305
+ token.depth = token.isGlobstar ? Infinity : 1;
306
+ }
307
+ };
308
+
309
+ /**
310
+ * Quickly scans a glob pattern and returns an object with a handful of
311
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
312
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
313
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
314
+ *
315
+ * ```js
316
+ * const pm = require('picomatch');
317
+ * console.log(pm.scan('foo/bar/*.js'));
318
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
319
+ * ```
320
+ * @param {String} `str`
321
+ * @param {Object} `options`
322
+ * @return {Object} Returns an object with tokens and regex source string.
323
+ * @api public
324
+ */
325
+
326
+ const scan = (input, options) => {
327
+ const opts = options || {};
328
+
329
+ const length = input.length - 1;
330
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
331
+ const slashes = [];
332
+ const tokens = [];
333
+ const parts = [];
334
+
335
+ let str = input;
336
+ let index = -1;
337
+ let start = 0;
338
+ let lastIndex = 0;
339
+ let isBrace = false;
340
+ let isBracket = false;
341
+ let isGlob = false;
342
+ let isExtglob = false;
343
+ let isGlobstar = false;
344
+ let braceEscaped = false;
345
+ let backslashes = false;
346
+ let negated = false;
347
+ let negatedExtglob = false;
348
+ let finished = false;
349
+ let braces = 0;
350
+ let prev;
351
+ let code;
352
+ let token = { value: '', depth: 0, isGlob: false };
353
+
354
+ const eos = () => index >= length;
355
+ const peek = () => str.charCodeAt(index + 1);
356
+ const advance = () => {
357
+ prev = code;
358
+ return str.charCodeAt(++index);
359
+ };
360
+
361
+ while (index < length) {
362
+ code = advance();
363
+ let next;
364
+
365
+ if (code === CHAR_BACKWARD_SLASH) {
366
+ backslashes = token.backslashes = true;
367
+ code = advance();
368
+
369
+ if (code === CHAR_LEFT_CURLY_BRACE) {
370
+ braceEscaped = true;
371
+ }
372
+ continue;
373
+ }
374
+
375
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
376
+ braces++;
377
+
378
+ while (eos() !== true && (code = advance())) {
379
+ if (code === CHAR_BACKWARD_SLASH) {
380
+ backslashes = token.backslashes = true;
381
+ advance();
382
+ continue;
383
+ }
384
+
385
+ if (code === CHAR_LEFT_CURLY_BRACE) {
386
+ braces++;
387
+ continue;
388
+ }
389
+
390
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
391
+ isBrace = token.isBrace = true;
392
+ isGlob = token.isGlob = true;
393
+ finished = true;
394
+
395
+ if (scanToEnd === true) {
396
+ continue;
397
+ }
398
+
399
+ break;
400
+ }
401
+
402
+ if (braceEscaped !== true && code === CHAR_COMMA) {
403
+ isBrace = token.isBrace = true;
404
+ isGlob = token.isGlob = true;
405
+ finished = true;
406
+
407
+ if (scanToEnd === true) {
408
+ continue;
409
+ }
410
+
411
+ break;
412
+ }
413
+
414
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
415
+ braces--;
416
+
417
+ if (braces === 0) {
418
+ braceEscaped = false;
419
+ isBrace = token.isBrace = true;
420
+ finished = true;
421
+ break;
422
+ }
423
+ }
424
+ }
425
+
426
+ if (scanToEnd === true) {
427
+ continue;
428
+ }
429
+
430
+ break;
431
+ }
432
+
433
+ if (code === CHAR_FORWARD_SLASH) {
434
+ slashes.push(index);
435
+ tokens.push(token);
436
+ token = { value: '', depth: 0, isGlob: false };
437
+
438
+ if (finished === true) continue;
439
+ if (prev === CHAR_DOT && index === (start + 1)) {
440
+ start += 2;
441
+ continue;
442
+ }
443
+
444
+ lastIndex = index + 1;
445
+ continue;
446
+ }
447
+
448
+ if (opts.noext !== true) {
449
+ const isExtglobChar = code === CHAR_PLUS
450
+ || code === CHAR_AT
451
+ || code === CHAR_ASTERISK
452
+ || code === CHAR_QUESTION_MARK
453
+ || code === CHAR_EXCLAMATION_MARK;
454
+
455
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
456
+ isGlob = token.isGlob = true;
457
+ isExtglob = token.isExtglob = true;
458
+ finished = true;
459
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
460
+ negatedExtglob = true;
461
+ }
462
+
463
+ if (scanToEnd === true) {
464
+ while (eos() !== true && (code = advance())) {
465
+ if (code === CHAR_BACKWARD_SLASH) {
466
+ backslashes = token.backslashes = true;
467
+ code = advance();
468
+ continue;
469
+ }
470
+
471
+ if (code === CHAR_RIGHT_PARENTHESES) {
472
+ isGlob = token.isGlob = true;
473
+ finished = true;
474
+ break;
475
+ }
476
+ }
477
+ continue;
478
+ }
479
+ break;
480
+ }
481
+ }
482
+
483
+ if (code === CHAR_ASTERISK) {
484
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
485
+ isGlob = token.isGlob = true;
486
+ finished = true;
487
+
488
+ if (scanToEnd === true) {
489
+ continue;
490
+ }
491
+ break;
492
+ }
493
+
494
+ if (code === CHAR_QUESTION_MARK) {
495
+ isGlob = token.isGlob = true;
496
+ finished = true;
497
+
498
+ if (scanToEnd === true) {
499
+ continue;
500
+ }
501
+ break;
502
+ }
503
+
504
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
505
+ while (eos() !== true && (next = advance())) {
506
+ if (next === CHAR_BACKWARD_SLASH) {
507
+ backslashes = token.backslashes = true;
508
+ advance();
509
+ continue;
510
+ }
511
+
512
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
513
+ isBracket = token.isBracket = true;
514
+ isGlob = token.isGlob = true;
515
+ finished = true;
516
+ break;
517
+ }
518
+ }
519
+
520
+ if (scanToEnd === true) {
521
+ continue;
522
+ }
523
+
524
+ break;
525
+ }
526
+
527
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
528
+ negated = token.negated = true;
529
+ start++;
530
+ continue;
531
+ }
532
+
533
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
534
+ isGlob = token.isGlob = true;
535
+
536
+ if (scanToEnd === true) {
537
+ while (eos() !== true && (code = advance())) {
538
+ if (code === CHAR_LEFT_PARENTHESES) {
539
+ backslashes = token.backslashes = true;
540
+ code = advance();
541
+ continue;
542
+ }
543
+
544
+ if (code === CHAR_RIGHT_PARENTHESES) {
545
+ finished = true;
546
+ break;
547
+ }
548
+ }
549
+ continue;
550
+ }
551
+ break;
552
+ }
553
+
554
+ if (isGlob === true) {
555
+ finished = true;
556
+
557
+ if (scanToEnd === true) {
558
+ continue;
559
+ }
560
+
561
+ break;
562
+ }
563
+ }
564
+
565
+ if (opts.noext === true) {
566
+ isExtglob = false;
567
+ isGlob = false;
568
+ }
569
+
570
+ let base = str;
571
+ let prefix = '';
572
+ let glob = '';
573
+
574
+ if (start > 0) {
575
+ prefix = str.slice(0, start);
576
+ str = str.slice(start);
577
+ lastIndex -= start;
578
+ }
579
+
580
+ if (base && isGlob === true && lastIndex > 0) {
581
+ base = str.slice(0, lastIndex);
582
+ glob = str.slice(lastIndex);
583
+ } else if (isGlob === true) {
584
+ base = '';
585
+ glob = str;
586
+ } else {
587
+ base = str;
588
+ }
589
+
590
+ if (base && base !== '' && base !== '/' && base !== str) {
591
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
592
+ base = base.slice(0, -1);
593
+ }
594
+ }
595
+
596
+ if (opts.unescape === true) {
597
+ if (glob) glob = utils.removeBackslashes(glob);
598
+
599
+ if (base && backslashes === true) {
600
+ base = utils.removeBackslashes(base);
601
+ }
602
+ }
603
+
604
+ const state = {
605
+ prefix,
606
+ input,
607
+ start,
608
+ base,
609
+ glob,
610
+ isBrace,
611
+ isBracket,
612
+ isGlob,
613
+ isExtglob,
614
+ isGlobstar,
615
+ negated,
616
+ negatedExtglob
617
+ };
618
+
619
+ if (opts.tokens === true) {
620
+ state.maxDepth = 0;
621
+ if (!isPathSeparator(code)) {
622
+ tokens.push(token);
623
+ }
624
+ state.tokens = tokens;
625
+ }
626
+
627
+ if (opts.parts === true || opts.tokens === true) {
628
+ let prevIndex;
629
+
630
+ for (let idx = 0; idx < slashes.length; idx++) {
631
+ const n = prevIndex ? prevIndex + 1 : start;
632
+ const i = slashes[idx];
633
+ const value = input.slice(n, i);
634
+ if (opts.tokens) {
635
+ if (idx === 0 && start !== 0) {
636
+ tokens[idx].isPrefix = true;
637
+ tokens[idx].value = prefix;
638
+ } else {
639
+ tokens[idx].value = value;
640
+ }
641
+ depth(tokens[idx]);
642
+ state.maxDepth += tokens[idx].depth;
643
+ }
644
+ if (idx !== 0 || value !== '') {
645
+ parts.push(value);
646
+ }
647
+ prevIndex = i;
648
+ }
649
+
650
+ if (prevIndex && prevIndex + 1 < input.length) {
651
+ const value = input.slice(prevIndex + 1);
652
+ parts.push(value);
653
+
654
+ if (opts.tokens) {
655
+ tokens[tokens.length - 1].value = value;
656
+ depth(tokens[tokens.length - 1]);
657
+ state.maxDepth += tokens[tokens.length - 1].depth;
658
+ }
659
+ }
660
+
661
+ state.slashes = slashes;
662
+ state.parts = parts;
663
+ }
664
+
665
+ return state;
666
+ };
667
+
668
+ scan_1 = scan;
669
+ return scan_1;
670
+ }
671
+
672
+ var parse_1;
673
+ var hasRequiredParse;
674
+
675
+ function requireParse () {
676
+ if (hasRequiredParse) return parse_1;
677
+ hasRequiredParse = 1;
678
+
679
+ const constants = /*@__PURE__*/ requireConstants();
680
+ const utils = /*@__PURE__*/ requireUtils();
681
+
682
+ /**
683
+ * Constants
684
+ */
685
+
686
+ const {
687
+ MAX_LENGTH,
688
+ POSIX_REGEX_SOURCE,
689
+ REGEX_NON_SPECIAL_CHARS,
690
+ REGEX_SPECIAL_CHARS_BACKREF,
691
+ REPLACEMENTS
692
+ } = constants;
693
+
694
+ /**
695
+ * Helpers
696
+ */
697
+
698
+ const expandRange = (args, options) => {
699
+ if (typeof options.expandRange === 'function') {
700
+ return options.expandRange(...args, options);
701
+ }
702
+
703
+ args.sort();
704
+ const value = `[${args.join('-')}]`;
705
+
706
+ try {
707
+ /* eslint-disable-next-line no-new */
708
+ new RegExp(value);
709
+ } catch (ex) {
710
+ return args.map(v => utils.escapeRegex(v)).join('..');
711
+ }
712
+
713
+ return value;
714
+ };
715
+
716
+ /**
717
+ * Create the message for a syntax error
718
+ */
719
+
720
+ const syntaxError = (type, char) => {
721
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
722
+ };
723
+
724
+ /**
725
+ * Parse the given input string.
726
+ * @param {String} input
727
+ * @param {Object} options
728
+ * @return {Object}
729
+ */
730
+
731
+ const parse = (input, options) => {
732
+ if (typeof input !== 'string') {
733
+ throw new TypeError('Expected a string');
734
+ }
735
+
736
+ input = REPLACEMENTS[input] || input;
737
+
738
+ const opts = { ...options };
739
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
740
+
741
+ let len = input.length;
742
+ if (len > max) {
743
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
744
+ }
745
+
746
+ const bos = { type: 'bos', value: '', output: opts.prepend || '' };
747
+ const tokens = [bos];
748
+
749
+ const capture = opts.capture ? '' : '?:';
750
+
751
+ // create constants based on platform, for windows or posix
752
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
753
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
754
+
755
+ const {
756
+ DOT_LITERAL,
757
+ PLUS_LITERAL,
758
+ SLASH_LITERAL,
759
+ ONE_CHAR,
760
+ DOTS_SLASH,
761
+ NO_DOT,
762
+ NO_DOT_SLASH,
763
+ NO_DOTS_SLASH,
764
+ QMARK,
765
+ QMARK_NO_DOT,
766
+ STAR,
767
+ START_ANCHOR
768
+ } = PLATFORM_CHARS;
769
+
770
+ const globstar = opts => {
771
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
772
+ };
773
+
774
+ const nodot = opts.dot ? '' : NO_DOT;
775
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
776
+ let star = opts.bash === true ? globstar(opts) : STAR;
777
+
778
+ if (opts.capture) {
779
+ star = `(${star})`;
780
+ }
781
+
782
+ // minimatch options support
783
+ if (typeof opts.noext === 'boolean') {
784
+ opts.noextglob = opts.noext;
785
+ }
786
+
787
+ const state = {
788
+ input,
789
+ index: -1,
790
+ start: 0,
791
+ dot: opts.dot === true,
792
+ consumed: '',
793
+ output: '',
794
+ prefix: '',
795
+ backtrack: false,
796
+ negated: false,
797
+ brackets: 0,
798
+ braces: 0,
799
+ parens: 0,
800
+ quotes: 0,
801
+ globstar: false,
802
+ tokens
803
+ };
804
+
805
+ input = utils.removePrefix(input, state);
806
+ len = input.length;
807
+
808
+ const extglobs = [];
809
+ const braces = [];
810
+ const stack = [];
811
+ let prev = bos;
812
+ let value;
813
+
814
+ /**
815
+ * Tokenizing helpers
816
+ */
817
+
818
+ const eos = () => state.index === len - 1;
819
+ const peek = state.peek = (n = 1) => input[state.index + n];
820
+ const advance = state.advance = () => input[++state.index] || '';
821
+ const remaining = () => input.slice(state.index + 1);
822
+ const consume = (value = '', num = 0) => {
823
+ state.consumed += value;
824
+ state.index += num;
825
+ };
826
+
827
+ const append = token => {
828
+ state.output += token.output != null ? token.output : token.value;
829
+ consume(token.value);
830
+ };
831
+
832
+ const negate = () => {
833
+ let count = 1;
834
+
835
+ while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
836
+ advance();
837
+ state.start++;
838
+ count++;
839
+ }
840
+
841
+ if (count % 2 === 0) {
842
+ return false;
843
+ }
844
+
845
+ state.negated = true;
846
+ state.start++;
847
+ return true;
848
+ };
849
+
850
+ const increment = type => {
851
+ state[type]++;
852
+ stack.push(type);
853
+ };
854
+
855
+ const decrement = type => {
856
+ state[type]--;
857
+ stack.pop();
858
+ };
859
+
860
+ /**
861
+ * Push tokens onto the tokens array. This helper speeds up
862
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
863
+ * and 2) helping us avoid creating extra tokens when consecutive
864
+ * characters are plain text. This improves performance and simplifies
865
+ * lookbehinds.
866
+ */
867
+
868
+ const push = tok => {
869
+ if (prev.type === 'globstar') {
870
+ const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
871
+ const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
872
+
873
+ if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
874
+ state.output = state.output.slice(0, -prev.output.length);
875
+ prev.type = 'star';
876
+ prev.value = '*';
877
+ prev.output = star;
878
+ state.output += prev.output;
879
+ }
880
+ }
881
+
882
+ if (extglobs.length && tok.type !== 'paren') {
883
+ extglobs[extglobs.length - 1].inner += tok.value;
884
+ }
885
+
886
+ if (tok.value || tok.output) append(tok);
887
+ if (prev && prev.type === 'text' && tok.type === 'text') {
888
+ prev.output = (prev.output || prev.value) + tok.value;
889
+ prev.value += tok.value;
890
+ return;
891
+ }
892
+
893
+ tok.prev = prev;
894
+ tokens.push(tok);
895
+ prev = tok;
896
+ };
897
+
898
+ const extglobOpen = (type, value) => {
899
+ const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
900
+
901
+ token.prev = prev;
902
+ token.parens = state.parens;
903
+ token.output = state.output;
904
+ const output = (opts.capture ? '(' : '') + token.open;
905
+
906
+ increment('parens');
907
+ push({ type, value, output: state.output ? '' : ONE_CHAR });
908
+ push({ type: 'paren', extglob: true, value: advance(), output });
909
+ extglobs.push(token);
910
+ };
911
+
912
+ const extglobClose = token => {
913
+ let output = token.close + (opts.capture ? ')' : '');
914
+ let rest;
915
+
916
+ if (token.type === 'negate') {
917
+ let extglobStar = star;
918
+
919
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
920
+ extglobStar = globstar(opts);
921
+ }
922
+
923
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
924
+ output = token.close = `)$))${extglobStar}`;
925
+ }
926
+
927
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
928
+ // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
929
+ // In this case, we need to parse the string and use it in the output of the original pattern.
930
+ // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
931
+ //
932
+ // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
933
+ const expression = parse(rest, { ...options, fastpaths: false }).output;
934
+
935
+ output = token.close = `)${expression})${extglobStar})`;
936
+ }
937
+
938
+ if (token.prev.type === 'bos') {
939
+ state.negatedExtglob = true;
940
+ }
941
+ }
942
+
943
+ push({ type: 'paren', extglob: true, value, output });
944
+ decrement('parens');
945
+ };
946
+
947
+ /**
948
+ * Fast paths
949
+ */
950
+
951
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
952
+ let backslashes = false;
953
+
954
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
955
+ if (first === '\\') {
956
+ backslashes = true;
957
+ return m;
958
+ }
959
+
960
+ if (first === '?') {
961
+ if (esc) {
962
+ return esc + first + (rest ? QMARK.repeat(rest.length) : '');
963
+ }
964
+ if (index === 0) {
965
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
966
+ }
967
+ return QMARK.repeat(chars.length);
968
+ }
969
+
970
+ if (first === '.') {
971
+ return DOT_LITERAL.repeat(chars.length);
972
+ }
973
+
974
+ if (first === '*') {
975
+ if (esc) {
976
+ return esc + first + (rest ? star : '');
977
+ }
978
+ return star;
979
+ }
980
+ return esc ? m : `\\${m}`;
981
+ });
982
+
983
+ if (backslashes === true) {
984
+ if (opts.unescape === true) {
985
+ output = output.replace(/\\/g, '');
986
+ } else {
987
+ output = output.replace(/\\+/g, m => {
988
+ return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
989
+ });
990
+ }
991
+ }
992
+
993
+ if (output === input && opts.contains === true) {
994
+ state.output = input;
995
+ return state;
996
+ }
997
+
998
+ state.output = utils.wrapOutput(output, state, options);
999
+ return state;
1000
+ }
1001
+
1002
+ /**
1003
+ * Tokenize input until we reach end-of-string
1004
+ */
1005
+
1006
+ while (!eos()) {
1007
+ value = advance();
1008
+
1009
+ if (value === '\u0000') {
1010
+ continue;
1011
+ }
1012
+
1013
+ /**
1014
+ * Escaped characters
1015
+ */
1016
+
1017
+ if (value === '\\') {
1018
+ const next = peek();
1019
+
1020
+ if (next === '/' && opts.bash !== true) {
1021
+ continue;
1022
+ }
1023
+
1024
+ if (next === '.' || next === ';') {
1025
+ continue;
1026
+ }
1027
+
1028
+ if (!next) {
1029
+ value += '\\';
1030
+ push({ type: 'text', value });
1031
+ continue;
1032
+ }
1033
+
1034
+ // collapse slashes to reduce potential for exploits
1035
+ const match = /^\\+/.exec(remaining());
1036
+ let slashes = 0;
1037
+
1038
+ if (match && match[0].length > 2) {
1039
+ slashes = match[0].length;
1040
+ state.index += slashes;
1041
+ if (slashes % 2 !== 0) {
1042
+ value += '\\';
1043
+ }
1044
+ }
1045
+
1046
+ if (opts.unescape === true) {
1047
+ value = advance();
1048
+ } else {
1049
+ value += advance();
1050
+ }
1051
+
1052
+ if (state.brackets === 0) {
1053
+ push({ type: 'text', value });
1054
+ continue;
1055
+ }
1056
+ }
1057
+
1058
+ /**
1059
+ * If we're inside a regex character class, continue
1060
+ * until we reach the closing bracket.
1061
+ */
1062
+
1063
+ if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
1064
+ if (opts.posix !== false && value === ':') {
1065
+ const inner = prev.value.slice(1);
1066
+ if (inner.includes('[')) {
1067
+ prev.posix = true;
1068
+
1069
+ if (inner.includes(':')) {
1070
+ const idx = prev.value.lastIndexOf('[');
1071
+ const pre = prev.value.slice(0, idx);
1072
+ const rest = prev.value.slice(idx + 2);
1073
+ const posix = POSIX_REGEX_SOURCE[rest];
1074
+ if (posix) {
1075
+ prev.value = pre + posix;
1076
+ state.backtrack = true;
1077
+ advance();
1078
+
1079
+ if (!bos.output && tokens.indexOf(prev) === 1) {
1080
+ bos.output = ONE_CHAR;
1081
+ }
1082
+ continue;
1083
+ }
1084
+ }
1085
+ }
1086
+ }
1087
+
1088
+ if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
1089
+ value = `\\${value}`;
1090
+ }
1091
+
1092
+ if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
1093
+ value = `\\${value}`;
1094
+ }
1095
+
1096
+ if (opts.posix === true && value === '!' && prev.value === '[') {
1097
+ value = '^';
1098
+ }
1099
+
1100
+ prev.value += value;
1101
+ append({ value });
1102
+ continue;
1103
+ }
1104
+
1105
+ /**
1106
+ * If we're inside a quoted string, continue
1107
+ * until we reach the closing double quote.
1108
+ */
1109
+
1110
+ if (state.quotes === 1 && value !== '"') {
1111
+ value = utils.escapeRegex(value);
1112
+ prev.value += value;
1113
+ append({ value });
1114
+ continue;
1115
+ }
1116
+
1117
+ /**
1118
+ * Double quotes
1119
+ */
1120
+
1121
+ if (value === '"') {
1122
+ state.quotes = state.quotes === 1 ? 0 : 1;
1123
+ if (opts.keepQuotes === true) {
1124
+ push({ type: 'text', value });
1125
+ }
1126
+ continue;
1127
+ }
1128
+
1129
+ /**
1130
+ * Parentheses
1131
+ */
1132
+
1133
+ if (value === '(') {
1134
+ increment('parens');
1135
+ push({ type: 'paren', value });
1136
+ continue;
1137
+ }
1138
+
1139
+ if (value === ')') {
1140
+ if (state.parens === 0 && opts.strictBrackets === true) {
1141
+ throw new SyntaxError(syntaxError('opening', '('));
1142
+ }
1143
+
1144
+ const extglob = extglobs[extglobs.length - 1];
1145
+ if (extglob && state.parens === extglob.parens + 1) {
1146
+ extglobClose(extglobs.pop());
1147
+ continue;
1148
+ }
1149
+
1150
+ push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
1151
+ decrement('parens');
1152
+ continue;
1153
+ }
1154
+
1155
+ /**
1156
+ * Square brackets
1157
+ */
1158
+
1159
+ if (value === '[') {
1160
+ if (opts.nobracket === true || !remaining().includes(']')) {
1161
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
1162
+ throw new SyntaxError(syntaxError('closing', ']'));
1163
+ }
1164
+
1165
+ value = `\\${value}`;
1166
+ } else {
1167
+ increment('brackets');
1168
+ }
1169
+
1170
+ push({ type: 'bracket', value });
1171
+ continue;
1172
+ }
1173
+
1174
+ if (value === ']') {
1175
+ if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
1176
+ push({ type: 'text', value, output: `\\${value}` });
1177
+ continue;
1178
+ }
1179
+
1180
+ if (state.brackets === 0) {
1181
+ if (opts.strictBrackets === true) {
1182
+ throw new SyntaxError(syntaxError('opening', '['));
1183
+ }
1184
+
1185
+ push({ type: 'text', value, output: `\\${value}` });
1186
+ continue;
1187
+ }
1188
+
1189
+ decrement('brackets');
1190
+
1191
+ const prevValue = prev.value.slice(1);
1192
+ if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
1193
+ value = `/${value}`;
1194
+ }
1195
+
1196
+ prev.value += value;
1197
+ append({ value });
1198
+
1199
+ // when literal brackets are explicitly disabled
1200
+ // assume we should match with a regex character class
1201
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
1202
+ continue;
1203
+ }
1204
+
1205
+ const escaped = utils.escapeRegex(prev.value);
1206
+ state.output = state.output.slice(0, -prev.value.length);
1207
+
1208
+ // when literal brackets are explicitly enabled
1209
+ // assume we should escape the brackets to match literal characters
1210
+ if (opts.literalBrackets === true) {
1211
+ state.output += escaped;
1212
+ prev.value = escaped;
1213
+ continue;
1214
+ }
1215
+
1216
+ // when the user specifies nothing, try to match both
1217
+ prev.value = `(${capture}${escaped}|${prev.value})`;
1218
+ state.output += prev.value;
1219
+ continue;
1220
+ }
1221
+
1222
+ /**
1223
+ * Braces
1224
+ */
1225
+
1226
+ if (value === '{' && opts.nobrace !== true) {
1227
+ increment('braces');
1228
+
1229
+ const open = {
1230
+ type: 'brace',
1231
+ value,
1232
+ output: '(',
1233
+ outputIndex: state.output.length,
1234
+ tokensIndex: state.tokens.length
1235
+ };
1236
+
1237
+ braces.push(open);
1238
+ push(open);
1239
+ continue;
1240
+ }
1241
+
1242
+ if (value === '}') {
1243
+ const brace = braces[braces.length - 1];
1244
+
1245
+ if (opts.nobrace === true || !brace) {
1246
+ push({ type: 'text', value, output: value });
1247
+ continue;
1248
+ }
1249
+
1250
+ let output = ')';
1251
+
1252
+ if (brace.dots === true) {
1253
+ const arr = tokens.slice();
1254
+ const range = [];
1255
+
1256
+ for (let i = arr.length - 1; i >= 0; i--) {
1257
+ tokens.pop();
1258
+ if (arr[i].type === 'brace') {
1259
+ break;
1260
+ }
1261
+ if (arr[i].type !== 'dots') {
1262
+ range.unshift(arr[i].value);
1263
+ }
1264
+ }
1265
+
1266
+ output = expandRange(range, opts);
1267
+ state.backtrack = true;
1268
+ }
1269
+
1270
+ if (brace.comma !== true && brace.dots !== true) {
1271
+ const out = state.output.slice(0, brace.outputIndex);
1272
+ const toks = state.tokens.slice(brace.tokensIndex);
1273
+ brace.value = brace.output = '\\{';
1274
+ value = output = '\\}';
1275
+ state.output = out;
1276
+ for (const t of toks) {
1277
+ state.output += (t.output || t.value);
1278
+ }
1279
+ }
1280
+
1281
+ push({ type: 'brace', value, output });
1282
+ decrement('braces');
1283
+ braces.pop();
1284
+ continue;
1285
+ }
1286
+
1287
+ /**
1288
+ * Pipes
1289
+ */
1290
+
1291
+ if (value === '|') {
1292
+ if (extglobs.length > 0) {
1293
+ extglobs[extglobs.length - 1].conditions++;
1294
+ }
1295
+ push({ type: 'text', value });
1296
+ continue;
1297
+ }
1298
+
1299
+ /**
1300
+ * Commas
1301
+ */
1302
+
1303
+ if (value === ',') {
1304
+ let output = value;
1305
+
1306
+ const brace = braces[braces.length - 1];
1307
+ if (brace && stack[stack.length - 1] === 'braces') {
1308
+ brace.comma = true;
1309
+ output = '|';
1310
+ }
1311
+
1312
+ push({ type: 'comma', value, output });
1313
+ continue;
1314
+ }
1315
+
1316
+ /**
1317
+ * Slashes
1318
+ */
1319
+
1320
+ if (value === '/') {
1321
+ // if the beginning of the glob is "./", advance the start
1322
+ // to the current index, and don't add the "./" characters
1323
+ // to the state. This greatly simplifies lookbehinds when
1324
+ // checking for BOS characters like "!" and "." (not "./")
1325
+ if (prev.type === 'dot' && state.index === state.start + 1) {
1326
+ state.start = state.index + 1;
1327
+ state.consumed = '';
1328
+ state.output = '';
1329
+ tokens.pop();
1330
+ prev = bos; // reset "prev" to the first token
1331
+ continue;
1332
+ }
1333
+
1334
+ push({ type: 'slash', value, output: SLASH_LITERAL });
1335
+ continue;
1336
+ }
1337
+
1338
+ /**
1339
+ * Dots
1340
+ */
1341
+
1342
+ if (value === '.') {
1343
+ if (state.braces > 0 && prev.type === 'dot') {
1344
+ if (prev.value === '.') prev.output = DOT_LITERAL;
1345
+ const brace = braces[braces.length - 1];
1346
+ prev.type = 'dots';
1347
+ prev.output += value;
1348
+ prev.value += value;
1349
+ brace.dots = true;
1350
+ continue;
1351
+ }
1352
+
1353
+ if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
1354
+ push({ type: 'text', value, output: DOT_LITERAL });
1355
+ continue;
1356
+ }
1357
+
1358
+ push({ type: 'dot', value, output: DOT_LITERAL });
1359
+ continue;
1360
+ }
1361
+
1362
+ /**
1363
+ * Question marks
1364
+ */
1365
+
1366
+ if (value === '?') {
1367
+ const isGroup = prev && prev.value === '(';
1368
+ if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
1369
+ extglobOpen('qmark', value);
1370
+ continue;
1371
+ }
1372
+
1373
+ if (prev && prev.type === 'paren') {
1374
+ const next = peek();
1375
+ let output = value;
1376
+
1377
+ if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
1378
+ output = `\\${value}`;
1379
+ }
1380
+
1381
+ push({ type: 'text', value, output });
1382
+ continue;
1383
+ }
1384
+
1385
+ if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
1386
+ push({ type: 'qmark', value, output: QMARK_NO_DOT });
1387
+ continue;
1388
+ }
1389
+
1390
+ push({ type: 'qmark', value, output: QMARK });
1391
+ continue;
1392
+ }
1393
+
1394
+ /**
1395
+ * Exclamation
1396
+ */
1397
+
1398
+ if (value === '!') {
1399
+ if (opts.noextglob !== true && peek() === '(') {
1400
+ if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
1401
+ extglobOpen('negate', value);
1402
+ continue;
1403
+ }
1404
+ }
1405
+
1406
+ if (opts.nonegate !== true && state.index === 0) {
1407
+ negate();
1408
+ continue;
1409
+ }
1410
+ }
1411
+
1412
+ /**
1413
+ * Plus
1414
+ */
1415
+
1416
+ if (value === '+') {
1417
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
1418
+ extglobOpen('plus', value);
1419
+ continue;
1420
+ }
1421
+
1422
+ if ((prev && prev.value === '(') || opts.regex === false) {
1423
+ push({ type: 'plus', value, output: PLUS_LITERAL });
1424
+ continue;
1425
+ }
1426
+
1427
+ if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
1428
+ push({ type: 'plus', value });
1429
+ continue;
1430
+ }
1431
+
1432
+ push({ type: 'plus', value: PLUS_LITERAL });
1433
+ continue;
1434
+ }
1435
+
1436
+ /**
1437
+ * Plain text
1438
+ */
1439
+
1440
+ if (value === '@') {
1441
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
1442
+ push({ type: 'at', extglob: true, value, output: '' });
1443
+ continue;
1444
+ }
1445
+
1446
+ push({ type: 'text', value });
1447
+ continue;
1448
+ }
1449
+
1450
+ /**
1451
+ * Plain text
1452
+ */
1453
+
1454
+ if (value !== '*') {
1455
+ if (value === '$' || value === '^') {
1456
+ value = `\\${value}`;
1457
+ }
1458
+
1459
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1460
+ if (match) {
1461
+ value += match[0];
1462
+ state.index += match[0].length;
1463
+ }
1464
+
1465
+ push({ type: 'text', value });
1466
+ continue;
1467
+ }
1468
+
1469
+ /**
1470
+ * Stars
1471
+ */
1472
+
1473
+ if (prev && (prev.type === 'globstar' || prev.star === true)) {
1474
+ prev.type = 'star';
1475
+ prev.star = true;
1476
+ prev.value += value;
1477
+ prev.output = star;
1478
+ state.backtrack = true;
1479
+ state.globstar = true;
1480
+ consume(value);
1481
+ continue;
1482
+ }
1483
+
1484
+ let rest = remaining();
1485
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1486
+ extglobOpen('star', value);
1487
+ continue;
1488
+ }
1489
+
1490
+ if (prev.type === 'star') {
1491
+ if (opts.noglobstar === true) {
1492
+ consume(value);
1493
+ continue;
1494
+ }
1495
+
1496
+ const prior = prev.prev;
1497
+ const before = prior.prev;
1498
+ const isStart = prior.type === 'slash' || prior.type === 'bos';
1499
+ const afterStar = before && (before.type === 'star' || before.type === 'globstar');
1500
+
1501
+ if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
1502
+ push({ type: 'star', value, output: '' });
1503
+ continue;
1504
+ }
1505
+
1506
+ const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
1507
+ const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
1508
+ if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
1509
+ push({ type: 'star', value, output: '' });
1510
+ continue;
1511
+ }
1512
+
1513
+ // strip consecutive `/**/`
1514
+ while (rest.slice(0, 3) === '/**') {
1515
+ const after = input[state.index + 4];
1516
+ if (after && after !== '/') {
1517
+ break;
1518
+ }
1519
+ rest = rest.slice(3);
1520
+ consume('/**', 3);
1521
+ }
1522
+
1523
+ if (prior.type === 'bos' && eos()) {
1524
+ prev.type = 'globstar';
1525
+ prev.value += value;
1526
+ prev.output = globstar(opts);
1527
+ state.output = prev.output;
1528
+ state.globstar = true;
1529
+ consume(value);
1530
+ continue;
1531
+ }
1532
+
1533
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
1534
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1535
+ prior.output = `(?:${prior.output}`;
1536
+
1537
+ prev.type = 'globstar';
1538
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
1539
+ prev.value += value;
1540
+ state.globstar = true;
1541
+ state.output += prior.output + prev.output;
1542
+ consume(value);
1543
+ continue;
1544
+ }
1545
+
1546
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
1547
+ const end = rest[1] !== void 0 ? '|$' : '';
1548
+
1549
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1550
+ prior.output = `(?:${prior.output}`;
1551
+
1552
+ prev.type = 'globstar';
1553
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1554
+ prev.value += value;
1555
+
1556
+ state.output += prior.output + prev.output;
1557
+ state.globstar = true;
1558
+
1559
+ consume(value + advance());
1560
+
1561
+ push({ type: 'slash', value: '/', output: '' });
1562
+ continue;
1563
+ }
1564
+
1565
+ if (prior.type === 'bos' && rest[0] === '/') {
1566
+ prev.type = 'globstar';
1567
+ prev.value += value;
1568
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1569
+ state.output = prev.output;
1570
+ state.globstar = true;
1571
+ consume(value + advance());
1572
+ push({ type: 'slash', value: '/', output: '' });
1573
+ continue;
1574
+ }
1575
+
1576
+ // remove single star from output
1577
+ state.output = state.output.slice(0, -prev.output.length);
1578
+
1579
+ // reset previous token to globstar
1580
+ prev.type = 'globstar';
1581
+ prev.output = globstar(opts);
1582
+ prev.value += value;
1583
+
1584
+ // reset output with globstar
1585
+ state.output += prev.output;
1586
+ state.globstar = true;
1587
+ consume(value);
1588
+ continue;
1589
+ }
1590
+
1591
+ const token = { type: 'star', value, output: star };
1592
+
1593
+ if (opts.bash === true) {
1594
+ token.output = '.*?';
1595
+ if (prev.type === 'bos' || prev.type === 'slash') {
1596
+ token.output = nodot + token.output;
1597
+ }
1598
+ push(token);
1599
+ continue;
1600
+ }
1601
+
1602
+ if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
1603
+ token.output = value;
1604
+ push(token);
1605
+ continue;
1606
+ }
1607
+
1608
+ if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
1609
+ if (prev.type === 'dot') {
1610
+ state.output += NO_DOT_SLASH;
1611
+ prev.output += NO_DOT_SLASH;
1612
+
1613
+ } else if (opts.dot === true) {
1614
+ state.output += NO_DOTS_SLASH;
1615
+ prev.output += NO_DOTS_SLASH;
1616
+
1617
+ } else {
1618
+ state.output += nodot;
1619
+ prev.output += nodot;
1620
+ }
1621
+
1622
+ if (peek() !== '*') {
1623
+ state.output += ONE_CHAR;
1624
+ prev.output += ONE_CHAR;
1625
+ }
1626
+ }
1627
+
1628
+ push(token);
1629
+ }
1630
+
1631
+ while (state.brackets > 0) {
1632
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
1633
+ state.output = utils.escapeLast(state.output, '[');
1634
+ decrement('brackets');
1635
+ }
1636
+
1637
+ while (state.parens > 0) {
1638
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
1639
+ state.output = utils.escapeLast(state.output, '(');
1640
+ decrement('parens');
1641
+ }
1642
+
1643
+ while (state.braces > 0) {
1644
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
1645
+ state.output = utils.escapeLast(state.output, '{');
1646
+ decrement('braces');
1647
+ }
1648
+
1649
+ if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
1650
+ push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
1651
+ }
1652
+
1653
+ // rebuild the output if we had to backtrack at any point
1654
+ if (state.backtrack === true) {
1655
+ state.output = '';
1656
+
1657
+ for (const token of state.tokens) {
1658
+ state.output += token.output != null ? token.output : token.value;
1659
+
1660
+ if (token.suffix) {
1661
+ state.output += token.suffix;
1662
+ }
1663
+ }
1664
+ }
1665
+
1666
+ return state;
1667
+ };
1668
+
1669
+ /**
1670
+ * Fast paths for creating regular expressions for common glob patterns.
1671
+ * This can significantly speed up processing and has very little downside
1672
+ * impact when none of the fast paths match.
1673
+ */
1674
+
1675
+ parse.fastpaths = (input, options) => {
1676
+ const opts = { ...options };
1677
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1678
+ const len = input.length;
1679
+ if (len > max) {
1680
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1681
+ }
1682
+
1683
+ input = REPLACEMENTS[input] || input;
1684
+
1685
+ // create constants based on platform, for windows or posix
1686
+ const {
1687
+ DOT_LITERAL,
1688
+ SLASH_LITERAL,
1689
+ ONE_CHAR,
1690
+ DOTS_SLASH,
1691
+ NO_DOT,
1692
+ NO_DOTS,
1693
+ NO_DOTS_SLASH,
1694
+ STAR,
1695
+ START_ANCHOR
1696
+ } = constants.globChars(opts.windows);
1697
+
1698
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
1699
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1700
+ const capture = opts.capture ? '' : '?:';
1701
+ const state = { negated: false, prefix: '' };
1702
+ let star = opts.bash === true ? '.*?' : STAR;
1703
+
1704
+ if (opts.capture) {
1705
+ star = `(${star})`;
1706
+ }
1707
+
1708
+ const globstar = opts => {
1709
+ if (opts.noglobstar === true) return star;
1710
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1711
+ };
1712
+
1713
+ const create = str => {
1714
+ switch (str) {
1715
+ case '*':
1716
+ return `${nodot}${ONE_CHAR}${star}`;
1717
+
1718
+ case '.*':
1719
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1720
+
1721
+ case '*.*':
1722
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1723
+
1724
+ case '*/*':
1725
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1726
+
1727
+ case '**':
1728
+ return nodot + globstar(opts);
1729
+
1730
+ case '**/*':
1731
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1732
+
1733
+ case '**/*.*':
1734
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1735
+
1736
+ case '**/.*':
1737
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1738
+
1739
+ default: {
1740
+ const match = /^(.*?)\.(\w+)$/.exec(str);
1741
+ if (!match) return;
1742
+
1743
+ const source = create(match[1]);
1744
+ if (!source) return;
1745
+
1746
+ return source + DOT_LITERAL + match[2];
1747
+ }
1748
+ }
1749
+ };
1750
+
1751
+ const output = utils.removePrefix(input, state);
1752
+ let source = create(output);
1753
+
1754
+ if (source && opts.strictSlashes !== true) {
1755
+ source += `${SLASH_LITERAL}?`;
1756
+ }
1757
+
1758
+ return source;
1759
+ };
1760
+
1761
+ parse_1 = parse;
1762
+ return parse_1;
1763
+ }
1764
+
1765
+ var picomatch_1$1;
1766
+ var hasRequiredPicomatch$1;
1767
+
1768
+ function requirePicomatch$1 () {
1769
+ if (hasRequiredPicomatch$1) return picomatch_1$1;
1770
+ hasRequiredPicomatch$1 = 1;
1771
+
1772
+ const scan = /*@__PURE__*/ requireScan();
1773
+ const parse = /*@__PURE__*/ requireParse();
1774
+ const utils = /*@__PURE__*/ requireUtils();
1775
+ const constants = /*@__PURE__*/ requireConstants();
1776
+ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
1777
+
1778
+ /**
1779
+ * Creates a matcher function from one or more glob patterns. The
1780
+ * returned function takes a string to match as its first argument,
1781
+ * and returns true if the string is a match. The returned matcher
1782
+ * function also takes a boolean as the second argument that, when true,
1783
+ * returns an object with additional information.
1784
+ *
1785
+ * ```js
1786
+ * const picomatch = require('picomatch');
1787
+ * // picomatch(glob[, options]);
1788
+ *
1789
+ * const isMatch = picomatch('*.!(*a)');
1790
+ * console.log(isMatch('a.a')); //=> false
1791
+ * console.log(isMatch('a.b')); //=> true
1792
+ * ```
1793
+ * @name picomatch
1794
+ * @param {String|Array} `globs` One or more glob patterns.
1795
+ * @param {Object=} `options`
1796
+ * @return {Function=} Returns a matcher function.
1797
+ * @api public
1798
+ */
1799
+
1800
+ const picomatch = (glob, options, returnState = false) => {
1801
+ if (Array.isArray(glob)) {
1802
+ const fns = glob.map(input => picomatch(input, options, returnState));
1803
+ const arrayMatcher = str => {
1804
+ for (const isMatch of fns) {
1805
+ const state = isMatch(str);
1806
+ if (state) return state;
1807
+ }
1808
+ return false;
1809
+ };
1810
+ return arrayMatcher;
1811
+ }
1812
+
1813
+ const isState = isObject(glob) && glob.tokens && glob.input;
1814
+
1815
+ if (glob === '' || (typeof glob !== 'string' && !isState)) {
1816
+ throw new TypeError('Expected pattern to be a non-empty string');
1817
+ }
1818
+
1819
+ const opts = options || {};
1820
+ const posix = opts.windows;
1821
+ const regex = isState
1822
+ ? picomatch.compileRe(glob, options)
1823
+ : picomatch.makeRe(glob, options, false, true);
1824
+
1825
+ const state = regex.state;
1826
+ delete regex.state;
1827
+
1828
+ let isIgnored = () => false;
1829
+ if (opts.ignore) {
1830
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
1831
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1832
+ }
1833
+
1834
+ const matcher = (input, returnObject = false) => {
1835
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
1836
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
1837
+
1838
+ if (typeof opts.onResult === 'function') {
1839
+ opts.onResult(result);
1840
+ }
1841
+
1842
+ if (isMatch === false) {
1843
+ result.isMatch = false;
1844
+ return returnObject ? result : false;
1845
+ }
1846
+
1847
+ if (isIgnored(input)) {
1848
+ if (typeof opts.onIgnore === 'function') {
1849
+ opts.onIgnore(result);
1850
+ }
1851
+ result.isMatch = false;
1852
+ return returnObject ? result : false;
1853
+ }
1854
+
1855
+ if (typeof opts.onMatch === 'function') {
1856
+ opts.onMatch(result);
1857
+ }
1858
+ return returnObject ? result : true;
1859
+ };
1860
+
1861
+ if (returnState) {
1862
+ matcher.state = state;
1863
+ }
1864
+
1865
+ return matcher;
1866
+ };
1867
+
1868
+ /**
1869
+ * Test `input` with the given `regex`. This is used by the main
1870
+ * `picomatch()` function to test the input string.
1871
+ *
1872
+ * ```js
1873
+ * const picomatch = require('picomatch');
1874
+ * // picomatch.test(input, regex[, options]);
1875
+ *
1876
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
1877
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
1878
+ * ```
1879
+ * @param {String} `input` String to test.
1880
+ * @param {RegExp} `regex`
1881
+ * @return {Object} Returns an object with matching info.
1882
+ * @api public
1883
+ */
1884
+
1885
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
1886
+ if (typeof input !== 'string') {
1887
+ throw new TypeError('Expected input to be a string');
1888
+ }
1889
+
1890
+ if (input === '') {
1891
+ return { isMatch: false, output: '' };
1892
+ }
1893
+
1894
+ const opts = options || {};
1895
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
1896
+ let match = input === glob;
1897
+ let output = (match && format) ? format(input) : input;
1898
+
1899
+ if (match === false) {
1900
+ output = format ? format(input) : input;
1901
+ match = output === glob;
1902
+ }
1903
+
1904
+ if (match === false || opts.capture === true) {
1905
+ if (opts.matchBase === true || opts.basename === true) {
1906
+ match = picomatch.matchBase(input, regex, options, posix);
1907
+ } else {
1908
+ match = regex.exec(output);
1909
+ }
1910
+ }
1911
+
1912
+ return { isMatch: Boolean(match), match, output };
1913
+ };
1914
+
1915
+ /**
1916
+ * Match the basename of a filepath.
1917
+ *
1918
+ * ```js
1919
+ * const picomatch = require('picomatch');
1920
+ * // picomatch.matchBase(input, glob[, options]);
1921
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
1922
+ * ```
1923
+ * @param {String} `input` String to test.
1924
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
1925
+ * @return {Boolean}
1926
+ * @api public
1927
+ */
1928
+
1929
+ picomatch.matchBase = (input, glob, options) => {
1930
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
1931
+ return regex.test(utils.basename(input));
1932
+ };
1933
+
1934
+ /**
1935
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
1936
+ *
1937
+ * ```js
1938
+ * const picomatch = require('picomatch');
1939
+ * // picomatch.isMatch(string, patterns[, options]);
1940
+ *
1941
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
1942
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
1943
+ * ```
1944
+ * @param {String|Array} str The string to test.
1945
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
1946
+ * @param {Object} [options] See available [options](#options).
1947
+ * @return {Boolean} Returns true if any patterns match `str`
1948
+ * @api public
1949
+ */
1950
+
1951
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
1952
+
1953
+ /**
1954
+ * Parse a glob pattern to create the source string for a regular
1955
+ * expression.
1956
+ *
1957
+ * ```js
1958
+ * const picomatch = require('picomatch');
1959
+ * const result = picomatch.parse(pattern[, options]);
1960
+ * ```
1961
+ * @param {String} `pattern`
1962
+ * @param {Object} `options`
1963
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
1964
+ * @api public
1965
+ */
1966
+
1967
+ picomatch.parse = (pattern, options) => {
1968
+ if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
1969
+ return parse(pattern, { ...options, fastpaths: false });
1970
+ };
1971
+
1972
+ /**
1973
+ * Scan a glob pattern to separate the pattern into segments.
1974
+ *
1975
+ * ```js
1976
+ * const picomatch = require('picomatch');
1977
+ * // picomatch.scan(input[, options]);
1978
+ *
1979
+ * const result = picomatch.scan('!./foo/*.js');
1980
+ * console.log(result);
1981
+ * { prefix: '!./',
1982
+ * input: '!./foo/*.js',
1983
+ * start: 3,
1984
+ * base: 'foo',
1985
+ * glob: '*.js',
1986
+ * isBrace: false,
1987
+ * isBracket: false,
1988
+ * isGlob: true,
1989
+ * isExtglob: false,
1990
+ * isGlobstar: false,
1991
+ * negated: true }
1992
+ * ```
1993
+ * @param {String} `input` Glob pattern to scan.
1994
+ * @param {Object} `options`
1995
+ * @return {Object} Returns an object with
1996
+ * @api public
1997
+ */
1998
+
1999
+ picomatch.scan = (input, options) => scan(input, options);
2000
+
2001
+ /**
2002
+ * Compile a regular expression from the `state` object returned by the
2003
+ * [parse()](#parse) method.
2004
+ *
2005
+ * @param {Object} `state`
2006
+ * @param {Object} `options`
2007
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
2008
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
2009
+ * @return {RegExp}
2010
+ * @api public
2011
+ */
2012
+
2013
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
2014
+ if (returnOutput === true) {
2015
+ return state.output;
2016
+ }
2017
+
2018
+ const opts = options || {};
2019
+ const prepend = opts.contains ? '' : '^';
2020
+ const append = opts.contains ? '' : '$';
2021
+
2022
+ let source = `${prepend}(?:${state.output})${append}`;
2023
+ if (state && state.negated === true) {
2024
+ source = `^(?!${source}).*$`;
2025
+ }
2026
+
2027
+ const regex = picomatch.toRegex(source, options);
2028
+ if (returnState === true) {
2029
+ regex.state = state;
2030
+ }
2031
+
2032
+ return regex;
2033
+ };
2034
+
2035
+ /**
2036
+ * Create a regular expression from a parsed glob pattern.
2037
+ *
2038
+ * ```js
2039
+ * const picomatch = require('picomatch');
2040
+ * const state = picomatch.parse('*.js');
2041
+ * // picomatch.compileRe(state[, options]);
2042
+ *
2043
+ * console.log(picomatch.compileRe(state));
2044
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2045
+ * ```
2046
+ * @param {String} `state` The object returned from the `.parse` method.
2047
+ * @param {Object} `options`
2048
+ * @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.
2049
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
2050
+ * @return {RegExp} Returns a regex created from the given pattern.
2051
+ * @api public
2052
+ */
2053
+
2054
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
2055
+ if (!input || typeof input !== 'string') {
2056
+ throw new TypeError('Expected a non-empty string');
2057
+ }
2058
+
2059
+ let parsed = { negated: false, fastpaths: true };
2060
+
2061
+ if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
2062
+ parsed.output = parse.fastpaths(input, options);
2063
+ }
2064
+
2065
+ if (!parsed.output) {
2066
+ parsed = parse(input, options);
2067
+ }
2068
+
2069
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
2070
+ };
2071
+
2072
+ /**
2073
+ * Create a regular expression from the given regex source string.
2074
+ *
2075
+ * ```js
2076
+ * const picomatch = require('picomatch');
2077
+ * // picomatch.toRegex(source[, options]);
2078
+ *
2079
+ * const { output } = picomatch.parse('*.js');
2080
+ * console.log(picomatch.toRegex(output));
2081
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2082
+ * ```
2083
+ * @param {String} `source` Regular expression source string.
2084
+ * @param {Object} `options`
2085
+ * @return {RegExp}
2086
+ * @api public
2087
+ */
2088
+
2089
+ picomatch.toRegex = (source, options) => {
2090
+ try {
2091
+ const opts = options || {};
2092
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
2093
+ } catch (err) {
2094
+ if (options && options.debug === true) throw err;
2095
+ return /$^/;
2096
+ }
2097
+ };
2098
+
2099
+ /**
2100
+ * Picomatch constants.
2101
+ * @return {Object}
2102
+ */
2103
+
2104
+ picomatch.constants = constants;
2105
+
2106
+ /**
2107
+ * Expose "picomatch"
2108
+ */
2109
+
2110
+ picomatch_1$1 = picomatch;
2111
+ return picomatch_1$1;
2112
+ }
2113
+
2114
+ var picomatch_1;
2115
+ var hasRequiredPicomatch;
2116
+
2117
+ function requirePicomatch () {
2118
+ if (hasRequiredPicomatch) return picomatch_1;
2119
+ hasRequiredPicomatch = 1;
2120
+
2121
+ const pico = /*@__PURE__*/ requirePicomatch$1();
2122
+ const utils = /*@__PURE__*/ requireUtils();
2123
+
2124
+ function picomatch(glob, options, returnState = false) {
2125
+ // default to os.platform()
2126
+ if (options && (options.windows === null || options.windows === undefined)) {
2127
+ // don't mutate the original options object
2128
+ options = { ...options, windows: utils.isWindows() };
2129
+ }
2130
+
2131
+ return pico(glob, options, returnState);
2132
+ }
2133
+
2134
+ Object.assign(picomatch, pico);
2135
+ picomatch_1 = picomatch;
2136
+ return picomatch_1;
2137
+ }
2138
+
2139
+ export { requirePicomatch as r };