@ariestools/toolchain 10.1.1 → 10.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/actions/agent/document.d.ts +15 -0
  2. package/dist/actions/agent/document.d.ts.map +1 -1
  3. package/dist/actions/agent/index.d.ts +1 -1
  4. package/dist/actions/agent/index.d.ts.map +1 -1
  5. package/dist/actions/agent/lint.d.ts +5 -0
  6. package/dist/actions/agent/lint.d.ts.map +1 -1
  7. package/dist/actions/agent/mutate.d.ts.map +1 -1
  8. package/dist/actions/agent/rules.d.ts.map +1 -1
  9. package/dist/actions/agent/walk.d.ts.map +1 -1
  10. package/dist/actions/package/compile/XyConfig.d.ts +25 -2
  11. package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
  12. package/dist/actions/plan/markdown.d.ts.map +1 -1
  13. package/dist/actions/repo-init/scaffold.d.ts.map +1 -1
  14. package/dist/actions/repo-init/skillsInstall.d.ts.map +1 -1
  15. package/dist/actions/repo-init/templateVars.d.ts.map +1 -1
  16. package/dist/actions/secure/dependabot.d.ts.map +1 -1
  17. package/dist/actions/skills/defaults.d.ts +3 -3
  18. package/dist/actions/skills/defaults.d.ts.map +1 -1
  19. package/dist/actions/skills/detectProfile.d.ts.map +1 -1
  20. package/dist/actions/skills/editXyConfigSkillPresence.d.ts +13 -0
  21. package/dist/actions/skills/editXyConfigSkillPresence.d.ts.map +1 -0
  22. package/dist/actions/skills/installed.d.ts +7 -0
  23. package/dist/actions/skills/installed.d.ts.map +1 -1
  24. package/dist/actions/skills/legacyGenerated.d.ts +7 -0
  25. package/dist/actions/skills/legacyGenerated.d.ts.map +1 -0
  26. package/dist/actions/skills/lint.d.ts +3 -0
  27. package/dist/actions/skills/lint.d.ts.map +1 -1
  28. package/dist/actions/skills/lock.d.ts +5 -1
  29. package/dist/actions/skills/lock.d.ts.map +1 -1
  30. package/dist/actions/skills/pick.d.ts.map +1 -1
  31. package/dist/actions/skills/skillRules.d.ts +2 -1
  32. package/dist/actions/skills/skillRules.d.ts.map +1 -1
  33. package/dist/actions/work/lint.d.ts.map +1 -1
  34. package/dist/bin/package/build.mjs +1494 -1494
  35. package/dist/bin/package/build.mjs.map +1 -1
  36. package/dist/bin/package/clean.mjs +1813 -1813
  37. package/dist/bin/package/clean.mjs.map +1 -1
  38. package/dist/bin/package/compile.mjs +1494 -1494
  39. package/dist/bin/package/compile.mjs.map +1 -1
  40. package/dist/bin/package/copy-assets-cjs.mjs +1 -1
  41. package/dist/bin/package/copy-assets-esm.mjs +1 -1
  42. package/dist/bin/package/publint.mjs +1 -1
  43. package/dist/bin/package/publint.mjs.map +1 -1
  44. package/dist/bin/package/recompile.mjs +1494 -1494
  45. package/dist/bin/package/recompile.mjs.map +1 -1
  46. package/dist/bin/package/sync-layout.mjs.map +1 -1
  47. package/dist/bin/xy.mjs +1293 -662
  48. package/dist/bin/xy.mjs.map +1 -1
  49. package/dist/bin/xyex.mjs +1293 -662
  50. package/dist/bin/xyex.mjs.map +1 -1
  51. package/dist/lib/loadConfig.d.ts +5 -0
  52. package/dist/lib/loadConfig.d.ts.map +1 -1
  53. package/dist/xy/common/checkCommand.d.ts.map +1 -1
  54. package/dist/xy/common/skills/index.d.ts.map +1 -1
  55. package/dist/xy/xy.d.ts +2 -0
  56. package/dist/xy/xy.d.ts.map +1 -1
  57. package/package.json +4 -4
  58. package/templates/repo/cli/root/AGENTS.md.tmpl +26 -17
  59. package/templates/repo/cli/root/docs/README.md.tmpl +4 -0
  60. package/templates/repo/cli/root/github/workflows/build-bun.yml.tmpl +8 -0
  61. package/templates/repo/cli/root/github/workflows/build-npm.yml.tmpl +9 -1
  62. package/templates/repo/cli/root/github/workflows/build-pnpm.yml.tmpl +10 -2
  63. package/templates/repo/cli/root/github/workflows/build-yarn.yml.tmpl +9 -1
  64. package/templates/repo/cli/root/package.json.tmpl +3 -3
  65. package/templates/repo/cli/root/papers/README.md.tmpl +10 -0
  66. package/templates/repo/cli/root/pnpm-workspace.yaml +4 -0
@@ -6,13 +6,13 @@ import tty from "node:tty";
6
6
  import * as xi from "node:fs";
7
7
  import fs, { existsSync, readFileSync } from "node:fs";
8
8
  import path, { posix, win32 } from "node:path";
9
- import { fileURLToPath } from "node:url";
9
+ import Re from "path";
10
10
  import Ie, { lstatSync, readdir, readdirSync, readlinkSync, realpathSync } from "fs";
11
+ import { fileURLToPath } from "node:url";
11
12
  import { lstat, readdir as readdir$1, readlink, realpath } from "node:fs/promises";
12
13
  import { EventEmitter } from "node:events";
13
14
  import Pe from "node:stream";
14
15
  import { StringDecoder } from "node:string_decoder";
15
- import Re from "path";
16
16
  import Ue from "os";
17
17
  import { createJiti } from "jiti";
18
18
  import ts, { formatDiagnosticsWithColorAndContext, sys } from "typescript";
@@ -523,152 +523,557 @@ Object.defineProperties(createChalk.prototype, {
523
523
  const chalk = createChalk();
524
524
  createChalk({ level: stderrColor ? stderrColor.level : 0 });
525
525
  //#endregion
526
- //#region ../../node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
527
- function Ht(n) {
528
- return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
529
- }
530
- function ps(n) {
531
- return n.replace(as, fe$1).replace(ls, ue$1).replace(cs, qt).replace(fs$4, de$1).replace(us, pe$1);
532
- }
533
- function ms(n) {
534
- return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os$2, ",").replace(hs, ".");
535
- }
536
- function me$1(n) {
537
- if (!n) return [""];
538
- let t = [], e = Gt("{", "}", n);
539
- if (!e) return n.split(",");
540
- let { pre: s, body: i, post: r } = e, o = s.split(",");
541
- o[o.length - 1] += "{" + i + "}";
542
- let h = me$1(r);
543
- return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
544
- }
545
- function ge$1(n, t = {}) {
546
- if (!n) return [];
547
- let { max: e = ds } = t;
548
- return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(ps(n), e, !0).map(ms);
549
- }
550
- function gs(n) {
551
- return "{" + n + "}";
552
- }
553
- function ws(n) {
554
- return /^-?0\d/.test(n);
555
- }
556
- function ys(n, t) {
557
- return n <= t;
558
- }
559
- function bs(n, t) {
560
- return n >= t;
561
- }
562
- function ht(n, t, e) {
563
- let s = [], i = Gt("{", "}", n);
564
- if (!i) return [n];
565
- let r = i.pre, o = i.post.length ? ht(i.post, t, !1) : [""];
566
- if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
567
- let a = r + "{" + i.body + "}" + o[h];
568
- s.push(a);
526
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
527
+ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
528
+ module.exports = isexe;
529
+ isexe.sync = sync;
530
+ var fs$4 = __require("fs");
531
+ function checkPathExt(path, options) {
532
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
533
+ if (!pathext) return true;
534
+ pathext = pathext.split(";");
535
+ if (pathext.indexOf("") !== -1) return true;
536
+ for (var i = 0; i < pathext.length; i++) {
537
+ var p = pathext[i].toLowerCase();
538
+ if (p && path.substr(-p.length).toLowerCase() === p) return true;
539
+ }
540
+ return false;
569
541
  }
570
- else {
571
- let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
572
- if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + qt + i.post, ht(n, t, !0)) : [n];
573
- let c;
574
- if (l) c = i.body.split(/\.\./);
575
- else if (c = me$1(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, !1).map(gs), c.length === 1)) return o.map((f) => i.pre + c[0] + f);
576
- let d;
577
- if (l && c[0] !== void 0 && c[1] !== void 0) {
578
- let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g = ys;
579
- m < f && (w *= -1, g = bs);
580
- let E = c.some(ws);
581
- d = [];
582
- for (let y = f; g(y, m); y += w) {
583
- let b;
584
- if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
585
- else if (b = String(y), E) {
586
- let z = p - b.length;
587
- if (z > 0) {
588
- let $ = new Array(z + 1).join("0");
589
- y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
590
- }
542
+ function checkStat(stat, path, options) {
543
+ if (!stat.isSymbolicLink() && !stat.isFile()) return false;
544
+ return checkPathExt(path, options);
545
+ }
546
+ function isexe(path, options, cb) {
547
+ fs$4.stat(path, function(er, stat) {
548
+ cb(er, er ? false : checkStat(stat, path, options));
549
+ });
550
+ }
551
+ function sync(path, options) {
552
+ return checkStat(fs$4.statSync(path), path, options);
553
+ }
554
+ }));
555
+ //#endregion
556
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
557
+ var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
558
+ module.exports = isexe;
559
+ isexe.sync = sync;
560
+ var fs$3 = __require("fs");
561
+ function isexe(path, options, cb) {
562
+ fs$3.stat(path, function(er, stat) {
563
+ cb(er, er ? false : checkStat(stat, options));
564
+ });
565
+ }
566
+ function sync(path, options) {
567
+ return checkStat(fs$3.statSync(path), options);
568
+ }
569
+ function checkStat(stat, options) {
570
+ return stat.isFile() && checkMode(stat, options);
571
+ }
572
+ function checkMode(stat, options) {
573
+ var mod = stat.mode;
574
+ var uid = stat.uid;
575
+ var gid = stat.gid;
576
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
577
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
578
+ var u = parseInt("100", 8);
579
+ var g = parseInt("010", 8);
580
+ var o = parseInt("001", 8);
581
+ var ug = u | g;
582
+ return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
583
+ }
584
+ }));
585
+ //#endregion
586
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
587
+ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
588
+ __require("fs");
589
+ var core;
590
+ if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
591
+ else core = require_mode();
592
+ module.exports = isexe;
593
+ isexe.sync = sync;
594
+ function isexe(path, options, cb) {
595
+ if (typeof options === "function") {
596
+ cb = options;
597
+ options = {};
598
+ }
599
+ if (!cb) {
600
+ if (typeof Promise !== "function") throw new TypeError("callback not provided");
601
+ return new Promise(function(resolve, reject) {
602
+ isexe(path, options || {}, function(er, is) {
603
+ if (er) reject(er);
604
+ else resolve(is);
605
+ });
606
+ });
607
+ }
608
+ core(path, options || {}, function(er, is) {
609
+ if (er) {
610
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
611
+ er = null;
612
+ is = false;
591
613
  }
592
- d.push(b);
593
614
  }
594
- } else {
595
- d = [];
596
- for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, !1));
597
- }
598
- for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
599
- let p = r + d[f] + o[m];
600
- (!e || l || p) && s.push(p);
615
+ cb(er, is);
616
+ });
617
+ }
618
+ function sync(path, options) {
619
+ try {
620
+ return core.sync(path, options || {});
621
+ } catch (er) {
622
+ if (options && options.ignoreErrors || er.code === "EACCES") return false;
623
+ else throw er;
601
624
  }
602
625
  }
603
- return s;
604
- }
605
- function Bt(n, t = {}) {
606
- return new I$1(n, t).streamSync();
607
- }
608
- function Qe$1(n, t = {}) {
609
- return new I$1(n, t).stream();
610
- }
611
- function ts$1(n, t = {}) {
612
- return new I$1(n, t).walkSync();
613
- }
614
- async function Je$1(n, t = {}) {
615
- return new I$1(n, t).walk();
616
- }
617
- function Ut(n, t = {}) {
618
- return new I$1(n, t).iterateSync();
619
- }
620
- function es(n, t = {}) {
621
- return new I$1(n, t).iterate();
622
- }
623
- var Gt, ce, ss, fe$1, ue$1, qt, de$1, pe$1, is, rs, ns, os$2, hs, as, ls, cs, fs$4, us, ds, at, Ss, lt, Es, we$1, ye$1, W, xs, be$1, vs, Ct, Cs, Ts, As, ks, Kt, Se$1, Ee$1, Q$1, tt, O$2, Rs, Os, Fs, Ds, Ms, Ns, _s, Ls, Ws, Ps, js, Is, zs, Bs, Us, $s, Gs, Hs, Ce$1, Te$1, Ae$1, xe$1, A$1, Vs, Ys, Xs, Js, N$1, Zs, ke$1, Qs, ti, ve$1, ei, D, si, Oe$1, Vt, Fe$1, At, Re$1, ii, q$1, De$1, Tt, ri, ft, Ne$1, oi, hi, ai, G, H$1, K$1, kt, ut, Rt, _e$1, Ot, Le$1, P, et, v$1, dt, st, C$1, F, T, Yt, Ft, k, x$1, Xt, Jt, We$1, Zt, B, Qt, Dt, pt, Y$1, M, mt, li, ci, fi, ui, Mt, te$1, di, pi, V, vi, wt, Ue$1, $e$1, Ri, Oi, L$1, Ge$1, He$1, U, qe$1, Ke$1, X$1, Ve$1, _$1, gt, se$1, je$1, yt, j, Nt, Lt, Ie$1, Fi, ie$1, ze$1, bt, Be, _t, Wt, ne$1, Ye$1, R$2, Pt, jt, It, it, rt, St, Xe$1, Di, Mi, Ni, nt, _i, ot, oe$1, he$1, ae$1, Et, Li, zt, xt, vt, Pi, I$1, le$1, ji, Ii, zi, Bi, Ui, Ze$1;
624
- var init_index_min = __esmMin((() => {
625
- Gt = (n, t, e) => {
626
- let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
627
- return r && {
628
- start: r[0],
629
- end: r[1],
630
- pre: e.slice(0, r[0]),
631
- body: e.slice(r[0] + s.length, r[1]),
632
- post: e.slice(r[1] + i.length)
626
+ }));
627
+ //#endregion
628
+ //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
629
+ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
630
+ const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
631
+ const path$5 = __require("path");
632
+ const COLON = isWindows ? ";" : ":";
633
+ const isexe = require_isexe();
634
+ const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
635
+ const getPathInfo = (cmd, opt) => {
636
+ const colon = opt.colon || COLON;
637
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
638
+ /* istanbul ignore next: very unusual */ "").split(colon)];
639
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
640
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
641
+ if (isWindows) {
642
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
643
+ }
644
+ return {
645
+ pathEnv,
646
+ pathExt,
647
+ pathExtExe
633
648
  };
634
649
  };
