@smallwebco/tinypivot-mcp 0.2.0 → 0.2.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.
@@ -39354,122 +39354,70 @@ var require_fs = __commonJS({
39354
39354
  }
39355
39355
  });
39356
39356
 
39357
- // ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/commonjs/index.js
39358
- var require_commonjs = __commonJS({
39359
- "../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/commonjs/index.js"(exports2) {
39357
+ // ../../node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js
39358
+ var require_concat_map = __commonJS({
39359
+ "../../node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js"(exports2, module2) {
39360
39360
  "use strict";
39361
- Object.defineProperty(exports2, "__esModule", { value: true });
39362
- exports2.range = exports2.balanced = void 0;
39363
- var balanced = (a, b, str) => {
39364
- const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
39365
- const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
39366
- const r = ma !== null && mb != null && (0, exports2.range)(ma, mb, str);
39367
- return r && {
39368
- start: r[0],
39369
- end: r[1],
39370
- pre: str.slice(0, r[0]),
39371
- body: str.slice(r[0] + ma.length, r[1]),
39372
- post: str.slice(r[1] + mb.length)
39373
- };
39374
- };
39375
- exports2.balanced = balanced;
39376
- var maybeMatch = (reg, str) => {
39377
- const m = str.match(reg);
39378
- return m ? m[0] : null;
39379
- };
39380
- var range2 = (a, b, str) => {
39381
- let begs, beg, left, right = void 0, result;
39382
- let ai = str.indexOf(a);
39383
- let bi = str.indexOf(b, ai + 1);
39384
- let i = ai;
39385
- if (ai >= 0 && bi > 0) {
39386
- if (a === b) {
39387
- return [ai, bi];
39388
- }
39389
- begs = [];
39390
- left = str.length;
39391
- while (i >= 0 && !result) {
39392
- if (i === ai) {
39393
- begs.push(i);
39394
- ai = str.indexOf(a, i + 1);
39395
- } else if (begs.length === 1) {
39396
- const r = begs.pop();
39397
- if (r !== void 0)
39398
- result = [r, bi];
39399
- } else {
39400
- beg = begs.pop();
39401
- if (beg !== void 0 && beg < left) {
39402
- left = beg;
39403
- right = bi;
39404
- }
39405
- bi = str.indexOf(b, i + 1);
39406
- }
39407
- i = ai < bi && ai >= 0 ? ai : bi;
39408
- }
39409
- if (begs.length && right !== void 0) {
39410
- result = [left, right];
39411
- }
39361
+ module2.exports = function(xs, fn) {
39362
+ var res = [];
39363
+ for (var i = 0; i < xs.length; i++) {
39364
+ var x = fn(xs[i], i);
39365
+ if (isArray(x)) res.push.apply(res, x);
39366
+ else res.push(x);
39412
39367
  }
39413
- return result;
39368
+ return res;
39369
+ };
39370
+ var isArray = Array.isArray || function(xs) {
39371
+ return Object.prototype.toString.call(xs) === "[object Array]";
39414
39372
  };
39415
- exports2.range = range2;
39416
39373
  }
39417
39374
  });
39418
39375
 
39419
- // ../../node_modules/.pnpm/brace-expansion@5.0.12/node_modules/brace-expansion/dist/commonjs/index.js
39420
- var require_commonjs2 = __commonJS({
39421
- "../../node_modules/.pnpm/brace-expansion@5.0.12/node_modules/brace-expansion/dist/commonjs/index.js"(exports2) {
39376
+ // ../../node_modules/.pnpm/brace-expansion@1.1.21/node_modules/brace-expansion/index.js
39377
+ var require_brace_expansion2 = __commonJS({
39378
+ "../../node_modules/.pnpm/brace-expansion@1.1.21/node_modules/brace-expansion/index.js"(exports2, module2) {
39422
39379
  "use strict";
39423
- Object.defineProperty(exports2, "__esModule", { value: true });
39424
- exports2.EXPANSION_MAX_REWRITES = exports2.EXPANSION_MAX_DEPTH = exports2.EXPANSION_MAX_LENGTH = exports2.EXPANSION_MAX = void 0;
39425
- exports2.expand = expand;
39426
- var balanced_match_1 = require_commonjs();
39380
+ var concatMap = require_concat_map();
39381
+ var balanced = require_balanced_match();
39382
+ module2.exports = expandTop;
39427
39383
  var escSlash = "\0SLASH" + Math.random() + "\0";
39428
39384
  var escOpen = "\0OPEN" + Math.random() + "\0";
39429
39385
  var escClose = "\0CLOSE" + Math.random() + "\0";
39430
39386
  var escComma = "\0COMMA" + Math.random() + "\0";
39431
39387
  var escPeriod = "\0PERIOD" + Math.random() + "\0";
39432
- var escSlashPattern = new RegExp(escSlash, "g");
39433
- var escOpenPattern = new RegExp(escOpen, "g");
39434
- var escClosePattern = new RegExp(escClose, "g");
39435
- var escCommaPattern = new RegExp(escComma, "g");
39436
- var escPeriodPattern = new RegExp(escPeriod, "g");
39437
- var slashPattern = /\\\\/g;
39438
- var openPattern = /\\{/g;
39439
- var closePattern = /\\}/g;
39440
- var commaPattern = /\\,/g;
39441
- var periodPattern = /\\\./g;
39442
- exports2.EXPANSION_MAX = 1e5;
39443
- exports2.EXPANSION_MAX_LENGTH = 4e6;
39444
- exports2.EXPANSION_MAX_DEPTH = 1e3;
39445
- exports2.EXPANSION_MAX_REWRITES = 1e3;
39388
+ var EXPANSION_MAX = 1e5;
39389
+ var EXPANSION_MAX_LENGTH = 4e6;
39390
+ var EXPANSION_MAX_DEPTH = 1e3;
39391
+ var EXPANSION_MAX_REWRITES = 1e3;
39446
39392
  function numeric(str) {
39447
- return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
39393
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
39448
39394
  }
39449
39395
  function escapeBraces(str) {
39450
- return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
39396
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
39451
39397
  }
39452
39398
  function unescapeBraces(str) {
39453
- return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
39399
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
39454
39400
  }
39455
39401
  function pushAll(target, items) {
39456
- for (let i = 0; i < items.length; i++) {
39402
+ for (var i = 0; i < items.length; i++) {
39457
39403
  target.push(items[i]);
39458
39404
  }
39459
39405
  }
39460
39406
  function parseCommaParts(str) {
39461
- const parts = [];
39462
- let carry = "";
39407
+ var parts = [];
39408
+ var carry = "";
39463
39409
  for (; ; ) {
39464
- const m = (0, balanced_match_1.balanced)("{", "}", str);
39410
+ var m = balanced("{", "}", str);
39465
39411
  if (!m) {
39466
- const tail = str.split(",");
39412
+ var tail = str.split(",");
39467
39413
  tail[0] = carry + tail[0];
39468
39414
  pushAll(parts, tail);
39469
39415
  return parts;
39470
39416
  }
39471
- const { pre, body, post } = m;
39472
- const p = pre.split(",");
39417
+ var pre = m.pre;
39418
+ var body = m.body;
39419
+ var post = m.post;
39420
+ var p = pre.split(",");
39473
39421
  p[0] = carry + p[0];
39474
39422
  p[p.length - 1] += "{" + body + "}";
39475
39423
  if (!post.length) {
@@ -39481,15 +39429,18 @@ var require_commonjs2 = __commonJS({
39481
39429
  str = post;
39482
39430
  }
39483
39431
  }
39484
- function expand(str, options = {}) {
39485
- if (!str) {
39432
+ function expandTop(str, options) {
39433
+ if (!str)
39486
39434
  return [];
39435
+ options = options || {};
39436
+ var max = options.max == null ? EXPANSION_MAX : options.max;
39437
+ var maxLength = options.maxLength == null ? EXPANSION_MAX_LENGTH : options.maxLength;
39438
+ var maxDepth = options.maxDepth == null ? EXPANSION_MAX_DEPTH : options.maxDepth;
39439
+ var maxRewrites = options.maxRewrites == null ? EXPANSION_MAX_REWRITES : options.maxRewrites;
39440
+ if (str.substr(0, 2) === "{}") {
39441
+ str = "\\{\\}" + str.substr(2);
39487
39442
  }
39488
- const { max = exports2.EXPANSION_MAX, maxLength = exports2.EXPANSION_MAX_LENGTH, maxDepth = exports2.EXPANSION_MAX_DEPTH, maxRewrites = exports2.EXPANSION_MAX_REWRITES } = options;
39489
- if (str.slice(0, 2) === "{}") {
39490
- str = "\\{\\}" + str.slice(2);
39491
- }
39492
- return expand_(escapeBraces(str), max, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
39443
+ return expand(escapeBraces(str), max, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
39493
39444
  }
39494
39445
  function embrace(str) {
39495
39446
  return "{" + str + "}";
@@ -39503,44 +39454,42 @@ var require_commonjs2 = __commonJS({
39503
39454
  function gte(i, y) {
39504
39455
  return i >= y;
39505
39456
  }
39506
- function combine(acc, pre, values, max, maxLength, dropEmpties) {
39507
- const out = [];
39508
- let length = 0;
39509
- for (let a = 0; a < acc.length; a++) {
39510
- for (let v = 0; v < values.length; v++) {
39511
- if (out.length >= max)
39512
- return out;
39513
- const expansion = acc[a] + pre + values[v];
39514
- if (dropEmpties && !expansion)
39515
- continue;
39516
- if (length + expansion.length > maxLength)
39517
- return out;
39457
+ function combine(acc, base, pre, values, max, maxLength, dropEmpties, outBase) {
39458
+ var out = [];
39459
+ var length = 0;
39460
+ for (var a = 0; a < acc.length; a++) {
39461
+ for (var v = 0; v < values.length; v++) {
39462
+ if (out.length >= max) return out;
39463
+ var expansion = acc[a] + pre + values[v];
39464
+ if (dropEmpties && expansion.length === base[a]) continue;
39465
+ if (length + expansion.length > maxLength) return out;
39518
39466
  out.push(expansion);
39467
+ outBase.push(base[a]);
39519
39468
  length += expansion.length;
39520
39469
  }
39521
39470
  }
39522
39471
  return out;
39523
39472
  }
39524
39473
  function expandSequence(body, isAlphaSequence, max, maxLength) {
39525
- const n = body.split(/\.\./);
39526
- const N = [];
39474
+ var n = body.split(/\.\./);
39475
+ var N = [];
39527
39476
  if (n[0] === void 0 || n[1] === void 0) {
39528
39477
  return N;
39529
39478
  }
39530
- const x = numeric(n[0]);
39531
- const y = numeric(n[1]);
39532
- const width = Math.max(n[0].length, n[1].length);
39533
- let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
39534
- let test = lte;
39535
- const reverse = y < x;
39479
+ var x = numeric(n[0]);
39480
+ var y = numeric(n[1]);
39481
+ var width = Math.max(n[0].length, n[1].length);
39482
+ var incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
39483
+ var test = lte;
39484
+ var reverse = y < x;
39536
39485
  if (reverse) {
39537
39486
  incr *= -1;
39538
39487
  test = gte;
39539
39488
  }
39540
- const pad = n.some(isPadded);
39541
- let length = 0;
39542
- for (let i = x; test(i, y) && N.length < max; i += incr) {
39543
- let c;
39489
+ var pad = n.some(isPadded);
39490
+ var length = 0;
39491
+ for (var i = x; test(i, y) && N.length < max; i += incr) {
39492
+ var c;
39544
39493
  if (isAlphaSequence) {
39545
39494
  c = String.fromCharCode(i);
39546
39495
  if (c === "\\") {
@@ -39549,9 +39498,9 @@ var require_commonjs2 = __commonJS({
39549
39498
  } else {
39550
39499
  c = String(i);
39551
39500
  if (pad) {
39552
- const need = width - c.length;
39501
+ var need = width - c.length;
39553
39502
  if (need > 0) {
39554
- const z = new Array(need + 1).join("0");
39503
+ var z = new Array(need + 1).join("0");
39555
39504
  if (i < 0) {
39556
39505
  c = "-" + z + c.slice(1);
39557
39506
  } else {
@@ -39560,81 +39509,101 @@ var require_commonjs2 = __commonJS({
39560
39509
  }
39561
39510
  }
39562
39511
  }
39563
- if (length + c.length > maxLength)
39564
- break;
39512
+ if (length + c.length > maxLength) break;
39565
39513
  N.push(c);
39566
39514
  length += c.length;
39567
39515
  }
39568
39516
  return N;
39569
39517
  }
39570
- function expand_(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
39518
+ function expand(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
39571
39519
  if (depth > maxDepth) {
39572
39520
  return [str];
39573
39521
  }
39574
- let acc = [""];
39575
- let rewrites = 0;
39576
- let dropEmpties = false;
39577
- let firstGroup = true;
39522
+ var acc = [""];
39523
+ var accBase = [0];
39524
+ var rewrites = 0;
39525
+ var dropEmpties = false;
39526
+ var firstGroup = true;
39527
+ var nextBase;
39578
39528
  for (; ; ) {
39579
- const m = (0, balanced_match_1.balanced)("{", "}", str);
39529
+ var m = balanced("{", "}", str);
39580
39530
  if (!m) {
39581
- return combine(acc, str, [""], max, maxLength, dropEmpties);
39531
+ return combine(acc, accBase, str, [""], max, maxLength, dropEmpties, []);
39582
39532
  }
39583
- const pre = m.pre;
39533
+ var pre = m.pre;
39584
39534
  if (/\$$/.test(pre)) {
39585
- acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
39586
- firstGroup = false;
39587
- if (!m.post.length)
39588
- break;
39589
- str = m.post;
39590
- continue;
39535
+ return combine(acc, accBase, str, [""], max, maxLength, dropEmpties, []);
39591
39536
  }
39592
- const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
39593
- const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
39594
- const isSequence = isNumericSequence || isAlphaSequence;
39595
- const isOptions = m.body.indexOf(",") >= 0;
39537
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
39538
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
39539
+ var isSequence = isNumericSequence || isAlphaSequence;
39540
+ var isOptions = m.body.indexOf(",") >= 0;
39596
39541
  if (!isSequence && !isOptions) {
39597
39542
  if (rewrites < maxRewrites && m.post.match(/,(?!,).*\}/)) {
39598
39543
  rewrites++;
39599
39544
  str = m.pre + "{" + m.body + escClose + m.post;
39600
39545
  isTop = true;
39546
+ firstGroup = true;
39547
+ dropEmpties = false;
39548
+ accBase = [];
39549
+ for (var b = 0; b < acc.length; b++) {
39550
+ accBase.push(acc[b].length);
39551
+ }
39601
39552
  continue;
39602
39553
  }
39603
- return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
39554
+ return combine(
39555
+ acc,
39556
+ accBase,
39557
+ pre + "{" + m.body + "}" + m.post,
39558
+ [""],
39559
+ max,
39560
+ maxLength,
39561
+ dropEmpties,
39562
+ []
39563
+ );
39604
39564
  }
39605
39565
  if (firstGroup) {
39606
39566
  dropEmpties = isTop && !isSequence;
39607
39567
  firstGroup = false;
39608
39568
  }
39609
- let values;
39569
+ var values;
39610
39570
  if (isSequence) {
39611
39571
  values = expandSequence(m.body, isAlphaSequence, max, maxLength);
39612
39572
  } else {
39613
- let n = parseCommaParts(m.body);
39573
+ var n = parseCommaParts(m.body);
39614
39574
  if (n.length === 1 && n[0] !== void 0) {
39615
- n = expand_(n[0], max, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
39575
+ n = expand(n[0], max, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
39616
39576
  if (n.length === 1) {
39617
- acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
39618
- if (!m.post.length)
39619
- break;
39577
+ nextBase = [];
39578
+ acc = combine(
39579
+ acc,
39580
+ accBase,
39581
+ pre + n[0],
39582
+ [""],
39583
+ max,
39584
+ maxLength,
39585
+ dropEmpties && !m.post.length,
39586
+ nextBase
39587
+ );
39588
+ accBase = nextBase;
39589
+ if (!m.post.length) break;
39620
39590
  str = m.post;
39621
39591
  continue;
39622
39592
  }
39623
39593
  }
39624
- let dropsEmpties = dropEmpties && !m.post.length && !pre;
39625
- for (let d = 0; dropsEmpties && d < acc.length; d++) {
39626
- if (acc[d]) {
39594
+ var dropsEmpties = dropEmpties && !m.post.length && !pre;
39595
+ for (var d = 0; dropsEmpties && d < acc.length; d++) {
39596
+ if (acc[d].length !== accBase[d]) {
39627
39597
  dropsEmpties = false;
39628
39598
  }
39629
39599
  }
39630
39600
  values = [];
39631
- let valuesLength = 0;
39632
- outer: for (let j = 0; j < n.length; j++) {
39633
- const expanded = expand_(n[j], max, maxLength, maxDepth, depth + 1, maxRewrites, false);
39634
- for (let k = 0; k < expanded.length; k++) {
39635
- const v = expanded[k];
39636
- if (dropsEmpties && !v)
39637
- continue;
39601
+ var valuesLength = 0;
39602
+ outer: for (var j = 0; j < n.length; j++) {
39603
+ var expanded = expand(n[j], max, maxLength, maxDepth, depth + 1, maxRewrites, false);
39604
+ for (var k = 0; k < expanded.length; k++) {
39605
+ var v = expanded[k];
39606
+ if (dropsEmpties && !v) continue;
39638
39607
  if (values.length >= max || valuesLength + v.length > maxLength) {
39639
39608
  break outer;
39640
39609
  }
@@ -39643,9 +39612,19 @@ var require_commonjs2 = __commonJS({
39643
39612
  }
39644
39613
  }
39645
39614
  }
39646
- acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
39647
- if (!m.post.length)
39648
- break;
39615
+ nextBase = [];
39616
+ acc = combine(
39617
+ acc,
39618
+ accBase,
39619
+ pre,
39620
+ values,
39621
+ max,
39622
+ maxLength,
39623
+ dropEmpties && !m.post.length,
39624
+ nextBase
39625
+ );
39626
+ accBase = nextBase;
39627
+ if (!m.post.length) break;
39649
39628
  str = m.post;
39650
39629
  }
39651
39630
  return acc;
@@ -39653,14 +39632,192 @@ var require_commonjs2 = __commonJS({
39653
39632
  }
39654
39633
  });
39655
39634
 
39656
- // ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
39657
- var require_assert_valid_pattern = __commonJS({
39658
- "../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js"(exports2) {
39635
+ // ../../node_modules/.pnpm/minimatch@3.1.5/node_modules/minimatch/minimatch.js
39636
+ var require_minimatch2 = __commonJS({
39637
+ "../../node_modules/.pnpm/minimatch@3.1.5/node_modules/minimatch/minimatch.js"(exports2, module2) {
39659
39638
  "use strict";
39660
- Object.defineProperty(exports2, "__esModule", { value: true });
39661
- exports2.assertValidPattern = void 0;
39639
+ module2.exports = minimatch;
39640
+ minimatch.Minimatch = Minimatch;
39641
+ var path = (function() {
39642
+ try {
39643
+ return __require("path");
39644
+ } catch (e) {
39645
+ }
39646
+ })() || {
39647
+ sep: "/"
39648
+ };
39649
+ minimatch.sep = path.sep;
39650
+ var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
39651
+ var expand = require_brace_expansion2();
39652
+ var plTypes = {
39653
+ "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
39654
+ "?": { open: "(?:", close: ")?" },
39655
+ "+": { open: "(?:", close: ")+" },
39656
+ "*": { open: "(?:", close: ")*" },
39657
+ "@": { open: "(?:", close: ")" }
39658
+ };
39659
+ var qmark = "[^/]";
39660
+ var star = qmark + "*?";
39661
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
39662
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
39663
+ var reSpecials = charSet("().*{}+?[]^$\\!");
39664
+ function charSet(s) {
39665
+ return s.split("").reduce(function(set, c) {
39666
+ set[c] = true;
39667
+ return set;
39668
+ }, {});
39669
+ }
39670
+ var slashSplit = /\/+/;
39671
+ minimatch.filter = filter2;
39672
+ function filter2(pattern, options) {
39673
+ options = options || {};
39674
+ return function(p, i, list) {
39675
+ return minimatch(p, pattern, options);
39676
+ };
39677
+ }
39678
+ function ext(a, b) {
39679
+ b = b || {};
39680
+ var t = {};
39681
+ Object.keys(a).forEach(function(k) {
39682
+ t[k] = a[k];
39683
+ });
39684
+ Object.keys(b).forEach(function(k) {
39685
+ t[k] = b[k];
39686
+ });
39687
+ return t;
39688
+ }
39689
+ minimatch.defaults = function(def) {
39690
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
39691
+ return minimatch;
39692
+ }
39693
+ var orig = minimatch;
39694
+ var m = function minimatch2(p, pattern, options) {
39695
+ return orig(p, pattern, ext(def, options));
39696
+ };
39697
+ m.Minimatch = function Minimatch2(pattern, options) {
39698
+ return new orig.Minimatch(pattern, ext(def, options));
39699
+ };
39700
+ m.Minimatch.defaults = function defaults(options) {
39701
+ return orig.defaults(ext(def, options)).Minimatch;
39702
+ };
39703
+ m.filter = function filter3(pattern, options) {
39704
+ return orig.filter(pattern, ext(def, options));
39705
+ };
39706
+ m.defaults = function defaults(options) {
39707
+ return orig.defaults(ext(def, options));
39708
+ };
39709
+ m.makeRe = function makeRe2(pattern, options) {
39710
+ return orig.makeRe(pattern, ext(def, options));
39711
+ };
39712
+ m.braceExpand = function braceExpand2(pattern, options) {
39713
+ return orig.braceExpand(pattern, ext(def, options));
39714
+ };
39715
+ m.match = function(list, pattern, options) {
39716
+ return orig.match(list, pattern, ext(def, options));
39717
+ };
39718
+ return m;
39719
+ };
39720
+ Minimatch.defaults = function(def) {
39721
+ return minimatch.defaults(def).Minimatch;
39722
+ };
39723
+ function minimatch(p, pattern, options) {
39724
+ assertValidPattern(pattern);
39725
+ if (!options) options = {};
39726
+ if (!options.nocomment && pattern.charAt(0) === "#") {
39727
+ return false;
39728
+ }
39729
+ return new Minimatch(pattern, options).match(p);
39730
+ }
39731
+ function Minimatch(pattern, options) {
39732
+ if (!(this instanceof Minimatch)) {
39733
+ return new Minimatch(pattern, options);
39734
+ }
39735
+ assertValidPattern(pattern);
39736
+ if (!options) options = {};
39737
+ pattern = pattern.trim();
39738
+ if (!options.allowWindowsEscape && path.sep !== "/") {
39739
+ pattern = pattern.split(path.sep).join("/");
39740
+ }
39741
+ this.options = options;
39742
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
39743
+ this.set = [];
39744
+ this.pattern = pattern;
39745
+ this.regexp = null;
39746
+ this.negate = false;
39747
+ this.comment = false;
39748
+ this.empty = false;
39749
+ this.partial = !!options.partial;
39750
+ this.make();
39751
+ }
39752
+ Minimatch.prototype.debug = function() {
39753
+ };
39754
+ Minimatch.prototype.make = make;
39755
+ function make() {
39756
+ var pattern = this.pattern;
39757
+ var options = this.options;
39758
+ if (!options.nocomment && pattern.charAt(0) === "#") {
39759
+ this.comment = true;
39760
+ return;
39761
+ }
39762
+ if (!pattern) {
39763
+ this.empty = true;
39764
+ return;
39765
+ }
39766
+ this.parseNegate();
39767
+ var set = this.globSet = this.braceExpand();
39768
+ if (options.debug) this.debug = function debug() {
39769
+ console.error.apply(console, arguments);
39770
+ };
39771
+ this.debug(this.pattern, set);
39772
+ set = this.globParts = set.map(function(s) {
39773
+ return s.split(slashSplit);
39774
+ });
39775
+ this.debug(this.pattern, set);
39776
+ set = set.map(function(s, si, set2) {
39777
+ return s.map(this.parse, this);
39778
+ }, this);
39779
+ this.debug(this.pattern, set);
39780
+ set = set.filter(function(s) {
39781
+ return s.indexOf(false) === -1;
39782
+ });
39783
+ this.debug(this.pattern, set);
39784
+ this.set = set;
39785
+ }
39786
+ Minimatch.prototype.parseNegate = parseNegate;
39787
+ function parseNegate() {
39788
+ var pattern = this.pattern;
39789
+ var negate = false;
39790
+ var options = this.options;
39791
+ var negateOffset = 0;
39792
+ if (options.nonegate) return;
39793
+ for (var i = 0, l2 = pattern.length; i < l2 && pattern.charAt(i) === "!"; i++) {
39794
+ negate = !negate;
39795
+ negateOffset++;
39796
+ }
39797
+ if (negateOffset) this.pattern = pattern.substr(negateOffset);
39798
+ this.negate = negate;
39799
+ }
39800
+ minimatch.braceExpand = function(pattern, options) {
39801
+ return braceExpand(pattern, options);
39802
+ };
39803
+ Minimatch.prototype.braceExpand = braceExpand;
39804
+ function braceExpand(pattern, options) {
39805
+ if (!options) {
39806
+ if (this instanceof Minimatch) {
39807
+ options = this.options;
39808
+ } else {
39809
+ options = {};
39810
+ }
39811
+ }
39812
+ pattern = typeof pattern === "undefined" ? this.pattern : pattern;
39813
+ assertValidPattern(pattern);
39814
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
39815
+ return [pattern];
39816
+ }
39817
+ return expand(pattern);
39818
+ }
39662
39819
  var MAX_PATTERN_LENGTH = 1024 * 64;
39663
- var assertValidPattern = (pattern) => {
39820
+ var assertValidPattern = function(pattern) {
39664
39821
  if (typeof pattern !== "string") {
39665
39822
  throw new TypeError("invalid pattern");
39666
39823
  }
@@ -39668,1650 +39825,483 @@ var require_assert_valid_pattern = __commonJS({
39668
39825
  throw new TypeError("pattern is too long");
39669
39826
  }
39670
39827
  };
39671
- exports2.assertValidPattern = assertValidPattern;
39672
- }
39673
- });
39674
-
39675
- // ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/brace-expressions.js
39676
- var require_brace_expressions = __commonJS({
39677
- "../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/brace-expressions.js"(exports2) {
39678
- "use strict";
39679
- Object.defineProperty(exports2, "__esModule", { value: true });
39680
- exports2.parseClass = void 0;
39681
- var posixClasses = {
39682
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
39683
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
39684
- "[:ascii:]": ["\\x00-\\x7f", false],
39685
- "[:blank:]": ["\\p{Zs}\\t", true],
39686
- "[:cntrl:]": ["\\p{Cc}", true],
39687
- "[:digit:]": ["\\p{Nd}", true],
39688
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
39689
- "[:lower:]": ["\\p{Ll}", true],
39690
- "[:print:]": ["\\p{C}", true],
39691
- "[:punct:]": ["\\p{P}", true],
39692
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
39693
- "[:upper:]": ["\\p{Lu}", true],
39694
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
39695
- "[:xdigit:]": ["A-Fa-f0-9", false]
39696
- };
39697
- var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
39698
- var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
39699
- var rangesToString = (ranges) => ranges.join("");
39700
- var parseClass = (glob, position) => {
39701
- const pos = position;
39702
- if (glob.charAt(pos) !== "[") {
39703
- throw new Error("not in a brace expression");
39828
+ Minimatch.prototype.parse = parse;
39829
+ var SUBPARSE = {};
39830
+ function parse(pattern, isSub) {
39831
+ assertValidPattern(pattern);
39832
+ var options = this.options;
39833
+ if (pattern === "**") {
39834
+ if (!options.noglobstar)
39835
+ return GLOBSTAR;
39836
+ else
39837
+ pattern = "*";
39838
+ }
39839
+ if (pattern === "") return "";
39840
+ var re = "";
39841
+ var hasMagic = !!options.nocase;
39842
+ var escaping = false;
39843
+ var patternListStack = [];
39844
+ var negativeLists = [];
39845
+ var stateChar;
39846
+ var inClass = false;
39847
+ var reClassStart = -1;
39848
+ var classStart = -1;
39849
+ var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
39850
+ var self2 = this;
39851
+ function clearStateChar() {
39852
+ if (stateChar) {
39853
+ switch (stateChar) {
39854
+ case "*":
39855
+ re += star;
39856
+ hasMagic = true;
39857
+ break;
39858
+ case "?":
39859
+ re += qmark;
39860
+ hasMagic = true;
39861
+ break;
39862
+ default:
39863
+ re += "\\" + stateChar;
39864
+ break;
39865
+ }
39866
+ self2.debug("clearStateChar %j %j", stateChar, re);
39867
+ stateChar = false;
39868
+ }
39704
39869
  }
39705
- const ranges = [];
39706
- const negs = [];
39707
- let i = pos + 1;
39708
- let sawStart = false;
39709
- let uflag = false;
39710
- let escaping = false;
39711
- let negate = false;
39712
- let endPos = pos;
39713
- let rangeStart = "";
39714
- WHILE: while (i < glob.length) {
39715
- const c = glob.charAt(i);
39716
- if ((c === "!" || c === "^") && i === pos + 1) {
39717
- negate = true;
39718
- i++;
39870
+ for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
39871
+ this.debug("%s %s %s %j", pattern, i, re, c);
39872
+ if (escaping && reSpecials[c]) {
39873
+ re += "\\" + c;
39874
+ escaping = false;
39719
39875
  continue;
39720
39876
  }
39721
- if (c === "]" && sawStart && !escaping) {
39722
- endPos = i + 1;
39723
- break;
39724
- }
39725
- sawStart = true;
39726
- if (c === "\\") {
39727
- if (!escaping) {
39877
+ switch (c) {
39878
+ /* istanbul ignore next */
39879
+ case "/": {
39880
+ return false;
39881
+ }
39882
+ case "\\":
39883
+ clearStateChar();
39728
39884
  escaping = true;
39729
- i++;
39730
39885
  continue;
39731
- }
39732
- }
39733
- if (c === "[" && !escaping) {
39734
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
39735
- if (glob.startsWith(cls, i)) {
39736
- if (rangeStart) {
39737
- return ["$.", false, glob.length - pos, true];
39738
- }
39739
- i += cls.length;
39740
- if (neg)
39741
- negs.push(unip);
39742
- else
39743
- ranges.push(unip);
39744
- uflag = uflag || u;
39745
- continue WHILE;
39886
+ // the various stateChar values
39887
+ // for the "extglob" stuff.
39888
+ case "?":
39889
+ case "*":
39890
+ case "+":
39891
+ case "@":
39892
+ case "!":
39893
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
39894
+ if (inClass) {
39895
+ this.debug(" in class");
39896
+ if (c === "!" && i === classStart + 1) c = "^";
39897
+ re += c;
39898
+ continue;
39746
39899
  }
39747
- }
39748
- }
39749
- escaping = false;
39750
- if (rangeStart) {
39751
- if (c > rangeStart) {
39752
- ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
39753
- } else if (c === rangeStart) {
39754
- ranges.push(braceEscape(c));
39755
- }
39756
- rangeStart = "";
39757
- i++;
39758
- continue;
39759
- }
39760
- if (glob.startsWith("-]", i + 1)) {
39761
- ranges.push(braceEscape(c + "-"));
39762
- i += 2;
39763
- continue;
39764
- }
39765
- if (glob.startsWith("-", i + 1)) {
39766
- rangeStart = c;
39767
- i += 2;
39768
- continue;
39769
- }
39770
- ranges.push(braceEscape(c));
39771
- i++;
39772
- }
39773
- if (endPos < i) {
39774
- return ["", false, 0, false];
39775
- }
39776
- if (!ranges.length && !negs.length) {
39777
- return ["$.", false, glob.length - pos, true];
39778
- }
39779
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
39780
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
39781
- return [regexpEscape(r), false, endPos - pos, false];
39782
- }
39783
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
39784
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
39785
- const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
39786
- return [comb, uflag, endPos - pos, true];
39787
- };
39788
- exports2.parseClass = parseClass;
39789
- }
39790
- });
39791
-
39792
- // ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/unescape.js
39793
- var require_unescape = __commonJS({
39794
- "../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/unescape.js"(exports2) {
39795
- "use strict";
39796
- Object.defineProperty(exports2, "__esModule", { value: true });
39797
- exports2.unescape = void 0;
39798
- var unescape2 = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
39799
- if (magicalBraces) {
39800
- return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
39801
- }
39802
- return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
39803
- };
39804
- exports2.unescape = unescape2;
39805
- }
39806
- });
39807
-
39808
- // ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/ast.js
39809
- var require_ast = __commonJS({
39810
- "../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/ast.js"(exports2) {
39811
- "use strict";
39812
- var _a;
39813
- Object.defineProperty(exports2, "__esModule", { value: true });
39814
- exports2.AST = void 0;
39815
- var brace_expressions_js_1 = require_brace_expressions();
39816
- var unescape_js_1 = require_unescape();
39817
- var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
39818
- var isExtglobType = (c) => types.has(c);
39819
- var isExtglobAST = (c) => isExtglobType(c.type);
39820
- var adoptionMap = /* @__PURE__ */ new Map([
39821
- ["!", ["@"]],
39822
- ["?", ["?", "@"]],
39823
- ["@", ["@"]],
39824
- ["*", ["*", "+", "?", "@"]],
39825
- ["+", ["+", "@"]]
39826
- ]);
39827
- var adoptionWithSpaceMap = /* @__PURE__ */ new Map([
39828
- ["!", ["?"]],
39829
- ["@", ["?"]],
39830
- ["+", ["?", "*"]]
39831
- ]);
39832
- var adoptionAnyMap = /* @__PURE__ */ new Map([
39833
- ["!", ["?", "@"]],
39834
- ["?", ["?", "@"]],
39835
- ["@", ["?", "@"]],
39836
- ["*", ["*", "+", "?", "@"]],
39837
- ["+", ["+", "@", "?", "*"]]
39838
- ]);
39839
- var usurpMap = /* @__PURE__ */ new Map([
39840
- ["!", /* @__PURE__ */ new Map([["!", "@"]])],
39841
- [
39842
- "?",
39843
- /* @__PURE__ */ new Map([
39844
- ["*", "*"],
39845
- ["+", "*"]
39846
- ])
39847
- ],
39848
- [
39849
- "@",
39850
- /* @__PURE__ */ new Map([
39851
- ["!", "!"],
39852
- ["?", "?"],
39853
- ["@", "@"],
39854
- ["*", "*"],
39855
- ["+", "+"]
39856
- ])
39857
- ],
39858
- [
39859
- "+",
39860
- /* @__PURE__ */ new Map([
39861
- ["?", "*"],
39862
- ["*", "*"]
39863
- ])
39864
- ]
39865
- ]);
39866
- var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
39867
- var startNoDot = "(?!\\.)";
39868
- var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
39869
- var justDots = /* @__PURE__ */ new Set(["..", "."]);
39870
- var reSpecials = new Set("().*{}+?[]^$\\!");
39871
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
39872
- var qmark = "[^/]";
39873
- var star = qmark + "*?";
39874
- var starNoEmpty = qmark + "+?";
39875
- var ID = 0;
39876
- var AST = class {
39877
- type;
39878
- #root;
39879
- #hasMagic;
39880
- #uflag = false;
39881
- #parts = [];
39882
- #parent;
39883
- #parentIndex;
39884
- #negs;
39885
- #filledNegs = false;
39886
- #options;
39887
- #toString;
39888
- // set to true if it's an extglob with no children
39889
- // (which really means one child of '')
39890
- #emptyExt = false;
39891
- id = ++ID;
39892
- get depth() {
39893
- return (this.#parent?.depth ?? -1) + 1;
39894
- }
39895
- [Symbol.for("nodejs.util.inspect.custom")]() {
39896
- return {
39897
- "@@type": "AST",
39898
- id: this.id,
39899
- type: this.type,
39900
- root: this.#root.id,
39901
- parent: this.#parent?.id,
39902
- depth: this.depth,
39903
- partsLength: this.#parts.length,
39904
- parts: this.#parts
39905
- };
39906
- }
39907
- constructor(type, parent2, options = {}) {
39908
- this.type = type;
39909
- if (type)
39910
- this.#hasMagic = true;
39911
- this.#parent = parent2;
39912
- this.#root = this.#parent ? this.#parent.#root : this;
39913
- this.#options = this.#root === this ? options : this.#root.#options;
39914
- this.#negs = this.#root === this ? [] : this.#root.#negs;
39915
- if (type === "!" && !this.#root.#filledNegs)
39916
- this.#negs.push(this);
39917
- this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
39918
- }
39919
- get hasMagic() {
39920
- if (this.#hasMagic !== void 0)
39921
- return this.#hasMagic;
39922
- for (const p of this.#parts) {
39923
- if (typeof p === "string")
39924
- continue;
39925
- if (p.type || p.hasMagic)
39926
- return this.#hasMagic = true;
39927
- }
39928
- return this.#hasMagic;
39929
- }
39930
- // reconstructs the pattern
39931
- toString() {
39932
- return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
39933
- }
39934
- #fillNegs() {
39935
- if (this !== this.#root)
39936
- throw new Error("should only call on root");
39937
- if (this.#filledNegs)
39938
- return this;
39939
- this.toString();
39940
- this.#filledNegs = true;
39941
- let n;
39942
- while (n = this.#negs.pop()) {
39943
- if (n.type !== "!")
39944
- continue;
39945
- let p = n;
39946
- let pp = p.#parent;
39947
- while (pp) {
39948
- for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
39949
- for (const part of n.#parts) {
39950
- if (typeof part === "string") {
39951
- throw new Error("string part in extglob AST??");
39952
- }
39953
- part.copyIn(pp.#parts[i]);
39954
- }
39955
- }
39956
- p = pp;
39957
- pp = p.#parent;
39958
- }
39959
- }
39960
- return this;
39961
- }
39962
- push(...parts) {
39963
- for (const p of parts) {
39964
- if (p === "")
39900
+ if (c === "*" && stateChar === "*") continue;
39901
+ self2.debug("call clearStateChar %j", stateChar);
39902
+ clearStateChar();
39903
+ stateChar = c;
39904
+ if (options.noext) clearStateChar();
39965
39905
  continue;
39966
- if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
39967
- throw new Error("invalid part: " + p);
39968
- }
39969
- this.#parts.push(p);
39970
- }
39971
- }
39972
- toJSON() {
39973
- const ret2 = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
39974
- if (this.isStart() && !this.type)
39975
- ret2.unshift([]);
39976
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
39977
- ret2.push({});
39978
- }
39979
- return ret2;
39980
- }
39981
- isStart() {
39982
- if (this.#root === this)
39983
- return true;
39984
- if (!this.#parent?.isStart())
39985
- return false;
39986
- if (this.#parentIndex === 0)
39987
- return true;
39988
- const p = this.#parent;
39989
- for (let i = 0; i < this.#parentIndex; i++) {
39990
- const pp = p.#parts[i];
39991
- if (!(pp instanceof _a && pp.type === "!")) {
39992
- return false;
39993
- }
39994
- }
39995
- return true;
39996
- }
39997
- isEnd() {
39998
- if (this.#root === this)
39999
- return true;
40000
- if (this.#parent?.type === "!")
40001
- return true;
40002
- if (!this.#parent?.isEnd())
40003
- return false;
40004
- if (!this.type)
40005
- return this.#parent?.isEnd();
40006
- const pl = this.#parent ? this.#parent.#parts.length : 0;
40007
- return this.#parentIndex === pl - 1;
40008
- }
40009
- copyIn(part) {
40010
- if (typeof part === "string")
40011
- this.push(part);
40012
- else
40013
- this.push(part.clone(this));
40014
- }
40015
- clone(parent2) {
40016
- const c = new _a(this.type, parent2);
40017
- for (const p of this.#parts) {
40018
- c.copyIn(p);
40019
- }
40020
- return c;
40021
- }
40022
- static #parseAST(str, ast, pos, opt, extDepth) {
40023
- const maxDepth = opt.maxExtglobRecursion ?? 2;
40024
- let escaping = false;
40025
- let inBrace = false;
40026
- let braceStart = -1;
40027
- let braceNeg = false;
40028
- if (ast.type === null) {
40029
- let i2 = pos;
40030
- let acc2 = "";
40031
- while (i2 < str.length) {
40032
- const c = str.charAt(i2++);
40033
- if (escaping || c === "\\") {
40034
- escaping = !escaping;
40035
- acc2 += c;
39906
+ case "(":
39907
+ if (inClass) {
39908
+ re += "(";
40036
39909
  continue;
40037
39910
  }
40038
- if (inBrace) {
40039
- if (i2 === braceStart + 1) {
40040
- if (c === "^" || c === "!") {
40041
- braceNeg = true;
40042
- }
40043
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
40044
- inBrace = false;
40045
- }
40046
- acc2 += c;
40047
- continue;
40048
- } else if (c === "[") {
40049
- inBrace = true;
40050
- braceStart = i2;
40051
- braceNeg = false;
40052
- acc2 += c;
39911
+ if (!stateChar) {
39912
+ re += "\\(";
40053
39913
  continue;
40054
39914
  }
40055
- const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i2) === "(" && extDepth <= maxDepth;
40056
- if (doRecurse) {
40057
- ast.push(acc2);
40058
- acc2 = "";
40059
- const ext = new _a(c, ast);
40060
- i2 = _a.#parseAST(str, ext, i2, opt, extDepth + 1);
40061
- ast.push(ext);
39915
+ patternListStack.push({
39916
+ type: stateChar,
39917
+ start: i - 1,
39918
+ reStart: re.length,
39919
+ open: plTypes[stateChar].open,
39920
+ close: plTypes[stateChar].close
39921
+ });
39922
+ re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
39923
+ this.debug("plType %j %j", stateChar, re);
39924
+ stateChar = false;
39925
+ continue;
39926
+ case ")":
39927
+ if (inClass || !patternListStack.length) {
39928
+ re += "\\)";
40062
39929
  continue;
40063
39930
  }
40064
- acc2 += c;
40065
- }
40066
- ast.push(acc2);
40067
- return i2;
40068
- }
40069
- let i = pos + 1;
40070
- let part = new _a(null, ast);
40071
- const parts = [];
40072
- let acc = "";
40073
- while (i < str.length) {
40074
- const c = str.charAt(i++);
40075
- if (escaping || c === "\\") {
40076
- escaping = !escaping;
40077
- acc += c;
40078
- continue;
40079
- }
40080
- if (inBrace) {
40081
- if (i === braceStart + 1) {
40082
- if (c === "^" || c === "!") {
40083
- braceNeg = true;
40084
- }
40085
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
40086
- inBrace = false;
39931
+ clearStateChar();
39932
+ hasMagic = true;
39933
+ var pl = patternListStack.pop();
39934
+ re += pl.close;
39935
+ if (pl.type === "!") {
39936
+ negativeLists.push(pl);
40087
39937
  }
40088
- acc += c;
39938
+ pl.reEnd = re.length;
40089
39939
  continue;
40090
- } else if (c === "[") {
40091
- inBrace = true;
40092
- braceStart = i;
40093
- braceNeg = false;
40094
- acc += c;
40095
- continue;
40096
- }
40097
- const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
40098
- (extDepth <= maxDepth || ast && ast.#canAdoptType(c));
40099
- if (doRecurse) {
40100
- const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
40101
- part.push(acc);
40102
- acc = "";
40103
- const ext = new _a(c, part);
40104
- part.push(ext);
40105
- i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
40106
- continue;
40107
- }
40108
- if (c === "|") {
40109
- part.push(acc);
40110
- acc = "";
40111
- parts.push(part);
40112
- part = new _a(null, ast);
40113
- continue;
40114
- }
40115
- if (c === ")") {
40116
- if (acc === "" && ast.#parts.length === 0) {
40117
- ast.#emptyExt = true;
40118
- }
40119
- part.push(acc);
40120
- acc = "";
40121
- ast.push(...parts, part);
40122
- return i;
40123
- }
40124
- acc += c;
40125
- }
40126
- ast.type = null;
40127
- ast.#hasMagic = void 0;
40128
- ast.#parts = [str.substring(pos - 1)];
40129
- return i;
40130
- }
40131
- #canAdoptWithSpace(child) {
40132
- return this.#canAdopt(child, adoptionWithSpaceMap);
40133
- }
40134
- #canAdopt(child, map2 = adoptionMap) {
40135
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
40136
- return false;
40137
- }
40138
- const gc = child.#parts[0];
40139
- if (!gc || typeof gc !== "object" || gc.type === null) {
40140
- return false;
40141
- }
40142
- return this.#canAdoptType(gc.type, map2);
40143
- }
40144
- #canAdoptType(c, map2 = adoptionAnyMap) {
40145
- return !!map2.get(this.type)?.includes(c);
40146
- }
40147
- #adoptWithSpace(child, index2) {
40148
- const gc = child.#parts[0];
40149
- const blank = new _a(null, gc, this.options);
40150
- blank.#parts.push("");
40151
- gc.push(blank);
40152
- this.#adopt(child, index2);
40153
- }
40154
- #adopt(child, index2) {
40155
- const gc = child.#parts[0];
40156
- this.#parts.splice(index2, 1, ...gc.#parts);
40157
- for (const p of gc.#parts) {
40158
- if (typeof p === "object")
40159
- p.#parent = this;
40160
- }
40161
- this.#toString = void 0;
40162
- }
40163
- #canUsurpType(c) {
40164
- const m = usurpMap.get(this.type);
40165
- return !!m?.has(c);
40166
- }
40167
- #canUsurp(child) {
40168
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
40169
- return false;
40170
- }
40171
- const gc = child.#parts[0];
40172
- if (!gc || typeof gc !== "object" || gc.type === null) {
40173
- return false;
40174
- }
40175
- return this.#canUsurpType(gc.type);
40176
- }
40177
- #usurp(child) {
40178
- const m = usurpMap.get(this.type);
40179
- const gc = child.#parts[0];
40180
- const nt = m?.get(gc.type);
40181
- if (!nt)
40182
- return false;
40183
- this.#parts = gc.#parts;
40184
- for (const p of this.#parts) {
40185
- if (typeof p === "object") {
40186
- p.#parent = this;
40187
- }
40188
- }
40189
- this.type = nt;
40190
- this.#toString = void 0;
40191
- this.#emptyExt = false;
40192
- }
40193
- static fromGlob(pattern, options = {}) {
40194
- const ast = new _a(null, void 0, options);
40195
- _a.#parseAST(pattern, ast, 0, options, 0);
40196
- return ast;
40197
- }
40198
- // returns the regular expression if there's magic, or the unescaped
40199
- // string if not.
40200
- toMMPattern() {
40201
- if (this !== this.#root)
40202
- return this.#root.toMMPattern();
40203
- const glob = this.toString();
40204
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
40205
- const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
40206
- if (!anyMagic) {
40207
- return body;
40208
- }
40209
- const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
40210
- return Object.assign(new RegExp(`^${re}$`, flags), {
40211
- _src: re,
40212
- _glob: glob
40213
- });
40214
- }
40215
- get options() {
40216
- return this.#options;
40217
- }
40218
- // returns the string match, the regexp source, whether there's magic
40219
- // in the regexp (so a regular expression is required) and whether or
40220
- // not the uflag is needed for the regular expression (for posix classes)
40221
- // TODO: instead of injecting the start/end at this point, just return
40222
- // the BODY of the regexp, along with the start/end portions suitable
40223
- // for binding the start/end in either a joined full-path makeRe context
40224
- // (where we bind to (^|/), or a standalone matchPart context (where
40225
- // we bind to ^, and not /). Otherwise slashes get duped!
40226
- //
40227
- // In part-matching mode, the start is:
40228
- // - if not isStart: nothing
40229
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
40230
- // - if dots allowed or not possible: ^
40231
- // - if dots possible and not allowed: ^(?!\.)
40232
- // end is:
40233
- // - if not isEnd(): nothing
40234
- // - else: $
40235
- //
40236
- // In full-path matching mode, we put the slash at the START of the
40237
- // pattern, so start is:
40238
- // - if first pattern: same as part-matching mode
40239
- // - if not isStart(): nothing
40240
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
40241
- // - if dots allowed or not possible: /
40242
- // - if dots possible and not allowed: /(?!\.)
40243
- // end is:
40244
- // - if last pattern, same as part-matching mode
40245
- // - else nothing
40246
- //
40247
- // Always put the (?:$|/) on negated tails, though, because that has to be
40248
- // there to bind the end of the negated pattern portion, and it's easier to
40249
- // just stick it in now rather than try to inject it later in the middle of
40250
- // the pattern.
40251
- //
40252
- // We can just always return the same end, and leave it up to the caller
40253
- // to know whether it's going to be used joined or in parts.
40254
- // And, if the start is adjusted slightly, can do the same there:
40255
- // - if not isStart: nothing
40256
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
40257
- // - if dots allowed or not possible: (?:/|^)
40258
- // - if dots possible and not allowed: (?:/|^)(?!\.)
40259
- //
40260
- // But it's better to have a simpler binding without a conditional, for
40261
- // performance, so probably better to return both start options.
40262
- //
40263
- // Then the caller just ignores the end if it's not the first pattern,
40264
- // and the start always gets applied.
40265
- //
40266
- // But that's always going to be $ if it's the ending pattern, or nothing,
40267
- // so the caller can just attach $ at the end of the pattern when building.
40268
- //
40269
- // So the todo is:
40270
- // - better detect what kind of start is needed
40271
- // - return both flavors of starting pattern
40272
- // - attach $ at the end of the pattern when creating the actual RegExp
40273
- //
40274
- // Ah, but wait, no, that all only applies to the root when the first pattern
40275
- // is not an extglob. If the first pattern IS an extglob, then we need all
40276
- // that dot prevention biz to live in the extglob portions, because eg
40277
- // +(*|.x*) can match .xy but not .yx.
40278
- //
40279
- // So, return the two flavors if it's #root and the first child is not an
40280
- // AST, otherwise leave it to the child AST to handle it, and there,
40281
- // use the (?:^|/) style of start binding.
40282
- //
40283
- // Even simplified further:
40284
- // - Since the start for a join is eg /(?!\.) and the start for a part
40285
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
40286
- // or start or whatever) and prepend ^ or / at the Regexp construction.
40287
- toRegExpSource(allowDot) {
40288
- const dot = allowDot ?? !!this.#options.dot;
40289
- if (this.#root === this) {
40290
- this.#flatten();
40291
- this.#fillNegs();
40292
- }
40293
- if (!isExtglobAST(this)) {
40294
- const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
40295
- const src = this.#parts.map((p) => {
40296
- const [re, _2, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
40297
- this.#hasMagic = this.#hasMagic || hasMagic;
40298
- this.#uflag = this.#uflag || uflag;
40299
- return re;
40300
- }).join("");
40301
- let start2 = "";
40302
- if (this.isStart()) {
40303
- if (typeof this.#parts[0] === "string") {
40304
- const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
40305
- if (!dotTravAllowed) {
40306
- const aps = addPatternStart;
40307
- const needNoTrav = (
40308
- // dots are allowed, and the pattern starts with [ or .
40309
- dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
40310
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
40311
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
40312
- );
40313
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
40314
- start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
40315
- }
40316
- }
40317
- }
40318
- let end = "";
40319
- if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") {
40320
- end = "(?:$|\\/)";
40321
- }
40322
- const final2 = start2 + src + end;
40323
- return [
40324
- final2,
40325
- (0, unescape_js_1.unescape)(src),
40326
- this.#hasMagic = !!this.#hasMagic,
40327
- this.#uflag
40328
- ];
40329
- }
40330
- const repeated = this.type === "*" || this.type === "+";
40331
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
40332
- let body = this.#partsToRegExp(dot);
40333
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
40334
- const s = this.toString();
40335
- const me = this;
40336
- me.#parts = [s];
40337
- me.type = null;
40338
- me.#hasMagic = void 0;
40339
- return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
40340
- }
40341
- let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
40342
- if (bodyDotAllowed === body) {
40343
- bodyDotAllowed = "";
40344
- }
40345
- if (bodyDotAllowed) {
40346
- body = `(?:${body})(?:${bodyDotAllowed})*?`;
40347
- }
40348
- let final = "";
40349
- if (this.type === "!" && this.#emptyExt) {
40350
- final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
40351
- } else {
40352
- const close = this.type === "!" ? (
40353
- // !() must match something,but !(x) can match ''
40354
- "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
40355
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
40356
- final = start + body + close;
40357
- }
40358
- return [
40359
- final,
40360
- (0, unescape_js_1.unescape)(body),
40361
- this.#hasMagic = !!this.#hasMagic,
40362
- this.#uflag
40363
- ];
40364
- }
40365
- #flatten() {
40366
- if (!isExtglobAST(this)) {
40367
- for (const p of this.#parts) {
40368
- if (typeof p === "object") {
40369
- p.#flatten();
40370
- }
40371
- }
40372
- } else {
40373
- let iterations = 0;
40374
- let done = false;
40375
- do {
40376
- done = true;
40377
- for (let i = 0; i < this.#parts.length; i++) {
40378
- const c = this.#parts[i];
40379
- if (typeof c === "object") {
40380
- c.#flatten();
40381
- if (this.#canAdopt(c)) {
40382
- done = false;
40383
- this.#adopt(c, i);
40384
- } else if (this.#canAdoptWithSpace(c)) {
40385
- done = false;
40386
- this.#adoptWithSpace(c, i);
40387
- } else if (this.#canUsurp(c)) {
40388
- done = false;
40389
- this.#usurp(c);
40390
- }
40391
- }
39940
+ case "|":
39941
+ if (inClass || !patternListStack.length || escaping) {
39942
+ re += "\\|";
39943
+ escaping = false;
39944
+ continue;
40392
39945
  }
40393
- } while (!done && ++iterations < 10);
40394
- }
40395
- this.#toString = void 0;
40396
- }
40397
- #partsToRegExp(dot) {
40398
- return this.#parts.map((p) => {
40399
- if (typeof p === "string") {
40400
- throw new Error("string type in extglob ast??");
40401
- }
40402
- const [re, _2, _hasMagic, uflag] = p.toRegExpSource(dot);
40403
- this.#uflag = this.#uflag || uflag;
40404
- return re;
40405
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
40406
- }
40407
- static #parseGlob(glob, hasMagic, noEmpty = false) {
40408
- let escaping = false;
40409
- let re = "";
40410
- let uflag = false;
40411
- let inStar = false;
40412
- for (let i = 0; i < glob.length; i++) {
40413
- const c = glob.charAt(i);
40414
- if (escaping) {
40415
- escaping = false;
40416
- re += (reSpecials.has(c) ? "\\" : "") + c;
39946
+ clearStateChar();
39947
+ re += "|";
40417
39948
  continue;
40418
- }
40419
- if (c === "*") {
40420
- if (inStar)
39949
+ // these are mostly the same in regexp and glob
39950
+ case "[":
39951
+ clearStateChar();
39952
+ if (inClass) {
39953
+ re += "\\" + c;
40421
39954
  continue;
40422
- inStar = true;
40423
- re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
40424
- hasMagic = true;
40425
- continue;
40426
- } else {
40427
- inStar = false;
40428
- }
40429
- if (c === "\\") {
40430
- if (i === glob.length - 1) {
40431
- re += "\\\\";
40432
- } else {
40433
- escaping = true;
40434
39955
  }
39956
+ inClass = true;
39957
+ classStart = i;
39958
+ reClassStart = re.length;
39959
+ re += c;
40435
39960
  continue;
40436
- }
40437
- if (c === "[") {
40438
- const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob, i);
40439
- if (consumed) {
40440
- re += src;
40441
- uflag = uflag || needUflag;
40442
- i += consumed - 1;
40443
- hasMagic = hasMagic || magic;
39961
+ case "]":
39962
+ if (i === classStart + 1 || !inClass) {
39963
+ re += "\\" + c;
39964
+ escaping = false;
39965
+ continue;
39966
+ }
39967
+ var cs = pattern.substring(classStart + 1, i);
39968
+ try {
39969
+ RegExp("[" + cs + "]");
39970
+ } catch (er) {
39971
+ var sp = this.parse(cs, SUBPARSE);
39972
+ re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
39973
+ hasMagic = hasMagic || sp[1];
39974
+ inClass = false;
40444
39975
  continue;
40445
39976
  }
40446
- }
40447
- if (c === "?") {
40448
- re += qmark;
40449
39977
  hasMagic = true;
39978
+ inClass = false;
39979
+ re += c;
40450
39980
  continue;
40451
- }
40452
- re += regExpEscape(c);
39981
+ default:
39982
+ clearStateChar();
39983
+ if (escaping) {
39984
+ escaping = false;
39985
+ } else if (reSpecials[c] && !(c === "^" && inClass)) {
39986
+ re += "\\";
39987
+ }
39988
+ re += c;
40453
39989
  }
40454
- return [re, (0, unescape_js_1.unescape)(glob), !!hasMagic, uflag];
40455
39990
  }
40456
- };
40457
- exports2.AST = AST;
40458
- _a = AST;
40459
- }
40460
- });
40461
-
40462
- // ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/escape.js
40463
- var require_escape = __commonJS({
40464
- "../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/escape.js"(exports2) {
40465
- "use strict";
40466
- Object.defineProperty(exports2, "__esModule", { value: true });
40467
- exports2.escape = void 0;
40468
- var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
40469
- if (magicalBraces) {
40470
- return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
39991
+ if (inClass) {
39992
+ cs = pattern.substr(classStart + 1);
39993
+ sp = this.parse(cs, SUBPARSE);
39994
+ re = re.substr(0, reClassStart) + "\\[" + sp[0];
39995
+ hasMagic = hasMagic || sp[1];
39996
+ }
39997
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
39998
+ var tail = re.slice(pl.reStart + pl.open.length);
39999
+ this.debug("setting tail", re, pl);
40000
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_2, $1, $2) {
40001
+ if (!$2) {
40002
+ $2 = "\\";
40003
+ }
40004
+ return $1 + $1 + $2 + "|";
40005
+ });
40006
+ this.debug("tail=%j\n %s", tail, tail, pl, re);
40007
+ var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
40008
+ hasMagic = true;
40009
+ re = re.slice(0, pl.reStart) + t + "\\(" + tail;
40010
+ }
40011
+ clearStateChar();
40012
+ if (escaping) {
40013
+ re += "\\\\";
40014
+ }
40015
+ var addPatternStart = false;
40016
+ switch (re.charAt(0)) {
40017
+ case "[":
40018
+ case ".":
40019
+ case "(":
40020
+ addPatternStart = true;
40021
+ }
40022
+ for (var n = negativeLists.length - 1; n > -1; n--) {
40023
+ var nl = negativeLists[n];
40024
+ var nlBefore = re.slice(0, nl.reStart);
40025
+ var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
40026
+ var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
40027
+ var nlAfter = re.slice(nl.reEnd);
40028
+ nlLast += nlAfter;
40029
+ var openParensBefore = nlBefore.split("(").length - 1;
40030
+ var cleanAfter = nlAfter;
40031
+ for (i = 0; i < openParensBefore; i++) {
40032
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
40033
+ }
40034
+ nlAfter = cleanAfter;
40035
+ var dollar = "";
40036
+ if (nlAfter === "" && isSub !== SUBPARSE) {
40037
+ dollar = "$";
40038
+ }
40039
+ var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
40040
+ re = newRe;
40041
+ }
40042
+ if (re !== "" && hasMagic) {
40043
+ re = "(?=.)" + re;
40044
+ }
40045
+ if (addPatternStart) {
40046
+ re = patternStart + re;
40047
+ }
40048
+ if (isSub === SUBPARSE) {
40049
+ return [re, hasMagic];
40050
+ }
40051
+ if (!hasMagic) {
40052
+ return globUnescape(pattern);
40053
+ }
40054
+ var flags = options.nocase ? "i" : "";
40055
+ try {
40056
+ var regExp = new RegExp("^" + re + "$", flags);
40057
+ } catch (er) {
40058
+ return new RegExp("$.");
40471
40059
  }
40472
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
40060
+ regExp._glob = pattern;
40061
+ regExp._src = re;
40062
+ return regExp;
40063
+ }
40064
+ minimatch.makeRe = function(pattern, options) {
40065
+ return new Minimatch(pattern, options || {}).makeRe();
40473
40066
  };
40474
- exports2.escape = escape;
40475
- }
40476
- });
40477
-
40478
- // ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/index.js
40479
- var require_commonjs3 = __commonJS({
40480
- "../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/index.js"(exports2) {
40481
- "use strict";
40482
- Object.defineProperty(exports2, "__esModule", { value: true });
40483
- exports2.unescape = exports2.escape = exports2.AST = exports2.Minimatch = exports2.match = exports2.makeRe = exports2.braceExpand = exports2.defaults = exports2.filter = exports2.GLOBSTAR = exports2.sep = exports2.minimatch = void 0;
40484
- var brace_expansion_1 = require_commonjs2();
40485
- var assert_valid_pattern_js_1 = require_assert_valid_pattern();
40486
- var ast_js_1 = require_ast();
40487
- var escape_js_1 = require_escape();
40488
- var unescape_js_1 = require_unescape();
40489
- var minimatch = (p, pattern, options = {}) => {
40490
- (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
40491
- if (!options.nocomment && pattern.charAt(0) === "#") {
40492
- return false;
40067
+ Minimatch.prototype.makeRe = makeRe;
40068
+ function makeRe() {
40069
+ if (this.regexp || this.regexp === false) return this.regexp;
40070
+ var set = this.set;
40071
+ if (!set.length) {
40072
+ this.regexp = false;
40073
+ return this.regexp;
40493
40074
  }
40494
- return new Minimatch(pattern, options).match(p);
40495
- };
40496
- exports2.minimatch = minimatch;
40497
- var starDotExtRE = /^\*+([^+@!?*[(]*)$/;
40498
- var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
40499
- var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
40500
- var starDotExtTestNocase = (ext2) => {
40501
- ext2 = ext2.toLowerCase();
40502
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
40503
- };
40504
- var starDotExtTestNocaseDot = (ext2) => {
40505
- ext2 = ext2.toLowerCase();
40506
- return (f) => f.toLowerCase().endsWith(ext2);
40507
- };
40508
- var starDotStarRE = /^\*+\.\*+$/;
40509
- var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
40510
- var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
40511
- var dotStarRE = /^\.\*+$/;
40512
- var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
40513
- var starRE = /^\*+$/;
40514
- var starTest = (f) => f.length !== 0 && !f.startsWith(".");
40515
- var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
40516
- var qmarksRE = /^\?+([^+@!?*[(]*)?$/;
40517
- var qmarksTestNocase = ([$0, ext2 = ""]) => {
40518
- const noext = qmarksTestNoExt([$0]);
40519
- if (!ext2)
40520
- return noext;
40521
- ext2 = ext2.toLowerCase();
40522
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
40523
- };
40524
- var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
40525
- const noext = qmarksTestNoExtDot([$0]);
40526
- if (!ext2)
40527
- return noext;
40528
- ext2 = ext2.toLowerCase();
40529
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
40530
- };
40531
- var qmarksTestDot = ([$0, ext2 = ""]) => {
40532
- const noext = qmarksTestNoExtDot([$0]);
40533
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
40534
- };
40535
- var qmarksTest = ([$0, ext2 = ""]) => {
40536
- const noext = qmarksTestNoExt([$0]);
40537
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
40538
- };
40539
- var qmarksTestNoExt = ([$0]) => {
40540
- const len = $0.length;
40541
- return (f) => f.length === len && !f.startsWith(".");
40542
- };
40543
- var qmarksTestNoExtDot = ([$0]) => {
40544
- const len = $0.length;
40545
- return (f) => f.length === len && f !== "." && f !== "..";
40546
- };
40547
- var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
40548
- var path = {
40549
- win32: { sep: "\\" },
40550
- posix: { sep: "/" }
40551
- };
40552
- exports2.sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
40553
- exports2.minimatch.sep = exports2.sep;
40554
- exports2.GLOBSTAR = Symbol("globstar **");
40555
- exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR;
40556
- var qmark = "[^/]";
40557
- var star = qmark + "*?";
40558
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
40559
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
40560
- var filter2 = (pattern, options = {}) => (p) => (0, exports2.minimatch)(p, pattern, options);
40561
- exports2.filter = filter2;
40562
- exports2.minimatch.filter = exports2.filter;
40563
- var ext = (a, b = {}) => Object.assign({}, a, b);
40564
- var defaults = (def) => {
40565
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
40566
- return exports2.minimatch;
40075
+ var options = this.options;
40076
+ var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
40077
+ var flags = options.nocase ? "i" : "";
40078
+ var re = set.map(function(pattern) {
40079
+ return pattern.map(function(p) {
40080
+ return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
40081
+ }).join("\\/");
40082
+ }).join("|");
40083
+ re = "^(?:" + re + ")$";
40084
+ if (this.negate) re = "^(?!" + re + ").*$";
40085
+ try {
40086
+ this.regexp = new RegExp(re, flags);
40087
+ } catch (ex) {
40088
+ this.regexp = false;
40567
40089
  }
40568
- const orig = exports2.minimatch;
40569
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
40570
- return Object.assign(m, {
40571
- Minimatch: class Minimatch extends orig.Minimatch {
40572
- constructor(pattern, options = {}) {
40573
- super(pattern, ext(def, options));
40574
- }
40575
- static defaults(options) {
40576
- return orig.defaults(ext(def, options)).Minimatch;
40577
- }
40578
- },
40579
- AST: class AST extends orig.AST {
40580
- /* c8 ignore start */
40581
- constructor(type, parent2, options = {}) {
40582
- super(type, parent2, ext(def, options));
40583
- }
40584
- /* c8 ignore stop */
40585
- static fromGlob(pattern, options = {}) {
40586
- return orig.AST.fromGlob(pattern, ext(def, options));
40587
- }
40588
- },
40589
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
40590
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
40591
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
40592
- defaults: (options) => orig.defaults(ext(def, options)),
40593
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
40594
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
40595
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
40596
- sep: orig.sep,
40597
- GLOBSTAR: exports2.GLOBSTAR
40090
+ return this.regexp;
40091
+ }
40092
+ minimatch.match = function(list, pattern, options) {
40093
+ options = options || {};
40094
+ var mm = new Minimatch(pattern, options);
40095
+ list = list.filter(function(f) {
40096
+ return mm.match(f);
40598
40097
  });
40599
- };
40600
- exports2.defaults = defaults;
40601
- exports2.minimatch.defaults = exports2.defaults;
40602
- var braceExpand = (pattern, options = {}) => {
40603
- (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
40604
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
40605
- return [pattern];
40606
- }
40607
- return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax });
40608
- };
40609
- exports2.braceExpand = braceExpand;
40610
- exports2.minimatch.braceExpand = exports2.braceExpand;
40611
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
40612
- exports2.makeRe = makeRe;
40613
- exports2.minimatch.makeRe = exports2.makeRe;
40614
- var match = (list, pattern, options = {}) => {
40615
- const mm = new Minimatch(pattern, options);
40616
- list = list.filter((f) => mm.match(f));
40617
40098
  if (mm.options.nonull && !list.length) {
40618
40099
  list.push(pattern);
40619
40100
  }
40620
40101
  return list;
40621
40102
  };
40622
- exports2.match = match;
40623
- exports2.minimatch.match = exports2.match;
40624
- var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
40625
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
40626
- var Minimatch = class {
40627
- options;
40628
- set;
40629
- pattern;
40630
- windowsPathsNoEscape;
40631
- nonegate;
40632
- negate;
40633
- comment;
40634
- empty;
40635
- preserveMultipleSlashes;
40636
- partial;
40637
- globSet;
40638
- globParts;
40639
- nocase;
40640
- isWindows;
40641
- platform;
40642
- windowsNoMagicRoot;
40643
- maxGlobstarRecursion;
40644
- regexp;
40645
- constructor(pattern, options = {}) {
40646
- (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
40647
- options = options || {};
40648
- this.options = options;
40649
- this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
40650
- this.pattern = pattern;
40651
- this.platform = options.platform || defaultPlatform;
40652
- this.isWindows = this.platform === "win32";
40653
- const awe = "allowWindowsEscape";
40654
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
40655
- if (this.windowsPathsNoEscape) {
40656
- this.pattern = this.pattern.replace(/\\/g, "/");
40657
- }
40658
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
40659
- this.regexp = null;
40660
- this.negate = false;
40661
- this.nonegate = !!options.nonegate;
40662
- this.comment = false;
40663
- this.empty = false;
40664
- this.partial = !!options.partial;
40665
- this.nocase = !!this.options.nocase;
40666
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
40667
- this.globSet = [];
40668
- this.globParts = [];
40669
- this.set = [];
40670
- this.make();
40103
+ Minimatch.prototype.match = function match(f, partial) {
40104
+ if (typeof partial === "undefined") partial = this.partial;
40105
+ this.debug("match", f, this.pattern);
40106
+ if (this.comment) return false;
40107
+ if (this.empty) return f === "";
40108
+ if (f === "/" && partial) return true;
40109
+ var options = this.options;
40110
+ if (path.sep !== "/") {
40111
+ f = f.split(path.sep).join("/");
40112
+ }
40113
+ f = f.split(slashSplit);
40114
+ this.debug(this.pattern, "split", f);
40115
+ var set = this.set;
40116
+ this.debug(this.pattern, "set", set);
40117
+ var filename;
40118
+ var i;
40119
+ for (i = f.length - 1; i >= 0; i--) {
40120
+ filename = f[i];
40121
+ if (filename) break;
40671
40122
  }
40672
- hasMagic() {
40673
- if (this.options.magicalBraces && this.set.length > 1) {
40674
- return true;
40123
+ for (i = 0; i < set.length; i++) {
40124
+ var pattern = set[i];
40125
+ var file = f;
40126
+ if (options.matchBase && pattern.length === 1) {
40127
+ file = [filename];
40675
40128
  }
40676
- for (const pattern of this.set) {
40677
- for (const part of pattern) {
40678
- if (typeof part !== "string")
40679
- return true;
40680
- }
40129
+ var hit = this.matchOne(file, pattern, partial);
40130
+ if (hit) {
40131
+ if (options.flipNegate) return true;
40132
+ return !this.negate;
40681
40133
  }
40682
- return false;
40683
40134
  }
40684
- debug(..._2) {
40135
+ if (options.flipNegate) return false;
40136
+ return this.negate;
40137
+ };
40138
+ Minimatch.prototype.matchOne = function(file, pattern, partial) {
40139
+ if (pattern.indexOf(GLOBSTAR) !== -1) {
40140
+ return this._matchGlobstar(file, pattern, partial, 0, 0);
40685
40141
  }
40686
- make() {
40687
- const pattern = this.pattern;
40688
- const options = this.options;
40689
- if (!options.nocomment && pattern.charAt(0) === "#") {
40690
- this.comment = true;
40691
- return;
40692
- }
40693
- if (!pattern) {
40694
- this.empty = true;
40695
- return;
40696
- }
40697
- this.parseNegate();
40698
- this.globSet = [...new Set(this.braceExpand())];
40699
- if (options.debug) {
40700
- this.debug = (...args) => console.error(...args);
40701
- }
40702
- this.debug(this.pattern, this.globSet);
40703
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
40704
- this.globParts = this.preprocess(rawGlobParts);
40705
- this.debug(this.pattern, this.globParts);
40706
- let set = this.globParts.map((s, _2, __) => {
40707
- if (this.isWindows && this.windowsNoMagicRoot) {
40708
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
40709
- const isDrive = /^[a-z]:/i.test(s[0]);
40710
- if (isUNC) {
40711
- return [
40712
- ...s.slice(0, 4),
40713
- ...s.slice(4).map((ss) => this.parse(ss))
40714
- ];
40715
- } else if (isDrive) {
40716
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
40717
- }
40718
- }
40719
- return s.map((ss) => this.parse(ss));
40720
- });
40721
- this.debug(this.pattern, set);
40722
- this.set = set.filter((s) => s.indexOf(false) === -1);
40723
- if (this.isWindows) {
40724
- for (let i = 0; i < this.set.length; i++) {
40725
- const p = this.set[i];
40726
- if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
40727
- p[2] = "?";
40728
- }
40729
- }
40730
- }
40731
- this.debug(this.pattern, this.set);
40732
- }
40733
- // various transforms to equivalent pattern sets that are
40734
- // faster to process in a filesystem walk. The goal is to
40735
- // eliminate what we can, and push all ** patterns as far
40736
- // to the right as possible, even if it increases the number
40737
- // of patterns that we have to process.
40738
- preprocess(globParts) {
40739
- if (this.options.noglobstar) {
40740
- for (const partset of globParts) {
40741
- for (let j = 0; j < partset.length; j++) {
40742
- if (partset[j] === "**") {
40743
- partset[j] = "*";
40744
- }
40745
- }
40746
- }
40747
- }
40748
- const { optimizationLevel = 1 } = this.options;
40749
- if (optimizationLevel >= 2) {
40750
- globParts = this.firstPhasePreProcess(globParts);
40751
- globParts = this.secondPhasePreProcess(globParts);
40752
- } else if (optimizationLevel >= 1) {
40753
- globParts = this.levelOneOptimize(globParts);
40754
- } else {
40755
- globParts = this.adjascentGlobstarOptimize(globParts);
40142
+ return this._matchOne(file, pattern, partial, 0, 0);
40143
+ };
40144
+ Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
40145
+ var i;
40146
+ var firstgs = -1;
40147
+ for (i = patternIndex; i < pattern.length; i++) {
40148
+ if (pattern[i] === GLOBSTAR) {
40149
+ firstgs = i;
40150
+ break;
40756
40151
  }
40757
- return globParts;
40758
40152
  }
40759
- // just get rid of adjascent ** portions
40760
- adjascentGlobstarOptimize(globParts) {
40761
- return globParts.map((parts) => {
40762
- let gs = -1;
40763
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
40764
- let i = gs;
40765
- while (parts[i + 1] === "**") {
40766
- i++;
40767
- }
40768
- if (i !== gs) {
40769
- parts.splice(gs, i - gs);
40770
- }
40771
- }
40772
- return parts;
40773
- });
40774
- }
40775
- // get rid of adjascent ** and resolve .. portions
40776
- levelOneOptimize(globParts) {
40777
- return globParts.map((parts) => {
40778
- parts = parts.reduce((set, part) => {
40779
- const prev = set[set.length - 1];
40780
- if (part === "**" && prev === "**") {
40781
- return set;
40782
- }
40783
- if (part === "..") {
40784
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
40785
- set.pop();
40786
- return set;
40787
- }
40788
- }
40789
- set.push(part);
40790
- return set;
40791
- }, []);
40792
- return parts.length === 0 ? [""] : parts;
40793
- });
40794
- }
40795
- levelTwoFileOptimize(parts) {
40796
- if (!Array.isArray(parts)) {
40797
- parts = this.slashSplit(parts);
40798
- }
40799
- let didSomething = false;
40800
- do {
40801
- didSomething = false;
40802
- if (!this.preserveMultipleSlashes) {
40803
- for (let i = 1; i < parts.length - 1; i++) {
40804
- const p = parts[i];
40805
- if (i === 1 && p === "" && parts[0] === "")
40806
- continue;
40807
- if (p === "." || p === "") {
40808
- didSomething = true;
40809
- parts.splice(i, 1);
40810
- i--;
40811
- }
40812
- }
40813
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
40814
- didSomething = true;
40815
- parts.pop();
40816
- }
40817
- }
40818
- let dd = 0;
40819
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
40820
- const p = parts[dd - 1];
40821
- if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
40822
- didSomething = true;
40823
- parts.splice(dd - 1, 2);
40824
- dd -= 2;
40825
- }
40826
- }
40827
- } while (didSomething);
40828
- return parts.length === 0 ? [""] : parts;
40829
- }
40830
- // First phase: single-pattern processing
40831
- // <pre> is 1 or more portions
40832
- // <rest> is 1 or more portions
40833
- // <p> is any portion other than ., .., '', or **
40834
- // <e> is . or ''
40835
- //
40836
- // **/.. is *brutal* for filesystem walking performance, because
40837
- // it effectively resets the recursive walk each time it occurs,
40838
- // and ** cannot be reduced out by a .. pattern part like a regexp
40839
- // or most strings (other than .., ., and '') can be.
40840
- //
40841
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
40842
- // <pre>/<e>/<rest> -> <pre>/<rest>
40843
- // <pre>/<p>/../<rest> -> <pre>/<rest>
40844
- // **/**/<rest> -> **/<rest>
40845
- //
40846
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
40847
- // this WOULD be allowed if ** did follow symlinks, or * didn't
40848
- firstPhasePreProcess(globParts) {
40849
- let didSomething = false;
40850
- do {
40851
- didSomething = false;
40852
- for (let parts of globParts) {
40853
- let gs = -1;
40854
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
40855
- let gss = gs;
40856
- while (parts[gss + 1] === "**") {
40857
- gss++;
40858
- }
40859
- if (gss > gs) {
40860
- parts.splice(gs + 1, gss - gs);
40861
- }
40862
- let next = parts[gs + 1];
40863
- const p = parts[gs + 2];
40864
- const p2 = parts[gs + 3];
40865
- if (next !== "..")
40866
- continue;
40867
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
40868
- continue;
40869
- }
40870
- didSomething = true;
40871
- parts.splice(gs, 1);
40872
- const other = parts.slice(0);
40873
- other[gs] = "**";
40874
- globParts.push(other);
40875
- gs--;
40876
- }
40877
- if (!this.preserveMultipleSlashes) {
40878
- for (let i = 1; i < parts.length - 1; i++) {
40879
- const p = parts[i];
40880
- if (i === 1 && p === "" && parts[0] === "")
40881
- continue;
40882
- if (p === "." || p === "") {
40883
- didSomething = true;
40884
- parts.splice(i, 1);
40885
- i--;
40886
- }
40887
- }
40888
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
40889
- didSomething = true;
40890
- parts.pop();
40891
- }
40892
- }
40893
- let dd = 0;
40894
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
40895
- const p = parts[dd - 1];
40896
- if (p && p !== "." && p !== ".." && p !== "**") {
40897
- didSomething = true;
40898
- const needDot = dd === 1 && parts[dd + 1] === "**";
40899
- const splin = needDot ? ["."] : [];
40900
- parts.splice(dd - 1, 2, ...splin);
40901
- if (parts.length === 0)
40902
- parts.push("");
40903
- dd -= 2;
40904
- }
40905
- }
40906
- }
40907
- } while (didSomething);
40908
- return globParts;
40909
- }
40910
- // second phase: multi-pattern dedupes
40911
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
40912
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
40913
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
40914
- //
40915
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
40916
- // ^-- not valid because ** doens't follow symlinks
40917
- secondPhasePreProcess(globParts) {
40918
- for (let i = 0; i < globParts.length - 1; i++) {
40919
- for (let j = i + 1; j < globParts.length; j++) {
40920
- const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
40921
- if (matched) {
40922
- globParts[i] = [];
40923
- globParts[j] = matched;
40924
- break;
40925
- }
40926
- }
40927
- }
40928
- return globParts.filter((gs) => gs.length);
40929
- }
40930
- partsMatch(a, b, emptyGSMatch = false) {
40931
- let ai = 0;
40932
- let bi = 0;
40933
- let result = [];
40934
- let which = "";
40935
- while (ai < a.length && bi < b.length) {
40936
- if (a[ai] === b[bi]) {
40937
- result.push(which === "b" ? b[bi] : a[ai]);
40938
- ai++;
40939
- bi++;
40940
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
40941
- result.push(a[ai]);
40942
- ai++;
40943
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
40944
- result.push(b[bi]);
40945
- bi++;
40946
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
40947
- if (which === "b")
40948
- return false;
40949
- which = "a";
40950
- result.push(a[ai]);
40951
- ai++;
40952
- bi++;
40953
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
40954
- if (which === "a")
40955
- return false;
40956
- which = "b";
40957
- result.push(b[bi]);
40958
- ai++;
40959
- bi++;
40960
- } else {
40961
- return false;
40962
- }
40153
+ var lastgs = -1;
40154
+ for (i = pattern.length - 1; i >= 0; i--) {
40155
+ if (pattern[i] === GLOBSTAR) {
40156
+ lastgs = i;
40157
+ break;
40963
40158
  }
40964
- return a.length === b.length && result;
40965
40159
  }
40966
- parseNegate() {
40967
- if (this.nonegate)
40968
- return;
40969
- const pattern = this.pattern;
40970
- let negate = false;
40971
- let negateOffset = 0;
40972
- for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
40973
- negate = !negate;
40974
- negateOffset++;
40160
+ var head = pattern.slice(patternIndex, firstgs);
40161
+ var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
40162
+ var tail = partial ? [] : pattern.slice(lastgs + 1);
40163
+ if (head.length) {
40164
+ var fileHead = file.slice(fileIndex, fileIndex + head.length);
40165
+ if (!this._matchOne(fileHead, head, partial, 0, 0)) {
40166
+ return false;
40975
40167
  }
40976
- if (negateOffset)
40977
- this.pattern = pattern.slice(negateOffset);
40978
- this.negate = negate;
40168
+ fileIndex += head.length;
40979
40169
  }
40980
- // set partial to true to test if, for example,
40981
- // "/a/b" matches the start of "/*/b/*/d"
40982
- // Partial means, if you run out of file before you run
40983
- // out of pattern, then that's fine, as long as all
40984
- // the parts match.
40985
- matchOne(file, pattern, partial = false) {
40986
- let fileStartIndex = 0;
40987
- let patternStartIndex = 0;
40988
- if (this.isWindows) {
40989
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
40990
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
40991
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
40992
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
40993
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
40994
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
40995
- if (typeof fdi === "number" && typeof pdi === "number") {
40996
- const [fd, pd] = [
40997
- file[fdi],
40998
- pattern[pdi]
40999
- ];
41000
- if (fd.toLowerCase() === pd.toLowerCase()) {
41001
- pattern[pdi] = fd;
41002
- patternStartIndex = pdi;
41003
- fileStartIndex = fdi;
41004
- }
41005
- }
41006
- }
41007
- const { optimizationLevel = 1 } = this.options;
41008
- if (optimizationLevel >= 2) {
41009
- file = this.levelTwoFileOptimize(file);
41010
- }
41011
- if (pattern.includes(exports2.GLOBSTAR)) {
41012
- return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
41013
- }
41014
- return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
41015
- }
41016
- #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
41017
- const firstgs = pattern.indexOf(exports2.GLOBSTAR, patternIndex);
41018
- const lastgs = pattern.lastIndexOf(exports2.GLOBSTAR);
41019
- const [head, body, tail] = partial ? [
41020
- pattern.slice(patternIndex, firstgs),
41021
- pattern.slice(firstgs + 1),
41022
- []
41023
- ] : [
41024
- pattern.slice(patternIndex, firstgs),
41025
- pattern.slice(firstgs + 1, lastgs),
41026
- pattern.slice(lastgs + 1)
41027
- ];
41028
- if (head.length) {
41029
- const fileHead = file.slice(fileIndex, fileIndex + head.length);
41030
- if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
40170
+ var fileTailMatch = 0;
40171
+ if (tail.length) {
40172
+ if (tail.length + fileIndex > file.length) return false;
40173
+ var tailStart = file.length - tail.length;
40174
+ if (this._matchOne(file, tail, partial, tailStart, 0)) {
40175
+ fileTailMatch = tail.length;
40176
+ } else {
40177
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
41031
40178
  return false;
41032
40179
  }
41033
- fileIndex += head.length;
41034
- patternIndex += head.length;
41035
- }
41036
- let fileTailMatch = 0;
41037
- if (tail.length) {
41038
- if (tail.length + fileIndex > file.length)
40180
+ tailStart--;
40181
+ if (!this._matchOne(file, tail, partial, tailStart, 0)) {
41039
40182
  return false;
41040
- let tailStart = file.length - tail.length;
41041
- if (this.#matchOne(file, tail, partial, tailStart, 0)) {
41042
- fileTailMatch = tail.length;
41043
- } else {
41044
- if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
41045
- return false;
41046
- }
41047
- tailStart--;
41048
- if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
41049
- return false;
41050
- }
41051
- fileTailMatch = tail.length + 1;
41052
- }
41053
- }
41054
- if (!body.length) {
41055
- let sawSome = !!fileTailMatch;
41056
- for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
41057
- const f = String(file[i2]);
41058
- sawSome = true;
41059
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
41060
- return false;
41061
- }
41062
- }
41063
- return partial || sawSome;
41064
- }
41065
- const bodySegments = [[[], 0]];
41066
- let currentBody = bodySegments[0];
41067
- let nonGsParts = 0;
41068
- const nonGsPartsSums = [0];
41069
- for (const b of body) {
41070
- if (b === exports2.GLOBSTAR) {
41071
- nonGsPartsSums.push(nonGsParts);
41072
- currentBody = [[], 0];
41073
- bodySegments.push(currentBody);
41074
- } else {
41075
- currentBody[0].push(b);
41076
- nonGsParts++;
41077
40183
  }
40184
+ fileTailMatch = tail.length + 1;
41078
40185
  }
41079
- let i = bodySegments.length - 1;
41080
- const fileLength = file.length - fileTailMatch;
41081
- for (const b of bodySegments) {
41082
- b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
41083
- }
41084
- return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
41085
40186
  }
41086
- // return false for "nope, not matching"
41087
- // return null for "not matching, cannot keep trying"
41088
- #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
41089
- const bs = bodySegments[bodyIndex];
41090
- if (!bs) {
41091
- for (let i = fileIndex; i < file.length; i++) {
41092
- sawTail = true;
41093
- const f = file[i];
41094
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
41095
- return false;
41096
- }
41097
- }
41098
- return sawTail;
41099
- }
41100
- const [body, after] = bs;
41101
- while (fileIndex <= after) {
41102
- const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
41103
- if (m && globStarDepth < this.maxGlobstarRecursion) {
41104
- const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
41105
- if (sub !== false) {
41106
- return sub;
41107
- }
41108
- }
41109
- const f = file[fileIndex];
41110
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
40187
+ if (!body.length) {
40188
+ var sawSome = !!fileTailMatch;
40189
+ for (i = fileIndex; i < file.length - fileTailMatch; i++) {
40190
+ var f = String(file[i]);
40191
+ sawSome = true;
40192
+ if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
41111
40193
  return false;
41112
40194
  }
41113
- fileIndex++;
41114
40195
  }
41115
- return partial || null;
40196
+ return partial || sawSome;
41116
40197
  }
41117
- #matchOne(file, pattern, partial, fileIndex, patternIndex) {
41118
- let fi;
41119
- let pi;
41120
- let pl;
41121
- let fl;
41122
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
41123
- this.debug("matchOne loop");
41124
- let p = pattern[pi];
41125
- let f = file[fi];
41126
- this.debug(pattern, p, f);
41127
- if (p === false || p === exports2.GLOBSTAR) {
40198
+ var bodySegments = [[[], 0]];
40199
+ var currentBody = bodySegments[0];
40200
+ var nonGsParts = 0;
40201
+ var nonGsPartsSums = [0];
40202
+ for (var bi = 0; bi < body.length; bi++) {
40203
+ var b = body[bi];
40204
+ if (b === GLOBSTAR) {
40205
+ nonGsPartsSums.push(nonGsParts);
40206
+ currentBody = [[], 0];
40207
+ bodySegments.push(currentBody);
40208
+ } else {
40209
+ currentBody[0].push(b);
40210
+ nonGsParts++;
40211
+ }
40212
+ }
40213
+ var idx = bodySegments.length - 1;
40214
+ var fileLength = file.length - fileTailMatch;
40215
+ for (var si = 0; si < bodySegments.length; si++) {
40216
+ bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
40217
+ }
40218
+ return !!this._matchGlobStarBodySections(
40219
+ file,
40220
+ bodySegments,
40221
+ fileIndex,
40222
+ 0,
40223
+ partial,
40224
+ 0,
40225
+ !!fileTailMatch
40226
+ );
40227
+ };
40228
+ Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
40229
+ var bs = bodySegments[bodyIndex];
40230
+ if (!bs) {
40231
+ for (var i = fileIndex; i < file.length; i++) {
40232
+ sawTail = true;
40233
+ var f = file[i];
40234
+ if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
41128
40235
  return false;
41129
40236
  }
41130
- let hit;
41131
- if (typeof p === "string") {
41132
- hit = f === p;
41133
- this.debug("string match", p, f, hit);
41134
- } else {
41135
- hit = p.test(f);
41136
- this.debug("pattern match", p, f, hit);
41137
- }
41138
- if (!hit)
41139
- return false;
41140
- }
41141
- if (fi === fl && pi === pl) {
41142
- return true;
41143
- } else if (fi === fl) {
41144
- return partial;
41145
- } else if (pi === pl) {
41146
- return fi === fl - 1 && file[fi] === "";
41147
- } else {
41148
- throw new Error("wtf?");
41149
40237
  }
40238
+ return sawTail;
41150
40239
  }
41151
- braceExpand() {
41152
- return (0, exports2.braceExpand)(this.pattern, this.options);
41153
- }
41154
- parse(pattern) {
41155
- (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
41156
- const options = this.options;
41157
- if (pattern === "**")
41158
- return exports2.GLOBSTAR;
41159
- if (pattern === "")
41160
- return "";
41161
- let m;
41162
- let fastTest = null;
41163
- if (m = pattern.match(starRE)) {
41164
- fastTest = options.dot ? starTestDot : starTest;
41165
- } else if (m = pattern.match(starDotExtRE)) {
41166
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
41167
- } else if (m = pattern.match(qmarksRE)) {
41168
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
41169
- } else if (m = pattern.match(starDotStarRE)) {
41170
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
41171
- } else if (m = pattern.match(dotStarRE)) {
41172
- fastTest = dotStarTest;
41173
- }
41174
- const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern();
41175
- if (fastTest && typeof re === "object") {
41176
- Reflect.defineProperty(re, "test", { value: fastTest });
41177
- }
41178
- return re;
41179
- }
41180
- makeRe() {
41181
- if (this.regexp || this.regexp === false)
41182
- return this.regexp;
41183
- const set = this.set;
41184
- if (!set.length) {
41185
- this.regexp = false;
41186
- return this.regexp;
41187
- }
41188
- const options = this.options;
41189
- const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
41190
- const flags = new Set(options.nocase ? ["i"] : []);
41191
- let re = set.map((pattern) => {
41192
- const pp = pattern.map((p) => {
41193
- if (p instanceof RegExp) {
41194
- for (const f of p.flags.split(""))
41195
- flags.add(f);
41196
- }
41197
- return typeof p === "string" ? regExpEscape(p) : p === exports2.GLOBSTAR ? exports2.GLOBSTAR : p._src;
41198
- });
41199
- pp.forEach((p, i) => {
41200
- const next = pp[i + 1];
41201
- const prev = pp[i - 1];
41202
- if (p !== exports2.GLOBSTAR || prev === exports2.GLOBSTAR) {
41203
- return;
41204
- }
41205
- if (prev === void 0) {
41206
- if (next !== void 0 && next !== exports2.GLOBSTAR) {
41207
- pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
41208
- } else {
41209
- pp[i] = twoStar;
41210
- }
41211
- } else if (next === void 0) {
41212
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
41213
- } else if (next !== exports2.GLOBSTAR) {
41214
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
41215
- pp[i + 1] = exports2.GLOBSTAR;
41216
- }
41217
- });
41218
- const filtered = pp.filter((p) => p !== exports2.GLOBSTAR);
41219
- if (this.partial && filtered.length >= 1) {
41220
- const prefixes = [];
41221
- for (let i = 1; i <= filtered.length; i++) {
41222
- prefixes.push(filtered.slice(0, i).join("/"));
41223
- }
41224
- return "(?:" + prefixes.join("|") + ")";
40240
+ var body = bs[0];
40241
+ var after = bs[1];
40242
+ while (fileIndex <= after) {
40243
+ var m = this._matchOne(
40244
+ file.slice(0, fileIndex + body.length),
40245
+ body,
40246
+ partial,
40247
+ fileIndex,
40248
+ 0
40249
+ );
40250
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
40251
+ var sub = this._matchGlobStarBodySections(
40252
+ file,
40253
+ bodySegments,
40254
+ fileIndex + body.length,
40255
+ bodyIndex + 1,
40256
+ partial,
40257
+ globStarDepth + 1,
40258
+ sawTail
40259
+ );
40260
+ if (sub !== false) {
40261
+ return sub;
41225
40262
  }
41226
- return filtered.join("/");
41227
- }).join("|");
41228
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
41229
- re = "^" + open + re + close + "$";
41230
- if (this.partial) {
41231
- re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
41232
- }
41233
- if (this.negate)
41234
- re = "^(?!" + re + ").+$";
41235
- try {
41236
- this.regexp = new RegExp(re, [...flags].join(""));
41237
- } catch {
41238
- this.regexp = false;
41239
- }
41240
- return this.regexp;
41241
- }
41242
- slashSplit(p) {
41243
- if (this.preserveMultipleSlashes) {
41244
- return p.split("/");
41245
- } else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
41246
- return ["", ...p.split(/\/+/)];
41247
- } else {
41248
- return p.split(/\/+/);
41249
40263
  }
41250
- }
41251
- match(f, partial = this.partial) {
41252
- this.debug("match", f, this.pattern);
41253
- if (this.comment) {
40264
+ var f = file[fileIndex];
40265
+ if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
41254
40266
  return false;
41255
40267
  }
41256
- if (this.empty) {
41257
- return f === "";
41258
- }
41259
- if (f === "/" && partial) {
41260
- return true;
41261
- }
41262
- const options = this.options;
41263
- if (this.isWindows) {
41264
- f = f.split("\\").join("/");
41265
- }
41266
- const ff = this.slashSplit(f);
41267
- this.debug(this.pattern, "split", ff);
41268
- const set = this.set;
41269
- this.debug(this.pattern, "set", set);
41270
- let filename = ff[ff.length - 1];
41271
- if (!filename) {
41272
- for (let i = ff.length - 2; !filename && i >= 0; i--) {
41273
- filename = ff[i];
41274
- }
41275
- }
41276
- for (const pattern of set) {
41277
- let file = ff;
41278
- if (options.matchBase && pattern.length === 1) {
41279
- file = [filename];
41280
- }
41281
- const hit = this.matchOne(file, pattern, partial);
41282
- if (hit) {
41283
- if (options.flipNegate) {
41284
- return true;
41285
- }
41286
- return !this.negate;
41287
- }
41288
- }
41289
- if (options.flipNegate) {
41290
- return false;
40268
+ fileIndex++;
40269
+ }
40270
+ return partial || null;
40271
+ };
40272
+ Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
40273
+ var fi, pi, fl, pl;
40274
+ for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
40275
+ this.debug("matchOne loop");
40276
+ var p = pattern[pi];
40277
+ var f = file[fi];
40278
+ this.debug(pattern, p, f);
40279
+ if (p === false || p === GLOBSTAR) return false;
40280
+ var hit;
40281
+ if (typeof p === "string") {
40282
+ hit = f === p;
40283
+ this.debug("string match", p, f, hit);
40284
+ } else {
40285
+ hit = f.match(p);
40286
+ this.debug("pattern match", p, f, hit);
41291
40287
  }
41292
- return this.negate;
40288
+ if (!hit) return false;
41293
40289
  }
41294
- static defaults(def) {
41295
- return exports2.minimatch.defaults(def).Minimatch;
40290
+ if (fi === fl && pi === pl) {
40291
+ return true;
40292
+ } else if (fi === fl) {
40293
+ return partial;
40294
+ } else if (pi === pl) {
40295
+ return fi === fl - 1 && file[fi] === "";
41296
40296
  }
40297
+ throw new Error("wtf?");
41297
40298
  };
41298
- exports2.Minimatch = Minimatch;
41299
- var ast_js_2 = require_ast();
41300
- Object.defineProperty(exports2, "AST", { enumerable: true, get: function() {
41301
- return ast_js_2.AST;
41302
- } });
41303
- var escape_js_2 = require_escape();
41304
- Object.defineProperty(exports2, "escape", { enumerable: true, get: function() {
41305
- return escape_js_2.escape;
41306
- } });
41307
- var unescape_js_2 = require_unescape();
41308
- Object.defineProperty(exports2, "unescape", { enumerable: true, get: function() {
41309
- return unescape_js_2.unescape;
41310
- } });
41311
- exports2.minimatch.AST = ast_js_1.AST;
41312
- exports2.minimatch.Minimatch = Minimatch;
41313
- exports2.minimatch.escape = escape_js_1.escape;
41314
- exports2.minimatch.unescape = unescape_js_1.unescape;
40299
+ function globUnescape(s) {
40300
+ return s.replace(/\\(.)/g, "$1");
40301
+ }
40302
+ function regExpEscape(s) {
40303
+ return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
40304
+ }
41315
40305
  }
41316
40306
  });
41317
40307
 
@@ -41351,7 +40341,7 @@ var require_common2 = __commonJS({
41351
40341
  }
41352
40342
  var fs = __require("fs");
41353
40343
  var path = __require("path");
41354
- var minimatch = require_commonjs3();
40344
+ var minimatch = require_minimatch2();
41355
40345
  var isAbsolute = require_path_is_absolute();
41356
40346
  var Minimatch = minimatch.Minimatch;
41357
40347
  function alphasort(a, b) {
@@ -41537,7 +40527,7 @@ var require_sync = __commonJS({
41537
40527
  module2.exports = globSync;
41538
40528
  globSync.GlobSync = GlobSync;
41539
40529
  var rp = require_fs();
41540
- var minimatch = require_commonjs3();
40530
+ var minimatch = require_minimatch2();
41541
40531
  var Minimatch = minimatch.Minimatch;
41542
40532
  var Glob = require_glob().Glob;
41543
40533
  var util = __require("util");
@@ -42015,7 +41005,7 @@ var require_glob = __commonJS({
42015
41005
  "use strict";
42016
41006
  module2.exports = glob;
42017
41007
  var rp = require_fs();
42018
- var minimatch = require_commonjs3();
41008
+ var minimatch = require_minimatch2();
42019
41009
  var Minimatch = minimatch.Minimatch;
42020
41010
  var inherits2 = require_inherits();
42021
41011
  var EE = __require("events").EventEmitter;