@catheadowl/pathscope 0.3.0 → 0.4.1

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/cjs/index.js CHANGED
@@ -34,9 +34,1785 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  ));
35
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
36
 
37
- // node_modules/.pnpm/fdir@6.5.0/node_modules/fdir/dist/index.cjs
37
+ // node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/constants.js
38
+ var require_constants = __commonJS({
39
+ "node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/constants.js"(exports2, module2) {
40
+ "use strict";
41
+ var WIN_SLASH = "\\\\/";
42
+ var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
43
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
44
+ var DOT_LITERAL = "\\.";
45
+ var PLUS_LITERAL = "\\+";
46
+ var QMARK_LITERAL = "\\?";
47
+ var SLASH_LITERAL = "\\/";
48
+ var ONE_CHAR = "(?=.)";
49
+ var QMARK = "[^/]";
50
+ var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
51
+ var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
52
+ var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
53
+ var NO_DOT = `(?!${DOT_LITERAL})`;
54
+ var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
55
+ var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
56
+ var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
57
+ var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
58
+ var STAR = `${QMARK}*?`;
59
+ var SEP = "/";
60
+ var POSIX_CHARS = {
61
+ DOT_LITERAL,
62
+ PLUS_LITERAL,
63
+ QMARK_LITERAL,
64
+ SLASH_LITERAL,
65
+ ONE_CHAR,
66
+ QMARK,
67
+ END_ANCHOR,
68
+ DOTS_SLASH,
69
+ NO_DOT,
70
+ NO_DOTS,
71
+ NO_DOT_SLASH,
72
+ NO_DOTS_SLASH,
73
+ QMARK_NO_DOT,
74
+ STAR,
75
+ START_ANCHOR,
76
+ SEP
77
+ };
78
+ var WINDOWS_CHARS = {
79
+ ...POSIX_CHARS,
80
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
81
+ QMARK: WIN_NO_SLASH,
82
+ STAR: `${WIN_NO_SLASH}*?`,
83
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
84
+ NO_DOT: `(?!${DOT_LITERAL})`,
85
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
86
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
87
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
88
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
89
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
90
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
91
+ SEP: "\\"
92
+ };
93
+ var POSIX_REGEX_SOURCE = {
94
+ __proto__: null,
95
+ alnum: "a-zA-Z0-9",
96
+ alpha: "a-zA-Z",
97
+ ascii: "\\x00-\\x7F",
98
+ blank: " \\t",
99
+ cntrl: "\\x00-\\x1F\\x7F",
100
+ digit: "0-9",
101
+ graph: "\\x21-\\x7E",
102
+ lower: "a-z",
103
+ print: "\\x20-\\x7E ",
104
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
105
+ space: " \\t\\r\\n\\v\\f",
106
+ upper: "A-Z",
107
+ word: "A-Za-z0-9_",
108
+ xdigit: "A-Fa-f0-9"
109
+ };
110
+ module2.exports = {
111
+ DEFAULT_MAX_EXTGLOB_RECURSION,
112
+ MAX_LENGTH: 1024 * 64,
113
+ POSIX_REGEX_SOURCE,
114
+ // regular expressions
115
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
116
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
117
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
118
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
119
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
120
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
121
+ // Replace globs with equivalent patterns to reduce parsing time.
122
+ REPLACEMENTS: {
123
+ __proto__: null,
124
+ "***": "*",
125
+ "**/**": "**",
126
+ "**/**/**": "**"
127
+ },
128
+ // Digits
129
+ CHAR_0: 48,
130
+ /* 0 */
131
+ CHAR_9: 57,
132
+ /* 9 */
133
+ // Alphabet chars.
134
+ CHAR_UPPERCASE_A: 65,
135
+ /* A */
136
+ CHAR_LOWERCASE_A: 97,
137
+ /* a */
138
+ CHAR_UPPERCASE_Z: 90,
139
+ /* Z */
140
+ CHAR_LOWERCASE_Z: 122,
141
+ /* z */
142
+ CHAR_LEFT_PARENTHESES: 40,
143
+ /* ( */
144
+ CHAR_RIGHT_PARENTHESES: 41,
145
+ /* ) */
146
+ CHAR_ASTERISK: 42,
147
+ /* * */
148
+ // Non-alphabetic chars.
149
+ CHAR_AMPERSAND: 38,
150
+ /* & */
151
+ CHAR_AT: 64,
152
+ /* @ */
153
+ CHAR_BACKWARD_SLASH: 92,
154
+ /* \ */
155
+ CHAR_CARRIAGE_RETURN: 13,
156
+ /* \r */
157
+ CHAR_CIRCUMFLEX_ACCENT: 94,
158
+ /* ^ */
159
+ CHAR_COLON: 58,
160
+ /* : */
161
+ CHAR_COMMA: 44,
162
+ /* , */
163
+ CHAR_DOT: 46,
164
+ /* . */
165
+ CHAR_DOUBLE_QUOTE: 34,
166
+ /* " */
167
+ CHAR_EQUAL: 61,
168
+ /* = */
169
+ CHAR_EXCLAMATION_MARK: 33,
170
+ /* ! */
171
+ CHAR_FORM_FEED: 12,
172
+ /* \f */
173
+ CHAR_FORWARD_SLASH: 47,
174
+ /* / */
175
+ CHAR_GRAVE_ACCENT: 96,
176
+ /* ` */
177
+ CHAR_HASH: 35,
178
+ /* # */
179
+ CHAR_HYPHEN_MINUS: 45,
180
+ /* - */
181
+ CHAR_LEFT_ANGLE_BRACKET: 60,
182
+ /* < */
183
+ CHAR_LEFT_CURLY_BRACE: 123,
184
+ /* { */
185
+ CHAR_LEFT_SQUARE_BRACKET: 91,
186
+ /* [ */
187
+ CHAR_LINE_FEED: 10,
188
+ /* \n */
189
+ CHAR_NO_BREAK_SPACE: 160,
190
+ /* \u00A0 */
191
+ CHAR_PERCENT: 37,
192
+ /* % */
193
+ CHAR_PLUS: 43,
194
+ /* + */
195
+ CHAR_QUESTION_MARK: 63,
196
+ /* ? */
197
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
198
+ /* > */
199
+ CHAR_RIGHT_CURLY_BRACE: 125,
200
+ /* } */
201
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
202
+ /* ] */
203
+ CHAR_SEMICOLON: 59,
204
+ /* ; */
205
+ CHAR_SINGLE_QUOTE: 39,
206
+ /* ' */
207
+ CHAR_SPACE: 32,
208
+ /* */
209
+ CHAR_TAB: 9,
210
+ /* \t */
211
+ CHAR_UNDERSCORE: 95,
212
+ /* _ */
213
+ CHAR_VERTICAL_LINE: 124,
214
+ /* | */
215
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
216
+ /* \uFEFF */
217
+ /**
218
+ * Create EXTGLOB_CHARS
219
+ */
220
+ extglobChars(chars) {
221
+ return {
222
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
223
+ "?": { type: "qmark", open: "(?:", close: ")?" },
224
+ "+": { type: "plus", open: "(?:", close: ")+" },
225
+ "*": { type: "star", open: "(?:", close: ")*" },
226
+ "@": { type: "at", open: "(?:", close: ")" }
227
+ };
228
+ },
229
+ /**
230
+ * Create GLOB_CHARS
231
+ */
232
+ globChars(win32) {
233
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
234
+ }
235
+ };
236
+ }
237
+ });
238
+
239
+ // node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js
240
+ var require_utils = __commonJS({
241
+ "node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js"(exports2) {
242
+ "use strict";
243
+ var {
244
+ REGEX_BACKSLASH,
245
+ REGEX_REMOVE_BACKSLASH,
246
+ REGEX_SPECIAL_CHARS,
247
+ REGEX_SPECIAL_CHARS_GLOBAL
248
+ } = require_constants();
249
+ exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
250
+ exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
251
+ exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
252
+ exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
253
+ exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
254
+ exports2.isWindows = () => {
255
+ if (typeof navigator !== "undefined" && navigator.platform) {
256
+ const platform3 = navigator.platform.toLowerCase();
257
+ return platform3 === "win32" || platform3 === "windows";
258
+ }
259
+ if (typeof process !== "undefined" && process.platform) {
260
+ return process.platform === "win32";
261
+ }
262
+ return false;
263
+ };
264
+ exports2.removeBackslashes = (str) => {
265
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
266
+ return match === "\\" ? "" : match;
267
+ });
268
+ };
269
+ exports2.escapeLast = (input, char, lastIdx) => {
270
+ const idx = input.lastIndexOf(char, lastIdx);
271
+ if (idx === -1) return input;
272
+ if (input[idx - 1] === "\\") return exports2.escapeLast(input, char, idx - 1);
273
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
274
+ };
275
+ exports2.removePrefix = (input, state = {}) => {
276
+ let output = input;
277
+ if (output.startsWith("./")) {
278
+ output = output.slice(2);
279
+ state.prefix = "./";
280
+ }
281
+ return output;
282
+ };
283
+ exports2.wrapOutput = (input, state = {}, options = {}) => {
284
+ const prepend = options.contains ? "" : "^";
285
+ const append = options.contains ? "" : "$";
286
+ let output = `${prepend}(?:${input})${append}`;
287
+ if (state.negated === true) {
288
+ output = `(?:^(?!${output}).*$)`;
289
+ }
290
+ return output;
291
+ };
292
+ exports2.basename = (path3, { windows } = {}) => {
293
+ const segs = path3.split(windows ? /[\\/]/ : "/");
294
+ const last = segs[segs.length - 1];
295
+ if (last === "") {
296
+ return segs[segs.length - 2];
297
+ }
298
+ return last;
299
+ };
300
+ }
301
+ });
302
+
303
+ // node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js
304
+ var require_scan = __commonJS({
305
+ "node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js"(exports2, module2) {
306
+ "use strict";
307
+ var utils = require_utils();
308
+ var {
309
+ CHAR_ASTERISK,
310
+ /* * */
311
+ CHAR_AT,
312
+ /* @ */
313
+ CHAR_BACKWARD_SLASH,
314
+ /* \ */
315
+ CHAR_COMMA,
316
+ /* , */
317
+ CHAR_DOT,
318
+ /* . */
319
+ CHAR_EXCLAMATION_MARK,
320
+ /* ! */
321
+ CHAR_FORWARD_SLASH,
322
+ /* / */
323
+ CHAR_LEFT_CURLY_BRACE,
324
+ /* { */
325
+ CHAR_LEFT_PARENTHESES,
326
+ /* ( */
327
+ CHAR_LEFT_SQUARE_BRACKET,
328
+ /* [ */
329
+ CHAR_PLUS,
330
+ /* + */
331
+ CHAR_QUESTION_MARK,
332
+ /* ? */
333
+ CHAR_RIGHT_CURLY_BRACE,
334
+ /* } */
335
+ CHAR_RIGHT_PARENTHESES,
336
+ /* ) */
337
+ CHAR_RIGHT_SQUARE_BRACKET
338
+ /* ] */
339
+ } = require_constants();
340
+ var isPathSeparator = (code) => {
341
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
342
+ };
343
+ var depth = (token) => {
344
+ if (token.isPrefix !== true) {
345
+ token.depth = token.isGlobstar ? Infinity : 1;
346
+ }
347
+ };
348
+ var scan = (input, options) => {
349
+ const opts = options || {};
350
+ const length = input.length - 1;
351
+ const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
352
+ const slashes = [];
353
+ const tokens = [];
354
+ const parts = [];
355
+ let str = input;
356
+ let index = -1;
357
+ let start = 0;
358
+ let lastIndex = 0;
359
+ let isBrace = false;
360
+ let isBracket = false;
361
+ let isGlob = false;
362
+ let isExtglob = false;
363
+ let isGlobstar = false;
364
+ let braceEscaped = false;
365
+ let backslashes = false;
366
+ let negated = false;
367
+ let negatedExtglob = false;
368
+ let finished = false;
369
+ let braces = 0;
370
+ let prev;
371
+ let code;
372
+ let token = { value: "", depth: 0, isGlob: false };
373
+ const eos = () => index >= length;
374
+ const peek = () => str.charCodeAt(index + 1);
375
+ const advance = () => {
376
+ prev = code;
377
+ return str.charCodeAt(++index);
378
+ };
379
+ while (index < length) {
380
+ code = advance();
381
+ let next;
382
+ if (code === CHAR_BACKWARD_SLASH) {
383
+ backslashes = token.backslashes = true;
384
+ code = advance();
385
+ if (code === CHAR_LEFT_CURLY_BRACE) {
386
+ braceEscaped = true;
387
+ }
388
+ continue;
389
+ }
390
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
391
+ braces++;
392
+ while (eos() !== true && (code = advance())) {
393
+ if (code === CHAR_BACKWARD_SLASH) {
394
+ backslashes = token.backslashes = true;
395
+ advance();
396
+ continue;
397
+ }
398
+ if (code === CHAR_LEFT_CURLY_BRACE) {
399
+ braces++;
400
+ continue;
401
+ }
402
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
403
+ isBrace = token.isBrace = true;
404
+ isGlob = token.isGlob = true;
405
+ finished = true;
406
+ if (scanToEnd === true) {
407
+ continue;
408
+ }
409
+ break;
410
+ }
411
+ if (braceEscaped !== true && code === CHAR_COMMA) {
412
+ isBrace = token.isBrace = true;
413
+ isGlob = token.isGlob = true;
414
+ finished = true;
415
+ if (scanToEnd === true) {
416
+ continue;
417
+ }
418
+ break;
419
+ }
420
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
421
+ braces--;
422
+ if (braces === 0) {
423
+ braceEscaped = false;
424
+ isBrace = token.isBrace = true;
425
+ finished = true;
426
+ break;
427
+ }
428
+ }
429
+ }
430
+ if (scanToEnd === true) {
431
+ continue;
432
+ }
433
+ break;
434
+ }
435
+ if (code === CHAR_FORWARD_SLASH) {
436
+ slashes.push(index);
437
+ tokens.push(token);
438
+ token = { value: "", depth: 0, isGlob: false };
439
+ if (finished === true) continue;
440
+ if (prev === CHAR_DOT && index === start + 1) {
441
+ start += 2;
442
+ continue;
443
+ }
444
+ lastIndex = index + 1;
445
+ continue;
446
+ }
447
+ if (opts.noext !== true) {
448
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
449
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
450
+ isGlob = token.isGlob = true;
451
+ isExtglob = token.isExtglob = true;
452
+ finished = true;
453
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
454
+ negatedExtglob = true;
455
+ }
456
+ if (scanToEnd === true) {
457
+ let parens = 0;
458
+ while (eos() !== true && (code = advance())) {
459
+ if (code === CHAR_BACKWARD_SLASH) {
460
+ backslashes = token.backslashes = true;
461
+ advance();
462
+ continue;
463
+ }
464
+ if (code === CHAR_LEFT_PARENTHESES) {
465
+ parens++;
466
+ continue;
467
+ }
468
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
469
+ finished = true;
470
+ break;
471
+ }
472
+ }
473
+ continue;
474
+ }
475
+ break;
476
+ }
477
+ }
478
+ if (code === CHAR_ASTERISK) {
479
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
480
+ isGlob = token.isGlob = true;
481
+ finished = true;
482
+ if (scanToEnd === true) {
483
+ continue;
484
+ }
485
+ break;
486
+ }
487
+ if (code === CHAR_QUESTION_MARK) {
488
+ isGlob = token.isGlob = true;
489
+ finished = true;
490
+ if (scanToEnd === true) {
491
+ continue;
492
+ }
493
+ break;
494
+ }
495
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
496
+ while (eos() !== true && (next = advance())) {
497
+ if (next === CHAR_BACKWARD_SLASH) {
498
+ backslashes = token.backslashes = true;
499
+ advance();
500
+ continue;
501
+ }
502
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
503
+ isBracket = token.isBracket = true;
504
+ isGlob = token.isGlob = true;
505
+ finished = true;
506
+ break;
507
+ }
508
+ }
509
+ if (scanToEnd === true) {
510
+ continue;
511
+ }
512
+ break;
513
+ }
514
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
515
+ negated = token.negated = true;
516
+ start++;
517
+ continue;
518
+ }
519
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
520
+ isGlob = token.isGlob = true;
521
+ if (scanToEnd === true) {
522
+ let parens = 1;
523
+ while (eos() !== true && (code = advance())) {
524
+ if (code === CHAR_BACKWARD_SLASH) {
525
+ backslashes = token.backslashes = true;
526
+ advance();
527
+ continue;
528
+ }
529
+ if (code === CHAR_LEFT_PARENTHESES) {
530
+ parens++;
531
+ continue;
532
+ }
533
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
534
+ finished = true;
535
+ break;
536
+ }
537
+ }
538
+ continue;
539
+ }
540
+ break;
541
+ }
542
+ if (isGlob === true) {
543
+ finished = true;
544
+ if (scanToEnd === true) {
545
+ continue;
546
+ }
547
+ break;
548
+ }
549
+ }
550
+ if (opts.noext === true) {
551
+ isExtglob = false;
552
+ isGlob = false;
553
+ }
554
+ let base = str;
555
+ let prefix = "";
556
+ let glob = "";
557
+ if (start > 0) {
558
+ prefix = str.slice(0, start);
559
+ str = str.slice(start);
560
+ lastIndex -= start;
561
+ }
562
+ if (base && isGlob === true && lastIndex > 0) {
563
+ base = str.slice(0, lastIndex);
564
+ glob = str.slice(lastIndex);
565
+ } else if (isGlob === true) {
566
+ base = "";
567
+ glob = str;
568
+ } else {
569
+ base = str;
570
+ }
571
+ if (base && base !== "" && base !== "/" && base !== str) {
572
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
573
+ base = base.slice(0, -1);
574
+ }
575
+ }
576
+ if (opts.unescape === true) {
577
+ if (glob) glob = utils.removeBackslashes(glob);
578
+ if (base && backslashes === true) {
579
+ base = utils.removeBackslashes(base);
580
+ }
581
+ }
582
+ const state = {
583
+ prefix,
584
+ input,
585
+ start,
586
+ base,
587
+ glob,
588
+ isBrace,
589
+ isBracket,
590
+ isGlob,
591
+ isExtglob,
592
+ isGlobstar,
593
+ negated,
594
+ negatedExtglob
595
+ };
596
+ if (opts.tokens === true) {
597
+ state.maxDepth = 0;
598
+ if (!isPathSeparator(code)) {
599
+ tokens.push(token);
600
+ }
601
+ state.tokens = tokens;
602
+ }
603
+ if (opts.parts === true || opts.tokens === true) {
604
+ let prevIndex;
605
+ for (let idx = 0; idx < slashes.length; idx++) {
606
+ const n2 = prevIndex !== void 0 ? prevIndex + 1 : start;
607
+ const i = slashes[idx];
608
+ const value2 = input.slice(n2, i);
609
+ if (opts.tokens) {
610
+ if (idx === 0 && start !== 0) {
611
+ tokens[idx].isPrefix = true;
612
+ tokens[idx].value = prefix;
613
+ } else {
614
+ tokens[idx].value = value2;
615
+ }
616
+ depth(tokens[idx]);
617
+ state.maxDepth += tokens[idx].depth;
618
+ }
619
+ if (i >= start) {
620
+ parts.push(value2);
621
+ prevIndex = i;
622
+ }
623
+ }
624
+ const n = prevIndex !== void 0 ? prevIndex + 1 : start;
625
+ const value = input.slice(n);
626
+ parts.push(value);
627
+ if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
628
+ tokens[tokens.length - 1].value = value;
629
+ depth(tokens[tokens.length - 1]);
630
+ state.maxDepth += tokens[tokens.length - 1].depth;
631
+ }
632
+ state.slashes = slashes;
633
+ state.parts = parts;
634
+ }
635
+ return state;
636
+ };
637
+ module2.exports = scan;
638
+ }
639
+ });
640
+
641
+ // node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
642
+ var require_parse = __commonJS({
643
+ "node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js"(exports2, module2) {
644
+ "use strict";
645
+ var constants = require_constants();
646
+ var utils = require_utils();
647
+ var {
648
+ MAX_LENGTH,
649
+ POSIX_REGEX_SOURCE,
650
+ REGEX_NON_SPECIAL_CHARS,
651
+ REGEX_SPECIAL_CHARS_BACKREF,
652
+ REPLACEMENTS
653
+ } = constants;
654
+ var expandRange = (args, options) => {
655
+ if (typeof options.expandRange === "function") {
656
+ return options.expandRange(...args, options);
657
+ }
658
+ args.sort();
659
+ const value = `[${args.join("-")}]`;
660
+ try {
661
+ new RegExp(value);
662
+ } catch (ex) {
663
+ return args.map((v) => utils.escapeRegex(v)).join("..");
664
+ }
665
+ return value;
666
+ };
667
+ var syntaxError = (type, char) => {
668
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
669
+ };
670
+ var splitTopLevel = (input) => {
671
+ const parts = [];
672
+ let bracket = 0;
673
+ let paren = 0;
674
+ let quote = 0;
675
+ let value = "";
676
+ let escaped = false;
677
+ for (const ch of input) {
678
+ if (escaped === true) {
679
+ value += ch;
680
+ escaped = false;
681
+ continue;
682
+ }
683
+ if (ch === "\\") {
684
+ value += ch;
685
+ escaped = true;
686
+ continue;
687
+ }
688
+ if (ch === '"') {
689
+ quote = quote === 1 ? 0 : 1;
690
+ value += ch;
691
+ continue;
692
+ }
693
+ if (quote === 0) {
694
+ if (ch === "[") {
695
+ bracket++;
696
+ } else if (ch === "]" && bracket > 0) {
697
+ bracket--;
698
+ } else if (bracket === 0) {
699
+ if (ch === "(") {
700
+ paren++;
701
+ } else if (ch === ")" && paren > 0) {
702
+ paren--;
703
+ } else if (ch === "|" && paren === 0) {
704
+ parts.push(value);
705
+ value = "";
706
+ continue;
707
+ }
708
+ }
709
+ }
710
+ value += ch;
711
+ }
712
+ parts.push(value);
713
+ return parts;
714
+ };
715
+ var isPlainBranch = (branch) => {
716
+ let escaped = false;
717
+ for (const ch of branch) {
718
+ if (escaped === true) {
719
+ escaped = false;
720
+ continue;
721
+ }
722
+ if (ch === "\\") {
723
+ escaped = true;
724
+ continue;
725
+ }
726
+ if (/[?*+@!()[\]{}]/.test(ch)) {
727
+ return false;
728
+ }
729
+ }
730
+ return true;
731
+ };
732
+ var normalizeSimpleBranch = (branch) => {
733
+ let value = branch.trim();
734
+ let changed = true;
735
+ while (changed === true) {
736
+ changed = false;
737
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
738
+ value = value.slice(2, -1);
739
+ changed = true;
740
+ }
741
+ }
742
+ if (!isPlainBranch(value)) {
743
+ return;
744
+ }
745
+ return value.replace(/\\(.)/g, "$1");
746
+ };
747
+ var hasRepeatedCharPrefixOverlap = (branches) => {
748
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
749
+ for (let i = 0; i < values.length; i++) {
750
+ for (let j = i + 1; j < values.length; j++) {
751
+ const a = values[i];
752
+ const b = values[j];
753
+ const char = a[0];
754
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
755
+ continue;
756
+ }
757
+ if (a === b || a.startsWith(b) || b.startsWith(a)) {
758
+ return true;
759
+ }
760
+ }
761
+ }
762
+ return false;
763
+ };
764
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
765
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
766
+ return;
767
+ }
768
+ let bracket = 0;
769
+ let paren = 0;
770
+ let quote = 0;
771
+ let escaped = false;
772
+ for (let i = 1; i < pattern.length; i++) {
773
+ const ch = pattern[i];
774
+ if (escaped === true) {
775
+ escaped = false;
776
+ continue;
777
+ }
778
+ if (ch === "\\") {
779
+ escaped = true;
780
+ continue;
781
+ }
782
+ if (ch === '"') {
783
+ quote = quote === 1 ? 0 : 1;
784
+ continue;
785
+ }
786
+ if (quote === 1) {
787
+ continue;
788
+ }
789
+ if (ch === "[") {
790
+ bracket++;
791
+ continue;
792
+ }
793
+ if (ch === "]" && bracket > 0) {
794
+ bracket--;
795
+ continue;
796
+ }
797
+ if (bracket > 0) {
798
+ continue;
799
+ }
800
+ if (ch === "(") {
801
+ paren++;
802
+ continue;
803
+ }
804
+ if (ch === ")") {
805
+ paren--;
806
+ if (paren === 0) {
807
+ if (requireEnd === true && i !== pattern.length - 1) {
808
+ return;
809
+ }
810
+ return {
811
+ type: pattern[0],
812
+ body: pattern.slice(2, i),
813
+ end: i
814
+ };
815
+ }
816
+ }
817
+ }
818
+ };
819
+ var buildCharClassStar = (chars) => {
820
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
821
+ return `${source}*`;
822
+ };
823
+ var getStarExtglobSequenceChars = (pattern) => {
824
+ let index = 0;
825
+ const chars = [];
826
+ while (index < pattern.length) {
827
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
828
+ if (!match || match.type !== "*") {
829
+ return;
830
+ }
831
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
832
+ if (branches.length !== 1) {
833
+ return;
834
+ }
835
+ const branch = normalizeSimpleBranch(branches[0]);
836
+ if (!branch || branch.length !== 1) {
837
+ return;
838
+ }
839
+ chars.push(branch);
840
+ index += match.end + 1;
841
+ }
842
+ if (chars.length < 1) {
843
+ return;
844
+ }
845
+ return chars;
846
+ };
847
+ var repeatedExtglobRecursion = (pattern) => {
848
+ let depth = 0;
849
+ let value = pattern.trim();
850
+ let match = parseRepeatedExtglob(value);
851
+ while (match) {
852
+ depth++;
853
+ value = match.body.trim();
854
+ match = parseRepeatedExtglob(value);
855
+ }
856
+ return depth;
857
+ };
858
+ var analyzeRepeatedExtglob = (body, options) => {
859
+ if (options.maxExtglobRecursion === false) {
860
+ return { risky: false };
861
+ }
862
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
863
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
864
+ if (branches.length > 1) {
865
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
866
+ return { risky: true };
867
+ }
868
+ }
869
+ const safeChars = [];
870
+ let sawStarSequence = false;
871
+ let combinable = true;
872
+ for (const branch of branches) {
873
+ const chars = getStarExtglobSequenceChars(branch);
874
+ if (chars) {
875
+ sawStarSequence = true;
876
+ safeChars.push(...chars);
877
+ continue;
878
+ }
879
+ const literal = normalizeSimpleBranch(branch);
880
+ if (literal && literal.length === 1) {
881
+ safeChars.push(literal);
882
+ continue;
883
+ }
884
+ combinable = false;
885
+ if (repeatedExtglobRecursion(branch) > max) {
886
+ return { risky: true };
887
+ }
888
+ }
889
+ if (sawStarSequence) {
890
+ return combinable ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) } : { risky: true };
891
+ }
892
+ return { risky: false };
893
+ };
894
+ var parse = (input, options) => {
895
+ if (typeof input !== "string") {
896
+ throw new TypeError("Expected a string");
897
+ }
898
+ input = REPLACEMENTS[input] || input;
899
+ const opts = { ...options };
900
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
901
+ let len = input.length;
902
+ if (len > max) {
903
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
904
+ }
905
+ const bos = { type: "bos", value: "", output: opts.prepend || "" };
906
+ const tokens = [bos];
907
+ const capture = opts.capture ? "" : "?:";
908
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
909
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
910
+ const {
911
+ DOT_LITERAL,
912
+ PLUS_LITERAL,
913
+ SLASH_LITERAL,
914
+ ONE_CHAR,
915
+ DOTS_SLASH,
916
+ NO_DOT,
917
+ NO_DOT_SLASH,
918
+ NO_DOTS_SLASH,
919
+ QMARK,
920
+ QMARK_NO_DOT,
921
+ STAR,
922
+ START_ANCHOR
923
+ } = PLATFORM_CHARS;
924
+ const globstar = (opts2) => {
925
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
926
+ };
927
+ const nodot = opts.dot ? "" : NO_DOT;
928
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
929
+ let star = opts.bash === true ? globstar(opts) : STAR;
930
+ if (opts.capture) {
931
+ star = `(${star})`;
932
+ }
933
+ if (typeof opts.noext === "boolean") {
934
+ opts.noextglob = opts.noext;
935
+ }
936
+ const state = {
937
+ input,
938
+ index: -1,
939
+ start: 0,
940
+ dot: opts.dot === true,
941
+ consumed: "",
942
+ output: "",
943
+ prefix: "",
944
+ backtrack: false,
945
+ negated: false,
946
+ brackets: 0,
947
+ braces: 0,
948
+ parens: 0,
949
+ quotes: 0,
950
+ globstar: false,
951
+ tokens
952
+ };
953
+ input = utils.removePrefix(input, state);
954
+ len = input.length;
955
+ const extglobs = [];
956
+ const braces = [];
957
+ const stack = [];
958
+ let prev = bos;
959
+ let value;
960
+ const eos = () => state.index === len - 1;
961
+ const peek = state.peek = (n = 1) => input[state.index + n];
962
+ const advance = state.advance = () => input[++state.index] || "";
963
+ const remaining = () => input.slice(state.index + 1);
964
+ const consume = (value2 = "", num = 0) => {
965
+ state.consumed += value2;
966
+ state.index += num;
967
+ };
968
+ const append = (token) => {
969
+ state.output += token.output != null ? token.output : token.value;
970
+ consume(token.value);
971
+ };
972
+ const negate = () => {
973
+ let count = 1;
974
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
975
+ advance();
976
+ state.start++;
977
+ count++;
978
+ }
979
+ if (count % 2 === 0) {
980
+ return false;
981
+ }
982
+ state.negated = true;
983
+ state.start++;
984
+ return true;
985
+ };
986
+ const increment = (type) => {
987
+ state[type]++;
988
+ stack.push(type);
989
+ };
990
+ const decrement = (type) => {
991
+ state[type]--;
992
+ stack.pop();
993
+ };
994
+ const push = (tok) => {
995
+ if (prev.type === "globstar") {
996
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
997
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
998
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
999
+ state.output = state.output.slice(0, -prev.output.length);
1000
+ prev.type = "star";
1001
+ prev.value = "*";
1002
+ prev.output = star;
1003
+ state.output += prev.output;
1004
+ }
1005
+ }
1006
+ if (extglobs.length && tok.type !== "paren") {
1007
+ extglobs[extglobs.length - 1].inner += tok.value;
1008
+ }
1009
+ if (tok.value || tok.output) append(tok);
1010
+ if (prev && prev.type === "text" && tok.type === "text") {
1011
+ prev.output = (prev.output || prev.value) + tok.value;
1012
+ prev.value += tok.value;
1013
+ return;
1014
+ }
1015
+ tok.prev = prev;
1016
+ tokens.push(tok);
1017
+ prev = tok;
1018
+ };
1019
+ const extglobOpen = (type, value2) => {
1020
+ const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
1021
+ token.prev = prev;
1022
+ token.parens = state.parens;
1023
+ token.output = state.output;
1024
+ token.startIndex = state.index;
1025
+ token.tokensIndex = tokens.length;
1026
+ const output = (opts.capture ? "(" : "") + token.open;
1027
+ increment("parens");
1028
+ push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
1029
+ push({ type: "paren", extglob: true, value: advance(), output });
1030
+ extglobs.push(token);
1031
+ };
1032
+ const extglobClose = (token) => {
1033
+ const literal = input.slice(token.startIndex, state.index + 1);
1034
+ const body = input.slice(token.startIndex + 2, state.index);
1035
+ const analysis = analyzeRepeatedExtglob(body, opts);
1036
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
1037
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
1038
+ const open = tokens[token.tokensIndex];
1039
+ open.type = "text";
1040
+ open.value = literal;
1041
+ open.output = safeOutput || utils.escapeRegex(literal);
1042
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
1043
+ tokens[i].value = "";
1044
+ tokens[i].output = "";
1045
+ delete tokens[i].suffix;
1046
+ }
1047
+ state.output = token.output + open.output;
1048
+ state.backtrack = true;
1049
+ push({ type: "paren", extglob: true, value, output: "" });
1050
+ decrement("parens");
1051
+ return;
1052
+ }
1053
+ let output = token.close + (opts.capture ? ")" : "");
1054
+ let rest;
1055
+ if (token.type === "negate") {
1056
+ let extglobStar = star;
1057
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
1058
+ extglobStar = globstar(opts);
1059
+ }
1060
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
1061
+ output = token.close = `)$))${extglobStar}`;
1062
+ }
1063
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
1064
+ const expression = parse(rest, { ...options, fastpaths: false }).output;
1065
+ output = token.close = `)${expression})${extglobStar})`;
1066
+ }
1067
+ if (token.prev.type === "bos") {
1068
+ state.negatedExtglob = true;
1069
+ }
1070
+ }
1071
+ push({ type: "paren", extglob: true, value, output });
1072
+ decrement("parens");
1073
+ };
1074
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
1075
+ let backslashes = false;
1076
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
1077
+ if (first === "\\") {
1078
+ backslashes = true;
1079
+ return m;
1080
+ }
1081
+ if (first === "?") {
1082
+ if (esc) {
1083
+ return esc + first + (rest ? QMARK.repeat(rest.length) : "");
1084
+ }
1085
+ if (index === 0) {
1086
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
1087
+ }
1088
+ return QMARK.repeat(chars.length);
1089
+ }
1090
+ if (first === ".") {
1091
+ return DOT_LITERAL.repeat(chars.length);
1092
+ }
1093
+ if (first === "*") {
1094
+ if (esc) {
1095
+ return esc + first + (rest ? star : "");
1096
+ }
1097
+ return star;
1098
+ }
1099
+ return esc ? m : `\\${m}`;
1100
+ });
1101
+ if (backslashes === true) {
1102
+ if (opts.unescape === true) {
1103
+ output = output.replace(/\\/g, "");
1104
+ } else {
1105
+ output = output.replace(/\\+/g, (m) => {
1106
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
1107
+ });
1108
+ }
1109
+ }
1110
+ if (output === input && opts.contains === true) {
1111
+ state.output = input;
1112
+ return state;
1113
+ }
1114
+ state.output = utils.wrapOutput(output, state, options);
1115
+ return state;
1116
+ }
1117
+ while (!eos()) {
1118
+ value = advance();
1119
+ if (value === "\0") {
1120
+ continue;
1121
+ }
1122
+ if (value === "\\") {
1123
+ const next = peek();
1124
+ if (next === "/" && opts.bash !== true) {
1125
+ continue;
1126
+ }
1127
+ if (next === "." || next === ";") {
1128
+ continue;
1129
+ }
1130
+ if (!next) {
1131
+ value += "\\";
1132
+ push({ type: "text", value });
1133
+ continue;
1134
+ }
1135
+ const match = /^\\+/.exec(remaining());
1136
+ let slashes = 0;
1137
+ if (match && match[0].length > 2) {
1138
+ slashes = match[0].length;
1139
+ state.index += slashes;
1140
+ if (slashes % 2 !== 0) {
1141
+ value += "\\";
1142
+ }
1143
+ }
1144
+ if (opts.unescape === true) {
1145
+ value = advance();
1146
+ } else {
1147
+ value += advance();
1148
+ }
1149
+ if (state.brackets === 0) {
1150
+ push({ type: "text", value });
1151
+ continue;
1152
+ }
1153
+ }
1154
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
1155
+ if (opts.posix !== false && value === ":") {
1156
+ const inner = prev.value.slice(1);
1157
+ if (inner.includes("[")) {
1158
+ prev.posix = true;
1159
+ if (inner.includes(":")) {
1160
+ const idx = prev.value.lastIndexOf("[");
1161
+ const pre = prev.value.slice(0, idx);
1162
+ const rest2 = prev.value.slice(idx + 2);
1163
+ const posix = POSIX_REGEX_SOURCE[rest2];
1164
+ if (posix) {
1165
+ prev.value = pre + posix;
1166
+ state.backtrack = true;
1167
+ advance();
1168
+ if (!bos.output && tokens.indexOf(prev) === 1) {
1169
+ bos.output = ONE_CHAR;
1170
+ }
1171
+ continue;
1172
+ }
1173
+ }
1174
+ }
1175
+ }
1176
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
1177
+ value = `\\${value}`;
1178
+ }
1179
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
1180
+ value = `\\${value}`;
1181
+ }
1182
+ if (opts.posix === true && value === "!" && prev.value === "[") {
1183
+ value = "^";
1184
+ }
1185
+ prev.value += value;
1186
+ append({ value });
1187
+ continue;
1188
+ }
1189
+ if (state.quotes === 1 && value !== '"') {
1190
+ value = utils.escapeRegex(value);
1191
+ prev.value += value;
1192
+ append({ value });
1193
+ continue;
1194
+ }
1195
+ if (value === '"') {
1196
+ state.quotes = state.quotes === 1 ? 0 : 1;
1197
+ if (opts.keepQuotes === true) {
1198
+ push({ type: "text", value });
1199
+ }
1200
+ continue;
1201
+ }
1202
+ if (value === "(") {
1203
+ increment("parens");
1204
+ push({ type: "paren", value });
1205
+ continue;
1206
+ }
1207
+ if (value === ")") {
1208
+ if (state.parens === 0 && opts.strictBrackets === true) {
1209
+ throw new SyntaxError(syntaxError("opening", "("));
1210
+ }
1211
+ const extglob = extglobs[extglobs.length - 1];
1212
+ if (extglob && state.parens === extglob.parens + 1) {
1213
+ extglobClose(extglobs.pop());
1214
+ continue;
1215
+ }
1216
+ push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
1217
+ decrement("parens");
1218
+ continue;
1219
+ }
1220
+ if (value === "[") {
1221
+ if (opts.nobracket === true || !remaining().includes("]")) {
1222
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
1223
+ throw new SyntaxError(syntaxError("closing", "]"));
1224
+ }
1225
+ value = `\\${value}`;
1226
+ } else {
1227
+ increment("brackets");
1228
+ }
1229
+ push({ type: "bracket", value });
1230
+ continue;
1231
+ }
1232
+ if (value === "]") {
1233
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
1234
+ push({ type: "text", value, output: `\\${value}` });
1235
+ continue;
1236
+ }
1237
+ if (state.brackets === 0) {
1238
+ if (opts.strictBrackets === true) {
1239
+ throw new SyntaxError(syntaxError("opening", "["));
1240
+ }
1241
+ push({ type: "text", value, output: `\\${value}` });
1242
+ continue;
1243
+ }
1244
+ decrement("brackets");
1245
+ const prevValue = prev.value.slice(1);
1246
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
1247
+ value = `/${value}`;
1248
+ }
1249
+ prev.value += value;
1250
+ append({ value });
1251
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
1252
+ continue;
1253
+ }
1254
+ const escaped = utils.escapeRegex(prev.value);
1255
+ state.output = state.output.slice(0, -prev.value.length);
1256
+ if (opts.literalBrackets === true) {
1257
+ state.output += escaped;
1258
+ prev.value = escaped;
1259
+ continue;
1260
+ }
1261
+ prev.value = `(${capture}${escaped}|${prev.value})`;
1262
+ state.output += prev.value;
1263
+ continue;
1264
+ }
1265
+ if (value === "{" && opts.nobrace !== true) {
1266
+ increment("braces");
1267
+ const open = {
1268
+ type: "brace",
1269
+ value,
1270
+ output: "(",
1271
+ outputIndex: state.output.length,
1272
+ tokensIndex: state.tokens.length
1273
+ };
1274
+ braces.push(open);
1275
+ push(open);
1276
+ continue;
1277
+ }
1278
+ if (value === "}") {
1279
+ const brace = braces[braces.length - 1];
1280
+ if (opts.nobrace === true || !brace) {
1281
+ push({ type: "text", value, output: value });
1282
+ continue;
1283
+ }
1284
+ let output = ")";
1285
+ if (brace.dots === true) {
1286
+ const arr = tokens.slice();
1287
+ const range = [];
1288
+ for (let i = arr.length - 1; i >= 0; i--) {
1289
+ tokens.pop();
1290
+ if (arr[i].type === "brace") {
1291
+ break;
1292
+ }
1293
+ if (arr[i].type !== "dots") {
1294
+ range.unshift(arr[i].value);
1295
+ }
1296
+ }
1297
+ output = expandRange(range, opts);
1298
+ state.backtrack = true;
1299
+ }
1300
+ if (brace.comma !== true && brace.dots !== true) {
1301
+ const out = state.output.slice(0, brace.outputIndex);
1302
+ const toks = state.tokens.slice(brace.tokensIndex);
1303
+ brace.value = brace.output = "\\{";
1304
+ value = output = "\\}";
1305
+ state.output = out;
1306
+ for (const t of toks) {
1307
+ state.output += t.output || t.value;
1308
+ }
1309
+ }
1310
+ push({ type: "brace", value, output });
1311
+ decrement("braces");
1312
+ braces.pop();
1313
+ continue;
1314
+ }
1315
+ if (value === "|") {
1316
+ if (extglobs.length > 0) {
1317
+ extglobs[extglobs.length - 1].conditions++;
1318
+ }
1319
+ push({ type: "text", value });
1320
+ continue;
1321
+ }
1322
+ if (value === ",") {
1323
+ let output = value;
1324
+ const brace = braces[braces.length - 1];
1325
+ if (brace && stack[stack.length - 1] === "braces") {
1326
+ brace.comma = true;
1327
+ output = "|";
1328
+ }
1329
+ push({ type: "comma", value, output });
1330
+ continue;
1331
+ }
1332
+ if (value === "/") {
1333
+ if (prev.type === "dot" && state.index === state.start + 1) {
1334
+ state.start = state.index + 1;
1335
+ state.consumed = "";
1336
+ state.output = "";
1337
+ tokens.pop();
1338
+ prev = bos;
1339
+ continue;
1340
+ }
1341
+ push({ type: "slash", value, output: SLASH_LITERAL });
1342
+ continue;
1343
+ }
1344
+ if (value === ".") {
1345
+ if (state.braces > 0 && prev.type === "dot") {
1346
+ if (prev.value === ".") prev.output = DOT_LITERAL;
1347
+ const brace = braces[braces.length - 1];
1348
+ prev.type = "dots";
1349
+ prev.output += value;
1350
+ prev.value += value;
1351
+ brace.dots = true;
1352
+ continue;
1353
+ }
1354
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1355
+ push({ type: "text", value, output: DOT_LITERAL });
1356
+ continue;
1357
+ }
1358
+ push({ type: "dot", value, output: DOT_LITERAL });
1359
+ continue;
1360
+ }
1361
+ if (value === "?") {
1362
+ const isGroup = prev && prev.value === "(";
1363
+ if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1364
+ extglobOpen("qmark", value);
1365
+ continue;
1366
+ }
1367
+ if (prev && prev.type === "paren") {
1368
+ const next = peek();
1369
+ let output = value;
1370
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
1371
+ output = `\\${value}`;
1372
+ }
1373
+ push({ type: "text", value, output });
1374
+ continue;
1375
+ }
1376
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1377
+ push({ type: "qmark", value, output: QMARK_NO_DOT });
1378
+ continue;
1379
+ }
1380
+ push({ type: "qmark", value, output: QMARK });
1381
+ continue;
1382
+ }
1383
+ if (value === "!") {
1384
+ if (opts.noextglob !== true && peek() === "(") {
1385
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1386
+ extglobOpen("negate", value);
1387
+ continue;
1388
+ }
1389
+ }
1390
+ if (opts.nonegate !== true && state.index === 0) {
1391
+ negate();
1392
+ continue;
1393
+ }
1394
+ }
1395
+ if (value === "+") {
1396
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1397
+ extglobOpen("plus", value);
1398
+ continue;
1399
+ }
1400
+ if (prev && prev.value === "(" || opts.regex === false) {
1401
+ push({ type: "plus", value, output: PLUS_LITERAL });
1402
+ continue;
1403
+ }
1404
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1405
+ push({ type: "plus", value });
1406
+ continue;
1407
+ }
1408
+ push({ type: "plus", value: PLUS_LITERAL });
1409
+ continue;
1410
+ }
1411
+ if (value === "@") {
1412
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1413
+ push({ type: "at", extglob: true, value, output: "" });
1414
+ continue;
1415
+ }
1416
+ push({ type: "text", value });
1417
+ continue;
1418
+ }
1419
+ if (value !== "*") {
1420
+ if (value === "$" || value === "^") {
1421
+ value = `\\${value}`;
1422
+ }
1423
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1424
+ if (match) {
1425
+ value += match[0];
1426
+ state.index += match[0].length;
1427
+ }
1428
+ push({ type: "text", value });
1429
+ continue;
1430
+ }
1431
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
1432
+ prev.type = "star";
1433
+ prev.star = true;
1434
+ prev.value += value;
1435
+ prev.output = star;
1436
+ state.backtrack = true;
1437
+ state.globstar = true;
1438
+ consume(value);
1439
+ continue;
1440
+ }
1441
+ let rest = remaining();
1442
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1443
+ extglobOpen("star", value);
1444
+ continue;
1445
+ }
1446
+ if (prev.type === "star") {
1447
+ if (opts.noglobstar === true) {
1448
+ consume(value);
1449
+ continue;
1450
+ }
1451
+ const prior = prev.prev;
1452
+ const before = prior.prev;
1453
+ const isStart = prior.type === "slash" || prior.type === "bos";
1454
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
1455
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1456
+ push({ type: "star", value, output: "" });
1457
+ continue;
1458
+ }
1459
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1460
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1461
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1462
+ push({ type: "star", value, output: "" });
1463
+ continue;
1464
+ }
1465
+ while (rest.slice(0, 3) === "/**") {
1466
+ const after = input[state.index + 4];
1467
+ if (after && after !== "/") {
1468
+ break;
1469
+ }
1470
+ rest = rest.slice(3);
1471
+ consume("/**", 3);
1472
+ }
1473
+ const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
1474
+ if (prior.type === "bos" && eos()) {
1475
+ prev.type = "globstar";
1476
+ prev.value += value;
1477
+ prev.output = globstar(opts);
1478
+ state.output = prev.output;
1479
+ state.globstar = true;
1480
+ consume(value);
1481
+ continue;
1482
+ }
1483
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
1484
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1485
+ prior.output = `(?:${prior.output}`;
1486
+ prev.type = "globstar";
1487
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1488
+ prev.value += value;
1489
+ state.globstar = true;
1490
+ state.output += prior.output + prev.output;
1491
+ consume(value);
1492
+ continue;
1493
+ }
1494
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1495
+ const end = rest[1] !== void 0 ? "|$" : "";
1496
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1497
+ prior.output = `(?:${prior.output}`;
1498
+ prev.type = "globstar";
1499
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1500
+ prev.value += value;
1501
+ state.output += prior.output + prev.output;
1502
+ state.globstar = true;
1503
+ consume(value + advance());
1504
+ push({ type: "slash", value: "/", output: "" });
1505
+ continue;
1506
+ }
1507
+ if (prior.type === "bos" && rest[0] === "/") {
1508
+ prev.type = "globstar";
1509
+ prev.value += value;
1510
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1511
+ state.output = prev.output;
1512
+ state.globstar = true;
1513
+ consume(value + advance());
1514
+ push({ type: "slash", value: "/", output: "" });
1515
+ continue;
1516
+ }
1517
+ state.output = state.output.slice(0, -prev.output.length);
1518
+ prev.type = "globstar";
1519
+ prev.output = globstar(opts);
1520
+ prev.value += value;
1521
+ state.output += prev.output;
1522
+ state.globstar = true;
1523
+ consume(value);
1524
+ continue;
1525
+ }
1526
+ const token = { type: "star", value, output: star };
1527
+ if (opts.bash === true) {
1528
+ token.output = ".*?";
1529
+ if (prev.type === "bos" || prev.type === "slash") {
1530
+ token.output = nodot + token.output;
1531
+ }
1532
+ push(token);
1533
+ continue;
1534
+ }
1535
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1536
+ token.output = value;
1537
+ push(token);
1538
+ continue;
1539
+ }
1540
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1541
+ if (prev.type === "dot") {
1542
+ state.output += NO_DOT_SLASH;
1543
+ prev.output += NO_DOT_SLASH;
1544
+ } else if (opts.dot === true) {
1545
+ state.output += NO_DOTS_SLASH;
1546
+ prev.output += NO_DOTS_SLASH;
1547
+ } else {
1548
+ state.output += nodot;
1549
+ prev.output += nodot;
1550
+ }
1551
+ if (peek() !== "*") {
1552
+ state.output += ONE_CHAR;
1553
+ prev.output += ONE_CHAR;
1554
+ }
1555
+ }
1556
+ push(token);
1557
+ }
1558
+ while (state.brackets > 0) {
1559
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1560
+ state.output = utils.escapeLast(state.output, "[");
1561
+ decrement("brackets");
1562
+ }
1563
+ while (state.parens > 0) {
1564
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
1565
+ state.output = utils.escapeLast(state.output, "(");
1566
+ decrement("parens");
1567
+ }
1568
+ while (state.braces > 0) {
1569
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
1570
+ state.output = utils.escapeLast(state.output, "{");
1571
+ decrement("braces");
1572
+ }
1573
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
1574
+ push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
1575
+ }
1576
+ if (state.backtrack === true) {
1577
+ state.output = "";
1578
+ for (const token of state.tokens) {
1579
+ state.output += token.output != null ? token.output : token.value;
1580
+ if (token.suffix) {
1581
+ state.output += token.suffix;
1582
+ }
1583
+ }
1584
+ }
1585
+ return state;
1586
+ };
1587
+ parse.fastpaths = (input, options) => {
1588
+ const opts = { ...options };
1589
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1590
+ const len = input.length;
1591
+ if (len > max) {
1592
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1593
+ }
1594
+ input = REPLACEMENTS[input] || input;
1595
+ const {
1596
+ DOT_LITERAL,
1597
+ SLASH_LITERAL,
1598
+ ONE_CHAR,
1599
+ DOTS_SLASH,
1600
+ NO_DOT,
1601
+ NO_DOTS,
1602
+ NO_DOTS_SLASH,
1603
+ STAR,
1604
+ START_ANCHOR
1605
+ } = constants.globChars(opts.windows);
1606
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
1607
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1608
+ const capture = opts.capture ? "" : "?:";
1609
+ const state = { negated: false, prefix: "" };
1610
+ let star = opts.bash === true ? ".*?" : STAR;
1611
+ if (opts.capture) {
1612
+ star = `(${star})`;
1613
+ }
1614
+ const globstar = (opts2) => {
1615
+ if (opts2.noglobstar === true) return star;
1616
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1617
+ };
1618
+ const create = (str) => {
1619
+ switch (str) {
1620
+ case "*":
1621
+ return `${nodot}${ONE_CHAR}${star}`;
1622
+ case ".*":
1623
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1624
+ case "*.*":
1625
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1626
+ case "*/*":
1627
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1628
+ case "**":
1629
+ return nodot + globstar(opts);
1630
+ case "**/*":
1631
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1632
+ case "**/*.*":
1633
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1634
+ case "**/.*":
1635
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1636
+ default: {
1637
+ const match = /^(.*?)\.(\w+)$/.exec(str);
1638
+ if (!match) return;
1639
+ const source2 = create(match[1]);
1640
+ if (!source2) return;
1641
+ return source2 + DOT_LITERAL + match[2];
1642
+ }
1643
+ }
1644
+ };
1645
+ const output = utils.removePrefix(input, state);
1646
+ let source = create(output);
1647
+ if (source && opts.strictSlashes !== true) {
1648
+ source += `${SLASH_LITERAL}?`;
1649
+ }
1650
+ return source;
1651
+ };
1652
+ module2.exports = parse;
1653
+ }
1654
+ });
1655
+
1656
+ // node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
1657
+ var require_picomatch = __commonJS({
1658
+ "node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
1659
+ "use strict";
1660
+ var scan = require_scan();
1661
+ var parse = require_parse();
1662
+ var utils = require_utils();
1663
+ var constants = require_constants();
1664
+ var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
1665
+ var picomatch = (glob, options, returnState = false) => {
1666
+ if (Array.isArray(glob)) {
1667
+ const fns = glob.map((input) => picomatch(input, options, returnState));
1668
+ const arrayMatcher = (str) => {
1669
+ for (const isMatch of fns) {
1670
+ const state2 = isMatch(str);
1671
+ if (state2) return state2;
1672
+ }
1673
+ return false;
1674
+ };
1675
+ return arrayMatcher;
1676
+ }
1677
+ const isState = isObject(glob) && glob.tokens && glob.input;
1678
+ if (glob === "" || typeof glob !== "string" && !isState) {
1679
+ throw new TypeError("Expected pattern to be a non-empty string");
1680
+ }
1681
+ const opts = options || {};
1682
+ const posix = opts.windows;
1683
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
1684
+ const state = regex.state;
1685
+ delete regex.state;
1686
+ let isIgnored = () => false;
1687
+ if (opts.ignore) {
1688
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
1689
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1690
+ }
1691
+ const matcher = (input, returnObject = false) => {
1692
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
1693
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
1694
+ if (typeof opts.onResult === "function") {
1695
+ opts.onResult(result);
1696
+ }
1697
+ if (isMatch === false) {
1698
+ result.isMatch = false;
1699
+ return returnObject ? result : false;
1700
+ }
1701
+ if (isIgnored(input)) {
1702
+ if (typeof opts.onIgnore === "function") {
1703
+ opts.onIgnore(result);
1704
+ }
1705
+ result.isMatch = false;
1706
+ return returnObject ? result : false;
1707
+ }
1708
+ if (typeof opts.onMatch === "function") {
1709
+ opts.onMatch(result);
1710
+ }
1711
+ return returnObject ? result : true;
1712
+ };
1713
+ if (returnState) {
1714
+ matcher.state = state;
1715
+ }
1716
+ return matcher;
1717
+ };
1718
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
1719
+ if (typeof input !== "string") {
1720
+ throw new TypeError("Expected input to be a string");
1721
+ }
1722
+ if (input === "") {
1723
+ return { isMatch: false, output: "" };
1724
+ }
1725
+ const opts = options || {};
1726
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
1727
+ let match = input === glob;
1728
+ let output = match && format ? format(input) : input;
1729
+ if (match === false) {
1730
+ output = format ? format(input) : input;
1731
+ match = output === glob;
1732
+ }
1733
+ if (match === false || opts.capture === true) {
1734
+ if (opts.matchBase === true || opts.basename === true) {
1735
+ match = picomatch.matchBase(input, regex, options, posix);
1736
+ } else {
1737
+ match = regex.exec(output);
1738
+ }
1739
+ }
1740
+ return { isMatch: Boolean(match), match, output };
1741
+ };
1742
+ picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
1743
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
1744
+ return regex.test(utils.basename(input, { windows: posix }));
1745
+ };
1746
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
1747
+ picomatch.parse = (pattern, options) => {
1748
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
1749
+ return parse(pattern, { ...options, fastpaths: false });
1750
+ };
1751
+ picomatch.scan = (input, options) => scan(input, options);
1752
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
1753
+ if (returnOutput === true) {
1754
+ return state.output;
1755
+ }
1756
+ const opts = options || {};
1757
+ const prepend = opts.contains ? "" : "^";
1758
+ const append = opts.contains ? "" : "$";
1759
+ let source = `${prepend}(?:${state.output})${append}`;
1760
+ if (state && state.negated === true) {
1761
+ source = `^(?!${source}).*$`;
1762
+ }
1763
+ const regex = picomatch.toRegex(source, options);
1764
+ if (returnState === true) {
1765
+ regex.state = state;
1766
+ }
1767
+ return regex;
1768
+ };
1769
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1770
+ if (!input || typeof input !== "string") {
1771
+ throw new TypeError("Expected a non-empty string");
1772
+ }
1773
+ let parsed = { negated: false, fastpaths: true };
1774
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
1775
+ parsed.output = parse.fastpaths(input, options);
1776
+ }
1777
+ if (!parsed.output) {
1778
+ parsed = parse(input, options);
1779
+ }
1780
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
1781
+ };
1782
+ picomatch.toRegex = (source, options) => {
1783
+ try {
1784
+ const opts = options || {};
1785
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1786
+ } catch (err) {
1787
+ if (options && options.debug === true) throw err;
1788
+ return /$^/;
1789
+ }
1790
+ };
1791
+ picomatch.constants = constants;
1792
+ module2.exports = picomatch;
1793
+ }
1794
+ });
1795
+
1796
+ // node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/index.js
1797
+ var require_picomatch2 = __commonJS({
1798
+ "node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/index.js"(exports2, module2) {
1799
+ "use strict";
1800
+ var pico = require_picomatch();
1801
+ var utils = require_utils();
1802
+ function picomatch(glob, options, returnState = false) {
1803
+ if (options && (options.windows === null || options.windows === void 0)) {
1804
+ options = { ...options, windows: utils.isWindows() };
1805
+ }
1806
+ return pico(glob, options, returnState);
1807
+ }
1808
+ Object.assign(picomatch, pico);
1809
+ module2.exports = picomatch;
1810
+ }
1811
+ });
1812
+
1813
+ // node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.7/node_modules/fdir/dist/index.cjs
38
1814
  var require_dist = __commonJS({
39
- "node_modules/.pnpm/fdir@6.5.0/node_modules/fdir/dist/index.cjs"(exports2) {
1815
+ "node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.7/node_modules/fdir/dist/index.cjs"(exports2) {
40
1816
  var __create2 = Object.create;
41
1817
  var __defProp2 = Object.defineProperty;
42
1818
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -174,10 +1950,10 @@ var require_dist = __commonJS({
174
1950
  queue.enqueue();
175
1951
  fs$1.realpath(path$1, (error, resolvedPath) => {
176
1952
  if (error) return queue.dequeue(suppressErrors ? null : error, state);
177
- fs$1.stat(resolvedPath, (error$1, stat) => {
1953
+ fs$1.stat(resolvedPath, (error$1, stat2) => {
178
1954
  if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
179
- if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
180
- callback$1(stat, resolvedPath);
1955
+ if (stat2.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
1956
+ callback$1(stat2, resolvedPath);
181
1957
  queue.dequeue(null, state);
182
1958
  });
183
1959
  });
@@ -187,9 +1963,9 @@ var require_dist = __commonJS({
187
1963
  queue.enqueue();
188
1964
  try {
189
1965
  const resolvedPath = fs$1.realpathSync(path$1);
190
- const stat = fs$1.statSync(resolvedPath);
191
- if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
192
- callback$1(stat, resolvedPath);
1966
+ const stat2 = fs$1.statSync(resolvedPath);
1967
+ if (stat2.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
1968
+ callback$1(stat2, resolvedPath);
193
1969
  } catch (e) {
194
1970
  if (!suppressErrors) throw e;
195
1971
  }
@@ -386,8 +2162,8 @@ var require_dist = __commonJS({
386
2162
  this.walkDirectory(this.state, path$1, path$1, depth - 1, this.walk);
387
2163
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
388
2164
  let path$1 = joinPathWithBasePath(entry.name, directoryPath);
389
- this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
390
- if (stat.isDirectory()) {
2165
+ this.resolveSymlink(path$1, this.state, (stat2, resolvedPath) => {
2166
+ if (stat2.isDirectory()) {
391
2167
  resolvedPath = normalizePath(resolvedPath, this.state.options);
392
2168
  if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
393
2169
  this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth - 1, this.walk);
@@ -438,7 +2214,7 @@ var require_dist = __commonJS({
438
2214
  var pm = null;
439
2215
  try {
440
2216
  require.resolve("picomatch");
441
- pm = require("picomatch");
2217
+ pm = require_picomatch2();
442
2218
  } catch {
443
2219
  }
444
2220
  var Builder = class {
@@ -1422,19 +3198,23 @@ __export(index_exports, {
1422
3198
  module.exports = __toCommonJS(index_exports);
1423
3199
 
1424
3200
  // src/engine.ts
1425
- var import_node_fs3 = require("node:fs");
1426
- var import_node_path2 = require("node:path");
3201
+ var import_node_fs4 = require("node:fs");
3202
+ var import_node_path3 = require("node:path");
3203
+ var import_node_process2 = require("node:process");
1427
3204
  var import_fdir = __toESM(require_dist(), 1);
1428
3205
 
1429
3206
  // src/cascade.ts
1430
3207
  var import_node_fs = require("node:fs");
1431
- function readGitignoreText(dirPath) {
3208
+ function readIgnoreFileText(dirPath, filename) {
1432
3209
  try {
1433
- return (0, import_node_fs.readFileSync)(`${dirPath.replace(/\/+$/, "")}/.gitignore`, "utf8");
3210
+ return (0, import_node_fs.readFileSync)(`${dirPath.replace(/\/+$/, "")}/${filename}`, "utf8");
1434
3211
  } catch {
1435
3212
  return null;
1436
3213
  }
1437
3214
  }
3215
+ function readGitignoreText(dirPath) {
3216
+ return readIgnoreFileText(dirPath, ".gitignore");
3217
+ }
1438
3218
  function splitLines(text) {
1439
3219
  return text.split(/\r?\n/);
1440
3220
  }
@@ -1450,7 +3230,7 @@ function reanchorLine(line, prefix) {
1450
3230
 
1451
3231
  // src/exclusion-engine.ts
1452
3232
  var import_node_fs2 = require("node:fs");
1453
- var import_node_path = require("node:path");
3233
+ var import_node_path2 = require("node:path");
1454
3234
  var import_ignore = __toESM(require_ignore(), 1);
1455
3235
 
1456
3236
  // src/presets.ts
@@ -1558,10 +3338,64 @@ var PathscopeGitError = class extends Error {
1558
3338
  }
1559
3339
  };
1560
3340
 
3341
+ // src/win-attr.ts
3342
+ var import_node_module = require("node:module");
3343
+ var import_node_path = require("node:path");
3344
+ var import_node_process = require("node:process");
3345
+ var import_meta = {};
3346
+ var cached;
3347
+ function requireForThisFile() {
3348
+ if (typeof __filename === "string" && (0, import_node_path.isAbsolute)(__filename)) return (0, import_node_module.createRequire)(__filename);
3349
+ return (0, import_node_module.createRequire)(import_meta.url);
3350
+ }
3351
+ var PREBUILD_CANDIDATES = [
3352
+ "../prebuilds/win32-x64/pathscope_win_attr.node",
3353
+ "../../prebuilds/win32-x64/pathscope_win_attr.node"
3354
+ ];
3355
+ function loadWinAttr() {
3356
+ if (cached !== void 0) return cached;
3357
+ cached = null;
3358
+ if (import_node_process.platform === "win32") {
3359
+ let require2;
3360
+ try {
3361
+ require2 = requireForThisFile();
3362
+ } catch {
3363
+ return cached;
3364
+ }
3365
+ for (const candidate of PREBUILD_CANDIDATES) {
3366
+ try {
3367
+ const mod = require2(candidate);
3368
+ if (typeof mod.getHidden === "function" && typeof mod.readdirWithAttrs === "function" && typeof mod.readdirWithAttrsSync === "function") {
3369
+ cached = mod;
3370
+ break;
3371
+ }
3372
+ } catch {
3373
+ }
3374
+ }
3375
+ }
3376
+ return cached;
3377
+ }
3378
+ function hiddenFaceDiagnostic(excludeDotEntriesOn, addonAvailable, isWin) {
3379
+ if (!isWin || !excludeDotEntriesOn || addonAvailable) return null;
3380
+ return {
3381
+ code: "windows-hidden-attributes-unavailable",
3382
+ message: "the Windows hidden-attribute face of the dot category is inert this run (native prebuild not loaded): attribute-hidden, dot-less entries are NOT pruned \u2014 never a silent cut; install integrity or the package tarball is the first suspect"
3383
+ };
3384
+ }
3385
+
1561
3386
  // src/exclusion-engine.ts
1562
3387
  var nodeExclusionIO = {
1563
- exists: (dirKey, name) => Promise.resolve((0, import_node_fs2.existsSync)((0, import_node_path.join)(dirKey, ...name.split("/")))),
1564
- readGitignore: (dirKey) => Promise.resolve(readGitignoreText(dirKey))
3388
+ exists: (dirKey, name) => Promise.resolve((0, import_node_fs2.existsSync)((0, import_node_path2.join)(dirKey, ...name.split("/")))),
3389
+ readGitignore: (dirKey) => Promise.resolve(readGitignoreText(dirKey)),
3390
+ readIgnoreFamily: (dirKey) => Promise.resolve({
3391
+ ignore: readIgnoreFileText(dirKey, ".ignore"),
3392
+ rgignore: readIgnoreFileText(dirKey, ".rgignore")
3393
+ }),
3394
+ hidden: (dirKey, name) => {
3395
+ const winAttr = loadWinAttr();
3396
+ if (winAttr === null) return Promise.resolve(null);
3397
+ return Promise.resolve(winAttr.getHidden((0, import_node_path2.join)(dirKey, ...name.split("/"))) === 1);
3398
+ }
1565
3399
  };
1566
3400
  function validateOptions(options) {
1567
3401
  if (options.mountPresets !== void 0) {
@@ -1634,18 +3468,20 @@ function parentDirKey(key) {
1634
3468
  async function createExclusionEngine(rootKey, options = {}, io = nodeExclusionIO) {
1635
3469
  validateOptions(options);
1636
3470
  const respectGitignore = options.respectGitignore !== false;
3471
+ const respectIgnoreFamily = options.respectIgnoreFamily !== false;
1637
3472
  const asRule = (raw) => raw === "" || raw.startsWith("#") || raw === "!" ? null : raw;
1638
3473
  const ruleIg = (mounted) => {
1639
3474
  const ig = (0, import_ignore.default)();
1640
3475
  ig.add([mounted]);
1641
3476
  return ig;
1642
3477
  };
1643
- const gitignoreRules = (lines, anchor, prefix) => {
3478
+ const gitignoreRules = (lines, anchor, prefix) => ignoreFileRules(lines, anchor, prefix, "gitignore");
3479
+ const ignoreFileRules = (lines, anchor, prefix, source, ignoreFile) => {
1644
3480
  const out = [];
1645
3481
  for (const raw of lines) {
1646
3482
  const mounted = prefix === "" ? asRule(raw) : reanchorLine(raw, prefix);
1647
3483
  if (mounted === null) continue;
1648
- out.push({ mounted, original: raw, source: "gitignore", gitignoreAnchor: anchor, ig: ruleIg(mounted) });
3484
+ out.push({ mounted, original: raw, source, gitignoreAnchor: anchor, ...ignoreFile !== void 0 ? { ignoreFile } : {}, ig: ruleIg(mounted) });
1649
3485
  }
1650
3486
  return out;
1651
3487
  };
@@ -1657,6 +3493,7 @@ async function createExclusionEngine(rootKey, options = {}, io = nodeExclusionIO
1657
3493
  const hit = { source: r.source, ruleText: r.original };
1658
3494
  if (r.presetName !== void 0) hit.presetName = r.presetName;
1659
3495
  if (r.gitignoreAnchor !== void 0) hit.gitignoreAnchor = r.gitignoreAnchor;
3496
+ if (r.ignoreFile !== void 0) hit.ignoreFile = r.ignoreFile;
1660
3497
  hits.push(hit);
1661
3498
  }
1662
3499
  return hits;
@@ -1727,6 +3564,15 @@ async function createExclusionEngine(rootKey, options = {}, io = nodeExclusionIO
1727
3564
  if (rootIgnoreText !== null) {
1728
3565
  coreRules.push(...gitignoreRules(splitLines(rootIgnoreText), "", offRel));
1729
3566
  }
3567
+ if (respectIgnoreFamily && io.readIgnoreFamily !== void 0) {
3568
+ const family = await io.readIgnoreFamily(rootKey);
3569
+ if (family.ignore !== null) {
3570
+ coreRules.push(...ignoreFileRules(splitLines(family.ignore), "", offRel, "ignore", ".ignore"));
3571
+ }
3572
+ if (family.rgignore !== null) {
3573
+ coreRules.push(...ignoreFileRules(splitLines(family.rgignore), "", offRel, "ignore", ".rgignore"));
3574
+ }
3575
+ }
1730
3576
  if (coreRules.length > 0) core.add(coreRules.map((r) => r.mounted));
1731
3577
  const policy = (0, import_ignore.default)();
1732
3578
  const policyRules = [];
@@ -1799,82 +3645,109 @@ async function createExclusionEngine(rootKey, options = {}, io = nodeExclusionIO
1799
3645
  if (policyResult.unignored) return false;
1800
3646
  return core.test(canonical).ignored;
1801
3647
  };
1802
- const adjudicateDirectoryImpl = (name, dirPath, stoneHit) => {
3648
+ const runDirectoryVerdict = (name, dirPath, stoneHit, meta, hits) => {
1803
3649
  const key = dirPath.replace(/\/+$/, "");
1804
3650
  const relDir = key === rootKey ? "" : key.slice(rootKey.length + 1);
1805
- const hits = [];
1806
3651
  if (key !== rootKey) {
1807
- const stones = stoneHitEntries(stoneDetail(stoneHit, relDir));
1808
- hits.push(...stones);
1809
- if (stones.some((h) => h.enforced)) return { excluded: true, hits };
3652
+ const stones = stoneDetail(stoneHit, relDir);
3653
+ if (hits !== void 0) hits.push(...stoneHitEntries(stones));
3654
+ if (stones.some((h) => h.enforced)) return true;
1810
3655
  }
1811
3656
  const canonicalDir = toCanonical(`${relDir}/`);
1812
- hits.push(...channelHits(strictRules, canonicalDir));
1813
- if (strictIg.test(canonicalDir).ignored) return { excluded: true, hits };
3657
+ if (hits !== void 0) hits.push(...channelHits(strictRules, canonicalDir));
3658
+ if (strictIg.test(canonicalDir).ignored) return true;
1814
3659
  if (overrideIg.test(canonicalDir).ignored) {
1815
- hits.push(...channelHits(overrideRules, canonicalDir));
1816
- return { excluded: false, hits };
3660
+ if (hits !== void 0) hits.push(...channelHits(overrideRules, canonicalDir));
3661
+ return false;
3662
+ }
3663
+ if (hits !== void 0) {
3664
+ hits.push(...channelHits(coreRules, canonicalDir));
3665
+ hits.push(...channelHits(policyRules, canonicalDir));
1817
3666
  }
1818
- hits.push(...channelHits(coreRules, canonicalDir));
1819
- hits.push(...channelHits(policyRules, canonicalDir));
1820
3667
  const policyResult = policy.test(canonicalDir);
1821
- if (policyResult.ignored) return { excluded: true, hits };
3668
+ if (policyResult.ignored) return true;
1822
3669
  if (policyResult.unignored) {
1823
3670
  if (core.test(canonicalDir).ignored) {
1824
3671
  core.add(`!/${canonicalDir}`);
1825
3672
  }
1826
3673
  } else if (core.test(canonicalDir).ignored) {
1827
- return { excluded: true, hits };
3674
+ return true;
1828
3675
  }
1829
- if (excludeDotEntries && name.startsWith(".")) {
1830
- hits.push({ source: "dot" });
1831
- return { excluded: true, hits };
3676
+ if (excludeDotEntries) {
3677
+ const byName = name.startsWith(".");
3678
+ const byAttribute = !byName && meta?.hidden === true;
3679
+ if (byName || byAttribute) {
3680
+ if (hits !== void 0) hits.push({ source: "dot", via: byName ? "name" : "attribute" });
3681
+ return true;
3682
+ }
1832
3683
  }
1833
- return { excluded: false, hits };
3684
+ return false;
1834
3685
  };
1835
- const adjudicateFileImpl = (relPath) => {
3686
+ const runFileVerdict = (relPath, meta, hits) => {
1836
3687
  const canonical = toCanonical(relPath);
1837
- const hits = [];
1838
- hits.push(...channelHits(strictRules, canonical));
1839
- if (strictIg.test(canonical).ignored) return { admitted: false, hits };
3688
+ if (hits !== void 0) hits.push(...channelHits(strictRules, canonical));
3689
+ if (strictIg.test(canonical).ignored) return false;
1840
3690
  if (overrideIg.test(canonical).ignored) {
1841
- hits.push(...channelHits(overrideRules, canonical));
1842
- return { admitted: true, hits };
3691
+ if (hits !== void 0) hits.push(...channelHits(overrideRules, canonical));
3692
+ return true;
3693
+ }
3694
+ if (hits !== void 0) {
3695
+ hits.push(...channelHits(coreRules, canonical));
3696
+ hits.push(...channelHits(policyRules, canonical));
1843
3697
  }
1844
- hits.push(...channelHits(coreRules, canonical));
1845
- hits.push(...channelHits(policyRules, canonical));
1846
- if (combinedExcludes(canonical)) return { admitted: false, hits };
1847
- if (excludeDotEntries && baseNamePosix(relPath).startsWith(".")) {
1848
- hits.push({ source: "dot" });
1849
- return { admitted: false, hits };
3698
+ if (combinedExcludes(canonical)) return false;
3699
+ if (excludeDotEntries) {
3700
+ const byName = baseNamePosix(relPath).startsWith(".");
3701
+ const byAttribute = !byName && meta?.hidden === true;
3702
+ if (byName || byAttribute) {
3703
+ if (hits !== void 0) hits.push({ source: "dot", via: byName ? "name" : "attribute" });
3704
+ return false;
3705
+ }
3706
+ }
3707
+ return true;
3708
+ };
3709
+ const adjudicateDirectoryImpl = (name, dirPath, stoneHit, meta) => {
3710
+ const hits = [];
3711
+ const excluded = runDirectoryVerdict(name, dirPath, stoneHit, meta, hits);
3712
+ return { excluded, hits };
3713
+ };
3714
+ const adjudicateFileImpl = (relPath, meta) => {
3715
+ const hits = [];
3716
+ const admitted = runFileVerdict(relPath, meta, hits);
3717
+ return { admitted, hits };
3718
+ };
3719
+ const foldLayer = (dirPath, text, source, ignoreFile) => {
3720
+ if (text == null || (source === "gitignore" ? !respectGitignore : !respectIgnoreFamily)) return;
3721
+ const key = dirPath.replace(/\/+$/, "");
3722
+ if (key === rootKey) return;
3723
+ const relDir = key.slice(rootKey.length + 1);
3724
+ const rules = ignoreFileRules(splitLines(text), relDir, joinPosix(offRel, relDir), source, ignoreFile);
3725
+ if (rules.length > 0) {
3726
+ core.add(rules.map((r) => r.mounted));
3727
+ coreRules.push(...rules);
1850
3728
  }
1851
- return { admitted: true, hits };
1852
3729
  };
1853
3730
  return {
1854
3731
  rootKey,
1855
3732
  stoneNames,
1856
- excludeDirectory(name, dirPath, stoneHit) {
1857
- return adjudicateDirectoryImpl(name, dirPath, stoneHit).excluded;
3733
+ excludeDirectory(name, dirPath, stoneHit, meta) {
3734
+ return runDirectoryVerdict(name, dirPath, stoneHit, meta, void 0);
1858
3735
  },
1859
3736
  foldGitignore(dirPath, text) {
1860
- if (text == null || !respectGitignore) return;
1861
- const key = dirPath.replace(/\/+$/, "");
1862
- if (key === rootKey) return;
1863
- const relDir = key.slice(rootKey.length + 1);
1864
- const rules = gitignoreRules(splitLines(text), relDir, joinPosix(offRel, relDir));
1865
- if (rules.length > 0) {
1866
- core.add(rules.map((r) => r.mounted));
1867
- coreRules.push(...rules);
1868
- }
3737
+ foldLayer(dirPath, text, "gitignore");
1869
3738
  },
1870
- admitFile(relPath) {
1871
- return adjudicateFileImpl(relPath).admitted;
3739
+ foldIgnoreFamily(dirPath, texts) {
3740
+ foldLayer(dirPath, texts.ignore ?? null, "ignore", ".ignore");
3741
+ foldLayer(dirPath, texts.rgignore ?? null, "ignore", ".rgignore");
1872
3742
  },
1873
- adjudicateDirectory(name, dirPath, stoneHit) {
1874
- return adjudicateDirectoryImpl(name, dirPath, stoneHit);
3743
+ admitFile(relPath, meta) {
3744
+ return runFileVerdict(relPath, meta, void 0);
1875
3745
  },
1876
- adjudicateFile(relPath) {
1877
- return adjudicateFileImpl(relPath);
3746
+ adjudicateDirectory(name, dirPath, stoneHit, meta) {
3747
+ return adjudicateDirectoryImpl(name, dirPath, stoneHit, meta);
3748
+ },
3749
+ adjudicateFile(relPath, meta) {
3750
+ return adjudicateFileImpl(relPath, meta);
1878
3751
  },
1879
3752
  attributeStones(relDir, stoneHit) {
1880
3753
  if (relDir === "") return [];
@@ -1888,12 +3761,134 @@ async function createExclusionEngine(rootKey, options = {}, io = nodeExclusionIO
1888
3761
  };
1889
3762
  }
1890
3763
 
3764
+ // src/walk-links.ts
3765
+ var import_node_fs3 = require("node:fs");
3766
+ var nativeFs = __toESM(require("node:fs"), 1);
3767
+ function createLinkRecorder(base = nativeFs) {
3768
+ const recorded = /* @__PURE__ */ new Set();
3769
+ let rootForm = null;
3770
+ const observe = (crawlPath, entries) => {
3771
+ if (rootForm === null) rootForm = crawlPath;
3772
+ const out = [];
3773
+ for (const entry of entries) {
3774
+ let observed = entry;
3775
+ if (entry.isSymbolicLink()) {
3776
+ recorded.add(crawlPath.slice(rootForm.length) + entry.name);
3777
+ } else if (!entry.isFile() && !entry.isDirectory()) {
3778
+ observed = rescueUnknownType(crawlPath + entry.name, entry);
3779
+ if (observed !== entry && observed.isSymbolicLink()) {
3780
+ recorded.add(crawlPath.slice(rootForm.length) + entry.name);
3781
+ }
3782
+ }
3783
+ out.push(observed);
3784
+ }
3785
+ return out;
3786
+ };
3787
+ const readdir = ((crawlPath, opts, cb) => {
3788
+ base.readdir(crawlPath, opts, (err, entries) => {
3789
+ if (err) return cb(err);
3790
+ cb(null, observe(crawlPath, entries));
3791
+ });
3792
+ });
3793
+ const readdirSync = ((crawlPath, opts) => observe(crawlPath, base.readdirSync(crawlPath, opts)));
3794
+ return {
3795
+ fs: {
3796
+ readdir,
3797
+ readdirSync,
3798
+ realpath: base.realpath,
3799
+ realpathSync: base.realpathSync,
3800
+ stat: base.stat,
3801
+ statSync: base.statSync
3802
+ },
3803
+ links: recorded,
3804
+ observeDirents: observe
3805
+ };
3806
+ }
3807
+ function rescueUnknownType(walkPath, entry) {
3808
+ let stats;
3809
+ try {
3810
+ stats = (0, import_node_fs3.lstatSync)(walkPath);
3811
+ } catch {
3812
+ return entry;
3813
+ }
3814
+ if (stats.isSymbolicLink()) return direntFacade(entry.name, false, false, true);
3815
+ if (stats.isFile()) return direntFacade(entry.name, true, false, false);
3816
+ if (stats.isDirectory()) return direntFacade(entry.name, false, true, false);
3817
+ return entry;
3818
+ }
3819
+ function direntFacade(name, file, dir, link) {
3820
+ return { name, isFile: () => file, isDirectory: () => dir, isSymbolicLink: () => link };
3821
+ }
3822
+ function selectLinks(files, recorded) {
3823
+ return files.filter((rel) => recorded.has(rel));
3824
+ }
3825
+
3826
+ // src/walk-hidden.ts
3827
+ var nativeFs2 = __toESM(require("node:fs"), 1);
3828
+ var ATTR_HIDDEN = 2;
3829
+ var ATTR_DIRECTORY = 16;
3830
+ var ATTR_REPARSE_POINT = 1024;
3831
+ function createHiddenStashFs(winAttr) {
3832
+ const hiddenByDir = /* @__PURE__ */ new Map();
3833
+ const dirKeyOf = (crawlPath) => crawlPath.replace(/\/+$/, "");
3834
+ const facade = (name, attrs) => {
3835
+ const isLink = (attrs & ATTR_REPARSE_POINT) !== 0;
3836
+ const isDir = !isLink && (attrs & ATTR_DIRECTORY) !== 0;
3837
+ return {
3838
+ name,
3839
+ isFile: () => !isDir && !isLink,
3840
+ isDirectory: () => isDir,
3841
+ isSymbolicLink: () => isLink
3842
+ };
3843
+ };
3844
+ const observe = (crawlPath, names, attrs) => {
3845
+ const key = dirKeyOf(crawlPath);
3846
+ const out = [];
3847
+ for (let i = 0; i < names.length; i++) {
3848
+ if ((attrs[i] & ATTR_HIDDEN) !== 0) {
3849
+ let set = hiddenByDir.get(key);
3850
+ if (set === void 0) {
3851
+ set = /* @__PURE__ */ new Set();
3852
+ hiddenByDir.set(key, set);
3853
+ }
3854
+ set.add(names[i]);
3855
+ }
3856
+ out.push(facade(names[i], attrs[i]));
3857
+ }
3858
+ return out;
3859
+ };
3860
+ const readdir = ((crawlPath, opts, cb) => {
3861
+ winAttr.readdirWithAttrs(crawlPath, (err, names, attrs) => {
3862
+ if (err !== null) {
3863
+ cb(err);
3864
+ return;
3865
+ }
3866
+ cb(null, observe(crawlPath, names ?? [], attrs ?? []));
3867
+ });
3868
+ });
3869
+ const readdirSync = ((crawlPath, opts) => {
3870
+ const { names, attrs } = winAttr.readdirWithAttrsSync(crawlPath);
3871
+ return observe(crawlPath, names, attrs);
3872
+ });
3873
+ return {
3874
+ fs: {
3875
+ readdir,
3876
+ readdirSync,
3877
+ realpath: nativeFs2.realpath,
3878
+ realpathSync: nativeFs2.realpathSync,
3879
+ stat: nativeFs2.stat,
3880
+ statSync: nativeFs2.statSync
3881
+ },
3882
+ hiddenFor: (dirKey, name) => hiddenByDir.get(dirKey)?.has(name) === true ? true : void 0
3883
+ };
3884
+ }
3885
+
1891
3886
  // src/engine.ts
1892
3887
  var DEFAULT_MAX_FILES = 2e3;
1893
3888
  async function walkScope(root, options = {}) {
1894
3889
  validateOptions(options);
1895
- const rootNative = (0, import_node_path2.resolve)(root);
1896
- if (!(0, import_node_fs3.existsSync)(rootNative)) {
3890
+ const rootNative = (0, import_node_path3.resolve)(root);
3891
+ if (!(0, import_node_fs4.existsSync)(rootNative)) {
1897
3892
  throw new PathscopeConfigError(`scan root does not exist: ${rootNative}`);
1898
3893
  }
1899
3894
  const scanKey = rootNative.replace(/\\/g, "/");
@@ -1901,11 +3896,16 @@ async function walkScope(root, options = {}) {
1901
3896
  const stoneHits = (key) => {
1902
3897
  const hits = [];
1903
3898
  for (const name of engine.stoneNames) {
1904
- if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(key, ...name.split("/")))) hits.push(name);
3899
+ if ((0, import_node_fs4.existsSync)((0, import_node_path3.join)(key, ...name.split("/")))) hits.push(name);
1905
3900
  }
1906
3901
  return hits;
1907
3902
  };
1908
3903
  const diagnostics = [];
3904
+ const winAttr = options.excludeDotEntries === false ? null : loadWinAttr();
3905
+ const respectIgnoreFamily = options.respectIgnoreFamily !== false;
3906
+ const attrStash = winAttr === null ? null : createHiddenStashFs(winAttr);
3907
+ const degraded = hiddenFaceDiagnostic(options.excludeDotEntries !== false, attrStash !== null, import_node_process2.platform === "win32");
3908
+ if (degraded !== null) diagnostics.push(degraded);
1909
3909
  const stoneReport = [];
1910
3910
  const controller = new AbortController();
1911
3911
  const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
@@ -1922,13 +3922,23 @@ async function walkScope(root, options = {}) {
1922
3922
  }
1923
3923
  }
1924
3924
  }
1925
- if (engine.excludeDirectory(dirName, key, hits)) return true;
3925
+ const meta = attrStash !== null && !dirName.startsWith(".") && attrStash.hiddenFor(key.slice(0, key.lastIndexOf("/")), dirName) === true ? { hidden: true } : void 0;
3926
+ if (engine.excludeDirectory(dirName, key, hits, meta)) return true;
1926
3927
  engine.foldGitignore(key, readGitignoreText(key));
3928
+ if (respectIgnoreFamily) {
3929
+ engine.foldIgnoreFamily(key, {
3930
+ ignore: readIgnoreFileText(key, ".ignore"),
3931
+ rgignore: readIgnoreFileText(key, ".rgignore")
3932
+ });
3933
+ }
1927
3934
  return false;
1928
3935
  };
1929
3936
  const keepFile = (rel) => {
1930
3937
  if (budgetCut) return false;
1931
- if (!engine.admitFile(rel)) return false;
3938
+ const slash = rel.lastIndexOf("/");
3939
+ const name = slash === -1 ? rel : rel.slice(slash + 1);
3940
+ const fileMeta = attrStash !== null && !name.startsWith(".") && attrStash.hiddenFor(slash === -1 ? scanKey : `${scanKey}/${rel.slice(0, slash)}`, name) === true ? { hidden: true } : void 0;
3941
+ if (!engine.admitFile(rel, fileMeta)) return false;
1932
3942
  if (included >= maxFiles) {
1933
3943
  budgetCut = true;
1934
3944
  controller.abort();
@@ -1942,27 +3952,36 @@ async function walkScope(root, options = {}) {
1942
3952
  included += 1;
1943
3953
  return true;
1944
3954
  };
3955
+ const follow = options.followSymlinks === true;
3956
+ const recorder = follow ? null : createLinkRecorder(attrStash?.fs);
1945
3957
  const files = await new import_fdir.fdir({
1946
3958
  pathSeparator: "/",
1947
3959
  exclude: excludeDirectory,
1948
3960
  signal: controller.signal,
1949
- resolveSymlinks: options.followSymlinks === true,
3961
+ resolveSymlinks: follow,
1950
3962
  // Keep descended-through-symlink paths in the scan-root universe instead
1951
3963
  // of emitting real (possibly outside-root) paths.
1952
3964
  useRealPaths: false,
1953
3965
  // Unreadable directories are skipped, ripgrep-style; the loud channel is
1954
3966
  // the budget, not per-directory I/O errors.
1955
- suppressErrors: true
3967
+ suppressErrors: true,
3968
+ fs: recorder?.fs ?? attrStash?.fs
1956
3969
  }).withRelativePaths().filter((path3) => keepFile(path3)).crawl(rootNative).withPromise();
1957
3970
  stoneReport.sort(
1958
3971
  (a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : a.stoneName < b.stoneName ? -1 : a.stoneName > b.stoneName ? 1 : 0
1959
3972
  );
1960
- return { files: [...files].sort(), diagnostics, stoneHits: stoneReport };
3973
+ const sortedFiles = [...files].sort();
3974
+ return {
3975
+ files: sortedFiles,
3976
+ links: recorder ? selectLinks(sortedFiles, recorder.links) : [],
3977
+ diagnostics,
3978
+ stoneHits: stoneReport
3979
+ };
1961
3980
  }
1962
3981
 
1963
3982
  // src/explain.ts
1964
- var import_node_fs4 = require("node:fs");
1965
- var import_node_path3 = require("node:path");
3983
+ var import_node_fs5 = require("node:fs");
3984
+ var import_node_path4 = require("node:path");
1966
3985
  function parseRelPath(relPath) {
1967
3986
  if (typeof relPath !== "string") {
1968
3987
  throw new PathscopeConfigError("relPath must be a scan-root-relative POSIX path string");
@@ -1990,8 +4009,8 @@ function parseRelPath(relPath) {
1990
4009
  }
1991
4010
  async function explainScopePath(root, relPath, options = {}) {
1992
4011
  const { segments, isDir, isRoot } = parseRelPath(relPath);
1993
- const rootNative = (0, import_node_path3.resolve)(root);
1994
- if (!(0, import_node_fs4.existsSync)(rootNative)) {
4012
+ const rootNative = (0, import_node_path4.resolve)(root);
4013
+ if (!(0, import_node_fs5.existsSync)(rootNative)) {
1995
4014
  throw new PathscopeConfigError(`scan root does not exist: ${rootNative}`);
1996
4015
  }
1997
4016
  const baseKey = rootNative.replace(/\\/g, "/").replace(/\/+$/, "");
@@ -2024,9 +4043,11 @@ async function explainScopePath(root, relPath, options = {}) {
2024
4043
  const relHere = segments.slice(0, i + 1).join("/");
2025
4044
  const isLeaf = i === segments.length - 1;
2026
4045
  const adjudicateAsDir = isLeaf ? isDir : true;
4046
+ const parentKey = i === 0 ? baseKey : keys[i - 1];
4047
+ const hiddenMeta = io.hidden !== void 0 && !name.startsWith(".") ? { hidden: await io.hidden(parentKey, name) === true } : void 0;
2027
4048
  if (adjudicateAsDir) {
2028
4049
  const stoneHit = await probeStones(keys[i]);
2029
- const adj = engine.adjudicateDirectory(name, keys[i], stoneHit);
4050
+ const adj = engine.adjudicateDirectory(name, keys[i], stoneHit, hiddenMeta);
2030
4051
  hitChain.push(...withPath(adj.hits, relHere));
2031
4052
  if (adj.excluded) {
2032
4053
  excluded = true;
@@ -2035,9 +4056,12 @@ async function explainScopePath(root, relPath, options = {}) {
2035
4056
  break;
2036
4057
  }
2037
4058
  engine.foldGitignore(keys[i], await io.readGitignore(keys[i]));
4059
+ if (io.readIgnoreFamily !== void 0 && options.respectIgnoreFamily !== false) {
4060
+ engine.foldIgnoreFamily(keys[i], await io.readIgnoreFamily(keys[i]));
4061
+ }
2038
4062
  if (isLeaf) excluded = false;
2039
4063
  } else {
2040
- const adj = engine.adjudicateFile(relHere);
4064
+ const adj = engine.adjudicateFile(relHere, hiddenMeta);
2041
4065
  hitChain.push(...withPath(adj.hits, relHere));
2042
4066
  excluded = !adj.admitted;
2043
4067
  }
@@ -2070,7 +4094,7 @@ async function explainScopePath(root, relPath, options = {}) {
2070
4094
 
2071
4095
  // src/universe.ts
2072
4096
  var import_node_child_process = require("node:child_process");
2073
- var import_node_path4 = require("node:path");
4097
+ var import_node_path5 = require("node:path");
2074
4098
  var import_ignore2 = __toESM(require_ignore(), 1);
2075
4099
  var repoRootCache = /* @__PURE__ */ new Map();
2076
4100
  function clearUniverseCache() {
@@ -2143,8 +4167,8 @@ function filterDiffRawRecords(stdout) {
2143
4167
  return [...kept];
2144
4168
  }
2145
4169
  function rebaseToRoot(repoRootNative, rootAbs, repoRelPosix) {
2146
- const rel = (0, import_node_path4.relative)(rootAbs, (0, import_node_path4.join)(repoRootNative, repoRelPosix));
2147
- if (rel === "" || (0, import_node_path4.isAbsolute)(rel) || rel.startsWith("..")) return null;
4170
+ const rel = (0, import_node_path5.relative)(rootAbs, (0, import_node_path5.join)(repoRootNative, repoRelPosix));
4171
+ if (rel === "" || (0, import_node_path5.isAbsolute)(rel) || rel.startsWith("..")) return null;
2148
4172
  return toPosix(rel);
2149
4173
  }
2150
4174
  function validateFilter(filter) {
@@ -2178,7 +4202,7 @@ async function gitUniverse(root, options = {}) {
2178
4202
  );
2179
4203
  }
2180
4204
  if (options.filter !== void 0) validateFilter(options.filter);
2181
- const rootAbs = (0, import_node_path4.resolve)(root);
4205
+ const rootAbs = (0, import_node_path5.resolve)(root);
2182
4206
  const repoRoot = repoRootOf(rootAbs);
2183
4207
  let repoRelative;
2184
4208
  if (variant === "staged") {
@@ -2204,15 +4228,15 @@ async function gitUniverse(root, options = {}) {
2204
4228
  }
2205
4229
 
2206
4230
  // src/discover.ts
2207
- var import_node_path7 = require("node:path");
4231
+ var import_node_path8 = require("node:path");
2208
4232
 
2209
4233
  // node_modules/.pnpm/find-up@8.0.0/node_modules/find-up/index.js
2210
- var import_node_path6 = __toESM(require("node:path"), 1);
4234
+ var import_node_path7 = __toESM(require("node:path"), 1);
2211
4235
 
2212
4236
  // node_modules/.pnpm/locate-path@8.0.0/node_modules/locate-path/index.js
2213
- var import_node_process = __toESM(require("node:process"), 1);
2214
- var import_node_path5 = __toESM(require("node:path"), 1);
2215
- var import_node_fs5 = __toESM(require("node:fs"), 1);
4237
+ var import_node_process3 = __toESM(require("node:process"), 1);
4238
+ var import_node_path6 = __toESM(require("node:path"), 1);
4239
+ var import_node_fs6 = __toESM(require("node:fs"), 1);
2216
4240
  var import_node_url = require("node:url");
2217
4241
  var typeMappings = {
2218
4242
  directory: "isDirectory",
@@ -2224,25 +4248,25 @@ function checkType(type) {
2224
4248
  }
2225
4249
  throw new Error(`Invalid type specified: ${type}`);
2226
4250
  }
2227
- var matchType = (type, stat) => type === "both" ? stat.isFile() || stat.isDirectory() : stat[typeMappings[type]]();
4251
+ var matchType = (type, stat2) => type === "both" ? stat2.isFile() || stat2.isDirectory() : stat2[typeMappings[type]]();
2228
4252
  var toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath;
2229
4253
  function locatePathSync(paths, {
2230
- cwd = import_node_process.default.cwd(),
4254
+ cwd = import_node_process3.default.cwd(),
2231
4255
  type = "file",
2232
4256
  allowSymlinks = true
2233
4257
  } = {}) {
2234
4258
  checkType(type);
2235
4259
  cwd = toPath(cwd);
2236
- const statFunction = allowSymlinks ? import_node_fs5.default.statSync : import_node_fs5.default.lstatSync;
4260
+ const statFunction = allowSymlinks ? import_node_fs6.default.statSync : import_node_fs6.default.lstatSync;
2237
4261
  for (const path_ of paths) {
2238
4262
  try {
2239
- const stat = statFunction(import_node_path5.default.resolve(cwd, path_), {
4263
+ const stat2 = statFunction(import_node_path6.default.resolve(cwd, path_), {
2240
4264
  throwIfNoEntry: false
2241
4265
  });
2242
- if (!stat) {
4266
+ if (!stat2) {
2243
4267
  continue;
2244
4268
  }
2245
- if (matchType(type, stat)) {
4269
+ if (matchType(type, stat2)) {
2246
4270
  return path_;
2247
4271
  }
2248
4272
  } catch {
@@ -2263,9 +4287,9 @@ var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
2263
4287
  // node_modules/.pnpm/find-up@8.0.0/node_modules/find-up/index.js
2264
4288
  var findUpStop = /* @__PURE__ */ Symbol("findUpStop");
2265
4289
  function findUpMultipleSync(name, options = {}) {
2266
- let directory = import_node_path6.default.resolve(toPath2(options.cwd) ?? "");
2267
- const { root } = import_node_path6.default.parse(directory);
2268
- const stopAt = import_node_path6.default.resolve(directory, toPath2(options.stopAt) ?? root);
4290
+ let directory = import_node_path7.default.resolve(toPath2(options.cwd) ?? "");
4291
+ const { root } = import_node_path7.default.parse(directory);
4292
+ const stopAt = import_node_path7.default.resolve(directory, toPath2(options.stopAt) ?? root);
2269
4293
  const limit = options.limit ?? Number.POSITIVE_INFINITY;
2270
4294
  const paths = [name].flat();
2271
4295
  const runMatcher = (locateOptions) => {
@@ -2285,12 +4309,12 @@ function findUpMultipleSync(name, options = {}) {
2285
4309
  break;
2286
4310
  }
2287
4311
  if (foundPath) {
2288
- matches.push(import_node_path6.default.resolve(directory, foundPath));
4312
+ matches.push(import_node_path7.default.resolve(directory, foundPath));
2289
4313
  }
2290
4314
  if (directory === stopAt || matches.length >= limit) {
2291
4315
  break;
2292
4316
  }
2293
- directory = import_node_path6.default.dirname(directory);
4317
+ directory = import_node_path7.default.dirname(directory);
2294
4318
  }
2295
4319
  return matches;
2296
4320
  }
@@ -2326,7 +4350,7 @@ function locateNearest(names, options = {}) {
2326
4350
  (name) => foundPosix.length >= suffixOf(name).length && fold(foundPosix.slice(foundPosix.length - suffixOf(name).length)) === fold(suffixOf(name))
2327
4351
  );
2328
4352
  if (hit === void 0) {
2329
- return { name: (0, import_node_path7.basename)(found), path: found };
4353
+ return { name: (0, import_node_path8.basename)(found), path: found };
2330
4354
  }
2331
4355
  return { name: hit, path: found };
2332
4356
  }