635
- ce = (n, t) => {
636
- let e = t.match(n);
637
- return e ? e[0] : null;
638
- };
639
- ss = (n, t, e) => {
640
- let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
641
- if (a >= 0 && l > 0) {
642
- if (n === t) return [a, l];
643
- for (s = [], r = e.length; u >= 0 && !h;) {
644
- if (u === a) s.push(u), a = e.indexOf(n, u + 1);
645
- else if (s.length === 1) {
646
- let c = s.pop();
647
- c !== void 0 && (h = [c, l]);
648
- } else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
649
- u = a < l && a >= 0 ? a : l;
650
- }
651
- s.length && o !== void 0 && (h = [r, o]);
650
+ const which = (cmd, opt, cb) => {
651
+ if (typeof opt === "function") {
652
+ cb = opt;
653
+ opt = {};
652
654
  }
653
- return h;
654
- };
655
- fe$1 = "\0SLASH" + Math.random() + "\0";
656
- ue$1 = "\0OPEN" + Math.random() + "\0";
657
- qt = "\0CLOSE" + Math.random() + "\0";
658
- de$1 = "\0COMMA" + Math.random() + "\0";
659
- pe$1 = "\0PERIOD" + Math.random() + "\0";
660
- is = new RegExp(fe$1, "g");
661
- rs = new RegExp(ue$1, "g");
662
- ns = new RegExp(qt, "g");
663
- os$2 = new RegExp(de$1, "g");
664
- hs = new RegExp(pe$1, "g");
665
- as = /\\\\/g;
666
- ls = /\\{/g;
667
- cs = /\\}/g;
668
- fs$4 = /\\,/g;
669
- us = /\\./g;
670
- ds = 1e5;
671
- at = (n) => {
655
+ if (!opt) opt = {};
656
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
657
+ const found = [];
658
+ const step = (i) => new Promise((resolve, reject) => {
659
+ if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
660
+ const ppRaw = pathEnv[i];
661
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
662
+ const pCmd = path$5.join(pathPart, cmd);
663
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
664
+ resolve(subStep(p, i, 0));
665
+ });
666
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
667
+ if (ii === pathExt.length) return resolve(step(i + 1));
668
+ const ext = pathExt[ii];
669
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
670
+ if (!er && is) {
671
+ if (opt.all) found.push(p + ext);
672
+ else return resolve(p + ext);
673
+ }
674
+ return resolve(subStep(p, i, ii + 1));
675
+ });
676
+ });
677
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
678
+ };
679
+ const whichSync = (cmd, opt) => {
680
+ opt = opt || {};
681
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
682
+ const found = [];
683
+ for (let i = 0; i < pathEnv.length; i++) {
684
+ const ppRaw = pathEnv[i];
685
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
686
+ const pCmd = path$5.join(pathPart, cmd);
687
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
688
+ for (let j = 0; j < pathExt.length; j++) {
689
+ const cur = p + pathExt[j];
690
+ try {
691
+ if (isexe.sync(cur, { pathExt: pathExtExe })) {
692
+ if (opt.all) found.push(cur);
693
+ else return cur;
694
+ }
695
+ } catch (ex) {}
696
+ }
697
+ }
698
+ if (opt.all && found.length) return found;
699
+ if (opt.nothrow) return null;
700
+ throw getNotFoundError(cmd);
701
+ };
702
+ module.exports = which;
703
+ which.sync = whichSync;
704
+ }));
705
+ //#endregion
706
+ //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
707
+ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
708
+ const pathKey = (options = {}) => {
709
+ const environment = options.env || process.env;
710
+ if ((options.platform || process.platform) !== "win32") return "PATH";
711
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
712
+ };
713
+ module.exports = pathKey;
714
+ module.exports.default = pathKey;
715
+ }));
716
+ //#endregion
717
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
718
+ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
719
+ const path$4 = __require("path");
720
+ const which = require_which();
721
+ const getPathKey = require_path_key();
722
+ function resolveCommandAttempt(parsed, withoutPathExt) {
723
+ const env = parsed.options.env || process.env;
724
+ const cwd = process.cwd();
725
+ const hasCustomCwd = parsed.options.cwd != null;
726
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
727
+ if (shouldSwitchCwd) try {
728
+ process.chdir(parsed.options.cwd);
729
+ } catch (err) {}
730
+ let resolved;
731
+ try {
732
+ resolved = which.sync(parsed.command, {
733
+ path: env[getPathKey({ env })],
734
+ pathExt: withoutPathExt ? path$4.delimiter : void 0
735
+ });
736
+ } catch (e) {} finally {
737
+ if (shouldSwitchCwd) process.chdir(cwd);
738
+ }
739
+ if (resolved) resolved = path$4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
740
+ return resolved;
741
+ }
742
+ function resolveCommand(parsed) {
743
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
744
+ }
745
+ module.exports = resolveCommand;
746
+ }));
747
+ //#endregion
748
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
749
+ var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
750
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
751
+ function escapeCommand(arg) {
752
+ arg = arg.replace(metaCharsRegExp, "^$1");
753
+ return arg;
754
+ }
755
+ function escapeArgument(arg, doubleEscapeMetaChars) {
756
+ arg = `${arg}`;
757
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
758
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
759
+ arg = `"${arg}"`;
760
+ arg = arg.replace(metaCharsRegExp, "^$1");
761
+ if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
762
+ return arg;
763
+ }
764
+ module.exports.command = escapeCommand;
765
+ module.exports.argument = escapeArgument;
766
+ }));
767
+ //#endregion
768
+ //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
769
+ var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
770
+ module.exports = /^#!(.*)/;
771
+ }));
772
+ //#endregion
773
+ //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
774
+ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
775
+ const shebangRegex = require_shebang_regex();
776
+ module.exports = (string = "") => {
777
+ const match = string.match(shebangRegex);
778
+ if (!match) return null;
779
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
780
+ const binary = path.split("/").pop();
781
+ if (binary === "env") return argument;
782
+ return argument ? `${binary} ${argument}` : binary;
783
+ };
784
+ }));
785
+ //#endregion
786
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
787
+ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
788
+ const fs$2 = __require("fs");
789
+ const shebangCommand = require_shebang_command();
790
+ function readShebang(command) {
791
+ const size = 150;
792
+ const buffer = Buffer.alloc(size);
793
+ let fd;
794
+ try {
795
+ fd = fs$2.openSync(command, "r");
796
+ fs$2.readSync(fd, buffer, 0, size, 0);
797
+ fs$2.closeSync(fd);
798
+ } catch (e) {}
799
+ return shebangCommand(buffer.toString());
800
+ }
801
+ module.exports = readShebang;
802
+ }));
803
+ //#endregion
804
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
805
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
806
+ const path$3 = __require("path");
807
+ const resolveCommand = require_resolveCommand();
808
+ const escape = require_escape();
809
+ const readShebang = require_readShebang();
810
+ const isWin = process.platform === "win32";
811
+ const isExecutableRegExp = /\.(?:com|exe)$/i;
812
+ const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
813
+ function detectShebang(parsed) {
814
+ parsed.file = resolveCommand(parsed);
815
+ const shebang = parsed.file && readShebang(parsed.file);
816
+ if (shebang) {
817
+ parsed.args.unshift(parsed.file);
818
+ parsed.command = shebang;
819
+ return resolveCommand(parsed);
820
+ }
821
+ return parsed.file;
822
+ }
823
+ function parseNonShell(parsed) {
824
+ if (!isWin) return parsed;
825
+ const commandFile = detectShebang(parsed);
826
+ const needsShell = !isExecutableRegExp.test(commandFile);
827
+ if (parsed.options.forceShell || needsShell) {
828
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
829
+ parsed.command = path$3.normalize(parsed.command);
830
+ parsed.command = escape.command(parsed.command);
831
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
832
+ parsed.args = [
833
+ "/d",
834
+ "/s",
835
+ "/c",
836
+ `"${[parsed.command].concat(parsed.args).join(" ")}"`
837
+ ];
838
+ parsed.command = process.env.comspec || "cmd.exe";
839
+ parsed.options.windowsVerbatimArguments = true;
840
+ }
841
+ return parsed;
842
+ }
843
+ function parse(command, args, options) {
844
+ if (args && !Array.isArray(args)) {
845
+ options = args;
846
+ args = null;
847
+ }
848
+ args = args ? args.slice(0) : [];
849
+ options = Object.assign({}, options);
850
+ const parsed = {
851
+ command,
852
+ args,
853
+ options,
854
+ file: void 0,
855
+ original: {
856
+ command,
857
+ args
858
+ }
859
+ };
860
+ return options.shell ? parsed : parseNonShell(parsed);
861
+ }
862
+ module.exports = parse;
863
+ }));
864
+ //#endregion
865
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
866
+ var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
867
+ const isWin = process.platform === "win32";
868
+ function notFoundError(original, syscall) {
869
+ return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
870
+ code: "ENOENT",
871
+ errno: "ENOENT",
872
+ syscall: `${syscall} ${original.command}`,
873
+ path: original.command,
874
+ spawnargs: original.args
875
+ });
876
+ }
877
+ function hookChildProcess(cp, parsed) {
878
+ if (!isWin) return;
879
+ const originalEmit = cp.emit;
880
+ cp.emit = function(name, arg1) {
881
+ if (name === "exit") {
882
+ const err = verifyENOENT(arg1, parsed);
883
+ if (err) return originalEmit.call(cp, "error", err);
884
+ }
885
+ return originalEmit.apply(cp, arguments);
886
+ };
887
+ }
888
+ function verifyENOENT(status, parsed) {
889
+ if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
890
+ return null;
891
+ }
892
+ function verifyENOENTSync(status, parsed) {
893
+ if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
894
+ return null;
895
+ }
896
+ module.exports = {
897
+ hookChildProcess,
898
+ verifyENOENT,
899
+ verifyENOENTSync,
900
+ notFoundError
901
+ };
902
+ }));
903
+ //#endregion
904
+ //#region src/lib/crossSpawn.ts
905
+ var import_cross_spawn = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
906
+ const cp = __require("child_process");
907
+ const parse = require_parse();
908
+ const enoent = require_enoent();
909
+ function spawn(command, args, options) {
910
+ const parsed = parse(command, args, options);
911
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
912
+ enoent.hookChildProcess(spawned, parsed);
913
+ return spawned;
914
+ }
915
+ function spawnSync(command, args, options) {
916
+ const parsed = parse(command, args, options);
917
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
918
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
919
+ return result;
920
+ }
921
+ module.exports = spawn;
922
+ module.exports.spawn = spawn;
923
+ module.exports.sync = spawnSync;
924
+ module.exports._parse = parse;
925
+ module.exports._enoent = enoent;
926
+ })))(), 1);
927
+ function spawnSync(command, args, options) {
928
+ return import_cross_spawn.default.sync(command, args, options);
929
+ }
930
+ //#endregion
931
+ //#region ../../node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
932
+ function Ht(n) {
933
+ return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
934
+ }
935
+ function ps(n) {
936
+ return n.replace(as, fe$1).replace(ls, ue$1).replace(cs, qt).replace(fs$1, de$1).replace(us, pe$1);
937
+ }
938
+ function ms(n) {
939
+ return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os$2, ",").replace(hs, ".");
940
+ }
941
+ function me$1(n) {
942
+ if (!n) return [""];
943
+ let t = [], e = Gt("{", "}", n);
944
+ if (!e) return n.split(",");
945
+ let { pre: s, body: i, post: r } = e, o = s.split(",");
946
+ o[o.length - 1] += "{" + i + "}";
947
+ let h = me$1(r);
948
+ return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
949
+ }
950
+ function ge$1(n, t = {}) {
951
+ if (!n) return [];
952
+ let { max: e = ds } = t;
953
+ return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(ps(n), e, !0).map(ms);
954
+ }
955
+ function gs(n) {
956
+ return "{" + n + "}";
957
+ }
958
+ function ws(n) {
959
+ return /^-?0\d/.test(n);
960
+ }
961
+ function ys(n, t) {
962
+ return n <= t;
963
+ }
964
+ function bs(n, t) {
965
+ return n >= t;
966
+ }
967
+ function ht(n, t, e) {
968
+ let s = [], i = Gt("{", "}", n);
969
+ if (!i) return [n];
970
+ let r = i.pre, o = i.post.length ? ht(i.post, t, !1) : [""];
971
+ if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
972
+ let a = r + "{" + i.body + "}" + o[h];
973
+ s.push(a);
974
+ }
975
+ else {
976
+ let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
977
+ if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + qt + i.post, ht(n, t, !0)) : [n];
978
+ let c;
979
+ if (l) c = i.body.split(/\.\./);
980
+ else if (c = me$1(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, !1).map(gs), c.length === 1)) return o.map((f) => i.pre + c[0] + f);
981
+ let d;
982
+ if (l && c[0] !== void 0 && c[1] !== void 0) {
983
+ let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g = ys;
984
+ m < f && (w *= -1, g = bs);
985
+ let E = c.some(ws);
986
+ d = [];
987
+ for (let y = f; g(y, m); y += w) {
988
+ let b;
989
+ if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
990
+ else if (b = String(y), E) {
991
+ let z = p - b.length;
992
+ if (z > 0) {
993
+ let $ = new Array(z + 1).join("0");
994
+ y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
995
+ }
996
+ }
997
+ d.push(b);
998
+ }
999
+ } else {
1000
+ d = [];
1001
+ for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, !1));
1002
+ }
1003
+ for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
1004
+ let p = r + d[f] + o[m];
1005
+ (!e || l || p) && s.push(p);
1006
+ }
1007
+ }
1008
+ return s;
1009
+ }
1010
+ function Bt(n, t = {}) {
1011
+ return new I$1(n, t).streamSync();
1012
+ }
1013
+ function Qe$1(n, t = {}) {
1014
+ return new I$1(n, t).stream();
1015
+ }
1016
+ function ts$1(n, t = {}) {
1017
+ return new I$1(n, t).walkSync();
1018
+ }
1019
+ async function Je$1(n, t = {}) {
1020
+ return new I$1(n, t).walk();
1021
+ }
1022
+ function Ut(n, t = {}) {
1023
+ return new I$1(n, t).iterateSync();
1024
+ }
1025
+ function es(n, t = {}) {
1026
+ return new I$1(n, t).iterate();
1027
+ }
1028
+ var Gt, ce, ss, fe$1, ue$1, qt, de$1, pe$1, is, rs, ns, os$2, hs, as, ls, cs, fs$1, us, ds, at, Ss, lt, Es, we$1, ye$1, W, xs, be$1, vs, Ct, Cs, Ts, As, ks, Kt, Se$1, Ee$1, Q$1, tt, O$2, Rs, Os, Fs, Ds, Ms, Ns, _s, Ls, Ws, Ps, js, Is, zs, Bs, Us, $s, Gs, Hs, Ce$1, Te$1, Ae$1, xe$1, A$1, Vs, Ys, Xs, Js, N$1, Zs, ke$1, Qs, ti, ve$1, ei, D, si, Oe$1, Vt, Fe$1, At, Re$1, ii, q$1, De$1, Tt, ri, ft, Ne$1, oi, hi, ai, G, H$1, K$1, kt, ut, Rt, _e$1, Ot, Le$1, P, et, v$1, dt, st, C$1, F, T, Yt, Ft, k, x$1, Xt, Jt, We$1, Zt, B, Qt, Dt, pt, Y$1, M, mt, li, ci, fi, ui, Mt, te$1, di, pi, V, vi, wt, Ue$1, $e$1, Ri, Oi, L$1, Ge$1, He$1, U, qe$1, Ke$1, X$1, Ve$1, _$1, gt, se$1, je$1, yt, j, Nt, Lt, Ie$1, Fi, ie$1, ze$1, bt, Be, _t, Wt, ne$1, Ye$1, R$2, Pt, jt, It, it, rt, St, Xe$1, Di, Mi, Ni, nt, _i, ot, oe$1, he$1, ae$1, Et, Li, zt, xt, vt, Pi, I$1, le$1, ji, Ii, zi, Bi, Ui, Ze$1;
1029
+ var init_index_min = __esmMin((() => {
1030
+ Gt = (n, t, e) => {
1031
+ let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
1032
+ return r && {
1033
+ start: r[0],
1034
+ end: r[1],
1035
+ pre: e.slice(0, r[0]),
1036
+ body: e.slice(r[0] + s.length, r[1]),
1037
+ post: e.slice(r[1] + i.length)
1038
+ };
1039
+ };
1040
+ ce = (n, t) => {
1041
+ let e = t.match(n);
1042
+ return e ? e[0] : null;
1043
+ };
1044
+ ss = (n, t, e) => {
1045
+ let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
1046
+ if (a >= 0 && l > 0) {
1047
+ if (n === t) return [a, l];
1048
+ for (s = [], r = e.length; u >= 0 && !h;) {
1049
+ if (u === a) s.push(u), a = e.indexOf(n, u + 1);
1050
+ else if (s.length === 1) {
1051
+ let c = s.pop();
1052
+ c !== void 0 && (h = [c, l]);
1053
+ } else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
1054
+ u = a < l && a >= 0 ? a : l;
1055
+ }
1056
+ s.length && o !== void 0 && (h = [r, o]);
1057
+ }
1058
+ return h;
1059
+ };
1060
+ fe$1 = "\0SLASH" + Math.random() + "\0";
1061
+ ue$1 = "\0OPEN" + Math.random() + "\0";
1062
+ qt = "\0CLOSE" + Math.random() + "\0";
1063
+ de$1 = "\0COMMA" + Math.random() + "\0";
1064
+ pe$1 = "\0PERIOD" + Math.random() + "\0";
1065
+ is = new RegExp(fe$1, "g");
1066
+ rs = new RegExp(ue$1, "g");
1067
+ ns = new RegExp(qt, "g");
1068
+ os$2 = new RegExp(de$1, "g");
1069
+ hs = new RegExp(pe$1, "g");
1070
+ as = /\\\\/g;
1071
+ ls = /\\{/g;
1072
+ cs = /\\}/g;
1073
+ fs$1 = /\\,/g;
1074
+ us = /\\./g;
1075
+ ds = 1e5;
1076
+ at = (n) => {
672
1077
  if (typeof n != "string") throw new TypeError("invalid pattern");
673
1078
  if (n.length > 65536) throw new TypeError("pattern is too long");
674
1079
  };
@@ -2734,1492 +3139,1087 @@ while (this[Le$1](this[Ft]()) && this[C$1].length);
2734
3139
  let s = ie$1(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _$1;
2735
3140
  return r !== U && r !== X$1 && r !== L$1 && (i.#e |= yt), e.unshift(i), e.provisional++, i;
2736
3141
  }
2737
- #U(t, e) {
2738
- for (let s = e.provisional; s < e.length; s++) {
2739
- let i = e[s];
2740
- if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
2741
- }
2742
- }
2743
- #l(t, e, s, i) {
2744
- let r = e.name;
2745
- return e.#e = e.#e & gt | ie$1(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
2746
- }
2747
- async lstat() {
2748
- if ((this.#e & j) === 0) try {
2749
- return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
2750
- } catch (t) {
2751
- this.#F(t.code);
2752
- }
2753
- }
2754
- lstatSync() {
2755
- if ((this.#e & j) === 0) try {
2756
- return this.#$(this.#t.lstatSync(this.fullpath())), this;
2757
- } catch (t) {
2758
- this.#F(t.code);
2759
- }
2760
- }
2761
- #$(t) {
2762
- let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: u, gid: c, ino: d, mode: f, mtime: m, mtimeMs: p, nlink: w, rdev: g, size: S, uid: E } = t;
2763
- this.#b = e, this.#a = s, this.#m = i, this.#E = r, this.#c = o, this.#f = h, this.#R = a, this.#d = l, this.#s = u, this.#S = c, this.#h = d, this.#n = f, this.#p = m, this.#i = p, this.#r = w, this.#w = g, this.#u = S, this.#o = E;
2764
- let y = ie$1(t);
2765
- this.#e = this.#e & gt | y | je$1, y !== L$1 && y !== U && y !== X$1 && (this.#e |= yt);
2766
- }
2767
- #W = [];
2768
- #O = !1;
2769
- #H(t) {
2770
- this.#O = !1;
2771
- let e = this.#W.slice();
2772
- this.#W.length = 0, e.forEach((s) => s(null, t));
2773
- }
2774
- readdirCB(t, e = !1) {
2775
- if (!this.canReaddir()) {
2776
- e ? t(null, []) : queueMicrotask(() => t(null, []));
2777
- return;
2778
- }
2779
- let s = this.children();
2780
- if (this.calledReaddir()) {
2781
- let r = s.slice(0, s.provisional);
2782
- e ? t(null, r) : queueMicrotask(() => t(null, r));
2783
- return;
2784
- }
2785
- if (this.#W.push(t), this.#O) return;
2786
- this.#O = !0;
2787
- let i = this.fullpath();
2788
- this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
2789
- if (r) this.#I(r.code), s.provisional = 0;
2790
- else {
2791
- for (let h of o) this.#z(h, s);
2792
- this.#j(s);
2793
- }
2794
- this.#H(s.slice(0, s.provisional));
2795
- });
2796
- }
2797
- #q;
2798
- async readdir() {
2799
- if (!this.canReaddir()) return [];
2800
- let t = this.children();
2801
- if (this.calledReaddir()) return t.slice(0, t.provisional);
2802
- let e = this.fullpath();
2803
- if (this.#q) await this.#q;
2804
- else {
2805
- let s = () => {};
2806
- this.#q = new Promise((i) => s = i);
2807
- try {
2808
- for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#z(i, t);
2809
- this.#j(t);
2810
- } catch (i) {
2811
- this.#I(i.code), t.provisional = 0;
2812
- }
2813
- this.#q = void 0, s();
2814
- }
2815
- return t.slice(0, t.provisional);
2816
- }
2817
- readdirSync() {
2818
- if (!this.canReaddir()) return [];
2819
- let t = this.children();
2820
- if (this.calledReaddir()) return t.slice(0, t.provisional);
2821
- let e = this.fullpath();
2822
- try {
2823
- for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#z(s, t);
2824
- this.#j(t);
2825
- } catch (s) {
2826
- this.#I(s.code), t.provisional = 0;
2827
- }
2828
- return t.slice(0, t.provisional);
2829
- }
2830
- canReaddir() {
2831
- if (this.#e & Ie$1) return !1;
2832
- let t = _$1 & this.#e;
2833
- return t === L$1 || t === U || t === X$1;
2834
- }
2835
- shouldWalk(t, e) {
2836
- return (this.#e & U) === U && !(this.#e & Ie$1) && !t.has(this) && (!e || e(this));
2837
- }
2838
- async realpath() {
2839
- if (this.#k) return this.#k;
2840
- if (!((Lt | Nt | j) & this.#e)) try {
2841
- let t = await this.#t.promises.realpath(this.fullpath());
2842
- return this.#k = this.resolve(t);
2843
- } catch {
2844
- this.#P();
2845
- }
2846
- }
2847
- realpathSync() {
2848
- if (this.#k) return this.#k;
2849
- if (!((Lt | Nt | j) & this.#e)) try {
2850
- let t = this.#t.realpathSync(this.fullpath());
2851
- return this.#k = this.resolve(t);
2852
- } catch {
2853
- this.#P();
2854
- }
2855
- }
2856
- [Ye$1](t) {
2857
- if (t === this) return;
2858
- t.isCWD = !1, this.isCWD = !0;
2859
- let e = /* @__PURE__ */ new Set([]), s = [], i = this;
2860
- for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
2861
- for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
2862
- }
2863
- };
2864
- Pt = class n extends R$2 {
2865
- sep = "\\";
2866
- splitSep = Oi;
2867
- constructor(t, e = L$1, s, i, r, o, h) {
2868
- super(t, e, s, i, r, o, h);
2869
- }
2870
- newChild(t, e = L$1, s = {}) {
2871
- return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2872
- }
2873
- getRootString(t) {
2874
- return win32.parse(t).root;
2875
- }
2876
- getRoot(t) {
2877
- if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
2878
- for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
2879
- return this.roots[t] = new it(t, this).root;
2880
- }
2881
- sameRoot(t, e = this.root.name) {
2882
- return t = t.toUpperCase().replace(/\//g, "\\").replace($e$1, "$1\\"), t === e;
2883
- }
2884
- };
2885
- jt = class n extends R$2 {
2886
- splitSep = "/";
2887
- sep = "/";
2888
- constructor(t, e = L$1, s, i, r, o, h) {
2889
- super(t, e, s, i, r, o, h);
2890
- }
2891
- getRootString(t) {
2892
- return t.startsWith("/") ? "/" : "";
2893
- }
2894
- getRoot(t) {
2895
- return this.root;
2896
- }
2897
- newChild(t, e = L$1, s = {}) {
2898
- return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2899
- }
2900
- };
2901
- It = class {
2902
- root;
2903
- rootPath;
2904
- roots;
2905
- cwd;
2906
- #t;
2907
- #s;
2908
- #n;
2909
- nocase;
2910
- #r;
2911
- constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16384, fs: o = wt } = {}) {
2912
- this.#r = Ue$1(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
2913
- let h = e.resolve(t);
2914
- this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne$1(r);
2915
- let a = h.substring(this.rootPath.length).split(s);
2916
- if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
2917
- this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
2918
- let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = !1;
2919
- for (let m of a) {
2920
- let p = u--;
2921
- l = l.child(m, {
2922
- relative: new Array(p).fill("..").join(c),
2923
- relativePosix: new Array(p).fill("..").join("/"),
2924
- fullpath: d += (f ? "" : c) + m
2925
- }), f = !0;
2926
- }
2927
- this.cwd = l;
2928
- }
2929
- depth(t = this.cwd) {
2930
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
2931
- }
2932
- childrenCache() {
2933
- return this.#n;
2934
- }
2935
- resolve(...t) {
2936
- let e = "";
2937
- for (let r = t.length - 1; r >= 0; r--) {
2938
- let o = t[r];
2939
- if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2940
- }
2941
- let s = this.#t.get(e);
2942
- if (s !== void 0) return s;
2943
- let i = this.cwd.resolve(e).fullpath();
2944
- return this.#t.set(e, i), i;
2945
- }
2946
- resolvePosix(...t) {
2947
- let e = "";
2948
- for (let r = t.length - 1; r >= 0; r--) {
2949
- let o = t[r];
2950
- if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2951
- }
2952
- let s = this.#s.get(e);
2953
- if (s !== void 0) return s;
2954
- let i = this.cwd.resolve(e).fullpathPosix();
2955
- return this.#s.set(e, i), i;
2956
- }
2957
- relative(t = this.cwd) {
2958
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
2959
- }
2960
- relativePosix(t = this.cwd) {
2961
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
2962
- }
2963
- basename(t = this.cwd) {
2964
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
2965
- }
2966
- dirname(t = this.cwd) {
2967
- return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
2968
- }
2969
- async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
2970
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
2971
- let { withFileTypes: s } = e;
2972
- if (t.canReaddir()) {
2973
- let i = await t.readdir();
2974
- return s ? i : i.map((r) => r.name);
2975
- } else return [];
2976
- }
2977
- readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
2978
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
2979
- let { withFileTypes: s = !0 } = e;
2980
- return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
2981
- }
2982
- async lstat(t = this.cwd) {
2983
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
3142
+ #U(t, e) {
3143
+ for (let s = e.provisional; s < e.length; s++) {
3144
+ let i = e[s];
3145
+ if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
3146
+ }
2984
3147
  }
2985
- lstatSync(t = this.cwd) {
2986
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
3148
+ #l(t, e, s, i) {
3149
+ let r = e.name;
3150
+ return e.#e = e.#e & gt | ie$1(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
2987
3151
  }
2988
- async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2989
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t.withFileTypes, t = this.cwd);
2990
- let s = await t.readlink();
2991
- return e ? s : s?.fullpath();
3152
+ async lstat() {
3153
+ if ((this.#e & j) === 0) try {
3154
+ return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
3155
+ } catch (t) {
3156
+ this.#F(t.code);
3157
+ }
2992
3158
  }
2993
- readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2994
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t.withFileTypes, t = this.cwd);
2995
- let s = t.readlinkSync();
2996
- return e ? s : s?.fullpath();
3159
+ lstatSync() {
3160
+ if ((this.#e & j) === 0) try {
3161
+ return this.#$(this.#t.lstatSync(this.fullpath())), this;
3162
+ } catch (t) {
3163
+ this.#F(t.code);
3164
+ }
2997
3165
  }
2998
- async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2999
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t.withFileTypes, t = this.cwd);
3000
- let s = await t.realpath();
3001
- return e ? s : s?.fullpath();
3166
+ #$(t) {
3167
+ let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: u, gid: c, ino: d, mode: f, mtime: m, mtimeMs: p, nlink: w, rdev: g, size: S, uid: E } = t;
3168
+ this.#b = e, this.#a = s, this.#m = i, this.#E = r, this.#c = o, this.#f = h, this.#R = a, this.#d = l, this.#s = u, this.#S = c, this.#h = d, this.#n = f, this.#p = m, this.#i = p, this.#r = w, this.#w = g, this.#u = S, this.#o = E;
3169
+ let y = ie$1(t);
3170
+ this.#e = this.#e & gt | y | je$1, y !== L$1 && y !== U && y !== X$1 && (this.#e |= yt);
3002
3171
  }
3003
- realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3004
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t.withFileTypes, t = this.cwd);
3005
- let s = t.realpathSync();
3006
- return e ? s : s?.fullpath();
3172
+ #W = [];
3173
+ #O = !1;
3174
+ #H(t) {
3175
+ this.#O = !1;
3176
+ let e = this.#W.slice();
3177
+ this.#W.length = 0, e.forEach((s) => s(null, t));
3007
3178
  }
