@wise/wds-codemods 0.0.1 → 1.0.0

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.
@@ -0,0 +1,2020 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ value: mod,
23
+ enumerable: true
24
+ }) : target, mod));
25
+
26
+ //#endregion
27
+ let node_child_process = require("node:child_process");
28
+ node_child_process = __toESM(node_child_process);
29
+ let node_fs_promises = require("node:fs/promises");
30
+ node_fs_promises = __toESM(node_fs_promises);
31
+ let node_path = require("node:path");
32
+ node_path = __toESM(node_path);
33
+ let __inquirer_prompts = require("@inquirer/prompts");
34
+ __inquirer_prompts = __toESM(__inquirer_prompts);
35
+ let node_fs = require("node:fs");
36
+ node_fs = __toESM(node_fs);
37
+
38
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js
39
+ var require_constants = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js": ((exports, module) => {
40
+ const SEMVER_SPEC_VERSION = "2.0.0";
41
+ const MAX_LENGTH$2 = 256;
42
+ const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || 9007199254740991;
43
+ const MAX_SAFE_COMPONENT_LENGTH$1 = 16;
44
+ const MAX_SAFE_BUILD_LENGTH$1 = MAX_LENGTH$2 - 6;
45
+ const RELEASE_TYPES = [
46
+ "major",
47
+ "premajor",
48
+ "minor",
49
+ "preminor",
50
+ "patch",
51
+ "prepatch",
52
+ "prerelease"
53
+ ];
54
+ module.exports = {
55
+ MAX_LENGTH: MAX_LENGTH$2,
56
+ MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH$1,
57
+ MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH$1,
58
+ MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
59
+ RELEASE_TYPES,
60
+ SEMVER_SPEC_VERSION,
61
+ FLAG_INCLUDE_PRERELEASE: 1,
62
+ FLAG_LOOSE: 2
63
+ };
64
+ }) });
65
+
66
+ //#endregion
67
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js
68
+ var require_debug = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js": ((exports, module) => {
69
+ const debug$4 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
70
+ module.exports = debug$4;
71
+ }) });
72
+
73
+ //#endregion
74
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js
75
+ var require_re = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js": ((exports, module) => {
76
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH: MAX_LENGTH$1 } = require_constants();
77
+ const debug$3 = require_debug();
78
+ exports = module.exports = {};
79
+ const re$4 = exports.re = [];
80
+ const safeRe = exports.safeRe = [];
81
+ const src = exports.src = [];
82
+ const safeSrc = exports.safeSrc = [];
83
+ const t$4 = exports.t = {};
84
+ let R = 0;
85
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
86
+ const safeRegexReplacements = [
87
+ ["\\s", 1],
88
+ ["\\d", MAX_LENGTH$1],
89
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
90
+ ];
91
+ const makeSafeRegex = (value) => {
92
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
93
+ return value;
94
+ };
95
+ const createToken = (name, value, isGlobal) => {
96
+ const safe = makeSafeRegex(value);
97
+ const index = R++;
98
+ debug$3(name, index, value);
99
+ t$4[name] = index;
100
+ src[index] = value;
101
+ safeSrc[index] = safe;
102
+ re$4[index] = new RegExp(value, isGlobal ? "g" : void 0);
103
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
104
+ };
105
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
106
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
107
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
108
+ createToken("MAINVERSION", `(${src[t$4.NUMERICIDENTIFIER]})\\.(${src[t$4.NUMERICIDENTIFIER]})\\.(${src[t$4.NUMERICIDENTIFIER]})`);
109
+ createToken("MAINVERSIONLOOSE", `(${src[t$4.NUMERICIDENTIFIERLOOSE]})\\.(${src[t$4.NUMERICIDENTIFIERLOOSE]})\\.(${src[t$4.NUMERICIDENTIFIERLOOSE]})`);
110
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t$4.NONNUMERICIDENTIFIER]}|${src[t$4.NUMERICIDENTIFIER]})`);
111
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t$4.NONNUMERICIDENTIFIER]}|${src[t$4.NUMERICIDENTIFIERLOOSE]})`);
112
+ createToken("PRERELEASE", `(?:-(${src[t$4.PRERELEASEIDENTIFIER]}(?:\\.${src[t$4.PRERELEASEIDENTIFIER]})*))`);
113
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t$4.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t$4.PRERELEASEIDENTIFIERLOOSE]})*))`);
114
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
115
+ createToken("BUILD", `(?:\\+(${src[t$4.BUILDIDENTIFIER]}(?:\\.${src[t$4.BUILDIDENTIFIER]})*))`);
116
+ createToken("FULLPLAIN", `v?${src[t$4.MAINVERSION]}${src[t$4.PRERELEASE]}?${src[t$4.BUILD]}?`);
117
+ createToken("FULL", `^${src[t$4.FULLPLAIN]}$`);
118
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t$4.MAINVERSIONLOOSE]}${src[t$4.PRERELEASELOOSE]}?${src[t$4.BUILD]}?`);
119
+ createToken("LOOSE", `^${src[t$4.LOOSEPLAIN]}$`);
120
+ createToken("GTLT", "((?:<|>)?=?)");
121
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t$4.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
122
+ createToken("XRANGEIDENTIFIER", `${src[t$4.NUMERICIDENTIFIER]}|x|X|\\*`);
123
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t$4.XRANGEIDENTIFIER]})(?:\\.(${src[t$4.XRANGEIDENTIFIER]})(?:\\.(${src[t$4.XRANGEIDENTIFIER]})(?:${src[t$4.PRERELEASE]})?${src[t$4.BUILD]}?)?)?`);
124
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t$4.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t$4.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t$4.XRANGEIDENTIFIERLOOSE]})(?:${src[t$4.PRERELEASELOOSE]})?${src[t$4.BUILD]}?)?)?`);
125
+ createToken("XRANGE", `^${src[t$4.GTLT]}\\s*${src[t$4.XRANGEPLAIN]}$`);
126
+ createToken("XRANGELOOSE", `^${src[t$4.GTLT]}\\s*${src[t$4.XRANGEPLAINLOOSE]}$`);
127
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
128
+ createToken("COERCE", `${src[t$4.COERCEPLAIN]}(?:$|[^\\d])`);
129
+ createToken("COERCEFULL", src[t$4.COERCEPLAIN] + `(?:${src[t$4.PRERELEASE]})?(?:${src[t$4.BUILD]})?(?:$|[^\\d])`);
130
+ createToken("COERCERTL", src[t$4.COERCE], true);
131
+ createToken("COERCERTLFULL", src[t$4.COERCEFULL], true);
132
+ createToken("LONETILDE", "(?:~>?)");
133
+ createToken("TILDETRIM", `(\\s*)${src[t$4.LONETILDE]}\\s+`, true);
134
+ exports.tildeTrimReplace = "$1~";
135
+ createToken("TILDE", `^${src[t$4.LONETILDE]}${src[t$4.XRANGEPLAIN]}$`);
136
+ createToken("TILDELOOSE", `^${src[t$4.LONETILDE]}${src[t$4.XRANGEPLAINLOOSE]}$`);
137
+ createToken("LONECARET", "(?:\\^)");
138
+ createToken("CARETTRIM", `(\\s*)${src[t$4.LONECARET]}\\s+`, true);
139
+ exports.caretTrimReplace = "$1^";
140
+ createToken("CARET", `^${src[t$4.LONECARET]}${src[t$4.XRANGEPLAIN]}$`);
141
+ createToken("CARETLOOSE", `^${src[t$4.LONECARET]}${src[t$4.XRANGEPLAINLOOSE]}$`);
142
+ createToken("COMPARATORLOOSE", `^${src[t$4.GTLT]}\\s*(${src[t$4.LOOSEPLAIN]})$|^$`);
143
+ createToken("COMPARATOR", `^${src[t$4.GTLT]}\\s*(${src[t$4.FULLPLAIN]})$|^$`);
144
+ createToken("COMPARATORTRIM", `(\\s*)${src[t$4.GTLT]}\\s*(${src[t$4.LOOSEPLAIN]}|${src[t$4.XRANGEPLAIN]})`, true);
145
+ exports.comparatorTrimReplace = "$1$2$3";
146
+ createToken("HYPHENRANGE", `^\\s*(${src[t$4.XRANGEPLAIN]})\\s+-\\s+(${src[t$4.XRANGEPLAIN]})\\s*$`);
147
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t$4.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t$4.XRANGEPLAINLOOSE]})\\s*$`);
148
+ createToken("STAR", "(<|>)?=?\\s*\\*");
149
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
150
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
151
+ }) });
152
+
153
+ //#endregion
154
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js
155
+ var require_parse_options = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js": ((exports, module) => {
156
+ const looseOption = Object.freeze({ loose: true });
157
+ const emptyOpts = Object.freeze({});
158
+ const parseOptions$3 = (options) => {
159
+ if (!options) return emptyOpts;
160
+ if (typeof options !== "object") return looseOption;
161
+ return options;
162
+ };
163
+ module.exports = parseOptions$3;
164
+ }) });
165
+
166
+ //#endregion
167
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js
168
+ var require_identifiers = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js": ((exports, module) => {
169
+ const numeric = /^[0-9]+$/;
170
+ const compareIdentifiers$1 = (a, b) => {
171
+ const anum = numeric.test(a);
172
+ const bnum = numeric.test(b);
173
+ if (anum && bnum) {
174
+ a = +a;
175
+ b = +b;
176
+ }
177
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
178
+ };
179
+ const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
180
+ module.exports = {
181
+ compareIdentifiers: compareIdentifiers$1,
182
+ rcompareIdentifiers
183
+ };
184
+ }) });
185
+
186
+ //#endregion
187
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js
188
+ var require_semver$1 = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js": ((exports, module) => {
189
+ const debug$2 = require_debug();
190
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
191
+ const { safeRe: re$3, t: t$3 } = require_re();
192
+ const parseOptions$2 = require_parse_options();
193
+ const { compareIdentifiers } = require_identifiers();
194
+ var SemVer$15 = class SemVer$15 {
195
+ constructor(version, options) {
196
+ options = parseOptions$2(options);
197
+ if (version instanceof SemVer$15) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
198
+ else version = version.version;
199
+ else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
200
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
201
+ debug$2("SemVer", version, options);
202
+ this.options = options;
203
+ this.loose = !!options.loose;
204
+ this.includePrerelease = !!options.includePrerelease;
205
+ const m = version.trim().match(options.loose ? re$3[t$3.LOOSE] : re$3[t$3.FULL]);
206
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
207
+ this.raw = version;
208
+ this.major = +m[1];
209
+ this.minor = +m[2];
210
+ this.patch = +m[3];
211
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
212
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
213
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
214
+ if (!m[4]) this.prerelease = [];
215
+ else this.prerelease = m[4].split(".").map((id) => {
216
+ if (/^[0-9]+$/.test(id)) {
217
+ const num = +id;
218
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
219
+ }
220
+ return id;
221
+ });
222
+ this.build = m[5] ? m[5].split(".") : [];
223
+ this.format();
224
+ }
225
+ format() {
226
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
227
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
228
+ return this.version;
229
+ }
230
+ toString() {
231
+ return this.version;
232
+ }
233
+ compare(other) {
234
+ debug$2("SemVer.compare", this.version, this.options, other);
235
+ if (!(other instanceof SemVer$15)) {
236
+ if (typeof other === "string" && other === this.version) return 0;
237
+ other = new SemVer$15(other, this.options);
238
+ }
239
+ if (other.version === this.version) return 0;
240
+ return this.compareMain(other) || this.comparePre(other);
241
+ }
242
+ compareMain(other) {
243
+ if (!(other instanceof SemVer$15)) other = new SemVer$15(other, this.options);
244
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
245
+ }
246
+ comparePre(other) {
247
+ if (!(other instanceof SemVer$15)) other = new SemVer$15(other, this.options);
248
+ if (this.prerelease.length && !other.prerelease.length) return -1;
249
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
250
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
251
+ let i = 0;
252
+ do {
253
+ const a = this.prerelease[i];
254
+ const b = other.prerelease[i];
255
+ debug$2("prerelease compare", i, a, b);
256
+ if (a === void 0 && b === void 0) return 0;
257
+ else if (b === void 0) return 1;
258
+ else if (a === void 0) return -1;
259
+ else if (a === b) continue;
260
+ else return compareIdentifiers(a, b);
261
+ } while (++i);
262
+ }
263
+ compareBuild(other) {
264
+ if (!(other instanceof SemVer$15)) other = new SemVer$15(other, this.options);
265
+ let i = 0;
266
+ do {
267
+ const a = this.build[i];
268
+ const b = other.build[i];
269
+ debug$2("build compare", i, a, b);
270
+ if (a === void 0 && b === void 0) return 0;
271
+ else if (b === void 0) return 1;
272
+ else if (a === void 0) return -1;
273
+ else if (a === b) continue;
274
+ else return compareIdentifiers(a, b);
275
+ } while (++i);
276
+ }
277
+ inc(release, identifier, identifierBase) {
278
+ if (release.startsWith("pre")) {
279
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
280
+ if (identifier) {
281
+ const match = `-${identifier}`.match(this.options.loose ? re$3[t$3.PRERELEASELOOSE] : re$3[t$3.PRERELEASE]);
282
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
283
+ }
284
+ }
285
+ switch (release) {
286
+ case "premajor":
287
+ this.prerelease.length = 0;
288
+ this.patch = 0;
289
+ this.minor = 0;
290
+ this.major++;
291
+ this.inc("pre", identifier, identifierBase);
292
+ break;
293
+ case "preminor":
294
+ this.prerelease.length = 0;
295
+ this.patch = 0;
296
+ this.minor++;
297
+ this.inc("pre", identifier, identifierBase);
298
+ break;
299
+ case "prepatch":
300
+ this.prerelease.length = 0;
301
+ this.inc("patch", identifier, identifierBase);
302
+ this.inc("pre", identifier, identifierBase);
303
+ break;
304
+ case "prerelease":
305
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
306
+ this.inc("pre", identifier, identifierBase);
307
+ break;
308
+ case "release":
309
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
310
+ this.prerelease.length = 0;
311
+ break;
312
+ case "major":
313
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
314
+ this.minor = 0;
315
+ this.patch = 0;
316
+ this.prerelease = [];
317
+ break;
318
+ case "minor":
319
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
320
+ this.patch = 0;
321
+ this.prerelease = [];
322
+ break;
323
+ case "patch":
324
+ if (this.prerelease.length === 0) this.patch++;
325
+ this.prerelease = [];
326
+ break;
327
+ case "pre": {
328
+ const base = Number(identifierBase) ? 1 : 0;
329
+ if (this.prerelease.length === 0) this.prerelease = [base];
330
+ else {
331
+ let i = this.prerelease.length;
332
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
333
+ this.prerelease[i]++;
334
+ i = -2;
335
+ }
336
+ if (i === -1) {
337
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
338
+ this.prerelease.push(base);
339
+ }
340
+ }
341
+ if (identifier) {
342
+ let prerelease$2 = [identifier, base];
343
+ if (identifierBase === false) prerelease$2 = [identifier];
344
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
345
+ if (isNaN(this.prerelease[1])) this.prerelease = prerelease$2;
346
+ } else this.prerelease = prerelease$2;
347
+ }
348
+ break;
349
+ }
350
+ default: throw new Error(`invalid increment argument: ${release}`);
351
+ }
352
+ this.raw = this.format();
353
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
354
+ return this;
355
+ }
356
+ };
357
+ module.exports = SemVer$15;
358
+ }) });
359
+
360
+ //#endregion
361
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js
362
+ var require_parse = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js": ((exports, module) => {
363
+ const SemVer$14 = require_semver$1();
364
+ const parse$6 = (version, options, throwErrors = false) => {
365
+ if (version instanceof SemVer$14) return version;
366
+ try {
367
+ return new SemVer$14(version, options);
368
+ } catch (er) {
369
+ if (!throwErrors) return null;
370
+ throw er;
371
+ }
372
+ };
373
+ module.exports = parse$6;
374
+ }) });
375
+
376
+ //#endregion
377
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js
378
+ var require_valid$1 = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js": ((exports, module) => {
379
+ const parse$5 = require_parse();
380
+ const valid$1 = (version, options) => {
381
+ const v = parse$5(version, options);
382
+ return v ? v.version : null;
383
+ };
384
+ module.exports = valid$1;
385
+ }) });
386
+
387
+ //#endregion
388
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js
389
+ var require_clean = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js": ((exports, module) => {
390
+ const parse$4 = require_parse();
391
+ const clean$1 = (version, options) => {
392
+ const s = parse$4(version.trim().replace(/^[=v]+/, ""), options);
393
+ return s ? s.version : null;
394
+ };
395
+ module.exports = clean$1;
396
+ }) });
397
+
398
+ //#endregion
399
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js
400
+ var require_inc = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js": ((exports, module) => {
401
+ const SemVer$13 = require_semver$1();
402
+ const inc$1 = (version, release, options, identifier, identifierBase) => {
403
+ if (typeof options === "string") {
404
+ identifierBase = identifier;
405
+ identifier = options;
406
+ options = void 0;
407
+ }
408
+ try {
409
+ return new SemVer$13(version instanceof SemVer$13 ? version.version : version, options).inc(release, identifier, identifierBase).version;
410
+ } catch (er) {
411
+ return null;
412
+ }
413
+ };
414
+ module.exports = inc$1;
415
+ }) });
416
+
417
+ //#endregion
418
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js
419
+ var require_diff = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js": ((exports, module) => {
420
+ const parse$3 = require_parse();
421
+ const diff$1 = (version1, version2) => {
422
+ const v1 = parse$3(version1, null, true);
423
+ const v2 = parse$3(version2, null, true);
424
+ const comparison = v1.compare(v2);
425
+ if (comparison === 0) return null;
426
+ const v1Higher = comparison > 0;
427
+ const highVersion = v1Higher ? v1 : v2;
428
+ const lowVersion = v1Higher ? v2 : v1;
429
+ const highHasPre = !!highVersion.prerelease.length;
430
+ if (!!lowVersion.prerelease.length && !highHasPre) {
431
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
432
+ if (lowVersion.compareMain(highVersion) === 0) {
433
+ if (lowVersion.minor && !lowVersion.patch) return "minor";
434
+ return "patch";
435
+ }
436
+ }
437
+ const prefix = highHasPre ? "pre" : "";
438
+ if (v1.major !== v2.major) return prefix + "major";
439
+ if (v1.minor !== v2.minor) return prefix + "minor";
440
+ if (v1.patch !== v2.patch) return prefix + "patch";
441
+ return "prerelease";
442
+ };
443
+ module.exports = diff$1;
444
+ }) });
445
+
446
+ //#endregion
447
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js
448
+ var require_major = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js": ((exports, module) => {
449
+ const SemVer$12 = require_semver$1();
450
+ const major$1 = (a, loose) => new SemVer$12(a, loose).major;
451
+ module.exports = major$1;
452
+ }) });
453
+
454
+ //#endregion
455
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js
456
+ var require_minor = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js": ((exports, module) => {
457
+ const SemVer$11 = require_semver$1();
458
+ const minor$1 = (a, loose) => new SemVer$11(a, loose).minor;
459
+ module.exports = minor$1;
460
+ }) });
461
+
462
+ //#endregion
463
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js
464
+ var require_patch = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js": ((exports, module) => {
465
+ const SemVer$10 = require_semver$1();
466
+ const patch$1 = (a, loose) => new SemVer$10(a, loose).patch;
467
+ module.exports = patch$1;
468
+ }) });
469
+
470
+ //#endregion
471
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js
472
+ var require_prerelease = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js": ((exports, module) => {
473
+ const parse$2 = require_parse();
474
+ const prerelease$1 = (version, options) => {
475
+ const parsed = parse$2(version, options);
476
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
477
+ };
478
+ module.exports = prerelease$1;
479
+ }) });
480
+
481
+ //#endregion
482
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js
483
+ var require_compare = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js": ((exports, module) => {
484
+ const SemVer$9 = require_semver$1();
485
+ const compare$11 = (a, b, loose) => new SemVer$9(a, loose).compare(new SemVer$9(b, loose));
486
+ module.exports = compare$11;
487
+ }) });
488
+
489
+ //#endregion
490
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js
491
+ var require_rcompare = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js": ((exports, module) => {
492
+ const compare$10 = require_compare();
493
+ const rcompare$1 = (a, b, loose) => compare$10(b, a, loose);
494
+ module.exports = rcompare$1;
495
+ }) });
496
+
497
+ //#endregion
498
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js
499
+ var require_compare_loose = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js": ((exports, module) => {
500
+ const compare$9 = require_compare();
501
+ const compareLoose$1 = (a, b) => compare$9(a, b, true);
502
+ module.exports = compareLoose$1;
503
+ }) });
504
+
505
+ //#endregion
506
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js
507
+ var require_compare_build = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js": ((exports, module) => {
508
+ const SemVer$8 = require_semver$1();
509
+ const compareBuild$3 = (a, b, loose) => {
510
+ const versionA = new SemVer$8(a, loose);
511
+ const versionB = new SemVer$8(b, loose);
512
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
513
+ };
514
+ module.exports = compareBuild$3;
515
+ }) });
516
+
517
+ //#endregion
518
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js
519
+ var require_sort = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js": ((exports, module) => {
520
+ const compareBuild$2 = require_compare_build();
521
+ const sort$1 = (list$1, loose) => list$1.sort((a, b) => compareBuild$2(a, b, loose));
522
+ module.exports = sort$1;
523
+ }) });
524
+
525
+ //#endregion
526
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js
527
+ var require_rsort = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js": ((exports, module) => {
528
+ const compareBuild$1 = require_compare_build();
529
+ const rsort$1 = (list$1, loose) => list$1.sort((a, b) => compareBuild$1(b, a, loose));
530
+ module.exports = rsort$1;
531
+ }) });
532
+
533
+ //#endregion
534
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js
535
+ var require_gt = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js": ((exports, module) => {
536
+ const compare$8 = require_compare();
537
+ const gt$4 = (a, b, loose) => compare$8(a, b, loose) > 0;
538
+ module.exports = gt$4;
539
+ }) });
540
+
541
+ //#endregion
542
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js
543
+ var require_lt = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js": ((exports, module) => {
544
+ const compare$7 = require_compare();
545
+ const lt$3 = (a, b, loose) => compare$7(a, b, loose) < 0;
546
+ module.exports = lt$3;
547
+ }) });
548
+
549
+ //#endregion
550
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js
551
+ var require_eq = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js": ((exports, module) => {
552
+ const compare$6 = require_compare();
553
+ const eq$2 = (a, b, loose) => compare$6(a, b, loose) === 0;
554
+ module.exports = eq$2;
555
+ }) });
556
+
557
+ //#endregion
558
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js
559
+ var require_neq = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js": ((exports, module) => {
560
+ const compare$5 = require_compare();
561
+ const neq$2 = (a, b, loose) => compare$5(a, b, loose) !== 0;
562
+ module.exports = neq$2;
563
+ }) });
564
+
565
+ //#endregion
566
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js
567
+ var require_gte = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js": ((exports, module) => {
568
+ const compare$4 = require_compare();
569
+ const gte$3 = (a, b, loose) => compare$4(a, b, loose) >= 0;
570
+ module.exports = gte$3;
571
+ }) });
572
+
573
+ //#endregion
574
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js
575
+ var require_lte = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js": ((exports, module) => {
576
+ const compare$3 = require_compare();
577
+ const lte$3 = (a, b, loose) => compare$3(a, b, loose) <= 0;
578
+ module.exports = lte$3;
579
+ }) });
580
+
581
+ //#endregion
582
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js
583
+ var require_cmp = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js": ((exports, module) => {
584
+ const eq$1 = require_eq();
585
+ const neq$1 = require_neq();
586
+ const gt$3 = require_gt();
587
+ const gte$2 = require_gte();
588
+ const lt$2 = require_lt();
589
+ const lte$2 = require_lte();
590
+ const cmp$2 = (a, op, b, loose) => {
591
+ switch (op) {
592
+ case "===":
593
+ if (typeof a === "object") a = a.version;
594
+ if (typeof b === "object") b = b.version;
595
+ return a === b;
596
+ case "!==":
597
+ if (typeof a === "object") a = a.version;
598
+ if (typeof b === "object") b = b.version;
599
+ return a !== b;
600
+ case "":
601
+ case "=":
602
+ case "==": return eq$1(a, b, loose);
603
+ case "!=": return neq$1(a, b, loose);
604
+ case ">": return gt$3(a, b, loose);
605
+ case ">=": return gte$2(a, b, loose);
606
+ case "<": return lt$2(a, b, loose);
607
+ case "<=": return lte$2(a, b, loose);
608
+ default: throw new TypeError(`Invalid operator: ${op}`);
609
+ }
610
+ };
611
+ module.exports = cmp$2;
612
+ }) });
613
+
614
+ //#endregion
615
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js
616
+ var require_coerce = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js": ((exports, module) => {
617
+ const SemVer$7 = require_semver$1();
618
+ const parse$1 = require_parse();
619
+ const { safeRe: re$2, t: t$2 } = require_re();
620
+ const coerce$1 = (version, options) => {
621
+ if (version instanceof SemVer$7) return version;
622
+ if (typeof version === "number") version = String(version);
623
+ if (typeof version !== "string") return null;
624
+ options = options || {};
625
+ let match = null;
626
+ if (!options.rtl) match = version.match(options.includePrerelease ? re$2[t$2.COERCEFULL] : re$2[t$2.COERCE]);
627
+ else {
628
+ const coerceRtlRegex = options.includePrerelease ? re$2[t$2.COERCERTLFULL] : re$2[t$2.COERCERTL];
629
+ let next;
630
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
631
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
632
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
633
+ }
634
+ coerceRtlRegex.lastIndex = -1;
635
+ }
636
+ if (match === null) return null;
637
+ const major$2 = match[2];
638
+ const minor$2 = match[3] || "0";
639
+ const patch$2 = match[4] || "0";
640
+ const prerelease$2 = options.includePrerelease && match[5] ? `-${match[5]}` : "";
641
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
642
+ return parse$1(`${major$2}.${minor$2}.${patch$2}${prerelease$2}${build}`, options);
643
+ };
644
+ module.exports = coerce$1;
645
+ }) });
646
+
647
+ //#endregion
648
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js
649
+ var require_lrucache = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js": ((exports, module) => {
650
+ var LRUCache = class {
651
+ constructor() {
652
+ this.max = 1e3;
653
+ this.map = /* @__PURE__ */ new Map();
654
+ }
655
+ get(key) {
656
+ const value = this.map.get(key);
657
+ if (value === void 0) return;
658
+ else {
659
+ this.map.delete(key);
660
+ this.map.set(key, value);
661
+ return value;
662
+ }
663
+ }
664
+ delete(key) {
665
+ return this.map.delete(key);
666
+ }
667
+ set(key, value) {
668
+ if (!this.delete(key) && value !== void 0) {
669
+ if (this.map.size >= this.max) {
670
+ const firstKey = this.map.keys().next().value;
671
+ this.delete(firstKey);
672
+ }
673
+ this.map.set(key, value);
674
+ }
675
+ return this;
676
+ }
677
+ };
678
+ module.exports = LRUCache;
679
+ }) });
680
+
681
+ //#endregion
682
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js
683
+ var require_range = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js": ((exports, module) => {
684
+ const SPACE_CHARACTERS = /\s+/g;
685
+ var Range$11 = class Range$11 {
686
+ constructor(range, options) {
687
+ options = parseOptions$1(options);
688
+ if (range instanceof Range$11) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
689
+ else return new Range$11(range.raw, options);
690
+ if (range instanceof Comparator$4) {
691
+ this.raw = range.value;
692
+ this.set = [[range]];
693
+ this.formatted = void 0;
694
+ return this;
695
+ }
696
+ this.options = options;
697
+ this.loose = !!options.loose;
698
+ this.includePrerelease = !!options.includePrerelease;
699
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
700
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
701
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
702
+ if (this.set.length > 1) {
703
+ const first = this.set[0];
704
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
705
+ if (this.set.length === 0) this.set = [first];
706
+ else if (this.set.length > 1) {
707
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
708
+ this.set = [c];
709
+ break;
710
+ }
711
+ }
712
+ }
713
+ this.formatted = void 0;
714
+ }
715
+ get range() {
716
+ if (this.formatted === void 0) {
717
+ this.formatted = "";
718
+ for (let i = 0; i < this.set.length; i++) {
719
+ if (i > 0) this.formatted += "||";
720
+ const comps = this.set[i];
721
+ for (let k = 0; k < comps.length; k++) {
722
+ if (k > 0) this.formatted += " ";
723
+ this.formatted += comps[k].toString().trim();
724
+ }
725
+ }
726
+ }
727
+ return this.formatted;
728
+ }
729
+ format() {
730
+ return this.range;
731
+ }
732
+ toString() {
733
+ return this.range;
734
+ }
735
+ parseRange(range) {
736
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
737
+ const cached = cache.get(memoKey);
738
+ if (cached) return cached;
739
+ const loose = this.options.loose;
740
+ const hr = loose ? re$1[t$1.HYPHENRANGELOOSE] : re$1[t$1.HYPHENRANGE];
741
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
742
+ debug$1("hyphen replace", range);
743
+ range = range.replace(re$1[t$1.COMPARATORTRIM], comparatorTrimReplace);
744
+ debug$1("comparator trim", range);
745
+ range = range.replace(re$1[t$1.TILDETRIM], tildeTrimReplace);
746
+ debug$1("tilde trim", range);
747
+ range = range.replace(re$1[t$1.CARETTRIM], caretTrimReplace);
748
+ debug$1("caret trim", range);
749
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
750
+ if (loose) rangeList = rangeList.filter((comp) => {
751
+ debug$1("loose invalid filter", comp, this.options);
752
+ return !!comp.match(re$1[t$1.COMPARATORLOOSE]);
753
+ });
754
+ debug$1("range list", rangeList);
755
+ const rangeMap = /* @__PURE__ */ new Map();
756
+ const comparators = rangeList.map((comp) => new Comparator$4(comp, this.options));
757
+ for (const comp of comparators) {
758
+ if (isNullSet(comp)) return [comp];
759
+ rangeMap.set(comp.value, comp);
760
+ }
761
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
762
+ const result = [...rangeMap.values()];
763
+ cache.set(memoKey, result);
764
+ return result;
765
+ }
766
+ intersects(range, options) {
767
+ if (!(range instanceof Range$11)) throw new TypeError("a Range is required");
768
+ return this.set.some((thisComparators) => {
769
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
770
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
771
+ return rangeComparators.every((rangeComparator) => {
772
+ return thisComparator.intersects(rangeComparator, options);
773
+ });
774
+ });
775
+ });
776
+ });
777
+ }
778
+ test(version) {
779
+ if (!version) return false;
780
+ if (typeof version === "string") try {
781
+ version = new SemVer$6(version, this.options);
782
+ } catch (er) {
783
+ return false;
784
+ }
785
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
786
+ return false;
787
+ }
788
+ };
789
+ module.exports = Range$11;
790
+ const cache = new (require_lrucache())();
791
+ const parseOptions$1 = require_parse_options();
792
+ const Comparator$4 = require_comparator();
793
+ const debug$1 = require_debug();
794
+ const SemVer$6 = require_semver$1();
795
+ const { safeRe: re$1, t: t$1, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
796
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
797
+ const isNullSet = (c) => c.value === "<0.0.0-0";
798
+ const isAny = (c) => c.value === "";
799
+ const isSatisfiable = (comparators, options) => {
800
+ let result = true;
801
+ const remainingComparators = comparators.slice();
802
+ let testComparator = remainingComparators.pop();
803
+ while (result && remainingComparators.length) {
804
+ result = remainingComparators.every((otherComparator) => {
805
+ return testComparator.intersects(otherComparator, options);
806
+ });
807
+ testComparator = remainingComparators.pop();
808
+ }
809
+ return result;
810
+ };
811
+ const parseComparator = (comp, options) => {
812
+ debug$1("comp", comp, options);
813
+ comp = replaceCarets(comp, options);
814
+ debug$1("caret", comp);
815
+ comp = replaceTildes(comp, options);
816
+ debug$1("tildes", comp);
817
+ comp = replaceXRanges(comp, options);
818
+ debug$1("xrange", comp);
819
+ comp = replaceStars(comp, options);
820
+ debug$1("stars", comp);
821
+ return comp;
822
+ };
823
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
824
+ const replaceTildes = (comp, options) => {
825
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
826
+ };
827
+ const replaceTilde = (comp, options) => {
828
+ const r = options.loose ? re$1[t$1.TILDELOOSE] : re$1[t$1.TILDE];
829
+ return comp.replace(r, (_, M, m, p, pr) => {
830
+ debug$1("tilde", comp, _, M, m, p, pr);
831
+ let ret;
832
+ if (isX(M)) ret = "";
833
+ else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
834
+ else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
835
+ else if (pr) {
836
+ debug$1("replaceTilde pr", pr);
837
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
838
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
839
+ debug$1("tilde return", ret);
840
+ return ret;
841
+ });
842
+ };
843
+ const replaceCarets = (comp, options) => {
844
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
845
+ };
846
+ const replaceCaret = (comp, options) => {
847
+ debug$1("caret", comp, options);
848
+ const r = options.loose ? re$1[t$1.CARETLOOSE] : re$1[t$1.CARET];
849
+ const z = options.includePrerelease ? "-0" : "";
850
+ return comp.replace(r, (_, M, m, p, pr) => {
851
+ debug$1("caret", comp, _, M, m, p, pr);
852
+ let ret;
853
+ if (isX(M)) ret = "";
854
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
855
+ else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
856
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
857
+ else if (pr) {
858
+ debug$1("replaceCaret pr", pr);
859
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
860
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
861
+ else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
862
+ } else {
863
+ debug$1("no pr");
864
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
865
+ else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
866
+ else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
867
+ }
868
+ debug$1("caret return", ret);
869
+ return ret;
870
+ });
871
+ };
872
+ const replaceXRanges = (comp, options) => {
873
+ debug$1("replaceXRanges", comp, options);
874
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
875
+ };
876
+ const replaceXRange = (comp, options) => {
877
+ comp = comp.trim();
878
+ const r = options.loose ? re$1[t$1.XRANGELOOSE] : re$1[t$1.XRANGE];
879
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
880
+ debug$1("xRange", comp, ret, gtlt, M, m, p, pr);
881
+ const xM = isX(M);
882
+ const xm = xM || isX(m);
883
+ const xp = xm || isX(p);
884
+ const anyX = xp;
885
+ if (gtlt === "=" && anyX) gtlt = "";
886
+ pr = options.includePrerelease ? "-0" : "";
887
+ if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
888
+ else ret = "*";
889
+ else if (gtlt && anyX) {
890
+ if (xm) m = 0;
891
+ p = 0;
892
+ if (gtlt === ">") {
893
+ gtlt = ">=";
894
+ if (xm) {
895
+ M = +M + 1;
896
+ m = 0;
897
+ p = 0;
898
+ } else {
899
+ m = +m + 1;
900
+ p = 0;
901
+ }
902
+ } else if (gtlt === "<=") {
903
+ gtlt = "<";
904
+ if (xm) M = +M + 1;
905
+ else m = +m + 1;
906
+ }
907
+ if (gtlt === "<") pr = "-0";
908
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
909
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
910
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
911
+ debug$1("xRange return", ret);
912
+ return ret;
913
+ });
914
+ };
915
+ const replaceStars = (comp, options) => {
916
+ debug$1("replaceStars", comp, options);
917
+ return comp.trim().replace(re$1[t$1.STAR], "");
918
+ };
919
+ const replaceGTE0 = (comp, options) => {
920
+ debug$1("replaceGTE0", comp, options);
921
+ return comp.trim().replace(re$1[options.includePrerelease ? t$1.GTE0PRE : t$1.GTE0], "");
922
+ };
923
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
924
+ if (isX(fM)) from = "";
925
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
926
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
927
+ else if (fpr) from = `>=${from}`;
928
+ else from = `>=${from}${incPr ? "-0" : ""}`;
929
+ if (isX(tM)) to = "";
930
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
931
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
932
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
933
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
934
+ else to = `<=${to}`;
935
+ return `${from} ${to}`.trim();
936
+ };
937
+ const testSet = (set, version, options) => {
938
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
939
+ if (version.prerelease.length && !options.includePrerelease) {
940
+ for (let i = 0; i < set.length; i++) {
941
+ debug$1(set[i].semver);
942
+ if (set[i].semver === Comparator$4.ANY) continue;
943
+ if (set[i].semver.prerelease.length > 0) {
944
+ const allowed = set[i].semver;
945
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
946
+ }
947
+ }
948
+ return false;
949
+ }
950
+ return true;
951
+ };
952
+ }) });
953
+
954
+ //#endregion
955
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js
956
+ var require_comparator = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js": ((exports, module) => {
957
+ const ANY$2 = Symbol("SemVer ANY");
958
+ var Comparator$3 = class Comparator$3 {
959
+ static get ANY() {
960
+ return ANY$2;
961
+ }
962
+ constructor(comp, options) {
963
+ options = parseOptions(options);
964
+ if (comp instanceof Comparator$3) if (comp.loose === !!options.loose) return comp;
965
+ else comp = comp.value;
966
+ comp = comp.trim().split(/\s+/).join(" ");
967
+ debug("comparator", comp, options);
968
+ this.options = options;
969
+ this.loose = !!options.loose;
970
+ this.parse(comp);
971
+ if (this.semver === ANY$2) this.value = "";
972
+ else this.value = this.operator + this.semver.version;
973
+ debug("comp", this);
974
+ }
975
+ parse(comp) {
976
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
977
+ const m = comp.match(r);
978
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
979
+ this.operator = m[1] !== void 0 ? m[1] : "";
980
+ if (this.operator === "=") this.operator = "";
981
+ if (!m[2]) this.semver = ANY$2;
982
+ else this.semver = new SemVer$5(m[2], this.options.loose);
983
+ }
984
+ toString() {
985
+ return this.value;
986
+ }
987
+ test(version) {
988
+ debug("Comparator.test", version, this.options.loose);
989
+ if (this.semver === ANY$2 || version === ANY$2) return true;
990
+ if (typeof version === "string") try {
991
+ version = new SemVer$5(version, this.options);
992
+ } catch (er) {
993
+ return false;
994
+ }
995
+ return cmp$1(version, this.operator, this.semver, this.options);
996
+ }
997
+ intersects(comp, options) {
998
+ if (!(comp instanceof Comparator$3)) throw new TypeError("a Comparator is required");
999
+ if (this.operator === "") {
1000
+ if (this.value === "") return true;
1001
+ return new Range$10(comp.value, options).test(this.value);
1002
+ } else if (comp.operator === "") {
1003
+ if (comp.value === "") return true;
1004
+ return new Range$10(this.value, options).test(comp.semver);
1005
+ }
1006
+ options = parseOptions(options);
1007
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
1008
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
1009
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
1010
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
1011
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
1012
+ if (cmp$1(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
1013
+ if (cmp$1(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
1014
+ return false;
1015
+ }
1016
+ };
1017
+ module.exports = Comparator$3;
1018
+ const parseOptions = require_parse_options();
1019
+ const { safeRe: re, t } = require_re();
1020
+ const cmp$1 = require_cmp();
1021
+ const debug = require_debug();
1022
+ const SemVer$5 = require_semver$1();
1023
+ const Range$10 = require_range();
1024
+ }) });
1025
+
1026
+ //#endregion
1027
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js
1028
+ var require_satisfies = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js": ((exports, module) => {
1029
+ const Range$9 = require_range();
1030
+ const satisfies$4 = (version, range, options) => {
1031
+ try {
1032
+ range = new Range$9(range, options);
1033
+ } catch (er) {
1034
+ return false;
1035
+ }
1036
+ return range.test(version);
1037
+ };
1038
+ module.exports = satisfies$4;
1039
+ }) });
1040
+
1041
+ //#endregion
1042
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js
1043
+ var require_to_comparators = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js": ((exports, module) => {
1044
+ const Range$8 = require_range();
1045
+ const toComparators$1 = (range, options) => new Range$8(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
1046
+ module.exports = toComparators$1;
1047
+ }) });
1048
+
1049
+ //#endregion
1050
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js
1051
+ var require_max_satisfying = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js": ((exports, module) => {
1052
+ const SemVer$4 = require_semver$1();
1053
+ const Range$7 = require_range();
1054
+ const maxSatisfying$1 = (versions, range, options) => {
1055
+ let max = null;
1056
+ let maxSV = null;
1057
+ let rangeObj = null;
1058
+ try {
1059
+ rangeObj = new Range$7(range, options);
1060
+ } catch (er) {
1061
+ return null;
1062
+ }
1063
+ versions.forEach((v) => {
1064
+ if (rangeObj.test(v)) {
1065
+ if (!max || maxSV.compare(v) === -1) {
1066
+ max = v;
1067
+ maxSV = new SemVer$4(max, options);
1068
+ }
1069
+ }
1070
+ });
1071
+ return max;
1072
+ };
1073
+ module.exports = maxSatisfying$1;
1074
+ }) });
1075
+
1076
+ //#endregion
1077
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js
1078
+ var require_min_satisfying = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js": ((exports, module) => {
1079
+ const SemVer$3 = require_semver$1();
1080
+ const Range$6 = require_range();
1081
+ const minSatisfying$1 = (versions, range, options) => {
1082
+ let min = null;
1083
+ let minSV = null;
1084
+ let rangeObj = null;
1085
+ try {
1086
+ rangeObj = new Range$6(range, options);
1087
+ } catch (er) {
1088
+ return null;
1089
+ }
1090
+ versions.forEach((v) => {
1091
+ if (rangeObj.test(v)) {
1092
+ if (!min || minSV.compare(v) === 1) {
1093
+ min = v;
1094
+ minSV = new SemVer$3(min, options);
1095
+ }
1096
+ }
1097
+ });
1098
+ return min;
1099
+ };
1100
+ module.exports = minSatisfying$1;
1101
+ }) });
1102
+
1103
+ //#endregion
1104
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js
1105
+ var require_min_version = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js": ((exports, module) => {
1106
+ const SemVer$2 = require_semver$1();
1107
+ const Range$5 = require_range();
1108
+ const gt$2 = require_gt();
1109
+ const minVersion$1 = (range, loose) => {
1110
+ range = new Range$5(range, loose);
1111
+ let minver = new SemVer$2("0.0.0");
1112
+ if (range.test(minver)) return minver;
1113
+ minver = new SemVer$2("0.0.0-0");
1114
+ if (range.test(minver)) return minver;
1115
+ minver = null;
1116
+ for (let i = 0; i < range.set.length; ++i) {
1117
+ const comparators = range.set[i];
1118
+ let setMin = null;
1119
+ comparators.forEach((comparator) => {
1120
+ const compver = new SemVer$2(comparator.semver.version);
1121
+ switch (comparator.operator) {
1122
+ case ">":
1123
+ if (compver.prerelease.length === 0) compver.patch++;
1124
+ else compver.prerelease.push(0);
1125
+ compver.raw = compver.format();
1126
+ case "":
1127
+ case ">=":
1128
+ if (!setMin || gt$2(compver, setMin)) setMin = compver;
1129
+ break;
1130
+ case "<":
1131
+ case "<=": break;
1132
+ default: throw new Error(`Unexpected operation: ${comparator.operator}`);
1133
+ }
1134
+ });
1135
+ if (setMin && (!minver || gt$2(minver, setMin))) minver = setMin;
1136
+ }
1137
+ if (minver && range.test(minver)) return minver;
1138
+ return null;
1139
+ };
1140
+ module.exports = minVersion$1;
1141
+ }) });
1142
+
1143
+ //#endregion
1144
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js
1145
+ var require_valid = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js": ((exports, module) => {
1146
+ const Range$4 = require_range();
1147
+ const validRange$1 = (range, options) => {
1148
+ try {
1149
+ return new Range$4(range, options).range || "*";
1150
+ } catch (er) {
1151
+ return null;
1152
+ }
1153
+ };
1154
+ module.exports = validRange$1;
1155
+ }) });
1156
+
1157
+ //#endregion
1158
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js
1159
+ var require_outside = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js": ((exports, module) => {
1160
+ const SemVer$1 = require_semver$1();
1161
+ const Comparator$2 = require_comparator();
1162
+ const { ANY: ANY$1 } = Comparator$2;
1163
+ const Range$3 = require_range();
1164
+ const satisfies$3 = require_satisfies();
1165
+ const gt$1 = require_gt();
1166
+ const lt$1 = require_lt();
1167
+ const lte$1 = require_lte();
1168
+ const gte$1 = require_gte();
1169
+ const outside$3 = (version, range, hilo, options) => {
1170
+ version = new SemVer$1(version, options);
1171
+ range = new Range$3(range, options);
1172
+ let gtfn, ltefn, ltfn, comp, ecomp;
1173
+ switch (hilo) {
1174
+ case ">":
1175
+ gtfn = gt$1;
1176
+ ltefn = lte$1;
1177
+ ltfn = lt$1;
1178
+ comp = ">";
1179
+ ecomp = ">=";
1180
+ break;
1181
+ case "<":
1182
+ gtfn = lt$1;
1183
+ ltefn = gte$1;
1184
+ ltfn = gt$1;
1185
+ comp = "<";
1186
+ ecomp = "<=";
1187
+ break;
1188
+ default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
1189
+ }
1190
+ if (satisfies$3(version, range, options)) return false;
1191
+ for (let i = 0; i < range.set.length; ++i) {
1192
+ const comparators = range.set[i];
1193
+ let high = null;
1194
+ let low = null;
1195
+ comparators.forEach((comparator) => {
1196
+ if (comparator.semver === ANY$1) comparator = new Comparator$2(">=0.0.0");
1197
+ high = high || comparator;
1198
+ low = low || comparator;
1199
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
1200
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
1201
+ });
1202
+ if (high.operator === comp || high.operator === ecomp) return false;
1203
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
1204
+ else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
1205
+ }
1206
+ return true;
1207
+ };
1208
+ module.exports = outside$3;
1209
+ }) });
1210
+
1211
+ //#endregion
1212
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js
1213
+ var require_gtr = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js": ((exports, module) => {
1214
+ const outside$2 = require_outside();
1215
+ const gtr$1 = (version, range, options) => outside$2(version, range, ">", options);
1216
+ module.exports = gtr$1;
1217
+ }) });
1218
+
1219
+ //#endregion
1220
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js
1221
+ var require_ltr = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js": ((exports, module) => {
1222
+ const outside$1 = require_outside();
1223
+ const ltr$1 = (version, range, options) => outside$1(version, range, "<", options);
1224
+ module.exports = ltr$1;
1225
+ }) });
1226
+
1227
+ //#endregion
1228
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js
1229
+ var require_intersects = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js": ((exports, module) => {
1230
+ const Range$2 = require_range();
1231
+ const intersects$1 = (r1, r2, options) => {
1232
+ r1 = new Range$2(r1, options);
1233
+ r2 = new Range$2(r2, options);
1234
+ return r1.intersects(r2, options);
1235
+ };
1236
+ module.exports = intersects$1;
1237
+ }) });
1238
+
1239
+ //#endregion
1240
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js
1241
+ var require_simplify = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js": ((exports, module) => {
1242
+ const satisfies$2 = require_satisfies();
1243
+ const compare$2 = require_compare();
1244
+ module.exports = (versions, range, options) => {
1245
+ const set = [];
1246
+ let first = null;
1247
+ let prev = null;
1248
+ const v = versions.sort((a, b) => compare$2(a, b, options));
1249
+ for (const version of v) if (satisfies$2(version, range, options)) {
1250
+ prev = version;
1251
+ if (!first) first = version;
1252
+ } else {
1253
+ if (prev) set.push([first, prev]);
1254
+ prev = null;
1255
+ first = null;
1256
+ }
1257
+ if (first) set.push([first, null]);
1258
+ const ranges = [];
1259
+ for (const [min, max] of set) if (min === max) ranges.push(min);
1260
+ else if (!max && min === v[0]) ranges.push("*");
1261
+ else if (!max) ranges.push(`>=${min}`);
1262
+ else if (min === v[0]) ranges.push(`<=${max}`);
1263
+ else ranges.push(`${min} - ${max}`);
1264
+ const simplified = ranges.join(" || ");
1265
+ const original = typeof range.raw === "string" ? range.raw : String(range);
1266
+ return simplified.length < original.length ? simplified : range;
1267
+ };
1268
+ }) });
1269
+
1270
+ //#endregion
1271
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js
1272
+ var require_subset = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js": ((exports, module) => {
1273
+ const Range$1 = require_range();
1274
+ const Comparator$1 = require_comparator();
1275
+ const { ANY } = Comparator$1;
1276
+ const satisfies$1 = require_satisfies();
1277
+ const compare$1 = require_compare();
1278
+ const subset$1 = (sub, dom, options = {}) => {
1279
+ if (sub === dom) return true;
1280
+ sub = new Range$1(sub, options);
1281
+ dom = new Range$1(dom, options);
1282
+ let sawNonNull = false;
1283
+ OUTER: for (const simpleSub of sub.set) {
1284
+ for (const simpleDom of dom.set) {
1285
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
1286
+ sawNonNull = sawNonNull || isSub !== null;
1287
+ if (isSub) continue OUTER;
1288
+ }
1289
+ if (sawNonNull) return false;
1290
+ }
1291
+ return true;
1292
+ };
1293
+ const minimumVersionWithPreRelease = [new Comparator$1(">=0.0.0-0")];
1294
+ const minimumVersion = [new Comparator$1(">=0.0.0")];
1295
+ const simpleSubset = (sub, dom, options) => {
1296
+ if (sub === dom) return true;
1297
+ if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
1298
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
1299
+ else sub = minimumVersion;
1300
+ if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
1301
+ else dom = minimumVersion;
1302
+ const eqSet = /* @__PURE__ */ new Set();
1303
+ let gt$5, lt$4;
1304
+ for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt$5 = higherGT(gt$5, c, options);
1305
+ else if (c.operator === "<" || c.operator === "<=") lt$4 = lowerLT(lt$4, c, options);
1306
+ else eqSet.add(c.semver);
1307
+ if (eqSet.size > 1) return null;
1308
+ let gtltComp;
1309
+ if (gt$5 && lt$4) {
1310
+ gtltComp = compare$1(gt$5.semver, lt$4.semver, options);
1311
+ if (gtltComp > 0) return null;
1312
+ else if (gtltComp === 0 && (gt$5.operator !== ">=" || lt$4.operator !== "<=")) return null;
1313
+ }
1314
+ for (const eq$3 of eqSet) {
1315
+ if (gt$5 && !satisfies$1(eq$3, String(gt$5), options)) return null;
1316
+ if (lt$4 && !satisfies$1(eq$3, String(lt$4), options)) return null;
1317
+ for (const c of dom) if (!satisfies$1(eq$3, String(c), options)) return false;
1318
+ return true;
1319
+ }
1320
+ let higher, lower;
1321
+ let hasDomLT, hasDomGT;
1322
+ let needDomLTPre = lt$4 && !options.includePrerelease && lt$4.semver.prerelease.length ? lt$4.semver : false;
1323
+ let needDomGTPre = gt$5 && !options.includePrerelease && gt$5.semver.prerelease.length ? gt$5.semver : false;
1324
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt$4.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
1325
+ for (const c of dom) {
1326
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
1327
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
1328
+ if (gt$5) {
1329
+ if (needDomGTPre) {
1330
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
1331
+ }
1332
+ if (c.operator === ">" || c.operator === ">=") {
1333
+ higher = higherGT(gt$5, c, options);
1334
+ if (higher === c && higher !== gt$5) return false;
1335
+ } else if (gt$5.operator === ">=" && !satisfies$1(gt$5.semver, String(c), options)) return false;
1336
+ }
1337
+ if (lt$4) {
1338
+ if (needDomLTPre) {
1339
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
1340
+ }
1341
+ if (c.operator === "<" || c.operator === "<=") {
1342
+ lower = lowerLT(lt$4, c, options);
1343
+ if (lower === c && lower !== lt$4) return false;
1344
+ } else if (lt$4.operator === "<=" && !satisfies$1(lt$4.semver, String(c), options)) return false;
1345
+ }
1346
+ if (!c.operator && (lt$4 || gt$5) && gtltComp !== 0) return false;
1347
+ }
1348
+ if (gt$5 && hasDomLT && !lt$4 && gtltComp !== 0) return false;
1349
+ if (lt$4 && hasDomGT && !gt$5 && gtltComp !== 0) return false;
1350
+ if (needDomGTPre || needDomLTPre) return false;
1351
+ return true;
1352
+ };
1353
+ const higherGT = (a, b, options) => {
1354
+ if (!a) return b;
1355
+ const comp = compare$1(a.semver, b.semver, options);
1356
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
1357
+ };
1358
+ const lowerLT = (a, b, options) => {
1359
+ if (!a) return b;
1360
+ const comp = compare$1(a.semver, b.semver, options);
1361
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
1362
+ };
1363
+ module.exports = subset$1;
1364
+ }) });
1365
+
1366
+ //#endregion
1367
+ //#region node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js
1368
+ var require_semver = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js": ((exports, module) => {
1369
+ const internalRe = require_re();
1370
+ const constants = require_constants();
1371
+ const SemVer = require_semver$1();
1372
+ const identifiers = require_identifiers();
1373
+ const parse = require_parse();
1374
+ const valid = require_valid$1();
1375
+ const clean = require_clean();
1376
+ const inc = require_inc();
1377
+ const diff = require_diff();
1378
+ const major = require_major();
1379
+ const minor = require_minor();
1380
+ const patch = require_patch();
1381
+ const prerelease = require_prerelease();
1382
+ const compare = require_compare();
1383
+ const rcompare = require_rcompare();
1384
+ const compareLoose = require_compare_loose();
1385
+ const compareBuild = require_compare_build();
1386
+ const sort = require_sort();
1387
+ const rsort = require_rsort();
1388
+ const gt = require_gt();
1389
+ const lt = require_lt();
1390
+ const eq = require_eq();
1391
+ const neq = require_neq();
1392
+ const gte = require_gte();
1393
+ const lte = require_lte();
1394
+ const cmp = require_cmp();
1395
+ const coerce = require_coerce();
1396
+ const Comparator = require_comparator();
1397
+ const Range = require_range();
1398
+ const satisfies = require_satisfies();
1399
+ const toComparators = require_to_comparators();
1400
+ const maxSatisfying = require_max_satisfying();
1401
+ const minSatisfying = require_min_satisfying();
1402
+ const minVersion = require_min_version();
1403
+ const validRange = require_valid();
1404
+ const outside = require_outside();
1405
+ const gtr = require_gtr();
1406
+ const ltr = require_ltr();
1407
+ const intersects = require_intersects();
1408
+ const simplifyRange = require_simplify();
1409
+ const subset = require_subset();
1410
+ module.exports = {
1411
+ parse,
1412
+ valid,
1413
+ clean,
1414
+ inc,
1415
+ diff,
1416
+ major,
1417
+ minor,
1418
+ patch,
1419
+ prerelease,
1420
+ compare,
1421
+ rcompare,
1422
+ compareLoose,
1423
+ compareBuild,
1424
+ sort,
1425
+ rsort,
1426
+ gt,
1427
+ lt,
1428
+ eq,
1429
+ neq,
1430
+ gte,
1431
+ lte,
1432
+ cmp,
1433
+ coerce,
1434
+ Comparator,
1435
+ Range,
1436
+ satisfies,
1437
+ toComparators,
1438
+ maxSatisfying,
1439
+ minSatisfying,
1440
+ minVersion,
1441
+ validRange,
1442
+ outside,
1443
+ gtr,
1444
+ ltr,
1445
+ intersects,
1446
+ simplifyRange,
1447
+ subset,
1448
+ SemVer,
1449
+ re: internalRe.re,
1450
+ src: internalRe.src,
1451
+ tokens: internalRe.t,
1452
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
1453
+ RELEASE_TYPES: constants.RELEASE_TYPES,
1454
+ compareIdentifiers: identifiers.compareIdentifiers,
1455
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
1456
+ };
1457
+ }) });
1458
+
1459
+ //#endregion
1460
+ //#region src/controller/helpers/getCodemodConfig.ts
1461
+ const getJsonFromPath = (baseDir, fileName) => {
1462
+ const jsonPath = (0, node_path.join)(baseDir, fileName);
1463
+ try {
1464
+ const jsonContent = (0, node_fs.readFileSync)(jsonPath, "utf8");
1465
+ return JSON.parse(jsonContent);
1466
+ } catch {
1467
+ throw new Error(`Error reading ${jsonPath}`);
1468
+ }
1469
+ };
1470
+ function getCodemodConfig(codemodPath, options = {}) {
1471
+ const { throwOnError = false } = options;
1472
+ try {
1473
+ return getJsonFromPath((0, node_path.dirname)(codemodPath), "config.json");
1474
+ } catch (err) {
1475
+ if (throwOnError) throw err;
1476
+ return null;
1477
+ }
1478
+ }
1479
+
1480
+ //#endregion
1481
+ //#region src/controller/helpers/repository.ts
1482
+ /**
1483
+ * Finds the root of the project by looking for the `.git` directory.
1484
+ */
1485
+ function findProjectRoot() {
1486
+ try {
1487
+ const gitRoot = (0, node_child_process.execSync)("git rev-parse --show-toplevel", {
1488
+ cwd: process.cwd(),
1489
+ encoding: "utf8",
1490
+ stdio: [
1491
+ "ignore",
1492
+ "pipe",
1493
+ "ignore"
1494
+ ]
1495
+ }).trim();
1496
+ return gitRoot && (0, node_fs.existsSync)(gitRoot) ? gitRoot : "";
1497
+ } catch {
1498
+ return "";
1499
+ }
1500
+ }
1501
+ /**
1502
+ * Quick and dirty way of determining package roots based on
1503
+ * the presence of `package.json` files and them optimistically
1504
+ * containing a `@transferwise/components` string.
1505
+ * */
1506
+ function findPackages() {
1507
+ try {
1508
+ const packages = (0, node_child_process.execSync)([
1509
+ "find ./",
1510
+ "-type f",
1511
+ "-name \"package.json\"",
1512
+ "-not -path \"*/node_modules/*\"",
1513
+ "|",
1514
+ "xargs grep -l \"@transferwise/components\""
1515
+ ].join(" "), {
1516
+ cwd: findProjectRoot(),
1517
+ encoding: "utf8"
1518
+ }).trim().split("\n").map(node_path.default.dirname);
1519
+ if (packages.length === 0) throw new Error();
1520
+ return packages;
1521
+ } catch {
1522
+ throw new Error("No suitable package roots found in the repository.");
1523
+ }
1524
+ }
1525
+
1526
+ //#endregion
1527
+ //#region src/controller/helpers/table.ts
1528
+ /**
1529
+ * Renders an object as a table in terminal
1530
+ */
1531
+ const renderTable = (data, indexHeading = "index") => {
1532
+ const firstEntry = Object.values(data)[0];
1533
+ if (!firstEntry) {
1534
+ console.info("No data to display");
1535
+ return;
1536
+ }
1537
+ const headings = [indexHeading, ...Object.keys(firstEntry)];
1538
+ const tableData = [];
1539
+ Object.entries(data).forEach(([packageName, details]) => {
1540
+ tableData.push([packageName, ...Object.values(details)]);
1541
+ });
1542
+ const getDisplayWidth = (str) => {
1543
+ return str.replace(/\x1b\[[0-9;]*m/gu, "").length;
1544
+ };
1545
+ const columnWidths = headings.map((heading, index) => {
1546
+ const maxDataWidth = Math.max(...tableData.map((row) => getDisplayWidth(row[index] || "")));
1547
+ return Math.max(heading.length, maxDataWidth);
1548
+ });
1549
+ const firstCellLine = "─".repeat(columnWidths[0] + 2);
1550
+ const remainingLines = columnWidths.slice(1).map((width) => "─".repeat(width + 2));
1551
+ const topSeparator = `┌${firstCellLine}┬${remainingLines.join("┬")}┐`;
1552
+ const midSeparator = `├${firstCellLine}┼${remainingLines.join("┼")}┤`;
1553
+ const endSeparator = `└${firstCellLine}┴${remainingLines.join("┴")}┘`;
1554
+ const formatRow = (cells) => {
1555
+ return `│${cells.map((cell, index) => {
1556
+ const width = columnWidths[index];
1557
+ const displayWidth = getDisplayWidth(cell);
1558
+ const padding = width - displayWidth;
1559
+ return ` ${cell}${" ".repeat(Math.max(0, padding))} `;
1560
+ }).join("│")}│`;
1561
+ };
1562
+ console.info(topSeparator);
1563
+ console.info(formatRow(headings));
1564
+ console.info(midSeparator);
1565
+ tableData.forEach((row) => {
1566
+ console.info(formatRow(row));
1567
+ });
1568
+ console.info(endSeparator);
1569
+ };
1570
+
1571
+ //#endregion
1572
+ //#region src/controller/helpers/dependencyChecks.ts
1573
+ var import_semver = /* @__PURE__ */ __toESM(require_semver());
1574
+ /**
1575
+ * Checks if the installed version satisfies the given version requirement.
1576
+ */
1577
+ function isVersionSatisfied(installedVersion, versionRequirement) {
1578
+ if (!installedVersion) return false;
1579
+ if (import_semver.default.valid(installedVersion) && import_semver.default.satisfies(installedVersion, versionRequirement)) return true;
1580
+ const cleanVersion = import_semver.default.coerce(installedVersion);
1581
+ return cleanVersion ? import_semver.default.satisfies(cleanVersion.version, versionRequirement) : false;
1582
+ }
1583
+ /**
1584
+ * Retrieves the version of a dependency from node_modules of a specific package.
1585
+ */
1586
+ function getVersionFromNodeModules(packagePath, packageName) {
1587
+ try {
1588
+ const nodeModulesPackageJson = (0, node_path.join)(packagePath, "node_modules", packageName, "package.json");
1589
+ if (!(0, node_fs.existsSync)(nodeModulesPackageJson)) return "";
1590
+ return JSON.parse((0, node_fs.readFileSync)(nodeModulesPackageJson, "utf8")).version || "";
1591
+ } catch {
1592
+ return "";
1593
+ }
1594
+ }
1595
+ /**
1596
+ * Finds the closest package.json by traversing up the directory tree
1597
+ */
1598
+ function findClosestPackageJson(currentPath) {
1599
+ const resolvedPath = (0, node_path.resolve)(currentPath);
1600
+ const projectRoot = findProjectRoot();
1601
+ const packageJsonPath = (0, node_path.join)(resolvedPath, "package.json");
1602
+ if ((0, node_fs.existsSync)(packageJsonPath)) return resolvedPath;
1603
+ if (projectRoot && resolvedPath === projectRoot) return null;
1604
+ const parentPath = (0, node_path.dirname)(resolvedPath);
1605
+ if (parentPath === resolvedPath) return null;
1606
+ return findClosestPackageJson(parentPath);
1607
+ }
1608
+ /**
1609
+ * Assesses whether the given package meets the prerequisites defined in the codemod's config.json.
1610
+ */
1611
+ const assessPrerequisites = (packagePath, codemodPath) => {
1612
+ try {
1613
+ const SYMBOL = {
1614
+ OK: "\x1B[32m✔\x1B[0m",
1615
+ FAIL: "\x1B[31m✗\x1B[0m"
1616
+ };
1617
+ const codemodConfig = getJsonFromPath((0, node_path.dirname)(codemodPath), "config.json");
1618
+ const resolvedPackagePath = (0, node_path.resolve)(process.cwd(), packagePath);
1619
+ const actualPackagePath = (0, node_fs.existsSync)((0, node_path.join)(resolvedPackagePath, "package.json")) ? resolvedPackagePath : findClosestPackageJson(resolvedPackagePath);
1620
+ if (!actualPackagePath) {
1621
+ console.error(`${SYMBOL.FAIL} \x1b[1mCould not find a package.json in or above ${packagePath}\x1b[0m`);
1622
+ return false;
1623
+ }
1624
+ if (actualPackagePath !== resolvedPackagePath) console.info(`Using package.json from ${actualPackagePath} for dependency checks`);
1625
+ const { dependencies = {}, peerDependencies = {} } = getJsonFromPath(actualPackagePath, "package.json");
1626
+ const comparisons = {};
1627
+ let isCompliant = true;
1628
+ if (codemodConfig.prerequisites) Object.entries(codemodConfig.prerequisites).forEach(([name, versionRequirement]) => {
1629
+ const nodeModulesVersion = getVersionFromNodeModules(actualPackagePath, name);
1630
+ const isDependencySatisfied = isVersionSatisfied(dependencies[name], versionRequirement);
1631
+ const isPeerDependencySatisfied = isVersionSatisfied(peerDependencies[name], versionRequirement);
1632
+ const isInstalledSatisfied = isVersionSatisfied(nodeModulesVersion, versionRequirement);
1633
+ if (!isDependencySatisfied && !isPeerDependencySatisfied || !isInstalledSatisfied) {
1634
+ isCompliant = false;
1635
+ comparisons[name] = {
1636
+ required: versionRequirement,
1637
+ dependencies: isDependencySatisfied ? SYMBOL.OK : `${SYMBOL.FAIL} ${dependencies[name] || "N/A"}`,
1638
+ peerDependencies: isPeerDependencySatisfied ? SYMBOL.OK : `${SYMBOL.FAIL} ${peerDependencies[name] || "N/A"}`,
1639
+ node_modules: isInstalledSatisfied ? SYMBOL.OK : `${SYMBOL.FAIL} ${nodeModulesVersion || "N/A"}`
1640
+ };
1641
+ }
1642
+ });
1643
+ if (!isCompliant) {
1644
+ console.info(`${SYMBOL.FAIL} \x1b[1mPrerequisite check failed.\x1b[0m`);
1645
+ renderTable(comparisons, "package");
1646
+ return false;
1647
+ }
1648
+ return true;
1649
+ } catch (error) {
1650
+ console.error("Cannot assess the state of prerequisites:", error);
1651
+ return false;
1652
+ }
1653
+ };
1654
+
1655
+ //#endregion
1656
+ //#region src/controller/helpers/getOptions.ts
1657
+ /**
1658
+ * if args are provided via CLI, log them to the console in
1659
+ * a formatted way matching Inquirer's style
1660
+ */
1661
+ const logToInquirer = (label, value) => {
1662
+ const checkmark = "\x1B[32m✔\x1B[0m";
1663
+ const boldLabel = `\x1b[1m${label}\x1b[0m`;
1664
+ const greenValue = `\x1b[32m${value}\x1b[0m`;
1665
+ console.info(`${checkmark} ${boldLabel} ${greenValue}`);
1666
+ };
1667
+ /**
1668
+ * Get all directories recursively for autocomplete
1669
+ */
1670
+ const getDirectoryChoices = (rootPath, currentInput = "", maxDepth = 3) => {
1671
+ const MAX_FILTERED_CHOICES = 10;
1672
+ const MAX_DEFAULT_CHOICES = 20;
1673
+ const SKIP_DIRS = new Set([
1674
+ "node_modules",
1675
+ "dist",
1676
+ "build",
1677
+ "coverage",
1678
+ ".git",
1679
+ ".next",
1680
+ ".nuxt",
1681
+ ".vscode",
1682
+ ".idea"
1683
+ ]);
1684
+ const choices = /* @__PURE__ */ new Set();
1685
+ choices.add(".");
1686
+ const scanDirectory = (dirPath, depth = 0) => {
1687
+ if (depth >= maxDepth) return;
1688
+ try {
1689
+ const items = (0, node_fs.readdirSync)(dirPath, { withFileTypes: true });
1690
+ for (const item of items) if (!item.name.startsWith(".") && !SKIP_DIRS.has(item.name)) {
1691
+ if (item.isDirectory()) {
1692
+ const fullPath = (0, node_path.join)(dirPath, item.name);
1693
+ const relativePath = (0, node_path.relative)(rootPath, fullPath);
1694
+ if (relativePath && !relativePath.startsWith("..") && !relativePath.includes("..")) {
1695
+ choices.add(relativePath);
1696
+ scanDirectory(fullPath, depth + 1);
1697
+ }
1698
+ }
1699
+ }
1700
+ } catch {}
1701
+ };
1702
+ scanDirectory(rootPath);
1703
+ const allChoices = Array.from(choices).sort();
1704
+ if (currentInput.trim()) {
1705
+ const inputLower = currentInput.toLowerCase();
1706
+ return allChoices.filter((choice) => choice.toLowerCase().includes(inputLower)).slice(0, MAX_FILTERED_CHOICES);
1707
+ }
1708
+ return allChoices.slice(0, MAX_DEFAULT_CHOICES);
1709
+ };
1710
+ /**
1711
+ * Lets user pick from available packages to run the codemod on
1712
+ */
1713
+ const queryPackages = async (packages) => {
1714
+ const message = "Path to run codemod on:";
1715
+ const nonRootPackages = packages.filter((pkg) => pkg !== "." && pkg !== "./");
1716
+ if (packages.length === 1 && (packages[0] === "." || packages[0] === "./")) {
1717
+ if (await (0, __inquirer_prompts.confirm)({
1718
+ message: "Do you want to target a specific folder instead of the entire project?",
1719
+ default: false
1720
+ })) {
1721
+ const customPath = await (0, __inquirer_prompts.search)({
1722
+ message: "Enter the folder path (relative to project root):",
1723
+ source: async (searchInput) => {
1724
+ const rootPath = process.cwd();
1725
+ return getDirectoryChoices(rootPath, searchInput || "").map((choice) => ({
1726
+ name: choice === "." ? ". (entire project)" : choice,
1727
+ value: choice,
1728
+ description: choice === "." ? "Target the entire project" : `Target ${choice} directory`
1729
+ }));
1730
+ },
1731
+ validate: (path$3) => {
1732
+ if (!path$3?.trim()) return "Path cannot be empty";
1733
+ const fullPath = (0, node_path.join)(process.cwd(), path$3);
1734
+ if (!(0, node_fs.existsSync)(fullPath)) return "Folder does not exist";
1735
+ if (!(0, node_fs.statSync)(fullPath).isDirectory()) return "Path must be a directory";
1736
+ return true;
1737
+ }
1738
+ });
1739
+ logToInquirer(message, customPath);
1740
+ return [customPath];
1741
+ }
1742
+ logToInquirer(message, packages[0] === "./" ? "." : packages[0]);
1743
+ return [packages[0] === "./" ? "." : packages[0]];
1744
+ }
1745
+ if (nonRootPackages.length >= 1) return (0, __inquirer_prompts.checkbox)({
1746
+ required: true,
1747
+ message: "Select packages to transform:",
1748
+ choices: nonRootPackages.map((file) => ({
1749
+ name: file,
1750
+ value: file,
1751
+ checked: true
1752
+ }))
1753
+ });
1754
+ return ["."];
1755
+ };
1756
+ /**
1757
+ * Determine user choice between CLI arg and Inquirer prompt: codemod
1758
+ */
1759
+ const determineTransformer = async ({ candidate, transformFiles }) => {
1760
+ const codemodMessage = "Select codemod to run:";
1761
+ if (candidate && transformFiles.includes(candidate)) {
1762
+ logToInquirer(codemodMessage, candidate);
1763
+ return candidate;
1764
+ }
1765
+ return (0, __inquirer_prompts.select)({
1766
+ message: codemodMessage,
1767
+ choices: transformFiles.map((file) => ({
1768
+ name: file,
1769
+ value: file
1770
+ }))
1771
+ });
1772
+ };
1773
+ /**
1774
+ * Determine user choice between CLI arg and Inquirer prompt: paths/packages to process
1775
+ */
1776
+ const determinePaths = async ({ candidate, root, packages }) => {
1777
+ const targetPaths = [];
1778
+ if (candidate && (0, node_fs.existsSync)((0, node_path.join)(root, candidate))) {
1779
+ logToInquirer("Path to run codemod on", candidate);
1780
+ targetPaths.push(candidate);
1781
+ }
1782
+ if (!targetPaths.length) {
1783
+ const packagesToProcess = await queryPackages(packages);
1784
+ targetPaths.push(...packagesToProcess ?? []);
1785
+ }
1786
+ return targetPaths;
1787
+ };
1788
+ /**
1789
+ * Determine user choice between CLI arg and Inquirer prompt: dry mode
1790
+ */
1791
+ const determineIsDryMode = async (args) => {
1792
+ const message = "Run in dry mode (no changes written to files)?";
1793
+ if (args.includes("--dry") || args.includes("--dry-run")) {
1794
+ logToInquirer(message, "Yes");
1795
+ return true;
1796
+ }
1797
+ return (0, __inquirer_prompts.confirm)({
1798
+ message,
1799
+ default: false
1800
+ });
1801
+ };
1802
+ /**
1803
+ * Determine user choice between CLI arg and Inquirer prompt: print to CLI
1804
+ */
1805
+ const determineIsPrint = async (args) => {
1806
+ const message = "Print transformed source to console?";
1807
+ if (args.includes("--print")) {
1808
+ logToInquirer(message, "Yes");
1809
+ return true;
1810
+ }
1811
+ return (0, __inquirer_prompts.confirm)({
1812
+ message,
1813
+ default: false
1814
+ });
1815
+ };
1816
+ const ALWAYS_IGNORED_FOLDERS = ["node_modules/**", ".next/**"];
1817
+ /**
1818
+ * Determine user choice between CLI arg and Inquirer prompt: ignore patterns
1819
+ */
1820
+ const determineIgnorePatterns = async (args) => {
1821
+ const message = "Enter ignore pattern(s) (comma separated) or leave empty:";
1822
+ const ignorePatternIndex = args.findIndex((arg) => arg === "--ignore-pattern");
1823
+ let ignorePattern;
1824
+ if (ignorePatternIndex !== -1 && args.length > ignorePatternIndex + 1) ignorePattern = args[ignorePatternIndex + 1];
1825
+ let userPatterns;
1826
+ if (ignorePattern) {
1827
+ logToInquirer(message, ignorePattern);
1828
+ userPatterns = ignorePattern;
1829
+ } else userPatterns = await (0, __inquirer_prompts.input)({
1830
+ message,
1831
+ validate: () => true
1832
+ });
1833
+ const allPatterns = [...ALWAYS_IGNORED_FOLDERS];
1834
+ if (userPatterns && userPatterns.trim()) allPatterns.push(...userPatterns.split(",").map((p) => p.trim()));
1835
+ return allPatterns.join(",");
1836
+ };
1837
+ /**
1838
+ * Determine user choice between CLI arg and Inquirer prompt: gitignore
1839
+ */
1840
+ const determineGitIgnore = async (args) => {
1841
+ const message = "Respect .gitignore files?";
1842
+ if (args.includes("--gitignore")) {
1843
+ logToInquirer(message, "Yes");
1844
+ return true;
1845
+ }
1846
+ if (args.includes("--no-gitignore")) {
1847
+ logToInquirer(message, "No");
1848
+ return false;
1849
+ }
1850
+ return (0, __inquirer_prompts.confirm)({
1851
+ message,
1852
+ default: true
1853
+ });
1854
+ };
1855
+ async function getOptions({ transformFiles, packages, root, preselectedTransformFile }) {
1856
+ const args = process.argv.slice(2);
1857
+ if (preselectedTransformFile && args[0] === preselectedTransformFile) args.shift();
1858
+ const transformFile = preselectedTransformFile || await determineTransformer({
1859
+ candidate: args[0] ?? "",
1860
+ transformFiles
1861
+ });
1862
+ const pathCandidate = preselectedTransformFile ? args[0] ?? "" : args[1] ?? "";
1863
+ const targetPaths = await determinePaths({
1864
+ candidate: pathCandidate,
1865
+ root,
1866
+ packages
1867
+ });
1868
+ const isDry = await determineIsDryMode(args);
1869
+ const isPrint = await determineIsPrint(args);
1870
+ const ignorePatterns = await determineIgnorePatterns(args);
1871
+ const useGitIgnore = await determineGitIgnore(args);
1872
+ return {
1873
+ transformFile,
1874
+ targetPaths,
1875
+ isDry,
1876
+ isPrint,
1877
+ ignorePatterns,
1878
+ useGitIgnore
1879
+ };
1880
+ }
1881
+ var getOptions_default = getOptions;
1882
+
1883
+ //#endregion
1884
+ //#region src/controller/helpers/loadTransformModules.ts
1885
+ async function loadTransformModules(transformsDir) {
1886
+ let transformModules = {};
1887
+ const transformers = await node_fs.promises.readdir(transformsDir);
1888
+ const transformFiles = await Promise.all(transformers.map(async (name) => {
1889
+ const transformModule = await import(node_path.default.join(transformsDir, name, "transformer.js"));
1890
+ transformModules = {
1891
+ ...transformModules,
1892
+ [name]: transformModule.default.default
1893
+ };
1894
+ return name;
1895
+ }));
1896
+ return {
1897
+ transformModules,
1898
+ transformFiles
1899
+ };
1900
+ }
1901
+ var loadTransformModules_default = loadTransformModules;
1902
+
1903
+ //#endregion
1904
+ //#region src/controller/helpers/reportManualReview.ts
1905
+ const REPORT_PATH = node_path.default.resolve(process.cwd(), "codemod-report.txt");
1906
+ const reportManualReview = async (filePath, message) => {
1907
+ const lineNumber = /at line (\d+)/u.exec(message)?.[1];
1908
+ const cleanMessage = message.replace(/ at line \d+/u, "");
1909
+ const lineInfo = lineNumber ? `:${lineNumber}` : "";
1910
+ try {
1911
+ await node_fs_promises.default.access(REPORT_PATH);
1912
+ (await node_fs_promises.default.readFile(REPORT_PATH, "utf8")).trim();
1913
+ } catch {}
1914
+ const args = process.argv;
1915
+ const transformIndex = args.findIndex((arg) => arg.endsWith("transformer.js"));
1916
+ if (transformIndex >= 0) {
1917
+ const transformPath = args[transformIndex];
1918
+ const transformDir = node_path.default.dirname(transformPath);
1919
+ node_path.default.basename(transformDir);
1920
+ }
1921
+ const content = `[${filePath}${lineInfo}] ${cleanMessage}\n`;
1922
+ await node_fs_promises.default.appendFile(REPORT_PATH, content, "utf8");
1923
+ };
1924
+ var reportManualReview_default = reportManualReview;
1925
+
1926
+ //#endregion
1927
+ //#region src/controller/helpers/runTransformPrompts.ts
1928
+ async function askPrompt(p) {
1929
+ switch (p.type) {
1930
+ case "select": return (0, __inquirer_prompts.select)({
1931
+ message: p.message,
1932
+ choices: (p.choices ?? []).map((c) => ({
1933
+ name: c.name,
1934
+ value: c.value
1935
+ })),
1936
+ default: p.default
1937
+ });
1938
+ case "confirm": return (0, __inquirer_prompts.confirm)({
1939
+ message: p.message,
1940
+ default: typeof p.default === "boolean" ? p.default : false
1941
+ });
1942
+ case "input":
1943
+ default: return (0, __inquirer_prompts.input)({
1944
+ message: p.message,
1945
+ default: p.default ?? ""
1946
+ });
1947
+ }
1948
+ }
1949
+ async function runTransformPrompts(codemodPath) {
1950
+ const config = getCodemodConfig(codemodPath);
1951
+ if (!config?.prompts?.length) return {};
1952
+ const answers = {};
1953
+ for (const prompt of config.prompts) try {
1954
+ answers[prompt.key] = await askPrompt(prompt);
1955
+ } catch (error) {
1956
+ console.warn(`Failed to execute prompt "${prompt.key}": ${error instanceof Error ? error.message : String(error)}`);
1957
+ if (prompt.default !== void 0) {
1958
+ console.info(`Using default value for "${prompt.key}": ${prompt.default}`);
1959
+ answers[prompt.key] = prompt.default;
1960
+ } else console.info(`Skipping prompt "${prompt.key}" - no default value available`);
1961
+ }
1962
+ return answers;
1963
+ }
1964
+
1965
+ //#endregion
1966
+ Object.defineProperty(exports, '__toESM', {
1967
+ enumerable: true,
1968
+ get: function () {
1969
+ return __toESM;
1970
+ }
1971
+ });
1972
+ Object.defineProperty(exports, 'assessPrerequisites', {
1973
+ enumerable: true,
1974
+ get: function () {
1975
+ return assessPrerequisites;
1976
+ }
1977
+ });
1978
+ Object.defineProperty(exports, 'findPackages', {
1979
+ enumerable: true,
1980
+ get: function () {
1981
+ return findPackages;
1982
+ }
1983
+ });
1984
+ Object.defineProperty(exports, 'findProjectRoot', {
1985
+ enumerable: true,
1986
+ get: function () {
1987
+ return findProjectRoot;
1988
+ }
1989
+ });
1990
+ Object.defineProperty(exports, 'getOptions_default', {
1991
+ enumerable: true,
1992
+ get: function () {
1993
+ return getOptions_default;
1994
+ }
1995
+ });
1996
+ Object.defineProperty(exports, 'loadTransformModules_default', {
1997
+ enumerable: true,
1998
+ get: function () {
1999
+ return loadTransformModules_default;
2000
+ }
2001
+ });
2002
+ Object.defineProperty(exports, 'logToInquirer', {
2003
+ enumerable: true,
2004
+ get: function () {
2005
+ return logToInquirer;
2006
+ }
2007
+ });
2008
+ Object.defineProperty(exports, 'reportManualReview_default', {
2009
+ enumerable: true,
2010
+ get: function () {
2011
+ return reportManualReview_default;
2012
+ }
2013
+ });
2014
+ Object.defineProperty(exports, 'runTransformPrompts', {
2015
+ enumerable: true,
2016
+ get: function () {
2017
+ return runTransformPrompts;
2018
+ }
2019
+ });
2020
+ //# sourceMappingURL=helpers-auDAwIcO.js.map