sickbay 1.15.0 → 1.15.2

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.
@@ -1,1761 +1,4 @@
1
- import {
2
- __commonJS,
3
- __toESM
4
- } from "./chunk-JSBRDJBE.js";
5
-
6
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
7
- var require_constants = __commonJS({
8
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"(exports, module) {
9
- "use strict";
10
- var WIN_SLASH = "\\\\/";
11
- var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
12
- var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
13
- var DOT_LITERAL = "\\.";
14
- var PLUS_LITERAL = "\\+";
15
- var QMARK_LITERAL = "\\?";
16
- var SLASH_LITERAL = "\\/";
17
- var ONE_CHAR = "(?=.)";
18
- var QMARK = "[^/]";
19
- var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
20
- var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
21
- var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
22
- var NO_DOT = `(?!${DOT_LITERAL})`;
23
- var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
24
- var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
25
- var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
26
- var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
27
- var STAR = `${QMARK}*?`;
28
- var SEP = "/";
29
- var POSIX_CHARS = {
30
- DOT_LITERAL,
31
- PLUS_LITERAL,
32
- QMARK_LITERAL,
33
- SLASH_LITERAL,
34
- ONE_CHAR,
35
- QMARK,
36
- END_ANCHOR,
37
- DOTS_SLASH,
38
- NO_DOT,
39
- NO_DOTS,
40
- NO_DOT_SLASH,
41
- NO_DOTS_SLASH,
42
- QMARK_NO_DOT,
43
- STAR,
44
- START_ANCHOR,
45
- SEP
46
- };
47
- var WINDOWS_CHARS = {
48
- ...POSIX_CHARS,
49
- SLASH_LITERAL: `[${WIN_SLASH}]`,
50
- QMARK: WIN_NO_SLASH,
51
- STAR: `${WIN_NO_SLASH}*?`,
52
- DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
53
- NO_DOT: `(?!${DOT_LITERAL})`,
54
- NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
55
- NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
56
- NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
57
- QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
58
- START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
59
- END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
60
- SEP: "\\"
61
- };
62
- var POSIX_REGEX_SOURCE = {
63
- __proto__: null,
64
- alnum: "a-zA-Z0-9",
65
- alpha: "a-zA-Z",
66
- ascii: "\\x00-\\x7F",
67
- blank: " \\t",
68
- cntrl: "\\x00-\\x1F\\x7F",
69
- digit: "0-9",
70
- graph: "\\x21-\\x7E",
71
- lower: "a-z",
72
- print: "\\x20-\\x7E ",
73
- punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
74
- space: " \\t\\r\\n\\v\\f",
75
- upper: "A-Z",
76
- word: "A-Za-z0-9_",
77
- xdigit: "A-Fa-f0-9"
78
- };
79
- module.exports = {
80
- DEFAULT_MAX_EXTGLOB_RECURSION,
81
- MAX_LENGTH: 1024 * 64,
82
- POSIX_REGEX_SOURCE,
83
- // regular expressions
84
- REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
85
- REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
86
- REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
87
- REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
88
- REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
89
- REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
90
- // Replace globs with equivalent patterns to reduce parsing time.
91
- REPLACEMENTS: {
92
- __proto__: null,
93
- "***": "*",
94
- "**/**": "**",
95
- "**/**/**": "**"
96
- },
97
- // Digits
98
- CHAR_0: 48,
99
- /* 0 */
100
- CHAR_9: 57,
101
- /* 9 */
102
- // Alphabet chars.
103
- CHAR_UPPERCASE_A: 65,
104
- /* A */
105
- CHAR_LOWERCASE_A: 97,
106
- /* a */
107
- CHAR_UPPERCASE_Z: 90,
108
- /* Z */
109
- CHAR_LOWERCASE_Z: 122,
110
- /* z */
111
- CHAR_LEFT_PARENTHESES: 40,
112
- /* ( */
113
- CHAR_RIGHT_PARENTHESES: 41,
114
- /* ) */
115
- CHAR_ASTERISK: 42,
116
- /* * */
117
- // Non-alphabetic chars.
118
- CHAR_AMPERSAND: 38,
119
- /* & */
120
- CHAR_AT: 64,
121
- /* @ */
122
- CHAR_BACKWARD_SLASH: 92,
123
- /* \ */
124
- CHAR_CARRIAGE_RETURN: 13,
125
- /* \r */
126
- CHAR_CIRCUMFLEX_ACCENT: 94,
127
- /* ^ */
128
- CHAR_COLON: 58,
129
- /* : */
130
- CHAR_COMMA: 44,
131
- /* , */
132
- CHAR_DOT: 46,
133
- /* . */
134
- CHAR_DOUBLE_QUOTE: 34,
135
- /* " */
136
- CHAR_EQUAL: 61,
137
- /* = */
138
- CHAR_EXCLAMATION_MARK: 33,
139
- /* ! */
140
- CHAR_FORM_FEED: 12,
141
- /* \f */
142
- CHAR_FORWARD_SLASH: 47,
143
- /* / */
144
- CHAR_GRAVE_ACCENT: 96,
145
- /* ` */
146
- CHAR_HASH: 35,
147
- /* # */
148
- CHAR_HYPHEN_MINUS: 45,
149
- /* - */
150
- CHAR_LEFT_ANGLE_BRACKET: 60,
151
- /* < */
152
- CHAR_LEFT_CURLY_BRACE: 123,
153
- /* { */
154
- CHAR_LEFT_SQUARE_BRACKET: 91,
155
- /* [ */
156
- CHAR_LINE_FEED: 10,
157
- /* \n */
158
- CHAR_NO_BREAK_SPACE: 160,
159
- /* \u00A0 */
160
- CHAR_PERCENT: 37,
161
- /* % */
162
- CHAR_PLUS: 43,
163
- /* + */
164
- CHAR_QUESTION_MARK: 63,
165
- /* ? */
166
- CHAR_RIGHT_ANGLE_BRACKET: 62,
167
- /* > */
168
- CHAR_RIGHT_CURLY_BRACE: 125,
169
- /* } */
170
- CHAR_RIGHT_SQUARE_BRACKET: 93,
171
- /* ] */
172
- CHAR_SEMICOLON: 59,
173
- /* ; */
174
- CHAR_SINGLE_QUOTE: 39,
175
- /* ' */
176
- CHAR_SPACE: 32,
177
- /* */
178
- CHAR_TAB: 9,
179
- /* \t */
180
- CHAR_UNDERSCORE: 95,
181
- /* _ */
182
- CHAR_VERTICAL_LINE: 124,
183
- /* | */
184
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
185
- /* \uFEFF */
186
- /**
187
- * Create EXTGLOB_CHARS
188
- */
189
- extglobChars(chars) {
190
- return {
191
- "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
192
- "?": { type: "qmark", open: "(?:", close: ")?" },
193
- "+": { type: "plus", open: "(?:", close: ")+" },
194
- "*": { type: "star", open: "(?:", close: ")*" },
195
- "@": { type: "at", open: "(?:", close: ")" }
196
- };
197
- },
198
- /**
199
- * Create GLOB_CHARS
200
- */
201
- globChars(win32) {
202
- return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
203
- }
204
- };
205
- }
206
- });
207
-
208
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
209
- var require_utils = __commonJS({
210
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"(exports) {
211
- "use strict";
212
- var {
213
- REGEX_BACKSLASH,
214
- REGEX_REMOVE_BACKSLASH,
215
- REGEX_SPECIAL_CHARS,
216
- REGEX_SPECIAL_CHARS_GLOBAL
217
- } = require_constants();
218
- exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
219
- exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
220
- exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
221
- exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
222
- exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
223
- exports.isWindows = () => {
224
- if (typeof navigator !== "undefined" && navigator.platform) {
225
- const platform = navigator.platform.toLowerCase();
226
- return platform === "win32" || platform === "windows";
227
- }
228
- if (typeof process !== "undefined" && process.platform) {
229
- return process.platform === "win32";
230
- }
231
- return false;
232
- };
233
- exports.removeBackslashes = (str) => {
234
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
235
- return match === "\\" ? "" : match;
236
- });
237
- };
238
- exports.escapeLast = (input, char, lastIdx) => {
239
- const idx = input.lastIndexOf(char, lastIdx);
240
- if (idx === -1) return input;
241
- if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
242
- return `${input.slice(0, idx)}\\${input.slice(idx)}`;
243
- };
244
- exports.removePrefix = (input, state = {}) => {
245
- let output = input;
246
- if (output.startsWith("./")) {
247
- output = output.slice(2);
248
- state.prefix = "./";
249
- }
250
- return output;
251
- };
252
- exports.wrapOutput = (input, state = {}, options = {}) => {
253
- const prepend = options.contains ? "" : "^";
254
- const append = options.contains ? "" : "$";
255
- let output = `${prepend}(?:${input})${append}`;
256
- if (state.negated === true) {
257
- output = `(?:^(?!${output}).*$)`;
258
- }
259
- return output;
260
- };
261
- exports.basename = (path, { windows } = {}) => {
262
- const segs = path.split(windows ? /[\\/]/ : "/");
263
- const last = segs[segs.length - 1];
264
- if (last === "") {
265
- return segs[segs.length - 2];
266
- }
267
- return last;
268
- };
269
- }
270
- });
271
-
272
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
273
- var require_scan = __commonJS({
274
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js"(exports, module) {
275
- "use strict";
276
- var utils = require_utils();
277
- var {
278
- CHAR_ASTERISK,
279
- /* * */
280
- CHAR_AT,
281
- /* @ */
282
- CHAR_BACKWARD_SLASH,
283
- /* \ */
284
- CHAR_COMMA,
285
- /* , */
286
- CHAR_DOT,
287
- /* . */
288
- CHAR_EXCLAMATION_MARK,
289
- /* ! */
290
- CHAR_FORWARD_SLASH,
291
- /* / */
292
- CHAR_LEFT_CURLY_BRACE,
293
- /* { */
294
- CHAR_LEFT_PARENTHESES,
295
- /* ( */
296
- CHAR_LEFT_SQUARE_BRACKET,
297
- /* [ */
298
- CHAR_PLUS,
299
- /* + */
300
- CHAR_QUESTION_MARK,
301
- /* ? */
302
- CHAR_RIGHT_CURLY_BRACE,
303
- /* } */
304
- CHAR_RIGHT_PARENTHESES,
305
- /* ) */
306
- CHAR_RIGHT_SQUARE_BRACKET
307
- /* ] */
308
- } = require_constants();
309
- var isPathSeparator = (code) => {
310
- return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
311
- };
312
- var depth = (token) => {
313
- if (token.isPrefix !== true) {
314
- token.depth = token.isGlobstar ? Infinity : 1;
315
- }
316
- };
317
- var scan = (input, options) => {
318
- const opts = options || {};
319
- const length = input.length - 1;
320
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
321
- const slashes = [];
322
- const tokens = [];
323
- const parts = [];
324
- let str = input;
325
- let index = -1;
326
- let start = 0;
327
- let lastIndex = 0;
328
- let isBrace = false;
329
- let isBracket = false;
330
- let isGlob = false;
331
- let isExtglob = false;
332
- let isGlobstar = false;
333
- let braceEscaped = false;
334
- let backslashes = false;
335
- let negated = false;
336
- let negatedExtglob = false;
337
- let finished = false;
338
- let braces = 0;
339
- let prev;
340
- let code;
341
- let token = { value: "", depth: 0, isGlob: false };
342
- const eos = () => index >= length;
343
- const peek = () => str.charCodeAt(index + 1);
344
- const advance = () => {
345
- prev = code;
346
- return str.charCodeAt(++index);
347
- };
348
- while (index < length) {
349
- code = advance();
350
- let next;
351
- if (code === CHAR_BACKWARD_SLASH) {
352
- backslashes = token.backslashes = true;
353
- code = advance();
354
- if (code === CHAR_LEFT_CURLY_BRACE) {
355
- braceEscaped = true;
356
- }
357
- continue;
358
- }
359
- if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
360
- braces++;
361
- while (eos() !== true && (code = advance())) {
362
- if (code === CHAR_BACKWARD_SLASH) {
363
- backslashes = token.backslashes = true;
364
- advance();
365
- continue;
366
- }
367
- if (code === CHAR_LEFT_CURLY_BRACE) {
368
- braces++;
369
- continue;
370
- }
371
- if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
372
- isBrace = token.isBrace = true;
373
- isGlob = token.isGlob = true;
374
- finished = true;
375
- if (scanToEnd === true) {
376
- continue;
377
- }
378
- break;
379
- }
380
- if (braceEscaped !== true && code === CHAR_COMMA) {
381
- isBrace = token.isBrace = true;
382
- isGlob = token.isGlob = true;
383
- finished = true;
384
- if (scanToEnd === true) {
385
- continue;
386
- }
387
- break;
388
- }
389
- if (code === CHAR_RIGHT_CURLY_BRACE) {
390
- braces--;
391
- if (braces === 0) {
392
- braceEscaped = false;
393
- isBrace = token.isBrace = true;
394
- finished = true;
395
- break;
396
- }
397
- }
398
- }
399
- if (scanToEnd === true) {
400
- continue;
401
- }
402
- break;
403
- }
404
- if (code === CHAR_FORWARD_SLASH) {
405
- slashes.push(index);
406
- tokens.push(token);
407
- token = { value: "", depth: 0, isGlob: false };
408
- if (finished === true) continue;
409
- if (prev === CHAR_DOT && index === start + 1) {
410
- start += 2;
411
- continue;
412
- }
413
- lastIndex = index + 1;
414
- continue;
415
- }
416
- if (opts.noext !== true) {
417
- const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
418
- if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
419
- isGlob = token.isGlob = true;
420
- isExtglob = token.isExtglob = true;
421
- finished = true;
422
- if (code === CHAR_EXCLAMATION_MARK && index === start) {
423
- negatedExtglob = true;
424
- }
425
- if (scanToEnd === true) {
426
- while (eos() !== true && (code = advance())) {
427
- if (code === CHAR_BACKWARD_SLASH) {
428
- backslashes = token.backslashes = true;
429
- code = advance();
430
- continue;
431
- }
432
- if (code === CHAR_RIGHT_PARENTHESES) {
433
- isGlob = token.isGlob = true;
434
- finished = true;
435
- break;
436
- }
437
- }
438
- continue;
439
- }
440
- break;
441
- }
442
- }
443
- if (code === CHAR_ASTERISK) {
444
- if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
445
- isGlob = token.isGlob = true;
446
- finished = true;
447
- if (scanToEnd === true) {
448
- continue;
449
- }
450
- break;
451
- }
452
- if (code === CHAR_QUESTION_MARK) {
453
- isGlob = token.isGlob = true;
454
- finished = true;
455
- if (scanToEnd === true) {
456
- continue;
457
- }
458
- break;
459
- }
460
- if (code === CHAR_LEFT_SQUARE_BRACKET) {
461
- while (eos() !== true && (next = advance())) {
462
- if (next === CHAR_BACKWARD_SLASH) {
463
- backslashes = token.backslashes = true;
464
- advance();
465
- continue;
466
- }
467
- if (next === CHAR_RIGHT_SQUARE_BRACKET) {
468
- isBracket = token.isBracket = true;
469
- isGlob = token.isGlob = true;
470
- finished = true;
471
- break;
472
- }
473
- }
474
- if (scanToEnd === true) {
475
- continue;
476
- }
477
- break;
478
- }
479
- if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
480
- negated = token.negated = true;
481
- start++;
482
- continue;
483
- }
484
- if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
485
- isGlob = token.isGlob = true;
486
- if (scanToEnd === true) {
487
- while (eos() !== true && (code = advance())) {
488
- if (code === CHAR_LEFT_PARENTHESES) {
489
- backslashes = token.backslashes = true;
490
- code = advance();
491
- continue;
492
- }
493
- if (code === CHAR_RIGHT_PARENTHESES) {
494
- finished = true;
495
- break;
496
- }
497
- }
498
- continue;
499
- }
500
- break;
501
- }
502
- if (isGlob === true) {
503
- finished = true;
504
- if (scanToEnd === true) {
505
- continue;
506
- }
507
- break;
508
- }
509
- }
510
- if (opts.noext === true) {
511
- isExtglob = false;
512
- isGlob = false;
513
- }
514
- let base = str;
515
- let prefix = "";
516
- let glob = "";
517
- if (start > 0) {
518
- prefix = str.slice(0, start);
519
- str = str.slice(start);
520
- lastIndex -= start;
521
- }
522
- if (base && isGlob === true && lastIndex > 0) {
523
- base = str.slice(0, lastIndex);
524
- glob = str.slice(lastIndex);
525
- } else if (isGlob === true) {
526
- base = "";
527
- glob = str;
528
- } else {
529
- base = str;
530
- }
531
- if (base && base !== "" && base !== "/" && base !== str) {
532
- if (isPathSeparator(base.charCodeAt(base.length - 1))) {
533
- base = base.slice(0, -1);
534
- }
535
- }
536
- if (opts.unescape === true) {
537
- if (glob) glob = utils.removeBackslashes(glob);
538
- if (base && backslashes === true) {
539
- base = utils.removeBackslashes(base);
540
- }
541
- }
542
- const state = {
543
- prefix,
544
- input,
545
- start,
546
- base,
547
- glob,
548
- isBrace,
549
- isBracket,
550
- isGlob,
551
- isExtglob,
552
- isGlobstar,
553
- negated,
554
- negatedExtglob
555
- };
556
- if (opts.tokens === true) {
557
- state.maxDepth = 0;
558
- if (!isPathSeparator(code)) {
559
- tokens.push(token);
560
- }
561
- state.tokens = tokens;
562
- }
563
- if (opts.parts === true || opts.tokens === true) {
564
- let prevIndex;
565
- for (let idx = 0; idx < slashes.length; idx++) {
566
- const n = prevIndex ? prevIndex + 1 : start;
567
- const i = slashes[idx];
568
- const value = input.slice(n, i);
569
- if (opts.tokens) {
570
- if (idx === 0 && start !== 0) {
571
- tokens[idx].isPrefix = true;
572
- tokens[idx].value = prefix;
573
- } else {
574
- tokens[idx].value = value;
575
- }
576
- depth(tokens[idx]);
577
- state.maxDepth += tokens[idx].depth;
578
- }
579
- if (idx !== 0 || value !== "") {
580
- parts.push(value);
581
- }
582
- prevIndex = i;
583
- }
584
- if (prevIndex && prevIndex + 1 < input.length) {
585
- const value = input.slice(prevIndex + 1);
586
- parts.push(value);
587
- if (opts.tokens) {
588
- tokens[tokens.length - 1].value = value;
589
- depth(tokens[tokens.length - 1]);
590
- state.maxDepth += tokens[tokens.length - 1].depth;
591
- }
592
- }
593
- state.slashes = slashes;
594
- state.parts = parts;
595
- }
596
- return state;
597
- };
598
- module.exports = scan;
599
- }
600
- });
601
-
602
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
603
- var require_parse = __commonJS({
604
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"(exports, module) {
605
- "use strict";
606
- var constants = require_constants();
607
- var utils = require_utils();
608
- var {
609
- MAX_LENGTH,
610
- POSIX_REGEX_SOURCE,
611
- REGEX_NON_SPECIAL_CHARS,
612
- REGEX_SPECIAL_CHARS_BACKREF,
613
- REPLACEMENTS
614
- } = constants;
615
- var expandRange = (args, options) => {
616
- if (typeof options.expandRange === "function") {
617
- return options.expandRange(...args, options);
618
- }
619
- args.sort();
620
- const value = `[${args.join("-")}]`;
621
- try {
622
- new RegExp(value);
623
- } catch (ex) {
624
- return args.map((v) => utils.escapeRegex(v)).join("..");
625
- }
626
- return value;
627
- };
628
- var syntaxError = (type, char) => {
629
- return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
630
- };
631
- var splitTopLevel = (input) => {
632
- const parts = [];
633
- let bracket = 0;
634
- let paren = 0;
635
- let quote = 0;
636
- let value = "";
637
- let escaped = false;
638
- for (const ch of input) {
639
- if (escaped === true) {
640
- value += ch;
641
- escaped = false;
642
- continue;
643
- }
644
- if (ch === "\\") {
645
- value += ch;
646
- escaped = true;
647
- continue;
648
- }
649
- if (ch === '"') {
650
- quote = quote === 1 ? 0 : 1;
651
- value += ch;
652
- continue;
653
- }
654
- if (quote === 0) {
655
- if (ch === "[") {
656
- bracket++;
657
- } else if (ch === "]" && bracket > 0) {
658
- bracket--;
659
- } else if (bracket === 0) {
660
- if (ch === "(") {
661
- paren++;
662
- } else if (ch === ")" && paren > 0) {
663
- paren--;
664
- } else if (ch === "|" && paren === 0) {
665
- parts.push(value);
666
- value = "";
667
- continue;
668
- }
669
- }
670
- }
671
- value += ch;
672
- }
673
- parts.push(value);
674
- return parts;
675
- };
676
- var isPlainBranch = (branch) => {
677
- let escaped = false;
678
- for (const ch of branch) {
679
- if (escaped === true) {
680
- escaped = false;
681
- continue;
682
- }
683
- if (ch === "\\") {
684
- escaped = true;
685
- continue;
686
- }
687
- if (/[?*+@!()[\]{}]/.test(ch)) {
688
- return false;
689
- }
690
- }
691
- return true;
692
- };
693
- var normalizeSimpleBranch = (branch) => {
694
- let value = branch.trim();
695
- let changed = true;
696
- while (changed === true) {
697
- changed = false;
698
- if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
699
- value = value.slice(2, -1);
700
- changed = true;
701
- }
702
- }
703
- if (!isPlainBranch(value)) {
704
- return;
705
- }
706
- return value.replace(/\\(.)/g, "$1");
707
- };
708
- var hasRepeatedCharPrefixOverlap = (branches) => {
709
- const values = branches.map(normalizeSimpleBranch).filter(Boolean);
710
- for (let i = 0; i < values.length; i++) {
711
- for (let j = i + 1; j < values.length; j++) {
712
- const a = values[i];
713
- const b = values[j];
714
- const char = a[0];
715
- if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
716
- continue;
717
- }
718
- if (a === b || a.startsWith(b) || b.startsWith(a)) {
719
- return true;
720
- }
721
- }
722
- }
723
- return false;
724
- };
725
- var parseRepeatedExtglob = (pattern, requireEnd = true) => {
726
- if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
727
- return;
728
- }
729
- let bracket = 0;
730
- let paren = 0;
731
- let quote = 0;
732
- let escaped = false;
733
- for (let i = 1; i < pattern.length; i++) {
734
- const ch = pattern[i];
735
- if (escaped === true) {
736
- escaped = false;
737
- continue;
738
- }
739
- if (ch === "\\") {
740
- escaped = true;
741
- continue;
742
- }
743
- if (ch === '"') {
744
- quote = quote === 1 ? 0 : 1;
745
- continue;
746
- }
747
- if (quote === 1) {
748
- continue;
749
- }
750
- if (ch === "[") {
751
- bracket++;
752
- continue;
753
- }
754
- if (ch === "]" && bracket > 0) {
755
- bracket--;
756
- continue;
757
- }
758
- if (bracket > 0) {
759
- continue;
760
- }
761
- if (ch === "(") {
762
- paren++;
763
- continue;
764
- }
765
- if (ch === ")") {
766
- paren--;
767
- if (paren === 0) {
768
- if (requireEnd === true && i !== pattern.length - 1) {
769
- return;
770
- }
771
- return {
772
- type: pattern[0],
773
- body: pattern.slice(2, i),
774
- end: i
775
- };
776
- }
777
- }
778
- }
779
- };
780
- var getStarExtglobSequenceOutput = (pattern) => {
781
- let index = 0;
782
- const chars = [];
783
- while (index < pattern.length) {
784
- const match = parseRepeatedExtglob(pattern.slice(index), false);
785
- if (!match || match.type !== "*") {
786
- return;
787
- }
788
- const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
789
- if (branches.length !== 1) {
790
- return;
791
- }
792
- const branch = normalizeSimpleBranch(branches[0]);
793
- if (!branch || branch.length !== 1) {
794
- return;
795
- }
796
- chars.push(branch);
797
- index += match.end + 1;
798
- }
799
- if (chars.length < 1) {
800
- return;
801
- }
802
- const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
803
- return `${source}*`;
804
- };
805
- var repeatedExtglobRecursion = (pattern) => {
806
- let depth = 0;
807
- let value = pattern.trim();
808
- let match = parseRepeatedExtglob(value);
809
- while (match) {
810
- depth++;
811
- value = match.body.trim();
812
- match = parseRepeatedExtglob(value);
813
- }
814
- return depth;
815
- };
816
- var analyzeRepeatedExtglob = (body, options) => {
817
- if (options.maxExtglobRecursion === false) {
818
- return { risky: false };
819
- }
820
- const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
821
- const branches = splitTopLevel(body).map((branch) => branch.trim());
822
- if (branches.length > 1) {
823
- if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
824
- return { risky: true };
825
- }
826
- }
827
- for (const branch of branches) {
828
- const safeOutput = getStarExtglobSequenceOutput(branch);
829
- if (safeOutput) {
830
- return { risky: true, safeOutput };
831
- }
832
- if (repeatedExtglobRecursion(branch) > max) {
833
- return { risky: true };
834
- }
835
- }
836
- return { risky: false };
837
- };
838
- var parse = (input, options) => {
839
- if (typeof input !== "string") {
840
- throw new TypeError("Expected a string");
841
- }
842
- input = REPLACEMENTS[input] || input;
843
- const opts = { ...options };
844
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
845
- let len = input.length;
846
- if (len > max) {
847
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
848
- }
849
- const bos = { type: "bos", value: "", output: opts.prepend || "" };
850
- const tokens = [bos];
851
- const capture = opts.capture ? "" : "?:";
852
- const PLATFORM_CHARS = constants.globChars(opts.windows);
853
- const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
854
- const {
855
- DOT_LITERAL,
856
- PLUS_LITERAL,
857
- SLASH_LITERAL,
858
- ONE_CHAR,
859
- DOTS_SLASH,
860
- NO_DOT,
861
- NO_DOT_SLASH,
862
- NO_DOTS_SLASH,
863
- QMARK,
864
- QMARK_NO_DOT,
865
- STAR,
866
- START_ANCHOR
867
- } = PLATFORM_CHARS;
868
- const globstar = (opts2) => {
869
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
870
- };
871
- const nodot = opts.dot ? "" : NO_DOT;
872
- const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
873
- let star = opts.bash === true ? globstar(opts) : STAR;
874
- if (opts.capture) {
875
- star = `(${star})`;
876
- }
877
- if (typeof opts.noext === "boolean") {
878
- opts.noextglob = opts.noext;
879
- }
880
- const state = {
881
- input,
882
- index: -1,
883
- start: 0,
884
- dot: opts.dot === true,
885
- consumed: "",
886
- output: "",
887
- prefix: "",
888
- backtrack: false,
889
- negated: false,
890
- brackets: 0,
891
- braces: 0,
892
- parens: 0,
893
- quotes: 0,
894
- globstar: false,
895
- tokens
896
- };
897
- input = utils.removePrefix(input, state);
898
- len = input.length;
899
- const extglobs = [];
900
- const braces = [];
901
- const stack = [];
902
- let prev = bos;
903
- let value;
904
- const eos = () => state.index === len - 1;
905
- const peek = state.peek = (n = 1) => input[state.index + n];
906
- const advance = state.advance = () => input[++state.index] || "";
907
- const remaining = () => input.slice(state.index + 1);
908
- const consume = (value2 = "", num = 0) => {
909
- state.consumed += value2;
910
- state.index += num;
911
- };
912
- const append = (token) => {
913
- state.output += token.output != null ? token.output : token.value;
914
- consume(token.value);
915
- };
916
- const negate = () => {
917
- let count = 1;
918
- while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
919
- advance();
920
- state.start++;
921
- count++;
922
- }
923
- if (count % 2 === 0) {
924
- return false;
925
- }
926
- state.negated = true;
927
- state.start++;
928
- return true;
929
- };
930
- const increment = (type) => {
931
- state[type]++;
932
- stack.push(type);
933
- };
934
- const decrement = (type) => {
935
- state[type]--;
936
- stack.pop();
937
- };
938
- const push = (tok) => {
939
- if (prev.type === "globstar") {
940
- const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
941
- const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
942
- if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
943
- state.output = state.output.slice(0, -prev.output.length);
944
- prev.type = "star";
945
- prev.value = "*";
946
- prev.output = star;
947
- state.output += prev.output;
948
- }
949
- }
950
- if (extglobs.length && tok.type !== "paren") {
951
- extglobs[extglobs.length - 1].inner += tok.value;
952
- }
953
- if (tok.value || tok.output) append(tok);
954
- if (prev && prev.type === "text" && tok.type === "text") {
955
- prev.output = (prev.output || prev.value) + tok.value;
956
- prev.value += tok.value;
957
- return;
958
- }
959
- tok.prev = prev;
960
- tokens.push(tok);
961
- prev = tok;
962
- };
963
- const extglobOpen = (type, value2) => {
964
- const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
965
- token.prev = prev;
966
- token.parens = state.parens;
967
- token.output = state.output;
968
- token.startIndex = state.index;
969
- token.tokensIndex = tokens.length;
970
- const output = (opts.capture ? "(" : "") + token.open;
971
- increment("parens");
972
- push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
973
- push({ type: "paren", extglob: true, value: advance(), output });
974
- extglobs.push(token);
975
- };
976
- const extglobClose = (token) => {
977
- const literal = input.slice(token.startIndex, state.index + 1);
978
- const body = input.slice(token.startIndex + 2, state.index);
979
- const analysis = analyzeRepeatedExtglob(body, opts);
980
- if ((token.type === "plus" || token.type === "star") && analysis.risky) {
981
- const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
982
- const open = tokens[token.tokensIndex];
983
- open.type = "text";
984
- open.value = literal;
985
- open.output = safeOutput || utils.escapeRegex(literal);
986
- for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
987
- tokens[i].value = "";
988
- tokens[i].output = "";
989
- delete tokens[i].suffix;
990
- }
991
- state.output = token.output + open.output;
992
- state.backtrack = true;
993
- push({ type: "paren", extglob: true, value, output: "" });
994
- decrement("parens");
995
- return;
996
- }
997
- let output = token.close + (opts.capture ? ")" : "");
998
- let rest;
999
- if (token.type === "negate") {
1000
- let extglobStar = star;
1001
- if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
1002
- extglobStar = globstar(opts);
1003
- }
1004
- if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
1005
- output = token.close = `)$))${extglobStar}`;
1006
- }
1007
- if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
1008
- const expression = parse(rest, { ...options, fastpaths: false }).output;
1009
- output = token.close = `)${expression})${extglobStar})`;
1010
- }
1011
- if (token.prev.type === "bos") {
1012
- state.negatedExtglob = true;
1013
- }
1014
- }
1015
- push({ type: "paren", extglob: true, value, output });
1016
- decrement("parens");
1017
- };
1018
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
1019
- let backslashes = false;
1020
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
1021
- if (first === "\\") {
1022
- backslashes = true;
1023
- return m;
1024
- }
1025
- if (first === "?") {
1026
- if (esc) {
1027
- return esc + first + (rest ? QMARK.repeat(rest.length) : "");
1028
- }
1029
- if (index === 0) {
1030
- return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
1031
- }
1032
- return QMARK.repeat(chars.length);
1033
- }
1034
- if (first === ".") {
1035
- return DOT_LITERAL.repeat(chars.length);
1036
- }
1037
- if (first === "*") {
1038
- if (esc) {
1039
- return esc + first + (rest ? star : "");
1040
- }
1041
- return star;
1042
- }
1043
- return esc ? m : `\\${m}`;
1044
- });
1045
- if (backslashes === true) {
1046
- if (opts.unescape === true) {
1047
- output = output.replace(/\\/g, "");
1048
- } else {
1049
- output = output.replace(/\\+/g, (m) => {
1050
- return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
1051
- });
1052
- }
1053
- }
1054
- if (output === input && opts.contains === true) {
1055
- state.output = input;
1056
- return state;
1057
- }
1058
- state.output = utils.wrapOutput(output, state, options);
1059
- return state;
1060
- }
1061
- while (!eos()) {
1062
- value = advance();
1063
- if (value === "\0") {
1064
- continue;
1065
- }
1066
- if (value === "\\") {
1067
- const next = peek();
1068
- if (next === "/" && opts.bash !== true) {
1069
- continue;
1070
- }
1071
- if (next === "." || next === ";") {
1072
- continue;
1073
- }
1074
- if (!next) {
1075
- value += "\\";
1076
- push({ type: "text", value });
1077
- continue;
1078
- }
1079
- const match = /^\\+/.exec(remaining());
1080
- let slashes = 0;
1081
- if (match && match[0].length > 2) {
1082
- slashes = match[0].length;
1083
- state.index += slashes;
1084
- if (slashes % 2 !== 0) {
1085
- value += "\\";
1086
- }
1087
- }
1088
- if (opts.unescape === true) {
1089
- value = advance();
1090
- } else {
1091
- value += advance();
1092
- }
1093
- if (state.brackets === 0) {
1094
- push({ type: "text", value });
1095
- continue;
1096
- }
1097
- }
1098
- if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
1099
- if (opts.posix !== false && value === ":") {
1100
- const inner = prev.value.slice(1);
1101
- if (inner.includes("[")) {
1102
- prev.posix = true;
1103
- if (inner.includes(":")) {
1104
- const idx = prev.value.lastIndexOf("[");
1105
- const pre = prev.value.slice(0, idx);
1106
- const rest2 = prev.value.slice(idx + 2);
1107
- const posix = POSIX_REGEX_SOURCE[rest2];
1108
- if (posix) {
1109
- prev.value = pre + posix;
1110
- state.backtrack = true;
1111
- advance();
1112
- if (!bos.output && tokens.indexOf(prev) === 1) {
1113
- bos.output = ONE_CHAR;
1114
- }
1115
- continue;
1116
- }
1117
- }
1118
- }
1119
- }
1120
- if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
1121
- value = `\\${value}`;
1122
- }
1123
- if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
1124
- value = `\\${value}`;
1125
- }
1126
- if (opts.posix === true && value === "!" && prev.value === "[") {
1127
- value = "^";
1128
- }
1129
- prev.value += value;
1130
- append({ value });
1131
- continue;
1132
- }
1133
- if (state.quotes === 1 && value !== '"') {
1134
- value = utils.escapeRegex(value);
1135
- prev.value += value;
1136
- append({ value });
1137
- continue;
1138
- }
1139
- if (value === '"') {
1140
- state.quotes = state.quotes === 1 ? 0 : 1;
1141
- if (opts.keepQuotes === true) {
1142
- push({ type: "text", value });
1143
- }
1144
- continue;
1145
- }
1146
- if (value === "(") {
1147
- increment("parens");
1148
- push({ type: "paren", value });
1149
- continue;
1150
- }
1151
- if (value === ")") {
1152
- if (state.parens === 0 && opts.strictBrackets === true) {
1153
- throw new SyntaxError(syntaxError("opening", "("));
1154
- }
1155
- const extglob = extglobs[extglobs.length - 1];
1156
- if (extglob && state.parens === extglob.parens + 1) {
1157
- extglobClose(extglobs.pop());
1158
- continue;
1159
- }
1160
- push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
1161
- decrement("parens");
1162
- continue;
1163
- }
1164
- if (value === "[") {
1165
- if (opts.nobracket === true || !remaining().includes("]")) {
1166
- if (opts.nobracket !== true && opts.strictBrackets === true) {
1167
- throw new SyntaxError(syntaxError("closing", "]"));
1168
- }
1169
- value = `\\${value}`;
1170
- } else {
1171
- increment("brackets");
1172
- }
1173
- push({ type: "bracket", value });
1174
- continue;
1175
- }
1176
- if (value === "]") {
1177
- if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
1178
- push({ type: "text", value, output: `\\${value}` });
1179
- continue;
1180
- }
1181
- if (state.brackets === 0) {
1182
- if (opts.strictBrackets === true) {
1183
- throw new SyntaxError(syntaxError("opening", "["));
1184
- }
1185
- push({ type: "text", value, output: `\\${value}` });
1186
- continue;
1187
- }
1188
- decrement("brackets");
1189
- const prevValue = prev.value.slice(1);
1190
- if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
1191
- value = `/${value}`;
1192
- }
1193
- prev.value += value;
1194
- append({ value });
1195
- if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
1196
- continue;
1197
- }
1198
- const escaped = utils.escapeRegex(prev.value);
1199
- state.output = state.output.slice(0, -prev.value.length);
1200
- if (opts.literalBrackets === true) {
1201
- state.output += escaped;
1202
- prev.value = escaped;
1203
- continue;
1204
- }
1205
- prev.value = `(${capture}${escaped}|${prev.value})`;
1206
- state.output += prev.value;
1207
- continue;
1208
- }
1209
- if (value === "{" && opts.nobrace !== true) {
1210
- increment("braces");
1211
- const open = {
1212
- type: "brace",
1213
- value,
1214
- output: "(",
1215
- outputIndex: state.output.length,
1216
- tokensIndex: state.tokens.length
1217
- };
1218
- braces.push(open);
1219
- push(open);
1220
- continue;
1221
- }
1222
- if (value === "}") {
1223
- const brace = braces[braces.length - 1];
1224
- if (opts.nobrace === true || !brace) {
1225
- push({ type: "text", value, output: value });
1226
- continue;
1227
- }
1228
- let output = ")";
1229
- if (brace.dots === true) {
1230
- const arr = tokens.slice();
1231
- const range = [];
1232
- for (let i = arr.length - 1; i >= 0; i--) {
1233
- tokens.pop();
1234
- if (arr[i].type === "brace") {
1235
- break;
1236
- }
1237
- if (arr[i].type !== "dots") {
1238
- range.unshift(arr[i].value);
1239
- }
1240
- }
1241
- output = expandRange(range, opts);
1242
- state.backtrack = true;
1243
- }
1244
- if (brace.comma !== true && brace.dots !== true) {
1245
- const out = state.output.slice(0, brace.outputIndex);
1246
- const toks = state.tokens.slice(brace.tokensIndex);
1247
- brace.value = brace.output = "\\{";
1248
- value = output = "\\}";
1249
- state.output = out;
1250
- for (const t of toks) {
1251
- state.output += t.output || t.value;
1252
- }
1253
- }
1254
- push({ type: "brace", value, output });
1255
- decrement("braces");
1256
- braces.pop();
1257
- continue;
1258
- }
1259
- if (value === "|") {
1260
- if (extglobs.length > 0) {
1261
- extglobs[extglobs.length - 1].conditions++;
1262
- }
1263
- push({ type: "text", value });
1264
- continue;
1265
- }
1266
- if (value === ",") {
1267
- let output = value;
1268
- const brace = braces[braces.length - 1];
1269
- if (brace && stack[stack.length - 1] === "braces") {
1270
- brace.comma = true;
1271
- output = "|";
1272
- }
1273
- push({ type: "comma", value, output });
1274
- continue;
1275
- }
1276
- if (value === "/") {
1277
- if (prev.type === "dot" && state.index === state.start + 1) {
1278
- state.start = state.index + 1;
1279
- state.consumed = "";
1280
- state.output = "";
1281
- tokens.pop();
1282
- prev = bos;
1283
- continue;
1284
- }
1285
- push({ type: "slash", value, output: SLASH_LITERAL });
1286
- continue;
1287
- }
1288
- if (value === ".") {
1289
- if (state.braces > 0 && prev.type === "dot") {
1290
- if (prev.value === ".") prev.output = DOT_LITERAL;
1291
- const brace = braces[braces.length - 1];
1292
- prev.type = "dots";
1293
- prev.output += value;
1294
- prev.value += value;
1295
- brace.dots = true;
1296
- continue;
1297
- }
1298
- if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1299
- push({ type: "text", value, output: DOT_LITERAL });
1300
- continue;
1301
- }
1302
- push({ type: "dot", value, output: DOT_LITERAL });
1303
- continue;
1304
- }
1305
- if (value === "?") {
1306
- const isGroup = prev && prev.value === "(";
1307
- if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1308
- extglobOpen("qmark", value);
1309
- continue;
1310
- }
1311
- if (prev && prev.type === "paren") {
1312
- const next = peek();
1313
- let output = value;
1314
- if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
1315
- output = `\\${value}`;
1316
- }
1317
- push({ type: "text", value, output });
1318
- continue;
1319
- }
1320
- if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1321
- push({ type: "qmark", value, output: QMARK_NO_DOT });
1322
- continue;
1323
- }
1324
- push({ type: "qmark", value, output: QMARK });
1325
- continue;
1326
- }
1327
- if (value === "!") {
1328
- if (opts.noextglob !== true && peek() === "(") {
1329
- if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1330
- extglobOpen("negate", value);
1331
- continue;
1332
- }
1333
- }
1334
- if (opts.nonegate !== true && state.index === 0) {
1335
- negate();
1336
- continue;
1337
- }
1338
- }
1339
- if (value === "+") {
1340
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1341
- extglobOpen("plus", value);
1342
- continue;
1343
- }
1344
- if (prev && prev.value === "(" || opts.regex === false) {
1345
- push({ type: "plus", value, output: PLUS_LITERAL });
1346
- continue;
1347
- }
1348
- if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1349
- push({ type: "plus", value });
1350
- continue;
1351
- }
1352
- push({ type: "plus", value: PLUS_LITERAL });
1353
- continue;
1354
- }
1355
- if (value === "@") {
1356
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1357
- push({ type: "at", extglob: true, value, output: "" });
1358
- continue;
1359
- }
1360
- push({ type: "text", value });
1361
- continue;
1362
- }
1363
- if (value !== "*") {
1364
- if (value === "$" || value === "^") {
1365
- value = `\\${value}`;
1366
- }
1367
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1368
- if (match) {
1369
- value += match[0];
1370
- state.index += match[0].length;
1371
- }
1372
- push({ type: "text", value });
1373
- continue;
1374
- }
1375
- if (prev && (prev.type === "globstar" || prev.star === true)) {
1376
- prev.type = "star";
1377
- prev.star = true;
1378
- prev.value += value;
1379
- prev.output = star;
1380
- state.backtrack = true;
1381
- state.globstar = true;
1382
- consume(value);
1383
- continue;
1384
- }
1385
- let rest = remaining();
1386
- if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1387
- extglobOpen("star", value);
1388
- continue;
1389
- }
1390
- if (prev.type === "star") {
1391
- if (opts.noglobstar === true) {
1392
- consume(value);
1393
- continue;
1394
- }
1395
- const prior = prev.prev;
1396
- const before = prior.prev;
1397
- const isStart = prior.type === "slash" || prior.type === "bos";
1398
- const afterStar = before && (before.type === "star" || before.type === "globstar");
1399
- if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1400
- push({ type: "star", value, output: "" });
1401
- continue;
1402
- }
1403
- const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1404
- const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1405
- if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1406
- push({ type: "star", value, output: "" });
1407
- continue;
1408
- }
1409
- while (rest.slice(0, 3) === "/**") {
1410
- const after = input[state.index + 4];
1411
- if (after && after !== "/") {
1412
- break;
1413
- }
1414
- rest = rest.slice(3);
1415
- consume("/**", 3);
1416
- }
1417
- if (prior.type === "bos" && eos()) {
1418
- prev.type = "globstar";
1419
- prev.value += value;
1420
- prev.output = globstar(opts);
1421
- state.output = prev.output;
1422
- state.globstar = true;
1423
- consume(value);
1424
- continue;
1425
- }
1426
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
1427
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
1428
- prior.output = `(?:${prior.output}`;
1429
- prev.type = "globstar";
1430
- prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1431
- prev.value += value;
1432
- state.globstar = true;
1433
- state.output += prior.output + prev.output;
1434
- consume(value);
1435
- continue;
1436
- }
1437
- if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1438
- const end = rest[1] !== void 0 ? "|$" : "";
1439
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
1440
- prior.output = `(?:${prior.output}`;
1441
- prev.type = "globstar";
1442
- prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1443
- prev.value += value;
1444
- state.output += prior.output + prev.output;
1445
- state.globstar = true;
1446
- consume(value + advance());
1447
- push({ type: "slash", value: "/", output: "" });
1448
- continue;
1449
- }
1450
- if (prior.type === "bos" && rest[0] === "/") {
1451
- prev.type = "globstar";
1452
- prev.value += value;
1453
- prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1454
- state.output = prev.output;
1455
- state.globstar = true;
1456
- consume(value + advance());
1457
- push({ type: "slash", value: "/", output: "" });
1458
- continue;
1459
- }
1460
- state.output = state.output.slice(0, -prev.output.length);
1461
- prev.type = "globstar";
1462
- prev.output = globstar(opts);
1463
- prev.value += value;
1464
- state.output += prev.output;
1465
- state.globstar = true;
1466
- consume(value);
1467
- continue;
1468
- }
1469
- const token = { type: "star", value, output: star };
1470
- if (opts.bash === true) {
1471
- token.output = ".*?";
1472
- if (prev.type === "bos" || prev.type === "slash") {
1473
- token.output = nodot + token.output;
1474
- }
1475
- push(token);
1476
- continue;
1477
- }
1478
- if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1479
- token.output = value;
1480
- push(token);
1481
- continue;
1482
- }
1483
- if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1484
- if (prev.type === "dot") {
1485
- state.output += NO_DOT_SLASH;
1486
- prev.output += NO_DOT_SLASH;
1487
- } else if (opts.dot === true) {
1488
- state.output += NO_DOTS_SLASH;
1489
- prev.output += NO_DOTS_SLASH;
1490
- } else {
1491
- state.output += nodot;
1492
- prev.output += nodot;
1493
- }
1494
- if (peek() !== "*") {
1495
- state.output += ONE_CHAR;
1496
- prev.output += ONE_CHAR;
1497
- }
1498
- }
1499
- push(token);
1500
- }
1501
- while (state.brackets > 0) {
1502
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1503
- state.output = utils.escapeLast(state.output, "[");
1504
- decrement("brackets");
1505
- }
1506
- while (state.parens > 0) {
1507
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
1508
- state.output = utils.escapeLast(state.output, "(");
1509
- decrement("parens");
1510
- }
1511
- while (state.braces > 0) {
1512
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
1513
- state.output = utils.escapeLast(state.output, "{");
1514
- decrement("braces");
1515
- }
1516
- if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
1517
- push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
1518
- }
1519
- if (state.backtrack === true) {
1520
- state.output = "";
1521
- for (const token of state.tokens) {
1522
- state.output += token.output != null ? token.output : token.value;
1523
- if (token.suffix) {
1524
- state.output += token.suffix;
1525
- }
1526
- }
1527
- }
1528
- return state;
1529
- };
1530
- parse.fastpaths = (input, options) => {
1531
- const opts = { ...options };
1532
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1533
- const len = input.length;
1534
- if (len > max) {
1535
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1536
- }
1537
- input = REPLACEMENTS[input] || input;
1538
- const {
1539
- DOT_LITERAL,
1540
- SLASH_LITERAL,
1541
- ONE_CHAR,
1542
- DOTS_SLASH,
1543
- NO_DOT,
1544
- NO_DOTS,
1545
- NO_DOTS_SLASH,
1546
- STAR,
1547
- START_ANCHOR
1548
- } = constants.globChars(opts.windows);
1549
- const nodot = opts.dot ? NO_DOTS : NO_DOT;
1550
- const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1551
- const capture = opts.capture ? "" : "?:";
1552
- const state = { negated: false, prefix: "" };
1553
- let star = opts.bash === true ? ".*?" : STAR;
1554
- if (opts.capture) {
1555
- star = `(${star})`;
1556
- }
1557
- const globstar = (opts2) => {
1558
- if (opts2.noglobstar === true) return star;
1559
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1560
- };
1561
- const create = (str) => {
1562
- switch (str) {
1563
- case "*":
1564
- return `${nodot}${ONE_CHAR}${star}`;
1565
- case ".*":
1566
- return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1567
- case "*.*":
1568
- return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1569
- case "*/*":
1570
- return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1571
- case "**":
1572
- return nodot + globstar(opts);
1573
- case "**/*":
1574
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1575
- case "**/*.*":
1576
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1577
- case "**/.*":
1578
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1579
- default: {
1580
- const match = /^(.*?)\.(\w+)$/.exec(str);
1581
- if (!match) return;
1582
- const source2 = create(match[1]);
1583
- if (!source2) return;
1584
- return source2 + DOT_LITERAL + match[2];
1585
- }
1586
- }
1587
- };
1588
- const output = utils.removePrefix(input, state);
1589
- let source = create(output);
1590
- if (source && opts.strictSlashes !== true) {
1591
- source += `${SLASH_LITERAL}?`;
1592
- }
1593
- return source;
1594
- };
1595
- module.exports = parse;
1596
- }
1597
- });
1598
-
1599
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
1600
- var require_picomatch = __commonJS({
1601
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js"(exports, module) {
1602
- "use strict";
1603
- var scan = require_scan();
1604
- var parse = require_parse();
1605
- var utils = require_utils();
1606
- var constants = require_constants();
1607
- var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
1608
- var picomatch3 = (glob, options, returnState = false) => {
1609
- if (Array.isArray(glob)) {
1610
- const fns = glob.map((input) => picomatch3(input, options, returnState));
1611
- const arrayMatcher = (str) => {
1612
- for (const isMatch of fns) {
1613
- const state2 = isMatch(str);
1614
- if (state2) return state2;
1615
- }
1616
- return false;
1617
- };
1618
- return arrayMatcher;
1619
- }
1620
- const isState = isObject(glob) && glob.tokens && glob.input;
1621
- if (glob === "" || typeof glob !== "string" && !isState) {
1622
- throw new TypeError("Expected pattern to be a non-empty string");
1623
- }
1624
- const opts = options || {};
1625
- const posix = opts.windows;
1626
- const regex = isState ? picomatch3.compileRe(glob, options) : picomatch3.makeRe(glob, options, false, true);
1627
- const state = regex.state;
1628
- delete regex.state;
1629
- let isIgnored = () => false;
1630
- if (opts.ignore) {
1631
- const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
1632
- isIgnored = picomatch3(opts.ignore, ignoreOpts, returnState);
1633
- }
1634
- const matcher = (input, returnObject = false) => {
1635
- const { isMatch, match, output } = picomatch3.test(input, regex, options, { glob, posix });
1636
- const result = { glob, state, regex, posix, input, output, match, isMatch };
1637
- if (typeof opts.onResult === "function") {
1638
- opts.onResult(result);
1639
- }
1640
- if (isMatch === false) {
1641
- result.isMatch = false;
1642
- return returnObject ? result : false;
1643
- }
1644
- if (isIgnored(input)) {
1645
- if (typeof opts.onIgnore === "function") {
1646
- opts.onIgnore(result);
1647
- }
1648
- result.isMatch = false;
1649
- return returnObject ? result : false;
1650
- }
1651
- if (typeof opts.onMatch === "function") {
1652
- opts.onMatch(result);
1653
- }
1654
- return returnObject ? result : true;
1655
- };
1656
- if (returnState) {
1657
- matcher.state = state;
1658
- }
1659
- return matcher;
1660
- };
1661
- picomatch3.test = (input, regex, options, { glob, posix } = {}) => {
1662
- if (typeof input !== "string") {
1663
- throw new TypeError("Expected input to be a string");
1664
- }
1665
- if (input === "") {
1666
- return { isMatch: false, output: "" };
1667
- }
1668
- const opts = options || {};
1669
- const format = opts.format || (posix ? utils.toPosixSlashes : null);
1670
- let match = input === glob;
1671
- let output = match && format ? format(input) : input;
1672
- if (match === false) {
1673
- output = format ? format(input) : input;
1674
- match = output === glob;
1675
- }
1676
- if (match === false || opts.capture === true) {
1677
- if (opts.matchBase === true || opts.basename === true) {
1678
- match = picomatch3.matchBase(input, regex, options, posix);
1679
- } else {
1680
- match = regex.exec(output);
1681
- }
1682
- }
1683
- return { isMatch: Boolean(match), match, output };
1684
- };
1685
- picomatch3.matchBase = (input, glob, options) => {
1686
- const regex = glob instanceof RegExp ? glob : picomatch3.makeRe(glob, options);
1687
- return regex.test(utils.basename(input));
1688
- };
1689
- picomatch3.isMatch = (str, patterns, options) => picomatch3(patterns, options)(str);
1690
- picomatch3.parse = (pattern, options) => {
1691
- if (Array.isArray(pattern)) return pattern.map((p) => picomatch3.parse(p, options));
1692
- return parse(pattern, { ...options, fastpaths: false });
1693
- };
1694
- picomatch3.scan = (input, options) => scan(input, options);
1695
- picomatch3.compileRe = (state, options, returnOutput = false, returnState = false) => {
1696
- if (returnOutput === true) {
1697
- return state.output;
1698
- }
1699
- const opts = options || {};
1700
- const prepend = opts.contains ? "" : "^";
1701
- const append = opts.contains ? "" : "$";
1702
- let source = `${prepend}(?:${state.output})${append}`;
1703
- if (state && state.negated === true) {
1704
- source = `^(?!${source}).*$`;
1705
- }
1706
- const regex = picomatch3.toRegex(source, options);
1707
- if (returnState === true) {
1708
- regex.state = state;
1709
- }
1710
- return regex;
1711
- };
1712
- picomatch3.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1713
- if (!input || typeof input !== "string") {
1714
- throw new TypeError("Expected a non-empty string");
1715
- }
1716
- let parsed = { negated: false, fastpaths: true };
1717
- if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
1718
- parsed.output = parse.fastpaths(input, options);
1719
- }
1720
- if (!parsed.output) {
1721
- parsed = parse(input, options);
1722
- }
1723
- return picomatch3.compileRe(parsed, options, returnOutput, returnState);
1724
- };
1725
- picomatch3.toRegex = (source, options) => {
1726
- try {
1727
- const opts = options || {};
1728
- return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1729
- } catch (err) {
1730
- if (options && options.debug === true) throw err;
1731
- return /$^/;
1732
- }
1733
- };
1734
- picomatch3.constants = constants;
1735
- module.exports = picomatch3;
1736
- }
1737
- });
1738
-
1739
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
1740
- var require_picomatch2 = __commonJS({
1741
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js"(exports, module) {
1742
- "use strict";
1743
- var pico = require_picomatch();
1744
- var utils = require_utils();
1745
- function picomatch3(glob, options, returnState = false) {
1746
- if (options && (options.windows === null || options.windows === void 0)) {
1747
- options = { ...options, windows: utils.isWindows() };
1748
- }
1749
- return pico(glob, options, returnState);
1750
- }
1751
- Object.assign(picomatch3, pico);
1752
- module.exports = picomatch3;
1753
- }
1754
- });
1755
-
1756
1
  // ../../packages/core/dist/index.js
