rollup-plugin-jsshaker 0.2.2 → 0.2.4

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