3008
- async walk(t = this.cwd, e = {}) {
3009
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3010
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3011
- (!r || r(t)) && h.push(s ? t : t.fullpath());
3012
- let a = /* @__PURE__ */ new Set(), l = (c, d) => {
3013
- a.add(c), c.readdirCB((f, m) => {
3014
- if (f) return d(f);
3015
- let p = m.length;
3016
- if (!p) return d();
3017
- let w = () => {
3018
- --p === 0 && d();
3019
- };
3020
- for (let g of m) (!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((S) => S?.isUnknown() ? S.lstat() : S).then((S) => S?.shouldWalk(a, o) ? l(S, w) : w()) : g.shouldWalk(a, o) ? l(g, w) : w();
3021
- }, !0);
3022
- }, u = t;
3023
- return new Promise((c, d) => {
3024
- l(u, (f) => {
3025
- if (f) return d(f);
3026
- c(h);
3027
- });
3179
+ readdirCB(t, e = !1) {
3180
+ if (!this.canReaddir()) {
3181
+ e ? t(null, []) : queueMicrotask(() => t(null, []));
3182
+ return;
3183
+ }
3184
+ let s = this.children();
3185
+ if (this.calledReaddir()) {
3186
+ let r = s.slice(0, s.provisional);
3187
+ e ? t(null, r) : queueMicrotask(() => t(null, r));
3188
+ return;
3189
+ }
3190
+ if (this.#W.push(t), this.#O) return;
3191
+ this.#O = !0;
3192
+ let i = this.fullpath();
3193
+ this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
3194
+ if (r) this.#I(r.code), s.provisional = 0;
3195
+ else {
3196
+ for (let h of o) this.#z(h, s);
3197
+ this.#j(s);
3198
+ }
3199
+ this.#H(s.slice(0, s.provisional));
3028
3200
  });
3029
3201
  }
3030
- walkSync(t = this.cwd, e = {}) {
3031
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3032
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3033
- (!r || r(t)) && h.push(s ? t : t.fullpath());
3034
- let a = /* @__PURE__ */ new Set([t]);
3035
- for (let l of a) {
3036
- let u = l.readdirSync();
3037
- for (let c of u) {
3038
- (!r || r(c)) && h.push(s ? c : c.fullpath());
3039
- let d = c;
3040
- if (c.isSymbolicLink()) {
3041
- if (!(i && (d = c.realpathSync()))) continue;
3042
- d.isUnknown() && d.lstatSync();
3043
- }
3044
- d.shouldWalk(a, o) && a.add(d);
3202
+ #q;
3203
+ async readdir() {
3204
+ if (!this.canReaddir()) return [];
3205
+ let t = this.children();
3206
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
3207
+ let e = this.fullpath();
3208
+ if (this.#q) await this.#q;
3209
+ else {
3210
+ let s = () => {};
3211
+ this.#q = new Promise((i) => s = i);
3212
+ try {
3213
+ for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#z(i, t);
3214
+ this.#j(t);
3215
+ } catch (i) {
3216
+ this.#I(i.code), t.provisional = 0;
3045
3217
  }
3218
+ this.#q = void 0, s();
3046
3219
  }
3047
- return h;
3220
+ return t.slice(0, t.provisional);
3048
3221
  }
3049
- [Symbol.asyncIterator]() {
3050
- return this.iterate();
3222
+ readdirSync() {
3223
+ if (!this.canReaddir()) return [];
3224
+ let t = this.children();
3225
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
3226
+ let e = this.fullpath();
3227
+ try {
3228
+ for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#z(s, t);
3229
+ this.#j(t);
3230
+ } catch (s) {
3231
+ this.#I(s.code), t.provisional = 0;
3232
+ }
3233
+ return t.slice(0, t.provisional);
3051
3234
  }
3052
- iterate(t = this.cwd, e = {}) {
3053
- return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
3235
+ canReaddir() {
3236
+ if (this.#e & Ie$1) return !1;
3237
+ let t = _$1 & this.#e;
3238
+ return t === L$1 || t === U || t === X$1;
3054
3239
  }
3055
- [Symbol.iterator]() {
3056
- return this.iterateSync();
3240
+ shouldWalk(t, e) {
3241
+ return (this.#e & U) === U && !(this.#e & Ie$1) && !t.has(this) && (!e || e(this));
3057
3242
  }
3058
- *iterateSync(t = this.cwd, e = {}) {
3059
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3060
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
3061
- (!r || r(t)) && (yield s ? t : t.fullpath());
3062
- let h = /* @__PURE__ */ new Set([t]);
3063
- for (let a of h) {
3064
- let l = a.readdirSync();
3065
- for (let u of l) {
3066
- (!r || r(u)) && (yield s ? u : u.fullpath());
3067
- let c = u;
3068
- if (u.isSymbolicLink()) {
3069
- if (!(i && (c = u.realpathSync()))) continue;
3070
- c.isUnknown() && c.lstatSync();
3071
- }
3072
- c.shouldWalk(h, o) && h.add(c);
3073
- }
3243
+ async realpath() {
3244
+ if (this.#k) return this.#k;
3245
+ if (!((Lt | Nt | j) & this.#e)) try {
3246
+ let t = await this.#t.promises.realpath(this.fullpath());
3247
+ return this.#k = this.resolve(t);
3248
+ } catch {
3249
+ this.#P();
3074
3250
  }
3075
3251
  }
3076
- stream(t = this.cwd, e = {}) {
3077
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3078
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
3079
- (!r || r(t)) && h.write(s ? t : t.fullpath());
3080
- let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
3081
- let d = !1;
3082
- for (; !d;) {
3083
- let f = l.shift();
3084
- if (!f) {
3085
- u === 0 && h.end();
3086
- return;
3087
- }
3088
- u++, a.add(f);
3089
- let m = (w, g, S = !1) => {
3090
- if (w) return h.emit("error", w);
3091
- if (i && !S) {
3092
- let E = [];
3093
- for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
3094
- if (E.length) {
3095
- Promise.all(E).then(() => m(null, g, !0));
3096
- return;
3097
- }
3098
- }
3099
- for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = !0));
3100
- u--;
3101
- for (let E of g) {
3102
- let y = E.realpathCached() || E;
3103
- y.shouldWalk(a, o) && l.push(y);
3104
- }
3105
- d && !h.flowing ? h.once("drain", c) : p || c();
3106
- }, p = !0;
3107
- f.readdirCB(m, !0), p = !1;
3108
- }
3109
- };
3110
- return c(), h;
3252
+ realpathSync() {
3253
+ if (this.#k) return this.#k;
3254
+ if (!((Lt | Nt | j) & this.#e)) try {
3255
+ let t = this.#t.realpathSync(this.fullpath());
3256
+ return this.#k = this.resolve(t);
3257
+ } catch {
3258
+ this.#P();
3259
+ }
3111
3260
  }
3112
- streamSync(t = this.cwd, e = {}) {
3113
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3114
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
3115
- (!r || r(t)) && h.write(s ? t : t.fullpath());
3116
- let l = [t], u = 0, c = () => {
3117
- let d = !1;
3118
- for (; !d;) {
3119
- let f = l.shift();
3120
- if (!f) {
3121
- u === 0 && h.end();
3122
- return;
3123
- }
3124
- u++, a.add(f);
3125
- let m = f.readdirSync();
3126
- for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = !0));
3127
- u--;
3128
- for (let p of m) {
3129
- let w = p;
3130
- if (p.isSymbolicLink()) {
3131
- if (!(i && (w = p.realpathSync()))) continue;
3132
- w.isUnknown() && w.lstatSync();
3133
- }
3134
- w.shouldWalk(a, o) && l.push(w);
3135
- }
3136
- }
3137
- d && !h.flowing && h.once("drain", c);
3138
- };
3139
- return c(), h;
3261
+ [Ye$1](t) {
3262
+ if (t === this) return;
3263
+ t.isCWD = !1, this.isCWD = !0;
3264
+ let e = /* @__PURE__ */ new Set([]), s = [], i = this;
3265
+ for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
3266
+ for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
3140
3267
  }
3141
- chdir(t = this.cwd) {
3142
- let e = this.cwd;
3143
- this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye$1](e);
3268
+ };
3269
+ Pt = class n extends R$2 {
3270
+ sep = "\\";
3271
+ splitSep = Oi;
3272
+ constructor(t, e = L$1, s, i, r, o, h) {
3273
+ super(t, e, s, i, r, o, h);
3144
3274
  }
3145
- };
3146
- it = class extends It {
3147
- sep = "\\";
3148
- constructor(t = process.cwd(), e = {}) {
3149
- let { nocase: s = !0 } = e;
3150
- super(t, win32, "\\", {
3151
- ...e,
3152
- nocase: s
3153
- }), this.nocase = s;
3154
- for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
3275
+ newChild(t, e = L$1, s = {}) {
3276
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
3155
3277
  }
3156
- parseRootPath(t) {
3157
- return win32.parse(t).root.toUpperCase();
3278
+ getRootString(t) {
3279
+ return win32.parse(t).root;
3158
3280
  }
3159
- newRoot(t) {
3160
- return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3281
+ getRoot(t) {
3282
+ if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
3283
+ for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
3284
+ return this.roots[t] = new it(t, this).root;
3161
3285
  }
3162
- isAbsolute(t) {
3163
- return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
3286
+ sameRoot(t, e = this.root.name) {
3287
+ return t = t.toUpperCase().replace(/\//g, "\\").replace($e$1, "$1\\"), t === e;
3164
3288
  }
3165
3289
  };
3166
- rt = class extends It {
3290
+ jt = class n extends R$2 {
3291
+ splitSep = "/";
3167
3292
  sep = "/";
3168
- constructor(t = process.cwd(), e = {}) {
3169
- let { nocase: s = !1 } = e;
3170
- super(t, posix, "/", {
3171
- ...e,
3172
- nocase: s
3173
- }), this.nocase = s;
3174
- }
3175
- parseRootPath(t) {
3176
- return "/";
3293
+ constructor(t, e = L$1, s, i, r, o, h) {
3294
+ super(t, e, s, i, r, o, h);
3177
3295
  }
3178
- newRoot(t) {
3179
- return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3296
+ getRootString(t) {
3297
+ return t.startsWith("/") ? "/" : "";
3180
3298
  }
3181
- isAbsolute(t) {
3182
- return t.startsWith("/");
3299
+ getRoot(t) {
3300
+ return this.root;
3183
3301
  }
3184
- };
3185
- St = class extends rt {
3186
- constructor(t = process.cwd(), e = {}) {
3187
- let { nocase: s = !0 } = e;
3188
- super(t, {
3189
- ...e,
3190
- nocase: s
3191
- });
3302
+ newChild(t, e = L$1, s = {}) {
3303
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
3192
3304
  }
3193
3305
  };
3194
- process.platform;
3195
- Xe$1 = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
3196
- Di = (n) => n.length >= 1;
3197
- Mi = (n) => n.length >= 1;
3198
- Ni = Symbol.for("nodejs.util.inspect.custom");
3199
- nt = class n {
3306
+ It = class {
3307
+ root;
3308
+ rootPath;
3309
+ roots;
3310
+ cwd;
3200
3311
  #t;
3201
3312
  #s;
3202
3313
  #n;
3203
- length;
3314
+ nocase;
3204
3315
  #r;
3205
- #o;
3206
- #S;
3207
- #w;
3208
- #c;
3209
- #h;
3210
- #u = !0;
3211
- constructor(t, e, s, i) {
3212
- if (!Di(t)) throw new TypeError("empty pattern list");
3213
- if (!Mi(e)) throw new TypeError("empty glob list");
3214
- if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
3215
- if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
3216
- if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
3217
- if (this.isUNC()) {
3218
- let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
3219
- l[0] === "" && (l.shift(), m.shift());
3220
- let p = [
3221
- r,
3222
- o,
3223
- h,
3224
- a,
3225
- ""
3226
- ].join("/"), w = [
3227
- u,
3228
- c,
3229
- d,
3230
- f,
3231
- ""
3232
- ].join("/");
3233
- this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
3234
- } else if (this.isDrive() || this.isAbsolute()) {
3235
- let [r, ...o] = this.#t, [h, ...a] = this.#s;
3236
- o[0] === "" && (o.shift(), a.shift());
3237
- let l = r + "/", u = h + "/";
3238
- this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
3239
- }
3316
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16384, fs: o = wt } = {}) {
3317
+ this.#r = Ue$1(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
3318
+ let h = e.resolve(t);
3319
+ this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne$1(r);
3320
+ let a = h.substring(this.rootPath.length).split(s);
3321
+ if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
3322
+ this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
3323
+ let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = !1;
3324
+ for (let m of a) {
3325
+ let p = u--;
3326
+ l = l.child(m, {
3327
+ relative: new Array(p).fill("..").join(c),
3328
+ relativePosix: new Array(p).fill("..").join("/"),
3329
+ fullpath: d += (f ? "" : c) + m
3330
+ }), f = !0;
3240
3331
  }
3332
+ this.cwd = l;
3241
3333
  }
3242
- [Ni]() {
3243
- return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
3244
- }
3245
- pattern() {
3246
- return this.#t[this.#n];
3247
- }
3248
- isString() {
3249
- return typeof this.#t[this.#n] == "string";
3250
- }
3251
- isGlobstar() {
3252
- return this.#t[this.#n] === A$1;
3253
- }
3254
- isRegExp() {
3255
- return this.#t[this.#n] instanceof RegExp;
3256
- }
3257
- globString() {
3258
- return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/"));
3259
- }
3260
- hasMore() {
3261
- return this.length > this.#n + 1;
3262
- }
3263
- rest() {
3264
- return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
3265
- }
3266
- isUNC() {
3267
- let t = this.#t;
3268
- return this.#c !== void 0 ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3];
3269
- }
3270
- isDrive() {
3271
- let t = this.#t;
3272
- return this.#w !== void 0 ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
3334
+ depth(t = this.cwd) {
3335
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
3273
3336
  }
3274
- isAbsolute() {
3275
- let t = this.#t;
3276
- return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
3337
+ childrenCache() {
3338
+ return this.#n;
3277
3339
  }
3278
- root() {
3279
- let t = this.#t[0];
3280
- return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
3340
+ resolve(...t) {
3341
+ let e = "";
3342
+ for (let r = t.length - 1; r >= 0; r--) {
3343
+ let o = t[r];
3344
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
3345
+ }
3346
+ let s = this.#t.get(e);
3347
+ if (s !== void 0) return s;
3348
+ let i = this.cwd.resolve(e).fullpath();
3349
+ return this.#t.set(e, i), i;
3281
3350
  }
3282
- checkFollowGlobstar() {
3283
- return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
3351
+ resolvePosix(...t) {
3352
+ let e = "";
3353
+ for (let r = t.length - 1; r >= 0; r--) {
3354
+ let o = t[r];
3355
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
3356
+ }
3357
+ let s = this.#s.get(e);
3358
+ if (s !== void 0) return s;
3359
+ let i = this.cwd.resolve(e).fullpathPosix();
3360
+ return this.#s.set(e, i), i;
3284
3361
  }
3285
- markFollowGlobstar() {
3286
- return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
3362
+ relative(t = this.cwd) {
3363
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
3287
3364
  }
3288
- };
3289
- _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3290
- ot = class {
3291
- relative;
3292
- relativeChildren;
3293
- absolute;
3294
- absoluteChildren;
3295
- platform;
3296
- mmopts;
3297
- constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
3298
- this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
3299
- dot: !0,
3300
- nobrace: e,
3301
- nocase: s,
3302
- noext: i,
3303
- noglobstar: r,
3304
- optimizationLevel: 2,
3305
- platform: o,
3306
- nocomment: !0,
3307
- nonegate: !0
3308
- };
3309
- for (let h of t) this.add(h);
3365
+ relativePosix(t = this.cwd) {
3366
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
3310
3367
  }
3311
- add(t) {
3312
- let e = new D(t, this.mmopts);
3313
- for (let s = 0; s < e.set.length; s++) {
3314
- let i = e.set[s], r = e.globParts[s];
3315
- if (!i || !r) throw new Error("invalid pattern object");
3316
- for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
3317
- let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
3318
- l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
3319
- }
3368
+ basename(t = this.cwd) {
3369
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
3320
3370
  }
3321
- ignored(t) {
3322
- let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
3323
- for (let o of this.relative) if (o.match(i) || o.match(r)) return !0;
3324
- for (let o of this.absolute) if (o.match(e) || o.match(s)) return !0;
3325
- return !1;
3371
+ dirname(t = this.cwd) {
3372
+ return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
3326
3373
  }
3327
- childrenIgnored(t) {
3328
- let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
3329
- for (let i of this.relativeChildren) if (i.match(s)) return !0;
3330
- for (let i of this.absoluteChildren) if (i.match(e)) return !0;
3331
- return !1;
3374
+ async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
3375
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3376
+ let { withFileTypes: s } = e;
3377
+ if (t.canReaddir()) {
3378
+ let i = await t.readdir();
3379
+ return s ? i : i.map((r) => r.name);
3380
+ } else return [];
3332
3381
  }
3333
- };
3334
- oe$1 = class n {
3335
- store;
3336
- constructor(t = /* @__PURE__ */ new Map()) {
3337
- this.store = t;
3382
+ readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
3383
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3384
+ let { withFileTypes: s = !0 } = e;
3385
+ return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
3338
3386
  }
3339
- copy() {
3340
- return new n(new Map(this.store));
3387
+ async lstat(t = this.cwd) {
3388
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
3341
3389
  }
3342
- hasWalked(t, e) {
3343
- return this.store.get(t.fullpath())?.has(e.globString());
3390
+ lstatSync(t = this.cwd) {
3391
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
3344
3392
  }
3345
- storeWalked(t, e) {
3346
- let s = t.fullpath(), i = this.store.get(s);
3347
- i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
3393
+ async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3394
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t.withFileTypes, t = this.cwd);
3395
+ let s = await t.readlink();
3396
+ return e ? s : s?.fullpath();
3348
3397
  }
3349
- };
3350
- he$1 = class {
3351
- store = /* @__PURE__ */ new Map();
3352
- add(t, e, s) {
3353
- let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
3354
- this.store.set(t, r === void 0 ? i : i & r);
3398
+ readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3399
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t.withFileTypes, t = this.cwd);
3400
+ let s = t.readlinkSync();
3401
+ return e ? s : s?.fullpath();
3355
3402
  }
3356
- entries() {
3357
- return [...this.store.entries()].map(([t, e]) => [
3358
- t,
3359
- !!(e & 2),
3360
- !!(e & 1)
3361
- ]);
3403
+ async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3404
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t.withFileTypes, t = this.cwd);
3405
+ let s = await t.realpath();
3406
+ return e ? s : s?.fullpath();
3362
3407
  }
3363
- };
3364
- ae$1 = class {
3365
- store = /* @__PURE__ */ new Map();
3366
- add(t, e) {
3367
- if (!t.canReaddir()) return;
3368
- let s = this.store.get(t);
3369
- s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
3408
+ realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3409
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t.withFileTypes, t = this.cwd);
3410
+ let s = t.realpathSync();
3411
+ return e ? s : s?.fullpath();
3370
3412
  }
3371
- get(t) {
3372
- let e = this.store.get(t);
3373
- if (!e) throw new Error("attempting to walk unknown path");
3374
- return e;
3413
+ async walk(t = this.cwd, e = {}) {
3414
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3415
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3416
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
3417
+ let a = /* @__PURE__ */ new Set(), l = (c, d) => {
3418
+ a.add(c), c.readdirCB((f, m) => {
3419
+ if (f) return d(f);
3420
+ let p = m.length;
3421
+ if (!p) return d();
3422
+ let w = () => {
3423
+ --p === 0 && d();
3424
+ };
3425
+ for (let g of m) (!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((S) => S?.isUnknown() ? S.lstat() : S).then((S) => S?.shouldWalk(a, o) ? l(S, w) : w()) : g.shouldWalk(a, o) ? l(g, w) : w();
3426
+ }, !0);
3427
+ }, u = t;
3428
+ return new Promise((c, d) => {
3429
+ l(u, (f) => {
3430
+ if (f) return d(f);
3431
+ c(h);
3432
+ });
3433
+ });
3375
3434
  }
3376
- entries() {
3377
- return this.keys().map((t) => [t, this.store.get(t)]);
3435
+ walkSync(t = this.cwd, e = {}) {
3436
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3437
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3438
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
3439
+ let a = /* @__PURE__ */ new Set([t]);
3440
+ for (let l of a) {
3441
+ let u = l.readdirSync();
3442
+ for (let c of u) {
3443
+ (!r || r(c)) && h.push(s ? c : c.fullpath());
3444
+ let d = c;
3445
+ if (c.isSymbolicLink()) {
3446
+ if (!(i && (d = c.realpathSync()))) continue;
3447
+ d.isUnknown() && d.lstatSync();
3448
+ }
3449
+ d.shouldWalk(a, o) && a.add(d);
3450
+ }
3451
+ }
3452
+ return h;
3378
3453
  }
3379
- keys() {
3380
- return [...this.store.keys()].filter((t) => t.canReaddir());
3454
+ [Symbol.asyncIterator]() {
3455
+ return this.iterate();
3381
3456
  }
3382
- };
3383
- Et = class n {
3384
- hasWalkedCache;
3385
- matches = new he$1();
3386
- subwalks = new ae$1();
3387
- patterns;
3388
- follow;
3389
- dot;
3390
- opts;
3391
- constructor(t, e) {
3392
- this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe$1();
3457
+ iterate(t = this.cwd, e = {}) {
3458
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
3393
3459
  }
3394
- processPatterns(t, e) {
3395
- this.patterns = e;
3396
- let s = e.map((i) => [t, i]);
3397
- for (let [i, r] of s) {
3398
- this.hasWalkedCache.storeWalked(i, r);
3399
- let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
3400
- if (o) {
3401
- i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
3402
- let c = r.rest();
3403
- if (c) r = c;
3404
- else {
3405
- this.matches.add(i, !0, !1);
3406
- continue;
3460
+ [Symbol.iterator]() {
3461
+ return this.iterateSync();
3462
+ }
3463
+ *iterateSync(t = this.cwd, e = {}) {
3464
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3465
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
3466
+ (!r || r(t)) && (yield s ? t : t.fullpath());
3467
+ let h = /* @__PURE__ */ new Set([t]);
3468
+ for (let a of h) {
3469
+ let l = a.readdirSync();
3470
+ for (let u of l) {
3471
+ (!r || r(u)) && (yield s ? u : u.fullpath());
3472
+ let c = u;
3473
+ if (u.isSymbolicLink()) {
3474
+ if (!(i && (c = u.realpathSync()))) continue;
3475
+ c.isUnknown() && c.lstatSync();
3407
3476
  }
3477
+ c.shouldWalk(h, o) && h.add(c);
3408
3478
  }
3409
- if (i.isENOENT()) continue;
3410
- let a, l, u = !1;
3411
- for (; typeof (a = r.pattern()) == "string" && (l = r.rest());) i = i.resolve(a), r = l, u = !0;
3412
- if (a = r.pattern(), l = r.rest(), u) {
3413
- if (this.hasWalkedCache.hasWalked(i, r)) continue;
3414
- this.hasWalkedCache.storeWalked(i, r);
3479
+ }
3480
+ }
3481
+ stream(t = this.cwd, e = {}) {
3482
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3483
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
3484
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
3485
+ let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
3486
+ let d = !1;
3487
+ for (; !d;) {
3488
+ let f = l.shift();
3489
+ if (!f) {
3490
+ u === 0 && h.end();
3491
+ return;
3492
+ }
3493
+ u++, a.add(f);
3494
+ let m = (w, g, S = !1) => {
3495
+ if (w) return h.emit("error", w);
3496
+ if (i && !S) {
3497
+ let E = [];
3498
+ for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
3499
+ if (E.length) {
3500
+ Promise.all(E).then(() => m(null, g, !0));
3501
+ return;
3502
+ }
3503
+ }
3504
+ for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = !0));
3505
+ u--;
3506
+ for (let E of g) {
3507
+ let y = E.realpathCached() || E;
3508
+ y.shouldWalk(a, o) && l.push(y);
3509
+ }
3510
+ d && !h.flowing ? h.once("drain", c) : p || c();
3511
+ }, p = !0;
3512
+ f.readdirCB(m, !0), p = !1;
3415
3513
  }
3416
- if (typeof a == "string") {
3417
- let c = a === ".." || a === "" || a === ".";
3418
- this.matches.add(i.resolve(a), h, c);
3419
- continue;
3420
- } else if (a === A$1) {
3421
- (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
3422
- let c = l?.pattern(), d = l?.rest();
3423
- if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
3424
- else if (c === "..") {
3425
- let f = i.parent || i;
3426
- d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, !0);
3514
+ };
3515
+ return c(), h;
3516
+ }
3517
+ streamSync(t = this.cwd, e = {}) {
3518
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$2 || (e = t, t = this.cwd);
3519
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
3520
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
3521
+ let l = [t], u = 0, c = () => {
3522
+ let d = !1;
3523
+ for (; !d;) {
3524
+ let f = l.shift();
3525
+ if (!f) {
3526
+ u === 0 && h.end();
3527
+ return;
3427
3528
  }
3428
- } else a instanceof RegExp && this.subwalks.add(i, r);
3429
- }
3430
- return this;
3529
+ u++, a.add(f);
3530
+ let m = f.readdirSync();
3531
+ for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = !0));
3532
+ u--;
3533
+ for (let p of m) {
3534
+ let w = p;
3535
+ if (p.isSymbolicLink()) {
3536
+ if (!(i && (w = p.realpathSync()))) continue;
3537
+ w.isUnknown() && w.lstatSync();
3538
+ }
3539
+ w.shouldWalk(a, o) && l.push(w);
3540
+ }
3541
+ }
3542
+ d && !h.flowing && h.once("drain", c);
3543
+ };
3544
+ return c(), h;
3431
3545
  }
3432
- subwalkTargets() {
3433
- return this.subwalks.keys();
3546
+ chdir(t = this.cwd) {
3547
+ let e = this.cwd;
3548
+ this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye$1](e);
3434
3549
  }
3435
- child() {
3436
- return new n(this.opts, this.hasWalkedCache);
3550
+ };
3551
+ it = class extends It {
3552
+ sep = "\\";
3553
+ constructor(t = process.cwd(), e = {}) {
3554
+ let { nocase: s = !0 } = e;
3555
+ super(t, win32, "\\", {
3556
+ ...e,
3557
+ nocase: s
3558
+ }), this.nocase = s;
3559
+ for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
3437
3560
  }
3438
- filterEntries(t, e) {
3439
- let s = this.subwalks.get(t), i = this.child();
3440
- for (let r of e) for (let o of s) {
3441
- let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
3442
- a === A$1 ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
3443
- }
3444
- return i;
3561
+ parseRootPath(t) {
3562
+ return win32.parse(t).root.toUpperCase();
3563
+ }
3564
+ newRoot(t) {
3565
+ return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3566
+ }
3567
+ isAbsolute(t) {
3568
+ return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
3569
+ }
3570
+ };
3571
+ rt = class extends It {
3572
+ sep = "/";
3573
+ constructor(t = process.cwd(), e = {}) {
3574
+ let { nocase: s = !1 } = e;
3575
+ super(t, posix, "/", {
3576
+ ...e,
3577
+ nocase: s
3578
+ }), this.nocase = s;
3445
3579
  }
3446
- testGlobstar(t, e, s, i) {
3447
- if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, !1), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
3448
- let r = s.pattern();
3449
- if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
3450
- else if (r === "..") {
3451
- let o = t.parent || t;
3452
- this.subwalks.add(o, s);
3453
- } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
3454
- }
3580
+ parseRootPath(t) {
3581
+ return "/";
3455
3582
  }
3456
- testRegExp(t, e, s, i) {
3457
- e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3583
+ newRoot(t) {
3584
+ return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3458
3585
  }
3459
- testString(t, e, s, i) {
3460
- t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3586
+ isAbsolute(t) {
3587
+ return t.startsWith("/");
3461
3588
  }
3462
3589
  };
3463
- Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n;
3464
- zt = class {
3465
- path;
3466
- patterns;
3467
- opts;
3468
- seen = /* @__PURE__ */ new Set();
3469
- paused = !1;
3470
- aborted = !1;
3471
- #t = [];
3590
+ St = class extends rt {
3591
+ constructor(t = process.cwd(), e = {}) {
3592
+ let { nocase: s = !0 } = e;
3593
+ super(t, {
3594
+ ...e,
3595
+ nocase: s
3596
+ });
3597
+ }
3598
+ };
3599
+ process.platform;
3600
+ Xe$1 = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
3601
+ Di = (n) => n.length >= 1;
3602
+ Mi = (n) => n.length >= 1;
3603
+ Ni = Symbol.for("nodejs.util.inspect.custom");
3604
+ nt = class n {
3605
+ #t;
3472
3606
  #s;
3473
3607
  #n;
3474
- signal;
3475
- maxDepth;
3476
- includeChildMatches;
3477
- constructor(t, e, s) {
3478
- if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) throw new Error("cannot ignore child matches, ignore lacks add() method.");
3479
- this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
3480
- this.#t.length = 0;
3481
- }));
3482
- }
3483
- #r(t) {
3484
- return this.seen.has(t) || !!this.#s?.ignored?.(t);
3608
+ length;
3609
+ #r;
3610
+ #o;
3611
+ #S;
3612
+ #w;
3613
+ #c;
3614
+ #h;
3615
+ #u = !0;
3616
+ constructor(t, e, s, i) {
3617
+ if (!Di(t)) throw new TypeError("empty pattern list");
3618
+ if (!Mi(e)) throw new TypeError("empty glob list");
3619
+ if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
3620
+ if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
3621
+ if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
3622
+ if (this.isUNC()) {
3623
+ let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
3624
+ l[0] === "" && (l.shift(), m.shift());
3625
+ let p = [
3626
+ r,
3627
+ o,
3628
+ h,
3629
+ a,
3630
+ ""
3631
+ ].join("/"), w = [
3632
+ u,
3633
+ c,
3634
+ d,
3635
+ f,
3636
+ ""
3637
+ ].join("/");
3638
+ this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
3639
+ } else if (this.isDrive() || this.isAbsolute()) {
3640
+ let [r, ...o] = this.#t, [h, ...a] = this.#s;
3641
+ o[0] === "" && (o.shift(), a.shift());
3642
+ let l = r + "/", u = h + "/";
3643
+ this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
3644
+ }
3645
+ }
3485
3646
  }
3486
- #o(t) {
3487
- return !!this.#s?.childrenIgnored?.(t);
3647
+ [Ni]() {
3648
+ return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
3488
3649
  }
3489
- pause() {
3490
- this.paused = !0;
3650
+ pattern() {
3651
+ return this.#t[this.#n];
3491
3652
  }
3492
- resume() {
3493
- if (this.signal?.aborted) return;
3494
- this.paused = !1;
3495
- let t;
3496
- for (; !this.paused && (t = this.#t.shift());) t();
3653
+ isString() {
3654
+ return typeof this.#t[this.#n] == "string";
3497
3655
  }
3498
- onResume(t) {
3499
- this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
3656
+ isGlobstar() {
3657
+ return this.#t[this.#n] === A$1;
3500
3658
  }
3501
- async matchCheck(t, e) {
3502
- if (e && this.opts.nodir) return;
3503
- let s;
3504
- if (this.opts.realpath) {
3505
- if (s = t.realpathCached() || await t.realpath(), !s) return;
3506
- t = s;
3507
- }
3508
- let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
3509
- if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3510
- let o = await r.realpath();
3511
- o && (o.isUnknown() || this.opts.stat) && await o.lstat();
3512
- }
3513
- return this.matchCheckTest(r, e);
3659
+ isRegExp() {
3660
+ return this.#t[this.#n] instanceof RegExp;
3514
3661
  }
3515
- matchCheckTest(t, e) {
3516
- return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
3662
+ globString() {
3663
+ return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/"));
3517
3664
  }
3518
- matchCheckSync(t, e) {
3519
- if (e && this.opts.nodir) return;
3520
- let s;
3521
- if (this.opts.realpath) {
3522
- if (s = t.realpathCached() || t.realpathSync(), !s) return;
3523
- t = s;
3524
- }
3525
- let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
3526
- if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3527
- let o = r.realpathSync();
3528
- o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
3529
- }
3530
- return this.matchCheckTest(r, e);
3665
+ hasMore() {
3666
+ return this.length > this.#n + 1;
3531
3667
  }
3532
- matchFinish(t, e) {
3533
- if (this.#r(t)) return;
3534
- if (!this.includeChildMatches && this.#s?.add) {
3535
- let r = `${t.relativePosix()}/**`;
3536
- this.#s.add(r);
3537
- }
3538
- let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
3539
- this.seen.add(t);
3540
- let i = this.opts.mark && t.isDirectory() ? this.#n : "";
3541
- if (this.opts.withFileTypes) this.matchEmit(t);
3542
- else if (s) {
3543
- let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
3544
- this.matchEmit(r + i);
3545
- } else {
3546
- let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
3547
- this.matchEmit(r ? o + r + i : "." + i);
3548
- }
3668
+ rest() {
3669
+ return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
3549
3670
  }
3550
- async match(t, e, s) {
3551
- let i = await this.matchCheck(t, s);
3552
- i && this.matchFinish(i, e);
3671
+ isUNC() {
3672
+ let t = this.#t;
3673
+ return this.#c !== void 0 ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3];
3553
3674
  }
3554
- matchSync(t, e, s) {
3555
- let i = this.matchCheckSync(t, s);
3556
- i && this.matchFinish(i, e);
3675
+ isDrive() {
3676
+ let t = this.#t;
3677
+ return this.#w !== void 0 ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
3557
3678
  }
3558
- walkCB(t, e, s) {
3559
- this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
3679
+ isAbsolute() {
3680
+ let t = this.#t;
3681
+ return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
3560
3682
  }
3561
- walkCB2(t, e, s, i) {
3562
- if (this.#o(t)) return i();
3563
- if (this.signal?.aborted && i(), this.paused) {
3564
- this.onResume(() => this.walkCB2(t, e, s, i));
3565
- return;
3566
- }
3567
- s.processPatterns(t, e);
3568
- let r = 1, o = () => {
3569
- --r === 0 && i();
3570
- };
3571
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3572
- for (let h of s.subwalkTargets()) {
3573
- if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3574
- r++;
3575
- let a = h.readdirCached();
3576
- h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
3577
- }
3578
- o();
3683
+ root() {
3684
+ let t = this.#t[0];
3685
+ return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
3579
3686
  }
3580
- walkCB3(t, e, s, i) {
3581
- s = s.filterEntries(t, e);
3582
- let r = 1, o = () => {
3583
- --r === 0 && i();
3584
- };
3585
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3586
- for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
3587
- o();
3687
+ checkFollowGlobstar() {
3688
+ return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
3588
3689
  }
3589
- walkCBSync(t, e, s) {
3590
- this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
3690
+ markFollowGlobstar() {
3691
+ return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
3591
3692
  }
3592
- walkCB2Sync(t, e, s, i) {
3593
- if (this.#o(t)) return i();
3594
- if (this.signal?.aborted && i(), this.paused) {
3595
- this.onResume(() => this.walkCB2Sync(t, e, s, i));
3596
- return;
3597
- }
3598
- s.processPatterns(t, e);
3599
- let r = 1, o = () => {
3600
- --r === 0 && i();
3601
- };
3602
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
3603
- for (let h of s.subwalkTargets()) {
3604
- if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3605
- r++;
3606
- let a = h.readdirSync();
3607
- this.walkCB3Sync(h, a, s, o);
3693
+ };
3694
+ _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3695
+ ot = class {
3696
+ relative;
3697
+ relativeChildren;
3698
+ absolute;
3699
+ absoluteChildren;
3700
+ platform;
3701
+ mmopts;
3702
+ constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
3703
+ this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
3704
+ dot: !0,
3705
+ nobrace: e,
3706
+ nocase: s,
3707
+ noext: i,
3708
+ noglobstar: r,
3709
+ optimizationLevel: 2,
3710
+ platform: o,
3711
+ nocomment: !0,
3712
+ nonegate: !0
3713
+ };
3714
+ for (let h of t) this.add(h);
3715
+ }
3716
+ add(t) {
3717
+ let e = new D(t, this.mmopts);
3718
+ for (let s = 0; s < e.set.length; s++) {
3719
+ let i = e.set[s], r = e.globParts[s];
3720
+ if (!i || !r) throw new Error("invalid pattern object");
3721
+ for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
3722
+ let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
3723
+ l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
3608
3724
  }
3609
- o();
3610
3725
  }
3611
- walkCB3Sync(t, e, s, i) {
3612
- s = s.filterEntries(t, e);
3613
- let r = 1, o = () => {
3614
- --r === 0 && i();
3615
- };
3616
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
3617
- for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
3618
- o();
3726
+ ignored(t) {
3727
+ let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
3728
+ for (let o of this.relative) if (o.match(i) || o.match(r)) return !0;
3729
+ for (let o of this.absolute) if (o.match(e) || o.match(s)) return !0;
3730
+ return !1;
3731
+ }
3732
+ childrenIgnored(t) {
3733
+ let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
3734
+ for (let i of this.relativeChildren) if (i.match(s)) return !0;
3735
+ for (let i of this.absoluteChildren) if (i.match(e)) return !0;
3736
+ return !1;
3619
3737
  }
3620
3738
  };
3621
- xt = class extends zt {
3622
- matches = /* @__PURE__ */ new Set();
3623
- constructor(t, e, s) {
3624
- super(t, e, s);
3739
+ oe$1 = class n {
3740
+ store;
3741
+ constructor(t = /* @__PURE__ */ new Map()) {
3742
+ this.store = t;
3625
3743
  }
3626
- matchEmit(t) {
3627
- this.matches.add(t);
3744
+ copy() {
3745
+ return new n(new Map(this.store));
3628
3746
  }
3629
- async walk() {
3630
- if (this.signal?.aborted) throw this.signal.reason;
3631
- return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
3632
- this.walkCB(this.path, this.patterns, () => {
3633
- this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
3634
- });
3635
- }), this.matches;
3747
+ hasWalked(t, e) {
3748
+ return this.store.get(t.fullpath())?.has(e.globString());
3636
3749
  }
3637
- walkSync() {
3638
- if (this.signal?.aborted) throw this.signal.reason;
3639
- return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
3640
- if (this.signal?.aborted) throw this.signal.reason;
3641
- }), this.matches;
3750
+ storeWalked(t, e) {
3751
+ let s = t.fullpath(), i = this.store.get(s);
3752
+ i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
3642
3753
  }
3643
3754
  };
3644
- vt = class extends zt {
3645
- results;
3646
- constructor(t, e, s) {
3647
- super(t, e, s), this.results = new V({
3648
- signal: this.signal,
3649
- objectMode: !0
3650
- }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
3755
+ he$1 = class {
3756
+ store = /* @__PURE__ */ new Map();
3757
+ add(t, e, s) {
3758
+ let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
3759
+ this.store.set(t, r === void 0 ? i : i & r);
3651
3760
  }
3652
- matchEmit(t) {
3653
- this.results.write(t), this.results.flowing || this.pause();
3761
+ entries() {
3762
+ return [...this.store.entries()].map(([t, e]) => [
3763
+ t,
3764
+ !!(e & 2),
3765
+ !!(e & 1)
3766
+ ]);
3654
3767
  }
3655
- stream() {
3656
- let t = this.path;
3657
- return t.isUnknown() ? t.lstat().then(() => {
3658
- this.walkCB(t, this.patterns, () => this.results.end());
3659
- }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
3768
+ };
3769
+ ae$1 = class {
3770
+ store = /* @__PURE__ */ new Map();
3771
+ add(t, e) {
3772
+ if (!t.canReaddir()) return;
3773
+ let s = this.store.get(t);
3774
+ s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
3660
3775
  }
3661
- streamSync() {
3662
- return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
3776
+ get(t) {
3777
+ let e = this.store.get(t);
3778
+ if (!e) throw new Error("attempting to walk unknown path");
3779
+ return e;
3780
+ }
3781
+ entries() {
3782
+ return this.keys().map((t) => [t, this.store.get(t)]);
3783
+ }
3784
+ keys() {
3785
+ return [...this.store.keys()].filter((t) => t.canReaddir());
3663
3786
  }
3664
3787
  };
3665
- Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3666
- I$1 = class {
3667
- absolute;
3668
- cwd;
3669
- root;
3670
- dot;
3671
- dotRelative;
3788
+ Et = class n {
3789
+ hasWalkedCache;
3790
+ matches = new he$1();
3791
+ subwalks = new ae$1();
3792
+ patterns;
3672
3793
  follow;
3673
- ignore;
3674
- magicalBraces;
3675
- mark;
3676
- matchBase;
3677
- maxDepth;
3678
- nobrace;
3679
- nocase;
3680
- nodir;
3681
- noext;
3682
- noglobstar;
3683
- pattern;
3684
- platform;
3685
- realpath;
3686
- scurry;
3687
- stat;
3688
- signal;
3689
- windowsPathsNoEscape;
3690
- withFileTypes;
3691
- includeChildMatches;
3794
+ dot;
3692
3795
  opts;
3693
- patterns;
3694
3796
  constructor(t, e) {
3695
- if (!e) throw new TypeError("glob options required");
3696
- if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = fileURLToPath(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
3697
- if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
3698
- if (e.noglobstar) throw new TypeError("base matching requires globstar");
3699
- t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
3797
+ this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe$1();
3798
+ }
3799
+ processPatterns(t, e) {
3800
+ this.patterns = e;
3801
+ let s = e.map((i) => [t, i]);
3802
+ for (let [i, r] of s) {
3803
+ this.hasWalkedCache.storeWalked(i, r);
3804
+ let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
3805
+ if (o) {
3806
+ i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
3807
+ let c = r.rest();
3808
+ if (c) r = c;
3809
+ else {
3810
+ this.matches.add(i, !0, !1);
3811
+ continue;
3812
+ }
3813
+ }
3814
+ if (i.isENOENT()) continue;
3815
+ let a, l, u = !1;
3816
+ for (; typeof (a = r.pattern()) == "string" && (l = r.rest());) i = i.resolve(a), r = l, u = !0;
3817
+ if (a = r.pattern(), l = r.rest(), u) {
3818
+ if (this.hasWalkedCache.hasWalked(i, r)) continue;
3819
+ this.hasWalkedCache.storeWalked(i, r);
3820
+ }
3821
+ if (typeof a == "string") {
3822
+ let c = a === ".." || a === "" || a === ".";
3823
+ this.matches.add(i.resolve(a), h, c);
3824
+ continue;
3825
+ } else if (a === A$1) {
3826
+ (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
3827
+ let c = l?.pattern(), d = l?.rest();
3828
+ if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
3829
+ else if (c === "..") {
3830
+ let f = i.parent || i;
3831
+ d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, !0);
3832
+ }
3833
+ } else a instanceof RegExp && this.subwalks.add(i, r);
3700
3834
  }
3701
- if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
3702
- ...e,
3703
- platform: this.platform
3704
- }, e.scurry) {
3705
- if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
3706
- } else {
3707
- let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe$1;
3708
- this.scurry = new a(this.cwd, {
3709
- nocase: e.nocase,
3710
- fs: e.fs
3711
- });
3835
+ return this;
3836
+ }
3837
+ subwalkTargets() {
3838
+ return this.subwalks.keys();
3839
+ }
3840
+ child() {
3841
+ return new n(this.opts, this.hasWalkedCache);
3842
+ }
3843
+ filterEntries(t, e) {
3844
+ let s = this.subwalks.get(t), i = this.child();
3845
+ for (let r of e) for (let o of s) {
3846
+ let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
3847
+ a === A$1 ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
3712
3848
  }
3713
- this.nocase = this.scurry.nocase;
3714
- let s = this.platform === "darwin" || this.platform === "win32", i = {
3715
- braceExpandMax: 1e4,
3716
- ...e,
3717
- dot: this.dot,
3718
- matchBase: this.matchBase,
3719
- nobrace: this.nobrace,
3720
- nocase: this.nocase,
3721
- nocaseMagicOnly: s,
3722
- nocomment: !0,
3723
- noext: this.noext,
3724
- nonegate: !0,
3725
- optimizationLevel: 2,
3726
- platform: this.platform,
3727
- windowsPathsNoEscape: this.windowsPathsNoEscape,
3728
- debug: !!this.opts.debug
3729
- }, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
3730
- this.patterns = o.map((a, l) => {
3731
- let u = h[l];
3732
- if (!u) throw new Error("invalid pattern object");
3733
- return new nt(a, u, 0, this.platform);
3734
- });
3849
+ return i;
3850
+ }
3851
+ testGlobstar(t, e, s, i) {
3852
+ if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, !1), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
3853
+ let r = s.pattern();
3854
+ if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
3855
+ else if (r === "..") {
3856
+ let o = t.parent || t;
3857
+ this.subwalks.add(o, s);
3858
+ } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
3859
+ }
3860
+ }
3861
+ testRegExp(t, e, s, i) {
3862
+ e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3863
+ }
3864
+ testString(t, e, s, i) {
3865
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3866
+ }
3867
+ };
3868
+ Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n;
3869
+ zt = class {
3870
+ path;
3871
+ patterns;
3872
+ opts;
3873
+ seen = /* @__PURE__ */ new Set();
3874
+ paused = !1;
3875
+ aborted = !1;
3876
+ #t = [];
3877
+ #s;
3878
+ #n;
3879
+ signal;
3880
+ maxDepth;
3881
+ includeChildMatches;
3882
+ constructor(t, e, s) {
3883
+ if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) throw new Error("cannot ignore child matches, ignore lacks add() method.");
3884
+ this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
3885
+ this.#t.length = 0;
3886
+ }));
3735
3887
  }
3736
- async walk() {
3737
- return [...await new xt(this.patterns, this.scurry.cwd, {
3738
- ...this.opts,
3739
- maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3740
- platform: this.platform,
3741
- nocase: this.nocase,
3742
- includeChildMatches: this.includeChildMatches
3743
- }).walk()];
3888
+ #r(t) {
3889
+ return this.seen.has(t) || !!this.#s?.ignored?.(t);
3744
3890
  }
3745
- walkSync() {
3746
- return [...new xt(this.patterns, this.scurry.cwd, {
3747
- ...this.opts,
3748
- maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3749
- platform: this.platform,
3750
- nocase: this.nocase,
3751
- includeChildMatches: this.includeChildMatches
3752
- }).walkSync()];
3891
+ #o(t) {
3892
+ return !!this.#s?.childrenIgnored?.(t);
3753
3893
  }
3754
- stream() {
3755
- return new vt(this.patterns, this.scurry.cwd, {
3756
- ...this.opts,
3757
- maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3758
- platform: this.platform,
3759
- nocase: this.nocase,
3760
- includeChildMatches: this.includeChildMatches
3761
- }).stream();
3894
+ pause() {
3895
+ this.paused = !0;
3762
3896
  }
3763
- streamSync() {
3764
- return new vt(this.patterns, this.scurry.cwd, {
3765
- ...this.opts,
3766
- maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3767
- platform: this.platform,
3768
- nocase: this.nocase,
3769
- includeChildMatches: this.includeChildMatches
3770
- }).streamSync();
3897
+ resume() {
3898
+ if (this.signal?.aborted) return;
3899
+ this.paused = !1;
3900
+ let t;
3901
+ for (; !this.paused && (t = this.#t.shift());) t();
3771
3902
  }
3772
- iterateSync() {
3773
- return this.streamSync()[Symbol.iterator]();
3903
+ onResume(t) {
3904
+ this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
3774
3905
  }
3775
- [Symbol.iterator]() {
3776
- return this.iterateSync();
3906
+ async matchCheck(t, e) {
3907
+ if (e && this.opts.nodir) return;
3908
+ let s;
3909
+ if (this.opts.realpath) {
3910
+ if (s = t.realpathCached() || await t.realpath(), !s) return;
3911
+ t = s;
3912
+ }
3913
+ let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
3914
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3915
+ let o = await r.realpath();
3916
+ o && (o.isUnknown() || this.opts.stat) && await o.lstat();
3917
+ }
3918
+ return this.matchCheckTest(r, e);
3777
3919
  }
3778
- iterate() {
3779
- return this.stream()[Symbol.asyncIterator]();
3920
+ matchCheckTest(t, e) {
3921
+ return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
3780
3922
  }
3781
- [Symbol.asyncIterator]() {
3782
- return this.iterate();
3923
+ matchCheckSync(t, e) {
3924
+ if (e && this.opts.nodir) return;
3925
+ let s;
3926
+ if (this.opts.realpath) {
3927
+ if (s = t.realpathCached() || t.realpathSync(), !s) return;
3928
+ t = s;
3929
+ }
3930
+ let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
3931
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3932
+ let o = r.realpathSync();
3933
+ o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
3934
+ }
3935
+ return this.matchCheckTest(r, e);
3783
3936
  }
3784
- };
3785
- le$1 = (n, t = {}) => {
3786
- Array.isArray(n) || (n = [n]);
3787
- for (let e of n) if (new D(e, t).hasMagic()) return !0;
3788
- return !1;
3789
- };
3790
- ji = Bt;
3791
- Ii = Object.assign(Qe$1, { sync: Bt });
3792
- zi = Ut;
3793
- Bi = Object.assign(es, { sync: Ut });
3794
- Ui = Object.assign(ts$1, {
3795
- stream: Bt,
3796
- iterate: Ut
3797
- });
3798
- Ze$1 = Object.assign(Je$1, {
3799
- glob: Je$1,
3800
- globSync: ts$1,
3801
- sync: Ui,
3802
- globStream: Qe$1,
3803
- stream: Ii,
3804
- globStreamSync: Bt,
3805
- streamSync: ji,
3806
- globIterate: es,
3807
- iterate: Bi,
3808
- globIterateSync: Ut,
3809
- iterateSync: zi,
3810
- Glob: I$1,
3811
- hasMagic: le$1,
3812
- escape: tt,
3813
- unescape: W
3814
- });
3815
- Ze$1.glob = Ze$1;
3816
- }));
3817
- //#endregion
3818
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
3819
- var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3820
- module.exports = isexe;
3821
- isexe.sync = sync;
3822
- var fs$3 = __require("fs");
3823
- function checkPathExt(path, options) {
3824
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
3825
- if (!pathext) return true;
3826
- pathext = pathext.split(";");
3827
- if (pathext.indexOf("") !== -1) return true;
3828
- for (var i = 0; i < pathext.length; i++) {
3829
- var p = pathext[i].toLowerCase();
3830
- if (p && path.substr(-p.length).toLowerCase() === p) return true;
3937
+ matchFinish(t, e) {
3938
+ if (this.#r(t)) return;
3939
+ if (!this.includeChildMatches && this.#s?.add) {
3940
+ let r = `${t.relativePosix()}/**`;
3941
+ this.#s.add(r);
3942
+ }
3943
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
3944
+ this.seen.add(t);
3945
+ let i = this.opts.mark && t.isDirectory() ? this.#n : "";
3946
+ if (this.opts.withFileTypes) this.matchEmit(t);
3947
+ else if (s) {
3948
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
3949
+ this.matchEmit(r + i);
3950
+ } else {
3951
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
3952
+ this.matchEmit(r ? o + r + i : "." + i);
3953
+ }
3831
3954
  }
3832
- return false;
3833
- }
3834
- function checkStat(stat, path, options) {
3835
- if (!stat.isSymbolicLink() && !stat.isFile()) return false;
3836
- return checkPathExt(path, options);
3837
- }
3838
- function isexe(path, options, cb) {
3839
- fs$3.stat(path, function(er, stat) {
3840
- cb(er, er ? false : checkStat(stat, path, options));
3841
- });
3842
- }
3843
- function sync(path, options) {
3844
- return checkStat(fs$3.statSync(path), path, options);
3845
- }
3846
- }));
3847
- //#endregion
3848
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
3849
- var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3850
- module.exports = isexe;
3851
- isexe.sync = sync;
3852
- var fs$2 = __require("fs");
3853
- function isexe(path, options, cb) {
3854
- fs$2.stat(path, function(er, stat) {
3855
- cb(er, er ? false : checkStat(stat, options));
3856
- });
3857
- }
3858
- function sync(path, options) {
3859
- return checkStat(fs$2.statSync(path), options);
3860
- }
3861
- function checkStat(stat, options) {
3862
- return stat.isFile() && checkMode(stat, options);
3863
- }
3864
- function checkMode(stat, options) {
3865
- var mod = stat.mode;
3866
- var uid = stat.uid;
3867
- var gid = stat.gid;
3868
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
3869
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
3870
- var u = parseInt("100", 8);
3871
- var g = parseInt("010", 8);
3872
- var o = parseInt("001", 8);
3873
- var ug = u | g;
3874
- return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
3875
- }
3876
- }));
3877
- //#endregion
3878
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
3879
- var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3880
- __require("fs");
3881
- var core;
3882
- if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
3883
- else core = require_mode();
3884
- module.exports = isexe;
3885
- isexe.sync = sync;
3886
- function isexe(path, options, cb) {
3887
- if (typeof options === "function") {
3888
- cb = options;
3889
- options = {};
3955
+ async match(t, e, s) {
3956
+ let i = await this.matchCheck(t, s);
3957
+ i && this.matchFinish(i, e);
3890
3958
  }
3891
- if (!cb) {
3892
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
3893
- return new Promise(function(resolve, reject) {
3894
- isexe(path, options || {}, function(er, is) {
3895
- if (er) reject(er);
3896
- else resolve(is);
3897
- });
3898
- });
3959
+ matchSync(t, e, s) {
3960
+ let i = this.matchCheckSync(t, s);
3961
+ i && this.matchFinish(i, e);
3899
3962
  }
3900
- core(path, options || {}, function(er, is) {
3901
- if (er) {
3902
- if (er.code === "EACCES" || options && options.ignoreErrors) {
3903
- er = null;
3904
- is = false;
3905
- }
3963
+ walkCB(t, e, s) {
3964
+ this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
3965
+ }
3966
+ walkCB2(t, e, s, i) {
3967
+ if (this.#o(t)) return i();
3968
+ if (this.signal?.aborted && i(), this.paused) {
3969
+ this.onResume(() => this.walkCB2(t, e, s, i));
3970
+ return;
3906
3971
  }
3907
- cb(er, is);
3908
- });
3909
- }
3910
- function sync(path, options) {
3911
- try {
3912
- return core.sync(path, options || {});
3913
- } catch (er) {
3914
- if (options && options.ignoreErrors || er.code === "EACCES") return false;
3915
- else throw er;
3972
+ s.processPatterns(t, e);
3973
+ let r = 1, o = () => {
3974
+ --r === 0 && i();
3975
+ };
3976
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3977
+ for (let h of s.subwalkTargets()) {
3978
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3979
+ r++;
3980
+ let a = h.readdirCached();
3981
+ h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
3982
+ }
3983
+ o();
3916
3984
  }
3917
- }
3918
- }));
3919
- //#endregion
3920
- //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
3921
- var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3922
- const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
3923
- const path$5 = __require("path");
3924
- const COLON = isWindows ? ";" : ":";
3925
- const isexe = require_isexe();
3926
- const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
3927
- const getPathInfo = (cmd, opt) => {
3928
- const colon = opt.colon || COLON;
3929
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
3930
- /* istanbul ignore next: very unusual */ "").split(colon)];
3931
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
3932
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
3933
- if (isWindows) {
3934
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
3985
+ walkCB3(t, e, s, i) {
3986
+ s = s.filterEntries(t, e);
3987
+ let r = 1, o = () => {
3988
+ --r === 0 && i();
3989
+ };
3990
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3991
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
3992
+ o();
3935
3993
  }
3936
- return {
3937
- pathEnv,
3938
- pathExt,
3939
- pathExtExe
3940
- };
3941
- };
3942
- const which = (cmd, opt, cb) => {
3943
- if (typeof opt === "function") {
3944
- cb = opt;
3945
- opt = {};
3994
+ walkCBSync(t, e, s) {
3995
+ this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
3946
3996
  }
3947
- if (!opt) opt = {};
3948
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
3949
- const found = [];
3950
- const step = (i) => new Promise((resolve, reject) => {
3951
- if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
3952
- const ppRaw = pathEnv[i];
3953
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
3954
- const pCmd = path$5.join(pathPart, cmd);
3955
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
3956
- resolve(subStep(p, i, 0));
3957
- });
3958
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
3959
- if (ii === pathExt.length) return resolve(step(i + 1));
3960
- const ext = pathExt[ii];
3961
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
3962
- if (!er && is) {
3963
- if (opt.all) found.push(p + ext);
3964
- else return resolve(p + ext);
3965
- }
3966
- return resolve(subStep(p, i, ii + 1));
3967
- });
3968
- });
3969
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
3970
- };
3971
- const whichSync = (cmd, opt) => {
3972
- opt = opt || {};
3973
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
3974
- const found = [];
3975
- for (let i = 0; i < pathEnv.length; i++) {
3976
- const ppRaw = pathEnv[i];
3977
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
3978
- const pCmd = path$5.join(pathPart, cmd);
3979
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
3980
- for (let j = 0; j < pathExt.length; j++) {
3981
- const cur = p + pathExt[j];
3982
- try {
3983
- if (isexe.sync(cur, { pathExt: pathExtExe })) {
3984
- if (opt.all) found.push(cur);
3985
- else return cur;
3986
- }
3987
- } catch (ex) {}
3997
+ walkCB2Sync(t, e, s, i) {
3998
+ if (this.#o(t)) return i();
3999
+ if (this.signal?.aborted && i(), this.paused) {
4000
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
4001
+ return;
4002
+ }
4003
+ s.processPatterns(t, e);
4004
+ let r = 1, o = () => {
4005
+ --r === 0 && i();
4006
+ };
4007
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
4008
+ for (let h of s.subwalkTargets()) {
4009
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
4010
+ r++;
4011
+ let a = h.readdirSync();
4012
+ this.walkCB3Sync(h, a, s, o);
3988
4013
  }
4014
+ o();
3989
4015
  }
3990
- if (opt.all && found.length) return found;
3991
- if (opt.nothrow) return null;
3992
- throw getNotFoundError(cmd);
3993
- };
3994
- module.exports = which;
3995
- which.sync = whichSync;
3996
- }));
3997
- //#endregion
3998
- //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
3999
- var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4000
- const pathKey = (options = {}) => {
4001
- const environment = options.env || process.env;
4002
- if ((options.platform || process.platform) !== "win32") return "PATH";
4003
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
4004
- };
4005
- module.exports = pathKey;
4006
- module.exports.default = pathKey;
4007
- }));
4008
- //#endregion
4009
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
4010
- var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4011
- const path$4 = __require("path");
4012
- const which = require_which();
4013
- const getPathKey = require_path_key();
4014
- function resolveCommandAttempt(parsed, withoutPathExt) {
4015
- const env = parsed.options.env || process.env;
4016
- const cwd = process.cwd();
4017
- const hasCustomCwd = parsed.options.cwd != null;
4018
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
4019
- if (shouldSwitchCwd) try {
4020
- process.chdir(parsed.options.cwd);
4021
- } catch (err) {}
4022
- let resolved;
4023
- try {
4024
- resolved = which.sync(parsed.command, {
4025
- path: env[getPathKey({ env })],
4026
- pathExt: withoutPathExt ? path$4.delimiter : void 0
4027
- });
4028
- } catch (e) {} finally {
4029
- if (shouldSwitchCwd) process.chdir(cwd);
4016
+ walkCB3Sync(t, e, s, i) {
4017
+ s = s.filterEntries(t, e);
4018
+ let r = 1, o = () => {
4019
+ --r === 0 && i();
4020
+ };
4021
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
4022
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
4023
+ o();
4030
4024
  }
4031
- if (resolved) resolved = path$4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
4032
- return resolved;
4033
- }
4034
- function resolveCommand(parsed) {
4035
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
4036
- }
4037
- module.exports = resolveCommand;
4038
- }));
4039
- //#endregion
4040
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
4041
- var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4042
- const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
4043
- function escapeCommand(arg) {
4044
- arg = arg.replace(metaCharsRegExp, "^$1");
4045
- return arg;
4046
- }
4047
- function escapeArgument(arg, doubleEscapeMetaChars) {
4048
- arg = `${arg}`;
4049
- arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
4050
- arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
4051
- arg = `"${arg}"`;
4052
- arg = arg.replace(metaCharsRegExp, "^$1");
4053
- if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
4054
- return arg;
4055
- }
4056
- module.exports.command = escapeCommand;
4057
- module.exports.argument = escapeArgument;
4058
- }));
4059
- //#endregion
4060
- //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
4061
- var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4062
- module.exports = /^#!(.*)/;
4063
- }));
4064
- //#endregion
4065
- //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
4066
- var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4067
- const shebangRegex = require_shebang_regex();
4068
- module.exports = (string = "") => {
4069
- const match = string.match(shebangRegex);
4070
- if (!match) return null;
4071
- const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
4072
- const binary = path.split("/").pop();
4073
- if (binary === "env") return argument;
4074
- return argument ? `${binary} ${argument}` : binary;
4075
4025
  };
4076
- }));
4077
- //#endregion
4078
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
4079
- var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4080
- const fs$1 = __require("fs");
4081
- const shebangCommand = require_shebang_command();
4082
- function readShebang(command) {
4083
- const size = 150;
4084
- const buffer = Buffer.alloc(size);
4085
- let fd;
4086
- try {
4087
- fd = fs$1.openSync(command, "r");
4088
- fs$1.readSync(fd, buffer, 0, size, 0);
4089
- fs$1.closeSync(fd);
4090
- } catch (e) {}
4091
- return shebangCommand(buffer.toString());
4092
- }
4093
- module.exports = readShebang;
4094
- }));
4095
- //#endregion
4096
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
4097
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4098
- const path$3 = __require("path");
4099
- const resolveCommand = require_resolveCommand();
4100
- const escape = require_escape();
4101
- const readShebang = require_readShebang();
4102
- const isWin = process.platform === "win32";
4103
- const isExecutableRegExp = /\.(?:com|exe)$/i;
4104
- const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
4105
- function detectShebang(parsed) {
4106
- parsed.file = resolveCommand(parsed);
4107
- const shebang = parsed.file && readShebang(parsed.file);
4108
- if (shebang) {
4109
- parsed.args.unshift(parsed.file);
4110
- parsed.command = shebang;
4111
- return resolveCommand(parsed);
4026
+ xt = class extends zt {
4027
+ matches = /* @__PURE__ */ new Set();
4028
+ constructor(t, e, s) {
4029
+ super(t, e, s);
4112
4030
  }
4113
- return parsed.file;
4114
- }
4115
- function parseNonShell(parsed) {
4116
- if (!isWin) return parsed;
4117
- const commandFile = detectShebang(parsed);
4118
- const needsShell = !isExecutableRegExp.test(commandFile);
4119
- if (parsed.options.forceShell || needsShell) {
4120
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
4121
- parsed.command = path$3.normalize(parsed.command);
4122
- parsed.command = escape.command(parsed.command);
4123
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
4124
- parsed.args = [
4125
- "/d",
4126
- "/s",
4127
- "/c",
4128
- `"${[parsed.command].concat(parsed.args).join(" ")}"`
4129
- ];
4130
- parsed.command = process.env.comspec || "cmd.exe";
4131
- parsed.options.windowsVerbatimArguments = true;
4031
+ matchEmit(t) {
4032
+ this.matches.add(t);
4033
+ }
4034
+ async walk() {
4035
+ if (this.signal?.aborted) throw this.signal.reason;
4036
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
4037
+ this.walkCB(this.path, this.patterns, () => {
4038
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
4039
+ });
4040
+ }), this.matches;
4041
+ }
4042
+ walkSync() {
4043
+ if (this.signal?.aborted) throw this.signal.reason;
4044
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
4045
+ if (this.signal?.aborted) throw this.signal.reason;
4046
+ }), this.matches;
4132
4047
  }
4133
- return parsed;
4134
- }
4135
- function parse(command, args, options) {
4136
- if (args && !Array.isArray(args)) {
4137
- options = args;
4138
- args = null;
4048
+ };
4049
+ vt = class extends zt {
4050
+ results;
4051
+ constructor(t, e, s) {
4052
+ super(t, e, s), this.results = new V({
4053
+ signal: this.signal,
4054
+ objectMode: !0
4055
+ }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
4139
4056
  }
4140
- args = args ? args.slice(0) : [];
4141
- options = Object.assign({}, options);
4142
- const parsed = {
4143
- command,
4144
- args,
4145
- options,
4146
- file: void 0,
4147
- original: {
4148
- command,
4149
- args
4057
+ matchEmit(t) {
4058
+ this.results.write(t), this.results.flowing || this.pause();
4059
+ }
4060
+ stream() {
4061
+ let t = this.path;
4062
+ return t.isUnknown() ? t.lstat().then(() => {
4063
+ this.walkCB(t, this.patterns, () => this.results.end());
4064
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
4065
+ }
4066
+ streamSync() {
4067
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
4068
+ }
4069
+ };
4070
+ Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
4071
+ I$1 = class {
4072
+ absolute;
4073
+ cwd;
4074
+ root;
4075
+ dot;
4076
+ dotRelative;
4077
+ follow;
4078
+ ignore;
4079
+ magicalBraces;
4080
+ mark;
4081
+ matchBase;
4082
+ maxDepth;
4083
+ nobrace;
4084
+ nocase;
4085
+ nodir;
4086
+ noext;
4087
+ noglobstar;
4088
+ pattern;
4089
+ platform;
4090
+ realpath;
4091
+ scurry;
4092
+ stat;
4093
+ signal;
4094
+ windowsPathsNoEscape;
4095
+ withFileTypes;
4096
+ includeChildMatches;
4097
+ opts;
4098
+ patterns;
4099
+ constructor(t, e) {
4100
+ if (!e) throw new TypeError("glob options required");
4101
+ if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = fileURLToPath(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
4102
+ if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
4103
+ if (e.noglobstar) throw new TypeError("base matching requires globstar");
4104
+ t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
4150
4105
  }
4151
- };
4152
- return options.shell ? parsed : parseNonShell(parsed);
4153
- }
4154
- module.exports = parse;
4155
- }));
4156
- //#endregion
4157
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
4158
- var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4159
- const isWin = process.platform === "win32";
4160
- function notFoundError(original, syscall) {
4161
- return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
4162
- code: "ENOENT",
4163
- errno: "ENOENT",
4164
- syscall: `${syscall} ${original.command}`,
4165
- path: original.command,
4166
- spawnargs: original.args
4167
- });
4168
- }
4169
- function hookChildProcess(cp, parsed) {
4170
- if (!isWin) return;
4171
- const originalEmit = cp.emit;
4172
- cp.emit = function(name, arg1) {
4173
- if (name === "exit") {
4174
- const err = verifyENOENT(arg1, parsed);
4175
- if (err) return originalEmit.call(cp, "error", err);
4106
+ if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
4107
+ ...e,
4108
+ platform: this.platform
4109
+ }, e.scurry) {
4110
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
4111
+ } else {
4112
+ let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe$1;
4113
+ this.scurry = new a(this.cwd, {
4114
+ nocase: e.nocase,
4115
+ fs: e.fs
4116
+ });
4176
4117
  }
4177
- return originalEmit.apply(cp, arguments);
4178
- };
4179
- }
4180
- function verifyENOENT(status, parsed) {
4181
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
4182
- return null;
4183
- }
4184
- function verifyENOENTSync(status, parsed) {
4185
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
4186
- return null;
4187
- }
4188
- module.exports = {
4189
- hookChildProcess,
4190
- verifyENOENT,
4191
- verifyENOENTSync,
4192
- notFoundError
4118
+ this.nocase = this.scurry.nocase;
4119
+ let s = this.platform === "darwin" || this.platform === "win32", i = {
4120
+ braceExpandMax: 1e4,
4121
+ ...e,
4122
+ dot: this.dot,
4123
+ matchBase: this.matchBase,
4124
+ nobrace: this.nobrace,
4125
+ nocase: this.nocase,
4126
+ nocaseMagicOnly: s,
4127
+ nocomment: !0,
4128
+ noext: this.noext,
4129
+ nonegate: !0,
4130
+ optimizationLevel: 2,
4131
+ platform: this.platform,
4132
+ windowsPathsNoEscape: this.windowsPathsNoEscape,
4133
+ debug: !!this.opts.debug
4134
+ }, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
4135
+ this.patterns = o.map((a, l) => {
4136
+ let u = h[l];
4137
+ if (!u) throw new Error("invalid pattern object");
4138
+ return new nt(a, u, 0, this.platform);
4139
+ });
4140
+ }
4141
+ async walk() {
4142
+ return [...await new xt(this.patterns, this.scurry.cwd, {
4143
+ ...this.opts,
4144
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4145
+ platform: this.platform,
4146
+ nocase: this.nocase,
4147
+ includeChildMatches: this.includeChildMatches
4148
+ }).walk()];
4149
+ }
4150
+ walkSync() {
4151
+ return [...new xt(this.patterns, this.scurry.cwd, {
4152
+ ...this.opts,
4153
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4154
+ platform: this.platform,
4155
+ nocase: this.nocase,
4156
+ includeChildMatches: this.includeChildMatches
4157
+ }).walkSync()];
4158
+ }
4159
+ stream() {
4160
+ return new vt(this.patterns, this.scurry.cwd, {
4161
+ ...this.opts,
4162
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4163
+ platform: this.platform,
4164
+ nocase: this.nocase,
4165
+ includeChildMatches: this.includeChildMatches
4166
+ }).stream();
4167
+ }
4168
+ streamSync() {
4169
+ return new vt(this.patterns, this.scurry.cwd, {
4170
+ ...this.opts,
4171
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4172
+ platform: this.platform,
4173
+ nocase: this.nocase,
4174
+ includeChildMatches: this.includeChildMatches
4175
+ }).streamSync();
4176
+ }
4177
+ iterateSync() {
4178
+ return this.streamSync()[Symbol.iterator]();
4179
+ }
4180
+ [Symbol.iterator]() {
4181
+ return this.iterateSync();
4182
+ }
4183
+ iterate() {
4184
+ return this.stream()[Symbol.asyncIterator]();
4185
+ }
4186
+ [Symbol.asyncIterator]() {
4187
+ return this.iterate();
4188
+ }
4189
+ };
4190
+ le$1 = (n, t = {}) => {
4191
+ Array.isArray(n) || (n = [n]);
4192
+ for (let e of n) if (new D(e, t).hasMagic()) return !0;
4193
+ return !1;
4193
4194
  };
4195
+ ji = Bt;
4196
+ Ii = Object.assign(Qe$1, { sync: Bt });
4197
+ zi = Ut;
4198
+ Bi = Object.assign(es, { sync: Ut });
4199
+ Ui = Object.assign(ts$1, {
4200
+ stream: Bt,
4201
+ iterate: Ut
4202
+ });
4203
+ Ze$1 = Object.assign(Je$1, {
4204
+ glob: Je$1,
4205
+ globSync: ts$1,
4206
+ sync: Ui,
4207
+ globStream: Qe$1,
4208
+ stream: Ii,
4209
+ globStreamSync: Bt,
4210
+ streamSync: ji,
4211
+ globIterate: es,
4212
+ iterate: Bi,
4213
+ globIterateSync: Ut,
4214
+ iterateSync: zi,
4215
+ Glob: I$1,
4216
+ hasMagic: le$1,
4217
+ escape: tt,
4218
+ unescape: W
4219
+ });
4220
+ Ze$1.glob = Ze$1;
4194
4221
  }));
4195
4222
  //#endregion
4196
- //#region src/lib/crossSpawn.ts
4197
- var import_cross_spawn = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4198
- const cp = __require("child_process");
4199
- const parse = require_parse();
4200
- const enoent = require_enoent();
4201
- function spawn(command, args, options) {
4202
- const parsed = parse(command, args, options);
4203
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
4204
- enoent.hookChildProcess(spawned, parsed);
4205
- return spawned;
4206
- }
4207
- function spawnSync(command, args, options) {
4208
- const parsed = parse(command, args, options);
4209
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
4210
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
4211
- return result;
4212
- }
4213
- module.exports = spawn;
4214
- module.exports.spawn = spawn;
4215
- module.exports.sync = spawnSync;
4216
- module.exports._parse = parse;
4217
- module.exports._enoent = enoent;
4218
- })))(), 1);
4219
- function spawnSync(command, args, options) {
4220
- return import_cross_spawn.default.sync(command, args, options);
4221
- }
4222
- //#endregion
4223
4223
  //#region src/lib/deepMerge.ts
4224
4224
  const UNSAFE_KEYS = /* @__PURE__ */ new Set([
4225
4225
  "__proto__",