1757
- var import_picomatch = __toESM(require_picomatch2(), 1);
1758
- var import_picomatch2 = __toESM(require_picomatch2(), 1);
1759
2
  import { relative as relative2 } from "path";
1760
3
  import { readFileSync, readdirSync, statSync, existsSync } from "fs";
1761
4
  import { join, extname } from "path";
@@ -1787,6 +30,7 @@ import { readdirSync as readdirSync8, statSync as statSync7, readFileSync as rea
1787
30
  import { join as join13 } from "path";
1788
31
  import { readdirSync as readdirSync9, statSync as statSync8 } from "fs";
1789
32
  import { join as join14, extname as extname3 } from "path";
33
+ import picomatch from "picomatch";
1790
34
  import { readFileSync as readFileSync13, readdirSync as readdirSync10, statSync as statSync9, existsSync as existsSync9 } from "fs";
1791
35
  import { join as join15, extname as extname5 } from "path";
1792
36
  import { basename, extname as extname4 } from "path";
@@ -1849,6 +93,7 @@ import { execa as execa13 } from "execa";
1849
93
  import { existsSync as existsSync25, readFileSync as readFileSync30 } from "fs";
1850
94
  import { join as join37, resolve as resolve2 } from "path";
1851
95
  import { globby as globby2 } from "globby";
96
+ import picomatch2 from "picomatch";
1852
97
  import { execa as execa14 } from "execa";
1853
98
  var BaseAdvisor = class {
1854
99
  isApplicableToContext(context) {
@@ -3403,7 +1648,7 @@ function findComponentFiles3(dir, projectRoot, isRoot = true) {
3403
1648
  }
3404
1649
  function createExcludeFilter(patterns) {
3405
1650
  if (patterns.length === 0) return () => false;
3406
- const isMatch = (0, import_picomatch.default)(patterns);
1651
+ const isMatch = picomatch(patterns);
3407
1652
  return (filePath) => isMatch(filePath);
3408
1653
  }
3409
1654
  var ASSET_DIRS = ["public", "src/assets", "static", "assets"];
@@ -6964,7 +5209,7 @@ function recalcScoreAfterSuppression(result, originalIssues) {
6964
5209
  function applySuppression(issues, rules) {
6965
5210
  if (rules.length === 0) return { issues, suppressedCount: 0 };
6966
5211
  const compiled = rules.map((rule) => ({
6967
- pathMatch: rule.path ? (0, import_picomatch2.default)(rule.path) : null,
5212
+ pathMatch: rule.path ? picomatch2(rule.path) : null,
6968
5213
  match: rule.match?.toLowerCase() ?? null
6969
5214
  }));
6970
5215
  let suppressedCount = 0;