@voidzero-dev/vite-plus-core 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE +175 -30
  2. package/dist/rolldown/cli.mjs +25 -14
  3. package/dist/rolldown/config.d.mts +1 -1
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-index.d.mts +15 -5
  6. package/dist/rolldown/experimental-index.mjs +23 -17
  7. package/dist/rolldown/filter-index.d.mts +1 -1
  8. package/dist/rolldown/index.d.mts +2 -2
  9. package/dist/rolldown/index.mjs +4 -4
  10. package/dist/rolldown/parallel-plugin-worker.mjs +5 -4
  11. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  12. package/dist/rolldown/parse-ast-index.d.mts +1 -1
  13. package/dist/rolldown/parse-ast-index.mjs +1 -1
  14. package/dist/rolldown/plugins-index.d.mts +3 -3
  15. package/dist/rolldown/plugins-index.mjs +2 -2
  16. package/dist/rolldown/shared/{binding-DgGsNpT9.d.mts → binding-B1q9aYT-.d.mts} +65 -142
  17. package/dist/rolldown/shared/{binding-CfwqjDbP.mjs → binding-BmkJW3Wy.mjs} +39 -35
  18. package/dist/rolldown/shared/{bindingify-input-options--chmbDhw.mjs → bindingify-input-options-Cmm60vfj.mjs} +1330 -1331
  19. package/dist/rolldown/shared/{constructors-Bx1tSad6.d.mts → constructors-2i1T9YcF.d.mts} +3 -4
  20. package/dist/rolldown/shared/{constructors-DnT9y_13.mjs → constructors-CE6zZSUt.mjs} +2 -5
  21. package/dist/rolldown/shared/{define-config-ChOOV2QZ.d.mts → define-config-BBz954-q.d.mts} +2 -2
  22. package/dist/rolldown/shared/{error-C0TrL0_H.mjs → error-BlQ0-ek7.mjs} +1 -1
  23. package/dist/rolldown/shared/{load-config-BXgGQtnA.mjs → load-config-CVVMWSlg.mjs} +1 -1
  24. package/dist/rolldown/shared/{normalize-string-or-regex-DGbe3BlX.mjs → normalize-string-or-regex-BYkbbGqQ.mjs} +1 -1
  25. package/dist/rolldown/shared/{parse-26ORR8fZ.mjs → parse-Dphnedsw.mjs} +2 -2
  26. package/dist/rolldown/shared/{prompt-DV1XbtjC.mjs → prompt-Bgj-uEyc.mjs} +5 -5
  27. package/dist/rolldown/shared/{resolve-tsconfig-D3YLh9ff.mjs → resolve-tsconfig-CdIAR1Eb.mjs} +2 -2
  28. package/dist/rolldown/shared/{rolldown-DpXXI00f.mjs → rolldown-Bnp916iM.mjs} +1 -1
  29. package/dist/rolldown/shared/{rolldown-build-D8R4Zzfy.mjs → rolldown-build-Cs2iVJuw.mjs} +24 -56
  30. package/dist/rolldown/shared/{transform-C-XSNVrd.d.mts → transform-CEmFsvJW.d.mts} +1 -1
  31. package/dist/rolldown/shared/{watch-D5Zm0Vsz.mjs → watch-ECGr-_QS.mjs} +4 -4
  32. package/dist/rolldown/utils-index.d.mts +3 -3
  33. package/dist/rolldown/utils-index.mjs +6 -6
  34. package/dist/tsdown/{build-B_nvJe4A-BkmlHYK-.js → build-B_nvJe4A-CcOht0gr.js} +30 -96
  35. package/dist/tsdown/debug-DLdR-9XB-CDf7D82m.js +250 -0
  36. package/dist/tsdown/{detect-B97OSl92-B5bcx_Ya.js → detect-B97OSl92-kGHGL-qU.js} +1 -1
  37. package/dist/tsdown/{dist-4h5bgYzo.js → dist-580owkGv.js} +30 -25
  38. package/dist/tsdown/general-Cp4NiJNK-BYPTHEzb.js +97 -0
  39. package/dist/tsdown/index-types.d.ts +197 -7
  40. package/dist/tsdown/index.js +3 -3
  41. package/dist/tsdown/internal-CUXleGMS.js +3 -0
  42. package/dist/tsdown/{main-BMtwTklr.js → main-BlTcyuFi.js} +2 -341
  43. package/dist/tsdown/npm_entry_picomatch.cjs +4 -2
  44. package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +5 -1
  45. package/dist/tsdown/{resolver-DtsKFXi2-DQOmVgSY.js → resolver-DtsKFXi2-B8Z3WwZh.js} +1 -1
  46. package/dist/tsdown/run.js +4 -3
  47. package/dist/tsdown/src-njF8VL4a.js +622 -0
  48. package/dist/tsdown/target-CqeSqtms-ZU1Gv6-M.js +79 -0
  49. package/dist/tsdown/{tsc-15OYetCl.js → tsc-CsN85f7a.js} +3 -3
  50. package/dist/tsdown/{tsc-context-DfwSQt2q.js → tsc-context-CX_GXdyS.js} +2 -2
  51. package/dist/tsdown/tsdown-css.js +874 -0
  52. package/dist/tsdown/tsdown-exe.js +949 -0
  53. package/dist/vite/client/client.mjs +7 -9
  54. package/dist/vite/client.d.ts +3 -0
  55. package/dist/vite/node/chunks/build.js +27 -34
  56. package/dist/vite/node/chunks/dist.js +23 -23
  57. package/dist/vite/node/chunks/dist2.js +3 -3
  58. package/dist/vite/node/chunks/logger.js +4 -4
  59. package/dist/vite/node/chunks/node.js +12354 -11629
  60. package/dist/vite/node/chunks/postcss-import.js +10 -10
  61. package/dist/vite/node/cli.js +3 -3
  62. package/dist/vite/node/index.d.ts +139 -14
  63. package/dist/vite/node/index.js +1 -1
  64. package/dist/vite/node/module-runner.js +4 -4
  65. package/dist/vite/types/importGlob.d.ts +48 -6
  66. package/package.json +14 -20
