@kevisual/project-search 0.0.4 → 0.0.6

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/remote.js CHANGED
@@ -5312,1841 +5312,6 @@ var require_out4 = __commonJS((exports, module) => {
5312
5312
  module.exports = FastGlob;
5313
5313
  });
5314
5314
 
5315
- // ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
5316
- var require_constants5 = __commonJS((exports, module) => {
5317
- var WIN_SLASH = "\\\\/";
5318
- var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
5319
- var DOT_LITERAL = "\\.";
5320
- var PLUS_LITERAL = "\\+";
5321
- var QMARK_LITERAL = "\\?";
5322
- var SLASH_LITERAL = "\\/";
5323
- var ONE_CHAR = "(?=.)";
5324
- var QMARK = "[^/]";
5325
- var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
5326
- var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
5327
- var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
5328
- var NO_DOT = `(?!${DOT_LITERAL})`;
5329
- var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
5330
- var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
5331
- var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
5332
- var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
5333
- var STAR = `${QMARK}*?`;
5334
- var SEP = "/";
5335
- var POSIX_CHARS = {
5336
- DOT_LITERAL,
5337
- PLUS_LITERAL,
5338
- QMARK_LITERAL,
5339
- SLASH_LITERAL,
5340
- ONE_CHAR,
5341
- QMARK,
5342
- END_ANCHOR,
5343
- DOTS_SLASH,
5344
- NO_DOT,
5345
- NO_DOTS,
5346
- NO_DOT_SLASH,
5347
- NO_DOTS_SLASH,
5348
- QMARK_NO_DOT,
5349
- STAR,
5350
- START_ANCHOR,
5351
- SEP
5352
- };
5353
- var WINDOWS_CHARS = {
5354
- ...POSIX_CHARS,
5355
- SLASH_LITERAL: `[${WIN_SLASH}]`,
5356
- QMARK: WIN_NO_SLASH,
5357
- STAR: `${WIN_NO_SLASH}*?`,
5358
- DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
5359
- NO_DOT: `(?!${DOT_LITERAL})`,
5360
- NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
5361
- NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
5362
- NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
5363
- QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
5364
- START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
5365
- END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
5366
- SEP: "\\"
5367
- };
5368
- var POSIX_REGEX_SOURCE = {
5369
- alnum: "a-zA-Z0-9",
5370
- alpha: "a-zA-Z",
5371
- ascii: "\\x00-\\x7F",
5372
- blank: " \\t",
5373
- cntrl: "\\x00-\\x1F\\x7F",
5374
- digit: "0-9",
5375
- graph: "\\x21-\\x7E",
5376
- lower: "a-z",
5377
- print: "\\x20-\\x7E ",
5378
- punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
5379
- space: " \\t\\r\\n\\v\\f",
5380
- upper: "A-Z",
5381
- word: "A-Za-z0-9_",
5382
- xdigit: "A-Fa-f0-9"
5383
- };
5384
- module.exports = {
5385
- MAX_LENGTH: 1024 * 64,
5386
- POSIX_REGEX_SOURCE,
5387
- REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
5388
- REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
5389
- REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
5390
- REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
5391
- REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
5392
- REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
5393
- REPLACEMENTS: {
5394
- __proto__: null,
5395
- "***": "*",
5396
- "**/**": "**",
5397
- "**/**/**": "**"
5398
- },
5399
- CHAR_0: 48,
5400
- CHAR_9: 57,
5401
- CHAR_UPPERCASE_A: 65,
5402
- CHAR_LOWERCASE_A: 97,
5403
- CHAR_UPPERCASE_Z: 90,
5404
- CHAR_LOWERCASE_Z: 122,
5405
- CHAR_LEFT_PARENTHESES: 40,
5406
- CHAR_RIGHT_PARENTHESES: 41,
5407
- CHAR_ASTERISK: 42,
5408
- CHAR_AMPERSAND: 38,
5409
- CHAR_AT: 64,
5410
- CHAR_BACKWARD_SLASH: 92,
5411
- CHAR_CARRIAGE_RETURN: 13,
5412
- CHAR_CIRCUMFLEX_ACCENT: 94,
5413
- CHAR_COLON: 58,
5414
- CHAR_COMMA: 44,
5415
- CHAR_DOT: 46,
5416
- CHAR_DOUBLE_QUOTE: 34,
5417
- CHAR_EQUAL: 61,
5418
- CHAR_EXCLAMATION_MARK: 33,
5419
- CHAR_FORM_FEED: 12,
5420
- CHAR_FORWARD_SLASH: 47,
5421
- CHAR_GRAVE_ACCENT: 96,
5422
- CHAR_HASH: 35,
5423
- CHAR_HYPHEN_MINUS: 45,
5424
- CHAR_LEFT_ANGLE_BRACKET: 60,
5425
- CHAR_LEFT_CURLY_BRACE: 123,
5426
- CHAR_LEFT_SQUARE_BRACKET: 91,
5427
- CHAR_LINE_FEED: 10,
5428
- CHAR_NO_BREAK_SPACE: 160,
5429
- CHAR_PERCENT: 37,
5430
- CHAR_PLUS: 43,
5431
- CHAR_QUESTION_MARK: 63,
5432
- CHAR_RIGHT_ANGLE_BRACKET: 62,
5433
- CHAR_RIGHT_CURLY_BRACE: 125,
5434
- CHAR_RIGHT_SQUARE_BRACKET: 93,
5435
- CHAR_SEMICOLON: 59,
5436
- CHAR_SINGLE_QUOTE: 39,
5437
- CHAR_SPACE: 32,
5438
- CHAR_TAB: 9,
5439
- CHAR_UNDERSCORE: 95,
5440
- CHAR_VERTICAL_LINE: 124,
5441
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
5442
- extglobChars(chars) {
5443
- return {
5444
- "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
5445
- "?": { type: "qmark", open: "(?:", close: ")?" },
5446
- "+": { type: "plus", open: "(?:", close: ")+" },
5447
- "*": { type: "star", open: "(?:", close: ")*" },
5448
- "@": { type: "at", open: "(?:", close: ")" }
5449
- };
5450
- },
5451
- globChars(win32) {
5452
- return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
5453
- }
5454
- };
5455
- });
5456
-
5457
- // ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
5458
- var require_utils5 = __commonJS((exports) => {
5459
- var {
5460
- REGEX_BACKSLASH,
5461
- REGEX_REMOVE_BACKSLASH,
5462
- REGEX_SPECIAL_CHARS,
5463
- REGEX_SPECIAL_CHARS_GLOBAL
5464
- } = require_constants5();
5465
- exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
5466
- exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
5467
- exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
5468
- exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
5469
- exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
5470
- exports.isWindows = () => {
5471
- if (typeof navigator !== "undefined" && navigator.platform) {
5472
- const platform = navigator.platform.toLowerCase();
5473
- return platform === "win32" || platform === "windows";
5474
- }
5475
- if (typeof process !== "undefined" && process.platform) {
5476
- return process.platform === "win32";
5477
- }
5478
- return false;
5479
- };
5480
- exports.removeBackslashes = (str) => {
5481
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
5482
- return match === "\\" ? "" : match;
5483
- });
5484
- };
5485
- exports.escapeLast = (input, char, lastIdx) => {
5486
- const idx = input.lastIndexOf(char, lastIdx);
5487
- if (idx === -1)
5488
- return input;
5489
- if (input[idx - 1] === "\\")
5490
- return exports.escapeLast(input, char, idx - 1);
5491
- return `${input.slice(0, idx)}\\${input.slice(idx)}`;
5492
- };
5493
- exports.removePrefix = (input, state = {}) => {
5494
- let output = input;
5495
- if (output.startsWith("./")) {
5496
- output = output.slice(2);
5497
- state.prefix = "./";
5498
- }
5499
- return output;
5500
- };
5501
- exports.wrapOutput = (input, state = {}, options = {}) => {
5502
- const prepend = options.contains ? "" : "^";
5503
- const append = options.contains ? "" : "$";
5504
- let output = `${prepend}(?:${input})${append}`;
5505
- if (state.negated === true) {
5506
- output = `(?:^(?!${output}).*$)`;
5507
- }
5508
- return output;
5509
- };
5510
- exports.basename = (path3, { windows } = {}) => {
5511
- const segs = path3.split(windows ? /[\\/]/ : "/");
5512
- const last = segs[segs.length - 1];
5513
- if (last === "") {
5514
- return segs[segs.length - 2];
5515
- }
5516
- return last;
5517
- };
5518
- });
5519
-
5520
- // ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
5521
- var require_scan2 = __commonJS((exports, module) => {
5522
- var utils = require_utils5();
5523
- var {
5524
- CHAR_ASTERISK,
5525
- CHAR_AT,
5526
- CHAR_BACKWARD_SLASH,
5527
- CHAR_COMMA,
5528
- CHAR_DOT,
5529
- CHAR_EXCLAMATION_MARK,
5530
- CHAR_FORWARD_SLASH,
5531
- CHAR_LEFT_CURLY_BRACE,
5532
- CHAR_LEFT_PARENTHESES,
5533
- CHAR_LEFT_SQUARE_BRACKET,
5534
- CHAR_PLUS,
5535
- CHAR_QUESTION_MARK,
5536
- CHAR_RIGHT_CURLY_BRACE,
5537
- CHAR_RIGHT_PARENTHESES,
5538
- CHAR_RIGHT_SQUARE_BRACKET
5539
- } = require_constants5();
5540
- var isPathSeparator = (code) => {
5541
- return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
5542
- };
5543
- var depth = (token) => {
5544
- if (token.isPrefix !== true) {
5545
- token.depth = token.isGlobstar ? Infinity : 1;
5546
- }
5547
- };
5548
- var scan = (input, options) => {
5549
- const opts = options || {};
5550
- const length = input.length - 1;
5551
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
5552
- const slashes = [];
5553
- const tokens = [];
5554
- const parts = [];
5555
- let str = input;
5556
- let index = -1;
5557
- let start = 0;
5558
- let lastIndex = 0;
5559
- let isBrace = false;
5560
- let isBracket = false;
5561
- let isGlob = false;
5562
- let isExtglob = false;
5563
- let isGlobstar = false;
5564
- let braceEscaped = false;
5565
- let backslashes = false;
5566
- let negated = false;
5567
- let negatedExtglob = false;
5568
- let finished = false;
5569
- let braces = 0;
5570
- let prev;
5571
- let code;
5572
- let token = { value: "", depth: 0, isGlob: false };
5573
- const eos = () => index >= length;
5574
- const peek = () => str.charCodeAt(index + 1);
5575
- const advance = () => {
5576
- prev = code;
5577
- return str.charCodeAt(++index);
5578
- };
5579
- while (index < length) {
5580
- code = advance();
5581
- let next;
5582
- if (code === CHAR_BACKWARD_SLASH) {
5583
- backslashes = token.backslashes = true;
5584
- code = advance();
5585
- if (code === CHAR_LEFT_CURLY_BRACE) {
5586
- braceEscaped = true;
5587
- }
5588
- continue;
5589
- }
5590
- if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
5591
- braces++;
5592
- while (eos() !== true && (code = advance())) {
5593
- if (code === CHAR_BACKWARD_SLASH) {
5594
- backslashes = token.backslashes = true;
5595
- advance();
5596
- continue;
5597
- }
5598
- if (code === CHAR_LEFT_CURLY_BRACE) {
5599
- braces++;
5600
- continue;
5601
- }
5602
- if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
5603
- isBrace = token.isBrace = true;
5604
- isGlob = token.isGlob = true;
5605
- finished = true;
5606
- if (scanToEnd === true) {
5607
- continue;
5608
- }
5609
- break;
5610
- }
5611
- if (braceEscaped !== true && code === CHAR_COMMA) {
5612
- isBrace = token.isBrace = true;
5613
- isGlob = token.isGlob = true;
5614
- finished = true;
5615
- if (scanToEnd === true) {
5616
- continue;
5617
- }
5618
- break;
5619
- }
5620
- if (code === CHAR_RIGHT_CURLY_BRACE) {
5621
- braces--;
5622
- if (braces === 0) {
5623
- braceEscaped = false;
5624
- isBrace = token.isBrace = true;
5625
- finished = true;
5626
- break;
5627
- }
5628
- }
5629
- }
5630
- if (scanToEnd === true) {
5631
- continue;
5632
- }
5633
- break;
5634
- }
5635
- if (code === CHAR_FORWARD_SLASH) {
5636
- slashes.push(index);
5637
- tokens.push(token);
5638
- token = { value: "", depth: 0, isGlob: false };
5639
- if (finished === true)
5640
- continue;
5641
- if (prev === CHAR_DOT && index === start + 1) {
5642
- start += 2;
5643
- continue;
5644
- }
5645
- lastIndex = index + 1;
5646
- continue;
5647
- }
5648
- if (opts.noext !== true) {
5649
- const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
5650
- if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
5651
- isGlob = token.isGlob = true;
5652
- isExtglob = token.isExtglob = true;
5653
- finished = true;
5654
- if (code === CHAR_EXCLAMATION_MARK && index === start) {
5655
- negatedExtglob = true;
5656
- }
5657
- if (scanToEnd === true) {
5658
- while (eos() !== true && (code = advance())) {
5659
- if (code === CHAR_BACKWARD_SLASH) {
5660
- backslashes = token.backslashes = true;
5661
- code = advance();
5662
- continue;
5663
- }
5664
- if (code === CHAR_RIGHT_PARENTHESES) {
5665
- isGlob = token.isGlob = true;
5666
- finished = true;
5667
- break;
5668
- }
5669
- }
5670
- continue;
5671
- }
5672
- break;
5673
- }
5674
- }
5675
- if (code === CHAR_ASTERISK) {
5676
- if (prev === CHAR_ASTERISK)
5677
- isGlobstar = token.isGlobstar = true;
5678
- isGlob = token.isGlob = true;
5679
- finished = true;
5680
- if (scanToEnd === true) {
5681
- continue;
5682
- }
5683
- break;
5684
- }
5685
- if (code === CHAR_QUESTION_MARK) {
5686
- isGlob = token.isGlob = true;
5687
- finished = true;
5688
- if (scanToEnd === true) {
5689
- continue;
5690
- }
5691
- break;
5692
- }
5693
- if (code === CHAR_LEFT_SQUARE_BRACKET) {
5694
- while (eos() !== true && (next = advance())) {
5695
- if (next === CHAR_BACKWARD_SLASH) {
5696
- backslashes = token.backslashes = true;
5697
- advance();
5698
- continue;
5699
- }
5700
- if (next === CHAR_RIGHT_SQUARE_BRACKET) {
5701
- isBracket = token.isBracket = true;
5702
- isGlob = token.isGlob = true;
5703
- finished = true;
5704
- break;
5705
- }
5706
- }
5707
- if (scanToEnd === true) {
5708
- continue;
5709
- }
5710
- break;
5711
- }
5712
- if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
5713
- negated = token.negated = true;
5714
- start++;
5715
- continue;
5716
- }
5717
- if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
5718
- isGlob = token.isGlob = true;
5719
- if (scanToEnd === true) {
5720
- while (eos() !== true && (code = advance())) {
5721
- if (code === CHAR_LEFT_PARENTHESES) {
5722
- backslashes = token.backslashes = true;
5723
- code = advance();
5724
- continue;
5725
- }
5726
- if (code === CHAR_RIGHT_PARENTHESES) {
5727
- finished = true;
5728
- break;
5729
- }
5730
- }
5731
- continue;
5732
- }
5733
- break;
5734
- }
5735
- if (isGlob === true) {
5736
- finished = true;
5737
- if (scanToEnd === true) {
5738
- continue;
5739
- }
5740
- break;
5741
- }
5742
- }
5743
- if (opts.noext === true) {
5744
- isExtglob = false;
5745
- isGlob = false;
5746
- }
5747
- let base = str;
5748
- let prefix = "";
5749
- let glob = "";
5750
- if (start > 0) {
5751
- prefix = str.slice(0, start);
5752
- str = str.slice(start);
5753
- lastIndex -= start;
5754
- }
5755
- if (base && isGlob === true && lastIndex > 0) {
5756
- base = str.slice(0, lastIndex);
5757
- glob = str.slice(lastIndex);
5758
- } else if (isGlob === true) {
5759
- base = "";
5760
- glob = str;
5761
- } else {
5762
- base = str;
5763
- }
5764
- if (base && base !== "" && base !== "/" && base !== str) {
5765
- if (isPathSeparator(base.charCodeAt(base.length - 1))) {
5766
- base = base.slice(0, -1);
5767
- }
5768
- }
5769
- if (opts.unescape === true) {
5770
- if (glob)
5771
- glob = utils.removeBackslashes(glob);
5772
- if (base && backslashes === true) {
5773
- base = utils.removeBackslashes(base);
5774
- }
5775
- }
5776
- const state = {
5777
- prefix,
5778
- input,
5779
- start,
5780
- base,
5781
- glob,
5782
- isBrace,
5783
- isBracket,
5784
- isGlob,
5785
- isExtglob,
5786
- isGlobstar,
5787
- negated,
5788
- negatedExtglob
5789
- };
5790
- if (opts.tokens === true) {
5791
- state.maxDepth = 0;
5792
- if (!isPathSeparator(code)) {
5793
- tokens.push(token);
5794
- }
5795
- state.tokens = tokens;
5796
- }
5797
- if (opts.parts === true || opts.tokens === true) {
5798
- let prevIndex;
5799
- for (let idx = 0;idx < slashes.length; idx++) {
5800
- const n = prevIndex ? prevIndex + 1 : start;
5801
- const i = slashes[idx];
5802
- const value = input.slice(n, i);
5803
- if (opts.tokens) {
5804
- if (idx === 0 && start !== 0) {
5805
- tokens[idx].isPrefix = true;
5806
- tokens[idx].value = prefix;
5807
- } else {
5808
- tokens[idx].value = value;
5809
- }
5810
- depth(tokens[idx]);
5811
- state.maxDepth += tokens[idx].depth;
5812
- }
5813
- if (idx !== 0 || value !== "") {
5814
- parts.push(value);
5815
- }
5816
- prevIndex = i;
5817
- }
5818
- if (prevIndex && prevIndex + 1 < input.length) {
5819
- const value = input.slice(prevIndex + 1);
5820
- parts.push(value);
5821
- if (opts.tokens) {
5822
- tokens[tokens.length - 1].value = value;
5823
- depth(tokens[tokens.length - 1]);
5824
- state.maxDepth += tokens[tokens.length - 1].depth;
5825
- }
5826
- }
5827
- state.slashes = slashes;
5828
- state.parts = parts;
5829
- }
5830
- return state;
5831
- };
5832
- module.exports = scan;
5833
- });
5834
-
5835
- // ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
5836
- var require_parse3 = __commonJS((exports, module) => {
5837
- var constants = require_constants5();
5838
- var utils = require_utils5();
5839
- var {
5840
- MAX_LENGTH,
5841
- POSIX_REGEX_SOURCE,
5842
- REGEX_NON_SPECIAL_CHARS,
5843
- REGEX_SPECIAL_CHARS_BACKREF,
5844
- REPLACEMENTS
5845
- } = constants;
5846
- var expandRange = (args, options) => {
5847
- if (typeof options.expandRange === "function") {
5848
- return options.expandRange(...args, options);
5849
- }
5850
- args.sort();
5851
- const value = `[${args.join("-")}]`;
5852
- try {
5853
- new RegExp(value);
5854
- } catch (ex) {
5855
- return args.map((v) => utils.escapeRegex(v)).join("..");
5856
- }
5857
- return value;
5858
- };
5859
- var syntaxError = (type, char) => {
5860
- return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
5861
- };
5862
- var parse2 = (input, options) => {
5863
- if (typeof input !== "string") {
5864
- throw new TypeError("Expected a string");
5865
- }
5866
- input = REPLACEMENTS[input] || input;
5867
- const opts = { ...options };
5868
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
5869
- let len = input.length;
5870
- if (len > max) {
5871
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
5872
- }
5873
- const bos = { type: "bos", value: "", output: opts.prepend || "" };
5874
- const tokens = [bos];
5875
- const capture = opts.capture ? "" : "?:";
5876
- const PLATFORM_CHARS = constants.globChars(opts.windows);
5877
- const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
5878
- const {
5879
- DOT_LITERAL,
5880
- PLUS_LITERAL,
5881
- SLASH_LITERAL,
5882
- ONE_CHAR,
5883
- DOTS_SLASH,
5884
- NO_DOT,
5885
- NO_DOT_SLASH,
5886
- NO_DOTS_SLASH,
5887
- QMARK,
5888
- QMARK_NO_DOT,
5889
- STAR,
5890
- START_ANCHOR
5891
- } = PLATFORM_CHARS;
5892
- const globstar = (opts2) => {
5893
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
5894
- };
5895
- const nodot = opts.dot ? "" : NO_DOT;
5896
- const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
5897
- let star = opts.bash === true ? globstar(opts) : STAR;
5898
- if (opts.capture) {
5899
- star = `(${star})`;
5900
- }
5901
- if (typeof opts.noext === "boolean") {
5902
- opts.noextglob = opts.noext;
5903
- }
5904
- const state = {
5905
- input,
5906
- index: -1,
5907
- start: 0,
5908
- dot: opts.dot === true,
5909
- consumed: "",
5910
- output: "",
5911
- prefix: "",
5912
- backtrack: false,
5913
- negated: false,
5914
- brackets: 0,
5915
- braces: 0,
5916
- parens: 0,
5917
- quotes: 0,
5918
- globstar: false,
5919
- tokens
5920
- };
5921
- input = utils.removePrefix(input, state);
5922
- len = input.length;
5923
- const extglobs = [];
5924
- const braces = [];
5925
- const stack = [];
5926
- let prev = bos;
5927
- let value;
5928
- const eos = () => state.index === len - 1;
5929
- const peek = state.peek = (n = 1) => input[state.index + n];
5930
- const advance = state.advance = () => input[++state.index] || "";
5931
- const remaining = () => input.slice(state.index + 1);
5932
- const consume = (value2 = "", num = 0) => {
5933
- state.consumed += value2;
5934
- state.index += num;
5935
- };
5936
- const append = (token) => {
5937
- state.output += token.output != null ? token.output : token.value;
5938
- consume(token.value);
5939
- };
5940
- const negate = () => {
5941
- let count = 1;
5942
- while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
5943
- advance();
5944
- state.start++;
5945
- count++;
5946
- }
5947
- if (count % 2 === 0) {
5948
- return false;
5949
- }
5950
- state.negated = true;
5951
- state.start++;
5952
- return true;
5953
- };
5954
- const increment = (type) => {
5955
- state[type]++;
5956
- stack.push(type);
5957
- };
5958
- const decrement = (type) => {
5959
- state[type]--;
5960
- stack.pop();
5961
- };
5962
- const push = (tok) => {
5963
- if (prev.type === "globstar") {
5964
- const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
5965
- const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
5966
- if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
5967
- state.output = state.output.slice(0, -prev.output.length);
5968
- prev.type = "star";
5969
- prev.value = "*";
5970
- prev.output = star;
5971
- state.output += prev.output;
5972
- }
5973
- }
5974
- if (extglobs.length && tok.type !== "paren") {
5975
- extglobs[extglobs.length - 1].inner += tok.value;
5976
- }
5977
- if (tok.value || tok.output)
5978
- append(tok);
5979
- if (prev && prev.type === "text" && tok.type === "text") {
5980
- prev.output = (prev.output || prev.value) + tok.value;
5981
- prev.value += tok.value;
5982
- return;
5983
- }
5984
- tok.prev = prev;
5985
- tokens.push(tok);
5986
- prev = tok;
5987
- };
5988
- const extglobOpen = (type, value2) => {
5989
- const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
5990
- token.prev = prev;
5991
- token.parens = state.parens;
5992
- token.output = state.output;
5993
- const output = (opts.capture ? "(" : "") + token.open;
5994
- increment("parens");
5995
- push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
5996
- push({ type: "paren", extglob: true, value: advance(), output });
5997
- extglobs.push(token);
5998
- };
5999
- const extglobClose = (token) => {
6000
- let output = token.close + (opts.capture ? ")" : "");
6001
- let rest;
6002
- if (token.type === "negate") {
6003
- let extglobStar = star;
6004
- if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
6005
- extglobStar = globstar(opts);
6006
- }
6007
- if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
6008
- output = token.close = `)$))${extglobStar}`;
6009
- }
6010
- if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
6011
- const expression = parse2(rest, { ...options, fastpaths: false }).output;
6012
- output = token.close = `)${expression})${extglobStar})`;
6013
- }
6014
- if (token.prev.type === "bos") {
6015
- state.negatedExtglob = true;
6016
- }
6017
- }
6018
- push({ type: "paren", extglob: true, value, output });
6019
- decrement("parens");
6020
- };
6021
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
6022
- let backslashes = false;
6023
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc2, chars, first, rest, index) => {
6024
- if (first === "\\") {
6025
- backslashes = true;
6026
- return m;
6027
- }
6028
- if (first === "?") {
6029
- if (esc2) {
6030
- return esc2 + first + (rest ? QMARK.repeat(rest.length) : "");
6031
- }
6032
- if (index === 0) {
6033
- return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
6034
- }
6035
- return QMARK.repeat(chars.length);
6036
- }
6037
- if (first === ".") {
6038
- return DOT_LITERAL.repeat(chars.length);
6039
- }
6040
- if (first === "*") {
6041
- if (esc2) {
6042
- return esc2 + first + (rest ? star : "");
6043
- }
6044
- return star;
6045
- }
6046
- return esc2 ? m : `\\${m}`;
6047
- });
6048
- if (backslashes === true) {
6049
- if (opts.unescape === true) {
6050
- output = output.replace(/\\/g, "");
6051
- } else {
6052
- output = output.replace(/\\+/g, (m) => {
6053
- return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
6054
- });
6055
- }
6056
- }
6057
- if (output === input && opts.contains === true) {
6058
- state.output = input;
6059
- return state;
6060
- }
6061
- state.output = utils.wrapOutput(output, state, options);
6062
- return state;
6063
- }
6064
- while (!eos()) {
6065
- value = advance();
6066
- if (value === "\x00") {
6067
- continue;
6068
- }
6069
- if (value === "\\") {
6070
- const next = peek();
6071
- if (next === "/" && opts.bash !== true) {
6072
- continue;
6073
- }
6074
- if (next === "." || next === ";") {
6075
- continue;
6076
- }
6077
- if (!next) {
6078
- value += "\\";
6079
- push({ type: "text", value });
6080
- continue;
6081
- }
6082
- const match = /^\\+/.exec(remaining());
6083
- let slashes = 0;
6084
- if (match && match[0].length > 2) {
6085
- slashes = match[0].length;
6086
- state.index += slashes;
6087
- if (slashes % 2 !== 0) {
6088
- value += "\\";
6089
- }
6090
- }
6091
- if (opts.unescape === true) {
6092
- value = advance();
6093
- } else {
6094
- value += advance();
6095
- }
6096
- if (state.brackets === 0) {
6097
- push({ type: "text", value });
6098
- continue;
6099
- }
6100
- }
6101
- if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
6102
- if (opts.posix !== false && value === ":") {
6103
- const inner = prev.value.slice(1);
6104
- if (inner.includes("[")) {
6105
- prev.posix = true;
6106
- if (inner.includes(":")) {
6107
- const idx = prev.value.lastIndexOf("[");
6108
- const pre = prev.value.slice(0, idx);
6109
- const rest2 = prev.value.slice(idx + 2);
6110
- const posix = POSIX_REGEX_SOURCE[rest2];
6111
- if (posix) {
6112
- prev.value = pre + posix;
6113
- state.backtrack = true;
6114
- advance();
6115
- if (!bos.output && tokens.indexOf(prev) === 1) {
6116
- bos.output = ONE_CHAR;
6117
- }
6118
- continue;
6119
- }
6120
- }
6121
- }
6122
- }
6123
- if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
6124
- value = `\\${value}`;
6125
- }
6126
- if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
6127
- value = `\\${value}`;
6128
- }
6129
- if (opts.posix === true && value === "!" && prev.value === "[") {
6130
- value = "^";
6131
- }
6132
- prev.value += value;
6133
- append({ value });
6134
- continue;
6135
- }
6136
- if (state.quotes === 1 && value !== '"') {
6137
- value = utils.escapeRegex(value);
6138
- prev.value += value;
6139
- append({ value });
6140
- continue;
6141
- }
6142
- if (value === '"') {
6143
- state.quotes = state.quotes === 1 ? 0 : 1;
6144
- if (opts.keepQuotes === true) {
6145
- push({ type: "text", value });
6146
- }
6147
- continue;
6148
- }
6149
- if (value === "(") {
6150
- increment("parens");
6151
- push({ type: "paren", value });
6152
- continue;
6153
- }
6154
- if (value === ")") {
6155
- if (state.parens === 0 && opts.strictBrackets === true) {
6156
- throw new SyntaxError(syntaxError("opening", "("));
6157
- }
6158
- const extglob = extglobs[extglobs.length - 1];
6159
- if (extglob && state.parens === extglob.parens + 1) {
6160
- extglobClose(extglobs.pop());
6161
- continue;
6162
- }
6163
- push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
6164
- decrement("parens");
6165
- continue;
6166
- }
6167
- if (value === "[") {
6168
- if (opts.nobracket === true || !remaining().includes("]")) {
6169
- if (opts.nobracket !== true && opts.strictBrackets === true) {
6170
- throw new SyntaxError(syntaxError("closing", "]"));
6171
- }
6172
- value = `\\${value}`;
6173
- } else {
6174
- increment("brackets");
6175
- }
6176
- push({ type: "bracket", value });
6177
- continue;
6178
- }
6179
- if (value === "]") {
6180
- if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
6181
- push({ type: "text", value, output: `\\${value}` });
6182
- continue;
6183
- }
6184
- if (state.brackets === 0) {
6185
- if (opts.strictBrackets === true) {
6186
- throw new SyntaxError(syntaxError("opening", "["));
6187
- }
6188
- push({ type: "text", value, output: `\\${value}` });
6189
- continue;
6190
- }
6191
- decrement("brackets");
6192
- const prevValue = prev.value.slice(1);
6193
- if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
6194
- value = `/${value}`;
6195
- }
6196
- prev.value += value;
6197
- append({ value });
6198
- if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
6199
- continue;
6200
- }
6201
- const escaped = utils.escapeRegex(prev.value);
6202
- state.output = state.output.slice(0, -prev.value.length);
6203
- if (opts.literalBrackets === true) {
6204
- state.output += escaped;
6205
- prev.value = escaped;
6206
- continue;
6207
- }
6208
- prev.value = `(${capture}${escaped}|${prev.value})`;
6209
- state.output += prev.value;
6210
- continue;
6211
- }
6212
- if (value === "{" && opts.nobrace !== true) {
6213
- increment("braces");
6214
- const open = {
6215
- type: "brace",
6216
- value,
6217
- output: "(",
6218
- outputIndex: state.output.length,
6219
- tokensIndex: state.tokens.length
6220
- };
6221
- braces.push(open);
6222
- push(open);
6223
- continue;
6224
- }
6225
- if (value === "}") {
6226
- const brace = braces[braces.length - 1];
6227
- if (opts.nobrace === true || !brace) {
6228
- push({ type: "text", value, output: value });
6229
- continue;
6230
- }
6231
- let output = ")";
6232
- if (brace.dots === true) {
6233
- const arr = tokens.slice();
6234
- const range = [];
6235
- for (let i = arr.length - 1;i >= 0; i--) {
6236
- tokens.pop();
6237
- if (arr[i].type === "brace") {
6238
- break;
6239
- }
6240
- if (arr[i].type !== "dots") {
6241
- range.unshift(arr[i].value);
6242
- }
6243
- }
6244
- output = expandRange(range, opts);
6245
- state.backtrack = true;
6246
- }
6247
- if (brace.comma !== true && brace.dots !== true) {
6248
- const out = state.output.slice(0, brace.outputIndex);
6249
- const toks = state.tokens.slice(brace.tokensIndex);
6250
- brace.value = brace.output = "\\{";
6251
- value = output = "\\}";
6252
- state.output = out;
6253
- for (const t of toks) {
6254
- state.output += t.output || t.value;
6255
- }
6256
- }
6257
- push({ type: "brace", value, output });
6258
- decrement("braces");
6259
- braces.pop();
6260
- continue;
6261
- }
6262
- if (value === "|") {
6263
- if (extglobs.length > 0) {
6264
- extglobs[extglobs.length - 1].conditions++;
6265
- }
6266
- push({ type: "text", value });
6267
- continue;
6268
- }
6269
- if (value === ",") {
6270
- let output = value;
6271
- const brace = braces[braces.length - 1];
6272
- if (brace && stack[stack.length - 1] === "braces") {
6273
- brace.comma = true;
6274
- output = "|";
6275
- }
6276
- push({ type: "comma", value, output });
6277
- continue;
6278
- }
6279
- if (value === "/") {
6280
- if (prev.type === "dot" && state.index === state.start + 1) {
6281
- state.start = state.index + 1;
6282
- state.consumed = "";
6283
- state.output = "";
6284
- tokens.pop();
6285
- prev = bos;
6286
- continue;
6287
- }
6288
- push({ type: "slash", value, output: SLASH_LITERAL });
6289
- continue;
6290
- }
6291
- if (value === ".") {
6292
- if (state.braces > 0 && prev.type === "dot") {
6293
- if (prev.value === ".")
6294
- prev.output = DOT_LITERAL;
6295
- const brace = braces[braces.length - 1];
6296
- prev.type = "dots";
6297
- prev.output += value;
6298
- prev.value += value;
6299
- brace.dots = true;
6300
- continue;
6301
- }
6302
- if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
6303
- push({ type: "text", value, output: DOT_LITERAL });
6304
- continue;
6305
- }
6306
- push({ type: "dot", value, output: DOT_LITERAL });
6307
- continue;
6308
- }
6309
- if (value === "?") {
6310
- const isGroup = prev && prev.value === "(";
6311
- if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
6312
- extglobOpen("qmark", value);
6313
- continue;
6314
- }
6315
- if (prev && prev.type === "paren") {
6316
- const next = peek();
6317
- let output = value;
6318
- if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
6319
- output = `\\${value}`;
6320
- }
6321
- push({ type: "text", value, output });
6322
- continue;
6323
- }
6324
- if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
6325
- push({ type: "qmark", value, output: QMARK_NO_DOT });
6326
- continue;
6327
- }
6328
- push({ type: "qmark", value, output: QMARK });
6329
- continue;
6330
- }
6331
- if (value === "!") {
6332
- if (opts.noextglob !== true && peek() === "(") {
6333
- if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
6334
- extglobOpen("negate", value);
6335
- continue;
6336
- }
6337
- }
6338
- if (opts.nonegate !== true && state.index === 0) {
6339
- negate();
6340
- continue;
6341
- }
6342
- }
6343
- if (value === "+") {
6344
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
6345
- extglobOpen("plus", value);
6346
- continue;
6347
- }
6348
- if (prev && prev.value === "(" || opts.regex === false) {
6349
- push({ type: "plus", value, output: PLUS_LITERAL });
6350
- continue;
6351
- }
6352
- if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
6353
- push({ type: "plus", value });
6354
- continue;
6355
- }
6356
- push({ type: "plus", value: PLUS_LITERAL });
6357
- continue;
6358
- }
6359
- if (value === "@") {
6360
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
6361
- push({ type: "at", extglob: true, value, output: "" });
6362
- continue;
6363
- }
6364
- push({ type: "text", value });
6365
- continue;
6366
- }
6367
- if (value !== "*") {
6368
- if (value === "$" || value === "^") {
6369
- value = `\\${value}`;
6370
- }
6371
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
6372
- if (match) {
6373
- value += match[0];
6374
- state.index += match[0].length;
6375
- }
6376
- push({ type: "text", value });
6377
- continue;
6378
- }
6379
- if (prev && (prev.type === "globstar" || prev.star === true)) {
6380
- prev.type = "star";
6381
- prev.star = true;
6382
- prev.value += value;
6383
- prev.output = star;
6384
- state.backtrack = true;
6385
- state.globstar = true;
6386
- consume(value);
6387
- continue;
6388
- }
6389
- let rest = remaining();
6390
- if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
6391
- extglobOpen("star", value);
6392
- continue;
6393
- }
6394
- if (prev.type === "star") {
6395
- if (opts.noglobstar === true) {
6396
- consume(value);
6397
- continue;
6398
- }
6399
- const prior = prev.prev;
6400
- const before = prior.prev;
6401
- const isStart = prior.type === "slash" || prior.type === "bos";
6402
- const afterStar = before && (before.type === "star" || before.type === "globstar");
6403
- if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
6404
- push({ type: "star", value, output: "" });
6405
- continue;
6406
- }
6407
- const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
6408
- const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
6409
- if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
6410
- push({ type: "star", value, output: "" });
6411
- continue;
6412
- }
6413
- while (rest.slice(0, 3) === "/**") {
6414
- const after = input[state.index + 4];
6415
- if (after && after !== "/") {
6416
- break;
6417
- }
6418
- rest = rest.slice(3);
6419
- consume("/**", 3);
6420
- }
6421
- if (prior.type === "bos" && eos()) {
6422
- prev.type = "globstar";
6423
- prev.value += value;
6424
- prev.output = globstar(opts);
6425
- state.output = prev.output;
6426
- state.globstar = true;
6427
- consume(value);
6428
- continue;
6429
- }
6430
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
6431
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
6432
- prior.output = `(?:${prior.output}`;
6433
- prev.type = "globstar";
6434
- prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
6435
- prev.value += value;
6436
- state.globstar = true;
6437
- state.output += prior.output + prev.output;
6438
- consume(value);
6439
- continue;
6440
- }
6441
- if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
6442
- const end = rest[1] !== undefined ? "|$" : "";
6443
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
6444
- prior.output = `(?:${prior.output}`;
6445
- prev.type = "globstar";
6446
- prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
6447
- prev.value += value;
6448
- state.output += prior.output + prev.output;
6449
- state.globstar = true;
6450
- consume(value + advance());
6451
- push({ type: "slash", value: "/", output: "" });
6452
- continue;
6453
- }
6454
- if (prior.type === "bos" && rest[0] === "/") {
6455
- prev.type = "globstar";
6456
- prev.value += value;
6457
- prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
6458
- state.output = prev.output;
6459
- state.globstar = true;
6460
- consume(value + advance());
6461
- push({ type: "slash", value: "/", output: "" });
6462
- continue;
6463
- }
6464
- state.output = state.output.slice(0, -prev.output.length);
6465
- prev.type = "globstar";
6466
- prev.output = globstar(opts);
6467
- prev.value += value;
6468
- state.output += prev.output;
6469
- state.globstar = true;
6470
- consume(value);
6471
- continue;
6472
- }
6473
- const token = { type: "star", value, output: star };
6474
- if (opts.bash === true) {
6475
- token.output = ".*?";
6476
- if (prev.type === "bos" || prev.type === "slash") {
6477
- token.output = nodot + token.output;
6478
- }
6479
- push(token);
6480
- continue;
6481
- }
6482
- if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
6483
- token.output = value;
6484
- push(token);
6485
- continue;
6486
- }
6487
- if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
6488
- if (prev.type === "dot") {
6489
- state.output += NO_DOT_SLASH;
6490
- prev.output += NO_DOT_SLASH;
6491
- } else if (opts.dot === true) {
6492
- state.output += NO_DOTS_SLASH;
6493
- prev.output += NO_DOTS_SLASH;
6494
- } else {
6495
- state.output += nodot;
6496
- prev.output += nodot;
6497
- }
6498
- if (peek() !== "*") {
6499
- state.output += ONE_CHAR;
6500
- prev.output += ONE_CHAR;
6501
- }
6502
- }
6503
- push(token);
6504
- }
6505
- while (state.brackets > 0) {
6506
- if (opts.strictBrackets === true)
6507
- throw new SyntaxError(syntaxError("closing", "]"));
6508
- state.output = utils.escapeLast(state.output, "[");
6509
- decrement("brackets");
6510
- }
6511
- while (state.parens > 0) {
6512
- if (opts.strictBrackets === true)
6513
- throw new SyntaxError(syntaxError("closing", ")"));
6514
- state.output = utils.escapeLast(state.output, "(");
6515
- decrement("parens");
6516
- }
6517
- while (state.braces > 0) {
6518
- if (opts.strictBrackets === true)
6519
- throw new SyntaxError(syntaxError("closing", "}"));
6520
- state.output = utils.escapeLast(state.output, "{");
6521
- decrement("braces");
6522
- }
6523
- if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
6524
- push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
6525
- }
6526
- if (state.backtrack === true) {
6527
- state.output = "";
6528
- for (const token of state.tokens) {
6529
- state.output += token.output != null ? token.output : token.value;
6530
- if (token.suffix) {
6531
- state.output += token.suffix;
6532
- }
6533
- }
6534
- }
6535
- return state;
6536
- };
6537
- parse2.fastpaths = (input, options) => {
6538
- const opts = { ...options };
6539
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
6540
- const len = input.length;
6541
- if (len > max) {
6542
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
6543
- }
6544
- input = REPLACEMENTS[input] || input;
6545
- const {
6546
- DOT_LITERAL,
6547
- SLASH_LITERAL,
6548
- ONE_CHAR,
6549
- DOTS_SLASH,
6550
- NO_DOT,
6551
- NO_DOTS,
6552
- NO_DOTS_SLASH,
6553
- STAR,
6554
- START_ANCHOR
6555
- } = constants.globChars(opts.windows);
6556
- const nodot = opts.dot ? NO_DOTS : NO_DOT;
6557
- const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
6558
- const capture = opts.capture ? "" : "?:";
6559
- const state = { negated: false, prefix: "" };
6560
- let star = opts.bash === true ? ".*?" : STAR;
6561
- if (opts.capture) {
6562
- star = `(${star})`;
6563
- }
6564
- const globstar = (opts2) => {
6565
- if (opts2.noglobstar === true)
6566
- return star;
6567
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
6568
- };
6569
- const create = (str) => {
6570
- switch (str) {
6571
- case "*":
6572
- return `${nodot}${ONE_CHAR}${star}`;
6573
- case ".*":
6574
- return `${DOT_LITERAL}${ONE_CHAR}${star}`;
6575
- case "*.*":
6576
- return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
6577
- case "*/*":
6578
- return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
6579
- case "**":
6580
- return nodot + globstar(opts);
6581
- case "**/*":
6582
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
6583
- case "**/*.*":
6584
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
6585
- case "**/.*":
6586
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
6587
- default: {
6588
- const match = /^(.*?)\.(\w+)$/.exec(str);
6589
- if (!match)
6590
- return;
6591
- const source2 = create(match[1]);
6592
- if (!source2)
6593
- return;
6594
- return source2 + DOT_LITERAL + match[2];
6595
- }
6596
- }
6597
- };
6598
- const output = utils.removePrefix(input, state);
6599
- let source = create(output);
6600
- if (source && opts.strictSlashes !== true) {
6601
- source += `${SLASH_LITERAL}?`;
6602
- }
6603
- return source;
6604
- };
6605
- module.exports = parse2;
6606
- });
6607
-
6608
- // ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
6609
- var require_picomatch2 = __commonJS((exports, module) => {
6610
- var scan = require_scan2();
6611
- var parse2 = require_parse3();
6612
- var utils = require_utils5();
6613
- var constants = require_constants5();
6614
- var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
6615
- var picomatch = (glob, options, returnState = false) => {
6616
- if (Array.isArray(glob)) {
6617
- const fns = glob.map((input) => picomatch(input, options, returnState));
6618
- const arrayMatcher = (str) => {
6619
- for (const isMatch of fns) {
6620
- const state2 = isMatch(str);
6621
- if (state2)
6622
- return state2;
6623
- }
6624
- return false;
6625
- };
6626
- return arrayMatcher;
6627
- }
6628
- const isState = isObject2(glob) && glob.tokens && glob.input;
6629
- if (glob === "" || typeof glob !== "string" && !isState) {
6630
- throw new TypeError("Expected pattern to be a non-empty string");
6631
- }
6632
- const opts = options || {};
6633
- const posix = opts.windows;
6634
- const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
6635
- const state = regex.state;
6636
- delete regex.state;
6637
- let isIgnored = () => false;
6638
- if (opts.ignore) {
6639
- const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
6640
- isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
6641
- }
6642
- const matcher = (input, returnObject = false) => {
6643
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
6644
- const result = { glob, state, regex, posix, input, output, match, isMatch };
6645
- if (typeof opts.onResult === "function") {
6646
- opts.onResult(result);
6647
- }
6648
- if (isMatch === false) {
6649
- result.isMatch = false;
6650
- return returnObject ? result : false;
6651
- }
6652
- if (isIgnored(input)) {
6653
- if (typeof opts.onIgnore === "function") {
6654
- opts.onIgnore(result);
6655
- }
6656
- result.isMatch = false;
6657
- return returnObject ? result : false;
6658
- }
6659
- if (typeof opts.onMatch === "function") {
6660
- opts.onMatch(result);
6661
- }
6662
- return returnObject ? result : true;
6663
- };
6664
- if (returnState) {
6665
- matcher.state = state;
6666
- }
6667
- return matcher;
6668
- };
6669
- picomatch.test = (input, regex, options, { glob, posix } = {}) => {
6670
- if (typeof input !== "string") {
6671
- throw new TypeError("Expected input to be a string");
6672
- }
6673
- if (input === "") {
6674
- return { isMatch: false, output: "" };
6675
- }
6676
- const opts = options || {};
6677
- const format = opts.format || (posix ? utils.toPosixSlashes : null);
6678
- let match = input === glob;
6679
- let output = match && format ? format(input) : input;
6680
- if (match === false) {
6681
- output = format ? format(input) : input;
6682
- match = output === glob;
6683
- }
6684
- if (match === false || opts.capture === true) {
6685
- if (opts.matchBase === true || opts.basename === true) {
6686
- match = picomatch.matchBase(input, regex, options, posix);
6687
- } else {
6688
- match = regex.exec(output);
6689
- }
6690
- }
6691
- return { isMatch: Boolean(match), match, output };
6692
- };
6693
- picomatch.matchBase = (input, glob, options) => {
6694
- const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
6695
- return regex.test(utils.basename(input));
6696
- };
6697
- picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
6698
- picomatch.parse = (pattern, options) => {
6699
- if (Array.isArray(pattern))
6700
- return pattern.map((p) => picomatch.parse(p, options));
6701
- return parse2(pattern, { ...options, fastpaths: false });
6702
- };
6703
- picomatch.scan = (input, options) => scan(input, options);
6704
- picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
6705
- if (returnOutput === true) {
6706
- return state.output;
6707
- }
6708
- const opts = options || {};
6709
- const prepend = opts.contains ? "" : "^";
6710
- const append = opts.contains ? "" : "$";
6711
- let source = `${prepend}(?:${state.output})${append}`;
6712
- if (state && state.negated === true) {
6713
- source = `^(?!${source}).*$`;
6714
- }
6715
- const regex = picomatch.toRegex(source, options);
6716
- if (returnState === true) {
6717
- regex.state = state;
6718
- }
6719
- return regex;
6720
- };
6721
- picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
6722
- if (!input || typeof input !== "string") {
6723
- throw new TypeError("Expected a non-empty string");
6724
- }
6725
- let parsed = { negated: false, fastpaths: true };
6726
- if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
6727
- parsed.output = parse2.fastpaths(input, options);
6728
- }
6729
- if (!parsed.output) {
6730
- parsed = parse2(input, options);
6731
- }
6732
- return picomatch.compileRe(parsed, options, returnOutput, returnState);
6733
- };
6734
- picomatch.toRegex = (source, options) => {
6735
- try {
6736
- const opts = options || {};
6737
- return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
6738
- } catch (err) {
6739
- if (options && options.debug === true)
6740
- throw err;
6741
- return /$^/;
6742
- }
6743
- };
6744
- picomatch.constants = constants;
6745
- module.exports = picomatch;
6746
- });
6747
-
6748
- // ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js
6749
- var require_picomatch3 = __commonJS((exports, module) => {
6750
- var pico = require_picomatch2();
6751
- var utils = require_utils5();
6752
- function picomatch(glob, options, returnState = false) {
6753
- if (options && (options.windows === null || options.windows === undefined)) {
6754
- options = { ...options, windows: utils.isWindows() };
6755
- }
6756
- return pico(glob, options, returnState);
6757
- }
6758
- Object.assign(picomatch, pico);
6759
- module.exports = picomatch;
6760
- });
6761
-
6762
- // ../../node_modules/.pnpm/@parcel+watcher@2.5.6/node_modules/@parcel/watcher/wrapper.js
6763
- var require_wrapper = __commonJS((exports) => {
6764
- var path3 = __require("path");
6765
- var picomatch = require_picomatch3();
6766
- var isGlob = require_is_glob();
6767
- function normalizeOptions(dir, opts = {}) {
6768
- const { ignore, ...rest } = opts;
6769
- if (Array.isArray(ignore)) {
6770
- opts = { ...rest };
6771
- for (const value of ignore) {
6772
- if (isGlob(value)) {
6773
- if (!opts.ignoreGlobs) {
6774
- opts.ignoreGlobs = [];
6775
- }
6776
- const regex = picomatch.makeRe(value, {
6777
- dot: true,
6778
- windows: process.platform === "win32"
6779
- });
6780
- opts.ignoreGlobs.push(regex.source);
6781
- } else {
6782
- if (!opts.ignorePaths) {
6783
- opts.ignorePaths = [];
6784
- }
6785
- opts.ignorePaths.push(path3.resolve(dir, value));
6786
- }
6787
- }
6788
- }
6789
- return opts;
6790
- }
6791
- exports.createWrapper = (binding) => {
6792
- return {
6793
- writeSnapshot(dir, snapshot, opts) {
6794
- return binding.writeSnapshot(path3.resolve(dir), path3.resolve(snapshot), normalizeOptions(dir, opts));
6795
- },
6796
- getEventsSince(dir, snapshot, opts) {
6797
- return binding.getEventsSince(path3.resolve(dir), path3.resolve(snapshot), normalizeOptions(dir, opts));
6798
- },
6799
- async subscribe(dir, fn, opts) {
6800
- dir = path3.resolve(dir);
6801
- opts = normalizeOptions(dir, opts);
6802
- await binding.subscribe(dir, fn, opts);
6803
- return {
6804
- unsubscribe() {
6805
- return binding.unsubscribe(dir, fn, opts);
6806
- }
6807
- };
6808
- },
6809
- unsubscribe(dir, fn, opts) {
6810
- return binding.unsubscribe(path3.resolve(dir), fn, normalizeOptions(dir, opts));
6811
- }
6812
- };
6813
- };
6814
- });
6815
-
6816
- // ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js
6817
- var require_process = __commonJS((exports, module) => {
6818
- var isLinux = () => process.platform === "linux";
6819
- var report = null;
6820
- var getReport = () => {
6821
- if (!report) {
6822
- if (isLinux() && process.report) {
6823
- const orig = process.report.excludeNetwork;
6824
- process.report.excludeNetwork = true;
6825
- report = process.report.getReport();
6826
- process.report.excludeNetwork = orig;
6827
- } else {
6828
- report = {};
6829
- }
6830
- }
6831
- return report;
6832
- };
6833
- module.exports = { isLinux, getReport };
6834
- });
6835
-
6836
- // ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js
6837
- var require_filesystem = __commonJS((exports, module) => {
6838
- var fs2 = __require("fs");
6839
- var LDD_PATH = "/usr/bin/ldd";
6840
- var SELF_PATH = "/proc/self/exe";
6841
- var MAX_LENGTH = 2048;
6842
- var readFileSync = (path3) => {
6843
- const fd = fs2.openSync(path3, "r");
6844
- const buffer = Buffer.alloc(MAX_LENGTH);
6845
- const bytesRead = fs2.readSync(fd, buffer, 0, MAX_LENGTH, 0);
6846
- fs2.close(fd, () => {});
6847
- return buffer.subarray(0, bytesRead);
6848
- };
6849
- var readFile = (path3) => new Promise((resolve, reject) => {
6850
- fs2.open(path3, "r", (err, fd) => {
6851
- if (err) {
6852
- reject(err);
6853
- } else {
6854
- const buffer = Buffer.alloc(MAX_LENGTH);
6855
- fs2.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
6856
- resolve(buffer.subarray(0, bytesRead));
6857
- fs2.close(fd, () => {});
6858
- });
6859
- }
6860
- });
6861
- });
6862
- module.exports = {
6863
- LDD_PATH,
6864
- SELF_PATH,
6865
- readFileSync,
6866
- readFile
6867
- };
6868
- });
6869
-
6870
- // ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js
6871
- var require_elf = __commonJS((exports, module) => {
6872
- var interpreterPath = (elf) => {
6873
- if (elf.length < 64) {
6874
- return null;
6875
- }
6876
- if (elf.readUInt32BE(0) !== 2135247942) {
6877
- return null;
6878
- }
6879
- if (elf.readUInt8(4) !== 2) {
6880
- return null;
6881
- }
6882
- if (elf.readUInt8(5) !== 1) {
6883
- return null;
6884
- }
6885
- const offset = elf.readUInt32LE(32);
6886
- const size = elf.readUInt16LE(54);
6887
- const count = elf.readUInt16LE(56);
6888
- for (let i = 0;i < count; i++) {
6889
- const headerOffset = offset + i * size;
6890
- const type = elf.readUInt32LE(headerOffset);
6891
- if (type === 3) {
6892
- const fileOffset = elf.readUInt32LE(headerOffset + 8);
6893
- const fileSize = elf.readUInt32LE(headerOffset + 32);
6894
- return elf.subarray(fileOffset, fileOffset + fileSize).toString().replace(/\0.*$/g, "");
6895
- }
6896
- }
6897
- return null;
6898
- };
6899
- module.exports = {
6900
- interpreterPath
6901
- };
6902
- });
6903
-
6904
- // ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js
6905
- var require_detect_libc = __commonJS((exports, module) => {
6906
- var childProcess = __require("child_process");
6907
- var { isLinux, getReport } = require_process();
6908
- var { LDD_PATH, SELF_PATH, readFile, readFileSync } = require_filesystem();
6909
- var { interpreterPath } = require_elf();
6910
- var cachedFamilyInterpreter;
6911
- var cachedFamilyFilesystem;
6912
- var cachedVersionFilesystem;
6913
- var command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
6914
- var commandOut = "";
6915
- var safeCommand = () => {
6916
- if (!commandOut) {
6917
- return new Promise((resolve) => {
6918
- childProcess.exec(command, (err, out) => {
6919
- commandOut = err ? " " : out;
6920
- resolve(commandOut);
6921
- });
6922
- });
6923
- }
6924
- return commandOut;
6925
- };
6926
- var safeCommandSync = () => {
6927
- if (!commandOut) {
6928
- try {
6929
- commandOut = childProcess.execSync(command, { encoding: "utf8" });
6930
- } catch (_err) {
6931
- commandOut = " ";
6932
- }
6933
- }
6934
- return commandOut;
6935
- };
6936
- var GLIBC = "glibc";
6937
- var RE_GLIBC_VERSION = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i;
6938
- var MUSL = "musl";
6939
- var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
6940
- var familyFromReport = () => {
6941
- const report = getReport();
6942
- if (report.header && report.header.glibcVersionRuntime) {
6943
- return GLIBC;
6944
- }
6945
- if (Array.isArray(report.sharedObjects)) {
6946
- if (report.sharedObjects.some(isFileMusl)) {
6947
- return MUSL;
6948
- }
6949
- }
6950
- return null;
6951
- };
6952
- var familyFromCommand = (out) => {
6953
- const [getconf, ldd1] = out.split(/[\r\n]+/);
6954
- if (getconf && getconf.includes(GLIBC)) {
6955
- return GLIBC;
6956
- }
6957
- if (ldd1 && ldd1.includes(MUSL)) {
6958
- return MUSL;
6959
- }
6960
- return null;
6961
- };
6962
- var familyFromInterpreterPath = (path3) => {
6963
- if (path3) {
6964
- if (path3.includes("/ld-musl-")) {
6965
- return MUSL;
6966
- } else if (path3.includes("/ld-linux-")) {
6967
- return GLIBC;
6968
- }
6969
- }
6970
- return null;
6971
- };
6972
- var getFamilyFromLddContent = (content) => {
6973
- content = content.toString();
6974
- if (content.includes("musl")) {
6975
- return MUSL;
6976
- }
6977
- if (content.includes("GNU C Library")) {
6978
- return GLIBC;
6979
- }
6980
- return null;
6981
- };
6982
- var familyFromFilesystem = async () => {
6983
- if (cachedFamilyFilesystem !== undefined) {
6984
- return cachedFamilyFilesystem;
6985
- }
6986
- cachedFamilyFilesystem = null;
6987
- try {
6988
- const lddContent = await readFile(LDD_PATH);
6989
- cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
6990
- } catch (e) {}
6991
- return cachedFamilyFilesystem;
6992
- };
6993
- var familyFromFilesystemSync = () => {
6994
- if (cachedFamilyFilesystem !== undefined) {
6995
- return cachedFamilyFilesystem;
6996
- }
6997
- cachedFamilyFilesystem = null;
6998
- try {
6999
- const lddContent = readFileSync(LDD_PATH);
7000
- cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
7001
- } catch (e) {}
7002
- return cachedFamilyFilesystem;
7003
- };
7004
- var familyFromInterpreter = async () => {
7005
- if (cachedFamilyInterpreter !== undefined) {
7006
- return cachedFamilyInterpreter;
7007
- }
7008
- cachedFamilyInterpreter = null;
7009
- try {
7010
- const selfContent = await readFile(SELF_PATH);
7011
- const path3 = interpreterPath(selfContent);
7012
- cachedFamilyInterpreter = familyFromInterpreterPath(path3);
7013
- } catch (e) {}
7014
- return cachedFamilyInterpreter;
7015
- };
7016
- var familyFromInterpreterSync = () => {
7017
- if (cachedFamilyInterpreter !== undefined) {
7018
- return cachedFamilyInterpreter;
7019
- }
7020
- cachedFamilyInterpreter = null;
7021
- try {
7022
- const selfContent = readFileSync(SELF_PATH);
7023
- const path3 = interpreterPath(selfContent);
7024
- cachedFamilyInterpreter = familyFromInterpreterPath(path3);
7025
- } catch (e) {}
7026
- return cachedFamilyInterpreter;
7027
- };
7028
- var family = async () => {
7029
- let family2 = null;
7030
- if (isLinux()) {
7031
- family2 = await familyFromInterpreter();
7032
- if (!family2) {
7033
- family2 = await familyFromFilesystem();
7034
- if (!family2) {
7035
- family2 = familyFromReport();
7036
- }
7037
- if (!family2) {
7038
- const out = await safeCommand();
7039
- family2 = familyFromCommand(out);
7040
- }
7041
- }
7042
- }
7043
- return family2;
7044
- };
7045
- var familySync = () => {
7046
- let family2 = null;
7047
- if (isLinux()) {
7048
- family2 = familyFromInterpreterSync();
7049
- if (!family2) {
7050
- family2 = familyFromFilesystemSync();
7051
- if (!family2) {
7052
- family2 = familyFromReport();
7053
- }
7054
- if (!family2) {
7055
- const out = safeCommandSync();
7056
- family2 = familyFromCommand(out);
7057
- }
7058
- }
7059
- }
7060
- return family2;
7061
- };
7062
- var isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
7063
- var isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
7064
- var versionFromFilesystem = async () => {
7065
- if (cachedVersionFilesystem !== undefined) {
7066
- return cachedVersionFilesystem;
7067
- }
7068
- cachedVersionFilesystem = null;
7069
- try {
7070
- const lddContent = await readFile(LDD_PATH);
7071
- const versionMatch = lddContent.match(RE_GLIBC_VERSION);
7072
- if (versionMatch) {
7073
- cachedVersionFilesystem = versionMatch[1];
7074
- }
7075
- } catch (e) {}
7076
- return cachedVersionFilesystem;
7077
- };
7078
- var versionFromFilesystemSync = () => {
7079
- if (cachedVersionFilesystem !== undefined) {
7080
- return cachedVersionFilesystem;
7081
- }
7082
- cachedVersionFilesystem = null;
7083
- try {
7084
- const lddContent = readFileSync(LDD_PATH);
7085
- const versionMatch = lddContent.match(RE_GLIBC_VERSION);
7086
- if (versionMatch) {
7087
- cachedVersionFilesystem = versionMatch[1];
7088
- }
7089
- } catch (e) {}
7090
- return cachedVersionFilesystem;
7091
- };
7092
- var versionFromReport = () => {
7093
- const report = getReport();
7094
- if (report.header && report.header.glibcVersionRuntime) {
7095
- return report.header.glibcVersionRuntime;
7096
- }
7097
- return null;
7098
- };
7099
- var versionSuffix = (s) => s.trim().split(/\s+/)[1];
7100
- var versionFromCommand = (out) => {
7101
- const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
7102
- if (getconf && getconf.includes(GLIBC)) {
7103
- return versionSuffix(getconf);
7104
- }
7105
- if (ldd1 && ldd2 && ldd1.includes(MUSL)) {
7106
- return versionSuffix(ldd2);
7107
- }
7108
- return null;
7109
- };
7110
- var version3 = async () => {
7111
- let version4 = null;
7112
- if (isLinux()) {
7113
- version4 = await versionFromFilesystem();
7114
- if (!version4) {
7115
- version4 = versionFromReport();
7116
- }
7117
- if (!version4) {
7118
- const out = await safeCommand();
7119
- version4 = versionFromCommand(out);
7120
- }
7121
- }
7122
- return version4;
7123
- };
7124
- var versionSync = () => {
7125
- let version4 = null;
7126
- if (isLinux()) {
7127
- version4 = versionFromFilesystemSync();
7128
- if (!version4) {
7129
- version4 = versionFromReport();
7130
- }
7131
- if (!version4) {
7132
- const out = safeCommandSync();
7133
- version4 = versionFromCommand(out);
7134
- }
7135
- }
7136
- return version4;
7137
- };
7138
- module.exports = {
7139
- GLIBC,
7140
- MUSL,
7141
- family,
7142
- familySync,
7143
- isNonGlibcLinux,
7144
- isNonGlibcLinuxSync,
7145
- version: version3,
7146
- versionSync
7147
- };
7148
- });
7149
-
7150
5315
  // ../../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js
