@ariestools/toolchain 10.1.1 → 10.1.3

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