@socketsecurity/lib 5.2.1 → 5.4.0

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 (60) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/bin.d.ts +0 -9
  3. package/dist/bin.js +70 -48
  4. package/dist/constants/agents.js +2 -2
  5. package/dist/constants/platform.d.ts +21 -0
  6. package/dist/constants/platform.js +30 -6
  7. package/dist/cover/code.js +13 -5
  8. package/dist/debug.js +1 -1
  9. package/dist/dlx/binary.d.ts +1 -1
  10. package/dist/dlx/binary.js +49 -39
  11. package/dist/dlx/cache.js +10 -2
  12. package/dist/dlx/dir.js +1 -1
  13. package/dist/dlx/manifest.d.ts +2 -1
  14. package/dist/dlx/manifest.js +45 -41
  15. package/dist/dlx/package.js +39 -19
  16. package/dist/dlx/packages.js +1 -1
  17. package/dist/dlx/paths.js +1 -1
  18. package/dist/env/rewire.js +10 -2
  19. package/dist/external/@inquirer/checkbox.js +4 -2528
  20. package/dist/external/@inquirer/confirm.js +4 -2371
  21. package/dist/external/@inquirer/input.js +4 -2395
  22. package/dist/external/@inquirer/password.js +4 -2503
  23. package/dist/external/@inquirer/search.js +4 -2500
  24. package/dist/external/@inquirer/select.js +4 -2617
  25. package/dist/external/del.js +4 -7139
  26. package/dist/external/fast-glob.js +4 -5776
  27. package/dist/external/inquirer-pack.js +4610 -0
  28. package/dist/external/npm-core.js +3 -1
  29. package/dist/external/pico-pack.js +7162 -0
  30. package/dist/external/picomatch.js +4 -1523
  31. package/dist/external/spdx-correct.js +4 -1384
  32. package/dist/external/spdx-expression-parse.js +4 -1047
  33. package/dist/external/spdx-pack.js +1640 -0
  34. package/dist/external/validate-npm-package-name.js +4 -104
  35. package/dist/fs.js +3 -3
  36. package/dist/git.js +41 -38
  37. package/dist/http-request.js +12 -4
  38. package/dist/ipc.js +53 -29
  39. package/dist/json/edit.js +1 -1
  40. package/dist/json/format.js +1 -1
  41. package/dist/logger.js +1 -1
  42. package/dist/packages/edit.js +3 -3
  43. package/dist/packages/isolation.js +45 -23
  44. package/dist/packages/licenses.js +10 -2
  45. package/dist/paths/normalize.js +3 -3
  46. package/dist/paths/packages.js +1 -1
  47. package/dist/paths/socket.d.ts +2 -2
  48. package/dist/paths/socket.js +27 -21
  49. package/dist/process-lock.js +23 -14
  50. package/dist/promises.js +1 -1
  51. package/dist/releases/github.d.ts +82 -137
  52. package/dist/releases/github.js +91 -48
  53. package/dist/releases/socket-btm.d.ts +78 -192
  54. package/dist/releases/socket-btm.js +112 -50
  55. package/dist/signal-exit.js +1 -1
  56. package/dist/spawn.js +11 -4
  57. package/dist/stdio/mask.d.ts +6 -21
  58. package/dist/stdio/mask.js +18 -14
  59. package/dist/themes/context.js +10 -2
  60. package/package.json +3 -2
@@ -1,1525 +1,6 @@
1
- "use strict";
2
- /**
3
- * Bundled from picomatch
4
- * This is a zero-dependency bundle created by esbuild.
5
- */
6
- "use strict";
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropNames = Object.getOwnPropertyNames;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __commonJS = (cb, mod) => function __require() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
1
+ 'use strict'
13
2
 
