@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
@@ -3,11 +3,11 @@ import { createRequire } from "node:module";
3
3
  import * as xi from "node:fs";
4
4
  import fs, { existsSync, readFileSync } from "node:fs";
5
5
  import path, { posix, win32 } from "node:path";
6
+ import { lstatSync, readdir, readdirSync, readlinkSync, realpathSync } from "fs";
6
7
  import process$1 from "node:process";
7
8
  import os from "node:os";
8
9
  import tty from "node:tty";
9
10
  import { fileURLToPath } from "node:url";
10
- import { lstatSync, readdir, readdirSync, readlinkSync, realpathSync } from "fs";
11
11
  import { lstat, readdir as readdir$1, readlink, realpath } from "node:fs/promises";
12
12
  import { EventEmitter } from "node:events";
13
13
  import Pe from "node:stream";
@@ -45,486 +45,891 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
45
45
  }) : target, mod));
46
46
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
47
47
  //#endregion
48
- //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/utilities.js
49
- function stringReplaceAll(string, substring, postfix) {
50
- let index = string.indexOf(substring);
51
- if (index === -1) return string;
52
- const substringLength = substring.length;
53
- let endIndex = 0;
54
- let returnValue = "";
55
- do {
56
- returnValue += string.slice(endIndex, index) + substring + postfix;
57
- endIndex = index + substringLength;
58
- index = string.indexOf(substring, endIndex);
59
- } while (index !== -1);
60
- returnValue += string.slice(endIndex);
61
- return returnValue;
62
- }
63
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
64
- let endIndex = 0;
65
- let returnValue = "";
66
- do {
67
- const isGotCR = string[index - 1] === "\r";
68
- returnValue += string.slice(endIndex, isGotCR ? index - 1 : index) + prefix + (isGotCR ? "\r\n" : "\n") + postfix;
69
- endIndex = index + 1;
70
- index = string.indexOf("\n", endIndex);
71
- } while (index !== -1);
72
- returnValue += string.slice(endIndex);
73
- return returnValue;
74
- }
48
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
49
+ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
50
+ module.exports = isexe;
51
+ isexe.sync = sync;
52
+ var fs$4 = __require("fs");
53
+ function checkPathExt(path, options) {
54
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
55
+ if (!pathext) return true;
56
+ pathext = pathext.split(";");
57
+ if (pathext.indexOf("") !== -1) return true;
58
+ for (var i = 0; i < pathext.length; i++) {
59
+ var p = pathext[i].toLowerCase();
60
+ if (p && path.substr(-p.length).toLowerCase() === p) return true;
61
+ }
62
+ return false;
63
+ }
64
+ function checkStat(stat, path, options) {
65
+ if (!stat.isSymbolicLink() && !stat.isFile()) return false;
66
+ return checkPathExt(path, options);
67
+ }
68
+ function isexe(path, options, cb) {
69
+ fs$4.stat(path, function(er, stat) {
70
+ cb(er, er ? false : checkStat(stat, path, options));
71
+ });
72
+ }
73
+ function sync(path, options) {
74
+ return checkStat(fs$4.statSync(path), path, options);
75
+ }
76
+ }));
75
77
  //#endregion