7151
5316
  var require_eventemitter32 = __commonJS((exports, module) => {
7152
5317
  var has = Object.prototype.hasOwnProperty;
@@ -7186,12 +5351,12 @@ var require_eventemitter32 = __commonJS((exports, module) => {
7186
5351
  this._eventsCount = 0;
7187
5352
  }
7188
5353
  EventEmitter.prototype.eventNames = function eventNames() {
7189
- var names = [], events, name2;
5354
+ var names = [], events, name;
7190
5355
  if (this._eventsCount === 0)
7191
5356
  return names;
7192
- for (name2 in events = this._events) {
7193
- if (has.call(events, name2))
7194
- names.push(prefix ? name2.slice(1) : name2);
5357
+ for (name in events = this._events) {
5358
+ if (has.call(events, name))
5359
+ names.push(prefix ? name.slice(1) : name);
7195
5360
  }
7196
5361
  if (Object.getOwnPropertySymbols) {
7197
5362
  return names.concat(Object.getOwnPropertySymbols(events));
@@ -26980,6 +25145,8 @@ class ProjectSearch {
26980
25145
  filter.push(`projectPath = "${options.projectPath}"`);
26981
25146
  if (options?.repo)
26982
25147
  filter.push(`repo = "${options.repo}"`);
25148
+ if (options?.filepath)
25149
+ filter.push(`filepath = "${options.filepath}"`);
26983
25150
  if (options?.title)
26984
25151
  filter.push(`title = "${options.title}"`);
26985
25152
  if (options?.tags) {
@@ -27248,47 +25415,8 @@ class ProjectStore {
27248
25415
  }
27249
25416
  }
27250
25417
 
27251
- // ../../node_modules/.pnpm/@parcel+watcher@2.5.6/node_modules/@parcel/watcher/index.js
27252
- var { createWrapper } = require_wrapper();
27253
- var name = `@parcel/watcher-${process.platform}-${process.arch}`;
27254
- if (process.platform === "linux") {
27255
- const { MUSL, familySync } = require_detect_libc();
27256
- const family = familySync();
27257
- if (family === MUSL) {
27258
- name += "-musl";
27259
- } else {
27260
- name += "-glibc";
27261
- }
27262
- }
27263
- var binding;
27264
- try {
27265
- binding = __require(name);
27266
- } catch (err) {
27267
- handleError(err);
27268
- try {
27269
- binding = (()=>{throw new Error("Cannot require module "+"./build/Release/watcher.node");})();
27270
- } catch (err2) {
27271
- handleError(err2);
27272
- try {
27273
- binding = (()=>{throw new Error("Cannot require module "+"./build/Debug/watcher.node");})();
27274
- } catch (err3) {
27275
- handleError(err3);
27276
- throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`);
27277
- }
27278
- }
27279
- }
27280
- function handleError(err) {
27281
- if (err?.code !== "MODULE_NOT_FOUND") {
27282
- throw err;
27283
- }
27284
- }
27285
- var wrapper = createWrapper(binding);
27286
- var $writeSnapshot = wrapper.writeSnapshot;
27287
- var $getEventsSince = wrapper.getEventsSince;
27288
- var $subscribe = wrapper.subscribe;
27289
- var $unsubscribe = wrapper.unsubscribe;
27290
-
27291
25418
  // src/project/project-listener/listener.ts
25419
+ import { subscribe } from "@parcel/watcher";
27292
25420
  import path3 from "node:path";
27293
25421
  import fs2 from "node:fs";
27294
25422
  class ProjectListener {
@@ -27312,7 +25440,7 @@ class ProjectListener {
27312
25440
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
27313
25441
  }
27314
25442
  const allIgnore = [...defaultIgnorePatterns, ...ignorePatterns];
27315
- const sub = await $subscribe(this.projectPath, async (err, events) => {
25443
+ const sub = await subscribe(this.projectPath, async (err, events) => {
27316
25444
  if (err)
27317
25445
  throw err;
27318
25446
  for (const event of events) {
@@ -27370,6 +25498,7 @@ var import__2 = __toESM(require_eventemitter32(), 1);
27370
25498
 
27371
25499
  // src/project/manager.ts
27372
25500
  import fs3 from "node:fs";
25501
+ import path4 from "node:path";
27373
25502
  class ProjectManager {
27374
25503
  projects = new Map;
27375
25504
  projectSearch;
@@ -27480,6 +25609,20 @@ class ProjectManager {
27480
25609
  type: "base64"
27481
25610
  };
27482
25611
  }
25612
+ async writeFile(filepath, content) {
25613
+ try {
25614
+ const buffer = Buffer.from(content, "base64");
25615
+ const dir = path4.dirname(filepath);
25616
+ if (!fs3.existsSync(dir)) {
25617
+ fs3.mkdirSync(dir, { recursive: true });
25618
+ }
25619
+ fs3.writeFileSync(filepath, buffer);
25620
+ return true;
25621
+ } catch (error48) {
25622
+ console.error("写入文件失败:", error48);
25623
+ return false;
25624
+ }
25625
+ }
27483
25626
  async deleteFile(filepath) {
27484
25627
  if (!fileIsExist(filepath)) {
27485
25628
  return false;
@@ -27546,12 +25689,12 @@ function requireEventemitter3() {
27546
25689
  this._eventsCount = 0;
27547
25690
  }
27548
25691
  EventEmitter2.prototype.eventNames = function eventNames() {
27549
- var names = [], events, name2;
25692
+ var names = [], events, name;
27550
25693
  if (this._eventsCount === 0)
27551
25694
  return names;
27552
- for (name2 in events = this._events) {
27553
- if (has.call(events, name2))
27554
- names.push(prefix ? name2.slice(1) : name2);
25695
+ for (name in events = this._events) {
25696
+ if (has.call(events, name))
25697
+ names.push(prefix ? name.slice(1) : name);
27555
25698
  }
27556
25699
  if (Object.getOwnPropertySymbols) {
27557
25700
  return names.concat(Object.getOwnPropertySymbols(events));
@@ -28626,7 +26769,7 @@ __export(exports_core3, {
28626
26769
  var NEVER2 = Object.freeze({
28627
26770
  status: "aborted"
28628
26771
  });
28629
- function $constructor2(name2, initializer3, params) {
26772
+ function $constructor2(name, initializer3, params) {
28630
26773
  function init(inst, def) {
28631
26774
  if (!inst._zod) {
28632
26775
  Object.defineProperty(inst, "_zod", {
@@ -28638,10 +26781,10 @@ function $constructor2(name2, initializer3, params) {
28638
26781
  enumerable: false
28639
26782
  });
28640
26783
  }
28641
- if (inst._zod.traits.has(name2)) {
26784
+ if (inst._zod.traits.has(name)) {
28642
26785
  return;
28643
26786
  }
28644
- inst._zod.traits.add(name2);
26787
+ inst._zod.traits.add(name);
28645
26788
  initializer3(inst, def);
28646
26789
  const proto = _.prototype;
28647
26790
  const keys = Object.keys(proto);
@@ -28656,7 +26799,7 @@ function $constructor2(name2, initializer3, params) {
28656
26799
 
28657
26800
  class Definition extends Parent {
28658
26801
  }
28659
- Object.defineProperty(Definition, "name", { value: name2 });
26802
+ Object.defineProperty(Definition, "name", { value: name });
28660
26803
  function _(def) {
28661
26804
  var _a2;
28662
26805
  const inst = params?.Parent ? new Definition : this;
@@ -28672,10 +26815,10 @@ function $constructor2(name2, initializer3, params) {
28672
26815
  value: (inst) => {
28673
26816
  if (params?.Parent && inst instanceof params.Parent)
28674
26817
  return true;
28675
- return inst?._zod?.traits?.has(name2);
26818
+ return inst?._zod?.traits?.has(name);
28676
26819
  }
28677
26820
  });
28678
- Object.defineProperty(_, "name", { value: name2 });
26821
+ Object.defineProperty(_, "name", { value: name });
28679
26822
  return _;
28680
26823
  }
28681
26824
  var $brand2 = Symbol("zod_brand");
@@ -28687,8 +26830,8 @@ class $ZodAsyncError2 extends Error {
28687
26830
  }
28688
26831
 
28689
26832
  class $ZodEncodeError2 extends Error {
28690
- constructor(name2) {
28691
- super(`Encountered unidirectional transform during encode: ${name2}`);
26833
+ constructor(name) {
26834
+ super(`Encountered unidirectional transform during encode: ${name}`);
28692
26835
  this.name = "ZodEncodeError";
28693
26836
  }
28694
26837
  }
@@ -28868,10 +27011,10 @@ function mergeDefs2(...defs) {
28868
27011
  function cloneDef2(schema) {
28869
27012
  return mergeDefs2(schema._zod.def);
28870
27013
  }
28871
- function getElementAtPath2(obj, path4) {
28872
- if (!path4)
27014
+ function getElementAtPath2(obj, path5) {
27015
+ if (!path5)
28873
27016
  return obj;
28874
- return path4.reduce((acc, key) => acc?.[key], obj);
27017
+ return path5.reduce((acc, key) => acc?.[key], obj);
28875
27018
  }
28876
27019
  function promiseAllObject2(promisesObj) {
28877
27020
  const keys = Object.keys(promisesObj);
@@ -29252,11 +27395,11 @@ function aborted2(x, startIndex = 0) {
29252
27395
  }
29253
27396
  return false;
29254
27397
  }
29255
- function prefixIssues2(path4, issues) {
27398
+ function prefixIssues2(path5, issues) {
29256
27399
  return issues.map((iss) => {
29257
27400
  var _a2;
29258
27401
  (_a2 = iss).path ?? (_a2.path = []);
29259
- iss.path.unshift(path4);
27402
+ iss.path.unshift(path5);
29260
27403
  return iss;
29261
27404
  });
29262
27405
  }
@@ -29439,7 +27582,7 @@ function formatError2(error48, mapper = (issue3) => issue3.message) {
29439
27582
  }
29440
27583
  function treeifyError2(error48, mapper = (issue3) => issue3.message) {
29441
27584
  const result = { errors: [] };
29442
- const processError = (error49, path4 = []) => {
27585
+ const processError = (error49, path5 = []) => {
29443
27586
  var _a2, _b;
29444
27587
  for (const issue3 of error49.issues) {
29445
27588
  if (issue3.code === "invalid_union" && issue3.errors.length) {
@@ -29449,7 +27592,7 @@ function treeifyError2(error48, mapper = (issue3) => issue3.message) {
29449
27592
  } else if (issue3.code === "invalid_element") {
29450
27593
  processError({ issues: issue3.issues }, issue3.path);
29451
27594
  } else {
29452
- const fullpath = [...path4, ...issue3.path];
27595
+ const fullpath = [...path5, ...issue3.path];
29453
27596
  if (fullpath.length === 0) {
29454
27597
  result.errors.push(mapper(issue3));
29455
27598
  continue;
@@ -29481,8 +27624,8 @@ function treeifyError2(error48, mapper = (issue3) => issue3.message) {
29481
27624
  }
29482
27625
  function toDotPath2(_path) {
29483
27626
  const segs = [];
29484
- const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
29485
- for (const seg of path4) {
27627
+ const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
27628
+ for (const seg of path5) {
29486
27629
  if (typeof seg === "number")
29487
27630
  segs.push(`[${seg}]`);
29488
27631
  else if (typeof seg === "symbol")
@@ -41229,13 +39372,13 @@ function resolveRef2(ref, ctx) {
41229
39372
  if (!ref.startsWith("#")) {
41230
39373
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
41231
39374
  }
41232
- const path4 = ref.slice(1).split("/").filter(Boolean);
41233
- if (path4.length === 0) {
39375
+ const path5 = ref.slice(1).split("/").filter(Boolean);
39376
+ if (path5.length === 0) {
41234
39377
  return ctx.rootSchema;
41235
39378
  }
41236
39379
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
41237
- if (path4[0] === defsKey) {
41238
- const key = path4[1];
39380
+ if (path5[0] === defsKey) {
39381
+ const key = path5[1];
41239
39382
  if (!key || !ctx.defs[key]) {
41240
39383
  throw new Error(`Reference not found: ${ref}`);
41241
39384
  }
@@ -41647,7 +39790,7 @@ var getGitPathname = (repoPath) => {
41647
39790
  }
41648
39791
  return null;
41649
39792
  } catch (err) {
41650
- console.error(`Failed to get remote URL for repo at ${repoPath}:`, err);
39793
+ console.warn(`[getGitPathname] Failed to get git remote url for ${repoPath}:`);
41651
39794
  return null;
41652
39795
  }
41653
39796
  };
@@ -41666,7 +39809,7 @@ app.route({
41666
39809
  }
41667
39810
  }
41668
39811
  }).define(async (ctx) => {
41669
- let { filepath, repo, name: name2 } = ctx.query;
39812
+ let { filepath, repo, name } = ctx.query;
41670
39813
  if (!filepath)
41671
39814
  ctx.throw(400, "filepath 不能为空");
41672
39815
  if (!repo) {
@@ -41678,7 +39821,7 @@ app.route({
41678
39821
  repo = pathParts[pathParts.length - 1];
41679
39822
  }
41680
39823
  }
41681
- const info = await manager.addProject({ path: filepath, repo, name: name2 });
39824
+ const info = await manager.addProject({ path: filepath, repo, name });
41682
39825
  ctx.body = { success: true, data: info };
41683
39826
  }).addTo(app);
41684
39827
  app.route({
@@ -41761,10 +39904,10 @@ app.route({
41761
39904
  }
41762
39905
  }
41763
39906
  }).define(async (ctx) => {
41764
- const { filepath, name: name2, title, tags, summary, description, link } = ctx.query;
39907
+ const { filepath, name, title, tags, summary, description, link } = ctx.query;
41765
39908
  if (!filepath)
41766
39909
  ctx.throw(400, "filepath 不能为空");
41767
- await manager.projectStore.updateProject(filepath, { name: name2, title, tags, summary, description, link });
39910
+ await manager.projectStore.updateProject(filepath, { name, title, tags, summary, description, link });
41768
39911
  ctx.body = { success: true };
41769
39912
  }).addTo(app);
41770
39913
 
@@ -41778,6 +39921,7 @@ app.route({
41778
39921
  args: {
41779
39922
  q: exports_external2.string().optional().describe("搜索关键词,选填;留空或不传则返回全部文件"),
41780
39923
  projectPath: exports_external2.string().optional().describe("按项目根目录路径过滤,仅返回该项目下的文件,选填"),
39924
+ filepath: exports_external2.string().optional().describe("按文件绝对路径过滤,选填"),
41781
39925
  repo: exports_external2.string().optional().describe("按代码仓库标识过滤(如 owner/repo),选填"),
41782
39926
  title: exports_external2.string().optional().describe("按人工标注的标题字段过滤,选填"),
41783
39927
  tags: exports_external2.array(exports_external2.string()).optional().describe("按人工标注的标签列表过滤,选填"),
@@ -41790,13 +39934,13 @@ app.route({
41790
39934
  }
41791
39935
  }
41792
39936
  }).define(async (ctx) => {
41793
- let { q, projectPath, repo, title, tags, summary, description, link, sort, limit, getContent = false } = ctx.query;
39937
+ let { q, projectPath, filepath, repo, title, tags, summary, description, link, sort, limit, getContent = false } = ctx.query;
41794
39938
  if (!q) {
41795
39939
  sort = sort ?? ["projectPath:asc"];
41796
39940
  limit = limit ?? 1000;
41797
39941
  }
41798
39942
  const projectSearch = manager.projectSearch;
41799
- const hits = await projectSearch.searchFiles(q, { projectPath, repo, title, tags, summary, description, link, sort, limit, getContent });
39943
+ const hits = await projectSearch.searchFiles(q, { projectPath, filepath, repo, title, tags, summary, description, link, sort, limit, getContent });
41800
39944
  ctx.body = { list: hits };
41801
39945
  }).addTo(app);
41802
39946
 
@@ -41822,6 +39966,33 @@ app.route({
41822
39966
  ctx.throw(500, "读取文件失败");
41823
39967
  }
41824
39968
  }).addTo(app);
39969
+ app.route({
39970
+ path: "project-file",
39971
+ key: "update-content",
39972
+ middleware: ["auth-admin"],
39973
+ description: "将 base64 编码的内容写入指定文件路径,用于更新或创建文件",
39974
+ metadata: {
39975
+ args: {
39976
+ filepath: exports_external2.string().nonempty().describe("要写入的文件绝对路径,必填"),
39977
+ content: exports_external2.string().nonempty().describe("文件内容的 base64 编码,必填")
39978
+ }
39979
+ }
39980
+ }).define(async (ctx) => {
39981
+ const { filepath, content } = ctx.query;
39982
+ if (!filepath)
39983
+ ctx.throw(400, "filepath 不能为空");
39984
+ if (!content)
39985
+ ctx.throw(400, "content 不能为空");
39986
+ try {
39987
+ const success3 = await manager.writeFile(filepath, content);
39988
+ if (!success3) {
39989
+ ctx.throw(500, "写入文件失败");
39990
+ }
39991
+ ctx.body = { success: true };
39992
+ } catch (error49) {
39993
+ ctx.throw(500, "写入文件失败");
39994
+ }
39995
+ }).addTo(app);
41825
39996
  app.route({
41826
39997
  path: "project-file",
41827
39998
  key: "update",
@@ -41929,12 +40100,12 @@ var require_eventemitter33 = __commonJS3((exports, module) => {
41929
40100
  this._eventsCount = 0;
41930
40101
  }
41931
40102
  EventEmitter3.prototype.eventNames = function eventNames() {
41932
- var names = [], events, name2;
40103
+ var names = [], events, name;
41933
40104
  if (this._eventsCount === 0)
41934
40105
  return names;
41935
- for (name2 in events = this._events) {
41936
- if (has.call(events, name2))
41937
- names.push(prefix ? name2.slice(1) : name2);
40106
+ for (name in events = this._events) {
40107
+ if (has.call(events, name))
40108
+ names.push(prefix ? name.slice(1) : name);
41938
40109
  }
41939
40110
  if (Object.getOwnPropertySymbols) {
41940
40111
  return names.concat(Object.getOwnPropertySymbols(events));