14
- // node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
15
- var require_constants = __commonJS({
16
- "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports2, module2) {
17
- "use strict";
18
- var path = require("path");
19
- var WIN_SLASH = "\\\\/";
20
- var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
21
- var DOT_LITERAL = "\\.";
22
- var PLUS_LITERAL = "\\+";
23
- var QMARK_LITERAL = "\\?";
24
- var SLASH_LITERAL = "\\/";
25
- var ONE_CHAR = "(?=.)";
26
- var QMARK = "[^/]";
27
- var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
28
- var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
29
- var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
30
- var NO_DOT = `(?!${DOT_LITERAL})`;
31
- var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
32
- var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
33
- var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
34
- var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
35
- var STAR = `${QMARK}*?`;
36
- var POSIX_CHARS = {
37
- DOT_LITERAL,
38
- PLUS_LITERAL,
39
- QMARK_LITERAL,
40
- SLASH_LITERAL,
41
- ONE_CHAR,
42
- QMARK,
43
- END_ANCHOR,
44
- DOTS_SLASH,
45
- NO_DOT,
46
- NO_DOTS,
47
- NO_DOT_SLASH,
48
- NO_DOTS_SLASH,
49
- QMARK_NO_DOT,
50
- STAR,
51
- START_ANCHOR
52
- };
53
- var WINDOWS_CHARS = {
54
- ...POSIX_CHARS,
55
- SLASH_LITERAL: `[${WIN_SLASH}]`,
56
- QMARK: WIN_NO_SLASH,
57
- STAR: `${WIN_NO_SLASH}*?`,
58
- DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
59
- NO_DOT: `(?!${DOT_LITERAL})`,
60
- NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
61
- NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
62
- NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
63
- QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
64
- START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
65
- END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
66
- };
67
- var POSIX_REGEX_SOURCE = {
68
- alnum: "a-zA-Z0-9",
69
- alpha: "a-zA-Z",
70
- ascii: "\\x00-\\x7F",
71
- blank: " \\t",
72
- cntrl: "\\x00-\\x1F\\x7F",
73
- digit: "0-9",
74
- graph: "\\x21-\\x7E",
75
- lower: "a-z",
76
- print: "\\x20-\\x7E ",
77
- punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
78
- space: " \\t\\r\\n\\v\\f",
79
- upper: "A-Z",
80
- word: "A-Za-z0-9_",
81
- xdigit: "A-Fa-f0-9"
82
- };
83
- module2.exports = {
84
- MAX_LENGTH: 1024 * 64,
85
- POSIX_REGEX_SOURCE,
86
- // regular expressions
87
- REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
88
- REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
89
- REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
90
- REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
91
- REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
92
- REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
93
- // Replace globs with equivalent patterns to reduce parsing time.
94
- REPLACEMENTS: {
95
- "***": "*",
96
- "**/**": "**",
97
- "**/**/**": "**"
98
- },
99
- // Digits
100
- CHAR_0: 48,
101
- /* 0 */
102
- CHAR_9: 57,
103
- /* 9 */
104
- // Alphabet chars.
105
- CHAR_UPPERCASE_A: 65,
106
- /* A */
107
- CHAR_LOWERCASE_A: 97,
108
- /* a */
109
- CHAR_UPPERCASE_Z: 90,
110
- /* Z */
111
- CHAR_LOWERCASE_Z: 122,
112
- /* z */
113
- CHAR_LEFT_PARENTHESES: 40,
114
- /* ( */
115
- CHAR_RIGHT_PARENTHESES: 41,
116
- /* ) */
117
- CHAR_ASTERISK: 42,
118
- /* * */
119
- // Non-alphabetic chars.
120
- CHAR_AMPERSAND: 38,
121
- /* & */
122
- CHAR_AT: 64,
123
- /* @ */
124
- CHAR_BACKWARD_SLASH: 92,
125
- /* \ */
126
- CHAR_CARRIAGE_RETURN: 13,
127
- /* \r */
128
- CHAR_CIRCUMFLEX_ACCENT: 94,
129
- /* ^ */
130
- CHAR_COLON: 58,
131
- /* : */
132
- CHAR_COMMA: 44,
133
- /* , */
134
- CHAR_DOT: 46,
135
- /* . */
136
- CHAR_DOUBLE_QUOTE: 34,
137
- /* " */
138
- CHAR_EQUAL: 61,
139
- /* = */
140
- CHAR_EXCLAMATION_MARK: 33,
141
- /* ! */
142
- CHAR_FORM_FEED: 12,
143
- /* \f */
144
- CHAR_FORWARD_SLASH: 47,
145
- /* / */
146
- CHAR_GRAVE_ACCENT: 96,
147
- /* ` */
148
- CHAR_HASH: 35,
149
- /* # */
150
- CHAR_HYPHEN_MINUS: 45,
151
- /* - */
152
- CHAR_LEFT_ANGLE_BRACKET: 60,
153
- /* < */
154
- CHAR_LEFT_CURLY_BRACE: 123,
155
- /* { */
156
- CHAR_LEFT_SQUARE_BRACKET: 91,
157
- /* [ */
158
- CHAR_LINE_FEED: 10,
159
- /* \n */
160
- CHAR_NO_BREAK_SPACE: 160,
161
- /* \u00A0 */
162
- CHAR_PERCENT: 37,
163
- /* % */
164
- CHAR_PLUS: 43,
165
- /* + */
166
- CHAR_QUESTION_MARK: 63,
167
- /* ? */
168
- CHAR_RIGHT_ANGLE_BRACKET: 62,
169
- /* > */
170
- CHAR_RIGHT_CURLY_BRACE: 125,
171
- /* } */
172
- CHAR_RIGHT_SQUARE_BRACKET: 93,
173
- /* ] */
174
- CHAR_SEMICOLON: 59,
175
- /* ; */
176
- CHAR_SINGLE_QUOTE: 39,
177
- /* ' */
178
- CHAR_SPACE: 32,
179
- /* */
180
- CHAR_TAB: 9,
181
- /* \t */
182
- CHAR_UNDERSCORE: 95,
183
- /* _ */
184
- CHAR_VERTICAL_LINE: 124,
185
- /* | */
186
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
187
- /* \uFEFF */
188
- SEP: path.sep,
189
- /**
190
- * Create EXTGLOB_CHARS
191
- */
192
- extglobChars(chars) {
193
- return {
194
- "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
195
- "?": { type: "qmark", open: "(?:", close: ")?" },
196
- "+": { type: "plus", open: "(?:", close: ")+" },
197
- "*": { type: "star", open: "(?:", close: ")*" },
198
- "@": { type: "at", open: "(?:", close: ")" }
199
- };
200
- },
201
- /**
202
- * Create GLOB_CHARS
203
- */
204
- globChars(win32) {
205
- return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
206
- }
207
- };
208
- }
209
- });
3
+ // Re-export from pico-pack bundle.
4
+ const { picomatch } = require('./pico-pack.js')
210
5
 