76
- //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/ansi-styles/index.js
77
- const ANSI_BACKGROUND_OFFSET = 10;
78
- const ANSI_UNDERLINE_OFFSET = 20;
79
- const wrapAnsi16 = (offset = 0) => (code) => `\u{1B}[${code + offset}m`;
80
- const wrapAnsi256 = (offset = 0) => (code) => `\u{1B}[${38 + offset};5;${code}m`;
81
- const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u{1B}[${38 + offset};2;${red};${green};${blue}m`;
82
- const wrapUnderlineAnsi = (code) => `\u{1B}[58;5;${code < 90 ? code - 30 : code - 90 + 8}m`;
83
- const styles$1 = {
84
- modifier: {
85
- reset: [0, 0],
86
- bold: [1, 22],
87
- dim: [2, 22],
88
- italic: [3, 23],
89
- underline: [4, 24],
90
- underlineDouble: ["4:2", 24],
91
- underlineCurly: ["4:3", 24],
92
- underlineDotted: ["4:4", 24],
93
- underlineDashed: ["4:5", 24],
94
- overline: [53, 55],
95
- inverse: [7, 27],
96
- hidden: [8, 28],
97
- strikethrough: [9, 29]
98
- },
99
- color: {
100
- black: [30, 39],
101
- red: [31, 39],
102
- green: [32, 39],
103
- yellow: [33, 39],
104
- blue: [34, 39],
105
- magenta: [35, 39],
106
- cyan: [36, 39],
107
- white: [37, 39],
108
- blackBright: [90, 39],
109
- gray: [90, 39],
110
- grey: [90, 39],
111
- redBright: [91, 39],
112
- greenBright: [92, 39],
113
- yellowBright: [93, 39],
114
- blueBright: [94, 39],
115
- magentaBright: [95, 39],
116
- cyanBright: [96, 39],
117
- whiteBright: [97, 39]
118
- },
119
- bgColor: {
120
- bgBlack: [40, 49],
121
- bgRed: [41, 49],
122
- bgGreen: [42, 49],
123
- bgYellow: [43, 49],
124
- bgBlue: [44, 49],
125
- bgMagenta: [45, 49],
126
- bgCyan: [46, 49],
127
- bgWhite: [47, 49],
128
- bgBlackBright: [100, 49],
129
- bgGray: [100, 49],
130
- bgGrey: [100, 49],
131
- bgRedBright: [101, 49],
132
- bgGreenBright: [102, 49],
133
- bgYellowBright: [103, 49],
134
- bgBlueBright: [104, 49],
135
- bgMagentaBright: [105, 49],
136
- bgCyanBright: [106, 49],
137
- bgWhiteBright: [107, 49]
138
- },
139
- underlineColor: {
140
- underlineBlack: ["58;5;0", 59],
141
- underlineRed: ["58;5;1", 59],
142
- underlineGreen: ["58;5;2", 59],
143
- underlineYellow: ["58;5;3", 59],
144
- underlineBlue: ["58;5;4", 59],
145
- underlineMagenta: ["58;5;5", 59],
146
- underlineCyan: ["58;5;6", 59],
147
- underlineWhite: ["58;5;7", 59],
148
- underlineBlackBright: ["58;5;8", 59],
149
- underlineGray: ["58;5;8", 59],
150
- underlineGrey: ["58;5;8", 59],
151
- underlineRedBright: ["58;5;9", 59],
152
- underlineGreenBright: ["58;5;10", 59],
153
- underlineYellowBright: ["58;5;11", 59],
154
- underlineBlueBright: ["58;5;12", 59],
155
- underlineMagentaBright: ["58;5;13", 59],
156
- underlineCyanBright: ["58;5;14", 59],
157
- underlineWhiteBright: ["58;5;15", 59]
78
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
79
+ var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
80
+ module.exports = isexe;
81
+ isexe.sync = sync;
82
+ var fs$3 = __require("fs");
83
+ function isexe(path, options, cb) {
84
+ fs$3.stat(path, function(er, stat) {
85
+ cb(er, er ? false : checkStat(stat, options));
86
+ });
158
87
  }
159
- };
160
- Object.keys(styles$1.modifier);
161
- const foregroundColorNames = Object.keys(styles$1.color);
162
- const backgroundColorNames = Object.keys(styles$1.bgColor);
163
- Object.keys(styles$1.underlineColor);
164
- [...foregroundColorNames, ...backgroundColorNames];
165
- function assembleStyles() {
166
- const codes = /* @__PURE__ */ new Map();
167
- for (const [groupName, group] of Object.entries(styles$1)) {
168
- for (const [styleName, style] of Object.entries(group)) {
169
- styles$1[styleName] = {
170
- open: `\u{1B}[${style[0]}m`,
171
- close: `\u{1B}[${style[1]}m`
172
- };
173
- group[styleName] = styles$1[styleName];
174
- codes.set(Number.parseInt(style[0], 10), style[1]);
88
+ function sync(path, options) {
89
+ return checkStat(fs$3.statSync(path), options);
90
+ }
91
+ function checkStat(stat, options) {
92
+ return stat.isFile() && checkMode(stat, options);
93
+ }
94
+ function checkMode(stat, options) {
95
+ var mod = stat.mode;
96
+ var uid = stat.uid;
97
+ var gid = stat.gid;
98
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
99
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
100
+ var u = parseInt("100", 8);
101
+ var g = parseInt("010", 8);
102
+ var o = parseInt("001", 8);
103
+ var ug = u | g;
104
+ return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
105
+ }
106
+ }));
107
+ //#endregion
108
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
109
+ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110
+ __require("fs");
111
+ var core;
112
+ if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
113
+ else core = require_mode();
114
+ module.exports = isexe;
115
+ isexe.sync = sync;
116
+ function isexe(path, options, cb) {
117
+ if (typeof options === "function") {
118
+ cb = options;
119
+ options = {};
175
120
  }
176
- Object.defineProperty(styles$1, groupName, {
177
- value: group,
178
- enumerable: false
121
+ if (!cb) {
122
+ if (typeof Promise !== "function") throw new TypeError("callback not provided");
123
+ return new Promise(function(resolve, reject) {
124
+ isexe(path, options || {}, function(er, is) {
125
+ if (er) reject(er);
126
+ else resolve(is);
127
+ });
128
+ });
129
+ }
130
+ core(path, options || {}, function(er, is) {
131
+ if (er) {
132
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
133
+ er = null;
134
+ is = false;
135
+ }
136
+ }
137
+ cb(er, is);
179
138
  });
180
139
  }
181
- Object.defineProperty(styles$1, "codes", {
182
- value: codes,
183
- enumerable: false
184
- });
185
- styles$1.color.close = "\x1B[39m";
186
- styles$1.bgColor.close = "\x1B[49m";
187
- styles$1.underlineColor.close = "\x1B[59m";
188
- styles$1.color.ansi = wrapAnsi16();
189
- styles$1.color.ansi256 = wrapAnsi256();
190
- styles$1.color.ansi16m = wrapAnsi16m();
191
- styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
192
- styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
193
- styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
194
- styles$1.underlineColor.ansi = wrapUnderlineAnsi;
195
- styles$1.underlineColor.ansi256 = wrapAnsi256(ANSI_UNDERLINE_OFFSET);
196
- styles$1.underlineColor.ansi16m = wrapAnsi16m(ANSI_UNDERLINE_OFFSET);
197
- Object.defineProperties(styles$1, {
198
- rgbToAnsi256: {
199
- value(red, green, blue) {
200
- if (red === green && green === blue) {
201
- if (red < 8) return 16;
202
- if (red > 248) return 231;
203
- return Math.round((red - 8) / 247 * 24) + 232;
204
- }
205
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
206
- },
207
- enumerable: false
208
- },
209
- hexToRgb: {
210
- value(hex) {
211
- const matches = /[\da-f]{6}|[\da-f]{3}/i.exec(hex.toString(16));
212
- if (!matches) return [
213
- 0,
214
- 0,
215
- 0
216
- ];
217
- let [colorString] = matches;
218
- if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
219
- const integer = Number.parseInt(colorString, 16);
220
- return [
221
- integer >> 16 & 255,
222
- integer >> 8 & 255,
223
- integer & 255
224
- ];
225
- },
226
- enumerable: false
227
- },
228
- hexToAnsi256: {
229
- value: (hex) => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
230
- enumerable: false
231
- },
232
- ansi256ToAnsi: {
233
- value(code) {
234
- if (code < 8) return 30 + code;
235
- if (code < 16) return 90 + (code - 8);
236
- let red;
237
- let green;
238
- let blue;
239
- if (code >= 232) {
240
- red = ((code - 232) * 10 + 8) / 255;
241
- green = red;
242
- blue = red;
243
- } else {
244
- code -= 16;
245
- const remainder = code % 36;
246
- red = Math.floor(code / 36) / 5;
247
- green = Math.floor(remainder / 6) / 5;
248
- blue = remainder % 6 / 5;
140
+ function sync(path, options) {
141
+ try {
142
+ return core.sync(path, options || {});
143
+ } catch (er) {
144
+ if (options && options.ignoreErrors || er.code === "EACCES") return false;
145
+ else throw er;
146
+ }
147
+ }
148
+ }));
149
+ //#endregion
150
+ //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
151
+ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
152
+ const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
153
+ const path$5 = __require("path");
154
+ const COLON = isWindows ? ";" : ":";
155
+ const isexe = require_isexe();
156
+ const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
157
+ const getPathInfo = (cmd, opt) => {
158
+ const colon = opt.colon || COLON;
159
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
160
+ /* istanbul ignore next: very unusual */ "").split(colon)];
161
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
162
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
163
+ if (isWindows) {
164
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
165
+ }
166
+ return {
167
+ pathEnv,
168
+ pathExt,
169
+ pathExtExe
170
+ };
171
+ };
172
+ const which = (cmd, opt, cb) => {
173
+ if (typeof opt === "function") {
174
+ cb = opt;
175
+ opt = {};
176
+ }
177
+ if (!opt) opt = {};
178
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
179
+ const found = [];
180
+ const step = (i) => new Promise((resolve, reject) => {
181
+ if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
182
+ const ppRaw = pathEnv[i];
183
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
184
+ const pCmd = path$5.join(pathPart, cmd);
185
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
186
+ resolve(subStep(p, i, 0));
187
+ });
188
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
189
+ if (ii === pathExt.length) return resolve(step(i + 1));
190
+ const ext = pathExt[ii];
191
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
192
+ if (!er && is) {
193
+ if (opt.all) found.push(p + ext);
194
+ else return resolve(p + ext);
249
195
  }
250
- const value = Math.max(red, green, blue) * 2;
251
- if (value === 0) return 30;
252
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
253
- if (value === 2) result += 60;
254
- return result;
255
- },
256
- enumerable: false
257
- },
258
- rgbToAnsi: {
259
- value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
260
- enumerable: false
261
- },
262
- hexToAnsi: {
263
- value: (hex) => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
264
- enumerable: false
196
+ return resolve(subStep(p, i, ii + 1));
197
+ });
198
+ });
199
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
200
+ };
201
+ const whichSync = (cmd, opt) => {
202
+ opt = opt || {};
203
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
204
+ const found = [];
205
+ for (let i = 0; i < pathEnv.length; i++) {
206
+ const ppRaw = pathEnv[i];
207
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
208
+ const pCmd = path$5.join(pathPart, cmd);
209
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
210
+ for (let j = 0; j < pathExt.length; j++) {
211
+ const cur = p + pathExt[j];
212
+ try {
213
+ if (isexe.sync(cur, { pathExt: pathExtExe })) {
214
+ if (opt.all) found.push(cur);
215
+ else return cur;
216
+ }
217
+ } catch (ex) {}
218
+ }
265
219
  }
266
- });
267
- return styles$1;
268
- }
269
- const ansiStyles = assembleStyles();
220
+ if (opt.all && found.length) return found;
221
+ if (opt.nothrow) return null;
222
+ throw getNotFoundError(cmd);
223
+ };
224
+ module.exports = which;
225
+ which.sync = whichSync;
226
+ }));
270
227
  //#endregion
271
- //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/supports-color/index.js
272
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
273
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
274
- const position = argv.indexOf(prefix + flag);
275
- const terminatorPosition = argv.indexOf("--");
276
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
277
- }
278
- const { env } = process$1;
279
- let flagForceColor;
280
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
281
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
282
- function hasNumericForceColor() {
283
- return /^\d+$/.test(env.FORCE_COLOR);
284
- }
285
- function envForceColor() {
286
- if (!("FORCE_COLOR" in env)) return;
287
- if (env.FORCE_COLOR === "false") return 0;
288
- if (env.FORCE_COLOR === "true" || env.FORCE_COLOR.length === 0) return 1;
289
- if (!hasNumericForceColor()) return;
290
- return Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
291
- }
292
- function translateLevel(level) {
293
- if (level === 0) return false;
294
- return {
295
- level,
296
- hasBasic: true,
297
- has256: level >= 2,
298
- has16m: level >= 3
228
+ //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
229
+ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
230
+ const pathKey = (options = {}) => {
231
+ const environment = options.env || process.env;
232
+ if ((options.platform || process.platform) !== "win32") return "PATH";
233
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
299
234
  };
300
- }
301
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
302
- const noFlagForceColor = envForceColor();
303
- if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
304
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
305
- if (forceColor === 0) return 0;
306
- if (sniffFlags) {
307
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
308
- if (hasFlag("color=256")) return 2;
235
+ module.exports = pathKey;
236
+ module.exports.default = pathKey;
237
+ }));
238
+ //#endregion
239
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
240
+ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
241
+ const path$4 = __require("path");
242
+ const which = require_which();
243
+ const getPathKey = require_path_key();
244
+ function resolveCommandAttempt(parsed, withoutPathExt) {
245
+ const env = parsed.options.env || process.env;
246
+ const cwd = process.cwd();
247
+ const hasCustomCwd = parsed.options.cwd != null;
248
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
249
+ if (shouldSwitchCwd) try {
250
+ process.chdir(parsed.options.cwd);
251
+ } catch (err) {}
252
+ let resolved;
253
+ try {
254
+ resolved = which.sync(parsed.command, {
255
+ path: env[getPathKey({ env })],
256
+ pathExt: withoutPathExt ? path$4.delimiter : void 0
257
+ });
258
+ } catch (e) {} finally {
259
+ if (shouldSwitchCwd) process.chdir(cwd);
260
+ }
261
+ if (resolved) resolved = path$4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
262
+ return resolved;
309
263
  }
310
- if (forceColor !== void 0 && hasNumericForceColor()) return forceColor;
311
- if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
312
- if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
313
- const min = forceColor || 0;
314
- if (env.TERM === "dumb") return min;
315
- if (process$1.platform === "win32") {
316
- const osRelease = os.release().split(".");
317
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
318
- return 1;
264
+ function resolveCommand(parsed) {
265
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
319
266
  }
320
- if ("CI" in env) {
321
- if ([
322
- "GITHUB_ACTIONS",
323
- "GITEA_ACTIONS",
324
- "CIRCLECI"
325
- ].some((key) => key in env)) return 3;
326
- if ([
327
- "TRAVIS",
328
- "APPVEYOR",
329
- "GITLAB_CI",
330
- "BUILDKITE",
331
- "DRONE"
332
- ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
333
- return min;
267
+ module.exports = resolveCommand;
268
+ }));
269
+ //#endregion
270
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
271
+ var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
272
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
273
+ function escapeCommand(arg) {
274
+ arg = arg.replace(metaCharsRegExp, "^$1");
275
+ return arg;
334
276
  }
335
- if ("TEAMCITY_VERSION" in env) return /^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
336
- if (env.COLORTERM === "truecolor") return 3;
337
- if (env.TERM === "xterm-kitty") return 3;
338
- if (env.TERM === "xterm-ghostty") return 3;
339
- if (env.TERM === "wezterm") return 3;
340
- if ("TERM_PROGRAM" in env) {
341
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".", 1)[0], 10);
342
- switch (env.TERM_PROGRAM) {
343
- case "iTerm.app": return version >= 3 ? 3 : 2;
344
- case "Apple_Terminal": return 2;
345
- }
277
+ function escapeArgument(arg, doubleEscapeMetaChars) {
278
+ arg = `${arg}`;
279
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
280
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
281
+ arg = `"${arg}"`;
282
+ arg = arg.replace(metaCharsRegExp, "^$1");
283
+ if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
284
+ return arg;
346
285
  }
347
- if (/-256(?:color)?$/i.test(env.TERM)) return 2;
348
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
349
- if ("COLORTERM" in env) return 1;
350
- return min;
351
- }
352
- function createSupportsColor(stream, options = {}) {
353
- return translateLevel(_supportsColor(stream, {
354
- streamIsTTY: stream && stream.isTTY,
355
- ...options
356
- }));
357
- }
286
+ module.exports.command = escapeCommand;
287
+ module.exports.argument = escapeArgument;
288
+ }));
358
289
  //#endregion
359
- //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/index.js
360
- const { stdout: stdoutColor, stderr: stderrColor } = {
361
- stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
362
- stderr: createSupportsColor({ isTTY: tty.isatty(2) })
363
- };
364
- const GENERATOR = Symbol("GENERATOR");
365
- const STYLER = Symbol("STYLER");
366
- const IS_EMPTY = Symbol("IS_EMPTY");
367
- const LEVEL = Symbol("LEVEL");
368
- const styles = Object.create(null);
369
- const assertValidLevel = (level) => {
370
- if (!Number.isSafeInteger(level) || level < 0 || level > 3) throw new Error("The `level` should be an integer from 0 to 3");
371
- };
372
- const levelDescriptor = {
373
- enumerable: true,
374
- get() {
375
- return this[LEVEL];
376
- },
377
- set(level) {
378
- assertValidLevel(level);
379
- this[LEVEL] = level;
380
- }
381
- };
382
- const applyOptions = (object, options = {}) => {
383
- if (options.level !== void 0) assertValidLevel(options.level);
384
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
385
- object[LEVEL] = options.level === void 0 ? colorLevel : options.level;
386
- };
387
- const chalkFactory = (options) => {
388
- const chalk = (...strings) => strings.join(" ");
389
- applyOptions(chalk, options);
390
- Object.setPrototypeOf(chalk, createChalk.prototype);
391
- return chalk;
392
- };
393
- function createChalk(options) {
394
- return chalkFactory(options);
395
- }
396
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
397
- for (const [styleName, style] of Object.entries(ansiStyles)) styles[styleName] = { get() {
398
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
399
- Object.defineProperty(this, styleName, { value: builder });
400
- return builder;
401
- } };
402
- styles.visible = { get() {
403
- const builder = createBuilder(this, this[STYLER], true);
404
- Object.defineProperty(this, "visible", { value: builder });
405
- return builder;
406
- } };
407
- const createModelConverters = (model, type) => {
408
- const style = ansiStyles[type];
409
- if (model === "rgb") {
410
- const ansi = (red, green, blue) => style.ansi(ansiStyles.rgbToAnsi(red, green, blue));
411
- const ansi256 = (red, green, blue) => style.ansi256(ansiStyles.rgbToAnsi256(red, green, blue));
412
- return [
413
- ansi,
414
- ansi,
415
- ansi256,
416
- style.ansi16m
417
- ];
418
- }
419
- if (model === "hex") {
420
- const ansi = (hex) => style.ansi(ansiStyles.hexToAnsi(hex));
421
- const ansi256 = (hex) => style.ansi256(ansiStyles.hexToAnsi256(hex));
422
- return [
423
- ansi,
424
- ansi,
425
- ansi256,
426
- (hex) => style.ansi16m(...ansiStyles.hexToRgb(hex))
427
- ];
428
- }
429
- const ansi = (code) => style.ansi(ansiStyles.ansi256ToAnsi(code));
430
- return [
431
- ansi,
432
- ansi,
433
- style.ansi256,
434
- style.ansi256
435
- ];
436
- };
437
- for (const model of [
438
- "rgb",
439
- "hex",
440
- "ansi256"
441
- ]) {
442
- const capitalizedModel = model[0].toUpperCase() + model.slice(1);
443
- for (const [styleName, type] of [
444
- [model, "color"],
445
- ["bg" + capitalizedModel, "bgColor"],
446
- ["underline" + capitalizedModel, "underlineColor"]
447
- ]) {
448
- const { close } = ansiStyles[type];
449
- const converters = createModelConverters(model, type);
450
- styles[styleName] = { get() {
451
- const styleFunction = function(first, second, third) {
452
- const open = converters[this.level](first, second, third);
453
- return createBuilder(this, createStyler(open, close, this[STYLER]), this[IS_EMPTY]);
454
- };
455
- Object.defineProperty(this, styleName, { value: styleFunction });
456
- return styleFunction;
457
- } };
290
+ //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
291
+ var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292
+ module.exports = /^#!(.*)/;
293
+ }));
294
+ //#endregion
295
+ //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
296
+ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
297
+ const shebangRegex = require_shebang_regex();
298
+ module.exports = (string = "") => {
299
+ const match = string.match(shebangRegex);
300
+ if (!match) return null;
301
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
302
+ const binary = path.split("/").pop();
303
+ if (binary === "env") return argument;
304
+ return argument ? `${binary} ${argument}` : binary;
305
+ };
306
+ }));
307
+ //#endregion
308
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
309
+ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
310
+ const fs$2 = __require("fs");
311
+ const shebangCommand = require_shebang_command();
312
+ function readShebang(command) {
313
+ const size = 150;
314
+ const buffer = Buffer.alloc(size);
315
+ let fd;
316
+ try {
317
+ fd = fs$2.openSync(command, "r");
318
+ fs$2.readSync(fd, buffer, 0, size, 0);
319
+ fs$2.closeSync(fd);
320
+ } catch (e) {}
321
+ return shebangCommand(buffer.toString());
458
322
  }
459
- }
460
- const proto = Object.defineProperties(() => {}, {
461
- ...styles,
462
- level: {
463
- enumerable: true,
464
- get() {
465
- return this[GENERATOR].level;
466
- },
467
- set(level) {
468
- this[GENERATOR].level = level;
323
+ module.exports = readShebang;
324
+ }));
325
+ //#endregion
326
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
327
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
328
+ const path$3 = __require("path");
329
+ const resolveCommand = require_resolveCommand();
330
+ const escape = require_escape();
331
+ const readShebang = require_readShebang();
332
+ const isWin = process.platform === "win32";
333
+ const isExecutableRegExp = /\.(?:com|exe)$/i;
334
+ const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
335
+ function detectShebang(parsed) {
336
+ parsed.file = resolveCommand(parsed);
337
+ const shebang = parsed.file && readShebang(parsed.file);
338
+ if (shebang) {
339
+ parsed.args.unshift(parsed.file);
340
+ parsed.command = shebang;
341
+ return resolveCommand(parsed);
469
342
  }
343
+ return parsed.file;
470
344
  }
471
- });
472
- const createStyler = (open, close, parent) => {
473
- let openAll;
474
- let closeAll;
475
- if (parent === void 0) {
476
- openAll = open;
477
- closeAll = close;
478
- } else {
479
- openAll = parent.openAll + open;
480
- closeAll = close + parent.closeAll;
345
+ function parseNonShell(parsed) {
346
+ if (!isWin) return parsed;
347
+ const commandFile = detectShebang(parsed);
348
+ const needsShell = !isExecutableRegExp.test(commandFile);
349
+ if (parsed.options.forceShell || needsShell) {
350
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
351
+ parsed.command = path$3.normalize(parsed.command);
352
+ parsed.command = escape.command(parsed.command);
353
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
354
+ parsed.args = [
355
+ "/d",
356
+ "/s",
357
+ "/c",
358
+ `"${[parsed.command].concat(parsed.args).join(" ")}"`
359
+ ];
360
+ parsed.command = process.env.comspec || "cmd.exe";
361
+ parsed.options.windowsVerbatimArguments = true;
362
+ }
363
+ return parsed;
481
364
  }
482
- return {
483
- open,
484
- close,
485
- openAll,
486
- closeAll,
487
- parent
488
- };
489
- };
490
- const createBuilder = (self, _styler, _isEmpty) => {
491
- const builder = (...arguments_) => {
492
- if (arguments_.length === 1) return applyStyle(builder, "" + arguments_[0]);
493
- if (arguments_.length === 2) return applyStyle(builder, `${arguments_[0] ?? ""} ${arguments_[1] ?? ""}`);
494
- return applyStyle(builder, arguments_.join(" "));
495
- };
496
- Object.setPrototypeOf(builder, proto);
497
- builder[GENERATOR] = self[GENERATOR] ?? self;
498
- builder[STYLER] = _styler;
499
- builder[IS_EMPTY] = _isEmpty;
500
- return builder;
501
- };
502
- const applyStyle = (self, string) => {
503
- if (self[GENERATOR][LEVEL] <= 0 || !string) return self[IS_EMPTY] ? "" : string;
504
- let styler = self[STYLER];
505
- if (styler === void 0) return string;
506
- const { openAll, closeAll } = styler;
507
- if (string.includes("\x1B")) while (styler !== void 0) {
508
- string = stringReplaceAll(string, styler.close, styler.open);
509
- styler = styler.parent;
365
+ function parse(command, args, options) {
366
+ if (args && !Array.isArray(args)) {
367
+ options = args;
368
+ args = null;
369
+ }
370
+ args = args ? args.slice(0) : [];
371
+ options = Object.assign({}, options);
372
+ const parsed = {
373
+ command,
374
+ args,
375
+ options,
376
+ file: void 0,
377
+ original: {
378
+ command,
379
+ args
380
+ }
381
+ };
382
+ return options.shell ? parsed : parseNonShell(parsed);
510
383
  }
511
- const lfIndex = string.indexOf("\n");
512
- if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
513
- return openAll + string + closeAll;
514
- };
515
- Object.defineProperties(createChalk.prototype, {
516
- ...styles,
517
- level: levelDescriptor
518
- });
519
- const chalk = createChalk();
520
- createChalk({ level: stderrColor ? stderrColor.level : 0 });
384
+ module.exports = parse;
385
+ }));
521
386
  //#endregion
522
- //#region ../../node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
387
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
388
+ var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
389
+ const isWin = process.platform === "win32";
390
+ function notFoundError(original, syscall) {
391
+ return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
392
+ code: "ENOENT",
393
+ errno: "ENOENT",
394
+ syscall: `${syscall} ${original.command}`,
395
+ path: original.command,
396
+ spawnargs: original.args
397
+ });
398
+ }
399
+ function hookChildProcess(cp, parsed) {
400
+ if (!isWin) return;
401
+ const originalEmit = cp.emit;
402
+ cp.emit = function(name, arg1) {
403
+ if (name === "exit") {
404
+ const err = verifyENOENT(arg1, parsed);
405
+ if (err) return originalEmit.call(cp, "error", err);
406
+ }
407
+ return originalEmit.apply(cp, arguments);
408
+ };
409
+ }
410
+ function verifyENOENT(status, parsed) {
411
+ if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
412
+ return null;
413
+ }
414
+ function verifyENOENTSync(status, parsed) {
415
+ if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
416
+ return null;
417
+ }
418
+ module.exports = {
419
+ hookChildProcess,
420
+ verifyENOENT,
421
+ verifyENOENTSync,
422
+ notFoundError
423
+ };
424
+ }));
425
+ //#endregion
426
+ //#region src/lib/crossSpawn.ts
427
+ var import_cross_spawn = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
428
+ const cp = __require("child_process");
429
+ const parse = require_parse();
430
+ const enoent = require_enoent();
431
+ function spawn(command, args, options) {
432
+ const parsed = parse(command, args, options);
433
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
434
+ enoent.hookChildProcess(spawned, parsed);
435
+ return spawned;
436
+ }
437
+ function spawnSync(command, args, options) {
438
+ const parsed = parse(command, args, options);
439
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
440
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
441
+ return result;
442
+ }
443
+ module.exports = spawn;
444
+ module.exports.spawn = spawn;
445
+ module.exports.sync = spawnSync;
446
+ module.exports._parse = parse;
447
+ module.exports._enoent = enoent;
448
+ })))(), 1);
449
+ function spawnSync(command, args, options) {
450
+ return import_cross_spawn.default.sync(command, args, options);
451
+ }
452
+ //#endregion
453
+ //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/utilities.js
454
+ function stringReplaceAll(string, substring, postfix) {
455
+ let index = string.indexOf(substring);
456
+ if (index === -1) return string;
457
+ const substringLength = substring.length;
458
+ let endIndex = 0;
459
+ let returnValue = "";
460
+ do {
461
+ returnValue += string.slice(endIndex, index) + substring + postfix;
462
+ endIndex = index + substringLength;
463
+ index = string.indexOf(substring, endIndex);
464
+ } while (index !== -1);
465
+ returnValue += string.slice(endIndex);
466
+ return returnValue;
467
+ }
468
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
469
+ let endIndex = 0;
470
+ let returnValue = "";
471
+ do {
472
+ const isGotCR = string[index - 1] === "\r";
473
+ returnValue += string.slice(endIndex, isGotCR ? index - 1 : index) + prefix + (isGotCR ? "\r\n" : "\n") + postfix;
474
+ endIndex = index + 1;
475
+ index = string.indexOf("\n", endIndex);
476
+ } while (index !== -1);
477
+ returnValue += string.slice(endIndex);
478
+ return returnValue;
479
+ }
480
+ //#endregion
481
+ //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/ansi-styles/index.js
482
+ const ANSI_BACKGROUND_OFFSET = 10;
483
+ const ANSI_UNDERLINE_OFFSET = 20;
484
+ const wrapAnsi16 = (offset = 0) => (code) => `\u{1B}[${code + offset}m`;
485
+ const wrapAnsi256 = (offset = 0) => (code) => `\u{1B}[${38 + offset};5;${code}m`;
486
+ const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u{1B}[${38 + offset};2;${red};${green};${blue}m`;
487
+ const wrapUnderlineAnsi = (code) => `\u{1B}[58;5;${code < 90 ? code - 30 : code - 90 + 8}m`;
488
+ const styles$1 = {
489
+ modifier: {
490
+ reset: [0, 0],
491
+ bold: [1, 22],
492
+ dim: [2, 22],
493
+ italic: [3, 23],
494
+ underline: [4, 24],
495
+ underlineDouble: ["4:2", 24],
496
+ underlineCurly: ["4:3", 24],
497
+ underlineDotted: ["4:4", 24],
498
+ underlineDashed: ["4:5", 24],
499
+ overline: [53, 55],
500
+ inverse: [7, 27],
501
+ hidden: [8, 28],
502
+ strikethrough: [9, 29]
503
+ },
504
+ color: {
505
+ black: [30, 39],
506
+ red: [31, 39],
507
+ green: [32, 39],
508
+ yellow: [33, 39],
509
+ blue: [34, 39],
510
+ magenta: [35, 39],
511
+ cyan: [36, 39],
512
+ white: [37, 39],
513
+ blackBright: [90, 39],
514
+ gray: [90, 39],
515
+ grey: [90, 39],
516
+ redBright: [91, 39],
517
+ greenBright: [92, 39],
518
+ yellowBright: [93, 39],
519
+ blueBright: [94, 39],
520
+ magentaBright: [95, 39],
521
+ cyanBright: [96, 39],
522
+ whiteBright: [97, 39]
523
+ },
524
+ bgColor: {
525
+ bgBlack: [40, 49],
526
+ bgRed: [41, 49],
527
+ bgGreen: [42, 49],
528
+ bgYellow: [43, 49],
529
+ bgBlue: [44, 49],
530
+ bgMagenta: [45, 49],
531
+ bgCyan: [46, 49],
532
+ bgWhite: [47, 49],
533
+ bgBlackBright: [100, 49],
534
+ bgGray: [100, 49],
535
+ bgGrey: [100, 49],
536
+ bgRedBright: [101, 49],
537
+ bgGreenBright: [102, 49],
538
+ bgYellowBright: [103, 49],
539
+ bgBlueBright: [104, 49],
540
+ bgMagentaBright: [105, 49],
541
+ bgCyanBright: [106, 49],
542
+ bgWhiteBright: [107, 49]
543
+ },
544
+ underlineColor: {
545
+ underlineBlack: ["58;5;0", 59],
546
+ underlineRed: ["58;5;1", 59],
547
+ underlineGreen: ["58;5;2", 59],
548
+ underlineYellow: ["58;5;3", 59],
549
+ underlineBlue: ["58;5;4", 59],
550
+ underlineMagenta: ["58;5;5", 59],
551
+ underlineCyan: ["58;5;6", 59],
552
+ underlineWhite: ["58;5;7", 59],
553
+ underlineBlackBright: ["58;5;8", 59],
554
+ underlineGray: ["58;5;8", 59],
555
+ underlineGrey: ["58;5;8", 59],
556
+ underlineRedBright: ["58;5;9", 59],
557
+ underlineGreenBright: ["58;5;10", 59],
558
+ underlineYellowBright: ["58;5;11", 59],
559
+ underlineBlueBright: ["58;5;12", 59],
560
+ underlineMagentaBright: ["58;5;13", 59],
561
+ underlineCyanBright: ["58;5;14", 59],
562
+ underlineWhiteBright: ["58;5;15", 59]
563
+ }
564
+ };
565
+ Object.keys(styles$1.modifier);
566
+ const foregroundColorNames = Object.keys(styles$1.color);
567
+ const backgroundColorNames = Object.keys(styles$1.bgColor);
568
+ Object.keys(styles$1.underlineColor);
569
+ [...foregroundColorNames, ...backgroundColorNames];
570
+ function assembleStyles() {
571
+ const codes = /* @__PURE__ */ new Map();
572
+ for (const [groupName, group] of Object.entries(styles$1)) {
573
+ for (const [styleName, style] of Object.entries(group)) {
574
+ styles$1[styleName] = {
575
+ open: `\u{1B}[${style[0]}m`,
576
+ close: `\u{1B}[${style[1]}m`
577
+ };
578
+ group[styleName] = styles$1[styleName];
579
+ codes.set(Number.parseInt(style[0], 10), style[1]);
580
+ }
581
+ Object.defineProperty(styles$1, groupName, {
582
+ value: group,
583
+ enumerable: false
584
+ });
585
+ }
586
+ Object.defineProperty(styles$1, "codes", {
587
+ value: codes,
588
+ enumerable: false
589
+ });
590
+ styles$1.color.close = "\x1B[39m";
591
+ styles$1.bgColor.close = "\x1B[49m";
592
+ styles$1.underlineColor.close = "\x1B[59m";
593
+ styles$1.color.ansi = wrapAnsi16();
594
+ styles$1.color.ansi256 = wrapAnsi256();
595
+ styles$1.color.ansi16m = wrapAnsi16m();
596
+ styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
597
+ styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
598
+ styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
599
+ styles$1.underlineColor.ansi = wrapUnderlineAnsi;
600
+ styles$1.underlineColor.ansi256 = wrapAnsi256(ANSI_UNDERLINE_OFFSET);
601
+ styles$1.underlineColor.ansi16m = wrapAnsi16m(ANSI_UNDERLINE_OFFSET);
602
+ Object.defineProperties(styles$1, {
603
+ rgbToAnsi256: {
604
+ value(red, green, blue) {
605
+ if (red === green && green === blue) {
606
+ if (red < 8) return 16;
607
+ if (red > 248) return 231;
608
+ return Math.round((red - 8) / 247 * 24) + 232;
609
+ }
610
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
611
+ },
612
+ enumerable: false
613
+ },
614
+ hexToRgb: {
615
+ value(hex) {
616
+ const matches = /[\da-f]{6}|[\da-f]{3}/i.exec(hex.toString(16));
617
+ if (!matches) return [
618
+ 0,
619
+ 0,
620
+ 0
621
+ ];
622
+ let [colorString] = matches;
623
+ if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
624
+ const integer = Number.parseInt(colorString, 16);
625
+ return [
626
+ integer >> 16 & 255,
627
+ integer >> 8 & 255,
628
+ integer & 255
629
+ ];
630
+ },
631
+ enumerable: false
632
+ },
633
+ hexToAnsi256: {
634
+ value: (hex) => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
635
+ enumerable: false
636
+ },
637
+ ansi256ToAnsi: {
638
+ value(code) {
639
+ if (code < 8) return 30 + code;
640
+ if (code < 16) return 90 + (code - 8);
641
+ let red;
642
+ let green;
643
+ let blue;
644
+ if (code >= 232) {
645
+ red = ((code - 232) * 10 + 8) / 255;
646
+ green = red;
647
+ blue = red;
648
+ } else {
649
+ code -= 16;
650
+ const remainder = code % 36;
651
+ red = Math.floor(code / 36) / 5;
652
+ green = Math.floor(remainder / 6) / 5;
653
+ blue = remainder % 6 / 5;
654
+ }
655
+ const value = Math.max(red, green, blue) * 2;
656
+ if (value === 0) return 30;
657
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
658
+ if (value === 2) result += 60;
659
+ return result;
660
+ },
661
+ enumerable: false
662
+ },
663
+ rgbToAnsi: {
664
+ value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
665
+ enumerable: false
666
+ },
667
+ hexToAnsi: {
668
+ value: (hex) => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
669
+ enumerable: false
670
+ }
671
+ });
672
+ return styles$1;
673
+ }
674
+ const ansiStyles = assembleStyles();
675
+ //#endregion
676
+ //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/supports-color/index.js
677
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
678
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
679
+ const position = argv.indexOf(prefix + flag);
680
+ const terminatorPosition = argv.indexOf("--");
681
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
682
+ }
683
+ const { env } = process$1;
684
+ let flagForceColor;
685
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
686
+ else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
687
+ function hasNumericForceColor() {
688
+ return /^\d+$/.test(env.FORCE_COLOR);
689
+ }
690
+ function envForceColor() {
691
+ if (!("FORCE_COLOR" in env)) return;
692
+ if (env.FORCE_COLOR === "false") return 0;
693
+ if (env.FORCE_COLOR === "true" || env.FORCE_COLOR.length === 0) return 1;
694
+ if (!hasNumericForceColor()) return;
695
+ return Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
696
+ }
697
+ function translateLevel(level) {
698
+ if (level === 0) return false;
699
+ return {
700
+ level,
701
+ hasBasic: true,
702
+ has256: level >= 2,
703
+ has16m: level >= 3
704
+ };
705
+ }
706
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
707
+ const noFlagForceColor = envForceColor();
708
+ if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
709
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
710
+ if (forceColor === 0) return 0;
711
+ if (sniffFlags) {
712
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
713
+ if (hasFlag("color=256")) return 2;
714
+ }
715
+ if (forceColor !== void 0 && hasNumericForceColor()) return forceColor;
716
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
717
+ if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
718
+ const min = forceColor || 0;
719
+ if (env.TERM === "dumb") return min;
720
+ if (process$1.platform === "win32") {
721
+ const osRelease = os.release().split(".");
722
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
723
+ return 1;
724
+ }
725
+ if ("CI" in env) {
726
+ if ([
727
+ "GITHUB_ACTIONS",
728
+ "GITEA_ACTIONS",
729
+ "CIRCLECI"
730
+ ].some((key) => key in env)) return 3;
731
+ if ([
732
+ "TRAVIS",
733
+ "APPVEYOR",
734
+ "GITLAB_CI",
735
+ "BUILDKITE",
736
+ "DRONE"
737
+ ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
738
+ return min;
739
+ }
740
+ if ("TEAMCITY_VERSION" in env) return /^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
741
+ if (env.COLORTERM === "truecolor") return 3;
742
+ if (env.TERM === "xterm-kitty") return 3;
743
+ if (env.TERM === "xterm-ghostty") return 3;
744
+ if (env.TERM === "wezterm") return 3;
745
+ if ("TERM_PROGRAM" in env) {
746
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".", 1)[0], 10);
747
+ switch (env.TERM_PROGRAM) {
748
+ case "iTerm.app": return version >= 3 ? 3 : 2;
749
+ case "Apple_Terminal": return 2;
750
+ }
751
+ }
752
+ if (/-256(?:color)?$/i.test(env.TERM)) return 2;
753
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
754
+ if ("COLORTERM" in env) return 1;
755
+ return min;
756
+ }
757
+ function createSupportsColor(stream, options = {}) {
758
+ return translateLevel(_supportsColor(stream, {
759
+ streamIsTTY: stream && stream.isTTY,
760
+ ...options
761
+ }));
762
+ }
763
+ //#endregion
764
+ //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/index.js
765
+ const { stdout: stdoutColor, stderr: stderrColor } = {
766
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
767
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
768
+ };
769
+ const GENERATOR = Symbol("GENERATOR");
770
+ const STYLER = Symbol("STYLER");
771
+ const IS_EMPTY = Symbol("IS_EMPTY");
772
+ const LEVEL = Symbol("LEVEL");
773
+ const styles = Object.create(null);
774
+ const assertValidLevel = (level) => {
775
+ if (!Number.isSafeInteger(level) || level < 0 || level > 3) throw new Error("The `level` should be an integer from 0 to 3");
776
+ };
777
+ const levelDescriptor = {
778
+ enumerable: true,
779
+ get() {
780
+ return this[LEVEL];
781
+ },
782
+ set(level) {
783
+ assertValidLevel(level);
784
+ this[LEVEL] = level;
785
+ }
786
+ };
787
+ const applyOptions = (object, options = {}) => {
788
+ if (options.level !== void 0) assertValidLevel(options.level);
789
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
790
+ object[LEVEL] = options.level === void 0 ? colorLevel : options.level;
791
+ };
792
+ const chalkFactory = (options) => {
793
+ const chalk = (...strings) => strings.join(" ");
794
+ applyOptions(chalk, options);
795
+ Object.setPrototypeOf(chalk, createChalk.prototype);
796
+ return chalk;
797
+ };
798
+ function createChalk(options) {
799
+ return chalkFactory(options);
800
+ }
801
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
802
+ for (const [styleName, style] of Object.entries(ansiStyles)) styles[styleName] = { get() {
803
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
804
+ Object.defineProperty(this, styleName, { value: builder });
805
+ return builder;
806
+ } };
807
+ styles.visible = { get() {
808
+ const builder = createBuilder(this, this[STYLER], true);
809
+ Object.defineProperty(this, "visible", { value: builder });
810
+ return builder;
811
+ } };
812
+ const createModelConverters = (model, type) => {
813
+ const style = ansiStyles[type];
814
+ if (model === "rgb") {
815
+ const ansi = (red, green, blue) => style.ansi(ansiStyles.rgbToAnsi(red, green, blue));
816
+ const ansi256 = (red, green, blue) => style.ansi256(ansiStyles.rgbToAnsi256(red, green, blue));
817
+ return [
818
+ ansi,
819
+ ansi,
820
+ ansi256,
821
+ style.ansi16m
822
+ ];
823
+ }
824
+ if (model === "hex") {
825
+ const ansi = (hex) => style.ansi(ansiStyles.hexToAnsi(hex));
826
+ const ansi256 = (hex) => style.ansi256(ansiStyles.hexToAnsi256(hex));
827
+ return [
828
+ ansi,
829
+ ansi,
830
+ ansi256,
831
+ (hex) => style.ansi16m(...ansiStyles.hexToRgb(hex))
832
+ ];
833
+ }
834
+ const ansi = (code) => style.ansi(ansiStyles.ansi256ToAnsi(code));
835
+ return [
836
+ ansi,
837
+ ansi,
838
+ style.ansi256,
839
+ style.ansi256
840
+ ];
841
+ };
842
+ for (const model of [
843
+ "rgb",
844
+ "hex",
845
+ "ansi256"
846
+ ]) {
847
+ const capitalizedModel = model[0].toUpperCase() + model.slice(1);
848
+ for (const [styleName, type] of [
849
+ [model, "color"],
850
+ ["bg" + capitalizedModel, "bgColor"],
851
+ ["underline" + capitalizedModel, "underlineColor"]
852
+ ]) {
853
+ const { close } = ansiStyles[type];
854
+ const converters = createModelConverters(model, type);
855
+ styles[styleName] = { get() {
856
+ const styleFunction = function(first, second, third) {
857
+ const open = converters[this.level](first, second, third);
858
+ return createBuilder(this, createStyler(open, close, this[STYLER]), this[IS_EMPTY]);
859
+ };
860
+ Object.defineProperty(this, styleName, { value: styleFunction });
861
+ return styleFunction;
862
+ } };
863
+ }
864
+ }
865
+ const proto = Object.defineProperties(() => {}, {
866
+ ...styles,
867
+ level: {
868
+ enumerable: true,
869
+ get() {
870
+ return this[GENERATOR].level;
871
+ },
872
+ set(level) {
873
+ this[GENERATOR].level = level;
874
+ }
875
+ }
876
+ });
877
+ const createStyler = (open, close, parent) => {
878
+ let openAll;
879
+ let closeAll;
880
+ if (parent === void 0) {
881
+ openAll = open;
882
+ closeAll = close;
883
+ } else {
884
+ openAll = parent.openAll + open;
885
+ closeAll = close + parent.closeAll;
886
+ }
887
+ return {
888
+ open,
889
+ close,
890
+ openAll,
891
+ closeAll,
892
+ parent
893
+ };
894
+ };
895
+ const createBuilder = (self, _styler, _isEmpty) => {
896
+ const builder = (...arguments_) => {
897
+ if (arguments_.length === 1) return applyStyle(builder, "" + arguments_[0]);
898
+ if (arguments_.length === 2) return applyStyle(builder, `${arguments_[0] ?? ""} ${arguments_[1] ?? ""}`);
899
+ return applyStyle(builder, arguments_.join(" "));
900
+ };
901
+ Object.setPrototypeOf(builder, proto);
902
+ builder[GENERATOR] = self[GENERATOR] ?? self;
903
+ builder[STYLER] = _styler;
904
+ builder[IS_EMPTY] = _isEmpty;
905
+ return builder;
906
+ };
907
+ const applyStyle = (self, string) => {
908
+ if (self[GENERATOR][LEVEL] <= 0 || !string) return self[IS_EMPTY] ? "" : string;
909
+ let styler = self[STYLER];
910
+ if (styler === void 0) return string;
911
+ const { openAll, closeAll } = styler;
912
+ if (string.includes("\x1B")) while (styler !== void 0) {
913
+ string = stringReplaceAll(string, styler.close, styler.open);
914
+ styler = styler.parent;
915
+ }
916
+ const lfIndex = string.indexOf("\n");
917
+ if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
918
+ return openAll + string + closeAll;
919
+ };
920
+ Object.defineProperties(createChalk.prototype, {
921
+ ...styles,
922
+ level: levelDescriptor
923
+ });
924
+ const chalk = createChalk();
925
+ createChalk({ level: stderrColor ? stderrColor.level : 0 });
926
+ //#endregion
927
+ //#region ../../node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
523
928
  function Ht(n) {
524
929
  return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
525
930
  }
526
931
  function ps(n) {
527
- return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs$4, de).replace(us, pe);
932
+ return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs$1, de).replace(us, pe);
528
933
  }
529
934
  function ms(n) {
530
935
  return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os$2, ",").replace(hs, ".");
@@ -616,7 +1021,7 @@ function Ut(n, t = {}) {
616
1021
  function es(n, t = {}) {
617
1022
  return new I(n, t).iterate();
618
1023
  }
619
- var Gt, ce, ss, fe, ue, qt, de, pe, is, rs, ns, os$2, hs, as, ls, cs, fs$4, us, ds, at, Ss, lt, Es, we, ye, W, xs, be, vs, Ct, Cs, Ts, As, ks, Kt, Se, Ee, Q, tt, O, Rs, Os, Fs, Ds, Ms, Ns, _s, Ls, Ws, Ps, js, Is, zs, Bs, Us, $s, Gs, Hs, Ce, Te, Ae, xe, A, Vs, Ys, Xs, Js, N, Zs, ke, Qs, ti, ve, ei, D, si, Oe, Vt, Fe, At, Re, ii, q, De, Tt, ri, ft, Ne, oi, hi, ai, G, H, K, kt, ut, Rt, _e, Ot, Le, P, et, v, dt, st, C, F, T, Yt, Ft, k, x, Xt, Jt, We, Zt, B, Qt, Dt, pt, Y, M, mt, li, ci, fi, ui, Mt, te, di, pi, V, vi, wt, Ue, $e, Ri, Oi, L, Ge, He, U, qe, Ke, X, Ve, _, gt, se, je, yt, j, Nt, Lt, Ie, Fi, ie, ze, bt, Be, _t, Wt, ne, Ye, R, Pt, jt, It, it, rt, St, Xe, Di, Mi, Ni, nt, _i, ot, oe, he, ae, Et, Li, zt, xt, vt, Pi, I, le, ji, Ii, zi, Bi, Ui, Ze;
1024
+ var Gt, ce, ss, fe, ue, qt, de, pe, is, rs, ns, os$2, hs, as, ls, cs, fs$1, us, ds, at, Ss, lt, Es, we, ye, W, xs, be, vs, Ct, Cs, Ts, As, ks, Kt, Se, Ee, Q, tt, O, Rs, Os, Fs, Ds, Ms, Ns, _s, Ls, Ws, Ps, js, Is, zs, Bs, Us, $s, Gs, Hs, Ce, Te, Ae, xe, A, Vs, Ys, Xs, Js, N, Zs, ke, Qs, ti, ve, ei, D, si, Oe, Vt, Fe, At, Re, ii, q, De, Tt, ri, ft, Ne, oi, hi, ai, G, H, K, kt, ut, Rt, _e, Ot, Le, P, et, v, dt, st, C, F, T, Yt, Ft, k, x, Xt, Jt, We, Zt, B, Qt, Dt, pt, Y, M, mt, li, ci, fi, ui, Mt, te, di, pi, V, vi, wt, Ue, $e, Ri, Oi, L, Ge, He, U, qe, Ke, X, Ve, _, gt, se, je, yt, j, Nt, Lt, Ie, Fi, ie, ze, bt, Be, _t, Wt, ne, Ye, R, Pt, jt, It, it, rt, St, Xe, Di, Mi, Ni, nt, _i, ot, oe, he, ae, Et, Li, zt, xt, vt, Pi, I, le, ji, Ii, zi, Bi, Ui, Ze;
620
1025
  var init_index_min = __esmMin((() => {
621
1026
  Gt = (n, t, e) => {
622
1027
  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);
@@ -661,7 +1066,7 @@ var init_index_min = __esmMin((() => {
661
1066
  as = /\\\\/g;
662
1067
  ls = /\\{/g;
663
1068
  cs = /\\}/g;
664
- fs$4 = /\\,/g;
1069
+ fs$1 = /\\,/g;
665
1070
  us = /\\./g;
666
1071
  ds = 1e5;
667
1072
  at = (n) => {
@@ -2730,1492 +3135,1087 @@ while (this[Le](this[Ft]()) && this[C].length);
2730
3135
  let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
2731
3136
  return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
2732
3137
  }
2733
- #U(t, e) {
2734
- for (let s = e.provisional; s < e.length; s++) {
2735
- let i = e[s];
2736
- if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
2737
- }
2738
- }
2739
- #l(t, e, s, i) {
2740
- let r = e.name;
2741
- return e.#e = e.#e & gt | ie(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;
2742
- }
2743
- async lstat() {
2744
- if ((this.#e & j) === 0) try {
2745
- return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
2746
- } catch (t) {
2747
- this.#F(t.code);
2748
- }
2749
- }
2750
- lstatSync() {
2751
- if ((this.#e & j) === 0) try {
2752
- return this.#$(this.#t.lstatSync(this.fullpath())), this;
2753
- } catch (t) {
2754
- this.#F(t.code);
2755
- }
2756
- }
2757
- #$(t) {
2758
- 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;
2759
- 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;
2760
- let y = ie(t);
2761
- this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
2762
- }
2763
- #W = [];
2764
- #O = !1;
2765
- #H(t) {
2766
- this.#O = !1;
2767
- let e = this.#W.slice();
2768
- this.#W.length = 0, e.forEach((s) => s(null, t));
2769
- }
2770
- readdirCB(t, e = !1) {
2771
- if (!this.canReaddir()) {
2772
- e ? t(null, []) : queueMicrotask(() => t(null, []));
2773
- return;
2774
- }
2775
- let s = this.children();
2776
- if (this.calledReaddir()) {
2777
- let r = s.slice(0, s.provisional);
2778
- e ? t(null, r) : queueMicrotask(() => t(null, r));
2779
- return;
2780
- }
2781
- if (this.#W.push(t), this.#O) return;
2782
- this.#O = !0;
2783
- let i = this.fullpath();
2784
- this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
2785
- if (r) this.#I(r.code), s.provisional = 0;
2786
- else {
2787
- for (let h of o) this.#z(h, s);
2788
- this.#j(s);
2789
- }
2790
- this.#H(s.slice(0, s.provisional));
2791
- });
2792
- }
2793
- #q;
2794
- async readdir() {
2795
- if (!this.canReaddir()) return [];
2796
- let t = this.children();
2797
- if (this.calledReaddir()) return t.slice(0, t.provisional);
2798
- let e = this.fullpath();
2799
- if (this.#q) await this.#q;
2800
- else {
2801
- let s = () => {};
2802
- this.#q = new Promise((i) => s = i);
2803
- try {
2804
- for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#z(i, t);
2805
- this.#j(t);
2806
- } catch (i) {
2807
- this.#I(i.code), t.provisional = 0;
2808
- }
2809
- this.#q = void 0, s();
2810
- }
2811
- return t.slice(0, t.provisional);
2812
- }
2813
- readdirSync() {
2814
- if (!this.canReaddir()) return [];
2815
- let t = this.children();
2816
- if (this.calledReaddir()) return t.slice(0, t.provisional);
2817
- let e = this.fullpath();
2818
- try {
2819
- for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#z(s, t);
2820
- this.#j(t);
2821
- } catch (s) {
2822
- this.#I(s.code), t.provisional = 0;
2823
- }
2824
- return t.slice(0, t.provisional);
2825
- }
2826
- canReaddir() {
2827
- if (this.#e & Ie) return !1;
2828
- let t = _ & this.#e;
2829
- return t === L || t === U || t === X;
2830
- }
2831
- shouldWalk(t, e) {
2832
- return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
2833
- }
2834
- async realpath() {
2835
- if (this.#k) return this.#k;
2836
- if (!((Lt | Nt | j) & this.#e)) try {
2837
- let t = await this.#t.promises.realpath(this.fullpath());
2838
- return this.#k = this.resolve(t);
2839
- } catch {
2840
- this.#P();
2841
- }
2842
- }
2843
- realpathSync() {
2844
- if (this.#k) return this.#k;
2845
- if (!((Lt | Nt | j) & this.#e)) try {
2846
- let t = this.#t.realpathSync(this.fullpath());
2847
- return this.#k = this.resolve(t);
2848
- } catch {
2849
- this.#P();
2850
- }
2851
- }
2852
- [Ye](t) {
2853
- if (t === this) return;
2854
- t.isCWD = !1, this.isCWD = !0;
2855
- let e = /* @__PURE__ */ new Set([]), s = [], i = this;
2856
- for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
2857
- for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
2858
- }
2859
- };
2860
- Pt = class n extends R {
2861
- sep = "\\";
2862
- splitSep = Oi;
2863
- constructor(t, e = L, s, i, r, o, h) {
2864
- super(t, e, s, i, r, o, h);
2865
- }
2866
- newChild(t, e = L, s = {}) {
2867
- return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2868
- }
2869
- getRootString(t) {
2870
- return win32.parse(t).root;
2871
- }
2872
- getRoot(t) {
2873
- if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
2874
- for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
2875
- return this.roots[t] = new it(t, this).root;
2876
- }
2877
- sameRoot(t, e = this.root.name) {
2878
- return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
2879
- }
2880
- };
2881
- jt = class n extends R {
2882
- splitSep = "/";
2883
- sep = "/";
2884
- constructor(t, e = L, s, i, r, o, h) {
2885
- super(t, e, s, i, r, o, h);
2886
- }
2887
- getRootString(t) {
2888
- return t.startsWith("/") ? "/" : "";
2889
- }
2890
- getRoot(t) {
2891
- return this.root;
2892
- }
2893
- newChild(t, e = L, s = {}) {
2894
- return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2895
- }
2896
- };
2897
- It = class {
2898
- root;
2899
- rootPath;
2900
- roots;
2901
- cwd;
2902
- #t;
2903
- #s;
2904
- #n;
2905
- nocase;
2906
- #r;
2907
- constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16384, fs: o = wt } = {}) {
2908
- this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
2909
- let h = e.resolve(t);
2910
- this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
2911
- let a = h.substring(this.rootPath.length).split(s);
2912
- if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
2913
- this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
2914
- let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = !1;
2915
- for (let m of a) {
2916
- let p = u--;
2917
- l = l.child(m, {
2918
- relative: new Array(p).fill("..").join(c),
2919
- relativePosix: new Array(p).fill("..").join("/"),
2920
- fullpath: d += (f ? "" : c) + m
2921
- }), f = !0;
2922
- }
2923
- this.cwd = l;
2924
- }
2925
- depth(t = this.cwd) {
2926
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
2927
- }
2928
- childrenCache() {
2929
- return this.#n;
2930
- }
2931
- resolve(...t) {
2932
- let e = "";
2933
- for (let r = t.length - 1; r >= 0; r--) {
2934
- let o = t[r];
2935
- if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2936
- }
2937
- let s = this.#t.get(e);
2938
- if (s !== void 0) return s;
2939
- let i = this.cwd.resolve(e).fullpath();
2940
- return this.#t.set(e, i), i;
2941
- }
2942
- resolvePosix(...t) {
2943
- let e = "";
2944
- for (let r = t.length - 1; r >= 0; r--) {
2945
- let o = t[r];
2946
- if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2947
- }
2948
- let s = this.#s.get(e);
2949
- if (s !== void 0) return s;
2950
- let i = this.cwd.resolve(e).fullpathPosix();
2951
- return this.#s.set(e, i), i;
2952
- }
2953
- relative(t = this.cwd) {
2954
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
2955
- }
2956
- relativePosix(t = this.cwd) {
2957
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
2958
- }
2959
- basename(t = this.cwd) {
2960
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
2961
- }
2962
- dirname(t = this.cwd) {
2963
- return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
2964
- }
2965
- async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
2966
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2967
- let { withFileTypes: s } = e;
2968
- if (t.canReaddir()) {
2969
- let i = await t.readdir();
2970
- return s ? i : i.map((r) => r.name);
2971
- } else return [];
2972
- }
2973
- readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
2974
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2975
- let { withFileTypes: s = !0 } = e;
2976
- return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
2977
- }
2978
- async lstat(t = this.cwd) {
2979
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
3138
+ #U(t, e) {
3139
+ for (let s = e.provisional; s < e.length; s++) {
3140
+ let i = e[s];
3141
+ if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
3142
+ }
2980
3143
  }
2981
- lstatSync(t = this.cwd) {
2982
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
3144
+ #l(t, e, s, i) {
3145
+ let r = e.name;
3146
+ return e.#e = e.#e & gt | ie(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;
2983
3147
  }
2984
- async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2985
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2986
- let s = await t.readlink();
2987
- return e ? s : s?.fullpath();
3148
+ async lstat() {
3149
+ if ((this.#e & j) === 0) try {
3150
+ return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
3151
+ } catch (t) {
3152
+ this.#F(t.code);
3153
+ }
2988
3154
  }
2989
- readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2990
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2991
- let s = t.readlinkSync();
2992
- return e ? s : s?.fullpath();
3155
+ lstatSync() {
3156
+ if ((this.#e & j) === 0) try {
3157
+ return this.#$(this.#t.lstatSync(this.fullpath())), this;
3158
+ } catch (t) {
3159
+ this.#F(t.code);
3160
+ }
2993
3161
  }
2994
- async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
2995
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2996
- let s = await t.realpath();
2997
- return e ? s : s?.fullpath();
3162
+ #$(t) {
3163
+ 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;
3164
+ 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;
3165
+ let y = ie(t);
3166
+ this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
2998
3167
  }
2999
- realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3000
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3001
- let s = t.realpathSync();
3002
- return e ? s : s?.fullpath();
3168
+ #W = [];
3169
+ #O = !1;
3170
+ #H(t) {
3171
+ this.#O = !1;
3172
+ let e = this.#W.slice();
3173
+ this.#W.length = 0, e.forEach((s) => s(null, t));
3003
3174
  }
3004
- async walk(t = this.cwd, e = {}) {
3005
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3006
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3007
- (!r || r(t)) && h.push(s ? t : t.fullpath());
3008
- let a = /* @__PURE__ */ new Set(), l = (c, d) => {
3009
- a.add(c), c.readdirCB((f, m) => {
3010
- if (f) return d(f);
3011
- let p = m.length;
3012
- if (!p) return d();
3013
- let w = () => {
3014
- --p === 0 && d();
3015
- };
3016
- 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();
3017
- }, !0);
3018
- }, u = t;
3019
- return new Promise((c, d) => {
3020
- l(u, (f) => {
3021
- if (f) return d(f);
3022
- c(h);
3023
- });
3175
+ readdirCB(t, e = !1) {
3176
+ if (!this.canReaddir()) {
3177
+ e ? t(null, []) : queueMicrotask(() => t(null, []));
3178
+ return;
3179
+ }
3180
+ let s = this.children();
3181
+ if (this.calledReaddir()) {
3182
+ let r = s.slice(0, s.provisional);
3183
+ e ? t(null, r) : queueMicrotask(() => t(null, r));
3184
+ return;
3185
+ }
3186
+ if (this.#W.push(t), this.#O) return;
3187
+ this.#O = !0;
3188
+ let i = this.fullpath();
3189
+ this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
3190
+ if (r) this.#I(r.code), s.provisional = 0;
3191
+ else {
3192
+ for (let h of o) this.#z(h, s);
3193
+ this.#j(s);
3194
+ }
3195
+ this.#H(s.slice(0, s.provisional));
3024
3196
  });
3025
3197
  }
3026
- walkSync(t = this.cwd, e = {}) {
3027
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3028
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3029
- (!r || r(t)) && h.push(s ? t : t.fullpath());
3030
- let a = /* @__PURE__ */ new Set([t]);
3031
- for (let l of a) {
3032
- let u = l.readdirSync();
3033
- for (let c of u) {
3034
- (!r || r(c)) && h.push(s ? c : c.fullpath());
3035
- let d = c;
3036
- if (c.isSymbolicLink()) {
3037
- if (!(i && (d = c.realpathSync()))) continue;
3038
- d.isUnknown() && d.lstatSync();
3039
- }
3040
- d.shouldWalk(a, o) && a.add(d);
3198
+ #q;
3199
+ async readdir() {
3200
+ if (!this.canReaddir()) return [];
3201
+ let t = this.children();
3202
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
3203
+ let e = this.fullpath();
3204
+ if (this.#q) await this.#q;
3205
+ else {
3206
+ let s = () => {};
3207
+ this.#q = new Promise((i) => s = i);
3208
+ try {
3209
+ for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#z(i, t);
3210
+ this.#j(t);
3211
+ } catch (i) {
3212
+ this.#I(i.code), t.provisional = 0;
3041
3213
  }
3214
+ this.#q = void 0, s();
3042
3215
  }
3043
- return h;
3216
+ return t.slice(0, t.provisional);
3044
3217
  }
3045
- [Symbol.asyncIterator]() {
3046
- return this.iterate();
3218
+ readdirSync() {
3219
+ if (!this.canReaddir()) return [];
3220
+ let t = this.children();
3221
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
3222
+ let e = this.fullpath();
3223
+ try {
3224
+ for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#z(s, t);
3225
+ this.#j(t);
3226
+ } catch (s) {
3227
+ this.#I(s.code), t.provisional = 0;
3228
+ }
3229
+ return t.slice(0, t.provisional);
3047
3230
  }
3048
- iterate(t = this.cwd, e = {}) {
3049
- return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
3231
+ canReaddir() {
3232
+ if (this.#e & Ie) return !1;
3233
+ let t = _ & this.#e;
3234
+ return t === L || t === U || t === X;
3050
3235
  }
3051
- [Symbol.iterator]() {
3052
- return this.iterateSync();
3236
+ shouldWalk(t, e) {
3237
+ return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
3053
3238
  }
3054
- *iterateSync(t = this.cwd, e = {}) {
3055
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3056
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
3057
- (!r || r(t)) && (yield s ? t : t.fullpath());
3058
- let h = /* @__PURE__ */ new Set([t]);
3059
- for (let a of h) {
3060
- let l = a.readdirSync();
3061
- for (let u of l) {
3062
- (!r || r(u)) && (yield s ? u : u.fullpath());
3063
- let c = u;
3064
- if (u.isSymbolicLink()) {
3065
- if (!(i && (c = u.realpathSync()))) continue;
3066
- c.isUnknown() && c.lstatSync();
3067
- }
3068
- c.shouldWalk(h, o) && h.add(c);
3069
- }
3239
+ async realpath() {
3240
+ if (this.#k) return this.#k;
3241
+ if (!((Lt | Nt | j) & this.#e)) try {
3242
+ let t = await this.#t.promises.realpath(this.fullpath());
3243
+ return this.#k = this.resolve(t);
3244
+ } catch {
3245
+ this.#P();
3070
3246
  }
3071
3247
  }
3072
- stream(t = this.cwd, e = {}) {
3073
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3074
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
3075
- (!r || r(t)) && h.write(s ? t : t.fullpath());
3076
- let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
3077
- let d = !1;
3078
- for (; !d;) {
3079
- let f = l.shift();
3080
- if (!f) {
3081
- u === 0 && h.end();
3082
- return;
3083
- }
3084
- u++, a.add(f);
3085
- let m = (w, g, S = !1) => {
3086
- if (w) return h.emit("error", w);
3087
- if (i && !S) {
3088
- let E = [];
3089
- for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
3090
- if (E.length) {
3091
- Promise.all(E).then(() => m(null, g, !0));
3092
- return;
3093
- }
3094
- }
3095
- for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = !0));
3096
- u--;
3097
- for (let E of g) {
3098
- let y = E.realpathCached() || E;
3099
- y.shouldWalk(a, o) && l.push(y);
3100
- }
3101
- d && !h.flowing ? h.once("drain", c) : p || c();
3102
- }, p = !0;
3103
- f.readdirCB(m, !0), p = !1;
3104
- }
3105
- };
3106
- return c(), h;
3248
+ realpathSync() {
3249
+ if (this.#k) return this.#k;
3250
+ if (!((Lt | Nt | j) & this.#e)) try {
3251
+ let t = this.#t.realpathSync(this.fullpath());
3252
+ return this.#k = this.resolve(t);
3253
+ } catch {
3254
+ this.#P();
3255
+ }
3107
3256
  }
3108
- streamSync(t = this.cwd, e = {}) {
3109
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3110
- let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
3111
- (!r || r(t)) && h.write(s ? t : t.fullpath());
3112
- let l = [t], u = 0, c = () => {
3113
- let d = !1;
3114
- for (; !d;) {
3115
- let f = l.shift();
3116
- if (!f) {
3117
- u === 0 && h.end();
3118
- return;
3119
- }
3120
- u++, a.add(f);
3121
- let m = f.readdirSync();
3122
- for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = !0));
3123
- u--;
3124
- for (let p of m) {
3125
- let w = p;
3126
- if (p.isSymbolicLink()) {
3127
- if (!(i && (w = p.realpathSync()))) continue;
3128
- w.isUnknown() && w.lstatSync();
3129
- }
3130
- w.shouldWalk(a, o) && l.push(w);
3131
- }
3132
- }
3133
- d && !h.flowing && h.once("drain", c);
3134
- };
3135
- return c(), h;
3257
+ [Ye](t) {
3258
+ if (t === this) return;
3259
+ t.isCWD = !1, this.isCWD = !0;
3260
+ let e = /* @__PURE__ */ new Set([]), s = [], i = this;
3261
+ for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
3262
+ for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
3136
3263
  }
3137
- chdir(t = this.cwd) {
3138
- let e = this.cwd;
3139
- this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
3264
+ };
3265
+ Pt = class n extends R {
3266
+ sep = "\\";
3267
+ splitSep = Oi;
3268
+ constructor(t, e = L, s, i, r, o, h) {
3269
+ super(t, e, s, i, r, o, h);
3140
3270
  }
3141
- };
3142
- it = class extends It {
3143
- sep = "\\";
3144
- constructor(t = process.cwd(), e = {}) {
3145
- let { nocase: s = !0 } = e;
3146
- super(t, win32, "\\", {
3147
- ...e,
3148
- nocase: s
3149
- }), this.nocase = s;
3150
- for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
3271
+ newChild(t, e = L, s = {}) {
3272
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
3151
3273
  }
3152
- parseRootPath(t) {
3153
- return win32.parse(t).root.toUpperCase();
3274
+ getRootString(t) {
3275
+ return win32.parse(t).root;
3154
3276
  }
3155
- newRoot(t) {
3156
- return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3277
+ getRoot(t) {
3278
+ if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
3279
+ for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
3280
+ return this.roots[t] = new it(t, this).root;
3157
3281
  }
3158
- isAbsolute(t) {
3159
- return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
3282
+ sameRoot(t, e = this.root.name) {
3283
+ return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
3160
3284
  }
3161
3285
  };
3162
- rt = class extends It {
3286
+ jt = class n extends R {
3287
+ splitSep = "/";
3163
3288
  sep = "/";
3164
- constructor(t = process.cwd(), e = {}) {
3165
- let { nocase: s = !1 } = e;
3166
- super(t, posix, "/", {
3167
- ...e,
3168
- nocase: s
3169
- }), this.nocase = s;
3170
- }
3171
- parseRootPath(t) {
3172
- return "/";
3289
+ constructor(t, e = L, s, i, r, o, h) {
3290
+ super(t, e, s, i, r, o, h);
3173
3291
  }
3174
- newRoot(t) {
3175
- return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3292
+ getRootString(t) {
3293
+ return t.startsWith("/") ? "/" : "";
3176
3294
  }
3177
- isAbsolute(t) {
3178
- return t.startsWith("/");
3295
+ getRoot(t) {
3296
+ return this.root;
3179
3297
  }
3180
- };
3181
- St = class extends rt {
3182
- constructor(t = process.cwd(), e = {}) {
3183
- let { nocase: s = !0 } = e;
3184
- super(t, {
3185
- ...e,
3186
- nocase: s
3187
- });
3298
+ newChild(t, e = L, s = {}) {
3299
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
3188
3300
  }
3189
3301
  };
3190
- process.platform;
3191
- Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
3192
- Di = (n) => n.length >= 1;
3193
- Mi = (n) => n.length >= 1;
3194
- Ni = Symbol.for("nodejs.util.inspect.custom");
3195
- nt = class n {
3302
+ It = class {
3303
+ root;
3304
+ rootPath;
3305
+ roots;
3306
+ cwd;
3196
3307
  #t;
3197
3308
  #s;
3198
3309
  #n;
3199
- length;
3310
+ nocase;
3200
3311
  #r;
3201
- #o;
3202
- #S;
3203
- #w;
3204
- #c;
3205
- #h;
3206
- #u = !0;
3207
- constructor(t, e, s, i) {
3208
- if (!Di(t)) throw new TypeError("empty pattern list");
3209
- if (!Mi(e)) throw new TypeError("empty glob list");
3210
- if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
3211
- if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
3212
- if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
3213
- if (this.isUNC()) {
3214
- let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
3215
- l[0] === "" && (l.shift(), m.shift());
3216
- let p = [
3217
- r,
3218
- o,
3219
- h,
3220
- a,
3221
- ""
3222
- ].join("/"), w = [
3223
- u,
3224
- c,
3225
- d,
3226
- f,
3227
- ""
3228
- ].join("/");
3229
- this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
3230
- } else if (this.isDrive() || this.isAbsolute()) {
3231
- let [r, ...o] = this.#t, [h, ...a] = this.#s;
3232
- o[0] === "" && (o.shift(), a.shift());
3233
- let l = r + "/", u = h + "/";
3234
- this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
3235
- }
3312
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16384, fs: o = wt } = {}) {
3313
+ this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
3314
+ let h = e.resolve(t);
3315
+ this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
3316
+ let a = h.substring(this.rootPath.length).split(s);
3317
+ if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
3318
+ this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
3319
+ let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = !1;
3320
+ for (let m of a) {
3321
+ let p = u--;
3322
+ l = l.child(m, {
3323
+ relative: new Array(p).fill("..").join(c),
3324
+ relativePosix: new Array(p).fill("..").join("/"),
3325
+ fullpath: d += (f ? "" : c) + m
3326
+ }), f = !0;
3236
3327
  }
3328
+ this.cwd = l;
3237
3329
  }
3238
- [Ni]() {
3239
- return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
3240
- }
3241
- pattern() {
3242
- return this.#t[this.#n];
3243
- }
3244
- isString() {
3245
- return typeof this.#t[this.#n] == "string";
3246
- }
3247
- isGlobstar() {
3248
- return this.#t[this.#n] === A;
3249
- }
3250
- isRegExp() {
3251
- return this.#t[this.#n] instanceof RegExp;
3252
- }
3253
- globString() {
3254
- 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("/"));
3255
- }
3256
- hasMore() {
3257
- return this.length > this.#n + 1;
3258
- }
3259
- rest() {
3260
- 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;
3261
- }
3262
- isUNC() {
3263
- let t = this.#t;
3264
- 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];
3265
- }
3266
- isDrive() {
3267
- let t = this.#t;
3268
- 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]);
3330
+ depth(t = this.cwd) {
3331
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
3269
3332
  }
3270
- isAbsolute() {
3271
- let t = this.#t;
3272
- return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
3333
+ childrenCache() {
3334
+ return this.#n;
3273
3335
  }
3274
- root() {
3275
- let t = this.#t[0];
3276
- return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
3336
+ resolve(...t) {
3337
+ let e = "";
3338
+ for (let r = t.length - 1; r >= 0; r--) {
3339
+ let o = t[r];
3340
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
3341
+ }
3342
+ let s = this.#t.get(e);
3343
+ if (s !== void 0) return s;
3344
+ let i = this.cwd.resolve(e).fullpath();
3345
+ return this.#t.set(e, i), i;
3277
3346
  }
3278
- checkFollowGlobstar() {
3279
- return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
3347
+ resolvePosix(...t) {
3348
+ let e = "";
3349
+ for (let r = t.length - 1; r >= 0; r--) {
3350
+ let o = t[r];
3351
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
3352
+ }
3353
+ let s = this.#s.get(e);
3354
+ if (s !== void 0) return s;
3355
+ let i = this.cwd.resolve(e).fullpathPosix();
3356
+ return this.#s.set(e, i), i;
3280
3357
  }
3281
- markFollowGlobstar() {
3282
- return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
3358
+ relative(t = this.cwd) {
3359
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
3283
3360
  }
3284
- };
3285
- _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3286
- ot = class {
3287
- relative;
3288
- relativeChildren;
3289
- absolute;
3290
- absoluteChildren;
3291
- platform;
3292
- mmopts;
3293
- constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
3294
- this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
3295
- dot: !0,
3296
- nobrace: e,
3297
- nocase: s,
3298
- noext: i,
3299
- noglobstar: r,
3300
- optimizationLevel: 2,
3301
- platform: o,
3302
- nocomment: !0,
3303
- nonegate: !0
3304
- };
3305
- for (let h of t) this.add(h);
3361
+ relativePosix(t = this.cwd) {
3362
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
3306
3363
  }
3307
- add(t) {
3308
- let e = new D(t, this.mmopts);
3309
- for (let s = 0; s < e.set.length; s++) {
3310
- let i = e.set[s], r = e.globParts[s];
3311
- if (!i || !r) throw new Error("invalid pattern object");
3312
- for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
3313
- let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
3314
- l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
3315
- }
3364
+ basename(t = this.cwd) {
3365
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
3316
3366
  }
3317
- ignored(t) {
3318
- let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
3319
- for (let o of this.relative) if (o.match(i) || o.match(r)) return !0;
3320
- for (let o of this.absolute) if (o.match(e) || o.match(s)) return !0;
3321
- return !1;
3367
+ dirname(t = this.cwd) {
3368
+ return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
3322
3369
  }
3323
- childrenIgnored(t) {
3324
- let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
3325
- for (let i of this.relativeChildren) if (i.match(s)) return !0;
3326
- for (let i of this.absoluteChildren) if (i.match(e)) return !0;
3327
- return !1;
3370
+ async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
3371
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3372
+ let { withFileTypes: s } = e;
3373
+ if (t.canReaddir()) {
3374
+ let i = await t.readdir();
3375
+ return s ? i : i.map((r) => r.name);
3376
+ } else return [];
3328
3377
  }
3329
- };
3330
- oe = class n {
3331
- store;
3332
- constructor(t = /* @__PURE__ */ new Map()) {
3333
- this.store = t;
3378
+ readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
3379
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3380
+ let { withFileTypes: s = !0 } = e;
3381
+ return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
3334
3382
  }
3335
- copy() {
3336
- return new n(new Map(this.store));
3383
+ async lstat(t = this.cwd) {
3384
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
3337
3385
  }
3338
- hasWalked(t, e) {
3339
- return this.store.get(t.fullpath())?.has(e.globString());
3386
+ lstatSync(t = this.cwd) {
3387
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
3340
3388
  }
3341
- storeWalked(t, e) {
3342
- let s = t.fullpath(), i = this.store.get(s);
3343
- i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
3389
+ async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3390
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3391
+ let s = await t.readlink();
3392
+ return e ? s : s?.fullpath();
3344
3393
  }
3345
- };
3346
- he = class {
3347
- store = /* @__PURE__ */ new Map();
3348
- add(t, e, s) {
3349
- let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
3350
- this.store.set(t, r === void 0 ? i : i & r);
3394
+ readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3395
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3396
+ let s = t.readlinkSync();
3397
+ return e ? s : s?.fullpath();
3351
3398
  }
3352
- entries() {
3353
- return [...this.store.entries()].map(([t, e]) => [
3354
- t,
3355
- !!(e & 2),
3356
- !!(e & 1)
3357
- ]);
3399
+ async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3400
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3401
+ let s = await t.realpath();
3402
+ return e ? s : s?.fullpath();
3358
3403
  }
3359
- };
3360
- ae = class {
3361
- store = /* @__PURE__ */ new Map();
3362
- add(t, e) {
3363
- if (!t.canReaddir()) return;
3364
- let s = this.store.get(t);
3365
- s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
3404
+ realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3405
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3406
+ let s = t.realpathSync();
3407
+ return e ? s : s?.fullpath();
3366
3408
  }
3367
- get(t) {
3368
- let e = this.store.get(t);
3369
- if (!e) throw new Error("attempting to walk unknown path");
3370
- return e;
3409
+ async walk(t = this.cwd, e = {}) {
3410
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3411
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3412
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
3413
+ let a = /* @__PURE__ */ new Set(), l = (c, d) => {
3414
+ a.add(c), c.readdirCB((f, m) => {
3415
+ if (f) return d(f);
3416
+ let p = m.length;
3417
+ if (!p) return d();
3418
+ let w = () => {
3419
+ --p === 0 && d();
3420
+ };
3421
+ 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();
3422
+ }, !0);
3423
+ }, u = t;
3424
+ return new Promise((c, d) => {
3425
+ l(u, (f) => {
3426
+ if (f) return d(f);
3427
+ c(h);
3428
+ });
3429
+ });
3371
3430
  }
3372
- entries() {
3373
- return this.keys().map((t) => [t, this.store.get(t)]);
3431
+ walkSync(t = this.cwd, e = {}) {
3432
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3433
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3434
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
3435
+ let a = /* @__PURE__ */ new Set([t]);
3436
+ for (let l of a) {
3437
+ let u = l.readdirSync();
3438
+ for (let c of u) {
3439
+ (!r || r(c)) && h.push(s ? c : c.fullpath());
3440
+ let d = c;
3441
+ if (c.isSymbolicLink()) {
3442
+ if (!(i && (d = c.realpathSync()))) continue;
3443
+ d.isUnknown() && d.lstatSync();
3444
+ }
3445
+ d.shouldWalk(a, o) && a.add(d);
3446
+ }
3447
+ }
3448
+ return h;
3374
3449
  }
3375
- keys() {
3376
- return [...this.store.keys()].filter((t) => t.canReaddir());
3450
+ [Symbol.asyncIterator]() {
3451
+ return this.iterate();
3377
3452
  }
3378
- };
3379
- Et = class n {
3380
- hasWalkedCache;
3381
- matches = new he();
3382
- subwalks = new ae();
3383
- patterns;
3384
- follow;
3385
- dot;
3386
- opts;
3387
- constructor(t, e) {
3388
- this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
3453
+ iterate(t = this.cwd, e = {}) {
3454
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
3389
3455
  }
3390
- processPatterns(t, e) {
3391
- this.patterns = e;
3392
- let s = e.map((i) => [t, i]);
3393
- for (let [i, r] of s) {
3394
- this.hasWalkedCache.storeWalked(i, r);
3395
- let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
3396
- if (o) {
3397
- i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
3398
- let c = r.rest();
3399
- if (c) r = c;
3400
- else {
3401
- this.matches.add(i, !0, !1);
3402
- continue;
3456
+ [Symbol.iterator]() {
3457
+ return this.iterateSync();
3458
+ }
3459
+ *iterateSync(t = this.cwd, e = {}) {
3460
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3461
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
3462
+ (!r || r(t)) && (yield s ? t : t.fullpath());
3463
+ let h = /* @__PURE__ */ new Set([t]);
3464
+ for (let a of h) {
3465
+ let l = a.readdirSync();
3466
+ for (let u of l) {
3467
+ (!r || r(u)) && (yield s ? u : u.fullpath());
3468
+ let c = u;
3469
+ if (u.isSymbolicLink()) {
3470
+ if (!(i && (c = u.realpathSync()))) continue;
3471
+ c.isUnknown() && c.lstatSync();
3403
3472
  }
3473
+ c.shouldWalk(h, o) && h.add(c);
3404
3474
  }
3405
- if (i.isENOENT()) continue;
3406
- let a, l, u = !1;
3407
- for (; typeof (a = r.pattern()) == "string" && (l = r.rest());) i = i.resolve(a), r = l, u = !0;
3408
- if (a = r.pattern(), l = r.rest(), u) {
3409
- if (this.hasWalkedCache.hasWalked(i, r)) continue;
3410
- this.hasWalkedCache.storeWalked(i, r);
3475
+ }
3476
+ }
3477
+ stream(t = this.cwd, e = {}) {
3478
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3479
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
3480
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
3481
+ let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
3482
+ let d = !1;
3483
+ for (; !d;) {
3484
+ let f = l.shift();
3485
+ if (!f) {
3486
+ u === 0 && h.end();
3487
+ return;
3488
+ }
3489
+ u++, a.add(f);
3490
+ let m = (w, g, S = !1) => {
3491
+ if (w) return h.emit("error", w);
3492
+ if (i && !S) {
3493
+ let E = [];
3494
+ for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
3495
+ if (E.length) {
3496
+ Promise.all(E).then(() => m(null, g, !0));
3497
+ return;
3498
+ }
3499
+ }
3500
+ for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = !0));
3501
+ u--;
3502
+ for (let E of g) {
3503
+ let y = E.realpathCached() || E;
3504
+ y.shouldWalk(a, o) && l.push(y);
3505
+ }
3506
+ d && !h.flowing ? h.once("drain", c) : p || c();
3507
+ }, p = !0;
3508
+ f.readdirCB(m, !0), p = !1;
3411
3509
  }
3412
- if (typeof a == "string") {
3413
- let c = a === ".." || a === "" || a === ".";
3414
- this.matches.add(i.resolve(a), h, c);
3415
- continue;
3416
- } else if (a === A) {
3417
- (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
3418
- let c = l?.pattern(), d = l?.rest();
3419
- if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
3420
- else if (c === "..") {
3421
- let f = i.parent || i;
3422
- d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, !0);
3510
+ };
3511
+ return c(), h;
3512
+ }
3513
+ streamSync(t = this.cwd, e = {}) {
3514
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3515
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
3516
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
3517
+ let l = [t], u = 0, c = () => {
3518
+ let d = !1;
3519
+ for (; !d;) {
3520
+ let f = l.shift();
3521
+ if (!f) {
3522
+ u === 0 && h.end();
3523
+ return;
3423
3524
  }
3424
- } else a instanceof RegExp && this.subwalks.add(i, r);
3425
- }
3426
- return this;
3525
+ u++, a.add(f);
3526
+ let m = f.readdirSync();
3527
+ for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = !0));
3528
+ u--;
3529
+ for (let p of m) {
3530
+ let w = p;
3531
+ if (p.isSymbolicLink()) {
3532
+ if (!(i && (w = p.realpathSync()))) continue;
3533
+ w.isUnknown() && w.lstatSync();
3534
+ }
3535
+ w.shouldWalk(a, o) && l.push(w);
3536
+ }
3537
+ }
3538
+ d && !h.flowing && h.once("drain", c);
3539
+ };
3540
+ return c(), h;
3427
3541
  }
3428
- subwalkTargets() {
3429
- return this.subwalks.keys();
3542
+ chdir(t = this.cwd) {
3543
+ let e = this.cwd;
3544
+ this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
3430
3545
  }
3431
- child() {
3432
- return new n(this.opts, this.hasWalkedCache);
3546
+ };
3547
+ it = class extends It {
3548
+ sep = "\\";
3549
+ constructor(t = process.cwd(), e = {}) {
3550
+ let { nocase: s = !0 } = e;
3551
+ super(t, win32, "\\", {
3552
+ ...e,
3553
+ nocase: s
3554
+ }), this.nocase = s;
3555
+ for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
3433
3556
  }
3434
- filterEntries(t, e) {
3435
- let s = this.subwalks.get(t), i = this.child();
3436
- for (let r of e) for (let o of s) {
3437
- let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
3438
- a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
3439
- }
3440
- return i;
3557
+ parseRootPath(t) {
3558
+ return win32.parse(t).root.toUpperCase();
3559
+ }
3560
+ newRoot(t) {
3561
+ return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3562
+ }
3563
+ isAbsolute(t) {
3564
+ return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
3565
+ }
3566
+ };
3567
+ rt = class extends It {
3568
+ sep = "/";
3569
+ constructor(t = process.cwd(), e = {}) {
3570
+ let { nocase: s = !1 } = e;
3571
+ super(t, posix, "/", {
3572
+ ...e,
3573
+ nocase: s
3574
+ }), this.nocase = s;
3441
3575
  }
3442
- testGlobstar(t, e, s, i) {
3443
- 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) {
3444
- let r = s.pattern();
3445
- if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
3446
- else if (r === "..") {
3447
- let o = t.parent || t;
3448
- this.subwalks.add(o, s);
3449
- } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
3450
- }
3576
+ parseRootPath(t) {
3577
+ return "/";
3451
3578
  }
3452
- testRegExp(t, e, s, i) {
3453
- e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3579
+ newRoot(t) {
3580
+ return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3454
3581
  }
3455
- testString(t, e, s, i) {
3456
- t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3582
+ isAbsolute(t) {
3583
+ return t.startsWith("/");
3457
3584
  }
3458
3585
  };
3459
- Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n;
3460
- zt = class {
3461
- path;
3462
- patterns;
3463
- opts;
3464
- seen = /* @__PURE__ */ new Set();
3465
- paused = !1;
3466
- aborted = !1;
3467
- #t = [];
3586
+ St = class extends rt {
3587
+ constructor(t = process.cwd(), e = {}) {
3588
+ let { nocase: s = !0 } = e;
3589
+ super(t, {
3590
+ ...e,
3591
+ nocase: s
3592
+ });
3593
+ }
3594
+ };
3595
+ process.platform;
3596
+ Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
3597
+ Di = (n) => n.length >= 1;
3598
+ Mi = (n) => n.length >= 1;
3599
+ Ni = Symbol.for("nodejs.util.inspect.custom");
3600
+ nt = class n {
3601
+ #t;
3468
3602
  #s;
3469
3603
  #n;
3470
- signal;
3471
- maxDepth;
3472
- includeChildMatches;
3473
- constructor(t, e, s) {
3474
- 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.");
3475
- this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
3476
- this.#t.length = 0;
3477
- }));
3478
- }
3479
- #r(t) {
3480
- return this.seen.has(t) || !!this.#s?.ignored?.(t);
3604
+ length;
3605
+ #r;
3606
+ #o;
3607
+ #S;
3608
+ #w;
3609
+ #c;
3610
+ #h;
3611
+ #u = !0;
3612
+ constructor(t, e, s, i) {
3613
+ if (!Di(t)) throw new TypeError("empty pattern list");
3614
+ if (!Mi(e)) throw new TypeError("empty glob list");
3615
+ if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
3616
+ if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
3617
+ if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
3618
+ if (this.isUNC()) {
3619
+ let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
3620
+ l[0] === "" && (l.shift(), m.shift());
3621
+ let p = [
3622
+ r,
3623
+ o,
3624
+ h,
3625
+ a,
3626
+ ""
3627
+ ].join("/"), w = [
3628
+ u,
3629
+ c,
3630
+ d,
3631
+ f,
3632
+ ""
3633
+ ].join("/");
3634
+ this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
3635
+ } else if (this.isDrive() || this.isAbsolute()) {
3636
+ let [r, ...o] = this.#t, [h, ...a] = this.#s;
3637
+ o[0] === "" && (o.shift(), a.shift());
3638
+ let l = r + "/", u = h + "/";
3639
+ this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
3640
+ }
3641
+ }
3481
3642
  }
3482
- #o(t) {
3483
- return !!this.#s?.childrenIgnored?.(t);
3643
+ [Ni]() {
3644
+ return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
3484
3645
  }
3485
- pause() {
3486
- this.paused = !0;
3646
+ pattern() {
3647
+ return this.#t[this.#n];
3487
3648
  }
3488
- resume() {
3489
- if (this.signal?.aborted) return;
3490
- this.paused = !1;
3491
- let t;
3492
- for (; !this.paused && (t = this.#t.shift());) t();
3649
+ isString() {
3650
+ return typeof this.#t[this.#n] == "string";
3493
3651
  }
3494
- onResume(t) {
3495
- this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
3652
+ isGlobstar() {
3653
+ return this.#t[this.#n] === A;
3496
3654
  }
3497
- async matchCheck(t, e) {
3498
- if (e && this.opts.nodir) return;
3499
- let s;
3500
- if (this.opts.realpath) {
3501
- if (s = t.realpathCached() || await t.realpath(), !s) return;
3502
- t = s;
3503
- }
3504
- let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
3505
- if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3506
- let o = await r.realpath();
3507
- o && (o.isUnknown() || this.opts.stat) && await o.lstat();
3508
- }
3509
- return this.matchCheckTest(r, e);
3655
+ isRegExp() {
3656
+ return this.#t[this.#n] instanceof RegExp;
3510
3657
  }
3511
- matchCheckTest(t, e) {
3512
- 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;
3658
+ globString() {
3659
+ 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("/"));
3513
3660
  }
3514
- matchCheckSync(t, e) {
3515
- if (e && this.opts.nodir) return;
3516
- let s;
3517
- if (this.opts.realpath) {
3518
- if (s = t.realpathCached() || t.realpathSync(), !s) return;
3519
- t = s;
3520
- }
3521
- let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
3522
- if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3523
- let o = r.realpathSync();
3524
- o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
3525
- }
3526
- return this.matchCheckTest(r, e);
3661
+ hasMore() {
3662
+ return this.length > this.#n + 1;
3527
3663
  }
3528
- matchFinish(t, e) {
3529
- if (this.#r(t)) return;
3530
- if (!this.includeChildMatches && this.#s?.add) {
3531
- let r = `${t.relativePosix()}/**`;
3532
- this.#s.add(r);
3533
- }
3534
- let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
3535
- this.seen.add(t);
3536
- let i = this.opts.mark && t.isDirectory() ? this.#n : "";
3537
- if (this.opts.withFileTypes) this.matchEmit(t);
3538
- else if (s) {
3539
- let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
3540
- this.matchEmit(r + i);
3541
- } else {
3542
- let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
3543
- this.matchEmit(r ? o + r + i : "." + i);
3544
- }
3664
+ rest() {
3665
+ 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;
3545
3666
  }
3546
- async match(t, e, s) {
3547
- let i = await this.matchCheck(t, s);
3548
- i && this.matchFinish(i, e);
3667
+ isUNC() {
3668
+ let t = this.#t;
3669
+ 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];
3549
3670
  }
3550
- matchSync(t, e, s) {
3551
- let i = this.matchCheckSync(t, s);
3552
- i && this.matchFinish(i, e);
3671
+ isDrive() {
3672
+ let t = this.#t;
3673
+ 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]);
3553
3674
  }
3554
- walkCB(t, e, s) {
3555
- this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
3675
+ isAbsolute() {
3676
+ let t = this.#t;
3677
+ return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
3556
3678
  }
3557
- walkCB2(t, e, s, i) {
3558
- if (this.#o(t)) return i();
3559
- if (this.signal?.aborted && i(), this.paused) {
3560
- this.onResume(() => this.walkCB2(t, e, s, i));
3561
- return;
3562
- }
3563
- s.processPatterns(t, e);
3564
- let r = 1, o = () => {
3565
- --r === 0 && i();
3566
- };
3567
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3568
- for (let h of s.subwalkTargets()) {
3569
- if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3570
- r++;
3571
- let a = h.readdirCached();
3572
- h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
3573
- }
3574
- o();
3679
+ root() {
3680
+ let t = this.#t[0];
3681
+ return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
3575
3682
  }
3576
- walkCB3(t, e, s, i) {
3577
- s = s.filterEntries(t, e);
3578
- let r = 1, o = () => {
3579
- --r === 0 && i();
3580
- };
3581
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3582
- for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
3583
- o();
3683
+ checkFollowGlobstar() {
3684
+ return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
3584
3685
  }
3585
- walkCBSync(t, e, s) {
3586
- this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
3686
+ markFollowGlobstar() {
3687
+ return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
3587
3688
  }
3588
- walkCB2Sync(t, e, s, i) {
3589
- if (this.#o(t)) return i();
3590
- if (this.signal?.aborted && i(), this.paused) {
3591
- this.onResume(() => this.walkCB2Sync(t, e, s, i));
3592
- return;
3593
- }
3594
- s.processPatterns(t, e);
3595
- let r = 1, o = () => {
3596
- --r === 0 && i();
3597
- };
3598
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
3599
- for (let h of s.subwalkTargets()) {
3600
- if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3601
- r++;
3602
- let a = h.readdirSync();
3603
- this.walkCB3Sync(h, a, s, o);
3689
+ };
3690
+ _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3691
+ ot = class {
3692
+ relative;
3693
+ relativeChildren;
3694
+ absolute;
3695
+ absoluteChildren;
3696
+ platform;
3697
+ mmopts;
3698
+ constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
3699
+ this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
3700
+ dot: !0,
3701
+ nobrace: e,
3702
+ nocase: s,
3703
+ noext: i,
3704
+ noglobstar: r,
3705
+ optimizationLevel: 2,
3706
+ platform: o,
3707
+ nocomment: !0,
3708
+ nonegate: !0
3709
+ };
3710
+ for (let h of t) this.add(h);
3711
+ }
3712
+ add(t) {
3713
+ let e = new D(t, this.mmopts);
3714
+ for (let s = 0; s < e.set.length; s++) {
3715
+ let i = e.set[s], r = e.globParts[s];
3716
+ if (!i || !r) throw new Error("invalid pattern object");
3717
+ for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
3718
+ let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
3719
+ l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
3604
3720
  }
3605
- o();
3606
3721
  }
3607
- walkCB3Sync(t, e, s, i) {
3608
- s = s.filterEntries(t, e);
3609
- let r = 1, o = () => {
3610
- --r === 0 && i();
3611
- };
3612
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
3613
- for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
3614
- o();
3722
+ ignored(t) {
3723
+ let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
3724
+ for (let o of this.relative) if (o.match(i) || o.match(r)) return !0;
3725
+ for (let o of this.absolute) if (o.match(e) || o.match(s)) return !0;
3726
+ return !1;
3727
+ }
3728
+ childrenIgnored(t) {
3729
+ let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
3730
+ for (let i of this.relativeChildren) if (i.match(s)) return !0;
3731
+ for (let i of this.absoluteChildren) if (i.match(e)) return !0;
3732
+ return !1;
3615
3733
  }
3616
3734
  };
3617
- xt = class extends zt {
3618
- matches = /* @__PURE__ */ new Set();
3619
- constructor(t, e, s) {
3620
- super(t, e, s);
3735
+ oe = class n {
3736
+ store;
3737
+ constructor(t = /* @__PURE__ */ new Map()) {
3738
+ this.store = t;
3621
3739
  }
3622
- matchEmit(t) {
3623
- this.matches.add(t);
3740
+ copy() {
3741
+ return new n(new Map(this.store));
3624
3742
  }
3625
- async walk() {
3626
- if (this.signal?.aborted) throw this.signal.reason;
3627
- return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
3628
- this.walkCB(this.path, this.patterns, () => {
3629
- this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
3630
- });
3631
- }), this.matches;
3743
+ hasWalked(t, e) {
3744
+ return this.store.get(t.fullpath())?.has(e.globString());
3632
3745
  }
3633
- walkSync() {
3634
- if (this.signal?.aborted) throw this.signal.reason;
3635
- return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
3636
- if (this.signal?.aborted) throw this.signal.reason;
3637
- }), this.matches;
3746
+ storeWalked(t, e) {
3747
+ let s = t.fullpath(), i = this.store.get(s);
3748
+ i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
3638
3749
  }
3639
3750
  };
3640
- vt = class extends zt {
3641
- results;
3642
- constructor(t, e, s) {
3643
- super(t, e, s), this.results = new V({
3644
- signal: this.signal,
3645
- objectMode: !0
3646
- }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
3751
+ he = class {
3752
+ store = /* @__PURE__ */ new Map();
3753
+ add(t, e, s) {
3754
+ let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
3755
+ this.store.set(t, r === void 0 ? i : i & r);
3647
3756
  }
3648
- matchEmit(t) {
3649
- this.results.write(t), this.results.flowing || this.pause();
3757
+ entries() {
3758
+ return [...this.store.entries()].map(([t, e]) => [
3759
+ t,
3760
+ !!(e & 2),
3761
+ !!(e & 1)
3762
+ ]);
3650
3763
  }
3651
- stream() {
3652
- let t = this.path;
3653
- return t.isUnknown() ? t.lstat().then(() => {
3654
- this.walkCB(t, this.patterns, () => this.results.end());
3655
- }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
3764
+ };
3765
+ ae = class {
3766
+ store = /* @__PURE__ */ new Map();
3767
+ add(t, e) {
3768
+ if (!t.canReaddir()) return;
3769
+ let s = this.store.get(t);
3770
+ s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
3656
3771
  }
3657
- streamSync() {
3658
- return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
3772
+ get(t) {
3773
+ let e = this.store.get(t);
3774
+ if (!e) throw new Error("attempting to walk unknown path");
3775
+ return e;
3776
+ }
3777
+ entries() {
3778
+ return this.keys().map((t) => [t, this.store.get(t)]);
3779
+ }
3780
+ keys() {
3781
+ return [...this.store.keys()].filter((t) => t.canReaddir());
3659
3782
  }
3660
3783
  };
3661
- Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3662
- I = class {
3663
- absolute;
3664
- cwd;
3665
- root;
3666
- dot;
3667
- dotRelative;
3784
+ Et = class n {
3785
+ hasWalkedCache;
3786
+ matches = new he();
3787
+ subwalks = new ae();
3788
+ patterns;
3668
3789
  follow;
3669
- ignore;
3670
- magicalBraces;
3671
- mark;
3672
- matchBase;
3673
- maxDepth;
3674
- nobrace;
3675
- nocase;
3676
- nodir;
3677
- noext;
3678
- noglobstar;
3679
- pattern;
3680
- platform;
3681
- realpath;
3682
- scurry;
3683
- stat;
3684
- signal;
3685
- windowsPathsNoEscape;
3686
- withFileTypes;
3687
- includeChildMatches;
3790
+ dot;
3688
3791
  opts;
3689
- patterns;
3690
3792
  constructor(t, e) {
3691
- if (!e) throw new TypeError("glob options required");
3692
- 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");
3693
- if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
3694
- if (e.noglobstar) throw new TypeError("base matching requires globstar");
3695
- t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
3793
+ this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
3794
+ }
3795
+ processPatterns(t, e) {
3796
+ this.patterns = e;
3797
+ let s = e.map((i) => [t, i]);
3798
+ for (let [i, r] of s) {
3799
+ this.hasWalkedCache.storeWalked(i, r);
3800
+ let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
3801
+ if (o) {
3802
+ i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
3803
+ let c = r.rest();
3804
+ if (c) r = c;
3805
+ else {
3806
+ this.matches.add(i, !0, !1);
3807
+ continue;
3808
+ }
3809
+ }
3810
+ if (i.isENOENT()) continue;
3811
+ let a, l, u = !1;
3812
+ for (; typeof (a = r.pattern()) == "string" && (l = r.rest());) i = i.resolve(a), r = l, u = !0;
3813
+ if (a = r.pattern(), l = r.rest(), u) {
3814
+ if (this.hasWalkedCache.hasWalked(i, r)) continue;
3815
+ this.hasWalkedCache.storeWalked(i, r);
3816
+ }
3817
+ if (typeof a == "string") {
3818
+ let c = a === ".." || a === "" || a === ".";
3819
+ this.matches.add(i.resolve(a), h, c);
3820
+ continue;
3821
+ } else if (a === A) {
3822
+ (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
3823
+ let c = l?.pattern(), d = l?.rest();
3824
+ if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
3825
+ else if (c === "..") {
3826
+ let f = i.parent || i;
3827
+ d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, !0);
3828
+ }
3829
+ } else a instanceof RegExp && this.subwalks.add(i, r);
3696
3830
  }
3697
- if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
3698
- ...e,
3699
- platform: this.platform
3700
- }, e.scurry) {
3701
- if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
3702
- } else {
3703
- let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
3704
- this.scurry = new a(this.cwd, {
3705
- nocase: e.nocase,
3706
- fs: e.fs
3707
- });
3831
+ return this;
3832
+ }
3833
+ subwalkTargets() {
3834
+ return this.subwalks.keys();
3835
+ }
3836
+ child() {
3837
+ return new n(this.opts, this.hasWalkedCache);
3838
+ }
3839
+ filterEntries(t, e) {
3840
+ let s = this.subwalks.get(t), i = this.child();
3841
+ for (let r of e) for (let o of s) {
3842
+ let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
3843
+ a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
3708
3844
  }
3709
- this.nocase = this.scurry.nocase;
3710
- let s = this.platform === "darwin" || this.platform === "win32", i = {
3711
- braceExpandMax: 1e4,
3712
- ...e,
3713
- dot: this.dot,
3714
- matchBase: this.matchBase,
3715
- nobrace: this.nobrace,
3716
- nocase: this.nocase,
3717
- nocaseMagicOnly: s,
3718
- nocomment: !0,
3719
- noext: this.noext,
3720
- nonegate: !0,
3721
- optimizationLevel: 2,
3722
- platform: this.platform,
3723
- windowsPathsNoEscape: this.windowsPathsNoEscape,
3724
- debug: !!this.opts.debug
3725
- }, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
3726
- this.patterns = o.map((a, l) => {
3727
- let u = h[l];
3728
- if (!u) throw new Error("invalid pattern object");
3729
- return new nt(a, u, 0, this.platform);
3730
- });
3845
+ return i;
3846
+ }
3847
+ testGlobstar(t, e, s, i) {
3848
+ 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) {
3849
+ let r = s.pattern();
3850
+ if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
3851
+ else if (r === "..") {
3852
+ let o = t.parent || t;
3853
+ this.subwalks.add(o, s);
3854
+ } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
3855
+ }
3856
+ }
3857
+ testRegExp(t, e, s, i) {
3858
+ e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3859
+ }
3860
+ testString(t, e, s, i) {
3861
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3862
+ }
3863
+ };
3864
+ Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n;
3865
+ zt = class {
3866
+ path;
3867
+ patterns;
3868
+ opts;
3869
+ seen = /* @__PURE__ */ new Set();
3870
+ paused = !1;
3871
+ aborted = !1;
3872
+ #t = [];
3873
+ #s;
3874
+ #n;
3875
+ signal;
3876
+ maxDepth;
3877
+ includeChildMatches;
3878
+ constructor(t, e, s) {
3879
+ 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.");
3880
+ this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
3881
+ this.#t.length = 0;
3882
+ }));
3731
3883
  }
3732
- async walk() {
3733
- return [...await new xt(this.patterns, this.scurry.cwd, {
3734
- ...this.opts,
3735
- maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3736
- platform: this.platform,
3737
- nocase: this.nocase,
3738
- includeChildMatches: this.includeChildMatches
3739
- }).walk()];
3884
+ #r(t) {
3885
+ return this.seen.has(t) || !!this.#s?.ignored?.(t);
3740
3886
  }
3741
- walkSync() {
3742
- return [...new xt(this.patterns, this.scurry.cwd, {
3743
- ...this.opts,
3744
- maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
3745
- platform: this.platform,
3746
- nocase: this.nocase,
3747
- includeChildMatches: this.includeChildMatches
3748
- }).walkSync()];
3887
+ #o(t) {
3888
+ return !!this.#s?.childrenIgnored?.(t);
3749
3889
  }
3750
- stream() {
3751
- return new vt(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
- }).stream();
3890
+ pause() {
3891
+ this.paused = !0;
3758
3892
  }
3759
- streamSync() {
3760
- return new vt(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
- }).streamSync();
3893
+ resume() {
3894
+ if (this.signal?.aborted) return;
3895
+ this.paused = !1;
3896
+ let t;
3897
+ for (; !this.paused && (t = this.#t.shift());) t();
3767
3898
  }
3768
- iterateSync() {
3769
- return this.streamSync()[Symbol.iterator]();
3899
+ onResume(t) {
3900
+ this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
3770
3901
  }
3771
- [Symbol.iterator]() {
3772
- return this.iterateSync();
3902
+ async matchCheck(t, e) {
3903
+ if (e && this.opts.nodir) return;
3904
+ let s;
3905
+ if (this.opts.realpath) {
3906
+ if (s = t.realpathCached() || await t.realpath(), !s) return;
3907
+ t = s;
3908
+ }
3909
+ let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
3910
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3911
+ let o = await r.realpath();
3912
+ o && (o.isUnknown() || this.opts.stat) && await o.lstat();
3913
+ }
3914
+ return this.matchCheckTest(r, e);
3773
3915
  }
3774
- iterate() {
3775
- return this.stream()[Symbol.asyncIterator]();
3916
+ matchCheckTest(t, e) {
3917
+ 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;
3776
3918
  }
3777
- [Symbol.asyncIterator]() {
3778
- return this.iterate();
3919
+ matchCheckSync(t, e) {
3920
+ if (e && this.opts.nodir) return;
3921
+ let s;
3922
+ if (this.opts.realpath) {
3923
+ if (s = t.realpathCached() || t.realpathSync(), !s) return;
3924
+ t = s;
3925
+ }
3926
+ let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
3927
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3928
+ let o = r.realpathSync();
3929
+ o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
3930
+ }
3931
+ return this.matchCheckTest(r, e);
3779
3932
  }
3780
- };
3781
- le = (n, t = {}) => {
3782
- Array.isArray(n) || (n = [n]);
3783
- for (let e of n) if (new D(e, t).hasMagic()) return !0;
3784
- return !1;
3785
- };
3786
- ji = Bt;
3787
- Ii = Object.assign(Qe, { sync: Bt });
3788
- zi = Ut;
3789
- Bi = Object.assign(es, { sync: Ut });
3790
- Ui = Object.assign(ts, {
3791
- stream: Bt,
3792
- iterate: Ut
3793
- });
3794
- Ze = Object.assign(Je, {
3795
- glob: Je,
3796
- globSync: ts,
3797
- sync: Ui,
3798
- globStream: Qe,
3799
- stream: Ii,
3800
- globStreamSync: Bt,
3801
- streamSync: ji,
3802
- globIterate: es,
3803
- iterate: Bi,
3804
- globIterateSync: Ut,
3805
- iterateSync: zi,
3806
- Glob: I,
3807
- hasMagic: le,
3808
- escape: tt,
3809
- unescape: W
3810
- });
3811
- Ze.glob = Ze;
3812
- }));
3813
- //#endregion
3814
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
3815
- var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3816
- module.exports = isexe;
3817
- isexe.sync = sync;
3818
- var fs$3 = __require("fs");
3819
- function checkPathExt(path, options) {
3820
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
3821
- if (!pathext) return true;
3822
- pathext = pathext.split(";");
3823
- if (pathext.indexOf("") !== -1) return true;
3824
- for (var i = 0; i < pathext.length; i++) {
3825
- var p = pathext[i].toLowerCase();
3826
- if (p && path.substr(-p.length).toLowerCase() === p) return true;
3933
+ matchFinish(t, e) {
3934
+ if (this.#r(t)) return;
3935
+ if (!this.includeChildMatches && this.#s?.add) {
3936
+ let r = `${t.relativePosix()}/**`;
3937
+ this.#s.add(r);
3938
+ }
3939
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
3940
+ this.seen.add(t);
3941
+ let i = this.opts.mark && t.isDirectory() ? this.#n : "";
3942
+ if (this.opts.withFileTypes) this.matchEmit(t);
3943
+ else if (s) {
3944
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
3945
+ this.matchEmit(r + i);
3946
+ } else {
3947
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
3948
+ this.matchEmit(r ? o + r + i : "." + i);
3949
+ }
3827
3950
  }
3828
- return false;
3829
- }
3830
- function checkStat(stat, path, options) {
3831
- if (!stat.isSymbolicLink() && !stat.isFile()) return false;
3832
- return checkPathExt(path, options);
3833
- }
3834
- function isexe(path, options, cb) {
3835
- fs$3.stat(path, function(er, stat) {
3836
- cb(er, er ? false : checkStat(stat, path, options));
3837
- });
3838
- }
3839
- function sync(path, options) {
3840
- return checkStat(fs$3.statSync(path), path, options);
3841
- }
3842
- }));
3843
- //#endregion
3844
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
3845
- var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3846
- module.exports = isexe;
3847
- isexe.sync = sync;
3848
- var fs$2 = __require("fs");
3849
- function isexe(path, options, cb) {
3850
- fs$2.stat(path, function(er, stat) {
3851
- cb(er, er ? false : checkStat(stat, options));
3852
- });
3853
- }
3854
- function sync(path, options) {
3855
- return checkStat(fs$2.statSync(path), options);
3856
- }
3857
- function checkStat(stat, options) {
3858
- return stat.isFile() && checkMode(stat, options);
3859
- }
3860
- function checkMode(stat, options) {
3861
- var mod = stat.mode;
3862
- var uid = stat.uid;
3863
- var gid = stat.gid;
3864
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
3865
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
3866
- var u = parseInt("100", 8);
3867
- var g = parseInt("010", 8);
3868
- var o = parseInt("001", 8);
3869
- var ug = u | g;
3870
- return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
3871
- }
3872
- }));
3873
- //#endregion
3874
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
3875
- var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3876
- __require("fs");
3877
- var core;
3878
- if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
3879
- else core = require_mode();
3880
- module.exports = isexe;
3881
- isexe.sync = sync;
3882
- function isexe(path, options, cb) {
3883
- if (typeof options === "function") {
3884
- cb = options;
3885
- options = {};
3951
+ async match(t, e, s) {
3952
+ let i = await this.matchCheck(t, s);
3953
+ i && this.matchFinish(i, e);
3886
3954
  }
3887
- if (!cb) {
3888
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
3889
- return new Promise(function(resolve, reject) {
3890
- isexe(path, options || {}, function(er, is) {
3891
- if (er) reject(er);
3892
- else resolve(is);
3893
- });
3894
- });
3955
+ matchSync(t, e, s) {
3956
+ let i = this.matchCheckSync(t, s);
3957
+ i && this.matchFinish(i, e);
3895
3958
  }
3896
- core(path, options || {}, function(er, is) {
3897
- if (er) {
3898
- if (er.code === "EACCES" || options && options.ignoreErrors) {
3899
- er = null;
3900
- is = false;
3901
- }
3959
+ walkCB(t, e, s) {
3960
+ this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
3961
+ }
3962
+ walkCB2(t, e, s, i) {
3963
+ if (this.#o(t)) return i();
3964
+ if (this.signal?.aborted && i(), this.paused) {
3965
+ this.onResume(() => this.walkCB2(t, e, s, i));
3966
+ return;
3902
3967
  }
3903
- cb(er, is);
3904
- });
3905
- }
3906
- function sync(path, options) {
3907
- try {
3908
- return core.sync(path, options || {});
3909
- } catch (er) {
3910
- if (options && options.ignoreErrors || er.code === "EACCES") return false;
3911
- else throw er;
3968
+ s.processPatterns(t, e);
3969
+ let r = 1, o = () => {
3970
+ --r === 0 && i();
3971
+ };
3972
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3973
+ for (let h of s.subwalkTargets()) {
3974
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3975
+ r++;
3976
+ let a = h.readdirCached();
3977
+ h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
3978
+ }
3979
+ o();
3912
3980
  }
3913
- }
3914
- }));
3915
- //#endregion
3916
- //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
3917
- var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3918
- const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
3919
- const path$5 = __require("path");
3920
- const COLON = isWindows ? ";" : ":";
3921
- const isexe = require_isexe();
3922
- const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
3923
- const getPathInfo = (cmd, opt) => {
3924
- const colon = opt.colon || COLON;
3925
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
3926
- /* istanbul ignore next: very unusual */ "").split(colon)];
3927
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
3928
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
3929
- if (isWindows) {
3930
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
3981
+ walkCB3(t, e, s, i) {
3982
+ s = s.filterEntries(t, e);
3983
+ let r = 1, o = () => {
3984
+ --r === 0 && i();
3985
+ };
3986
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
3987
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
3988
+ o();
3931
3989
  }
3932
- return {
3933
- pathEnv,
3934
- pathExt,
3935
- pathExtExe
3936
- };
3937
- };
3938
- const which = (cmd, opt, cb) => {
3939
- if (typeof opt === "function") {
3940
- cb = opt;
3941
- opt = {};
3990
+ walkCBSync(t, e, s) {
3991
+ this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
3942
3992
  }
3943
- if (!opt) opt = {};
3944
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
3945
- const found = [];
3946
- const step = (i) => new Promise((resolve, reject) => {
3947
- if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
3948
- const ppRaw = pathEnv[i];
3949
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
3950
- const pCmd = path$5.join(pathPart, cmd);
3951
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
3952
- resolve(subStep(p, i, 0));
3953
- });
3954
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
3955
- if (ii === pathExt.length) return resolve(step(i + 1));
3956
- const ext = pathExt[ii];
3957
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
3958
- if (!er && is) {
3959
- if (opt.all) found.push(p + ext);
3960
- else return resolve(p + ext);
3961
- }
3962
- return resolve(subStep(p, i, ii + 1));
3963
- });
3964
- });
3965
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
3966
- };
3967
- const whichSync = (cmd, opt) => {
3968
- opt = opt || {};
3969
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
3970
- const found = [];
3971
- for (let i = 0; i < pathEnv.length; i++) {
3972
- const ppRaw = pathEnv[i];
3973
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
3974
- const pCmd = path$5.join(pathPart, cmd);
3975
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
3976
- for (let j = 0; j < pathExt.length; j++) {
3977
- const cur = p + pathExt[j];
3978
- try {
3979
- if (isexe.sync(cur, { pathExt: pathExtExe })) {
3980
- if (opt.all) found.push(cur);
3981
- else return cur;
3982
- }
3983
- } catch (ex) {}
3993
+ walkCB2Sync(t, e, s, i) {
3994
+ if (this.#o(t)) return i();
3995
+ if (this.signal?.aborted && i(), this.paused) {
3996
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
3997
+ return;
3998
+ }
3999
+ s.processPatterns(t, e);
4000
+ let r = 1, o = () => {
4001
+ --r === 0 && i();
4002
+ };
4003
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
4004
+ for (let h of s.subwalkTargets()) {
4005
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
4006
+ r++;
4007
+ let a = h.readdirSync();
4008
+ this.walkCB3Sync(h, a, s, o);
3984
4009
  }
4010
+ o();
3985
4011
  }
3986
- if (opt.all && found.length) return found;
3987
- if (opt.nothrow) return null;
3988
- throw getNotFoundError(cmd);
3989
- };
3990
- module.exports = which;
3991
- which.sync = whichSync;
3992
- }));
3993
- //#endregion
3994
- //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
3995
- var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3996
- const pathKey = (options = {}) => {
3997
- const environment = options.env || process.env;
3998
- if ((options.platform || process.platform) !== "win32") return "PATH";
3999
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
4000
- };
4001
- module.exports = pathKey;
4002
- module.exports.default = pathKey;
4003
- }));
4004
- //#endregion
4005
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
4006
- var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4007
- const path$4 = __require("path");
4008
- const which = require_which();
4009
- const getPathKey = require_path_key();
4010
- function resolveCommandAttempt(parsed, withoutPathExt) {
4011
- const env = parsed.options.env || process.env;
4012
- const cwd = process.cwd();
4013
- const hasCustomCwd = parsed.options.cwd != null;
4014
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
4015
- if (shouldSwitchCwd) try {
4016
- process.chdir(parsed.options.cwd);
4017
- } catch (err) {}
4018
- let resolved;
4019
- try {
4020
- resolved = which.sync(parsed.command, {
4021
- path: env[getPathKey({ env })],
4022
- pathExt: withoutPathExt ? path$4.delimiter : void 0
4023
- });
4024
- } catch (e) {} finally {
4025
- if (shouldSwitchCwd) process.chdir(cwd);
4012
+ walkCB3Sync(t, e, s, i) {
4013
+ s = s.filterEntries(t, e);
4014
+ let r = 1, o = () => {
4015
+ --r === 0 && i();
4016
+ };
4017
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
4018
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
4019
+ o();
4026
4020
  }
4027
- if (resolved) resolved = path$4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
4028
- return resolved;
4029
- }
4030
- function resolveCommand(parsed) {
4031
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
4032
- }
4033
- module.exports = resolveCommand;
4034
- }));
4035
- //#endregion
4036
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
4037
- var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4038
- const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
4039
- function escapeCommand(arg) {
4040
- arg = arg.replace(metaCharsRegExp, "^$1");
4041
- return arg;
4042
- }
4043
- function escapeArgument(arg, doubleEscapeMetaChars) {
4044
- arg = `${arg}`;
4045
- arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
4046
- arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
4047
- arg = `"${arg}"`;
4048
- arg = arg.replace(metaCharsRegExp, "^$1");
4049
- if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
4050
- return arg;
4051
- }
4052
- module.exports.command = escapeCommand;
4053
- module.exports.argument = escapeArgument;
4054
- }));
4055
- //#endregion
4056
- //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
4057
- var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4058
- module.exports = /^#!(.*)/;
4059
- }));
4060
- //#endregion
4061
- //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
4062
- var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4063
- const shebangRegex = require_shebang_regex();
4064
- module.exports = (string = "") => {
4065
- const match = string.match(shebangRegex);
4066
- if (!match) return null;
4067
- const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
4068
- const binary = path.split("/").pop();
4069
- if (binary === "env") return argument;
4070
- return argument ? `${binary} ${argument}` : binary;
4071
4021
  };
4072
- }));
4073
- //#endregion
4074
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
4075
- var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4076
- const fs$1 = __require("fs");
4077
- const shebangCommand = require_shebang_command();
4078
- function readShebang(command) {
4079
- const size = 150;
4080
- const buffer = Buffer.alloc(size);
4081
- let fd;
4082
- try {
4083
- fd = fs$1.openSync(command, "r");
4084
- fs$1.readSync(fd, buffer, 0, size, 0);
4085
- fs$1.closeSync(fd);
4086
- } catch (e) {}
4087
- return shebangCommand(buffer.toString());
4088
- }
4089
- module.exports = readShebang;
4090
- }));
4091
- //#endregion
4092
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
4093
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4094
- const path$3 = __require("path");
4095
- const resolveCommand = require_resolveCommand();
4096
- const escape = require_escape();
4097
- const readShebang = require_readShebang();
4098
- const isWin = process.platform === "win32";
4099
- const isExecutableRegExp = /\.(?:com|exe)$/i;
4100
- const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
4101
- function detectShebang(parsed) {
4102
- parsed.file = resolveCommand(parsed);
4103
- const shebang = parsed.file && readShebang(parsed.file);
4104
- if (shebang) {
4105
- parsed.args.unshift(parsed.file);
4106
- parsed.command = shebang;
4107
- return resolveCommand(parsed);
4022
+ xt = class extends zt {
4023
+ matches = /* @__PURE__ */ new Set();
4024
+ constructor(t, e, s) {
4025
+ super(t, e, s);
4108
4026
  }
4109
- return parsed.file;
4110
- }
4111
- function parseNonShell(parsed) {
4112
- if (!isWin) return parsed;
4113
- const commandFile = detectShebang(parsed);
4114
- const needsShell = !isExecutableRegExp.test(commandFile);
4115
- if (parsed.options.forceShell || needsShell) {
4116
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
4117
- parsed.command = path$3.normalize(parsed.command);
4118
- parsed.command = escape.command(parsed.command);
4119
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
4120
- parsed.args = [
4121
- "/d",
4122
- "/s",
4123
- "/c",
4124
- `"${[parsed.command].concat(parsed.args).join(" ")}"`
4125
- ];
4126
- parsed.command = process.env.comspec || "cmd.exe";
4127
- parsed.options.windowsVerbatimArguments = true;
4027
+ matchEmit(t) {
4028
+ this.matches.add(t);
4029
+ }
4030
+ async walk() {
4031
+ if (this.signal?.aborted) throw this.signal.reason;
4032
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
4033
+ this.walkCB(this.path, this.patterns, () => {
4034
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
4035
+ });
4036
+ }), this.matches;
4037
+ }
4038
+ walkSync() {
4039
+ if (this.signal?.aborted) throw this.signal.reason;
4040
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
4041
+ if (this.signal?.aborted) throw this.signal.reason;
4042
+ }), this.matches;
4128
4043
  }
4129
- return parsed;
4130
- }
4131
- function parse(command, args, options) {
4132
- if (args && !Array.isArray(args)) {
4133
- options = args;
4134
- args = null;
4044
+ };
4045
+ vt = class extends zt {
4046
+ results;
4047
+ constructor(t, e, s) {
4048
+ super(t, e, s), this.results = new V({
4049
+ signal: this.signal,
4050
+ objectMode: !0
4051
+ }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
4135
4052
  }
4136
- args = args ? args.slice(0) : [];
4137
- options = Object.assign({}, options);
4138
- const parsed = {
4139
- command,
4140
- args,
4141
- options,
4142
- file: void 0,
4143
- original: {
4144
- command,
4145
- args
4053
+ matchEmit(t) {
4054
+ this.results.write(t), this.results.flowing || this.pause();
4055
+ }
4056
+ stream() {
4057
+ let t = this.path;
4058
+ return t.isUnknown() ? t.lstat().then(() => {
4059
+ this.walkCB(t, this.patterns, () => this.results.end());
4060
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
4061
+ }
4062
+ streamSync() {
4063
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
4064
+ }
4065
+ };
4066
+ Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
4067
+ I = class {
4068
+ absolute;
4069
+ cwd;
4070
+ root;
4071
+ dot;
4072
+ dotRelative;
4073
+ follow;
4074
+ ignore;
4075
+ magicalBraces;
4076
+ mark;
4077
+ matchBase;
4078
+ maxDepth;
4079
+ nobrace;
4080
+ nocase;
4081
+ nodir;
4082
+ noext;
4083
+ noglobstar;
4084
+ pattern;
4085
+ platform;
4086
+ realpath;
4087
+ scurry;
4088
+ stat;
4089
+ signal;
4090
+ windowsPathsNoEscape;
4091
+ withFileTypes;
4092
+ includeChildMatches;
4093
+ opts;
4094
+ patterns;
4095
+ constructor(t, e) {
4096
+ if (!e) throw new TypeError("glob options required");
4097
+ 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");
4098
+ if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
4099
+ if (e.noglobstar) throw new TypeError("base matching requires globstar");
4100
+ t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
4146
4101
  }
4147
- };
4148
- return options.shell ? parsed : parseNonShell(parsed);
4149
- }
4150
- module.exports = parse;
4151
- }));
4152
- //#endregion
4153
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
4154
- var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4155
- const isWin = process.platform === "win32";
4156
- function notFoundError(original, syscall) {
4157
- return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
4158
- code: "ENOENT",
4159
- errno: "ENOENT",
4160
- syscall: `${syscall} ${original.command}`,
4161
- path: original.command,
4162
- spawnargs: original.args
4163
- });
4164
- }
4165
- function hookChildProcess(cp, parsed) {
4166
- if (!isWin) return;
4167
- const originalEmit = cp.emit;
4168
- cp.emit = function(name, arg1) {
4169
- if (name === "exit") {
4170
- const err = verifyENOENT(arg1, parsed);
4171
- if (err) return originalEmit.call(cp, "error", err);
4102
+ if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
4103
+ ...e,
4104
+ platform: this.platform
4105
+ }, e.scurry) {
4106
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
4107
+ } else {
4108
+ let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
4109
+ this.scurry = new a(this.cwd, {
4110
+ nocase: e.nocase,
4111
+ fs: e.fs
4112
+ });
4172
4113
  }
4173
- return originalEmit.apply(cp, arguments);
4174
- };
4175
- }
4176
- function verifyENOENT(status, parsed) {
4177
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
4178
- return null;
4179
- }
4180
- function verifyENOENTSync(status, parsed) {
4181
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
4182
- return null;
4183
- }
4184
- module.exports = {
4185
- hookChildProcess,
4186
- verifyENOENT,
4187
- verifyENOENTSync,
4188
- notFoundError
4114
+ this.nocase = this.scurry.nocase;
4115
+ let s = this.platform === "darwin" || this.platform === "win32", i = {
4116
+ braceExpandMax: 1e4,
4117
+ ...e,
4118
+ dot: this.dot,
4119
+ matchBase: this.matchBase,
4120
+ nobrace: this.nobrace,
4121
+ nocase: this.nocase,
4122
+ nocaseMagicOnly: s,
4123
+ nocomment: !0,
4124
+ noext: this.noext,
4125
+ nonegate: !0,
4126
+ optimizationLevel: 2,
4127
+ platform: this.platform,
4128
+ windowsPathsNoEscape: this.windowsPathsNoEscape,
4129
+ debug: !!this.opts.debug
4130
+ }, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
4131
+ this.patterns = o.map((a, l) => {
4132
+ let u = h[l];
4133
+ if (!u) throw new Error("invalid pattern object");
4134
+ return new nt(a, u, 0, this.platform);
4135
+ });
4136
+ }
4137
+ async walk() {
4138
+ return [...await new xt(this.patterns, this.scurry.cwd, {
4139
+ ...this.opts,
4140
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4141
+ platform: this.platform,
4142
+ nocase: this.nocase,
4143
+ includeChildMatches: this.includeChildMatches
4144
+ }).walk()];
4145
+ }
4146
+ walkSync() {
4147
+ return [...new xt(this.patterns, this.scurry.cwd, {
4148
+ ...this.opts,
4149
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4150
+ platform: this.platform,
4151
+ nocase: this.nocase,
4152
+ includeChildMatches: this.includeChildMatches
4153
+ }).walkSync()];
4154
+ }
4155
+ stream() {
4156
+ return new vt(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
+ }).stream();
4163
+ }
4164
+ streamSync() {
4165
+ return new vt(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
+ }).streamSync();
4172
+ }
4173
+ iterateSync() {
4174
+ return this.streamSync()[Symbol.iterator]();
4175
+ }
4176
+ [Symbol.iterator]() {
4177
+ return this.iterateSync();
4178
+ }
4179
+ iterate() {
4180
+ return this.stream()[Symbol.asyncIterator]();
4181
+ }
4182
+ [Symbol.asyncIterator]() {
4183
+ return this.iterate();
4184
+ }
4185
+ };
4186
+ le = (n, t = {}) => {
4187
+ Array.isArray(n) || (n = [n]);
4188
+ for (let e of n) if (new D(e, t).hasMagic()) return !0;
4189
+ return !1;
4189
4190
  };
4191
+ ji = Bt;
4192
+ Ii = Object.assign(Qe, { sync: Bt });
4193
+ zi = Ut;
4194
+ Bi = Object.assign(es, { sync: Ut });
4195
+ Ui = Object.assign(ts, {
4196
+ stream: Bt,
4197
+ iterate: Ut
4198
+ });
4199
+ Ze = Object.assign(Je, {
4200
+ glob: Je,
4201
+ globSync: ts,
4202
+ sync: Ui,
4203
+ globStream: Qe,
4204
+ stream: Ii,
4205
+ globStreamSync: Bt,
4206
+ streamSync: ji,
4207
+ globIterate: es,
4208
+ iterate: Bi,
4209
+ globIterateSync: Ut,
4210
+ iterateSync: zi,
4211
+ Glob: I,
4212
+ hasMagic: le,
4213
+ escape: tt,
4214
+ unescape: W
4215
+ });
4216
+ Ze.glob = Ze;
4190
4217
  }));
4191
4218
  //#endregion
4192
- //#region src/lib/crossSpawn.ts
4193
- var import_cross_spawn = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4194
- const cp = __require("child_process");
4195
- const parse = require_parse();
4196
- const enoent = require_enoent();
4197
- function spawn(command, args, options) {
4198
- const parsed = parse(command, args, options);
4199
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
4200
- enoent.hookChildProcess(spawned, parsed);
4201
- return spawned;
4202
- }
4203
- function spawnSync(command, args, options) {
4204
- const parsed = parse(command, args, options);
4205
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
4206
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
4207
- return result;
4208
- }
4209
- module.exports = spawn;
4210
- module.exports.spawn = spawn;
4211
- module.exports.sync = spawnSync;
4212
- module.exports._parse = parse;
4213
- module.exports._enoent = enoent;
4214
- })))(), 1);
4215
- function spawnSync(command, args, options) {
4216
- return import_cross_spawn.default.sync(command, args, options);
4217
- }
4218
- //#endregion
4219
4219
  //#region src/lib/deepMerge.ts
4220
4220
  const UNSAFE_KEYS = /* @__PURE__ */ new Set([
4221
4221
  "__proto__",