@@ -0,0 +1,949 @@
1
+ import { d as __commonJSMin, m as __toESM } from "./general-Cp4NiJNK-BYPTHEzb.js";
2
+ import { r as createDebug, t as R } from "./main-BlTcyuFi.js";
3
+ import { a as fsRemove, i as fsExists } from "./target-CqeSqtms-ZU1Gv6-M.js";
4
+ import "./internal-CUXleGMS.js";
5
+ import process$1 from "node:process";
6
+ import path from "node:path";
7
+ import { chmod, mkdir, rename, writeFile } from "node:fs/promises";
8
+ import os from "node:os";
9
+ import { Buffer } from "node:buffer";
10
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/lrucache.js
11
+ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12
+ var LRUCache = class {
13
+ constructor() {
14
+ this.max = 1e3;
15
+ this.map = /* @__PURE__ */ new Map();
16
+ }
17
+ get(key) {
18
+ const value = this.map.get(key);
19
+ if (value === void 0) return;
20
+ else {
21
+ this.map.delete(key);
22
+ this.map.set(key, value);
23
+ return value;
24
+ }
25
+ }
26
+ delete(key) {
27
+ return this.map.delete(key);
28
+ }
29
+ set(key, value) {
30
+ if (!this.delete(key) && value !== void 0) {
31
+ if (this.map.size >= this.max) {
32
+ const firstKey = this.map.keys().next().value;
33
+ this.delete(firstKey);
34
+ }
35
+ this.map.set(key, value);
36
+ }
37
+ return this;
38
+ }
39
+ };
40
+ module.exports = LRUCache;
41
+ }));
42
+ //#endregion
43
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/parse-options.js
44
+ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
45
+ const looseOption = Object.freeze({ loose: true });
46
+ const emptyOpts = Object.freeze({});
47
+ const parseOptions = (options) => {
48
+ if (!options) return emptyOpts;
49
+ if (typeof options !== "object") return looseOption;
50
+ return options;
51
+ };
52
+ module.exports = parseOptions;
53
+ }));
54
+ //#endregion
55
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/constants.js
56
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
57
+ const SEMVER_SPEC_VERSION = "2.0.0";
58
+ const MAX_LENGTH = 256;
59
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
60
+ module.exports = {
61
+ MAX_LENGTH,
62
+ MAX_SAFE_COMPONENT_LENGTH: 16,
63
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
64
+ MAX_SAFE_INTEGER,
65
+ RELEASE_TYPES: [
66
+ "major",
67
+ "premajor",
68
+ "minor",
69
+ "preminor",
70
+ "patch",
71
+ "prepatch",
72
+ "prerelease"
73
+ ],
74
+ SEMVER_SPEC_VERSION,
75
+ FLAG_INCLUDE_PRERELEASE: 1,
76
+ FLAG_LOOSE: 2
77
+ };
78
+ }));
79
+ //#endregion
80
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/debug.js
81
+ var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
83
+ }));
84
+ //#endregion
85
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/re.js
86
+ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
87
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
88
+ const debug = require_debug();
89
+ exports = module.exports = {};
90
+ const re = exports.re = [];
91
+ const safeRe = exports.safeRe = [];
92
+ const src = exports.src = [];
93
+ const safeSrc = exports.safeSrc = [];
94
+ const t = exports.t = {};
95
+ let R = 0;
96
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
97
+ const safeRegexReplacements = [
98
+ ["\\s", 1],
99
+ ["\\d", MAX_LENGTH],
100
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
101
+ ];
102
+ const makeSafeRegex = (value) => {
103
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
104
+ return value;
105
+ };
106
+ const createToken = (name, value, isGlobal) => {
107
+ const safe = makeSafeRegex(value);
108
+ const index = R++;
109
+ debug(name, index, value);
110
+ t[name] = index;
111
+ src[index] = value;
112
+ safeSrc[index] = safe;
113
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
114
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
115
+ };
116
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
117
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
118
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
119
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
120
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
121
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
122
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
123
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
124
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
125
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
126
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
127
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
128
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
129
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
130
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
131
+ createToken("GTLT", "((?:<|>)?=?)");
132
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
133
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
134
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
135
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
136
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
137
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
138
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
139
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
140
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
141
+ createToken("COERCERTL", src[t.COERCE], true);
142
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
143
+ createToken("LONETILDE", "(?:~>?)");
144
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
145
+ exports.tildeTrimReplace = "$1~";
146
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
147
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
148
+ createToken("LONECARET", "(?:\\^)");
149
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
150
+ exports.caretTrimReplace = "$1^";
151
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
152
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
153
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
154
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
155
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
156
+ exports.comparatorTrimReplace = "$1$2$3";
157
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
158
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
159
+ createToken("STAR", "(<|>)?=?\\s*\\*");
160
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
161
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
162
+ }));
163
+ //#endregion
164
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/identifiers.js
165
+ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
166
+ const numeric = /^[0-9]+$/;
167
+ const compareIdentifiers = (a, b) => {
168
+ if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
169
+ const anum = numeric.test(a);
170
+ const bnum = numeric.test(b);
171
+ if (anum && bnum) {
172
+ a = +a;
173
+ b = +b;
174
+ }
175
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
176
+ };
177
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
178
+ module.exports = {
179
+ compareIdentifiers,
180
+ rcompareIdentifiers
181
+ };
182
+ }));
183
+ //#endregion
184
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/semver.js
185
+ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
186
+ const debug = require_debug();
187
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
188
+ const { safeRe: re, t } = require_re();
189
+ const parseOptions = require_parse_options();
190
+ const { compareIdentifiers } = require_identifiers();
191
+ const isPrereleaseIdentifier = (prerelease, identifier) => {
192
+ const identifiers = identifier.split(".");
193
+ if (identifiers.length > prerelease.length) return false;
194
+ for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
195
+ return true;
196
+ };
197
+ module.exports = class SemVer {
198
+ constructor(version, options) {
199
+ options = parseOptions(options);
200
+ if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
201
+ else version = version.version;
202
+ else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
203
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
204
+ debug("SemVer", version, options);
205
+ this.options = options;
206
+ this.loose = !!options.loose;
207
+ this.includePrerelease = !!options.includePrerelease;
208
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
209
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
210
+ this.raw = version;
211
+ this.major = +m[1];
212
+ this.minor = +m[2];
213
+ this.patch = +m[3];
214
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
215
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
216
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
217
+ if (!m[4]) this.prerelease = [];
218
+ else this.prerelease = m[4].split(".").map((id) => {
219
+ if (/^[0-9]+$/.test(id)) {
220
+ const num = +id;
221
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
222
+ }
223
+ return id;
224
+ });
225
+ this.build = m[5] ? m[5].split(".") : [];
226
+ this.format();
227
+ }
228
+ format() {
229
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
230
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
231
+ return this.version;
232
+ }
233
+ toString() {
234
+ return this.version;
235
+ }
236
+ compare(other) {
237
+ debug("SemVer.compare", this.version, this.options, other);
238
+ if (!(other instanceof SemVer)) {
239
+ if (typeof other === "string" && other === this.version) return 0;
240
+ other = new SemVer(other, this.options);
241
+ }
242
+ if (other.version === this.version) return 0;
243
+ return this.compareMain(other) || this.comparePre(other);
244
+ }
245
+ compareMain(other) {
246
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
247
+ if (this.major < other.major) return -1;
248
+ if (this.major > other.major) return 1;
249
+ if (this.minor < other.minor) return -1;
250
+ if (this.minor > other.minor) return 1;
251
+ if (this.patch < other.patch) return -1;
252
+ if (this.patch > other.patch) return 1;
253
+ return 0;
254
+ }
255
+ comparePre(other) {
256
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
257
+ if (this.prerelease.length && !other.prerelease.length) return -1;
258
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
259
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
260
+ let i = 0;
261
+ do {
262
+ const a = this.prerelease[i];
263
+ const b = other.prerelease[i];
264
+ debug("prerelease compare", i, a, b);
265
+ if (a === void 0 && b === void 0) return 0;
266
+ else if (b === void 0) return 1;
267
+ else if (a === void 0) return -1;
268
+ else if (a === b) continue;
269
+ else return compareIdentifiers(a, b);
270
+ } while (++i);
271
+ }
272
+ compareBuild(other) {
273
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
274
+ let i = 0;
275
+ do {
276
+ const a = this.build[i];
277
+ const b = other.build[i];
278
+ debug("build compare", i, a, b);
279
+ if (a === void 0 && b === void 0) return 0;
280
+ else if (b === void 0) return 1;
281
+ else if (a === void 0) return -1;
282
+ else if (a === b) continue;
283
+ else return compareIdentifiers(a, b);
284
+ } while (++i);
285
+ }
286
+ inc(release, identifier, identifierBase) {
287
+ if (release.startsWith("pre")) {
288
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
289
+ if (identifier) {
290
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
291
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
292
+ }
293
+ }
294
+ switch (release) {
295
+ case "premajor":
296
+ this.prerelease.length = 0;
297
+ this.patch = 0;
298
+ this.minor = 0;
299
+ this.major++;
300
+ this.inc("pre", identifier, identifierBase);
301
+ break;
302
+ case "preminor":
303
+ this.prerelease.length = 0;
304
+ this.patch = 0;
305
+ this.minor++;
306
+ this.inc("pre", identifier, identifierBase);
307
+ break;
308
+ case "prepatch":
309
+ this.prerelease.length = 0;
310
+ this.inc("patch", identifier, identifierBase);
311
+ this.inc("pre", identifier, identifierBase);
312
+ break;
313
+ case "prerelease":
314
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
315
+ this.inc("pre", identifier, identifierBase);
316
+ break;
317
+ case "release":
318
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
319
+ this.prerelease.length = 0;
320
+ break;
321
+ case "major":
322
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
323
+ this.minor = 0;
324
+ this.patch = 0;
325
+ this.prerelease = [];
326
+ break;
327
+ case "minor":
328
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
329
+ this.patch = 0;
330
+ this.prerelease = [];
331
+ break;
332
+ case "patch":
333
+ if (this.prerelease.length === 0) this.patch++;
334
+ this.prerelease = [];
335
+ break;
336
+ case "pre": {
337
+ const base = Number(identifierBase) ? 1 : 0;
338
+ if (this.prerelease.length === 0) this.prerelease = [base];
339
+ else {
340
+ let i = this.prerelease.length;
341
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
342
+ this.prerelease[i]++;
343
+ i = -2;
344
+ }
345
+ if (i === -1) {
346
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
347
+ this.prerelease.push(base);
348
+ }
349
+ }
350
+ if (identifier) {
351
+ let prerelease = [identifier, base];
352
+ if (identifierBase === false) prerelease = [identifier];
353
+ if (isPrereleaseIdentifier(this.prerelease, identifier)) {
354
+ const prereleaseBase = this.prerelease[identifier.split(".").length];
355
+ if (isNaN(prereleaseBase)) this.prerelease = prerelease;
356
+ } else this.prerelease = prerelease;
357
+ }
358
+ break;
359
+ }
360
+ default: throw new Error(`invalid increment argument: ${release}`);
361
+ }
362
+ this.raw = this.format();
363
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
364
+ return this;
365
+ }
366
+ };
367
+ }));
368
+ //#endregion
369
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare.js
370
+ var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
371
+ const SemVer = require_semver();
372
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
373
+ module.exports = compare;
374
+ }));
375
+ //#endregion
376
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/eq.js
377
+ var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
378
+ const compare = require_compare();
379
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
380
+ module.exports = eq;
381
+ }));
382
+ //#endregion
383
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/neq.js
384
+ var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
385
+ const compare = require_compare();
386
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
387
+ module.exports = neq;
388
+ }));
389
+ //#endregion
390
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/gt.js
391
+ var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
392
+ const compare = require_compare();
393
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
394
+ module.exports = gt;
395
+ }));
396
+ //#endregion
397
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/gte.js
398
+ var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
399
+ const compare = require_compare();
400
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
401
+ module.exports = gte;
402
+ }));
403
+ //#endregion
404
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/lt.js
405
+ var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
406
+ const compare = require_compare();
407
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
408
+ module.exports = lt;
409
+ }));
410
+ //#endregion
411
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/lte.js
412
+ var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
413
+ const compare = require_compare();
414
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
415
+ module.exports = lte;
416
+ }));
417
+ //#endregion
418
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/cmp.js
419
+ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
420
+ const eq = require_eq();
421
+ const neq = require_neq();
422
+ const gt = require_gt();
423
+ const gte = require_gte();
424
+ const lt = require_lt();
425
+ const lte = require_lte();
426
+ const cmp = (a, op, b, loose) => {
427
+ switch (op) {
428
+ case "===":
429
+ if (typeof a === "object") a = a.version;
430
+ if (typeof b === "object") b = b.version;
431
+ return a === b;
432
+ case "!==":
433
+ if (typeof a === "object") a = a.version;
434
+ if (typeof b === "object") b = b.version;
435
+ return a !== b;
436
+ case "":
437
+ case "=":
438
+ case "==": return eq(a, b, loose);
439
+ case "!=": return neq(a, b, loose);
440
+ case ">": return gt(a, b, loose);
441
+ case ">=": return gte(a, b, loose);
442
+ case "<": return lt(a, b, loose);
443
+ case "<=": return lte(a, b, loose);
444
+ default: throw new TypeError(`Invalid operator: ${op}`);
445
+ }
446
+ };
447
+ module.exports = cmp;
448
+ }));
449
+ //#endregion
450
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/comparator.js
451
+ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
452
+ const ANY = Symbol("SemVer ANY");
453
+ module.exports = class Comparator {
454
+ static get ANY() {
455
+ return ANY;
456
+ }
457
+ constructor(comp, options) {
458
+ options = parseOptions(options);
459
+ if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
460
+ else comp = comp.value;
461
+ comp = comp.trim().split(/\s+/).join(" ");
462
+ debug("comparator", comp, options);
463
+ this.options = options;
464
+ this.loose = !!options.loose;
465
+ this.parse(comp);
466
+ if (this.semver === ANY) this.value = "";
467
+ else this.value = this.operator + this.semver.version;
468
+ debug("comp", this);
469
+ }
470
+ parse(comp) {
471
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
472
+ const m = comp.match(r);
473
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
474
+ this.operator = m[1] !== void 0 ? m[1] : "";
475
+ if (this.operator === "=") this.operator = "";
476
+ if (!m[2]) this.semver = ANY;
477
+ else this.semver = new SemVer(m[2], this.options.loose);
478
+ }
479
+ toString() {
480
+ return this.value;
481
+ }
482
+ test(version) {
483
+ debug("Comparator.test", version, this.options.loose);
484
+ if (this.semver === ANY || version === ANY) return true;
485
+ if (typeof version === "string") try {
486
+ version = new SemVer(version, this.options);
487
+ } catch (er) {
488
+ return false;
489
+ }
490
+ return cmp(version, this.operator, this.semver, this.options);
491
+ }
492
+ intersects(comp, options) {
493
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
494
+ if (this.operator === "") {
495
+ if (this.value === "") return true;
496
+ return new Range(comp.value, options).test(this.value);
497
+ } else if (comp.operator === "") {
498
+ if (comp.value === "") return true;
499
+ return new Range(this.value, options).test(comp.semver);
500
+ }
501
+ options = parseOptions(options);
502
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
503
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
504
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
505
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
506
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
507
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
508
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
509
+ return false;
510
+ }
511
+ };
512
+ const parseOptions = require_parse_options();
513
+ const { safeRe: re, t } = require_re();
514
+ const cmp = require_cmp();
515
+ const debug = require_debug();
516
+ const SemVer = require_semver();
517
+ const Range = require_range();
518
+ }));
519
+ //#endregion
520
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/range.js
521
+ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
522
+ const SPACE_CHARACTERS = /\s+/g;
523
+ module.exports = class Range {
524
+ constructor(range, options) {
525
+ options = parseOptions(options);
526
+ if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
527
+ else return new Range(range.raw, options);
528
+ if (range instanceof Comparator) {
529
+ this.raw = range.value;
530
+ this.set = [[range]];
531
+ this.formatted = void 0;
532
+ return this;
533
+ }
534
+ this.options = options;
535
+ this.loose = !!options.loose;
536
+ this.includePrerelease = !!options.includePrerelease;
537
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
538
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
539
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
540
+ if (this.set.length > 1) {
541
+ const first = this.set[0];
542
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
543
+ if (this.set.length === 0) this.set = [first];
544
+ else if (this.set.length > 1) {
545
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
546
+ this.set = [c];
547
+ break;
548
+ }
549
+ }
550
+ }
551
+ this.formatted = void 0;
552
+ }
553
+ get range() {
554
+ if (this.formatted === void 0) {
555
+ this.formatted = "";
556
+ for (let i = 0; i < this.set.length; i++) {
557
+ if (i > 0) this.formatted += "||";
558
+ const comps = this.set[i];
559
+ for (let k = 0; k < comps.length; k++) {
560
+ if (k > 0) this.formatted += " ";
561
+ this.formatted += comps[k].toString().trim();
562
+ }
563
+ }
564
+ }
565
+ return this.formatted;
566
+ }
567
+ format() {
568
+ return this.range;
569
+ }
570
+ toString() {
571
+ return this.range;
572
+ }
573
+ parseRange(range) {
574
+ range = range.replace(BUILDSTRIPRE, "");
575
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
576
+ const cached = cache.get(memoKey);
577
+ if (cached) return cached;
578
+ const loose = this.options.loose;
579
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
580
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
581
+ debug("hyphen replace", range);
582
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
583
+ debug("comparator trim", range);
584
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
585
+ debug("tilde trim", range);
586
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
587
+ debug("caret trim", range);
588
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
589
+ if (loose) rangeList = rangeList.filter((comp) => {
590
+ debug("loose invalid filter", comp, this.options);
591
+ return !!comp.match(re[t.COMPARATORLOOSE]);
592
+ });
593
+ debug("range list", rangeList);
594
+ const rangeMap = /* @__PURE__ */ new Map();
595
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
596
+ for (const comp of comparators) {
597
+ if (isNullSet(comp)) return [comp];
598
+ rangeMap.set(comp.value, comp);
599
+ }
600
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
601
+ const result = [...rangeMap.values()];
602
+ cache.set(memoKey, result);
603
+ return result;
604
+ }
605
+ intersects(range, options) {
606
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
607
+ return this.set.some((thisComparators) => {
608
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
609
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
610
+ return rangeComparators.every((rangeComparator) => {
611
+ return thisComparator.intersects(rangeComparator, options);
612
+ });
613
+ });
614
+ });
615
+ });
616
+ }
617
+ test(version) {
618
+ if (!version) return false;
619
+ if (typeof version === "string") try {
620
+ version = new SemVer(version, this.options);
621
+ } catch (er) {
622
+ return false;
623
+ }
624
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
625
+ return false;
626
+ }
627
+ };
628
+ const cache = new (require_lrucache())();
629
+ const parseOptions = require_parse_options();
630
+ const Comparator = require_comparator();
631
+ const debug = require_debug();
632
+ const SemVer = require_semver();
633
+ const { safeRe: re, src, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
634
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
635
+ const BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
636
+ const isNullSet = (c) => c.value === "<0.0.0-0";
637
+ const isAny = (c) => c.value === "";
638
+ const isSatisfiable = (comparators, options) => {
639
+ let result = true;
640
+ const remainingComparators = comparators.slice();
641
+ let testComparator = remainingComparators.pop();
642
+ while (result && remainingComparators.length) {
643
+ result = remainingComparators.every((otherComparator) => {
644
+ return testComparator.intersects(otherComparator, options);
645
+ });
646
+ testComparator = remainingComparators.pop();
647
+ }
648
+ return result;
649
+ };
650
+ const parseComparator = (comp, options) => {
651
+ comp = comp.replace(re[t.BUILD], "");
652
+ debug("comp", comp, options);
653
+ comp = replaceCarets(comp, options);
654
+ debug("caret", comp);
655
+ comp = replaceTildes(comp, options);
656
+ debug("tildes", comp);
657
+ comp = replaceXRanges(comp, options);
658
+ debug("xrange", comp);
659
+ comp = replaceStars(comp, options);
660
+ debug("stars", comp);
661
+ return comp;
662
+ };
663
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
664
+ const invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
665
+ const replaceTildes = (comp, options) => {
666
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
667
+ };
668
+ const replaceTilde = (comp, options) => {
669
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
670
+ return comp.replace(r, (_, M, m, p, pr) => {
671
+ debug("tilde", comp, _, M, m, p, pr);
672
+ let ret;
673
+ if (isX(M)) ret = "";
674
+ else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
675
+ else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
676
+ else if (pr) {
677
+ debug("replaceTilde pr", pr);
678
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
679
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
680
+ debug("tilde return", ret);
681
+ return ret;
682
+ });
683
+ };
684
+ const replaceCarets = (comp, options) => {
685
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
686
+ };
687
+ const replaceCaret = (comp, options) => {
688
+ debug("caret", comp, options);
689
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
690
+ const z = options.includePrerelease ? "-0" : "";
691
+ return comp.replace(r, (_, M, m, p, pr) => {
692
+ debug("caret", comp, _, M, m, p, pr);
693
+ let ret;
694
+ if (isX(M)) ret = "";
695
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
696
+ else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
697
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
698
+ else if (pr) {
699
+ debug("replaceCaret pr", pr);
700
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
701
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
702
+ else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
703
+ } else {
704
+ debug("no pr");
705
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
706
+ else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
707
+ else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
708
+ }
709
+ debug("caret return", ret);
710
+ return ret;
711
+ });
712
+ };
713
+ const replaceXRanges = (comp, options) => {
714
+ debug("replaceXRanges", comp, options);
715
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
716
+ };
717
+ const replaceXRange = (comp, options) => {
718
+ comp = comp.trim();
719
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
720
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
721
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
722
+ if (invalidXRangeOrder(M, m, p)) return comp;
723
+ const xM = isX(M);
724
+ const xm = xM || isX(m);
725
+ const xp = xm || isX(p);
726
+ const anyX = xp;
727
+ if (gtlt === "=" && anyX) gtlt = "";
728
+ pr = options.includePrerelease ? "-0" : "";
729
+ if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
730
+ else ret = "*";
731
+ else if (gtlt && anyX) {
732
+ if (xm) m = 0;
733
+ p = 0;
734
+ if (gtlt === ">") {
735
+ gtlt = ">=";
736
+ if (xm) {
737
+ M = +M + 1;
738
+ m = 0;
739
+ p = 0;
740
+ } else {
741
+ m = +m + 1;
742
+ p = 0;
743
+ }
744
+ } else if (gtlt === "<=") {
745
+ gtlt = "<";
746
+ if (xm) M = +M + 1;
747
+ else m = +m + 1;
748
+ }
749
+ if (gtlt === "<") pr = "-0";
750
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
751
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
752
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
753
+ debug("xRange return", ret);
754
+ return ret;
755
+ });
756
+ };
757
+ const replaceStars = (comp, options) => {
758
+ debug("replaceStars", comp, options);
759
+ return comp.trim().replace(re[t.STAR], "");
760
+ };
761
+ const replaceGTE0 = (comp, options) => {
762
+ debug("replaceGTE0", comp, options);
763
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
764
+ };
765
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
766
+ if (isX(fM)) from = "";
767
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
768
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
769
+ else if (fpr) from = `>=${from}`;
770
+ else from = `>=${from}${incPr ? "-0" : ""}`;
771
+ if (isX(tM)) to = "";
772
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
773
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
774
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
775
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
776
+ else to = `<=${to}`;
777
+ return `${from} ${to}`.trim();
778
+ };
779
+ const testSet = (set, version, options) => {
780
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
781
+ if (version.prerelease.length && !options.includePrerelease) {
782
+ for (let i = 0; i < set.length; i++) {
783
+ debug(set[i].semver);
784
+ if (set[i].semver === Comparator.ANY) continue;
785
+ if (set[i].semver.prerelease.length > 0) {
786
+ const allowed = set[i].semver;
787
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
788
+ }
789
+ }
790
+ return false;
791
+ }
792
+ return true;
793
+ };
794
+ }));
795
+ //#endregion
796
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/satisfies.js
797
+ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
798
+ const Range = require_range();
799
+ const satisfies = (version, range, options) => {
800
+ try {
801
+ range = new Range(range, options);
802
+ } catch (er) {
803
+ return false;
804
+ }
805
+ return range.test(version);
806
+ };
807
+ module.exports = satisfies;
808
+ }));
809
+ //#endregion
810
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/parse.js
811
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
812
+ const SemVer = require_semver();
813
+ const parse = (version, options, throwErrors = false) => {
814
+ if (version instanceof SemVer) return version;
815
+ try {
816
+ return new SemVer(version, options);
817
+ } catch (er) {
818
+ if (!throwErrors) return null;
819
+ throw er;
820
+ }
821
+ };
822
+ module.exports = parse;
823
+ }));
824
+ //#endregion
825
+ //#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/valid.js
826
+ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
827
+ const parse = require_parse();
828
+ const valid = (version, options) => {
829
+ const v = parse(version, options);
830
+ return v ? v.version : null;
831
+ };
832
+ module.exports = valid;
833
+ }));
834
+ //#endregion
835
+ //#region ../../node_modules/.pnpm/@tsdown+exe@0.22.3_tsdown@0.22.3/node_modules/@tsdown/exe/dist/index.mjs
836
+ var import_satisfies = /* @__PURE__ */ __toESM(require_satisfies(), 1);
837
+ var import_valid = /* @__PURE__ */ __toESM(require_valid(), 1);
838
+ function getCacheDir() {
839
+ const home = os.homedir();
840
+ if (process$1.platform === "win32") {
841
+ const localAppData = process$1.env.LOCALAPPDATA || path.join(home, "AppData/Local");
842
+ return path.join(localAppData, "tsdown/Caches");
843
+ }
844
+ if (process$1.platform === "darwin") return path.join(home, "Library/Caches/tsdown");
845
+ const xdgCache = process$1.env.XDG_CACHE_HOME || path.join(home, ".cache");
846
+ return path.join(xdgCache, "tsdown");
847
+ }
848
+ function getCachedBinaryPath(target) {
849
+ const cacheDir = getCacheDir();
850
+ const binName = target.platform === "win" ? "node.exe" : "node";
851
+ return path.join(cacheDir, "node", `v${target.nodeVersion}`, `${target.platform}-${target.arch}`, binName);
852
+ }
853
+ function getArchiveExtension(platform) {
854
+ if (platform === "win") return "zip";
855
+ if (platform === "linux") return "tar.xz";
856
+ return "tar.gz";
857
+ }
858
+ function getDownloadUrl(target) {
859
+ const { platform, arch, nodeVersion } = target;
860
+ return `https://nodejs.org/dist/v${nodeVersion}/node-v${nodeVersion}-${platform}-${arch}.${getArchiveExtension(platform)}`;
861
+ }
862
+ function getBinaryPathInArchive(target) {
863
+ const { platform, arch, nodeVersion } = target;
864
+ const dirName = `node-v${nodeVersion}-${platform}-${arch}`;
865
+ if (platform === "win") return `${dirName}/node.exe`;
866
+ return `${dirName}/bin/node`;
867
+ }
868
+ const NODE_DIST_INDEX_URL = "https://nodejs.org/dist/index.json";
869
+ async function resolveNodeVersion(nodeVersion) {
870
+ if (nodeVersion === "latest" || nodeVersion === "latest-lts") {
871
+ const response = await fetch(NODE_DIST_INDEX_URL);
872
+ if (!response.ok) throw new Error(`Failed to fetch Node.js releases: HTTP ${response.status} from ${NODE_DIST_INDEX_URL}`);
873
+ const releases = await response.json();
874
+ const release = nodeVersion === "latest" ? releases[0] : releases.find((r) => r.lts !== false);
875
+ if (!release) throw new Error(`No matching Node.js release found for "${nodeVersion}".`);
876
+ nodeVersion = release.version.replace(/^v/, "");
877
+ }
878
+ const version = (0, import_valid.default)(nodeVersion);
879
+ if (!version) throw new Error(`Invalid Node.js version: ${nodeVersion}. Please provide a valid version string (e.g., "25.7.0").`);
880
+ if (!(0, import_satisfies.default)(version, ">=25.7.0")) throw new Error(`Node.js ${version} does not support SEA (Single Executable Applications). Required minimum version is 25.7.0. Please update the nodeVersion in your target configuration.`);
881
+ return version;
882
+ }
883
+ function getTargetSuffix(target) {
884
+ return `-${target.platform}-${target.arch}`;
885
+ }
886
+ const debug = createDebug("tsdown:exe:download");
887
+ async function resolveNodeBinary(target, logger) {
888
+ debug("Resolving Node.js binary for target: %O", target);
889
+ target.nodeVersion = await resolveNodeVersion(target.nodeVersion);
890
+ const cachedPath = getCachedBinaryPath(target);
891
+ debug("Cache path: %s", cachedPath);
892
+ if (await fsExists(cachedPath)) {
893
+ debug("Cache hit: %s", cachedPath);
894
+ logger?.info(`Using cached Node.js ${target.nodeVersion} for ${target.platform}-${target.arch}`);
895
+ return cachedPath;
896
+ }
897
+ const url = getDownloadUrl(target);
898
+ debug("Cache miss, downloading from: %s", url);
899
+ logger?.info(`Downloading Node.js ${target.nodeVersion} for ${target.platform}-${target.arch}...`);
900
+ logger?.info(` ${url}`);
901
+ await mkdir(path.dirname(cachedPath), { recursive: true });
902
+ const response = await fetch(url);
903
+ if (!response.ok) throw new Error(`Failed to download Node.js binary: HTTP ${response.status} from ${url}`);
904
+ const archivePath = `${cachedPath}.download.${getArchiveExtension(target.platform)}`;
905
+ const buffer = Buffer.from(await response.arrayBuffer());
906
+ debug("Downloaded %d bytes, writing to: %s", buffer.length, archivePath);
907
+ await writeFile(archivePath, buffer);
908
+ try {
909
+ await extractBinary(archivePath, cachedPath, target);
910
+ if (target.platform !== "win") await chmod(cachedPath, 493);
911
+ debug("Binary cached at: %s", cachedPath);
912
+ logger?.info(`Cached Node.js binary at: ${cachedPath}`);
913
+ } finally {
914
+ await fsRemove(archivePath);
915
+ }
916
+ return cachedPath;
917
+ }
918
+ async function extractBinary(archivePath, targetBinaryPath, target) {
919
+ const binaryInArchive = getBinaryPathInArchive(target);
920
+ const outDir = path.dirname(targetBinaryPath);
921
+ debug("Extracting %s from archive to %s", binaryInArchive, outDir);
922
+ if (target.platform === "win") await R("tar", [
923
+ "-xf",
924
+ archivePath,
925
+ "-C",
926
+ outDir,
927
+ "--strip-components=1",
928
+ binaryInArchive
929
+ ], {
930
+ nodeOptions: { stdio: "inherit" },
931
+ throwOnError: true
932
+ });
933
+ else await R("tar", [
934
+ `-x${archivePath.endsWith(".tar.xz") ? "J" : "z"}f`,
935
+ archivePath,
936
+ "-C",
937
+ outDir,
938
+ "--strip-components=2",
939
+ binaryInArchive
940
+ ], {
941
+ nodeOptions: { stdio: "inherit" },
942
+ throwOnError: true
943
+ });
944
+ const extractedName = target.platform === "win" ? "node.exe" : "node";
945
+ const extractedPath = path.join(outDir, extractedName);
946
+ if (extractedPath !== targetBinaryPath) await rename(extractedPath, targetBinaryPath);
947
+ }
948
+ //#endregion
949
+ export { getCacheDir, getCachedBinaryPath, getTargetSuffix, resolveNodeBinary };