211
- // node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
212
- var require_utils = __commonJS({
213
- "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports2) {
214
- "use strict";
215
- var path = require("path");
216
- var win32 = process.platform === "win32";
217
- var {
218
- REGEX_BACKSLASH,
219
- REGEX_REMOVE_BACKSLASH,
220
- REGEX_SPECIAL_CHARS,
221
- REGEX_SPECIAL_CHARS_GLOBAL
222
- } = require_constants();
223
- exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
224
- exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
225
- exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
226
- exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
227
- exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
228
- exports2.removeBackslashes = (str) => {
229
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
230
- return match === "\\" ? "" : match;
231
- });
232
- };
233
- exports2.supportsLookbehinds = () => {
234
- const segs = process.version.slice(1).split(".").map(Number);
235
- if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
236
- return true;
237
- }
238
- return false;
239
- };
240
- exports2.isWindows = (options) => {
241
- if (options && typeof options.windows === "boolean") {
242
- return options.windows;
243
- }
244
- return win32 === true || path.sep === "\\";
245
- };
246
- exports2.escapeLast = (input, char, lastIdx) => {
247
- const idx = input.lastIndexOf(char, lastIdx);
248
- if (idx === -1) return input;
249
- if (input[idx - 1] === "\\") return exports2.escapeLast(input, char, idx - 1);
250
- return `${input.slice(0, idx)}\\${input.slice(idx)}`;
251
- };
252
- exports2.removePrefix = (input, state = {}) => {
253
- let output = input;
254
- if (output.startsWith("./")) {
255
- output = output.slice(2);
256
- state.prefix = "./";
257
- }
258
- return output;
259
- };
260
- exports2.wrapOutput = (input, state = {}, options = {}) => {
261
- const prepend = options.contains ? "" : "^";
262
- const append = options.contains ? "" : "$";
263
- let output = `${prepend}(?:${input})${append}`;
264
- if (state.negated === true) {
265
- output = `(?:^(?!${output}).*$)`;
266
- }
267
- return output;
268
- };
269
- }
270
- });
271
-
272
- // node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js
273
- var require_scan = __commonJS({
274
- "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports2, module2) {
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 = /* @__PURE__ */ __name((code) => {
310
- return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
311
- }, "isPathSeparator");
312
- var depth = /* @__PURE__ */ __name((token) => {
313
- if (token.isPrefix !== true) {
314
- token.depth = token.isGlobstar ? Infinity : 1;
315
- }
316
- }, "depth");
317
- var scan = /* @__PURE__ */ __name((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 = /* @__PURE__ */ __name(() => index >= length, "eos");
343
- const peek = /* @__PURE__ */ __name(() => str.charCodeAt(index + 1), "peek");
344
- const advance = /* @__PURE__ */ __name(() => {
345
- prev = code;
346
- return str.charCodeAt(++index);
347
- }, "advance");
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
- }, "scan");
598
- module2.exports = scan;
599
- }
600
- });
601
-
602
- // node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
603
- var require_parse = __commonJS({
604
- "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports2, module2) {
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 = /* @__PURE__ */ __name((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
- }, "expandRange");
628
- var syntaxError = /* @__PURE__ */ __name((type, char) => {
629
- return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
630
- }, "syntaxError");
631
- var parse = /* @__PURE__ */ __name((input, options) => {
632
- if (typeof input !== "string") {
633
- throw new TypeError("Expected a string");
634
- }
635
- input = REPLACEMENTS[input] || input;
636
- const opts = { ...options };
637
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
638
- let len = input.length;
639
- if (len > max) {
640
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
641
- }
642
- const bos = { type: "bos", value: "", output: opts.prepend || "" };
643
- const tokens = [bos];
644
- const capture = opts.capture ? "" : "?:";
645
- const win32 = utils.isWindows(options);
646
- const PLATFORM_CHARS = constants.globChars(win32);
647
- const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
648
- const {
649
- DOT_LITERAL,
650
- PLUS_LITERAL,
651
- SLASH_LITERAL,
652
- ONE_CHAR,
653
- DOTS_SLASH,
654
- NO_DOT,
655
- NO_DOT_SLASH,
656
- NO_DOTS_SLASH,
657
- QMARK,
658
- QMARK_NO_DOT,
659
- STAR,
660
- START_ANCHOR
661
- } = PLATFORM_CHARS;
662
- const globstar = /* @__PURE__ */ __name((opts2) => {
663
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
664
- }, "globstar");
665
- const nodot = opts.dot ? "" : NO_DOT;
666
- const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
667
- let star = opts.bash === true ? globstar(opts) : STAR;
668
- if (opts.capture) {
669
- star = `(${star})`;
670
- }
671
- if (typeof opts.noext === "boolean") {
672
- opts.noextglob = opts.noext;
673
- }
674
- const state = {
675
- input,
676
- index: -1,
677
- start: 0,
678
- dot: opts.dot === true,
679
- consumed: "",
680
- output: "",
681
- prefix: "",
682
- backtrack: false,
683
- negated: false,
684
- brackets: 0,
685
- braces: 0,
686
- parens: 0,
687
- quotes: 0,
688
- globstar: false,
689
- tokens
690
- };
691
- input = utils.removePrefix(input, state);
692
- len = input.length;
693
- const extglobs = [];
694
- const braces = [];
695
- const stack = [];
696
- let prev = bos;
697
- let value;
698
- const eos = /* @__PURE__ */ __name(() => state.index === len - 1, "eos");
699
- const peek = state.peek = (n = 1) => input[state.index + n];
700
- const advance = state.advance = () => input[++state.index] || "";
701
- const remaining = /* @__PURE__ */ __name(() => input.slice(state.index + 1), "remaining");
702
- const consume = /* @__PURE__ */ __name((value2 = "", num = 0) => {
703
- state.consumed += value2;
704
- state.index += num;
705
- }, "consume");
706
- const append = /* @__PURE__ */ __name((token) => {
707
- state.output += token.output != null ? token.output : token.value;
708
- consume(token.value);
709
- }, "append");
710
- const negate = /* @__PURE__ */ __name(() => {
711
- let count = 1;
712
- while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
713
- advance();
714
- state.start++;
715
- count++;
716
- }
717
- if (count % 2 === 0) {
718
- return false;
719
- }
720
- state.negated = true;
721
- state.start++;
722
- return true;
723
- }, "negate");
724
- const increment = /* @__PURE__ */ __name((type) => {
725
- state[type]++;
726
- stack.push(type);
727
- }, "increment");
728
- const decrement = /* @__PURE__ */ __name((type) => {
729
- state[type]--;
730
- stack.pop();
731
- }, "decrement");
732
- const push = /* @__PURE__ */ __name((tok) => {
733
- if (prev.type === "globstar") {
734
- const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
735
- const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
736
- if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
737
- state.output = state.output.slice(0, -prev.output.length);
738
- prev.type = "star";
739
- prev.value = "*";
740
- prev.output = star;
741
- state.output += prev.output;
742
- }
743
- }
744
- if (extglobs.length && tok.type !== "paren") {
745
- extglobs[extglobs.length - 1].inner += tok.value;
746
- }
747
- if (tok.value || tok.output) append(tok);
748
- if (prev && prev.type === "text" && tok.type === "text") {
749
- prev.value += tok.value;
750
- prev.output = (prev.output || "") + tok.value;
751
- return;
752
- }
753
- tok.prev = prev;
754
- tokens.push(tok);
755
- prev = tok;
756
- }, "push");
757
- const extglobOpen = /* @__PURE__ */ __name((type, value2) => {
758
- const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
759
- token.prev = prev;
760
- token.parens = state.parens;
761
- token.output = state.output;
762
- const output = (opts.capture ? "(" : "") + token.open;
763
- increment("parens");
764
- push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
765
- push({ type: "paren", extglob: true, value: advance(), output });
766
- extglobs.push(token);
767
- }, "extglobOpen");
768
- const extglobClose = /* @__PURE__ */ __name((token) => {
769
- let output = token.close + (opts.capture ? ")" : "");
770
- let rest;
771
- if (token.type === "negate") {
772
- let extglobStar = star;
773
- if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
774
- extglobStar = globstar(opts);
775
- }
776
- if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
777
- output = token.close = `)$))${extglobStar}`;
778
- }
779
- if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
780
- const expression = parse(rest, { ...options, fastpaths: false }).output;
781
- output = token.close = `)${expression})${extglobStar})`;
782
- }
783
- if (token.prev.type === "bos") {
784
- state.negatedExtglob = true;
785
- }
786
- }
787
- push({ type: "paren", extglob: true, value, output });
788
- decrement("parens");
789
- }, "extglobClose");
790
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
791
- let backslashes = false;
792
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
793
- if (first === "\\") {
794
- backslashes = true;
795
- return m;
796
- }
797
- if (first === "?") {
798
- if (esc) {
799
- return esc + first + (rest ? QMARK.repeat(rest.length) : "");
800
- }
801
- if (index === 0) {
802
- return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
803
- }
804
- return QMARK.repeat(chars.length);
805
- }
806
- if (first === ".") {
807
- return DOT_LITERAL.repeat(chars.length);
808
- }
809
- if (first === "*") {
810
- if (esc) {
811
- return esc + first + (rest ? star : "");
812
- }
813
- return star;
814
- }
815
- return esc ? m : `\\${m}`;
816
- });
817
- if (backslashes === true) {
818
- if (opts.unescape === true) {
819
- output = output.replace(/\\/g, "");
820
- } else {
821
- output = output.replace(/\\+/g, (m) => {
822
- return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
823
- });
824
- }
825
- }
826
- if (output === input && opts.contains === true) {
827
- state.output = input;
828
- return state;
829
- }
830
- state.output = utils.wrapOutput(output, state, options);
831
- return state;
832
- }
833
- while (!eos()) {
834
- value = advance();
835
- if (value === "\0") {
836
- continue;
837
- }
838
- if (value === "\\") {
839
- const next = peek();
840
- if (next === "/" && opts.bash !== true) {
841
- continue;
842
- }
843
- if (next === "." || next === ";") {
844
- continue;
845
- }
846
- if (!next) {
847
- value += "\\";
848
- push({ type: "text", value });
849
- continue;
850
- }
851
- const match = /^\\+/.exec(remaining());
852
- let slashes = 0;
853
- if (match && match[0].length > 2) {
854
- slashes = match[0].length;
855
- state.index += slashes;
856
- if (slashes % 2 !== 0) {
857
- value += "\\";
858
- }
859
- }
860
- if (opts.unescape === true) {
861
- value = advance();
862
- } else {
863
- value += advance();
864
- }
865
- if (state.brackets === 0) {
866
- push({ type: "text", value });
867
- continue;
868
- }
869
- }
870
- if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
871
- if (opts.posix !== false && value === ":") {
872
- const inner = prev.value.slice(1);
873
- if (inner.includes("[")) {
874
- prev.posix = true;
875
- if (inner.includes(":")) {
876
- const idx = prev.value.lastIndexOf("[");
877
- const pre = prev.value.slice(0, idx);
878
- const rest2 = prev.value.slice(idx + 2);
879
- const posix = POSIX_REGEX_SOURCE[rest2];
880
- if (posix) {
881
- prev.value = pre + posix;
882
- state.backtrack = true;
883
- advance();
884
- if (!bos.output && tokens.indexOf(prev) === 1) {
885
- bos.output = ONE_CHAR;
886
- }
887
- continue;
888
- }
889
- }
890
- }
891
- }
892
- if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
893
- value = `\\${value}`;
894
- }
895
- if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
896
- value = `\\${value}`;
897
- }
898
- if (opts.posix === true && value === "!" && prev.value === "[") {
899
- value = "^";
900
- }
901
- prev.value += value;
902
- append({ value });
903
- continue;
904
- }
905
- if (state.quotes === 1 && value !== '"') {
906
- value = utils.escapeRegex(value);
907
- prev.value += value;
908
- append({ value });
909
- continue;
910
- }
911
- if (value === '"') {
912
- state.quotes = state.quotes === 1 ? 0 : 1;
913
- if (opts.keepQuotes === true) {
914
- push({ type: "text", value });
915
- }
916
- continue;
917
- }
918
- if (value === "(") {
919
- increment("parens");
920
- push({ type: "paren", value });
921
- continue;
922
- }
923
- if (value === ")") {
924
- if (state.parens === 0 && opts.strictBrackets === true) {
925
- throw new SyntaxError(syntaxError("opening", "("));
926
- }
927
- const extglob = extglobs[extglobs.length - 1];
928
- if (extglob && state.parens === extglob.parens + 1) {
929
- extglobClose(extglobs.pop());
930
- continue;
931
- }
932
- push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
933
- decrement("parens");
934
- continue;
935
- }
936
- if (value === "[") {
937
- if (opts.nobracket === true || !remaining().includes("]")) {
938
- if (opts.nobracket !== true && opts.strictBrackets === true) {
939
- throw new SyntaxError(syntaxError("closing", "]"));
940
- }
941
- value = `\\${value}`;
942
- } else {
943
- increment("brackets");
944
- }
945
- push({ type: "bracket", value });
946
- continue;
947
- }
948
- if (value === "]") {
949
- if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
950
- push({ type: "text", value, output: `\\${value}` });
951
- continue;
952
- }
953
- if (state.brackets === 0) {
954
- if (opts.strictBrackets === true) {
955
- throw new SyntaxError(syntaxError("opening", "["));
956
- }
957
- push({ type: "text", value, output: `\\${value}` });
958
- continue;
959
- }
960
- decrement("brackets");
961
- const prevValue = prev.value.slice(1);
962
- if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
963
- value = `/${value}`;
964
- }
965
- prev.value += value;
966
- append({ value });
967
- if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
968
- continue;
969
- }
970
- const escaped = utils.escapeRegex(prev.value);
971
- state.output = state.output.slice(0, -prev.value.length);
972
- if (opts.literalBrackets === true) {
973
- state.output += escaped;
974
- prev.value = escaped;
975
- continue;
976
- }
977
- prev.value = `(${capture}${escaped}|${prev.value})`;
978
- state.output += prev.value;
979
- continue;
980
- }
981
- if (value === "{" && opts.nobrace !== true) {
982
- increment("braces");
983
- const open = {
984
- type: "brace",
985
- value,
986
- output: "(",
987
- outputIndex: state.output.length,
988
- tokensIndex: state.tokens.length
989
- };
990
- braces.push(open);
991
- push(open);
992
- continue;
993
- }
994
- if (value === "}") {
995
- const brace = braces[braces.length - 1];
996
- if (opts.nobrace === true || !brace) {
997
- push({ type: "text", value, output: value });
998
- continue;
999
- }
1000
- let output = ")";
1001
- if (brace.dots === true) {
1002
- const arr = tokens.slice();
1003
- const range = [];
1004
- for (let i = arr.length - 1; i >= 0; i--) {
1005
- tokens.pop();
1006
- if (arr[i].type === "brace") {
1007
- break;
1008
- }
1009
- if (arr[i].type !== "dots") {
1010
- range.unshift(arr[i].value);
1011
- }
1012
- }
1013
- output = expandRange(range, opts);
1014
- state.backtrack = true;
1015
- }
1016
- if (brace.comma !== true && brace.dots !== true) {
1017
- const out = state.output.slice(0, brace.outputIndex);
1018
- const toks = state.tokens.slice(brace.tokensIndex);
1019
- brace.value = brace.output = "\\{";
1020
- value = output = "\\}";
1021
- state.output = out;
1022
- for (const t of toks) {
1023
- state.output += t.output || t.value;
1024
- }
1025
- }
1026
- push({ type: "brace", value, output });
1027
- decrement("braces");
1028
- braces.pop();
1029
- continue;
1030
- }
1031
- if (value === "|") {
1032
- if (extglobs.length > 0) {
1033
- extglobs[extglobs.length - 1].conditions++;
1034
- }
1035
- push({ type: "text", value });
1036
- continue;
1037
- }
1038
- if (value === ",") {
1039
- let output = value;
1040
- const brace = braces[braces.length - 1];
1041
- if (brace && stack[stack.length - 1] === "braces") {
1042
- brace.comma = true;
1043
- output = "|";
1044
- }
1045
- push({ type: "comma", value, output });
1046
- continue;
1047
- }
1048
- if (value === "/") {
1049
- if (prev.type === "dot" && state.index === state.start + 1) {
1050
- state.start = state.index + 1;
1051
- state.consumed = "";
1052
- state.output = "";
1053
- tokens.pop();
1054
- prev = bos;
1055
- continue;
1056
- }
1057
- push({ type: "slash", value, output: SLASH_LITERAL });
1058
- continue;
1059
- }
1060
- if (value === ".") {
1061
- if (state.braces > 0 && prev.type === "dot") {
1062
- if (prev.value === ".") prev.output = DOT_LITERAL;
1063
- const brace = braces[braces.length - 1];
1064
- prev.type = "dots";
1065
- prev.output += value;
1066
- prev.value += value;
1067
- brace.dots = true;
1068
- continue;
1069
- }
1070
- if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1071
- push({ type: "text", value, output: DOT_LITERAL });
1072
- continue;
1073
- }
1074
- push({ type: "dot", value, output: DOT_LITERAL });
1075
- continue;
1076
- }
1077
- if (value === "?") {
1078
- const isGroup = prev && prev.value === "(";
1079
- if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1080
- extglobOpen("qmark", value);
1081
- continue;
1082
- }
1083
- if (prev && prev.type === "paren") {
1084
- const next = peek();
1085
- let output = value;
1086
- if (next === "<" && !utils.supportsLookbehinds()) {
1087
- throw new Error("Node.js v10 or higher is required for regex lookbehinds");
1088
- }
1089
- if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
1090
- output = `\\${value}`;
1091
- }
1092
- push({ type: "text", value, output });
1093
- continue;
1094
- }
1095
- if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1096
- push({ type: "qmark", value, output: QMARK_NO_DOT });
1097
- continue;
1098
- }
1099
- push({ type: "qmark", value, output: QMARK });
1100
- continue;
1101
- }
1102
- if (value === "!") {
1103
- if (opts.noextglob !== true && peek() === "(") {
1104
- if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1105
- extglobOpen("negate", value);
1106
- continue;
1107
- }
1108
- }
1109
- if (opts.nonegate !== true && state.index === 0) {
1110
- negate();
1111
- continue;
1112
- }
1113
- }
1114
- if (value === "+") {
1115
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1116
- extglobOpen("plus", value);
1117
- continue;
1118
- }
1119
- if (prev && prev.value === "(" || opts.regex === false) {
1120
- push({ type: "plus", value, output: PLUS_LITERAL });
1121
- continue;
1122
- }
1123
- if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1124
- push({ type: "plus", value });
1125
- continue;
1126
- }
1127
- push({ type: "plus", value: PLUS_LITERAL });
1128
- continue;
1129
- }
1130
- if (value === "@") {
1131
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1132
- push({ type: "at", extglob: true, value, output: "" });
1133
- continue;
1134
- }
1135
- push({ type: "text", value });
1136
- continue;
1137
- }
1138
- if (value !== "*") {
1139
- if (value === "$" || value === "^") {
1140
- value = `\\${value}`;
1141
- }
1142
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1143
- if (match) {
1144
- value += match[0];
1145
- state.index += match[0].length;
1146
- }
1147
- push({ type: "text", value });
1148
- continue;
1149
- }
1150
- if (prev && (prev.type === "globstar" || prev.star === true)) {
1151
- prev.type = "star";
1152
- prev.star = true;
1153
- prev.value += value;
1154
- prev.output = star;
1155
- state.backtrack = true;
1156
- state.globstar = true;
1157
- consume(value);
1158
- continue;
1159
- }
1160
- let rest = remaining();
1161
- if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1162
- extglobOpen("star", value);
1163
- continue;
1164
- }
1165
- if (prev.type === "star") {
1166
- if (opts.noglobstar === true) {
1167
- consume(value);
1168
- continue;
1169
- }
1170
- const prior = prev.prev;
1171
- const before = prior.prev;
1172
- const isStart = prior.type === "slash" || prior.type === "bos";
1173
- const afterStar = before && (before.type === "star" || before.type === "globstar");
1174
- if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1175
- push({ type: "star", value, output: "" });
1176
- continue;
1177
- }
1178
- const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1179
- const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1180
- if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1181
- push({ type: "star", value, output: "" });
1182
- continue;
1183
- }
1184
- while (rest.slice(0, 3) === "/**") {
1185
- const after = input[state.index + 4];
1186
- if (after && after !== "/") {
1187
- break;
1188
- }
1189
- rest = rest.slice(3);
1190
- consume("/**", 3);
1191
- }
1192
- if (prior.type === "bos" && eos()) {
1193
- prev.type = "globstar";
1194
- prev.value += value;
1195
- prev.output = globstar(opts);
1196
- state.output = prev.output;
1197
- state.globstar = true;
1198
- consume(value);
1199
- continue;
1200
- }
1201
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
1202
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
1203
- prior.output = `(?:${prior.output}`;
1204
- prev.type = "globstar";
1205
- prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1206
- prev.value += value;
1207
- state.globstar = true;
1208
- state.output += prior.output + prev.output;
1209
- consume(value);
1210
- continue;
1211
- }
1212
- if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1213
- const end = rest[1] !== void 0 ? "|$" : "";
1214
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
1215
- prior.output = `(?:${prior.output}`;
1216
- prev.type = "globstar";
1217
- prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1218
- prev.value += value;
1219
- state.output += prior.output + prev.output;
1220
- state.globstar = true;
1221
- consume(value + advance());
1222
- push({ type: "slash", value: "/", output: "" });
1223
- continue;
1224
- }
1225
- if (prior.type === "bos" && rest[0] === "/") {
1226
- prev.type = "globstar";
1227
- prev.value += value;
1228
- prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1229
- state.output = prev.output;
1230
- state.globstar = true;
1231
- consume(value + advance());
1232
- push({ type: "slash", value: "/", output: "" });
1233
- continue;
1234
- }
1235
- state.output = state.output.slice(0, -prev.output.length);
1236
- prev.type = "globstar";
1237
- prev.output = globstar(opts);
1238
- prev.value += value;
1239
- state.output += prev.output;
1240
- state.globstar = true;
1241
- consume(value);
1242
- continue;
1243
- }
1244
- const token = { type: "star", value, output: star };
1245
- if (opts.bash === true) {
1246
- token.output = ".*?";
1247
- if (prev.type === "bos" || prev.type === "slash") {
1248
- token.output = nodot + token.output;
1249
- }
1250
- push(token);
1251
- continue;
1252
- }
1253
- if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1254
- token.output = value;
1255
- push(token);
1256
- continue;
1257
- }
1258
- if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1259
- if (prev.type === "dot") {
1260
- state.output += NO_DOT_SLASH;
1261
- prev.output += NO_DOT_SLASH;
1262
- } else if (opts.dot === true) {
1263
- state.output += NO_DOTS_SLASH;
1264
- prev.output += NO_DOTS_SLASH;
1265
- } else {
1266
- state.output += nodot;
1267
- prev.output += nodot;
1268
- }
1269
- if (peek() !== "*") {
1270
- state.output += ONE_CHAR;
1271
- prev.output += ONE_CHAR;
1272
- }
1273
- }
1274
- push(token);
1275
- }
1276
- while (state.brackets > 0) {
1277
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1278
- state.output = utils.escapeLast(state.output, "[");
1279
- decrement("brackets");
1280
- }
1281
- while (state.parens > 0) {
1282
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
1283
- state.output = utils.escapeLast(state.output, "(");
1284
- decrement("parens");
1285
- }
1286
- while (state.braces > 0) {
1287
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
1288
- state.output = utils.escapeLast(state.output, "{");
1289
- decrement("braces");
1290
- }
1291
- if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
1292
- push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
1293
- }
1294
- if (state.backtrack === true) {
1295
- state.output = "";
1296
- for (const token of state.tokens) {
1297
- state.output += token.output != null ? token.output : token.value;
1298
- if (token.suffix) {
1299
- state.output += token.suffix;
1300
- }
1301
- }
1302
- }
1303
- return state;
1304
- }, "parse");
1305
- parse.fastpaths = (input, options) => {
1306
- const opts = { ...options };
1307
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1308
- const len = input.length;
1309
- if (len > max) {
1310
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1311
- }
1312
- input = REPLACEMENTS[input] || input;
1313
- const win32 = utils.isWindows(options);
1314
- const {
1315
- DOT_LITERAL,
1316
- SLASH_LITERAL,
1317
- ONE_CHAR,
1318
- DOTS_SLASH,
1319
- NO_DOT,
1320
- NO_DOTS,
1321
- NO_DOTS_SLASH,
1322
- STAR,
1323
- START_ANCHOR
1324
- } = constants.globChars(win32);
1325
- const nodot = opts.dot ? NO_DOTS : NO_DOT;
1326
- const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1327
- const capture = opts.capture ? "" : "?:";
1328
- const state = { negated: false, prefix: "" };
1329
- let star = opts.bash === true ? ".*?" : STAR;
1330
- if (opts.capture) {
1331
- star = `(${star})`;
1332
- }
1333
- const globstar = /* @__PURE__ */ __name((opts2) => {
1334
- if (opts2.noglobstar === true) return star;
1335
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1336
- }, "globstar");
1337
- const create = /* @__PURE__ */ __name((str) => {
1338
- switch (str) {
1339
- case "*":
1340
- return `${nodot}${ONE_CHAR}${star}`;
1341
- case ".*":
1342
- return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1343
- case "*.*":
1344
- return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1345
- case "*/*":
1346
- return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1347
- case "**":
1348
- return nodot + globstar(opts);
1349
- case "**/*":
1350
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1351
- case "**/*.*":
1352
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1353
- case "**/.*":
1354
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1355
- default: {
1356
- const match = /^(.*?)\.(\w+)$/.exec(str);
1357
- if (!match) return;
1358
- const source2 = create(match[1]);
1359
- if (!source2) return;
1360
- return source2 + DOT_LITERAL + match[2];
1361
- }
1362
- }
1363
- }, "create");
1364
- const output = utils.removePrefix(input, state);
1365
- let source = create(output);
1366
- if (source && opts.strictSlashes !== true) {
1367
- source += `${SLASH_LITERAL}?`;
1368
- }
1369
- return source;
1370
- };
1371
- module2.exports = parse;
1372
- }
1373
- });
1374
-
1375
- // node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
1376
- var require_picomatch = __commonJS({
1377
- "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
1378
- "use strict";
1379
- var path = require("path");
1380
- var scan = require_scan();
1381
- var parse = require_parse();
1382
- var utils = require_utils();
1383
- var constants = require_constants();
1384
- var isObject = /* @__PURE__ */ __name((val) => val && typeof val === "object" && !Array.isArray(val), "isObject");
1385
- var picomatch = /* @__PURE__ */ __name((glob, options, returnState = false) => {
1386
- if (Array.isArray(glob)) {
1387
- const fns = glob.map((input) => picomatch(input, options, returnState));
1388
- const arrayMatcher = /* @__PURE__ */ __name((str) => {
1389
- for (const isMatch of fns) {
1390
- const state2 = isMatch(str);
1391
- if (state2) return state2;
1392
- }
1393
- return false;
1394
- }, "arrayMatcher");
1395
- return arrayMatcher;
1396
- }
1397
- const isState = isObject(glob) && glob.tokens && glob.input;
1398
- if (glob === "" || typeof glob !== "string" && !isState) {
1399
- throw new TypeError("Expected pattern to be a non-empty string");
1400
- }
1401
- const opts = options || {};
1402
- const posix = utils.isWindows(options);
1403
- const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
1404
- const state = regex.state;
1405
- delete regex.state;
1406
- let isIgnored = /* @__PURE__ */ __name(() => false, "isIgnored");
1407
- if (opts.ignore) {
1408
- const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
1409
- isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1410
- }
1411
- const matcher = /* @__PURE__ */ __name((input, returnObject = false) => {
1412
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
1413
- const result = { glob, state, regex, posix, input, output, match, isMatch };
1414
- if (typeof opts.onResult === "function") {
1415
- opts.onResult(result);
1416
- }
1417
- if (isMatch === false) {
1418
- result.isMatch = false;
1419
- return returnObject ? result : false;
1420
- }
1421
- if (isIgnored(input)) {
1422
- if (typeof opts.onIgnore === "function") {
1423
- opts.onIgnore(result);
1424
- }
1425
- result.isMatch = false;
1426
- return returnObject ? result : false;
1427
- }
1428
- if (typeof opts.onMatch === "function") {
1429
- opts.onMatch(result);
1430
- }
1431
- return returnObject ? result : true;
1432
- }, "matcher");
1433
- if (returnState) {
1434
- matcher.state = state;
1435
- }
1436
- return matcher;
1437
- }, "picomatch");
1438
- picomatch.test = (input, regex, options, { glob, posix } = {}) => {
1439
- if (typeof input !== "string") {
1440
- throw new TypeError("Expected input to be a string");
1441
- }
1442
- if (input === "") {
1443
- return { isMatch: false, output: "" };
1444
- }
1445
- const opts = options || {};
1446
- const format = opts.format || (posix ? utils.toPosixSlashes : null);
1447
- let match = input === glob;
1448
- let output = match && format ? format(input) : input;
1449
- if (match === false) {
1450
- output = format ? format(input) : input;
1451
- match = output === glob;
1452
- }
1453
- if (match === false || opts.capture === true) {
1454
- if (opts.matchBase === true || opts.basename === true) {
1455
- match = picomatch.matchBase(input, regex, options, posix);
1456
- } else {
1457
- match = regex.exec(output);
1458
- }
1459
- }
1460
- return { isMatch: Boolean(match), match, output };
1461
- };
1462
- picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
1463
- const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
1464
- return regex.test(path.basename(input));
1465
- };
1466
- picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
1467
- picomatch.parse = (pattern, options) => {
1468
- if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
1469
- return parse(pattern, { ...options, fastpaths: false });
1470
- };
1471
- picomatch.scan = (input, options) => scan(input, options);
1472
- picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
1473
- if (returnOutput === true) {
1474
- return state.output;
1475
- }
1476
- const opts = options || {};
1477
- const prepend = opts.contains ? "" : "^";
1478
- const append = opts.contains ? "" : "$";
1479
- let source = `${prepend}(?:${state.output})${append}`;
1480
- if (state && state.negated === true) {
1481
- source = `^(?!${source}).*$`;
1482
- }
1483
- const regex = picomatch.toRegex(source, options);
1484
- if (returnState === true) {
1485
- regex.state = state;
1486
- }
1487
- return regex;
1488
- };
1489
- picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1490
- if (!input || typeof input !== "string") {
1491
- throw new TypeError("Expected a non-empty string");
1492
- }
1493
- let parsed = { negated: false, fastpaths: true };
1494
- if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
1495
- parsed.output = parse.fastpaths(input, options);
1496
- }
1497
- if (!parsed.output) {
1498
- parsed = parse(input, options);
1499
- }
1500
- return picomatch.compileRe(parsed, options, returnOutput, returnState);
1501
- };
1502
- picomatch.toRegex = (source, options) => {
1503
- try {
1504
- const opts = options || {};
1505
- return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1506
- } catch (err) {
1507
- if (options && options.debug === true) throw err;
1508
- return /$^/;
1509
- }
1510
- };
1511
- picomatch.constants = constants;
1512
- module2.exports = picomatch;
1513
- }
1514
- });
1515
-
1516
- // node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js
1517
- var require_picomatch2 = __commonJS({
1518
- "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js"(exports2, module2) {
1519
- "use strict";
1520
- module2.exports = require_picomatch();
1521
- }
1522
- });
1523
-
1524
- // src/external/picomatch.js
1525
- module.exports = require_picomatch2();
6
+ module.exports = picomatch