@slidev/cli 0.48.0-beta.3 → 0.48.0-beta.4

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.
@@ -1,2544 +1,14 @@
1
- import {
2
- ViteSlidevPlugin,
3
- mergeViteConfigs
4
- } from "./chunk-JORVSTMS.mjs";
5
- import {
6
- packageExists,
7
- resolveImportPath
8
- } from "./chunk-DWXI5WEO.mjs";
9
- import {
10
- __commonJS,
11
- __toESM
12
- } from "./chunk-BXO7ZPPU.mjs";
13
-
14
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/constants.js
15
- var require_constants = __commonJS({
16
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/constants.js"(exports, module) {
17
- "use strict";
18
- var SEMVER_SPEC_VERSION = "2.0.0";
19
- var MAX_LENGTH = 256;
20
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
21
- 9007199254740991;
22
- var MAX_SAFE_COMPONENT_LENGTH = 16;
23
- var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
24
- var RELEASE_TYPES = [
25
- "major",
26
- "premajor",
27
- "minor",
28
- "preminor",
29
- "patch",
30
- "prepatch",
31
- "prerelease"
32
- ];
33
- module.exports = {
34
- MAX_LENGTH,
35
- MAX_SAFE_COMPONENT_LENGTH,
36
- MAX_SAFE_BUILD_LENGTH,
37
- MAX_SAFE_INTEGER,
38
- RELEASE_TYPES,
39
- SEMVER_SPEC_VERSION,
40
- FLAG_INCLUDE_PRERELEASE: 1,
41
- FLAG_LOOSE: 2
42
- };
43
- }
44
- });
45
-
46
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/debug.js
47
- var require_debug = __commonJS({
48
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/debug.js"(exports, module) {
49
- "use strict";
50
- var debug2 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
51
- };
52
- module.exports = debug2;
53
- }
54
- });
55
-
56
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/re.js
57
- var require_re = __commonJS({
58
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/re.js"(exports, module) {
59
- "use strict";
60
- var {
61
- MAX_SAFE_COMPONENT_LENGTH,
62
- MAX_SAFE_BUILD_LENGTH,
63
- MAX_LENGTH
64
- } = require_constants();
65
- var debug2 = require_debug();
66
- exports = module.exports = {};
67
- var re = exports.re = [];
68
- var safeRe = exports.safeRe = [];
69
- var src2 = exports.src = [];
70
- var t = exports.t = {};
71
- var R = 0;
72
- var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
73
- var safeRegexReplacements = [
74
- ["\\s", 1],
75
- ["\\d", MAX_LENGTH],
76
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
77
- ];
78
- var makeSafeRegex = (value) => {
79
- for (const [token, max] of safeRegexReplacements) {
80
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
81
- }
82
- return value;
83
- };
84
- var createToken = (name, value, isGlobal) => {
85
- const safe2 = makeSafeRegex(value);
86
- const index = R++;
87
- debug2(name, index, value);
88
- t[name] = index;
89
- src2[index] = value;
90
- re[index] = new RegExp(value, isGlobal ? "g" : void 0);
91
- safeRe[index] = new RegExp(safe2, isGlobal ? "g" : void 0);
92
- };
93
- createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
94
- createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
95
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
96
- createToken("MAINVERSION", `(${src2[t.NUMERICIDENTIFIER]})\\.(${src2[t.NUMERICIDENTIFIER]})\\.(${src2[t.NUMERICIDENTIFIER]})`);
97
- createToken("MAINVERSIONLOOSE", `(${src2[t.NUMERICIDENTIFIERLOOSE]})\\.(${src2[t.NUMERICIDENTIFIERLOOSE]})\\.(${src2[t.NUMERICIDENTIFIERLOOSE]})`);
98
- createToken("PRERELEASEIDENTIFIER", `(?:${src2[t.NUMERICIDENTIFIER]}|${src2[t.NONNUMERICIDENTIFIER]})`);
99
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src2[t.NUMERICIDENTIFIERLOOSE]}|${src2[t.NONNUMERICIDENTIFIER]})`);
100
- createToken("PRERELEASE", `(?:-(${src2[t.PRERELEASEIDENTIFIER]}(?:\\.${src2[t.PRERELEASEIDENTIFIER]})*))`);
101
- createToken("PRERELEASELOOSE", `(?:-?(${src2[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src2[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
102
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
103
- createToken("BUILD", `(?:\\+(${src2[t.BUILDIDENTIFIER]}(?:\\.${src2[t.BUILDIDENTIFIER]})*))`);
104
- createToken("FULLPLAIN", `v?${src2[t.MAINVERSION]}${src2[t.PRERELEASE]}?${src2[t.BUILD]}?`);
105
- createToken("FULL", `^${src2[t.FULLPLAIN]}$`);
106
- createToken("LOOSEPLAIN", `[v=\\s]*${src2[t.MAINVERSIONLOOSE]}${src2[t.PRERELEASELOOSE]}?${src2[t.BUILD]}?`);
107
- createToken("LOOSE", `^${src2[t.LOOSEPLAIN]}$`);
108
- createToken("GTLT", "((?:<|>)?=?)");
109
- createToken("XRANGEIDENTIFIERLOOSE", `${src2[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
110
- createToken("XRANGEIDENTIFIER", `${src2[t.NUMERICIDENTIFIER]}|x|X|\\*`);
111
- createToken("XRANGEPLAIN", `[v=\\s]*(${src2[t.XRANGEIDENTIFIER]})(?:\\.(${src2[t.XRANGEIDENTIFIER]})(?:\\.(${src2[t.XRANGEIDENTIFIER]})(?:${src2[t.PRERELEASE]})?${src2[t.BUILD]}?)?)?`);
112
- createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:${src2[t.PRERELEASELOOSE]})?${src2[t.BUILD]}?)?)?`);
113
- createToken("XRANGE", `^${src2[t.GTLT]}\\s*${src2[t.XRANGEPLAIN]}$`);
114
- createToken("XRANGELOOSE", `^${src2[t.GTLT]}\\s*${src2[t.XRANGEPLAINLOOSE]}$`);
115
- createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
116
- createToken("COERCE", `${src2[t.COERCEPLAIN]}(?:$|[^\\d])`);
117
- createToken("COERCEFULL", src2[t.COERCEPLAIN] + `(?:${src2[t.PRERELEASE]})?(?:${src2[t.BUILD]})?(?:$|[^\\d])`);
118
- createToken("COERCERTL", src2[t.COERCE], true);
119
- createToken("COERCERTLFULL", src2[t.COERCEFULL], true);
120
- createToken("LONETILDE", "(?:~>?)");
121
- createToken("TILDETRIM", `(\\s*)${src2[t.LONETILDE]}\\s+`, true);
122
- exports.tildeTrimReplace = "$1~";
123
- createToken("TILDE", `^${src2[t.LONETILDE]}${src2[t.XRANGEPLAIN]}$`);
124
- createToken("TILDELOOSE", `^${src2[t.LONETILDE]}${src2[t.XRANGEPLAINLOOSE]}$`);
125
- createToken("LONECARET", "(?:\\^)");
126
- createToken("CARETTRIM", `(\\s*)${src2[t.LONECARET]}\\s+`, true);
127
- exports.caretTrimReplace = "$1^";
128
- createToken("CARET", `^${src2[t.LONECARET]}${src2[t.XRANGEPLAIN]}$`);
129
- createToken("CARETLOOSE", `^${src2[t.LONECARET]}${src2[t.XRANGEPLAINLOOSE]}$`);
130
- createToken("COMPARATORLOOSE", `^${src2[t.GTLT]}\\s*(${src2[t.LOOSEPLAIN]})$|^$`);
131
- createToken("COMPARATOR", `^${src2[t.GTLT]}\\s*(${src2[t.FULLPLAIN]})$|^$`);
132
- createToken("COMPARATORTRIM", `(\\s*)${src2[t.GTLT]}\\s*(${src2[t.LOOSEPLAIN]}|${src2[t.XRANGEPLAIN]})`, true);
133
- exports.comparatorTrimReplace = "$1$2$3";
134
- createToken("HYPHENRANGE", `^\\s*(${src2[t.XRANGEPLAIN]})\\s+-\\s+(${src2[t.XRANGEPLAIN]})\\s*$`);
135
- createToken("HYPHENRANGELOOSE", `^\\s*(${src2[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src2[t.XRANGEPLAINLOOSE]})\\s*$`);
136
- createToken("STAR", "(<|>)?=?\\s*\\*");
137
- createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
138
- createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
139
- }
140
- });
141
-
142
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/parse-options.js
143
- var require_parse_options = __commonJS({
144
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/parse-options.js"(exports, module) {
145
- "use strict";
146
- var looseOption = Object.freeze({ loose: true });
147
- var emptyOpts = Object.freeze({});
148
- var parseOptions = (options2) => {
149
- if (!options2) {
150
- return emptyOpts;
151
- }
152
- if (typeof options2 !== "object") {
153
- return looseOption;
154
- }
155
- return options2;
156
- };
157
- module.exports = parseOptions;
158
- }
159
- });
160
-
161
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/identifiers.js
162
- var require_identifiers = __commonJS({
163
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/identifiers.js"(exports, module) {
164
- "use strict";
165
- var numeric = /^[0-9]+$/;
166
- var compareIdentifiers = (a, b) => {
167
- const anum = numeric.test(a);
168
- const bnum = numeric.test(b);
169
- if (anum && bnum) {
170
- a = +a;
171
- b = +b;
172
- }
173
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
174
- };
175
- var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
176
- module.exports = {
177
- compareIdentifiers,
178
- rcompareIdentifiers
179
- };
180
- }
181
- });
182
-
183
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/semver.js
184
- var require_semver = __commonJS({
185
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/semver.js"(exports, module) {
186
- "use strict";
187
- var debug2 = require_debug();
188
- var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
189
- var { safeRe: re, t } = require_re();
190
- var parseOptions = require_parse_options();
191
- var { compareIdentifiers } = require_identifiers();
192
- var SemVer = class _SemVer {
193
- constructor(version3, options2) {
194
- options2 = parseOptions(options2);
195
- if (version3 instanceof _SemVer) {
196
- if (version3.loose === !!options2.loose && version3.includePrerelease === !!options2.includePrerelease) {
197
- return version3;
198
- } else {
199
- version3 = version3.version;
200
- }
201
- } else if (typeof version3 !== "string") {
202
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version3}".`);
203
- }
204
- if (version3.length > MAX_LENGTH) {
205
- throw new TypeError(
206
- `version is longer than ${MAX_LENGTH} characters`
207
- );
208
- }
209
- debug2("SemVer", version3, options2);
210
- this.options = options2;
211
- this.loose = !!options2.loose;
212
- this.includePrerelease = !!options2.includePrerelease;
213
- const m = version3.trim().match(options2.loose ? re[t.LOOSE] : re[t.FULL]);
214
- if (!m) {
215
- throw new TypeError(`Invalid Version: ${version3}`);
216
- }
217
- this.raw = version3;
218
- this.major = +m[1];
219
- this.minor = +m[2];
220
- this.patch = +m[3];
221
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
222
- throw new TypeError("Invalid major version");
223
- }
224
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
225
- throw new TypeError("Invalid minor version");
226
- }
227
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
228
- throw new TypeError("Invalid patch version");
229
- }
230
- if (!m[4]) {
231
- this.prerelease = [];
232
- } else {
233
- this.prerelease = m[4].split(".").map((id) => {
234
- if (/^[0-9]+$/.test(id)) {
235
- const num = +id;
236
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
237
- return num;
238
- }
239
- }
240
- return id;
241
- });
242
- }
243
- this.build = m[5] ? m[5].split(".") : [];
244
- this.format();
245
- }
246
- format() {
247
- this.version = `${this.major}.${this.minor}.${this.patch}`;
248
- if (this.prerelease.length) {
249
- this.version += `-${this.prerelease.join(".")}`;
250
- }
251
- return this.version;
252
- }
253
- toString() {
254
- return this.version;
255
- }
256
- compare(other) {
257
- debug2("SemVer.compare", this.version, this.options, other);
258
- if (!(other instanceof _SemVer)) {
259
- if (typeof other === "string" && other === this.version) {
260
- return 0;
261
- }
262
- other = new _SemVer(other, this.options);
263
- }
264
- if (other.version === this.version) {
265
- return 0;
266
- }
267
- return this.compareMain(other) || this.comparePre(other);
268
- }
269
- compareMain(other) {
270
- if (!(other instanceof _SemVer)) {
271
- other = new _SemVer(other, this.options);
272
- }
273
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
274
- }
275
- comparePre(other) {
276
- if (!(other instanceof _SemVer)) {
277
- other = new _SemVer(other, this.options);
278
- }
279
- if (this.prerelease.length && !other.prerelease.length) {
280
- return -1;
281
- } else if (!this.prerelease.length && other.prerelease.length) {
282
- return 1;
283
- } else if (!this.prerelease.length && !other.prerelease.length) {
284
- return 0;
285
- }
286
- let i = 0;
287
- do {
288
- const a = this.prerelease[i];
289
- const b = other.prerelease[i];
290
- debug2("prerelease compare", i, a, b);
291
- if (a === void 0 && b === void 0) {
292
- return 0;
293
- } else if (b === void 0) {
294
- return 1;
295
- } else if (a === void 0) {
296
- return -1;
297
- } else if (a === b) {
298
- continue;
299
- } else {
300
- return compareIdentifiers(a, b);
301
- }
302
- } while (++i);
303
- }
304
- compareBuild(other) {
305
- if (!(other instanceof _SemVer)) {
306
- other = new _SemVer(other, this.options);
307
- }
308
- let i = 0;
309
- do {
310
- const a = this.build[i];
311
- const b = other.build[i];
312
- debug2("prerelease compare", i, a, b);
313
- if (a === void 0 && b === void 0) {
314
- return 0;
315
- } else if (b === void 0) {
316
- return 1;
317
- } else if (a === void 0) {
318
- return -1;
319
- } else if (a === b) {
320
- continue;
321
- } else {
322
- return compareIdentifiers(a, b);
323
- }
324
- } while (++i);
325
- }
326
- // preminor will bump the version up to the next minor release, and immediately
327
- // down to pre-release. premajor and prepatch work the same way.
328
- inc(release, identifier, identifierBase) {
329
- switch (release) {
330
- case "premajor":
331
- this.prerelease.length = 0;
332
- this.patch = 0;
333
- this.minor = 0;
334
- this.major++;
335
- this.inc("pre", identifier, identifierBase);
336
- break;
337
- case "preminor":
338
- this.prerelease.length = 0;
339
- this.patch = 0;
340
- this.minor++;
341
- this.inc("pre", identifier, identifierBase);
342
- break;
343
- case "prepatch":
344
- this.prerelease.length = 0;
345
- this.inc("patch", identifier, identifierBase);
346
- this.inc("pre", identifier, identifierBase);
347
- break;
348
- case "prerelease":
349
- if (this.prerelease.length === 0) {
350
- this.inc("patch", identifier, identifierBase);
351
- }
352
- this.inc("pre", identifier, identifierBase);
353
- break;
354
- case "major":
355
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
356
- this.major++;
357
- }
358
- this.minor = 0;
359
- this.patch = 0;
360
- this.prerelease = [];
361
- break;
362
- case "minor":
363
- if (this.patch !== 0 || this.prerelease.length === 0) {
364
- this.minor++;
365
- }
366
- this.patch = 0;
367
- this.prerelease = [];
368
- break;
369
- case "patch":
370
- if (this.prerelease.length === 0) {
371
- this.patch++;
372
- }
373
- this.prerelease = [];
374
- break;
375
- case "pre": {
376
- const base = Number(identifierBase) ? 1 : 0;
377
- if (!identifier && identifierBase === false) {
378
- throw new Error("invalid increment argument: identifier is empty");
379
- }
380
- if (this.prerelease.length === 0) {
381
- this.prerelease = [base];
382
- } else {
383
- let i = this.prerelease.length;
384
- while (--i >= 0) {
385
- if (typeof this.prerelease[i] === "number") {
386
- this.prerelease[i]++;
387
- i = -2;
388
- }
389
- }
390
- if (i === -1) {
391
- if (identifier === this.prerelease.join(".") && identifierBase === false) {
392
- throw new Error("invalid increment argument: identifier already exists");
393
- }
394
- this.prerelease.push(base);
395
- }
396
- }
397
- if (identifier) {
398
- let prerelease = [identifier, base];
399
- if (identifierBase === false) {
400
- prerelease = [identifier];
401
- }
402
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
403
- if (isNaN(this.prerelease[1])) {
404
- this.prerelease = prerelease;
405
- }
406
- } else {
407
- this.prerelease = prerelease;
408
- }
409
- }
410
- break;
411
- }
412
- default:
413
- throw new Error(`invalid increment argument: ${release}`);
414
- }
415
- this.raw = this.format();
416
- if (this.build.length) {
417
- this.raw += `+${this.build.join(".")}`;
418
- }
419
- return this;
420
- }
421
- };
422
- module.exports = SemVer;
423
- }
424
- });
425
-
426
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/parse.js
427
- var require_parse = __commonJS({
428
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/parse.js"(exports, module) {
429
- "use strict";
430
- var SemVer = require_semver();
431
- var parse2 = (version3, options2, throwErrors = false) => {
432
- if (version3 instanceof SemVer) {
433
- return version3;
434
- }
435
- try {
436
- return new SemVer(version3, options2);
437
- } catch (er) {
438
- if (!throwErrors) {
439
- return null;
440
- }
441
- throw er;
442
- }
443
- };
444
- module.exports = parse2;
445
- }
446
- });
447
-
448
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/valid.js
449
- var require_valid = __commonJS({
450
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/valid.js"(exports, module) {
451
- "use strict";
452
- var parse2 = require_parse();
453
- var valid = (version3, options2) => {
454
- const v = parse2(version3, options2);
455
- return v ? v.version : null;
456
- };
457
- module.exports = valid;
458
- }
459
- });
460
-
461
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/clean.js
462
- var require_clean = __commonJS({
463
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/clean.js"(exports, module) {
464
- "use strict";
465
- var parse2 = require_parse();
466
- var clean = (version3, options2) => {
467
- const s = parse2(version3.trim().replace(/^[=v]+/, ""), options2);
468
- return s ? s.version : null;
469
- };
470
- module.exports = clean;
471
- }
472
- });
473
-
474
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/inc.js
475
- var require_inc = __commonJS({
476
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/inc.js"(exports, module) {
477
- "use strict";
478
- var SemVer = require_semver();
479
- var inc = (version3, release, options2, identifier, identifierBase) => {
480
- if (typeof options2 === "string") {
481
- identifierBase = identifier;
482
- identifier = options2;
483
- options2 = void 0;
484
- }
485
- try {
486
- return new SemVer(
487
- version3 instanceof SemVer ? version3.version : version3,
488
- options2
489
- ).inc(release, identifier, identifierBase).version;
490
- } catch (er) {
491
- return null;
492
- }
493
- };
494
- module.exports = inc;
495
- }
496
- });
497
-
498
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/diff.js
499
- var require_diff = __commonJS({
500
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/diff.js"(exports, module) {
501
- "use strict";
502
- var parse2 = require_parse();
503
- var diff = (version1, version22) => {
504
- const v1 = parse2(version1, null, true);
505
- const v2 = parse2(version22, null, true);
506
- const comparison = v1.compare(v2);
507
- if (comparison === 0) {
508
- return null;
509
- }
510
- const v1Higher = comparison > 0;
511
- const highVersion = v1Higher ? v1 : v2;
512
- const lowVersion = v1Higher ? v2 : v1;
513
- const highHasPre = !!highVersion.prerelease.length;
514
- const lowHasPre = !!lowVersion.prerelease.length;
515
- if (lowHasPre && !highHasPre) {
516
- if (!lowVersion.patch && !lowVersion.minor) {
517
- return "major";
518
- }
519
- if (highVersion.patch) {
520
- return "patch";
521
- }
522
- if (highVersion.minor) {
523
- return "minor";
524
- }
525
- return "major";
526
- }
527
- const prefix = highHasPre ? "pre" : "";
528
- if (v1.major !== v2.major) {
529
- return prefix + "major";
530
- }
531
- if (v1.minor !== v2.minor) {
532
- return prefix + "minor";
533
- }
534
- if (v1.patch !== v2.patch) {
535
- return prefix + "patch";
536
- }
537
- return "prerelease";
538
- };
539
- module.exports = diff;
540
- }
541
- });
542
-
543
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/major.js
544
- var require_major = __commonJS({
545
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/major.js"(exports, module) {
546
- "use strict";
547
- var SemVer = require_semver();
548
- var major = (a, loose) => new SemVer(a, loose).major;
549
- module.exports = major;
550
- }
551
- });
552
-
553
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/minor.js
554
- var require_minor = __commonJS({
555
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/minor.js"(exports, module) {
556
- "use strict";
557
- var SemVer = require_semver();
558
- var minor = (a, loose) => new SemVer(a, loose).minor;
559
- module.exports = minor;
560
- }
561
- });
562
-
563
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/patch.js
564
- var require_patch = __commonJS({
565
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/patch.js"(exports, module) {
566
- "use strict";
567
- var SemVer = require_semver();
568
- var patch = (a, loose) => new SemVer(a, loose).patch;
569
- module.exports = patch;
570
- }
571
- });
572
-
573
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/prerelease.js
574
- var require_prerelease = __commonJS({
575
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/prerelease.js"(exports, module) {
576
- "use strict";
577
- var parse2 = require_parse();
578
- var prerelease = (version3, options2) => {
579
- const parsed = parse2(version3, options2);
580
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
581
- };
582
- module.exports = prerelease;
583
- }
584
- });
585
-
586
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare.js
587
- var require_compare = __commonJS({
588
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare.js"(exports, module) {
589
- "use strict";
590
- var SemVer = require_semver();
591
- var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
592
- module.exports = compare;
593
- }
594
- });
595
-
596
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rcompare.js
597
- var require_rcompare = __commonJS({
598
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rcompare.js"(exports, module) {
599
- "use strict";
600
- var compare = require_compare();
601
- var rcompare = (a, b, loose) => compare(b, a, loose);
602
- module.exports = rcompare;
603
- }
604
- });
605
-
606
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-loose.js
607
- var require_compare_loose = __commonJS({
608
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-loose.js"(exports, module) {
609
- "use strict";
610
- var compare = require_compare();
611
- var compareLoose = (a, b) => compare(a, b, true);
612
- module.exports = compareLoose;
613
- }
614
- });
615
-
616
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-build.js
617
- var require_compare_build = __commonJS({
618
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-build.js"(exports, module) {
619
- "use strict";
620
- var SemVer = require_semver();
621
- var compareBuild = (a, b, loose) => {
622
- const versionA = new SemVer(a, loose);
623
- const versionB = new SemVer(b, loose);
624
- return versionA.compare(versionB) || versionA.compareBuild(versionB);
625
- };
626
- module.exports = compareBuild;
627
- }
628
- });
629
-
630
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/sort.js
631
- var require_sort = __commonJS({
632
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/sort.js"(exports, module) {
633
- "use strict";
634
- var compareBuild = require_compare_build();
635
- var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
636
- module.exports = sort;
637
- }
638
- });
639
-
640
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rsort.js
641
- var require_rsort = __commonJS({
642
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rsort.js"(exports, module) {
643
- "use strict";
644
- var compareBuild = require_compare_build();
645
- var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
646
- module.exports = rsort;
647
- }
648
- });
649
-
650
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gt.js
651
- var require_gt = __commonJS({
652
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gt.js"(exports, module) {
653
- "use strict";
654
- var compare = require_compare();
655
- var gt = (a, b, loose) => compare(a, b, loose) > 0;
656
- module.exports = gt;
657
- }
658
- });
659
-
660
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lt.js
661
- var require_lt = __commonJS({
662
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lt.js"(exports, module) {
663
- "use strict";
664
- var compare = require_compare();
665
- var lt = (a, b, loose) => compare(a, b, loose) < 0;
666
- module.exports = lt;
667
- }
668
- });
669
-
670
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/eq.js
671
- var require_eq = __commonJS({
672
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/eq.js"(exports, module) {
673
- "use strict";
674
- var compare = require_compare();
675
- var eq = (a, b, loose) => compare(a, b, loose) === 0;
676
- module.exports = eq;
677
- }
678
- });
679
-
680
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/neq.js
681
- var require_neq = __commonJS({
682
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/neq.js"(exports, module) {
683
- "use strict";
684
- var compare = require_compare();
685
- var neq = (a, b, loose) => compare(a, b, loose) !== 0;
686
- module.exports = neq;
687
- }
688
- });
689
-
690
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gte.js
691
- var require_gte = __commonJS({
692
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gte.js"(exports, module) {
693
- "use strict";
694
- var compare = require_compare();
695
- var gte = (a, b, loose) => compare(a, b, loose) >= 0;
696
- module.exports = gte;
697
- }
698
- });
699
-
700
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lte.js
701
- var require_lte = __commonJS({
702
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lte.js"(exports, module) {
703
- "use strict";
704
- var compare = require_compare();
705
- var lte = (a, b, loose) => compare(a, b, loose) <= 0;
706
- module.exports = lte;
707
- }
708
- });
709
-
710
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/cmp.js
711
- var require_cmp = __commonJS({
712
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/cmp.js"(exports, module) {
713
- "use strict";
714
- var eq = require_eq();
715
- var neq = require_neq();
716
- var gt = require_gt();
717
- var gte = require_gte();
718
- var lt = require_lt();
719
- var lte = require_lte();
720
- var cmp = (a, op, b, loose) => {
721
- switch (op) {
722
- case "===":
723
- if (typeof a === "object") {
724
- a = a.version;
725
- }
726
- if (typeof b === "object") {
727
- b = b.version;
728
- }
729
- return a === b;
730
- case "!==":
731
- if (typeof a === "object") {
732
- a = a.version;
733
- }
734
- if (typeof b === "object") {
735
- b = b.version;
736
- }
737
- return a !== b;
738
- case "":
739
- case "=":
740
- case "==":
741
- return eq(a, b, loose);
742
- case "!=":
743
- return neq(a, b, loose);
744
- case ">":
745
- return gt(a, b, loose);
746
- case ">=":
747
- return gte(a, b, loose);
748
- case "<":
749
- return lt(a, b, loose);
750
- case "<=":
751
- return lte(a, b, loose);
752
- default:
753
- throw new TypeError(`Invalid operator: ${op}`);
754
- }
755
- };
756
- module.exports = cmp;
757
- }
758
- });
759
-
760
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/coerce.js
761
- var require_coerce = __commonJS({
762
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/coerce.js"(exports, module) {
763
- "use strict";
764
- var SemVer = require_semver();
765
- var parse2 = require_parse();
766
- var { safeRe: re, t } = require_re();
767
- var coerce = (version3, options2) => {
768
- if (version3 instanceof SemVer) {
769
- return version3;
770
- }
771
- if (typeof version3 === "number") {
772
- version3 = String(version3);
773
- }
774
- if (typeof version3 !== "string") {
775
- return null;
776
- }
777
- options2 = options2 || {};
778
- let match = null;
779
- if (!options2.rtl) {
780
- match = version3.match(options2.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
781
- } else {
782
- const coerceRtlRegex = options2.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
783
- let next;
784
- while ((next = coerceRtlRegex.exec(version3)) && (!match || match.index + match[0].length !== version3.length)) {
785
- if (!match || next.index + next[0].length !== match.index + match[0].length) {
786
- match = next;
787
- }
788
- coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
789
- }
790
- coerceRtlRegex.lastIndex = -1;
791
- }
792
- if (match === null) {
793
- return null;
794
- }
795
- const major = match[2];
796
- const minor = match[3] || "0";
797
- const patch = match[4] || "0";
798
- const prerelease = options2.includePrerelease && match[5] ? `-${match[5]}` : "";
799
- const build = options2.includePrerelease && match[6] ? `+${match[6]}` : "";
800
- return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options2);
801
- };
802
- module.exports = coerce;
803
- }
804
- });
805
-
806
- // ../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js
807
- var require_iterator = __commonJS({
808
- "../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js"(exports, module) {
809
- "use strict";
810
- module.exports = function(Yallist) {
811
- Yallist.prototype[Symbol.iterator] = function* () {
812
- for (let walker = this.head; walker; walker = walker.next) {
813
- yield walker.value;
814
- }
815
- };
816
- };
817
- }
818
- });
819
-
820
- // ../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js
821
- var require_yallist = __commonJS({
822
- "../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js"(exports, module) {
823
- "use strict";
824
- module.exports = Yallist;
825
- Yallist.Node = Node2;
826
- Yallist.create = Yallist;
827
- function Yallist(list) {
828
- var self2 = this;
829
- if (!(self2 instanceof Yallist)) {
830
- self2 = new Yallist();
831
- }
832
- self2.tail = null;
833
- self2.head = null;
834
- self2.length = 0;
835
- if (list && typeof list.forEach === "function") {
836
- list.forEach(function(item2) {
837
- self2.push(item2);
838
- });
839
- } else if (arguments.length > 0) {
840
- for (var i = 0, l = arguments.length; i < l; i++) {
841
- self2.push(arguments[i]);
842
- }
843
- }
844
- return self2;
845
- }
846
- Yallist.prototype.removeNode = function(node) {
847
- if (node.list !== this) {
848
- throw new Error("removing node which does not belong to this list");
849
- }
850
- var next = node.next;
851
- var prev = node.prev;
852
- if (next) {
853
- next.prev = prev;
854
- }
855
- if (prev) {
856
- prev.next = next;
857
- }
858
- if (node === this.head) {
859
- this.head = next;
860
- }
861
- if (node === this.tail) {
862
- this.tail = prev;
863
- }
864
- node.list.length--;
865
- node.next = null;
866
- node.prev = null;
867
- node.list = null;
868
- return next;
869
- };
870
- Yallist.prototype.unshiftNode = function(node) {
871
- if (node === this.head) {
872
- return;
873
- }
874
- if (node.list) {
875
- node.list.removeNode(node);
876
- }
877
- var head = this.head;
878
- node.list = this;
879
- node.next = head;
880
- if (head) {
881
- head.prev = node;
882
- }
883
- this.head = node;
884
- if (!this.tail) {
885
- this.tail = node;
886
- }
887
- this.length++;
888
- };
889
- Yallist.prototype.pushNode = function(node) {
890
- if (node === this.tail) {
891
- return;
892
- }
893
- if (node.list) {
894
- node.list.removeNode(node);
895
- }
896
- var tail = this.tail;
897
- node.list = this;
898
- node.prev = tail;
899
- if (tail) {
900
- tail.next = node;
901
- }
902
- this.tail = node;
903
- if (!this.head) {
904
- this.head = node;
905
- }
906
- this.length++;
907
- };
908
- Yallist.prototype.push = function() {
909
- for (var i = 0, l = arguments.length; i < l; i++) {
910
- push(this, arguments[i]);
911
- }
912
- return this.length;
913
- };
914
- Yallist.prototype.unshift = function() {
915
- for (var i = 0, l = arguments.length; i < l; i++) {
916
- unshift(this, arguments[i]);
917
- }
918
- return this.length;
919
- };
920
- Yallist.prototype.pop = function() {
921
- if (!this.tail) {
922
- return void 0;
923
- }
924
- var res = this.tail.value;
925
- this.tail = this.tail.prev;
926
- if (this.tail) {
927
- this.tail.next = null;
928
- } else {
929
- this.head = null;
930
- }
931
- this.length--;
932
- return res;
933
- };
934
- Yallist.prototype.shift = function() {
935
- if (!this.head) {
936
- return void 0;
937
- }
938
- var res = this.head.value;
939
- this.head = this.head.next;
940
- if (this.head) {
941
- this.head.prev = null;
942
- } else {
943
- this.tail = null;
944
- }
945
- this.length--;
946
- return res;
947
- };
948
- Yallist.prototype.forEach = function(fn, thisp) {
949
- thisp = thisp || this;
950
- for (var walker = this.head, i = 0; walker !== null; i++) {
951
- fn.call(thisp, walker.value, i, this);
952
- walker = walker.next;
953
- }
954
- };
955
- Yallist.prototype.forEachReverse = function(fn, thisp) {
956
- thisp = thisp || this;
957
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
958
- fn.call(thisp, walker.value, i, this);
959
- walker = walker.prev;
960
- }
961
- };
962
- Yallist.prototype.get = function(n) {
963
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
964
- walker = walker.next;
965
- }
966
- if (i === n && walker !== null) {
967
- return walker.value;
968
- }
969
- };
970
- Yallist.prototype.getReverse = function(n) {
971
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
972
- walker = walker.prev;
973
- }
974
- if (i === n && walker !== null) {
975
- return walker.value;
976
- }
977
- };
978
- Yallist.prototype.map = function(fn, thisp) {
979
- thisp = thisp || this;
980
- var res = new Yallist();
981
- for (var walker = this.head; walker !== null; ) {
982
- res.push(fn.call(thisp, walker.value, this));
983
- walker = walker.next;
984
- }
985
- return res;
986
- };
987
- Yallist.prototype.mapReverse = function(fn, thisp) {
988
- thisp = thisp || this;
989
- var res = new Yallist();
990
- for (var walker = this.tail; walker !== null; ) {
991
- res.push(fn.call(thisp, walker.value, this));
992
- walker = walker.prev;
993
- }
994
- return res;
995
- };
996
- Yallist.prototype.reduce = function(fn, initial) {
997
- var acc;
998
- var walker = this.head;
999
- if (arguments.length > 1) {
1000
- acc = initial;
1001
- } else if (this.head) {
1002
- walker = this.head.next;
1003
- acc = this.head.value;
1004
- } else {
1005
- throw new TypeError("Reduce of empty list with no initial value");
1006
- }
1007
- for (var i = 0; walker !== null; i++) {
1008
- acc = fn(acc, walker.value, i);
1009
- walker = walker.next;
1010
- }
1011
- return acc;
1012
- };
1013
- Yallist.prototype.reduceReverse = function(fn, initial) {
1014
- var acc;
1015
- var walker = this.tail;
1016
- if (arguments.length > 1) {
1017
- acc = initial;
1018
- } else if (this.tail) {
1019
- walker = this.tail.prev;
1020
- acc = this.tail.value;
1021
- } else {
1022
- throw new TypeError("Reduce of empty list with no initial value");
1023
- }
1024
- for (var i = this.length - 1; walker !== null; i--) {
1025
- acc = fn(acc, walker.value, i);
1026
- walker = walker.prev;
1027
- }
1028
- return acc;
1029
- };
1030
- Yallist.prototype.toArray = function() {
1031
- var arr = new Array(this.length);
1032
- for (var i = 0, walker = this.head; walker !== null; i++) {
1033
- arr[i] = walker.value;
1034
- walker = walker.next;
1035
- }
1036
- return arr;
1037
- };
1038
- Yallist.prototype.toArrayReverse = function() {
1039
- var arr = new Array(this.length);
1040
- for (var i = 0, walker = this.tail; walker !== null; i++) {
1041
- arr[i] = walker.value;
1042
- walker = walker.prev;
1043
- }
1044
- return arr;
1045
- };
1046
- Yallist.prototype.slice = function(from, to) {
1047
- to = to || this.length;
1048
- if (to < 0) {
1049
- to += this.length;
1050
- }
1051
- from = from || 0;
1052
- if (from < 0) {
1053
- from += this.length;
1054
- }
1055
- var ret = new Yallist();
1056
- if (to < from || to < 0) {
1057
- return ret;
1058
- }
1059
- if (from < 0) {
1060
- from = 0;
1061
- }
1062
- if (to > this.length) {
1063
- to = this.length;
1064
- }
1065
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
1066
- walker = walker.next;
1067
- }
1068
- for (; walker !== null && i < to; i++, walker = walker.next) {
1069
- ret.push(walker.value);
1070
- }
1071
- return ret;
1072
- };
1073
- Yallist.prototype.sliceReverse = function(from, to) {
1074
- to = to || this.length;
1075
- if (to < 0) {
1076
- to += this.length;
1077
- }
1078
- from = from || 0;
1079
- if (from < 0) {
1080
- from += this.length;
1081
- }
1082
- var ret = new Yallist();
1083
- if (to < from || to < 0) {
1084
- return ret;
1085
- }
1086
- if (from < 0) {
1087
- from = 0;
1088
- }
1089
- if (to > this.length) {
1090
- to = this.length;
1091
- }
1092
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
1093
- walker = walker.prev;
1094
- }
1095
- for (; walker !== null && i > from; i--, walker = walker.prev) {
1096
- ret.push(walker.value);
1097
- }
1098
- return ret;
1099
- };
1100
- Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
1101
- if (start > this.length) {
1102
- start = this.length - 1;
1103
- }
1104
- if (start < 0) {
1105
- start = this.length + start;
1106
- }
1107
- for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
1108
- walker = walker.next;
1109
- }
1110
- var ret = [];
1111
- for (var i = 0; walker && i < deleteCount; i++) {
1112
- ret.push(walker.value);
1113
- walker = this.removeNode(walker);
1114
- }
1115
- if (walker === null) {
1116
- walker = this.tail;
1117
- }
1118
- if (walker !== this.head && walker !== this.tail) {
1119
- walker = walker.prev;
1120
- }
1121
- for (var i = 0; i < nodes.length; i++) {
1122
- walker = insert(this, walker, nodes[i]);
1123
- }
1124
- return ret;
1125
- };
1126
- Yallist.prototype.reverse = function() {
1127
- var head = this.head;
1128
- var tail = this.tail;
1129
- for (var walker = head; walker !== null; walker = walker.prev) {
1130
- var p = walker.prev;
1131
- walker.prev = walker.next;
1132
- walker.next = p;
1133
- }
1134
- this.head = tail;
1135
- this.tail = head;
1136
- return this;
1137
- };
1138
- function insert(self2, node, value) {
1139
- var inserted = node === self2.head ? new Node2(value, null, node, self2) : new Node2(value, node, node.next, self2);
1140
- if (inserted.next === null) {
1141
- self2.tail = inserted;
1142
- }
1143
- if (inserted.prev === null) {
1144
- self2.head = inserted;
1145
- }
1146
- self2.length++;
1147
- return inserted;
1148
- }
1149
- function push(self2, item2) {
1150
- self2.tail = new Node2(item2, self2.tail, null, self2);
1151
- if (!self2.head) {
1152
- self2.head = self2.tail;
1153
- }
1154
- self2.length++;
1155
- }
1156
- function unshift(self2, item2) {
1157
- self2.head = new Node2(item2, null, self2.head, self2);
1158
- if (!self2.tail) {
1159
- self2.tail = self2.head;
1160
- }
1161
- self2.length++;
1162
- }
1163
- function Node2(value, prev, next, list) {
1164
- if (!(this instanceof Node2)) {
1165
- return new Node2(value, prev, next, list);
1166
- }
1167
- this.list = list;
1168
- this.value = value;
1169
- if (prev) {
1170
- prev.next = this;
1171
- this.prev = prev;
1172
- } else {
1173
- this.prev = null;
1174
- }
1175
- if (next) {
1176
- next.prev = this;
1177
- this.next = next;
1178
- } else {
1179
- this.next = null;
1180
- }
1181
- }
1182
- try {
1183
- require_iterator()(Yallist);
1184
- } catch (er) {
1185
- }
1186
- }
1187
- });
1188
-
1189
- // ../../node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js
1190
- var require_lru_cache = __commonJS({
1191
- "../../node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js"(exports, module) {
1192
- "use strict";
1193
- var Yallist = require_yallist();
1194
- var MAX = Symbol("max");
1195
- var LENGTH = Symbol("length");
1196
- var LENGTH_CALCULATOR = Symbol("lengthCalculator");
1197
- var ALLOW_STALE = Symbol("allowStale");
1198
- var MAX_AGE = Symbol("maxAge");
1199
- var DISPOSE = Symbol("dispose");
1200
- var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
1201
- var LRU_LIST = Symbol("lruList");
1202
- var CACHE = Symbol("cache");
1203
- var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
1204
- var naiveLength = () => 1;
1205
- var LRUCache = class {
1206
- constructor(options2) {
1207
- if (typeof options2 === "number")
1208
- options2 = { max: options2 };
1209
- if (!options2)
1210
- options2 = {};
1211
- if (options2.max && (typeof options2.max !== "number" || options2.max < 0))
1212
- throw new TypeError("max must be a non-negative number");
1213
- const max = this[MAX] = options2.max || Infinity;
1214
- const lc = options2.length || naiveLength;
1215
- this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
1216
- this[ALLOW_STALE] = options2.stale || false;
1217
- if (options2.maxAge && typeof options2.maxAge !== "number")
1218
- throw new TypeError("maxAge must be a number");
1219
- this[MAX_AGE] = options2.maxAge || 0;
1220
- this[DISPOSE] = options2.dispose;
1221
- this[NO_DISPOSE_ON_SET] = options2.noDisposeOnSet || false;
1222
- this[UPDATE_AGE_ON_GET] = options2.updateAgeOnGet || false;
1223
- this.reset();
1224
- }
1225
- // resize the cache when the max changes.
1226
- set max(mL) {
1227
- if (typeof mL !== "number" || mL < 0)
1228
- throw new TypeError("max must be a non-negative number");
1229
- this[MAX] = mL || Infinity;
1230
- trim(this);
1231
- }
1232
- get max() {
1233
- return this[MAX];
1234
- }
1235
- set allowStale(allowStale) {
1236
- this[ALLOW_STALE] = !!allowStale;
1237
- }
1238
- get allowStale() {
1239
- return this[ALLOW_STALE];
1240
- }
1241
- set maxAge(mA) {
1242
- if (typeof mA !== "number")
1243
- throw new TypeError("maxAge must be a non-negative number");
1244
- this[MAX_AGE] = mA;
1245
- trim(this);
1246
- }
1247
- get maxAge() {
1248
- return this[MAX_AGE];
1249
- }
1250
- // resize the cache when the lengthCalculator changes.
1251
- set lengthCalculator(lC) {
1252
- if (typeof lC !== "function")
1253
- lC = naiveLength;
1254
- if (lC !== this[LENGTH_CALCULATOR]) {
1255
- this[LENGTH_CALCULATOR] = lC;
1256
- this[LENGTH] = 0;
1257
- this[LRU_LIST].forEach((hit) => {
1258
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
1259
- this[LENGTH] += hit.length;
1260
- });
1261
- }
1262
- trim(this);
1263
- }
1264
- get lengthCalculator() {
1265
- return this[LENGTH_CALCULATOR];
1266
- }
1267
- get length() {
1268
- return this[LENGTH];
1269
- }
1270
- get itemCount() {
1271
- return this[LRU_LIST].length;
1272
- }
1273
- rforEach(fn, thisp) {
1274
- thisp = thisp || this;
1275
- for (let walker = this[LRU_LIST].tail; walker !== null; ) {
1276
- const prev = walker.prev;
1277
- forEachStep(this, fn, walker, thisp);
1278
- walker = prev;
1279
- }
1280
- }
1281
- forEach(fn, thisp) {
1282
- thisp = thisp || this;
1283
- for (let walker = this[LRU_LIST].head; walker !== null; ) {
1284
- const next = walker.next;
1285
- forEachStep(this, fn, walker, thisp);
1286
- walker = next;
1287
- }
1288
- }
1289
- keys() {
1290
- return this[LRU_LIST].toArray().map((k) => k.key);
1291
- }
1292
- values() {
1293
- return this[LRU_LIST].toArray().map((k) => k.value);
1294
- }
1295
- reset() {
1296
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
1297
- this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
1298
- }
1299
- this[CACHE] = /* @__PURE__ */ new Map();
1300
- this[LRU_LIST] = new Yallist();
1301
- this[LENGTH] = 0;
1302
- }
1303
- dump() {
1304
- return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
1305
- k: hit.key,
1306
- v: hit.value,
1307
- e: hit.now + (hit.maxAge || 0)
1308
- }).toArray().filter((h) => h);
1309
- }
1310
- dumpLru() {
1311
- return this[LRU_LIST];
1312
- }
1313
- set(key, value, maxAge) {
1314
- maxAge = maxAge || this[MAX_AGE];
1315
- if (maxAge && typeof maxAge !== "number")
1316
- throw new TypeError("maxAge must be a number");
1317
- const now = maxAge ? Date.now() : 0;
1318
- const len = this[LENGTH_CALCULATOR](value, key);
1319
- if (this[CACHE].has(key)) {
1320
- if (len > this[MAX]) {
1321
- del(this, this[CACHE].get(key));
1322
- return false;
1323
- }
1324
- const node = this[CACHE].get(key);
1325
- const item2 = node.value;
1326
- if (this[DISPOSE]) {
1327
- if (!this[NO_DISPOSE_ON_SET])
1328
- this[DISPOSE](key, item2.value);
1329
- }
1330
- item2.now = now;
1331
- item2.maxAge = maxAge;
1332
- item2.value = value;
1333
- this[LENGTH] += len - item2.length;
1334
- item2.length = len;
1335
- this.get(key);
1336
- trim(this);
1337
- return true;
1338
- }
1339
- const hit = new Entry(key, value, len, now, maxAge);
1340
- if (hit.length > this[MAX]) {
1341
- if (this[DISPOSE])
1342
- this[DISPOSE](key, value);
1343
- return false;
1344
- }
1345
- this[LENGTH] += hit.length;
1346
- this[LRU_LIST].unshift(hit);
1347
- this[CACHE].set(key, this[LRU_LIST].head);
1348
- trim(this);
1349
- return true;
1350
- }
1351
- has(key) {
1352
- if (!this[CACHE].has(key))
1353
- return false;
1354
- const hit = this[CACHE].get(key).value;
1355
- return !isStale(this, hit);
1356
- }
1357
- get(key) {
1358
- return get(this, key, true);
1359
- }
1360
- peek(key) {
1361
- return get(this, key, false);
1362
- }
1363
- pop() {
1364
- const node = this[LRU_LIST].tail;
1365
- if (!node)
1366
- return null;
1367
- del(this, node);
1368
- return node.value;
1369
- }
1370
- del(key) {
1371
- del(this, this[CACHE].get(key));
1372
- }
1373
- load(arr) {
1374
- this.reset();
1375
- const now = Date.now();
1376
- for (let l = arr.length - 1; l >= 0; l--) {
1377
- const hit = arr[l];
1378
- const expiresAt = hit.e || 0;
1379
- if (expiresAt === 0)
1380
- this.set(hit.k, hit.v);
1381
- else {
1382
- const maxAge = expiresAt - now;
1383
- if (maxAge > 0) {
1384
- this.set(hit.k, hit.v, maxAge);
1385
- }
1386
- }
1387
- }
1388
- }
1389
- prune() {
1390
- this[CACHE].forEach((value, key) => get(this, key, false));
1391
- }
1392
- };
1393
- var get = (self2, key, doUse) => {
1394
- const node = self2[CACHE].get(key);
1395
- if (node) {
1396
- const hit = node.value;
1397
- if (isStale(self2, hit)) {
1398
- del(self2, node);
1399
- if (!self2[ALLOW_STALE])
1400
- return void 0;
1401
- } else {
1402
- if (doUse) {
1403
- if (self2[UPDATE_AGE_ON_GET])
1404
- node.value.now = Date.now();
1405
- self2[LRU_LIST].unshiftNode(node);
1406
- }
1407
- }
1408
- return hit.value;
1409
- }
1410
- };
1411
- var isStale = (self2, hit) => {
1412
- if (!hit || !hit.maxAge && !self2[MAX_AGE])
1413
- return false;
1414
- const diff = Date.now() - hit.now;
1415
- return hit.maxAge ? diff > hit.maxAge : self2[MAX_AGE] && diff > self2[MAX_AGE];
1416
- };
1417
- var trim = (self2) => {
1418
- if (self2[LENGTH] > self2[MAX]) {
1419
- for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
1420
- const prev = walker.prev;
1421
- del(self2, walker);
1422
- walker = prev;
1423
- }
1424
- }
1425
- };
1426
- var del = (self2, node) => {
1427
- if (node) {
1428
- const hit = node.value;
1429
- if (self2[DISPOSE])
1430
- self2[DISPOSE](hit.key, hit.value);
1431
- self2[LENGTH] -= hit.length;
1432
- self2[CACHE].delete(hit.key);
1433
- self2[LRU_LIST].removeNode(node);
1434
- }
1435
- };
1436
- var Entry = class {
1437
- constructor(key, value, length, now, maxAge) {
1438
- this.key = key;
1439
- this.value = value;
1440
- this.length = length;
1441
- this.now = now;
1442
- this.maxAge = maxAge || 0;
1443
- }
1444
- };
1445
- var forEachStep = (self2, fn, node, thisp) => {
1446
- let hit = node.value;
1447
- if (isStale(self2, hit)) {
1448
- del(self2, node);
1449
- if (!self2[ALLOW_STALE])
1450
- hit = void 0;
1451
- }
1452
- if (hit)
1453
- fn.call(thisp, hit.value, hit.key, self2);
1454
- };
1455
- module.exports = LRUCache;
1456
- }
1457
- });
1458
-
1459
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/range.js
1460
- var require_range = __commonJS({
1461
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/range.js"(exports, module) {
1462
- "use strict";
1463
- var Range = class _Range {
1464
- constructor(range, options2) {
1465
- options2 = parseOptions(options2);
1466
- if (range instanceof _Range) {
1467
- if (range.loose === !!options2.loose && range.includePrerelease === !!options2.includePrerelease) {
1468
- return range;
1469
- } else {
1470
- return new _Range(range.raw, options2);
1471
- }
1472
- }
1473
- if (range instanceof Comparator) {
1474
- this.raw = range.value;
1475
- this.set = [[range]];
1476
- this.format();
1477
- return this;
1478
- }
1479
- this.options = options2;
1480
- this.loose = !!options2.loose;
1481
- this.includePrerelease = !!options2.includePrerelease;
1482
- this.raw = range.trim().split(/\s+/).join(" ");
1483
- this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c2) => c2.length);
1484
- if (!this.set.length) {
1485
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
1486
- }
1487
- if (this.set.length > 1) {
1488
- const first = this.set[0];
1489
- this.set = this.set.filter((c2) => !isNullSet(c2[0]));
1490
- if (this.set.length === 0) {
1491
- this.set = [first];
1492
- } else if (this.set.length > 1) {
1493
- for (const c2 of this.set) {
1494
- if (c2.length === 1 && isAny(c2[0])) {
1495
- this.set = [c2];
1496
- break;
1497
- }
1498
- }
1499
- }
1500
- }
1501
- this.format();
1502
- }
1503
- format() {
1504
- this.range = this.set.map((comps) => comps.join(" ").trim()).join("||").trim();
1505
- return this.range;
1506
- }
1507
- toString() {
1508
- return this.range;
1509
- }
1510
- parseRange(range) {
1511
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
1512
- const memoKey = memoOpts + ":" + range;
1513
- const cached = cache.get(memoKey);
1514
- if (cached) {
1515
- return cached;
1516
- }
1517
- const loose = this.options.loose;
1518
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1519
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1520
- debug2("hyphen replace", range);
1521
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1522
- debug2("comparator trim", range);
1523
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1524
- debug2("tilde trim", range);
1525
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1526
- debug2("caret trim", range);
1527
- let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1528
- if (loose) {
1529
- rangeList = rangeList.filter((comp) => {
1530
- debug2("loose invalid filter", comp, this.options);
1531
- return !!comp.match(re[t.COMPARATORLOOSE]);
1532
- });
1533
- }
1534
- debug2("range list", rangeList);
1535
- const rangeMap = /* @__PURE__ */ new Map();
1536
- const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
1537
- for (const comp of comparators) {
1538
- if (isNullSet(comp)) {
1539
- return [comp];
1540
- }
1541
- rangeMap.set(comp.value, comp);
1542
- }
1543
- if (rangeMap.size > 1 && rangeMap.has("")) {
1544
- rangeMap.delete("");
1545
- }
1546
- const result = [...rangeMap.values()];
1547
- cache.set(memoKey, result);
1548
- return result;
1549
- }
1550
- intersects(range, options2) {
1551
- if (!(range instanceof _Range)) {
1552
- throw new TypeError("a Range is required");
1553
- }
1554
- return this.set.some((thisComparators) => {
1555
- return isSatisfiable(thisComparators, options2) && range.set.some((rangeComparators) => {
1556
- return isSatisfiable(rangeComparators, options2) && thisComparators.every((thisComparator) => {
1557
- return rangeComparators.every((rangeComparator) => {
1558
- return thisComparator.intersects(rangeComparator, options2);
1559
- });
1560
- });
1561
- });
1562
- });
1563
- }
1564
- // if ANY of the sets match ALL of its comparators, then pass
1565
- test(version3) {
1566
- if (!version3) {
1567
- return false;
1568
- }
1569
- if (typeof version3 === "string") {
1570
- try {
1571
- version3 = new SemVer(version3, this.options);
1572
- } catch (er) {
1573
- return false;
1574
- }
1575
- }
1576
- for (let i = 0; i < this.set.length; i++) {
1577
- if (testSet(this.set[i], version3, this.options)) {
1578
- return true;
1579
- }
1580
- }
1581
- return false;
1582
- }
1583
- };
1584
- module.exports = Range;
1585
- var LRU = require_lru_cache();
1586
- var cache = new LRU({ max: 1e3 });
1587
- var parseOptions = require_parse_options();
1588
- var Comparator = require_comparator();
1589
- var debug2 = require_debug();
1590
- var SemVer = require_semver();
1591
- var {
1592
- safeRe: re,
1593
- t,
1594
- comparatorTrimReplace,
1595
- tildeTrimReplace,
1596
- caretTrimReplace
1597
- } = require_re();
1598
- var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1599
- var isNullSet = (c2) => c2.value === "<0.0.0-0";
1600
- var isAny = (c2) => c2.value === "";
1601
- var isSatisfiable = (comparators, options2) => {
1602
- let result = true;
1603
- const remainingComparators = comparators.slice();
1604
- let testComparator = remainingComparators.pop();
1605
- while (result && remainingComparators.length) {
1606
- result = remainingComparators.every((otherComparator) => {
1607
- return testComparator.intersects(otherComparator, options2);
1608
- });
1609
- testComparator = remainingComparators.pop();
1610
- }
1611
- return result;
1612
- };
1613
- var parseComparator = (comp, options2) => {
1614
- debug2("comp", comp, options2);
1615
- comp = replaceCarets(comp, options2);
1616
- debug2("caret", comp);
1617
- comp = replaceTildes(comp, options2);
1618
- debug2("tildes", comp);
1619
- comp = replaceXRanges(comp, options2);
1620
- debug2("xrange", comp);
1621
- comp = replaceStars(comp, options2);
1622
- debug2("stars", comp);
1623
- return comp;
1624
- };
1625
- var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1626
- var replaceTildes = (comp, options2) => {
1627
- return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options2)).join(" ");
1628
- };
1629
- var replaceTilde = (comp, options2) => {
1630
- const r = options2.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1631
- return comp.replace(r, (_, M, m, p, pr) => {
1632
- debug2("tilde", comp, _, M, m, p, pr);
1633
- let ret;
1634
- if (isX(M)) {
1635
- ret = "";
1636
- } else if (isX(m)) {
1637
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1638
- } else if (isX(p)) {
1639
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1640
- } else if (pr) {
1641
- debug2("replaceTilde pr", pr);
1642
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1643
- } else {
1644
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1645
- }
1646
- debug2("tilde return", ret);
1647
- return ret;
1648
- });
1649
- };
1650
- var replaceCarets = (comp, options2) => {
1651
- return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options2)).join(" ");
1652
- };
1653
- var replaceCaret = (comp, options2) => {
1654
- debug2("caret", comp, options2);
1655
- const r = options2.loose ? re[t.CARETLOOSE] : re[t.CARET];
1656
- const z = options2.includePrerelease ? "-0" : "";
1657
- return comp.replace(r, (_, M, m, p, pr) => {
1658
- debug2("caret", comp, _, M, m, p, pr);
1659
- let ret;
1660
- if (isX(M)) {
1661
- ret = "";
1662
- } else if (isX(m)) {
1663
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1664
- } else if (isX(p)) {
1665
- if (M === "0") {
1666
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1667
- } else {
1668
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1669
- }
1670
- } else if (pr) {
1671
- debug2("replaceCaret pr", pr);
1672
- if (M === "0") {
1673
- if (m === "0") {
1674
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1675
- } else {
1676
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1677
- }
1678
- } else {
1679
- ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1680
- }
1681
- } else {
1682
- debug2("no pr");
1683
- if (M === "0") {
1684
- if (m === "0") {
1685
- ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1686
- } else {
1687
- ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1688
- }
1689
- } else {
1690
- ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1691
- }
1692
- }
1693
- debug2("caret return", ret);
1694
- return ret;
1695
- });
1696
- };
1697
- var replaceXRanges = (comp, options2) => {
1698
- debug2("replaceXRanges", comp, options2);
1699
- return comp.split(/\s+/).map((c2) => replaceXRange(c2, options2)).join(" ");
1700
- };
1701
- var replaceXRange = (comp, options2) => {
1702
- comp = comp.trim();
1703
- const r = options2.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1704
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1705
- debug2("xRange", comp, ret, gtlt, M, m, p, pr);
1706
- const xM = isX(M);
1707
- const xm = xM || isX(m);
1708
- const xp = xm || isX(p);
1709
- const anyX = xp;
1710
- if (gtlt === "=" && anyX) {
1711
- gtlt = "";
1712
- }
1713
- pr = options2.includePrerelease ? "-0" : "";
1714
- if (xM) {
1715
- if (gtlt === ">" || gtlt === "<") {
1716
- ret = "<0.0.0-0";
1717
- } else {
1718
- ret = "*";
1719
- }
1720
- } else if (gtlt && anyX) {
1721
- if (xm) {
1722
- m = 0;
1723
- }
1724
- p = 0;
1725
- if (gtlt === ">") {
1726
- gtlt = ">=";
1727
- if (xm) {
1728
- M = +M + 1;
1729
- m = 0;
1730
- p = 0;
1731
- } else {
1732
- m = +m + 1;
1733
- p = 0;
1734
- }
1735
- } else if (gtlt === "<=") {
1736
- gtlt = "<";
1737
- if (xm) {
1738
- M = +M + 1;
1739
- } else {
1740
- m = +m + 1;
1741
- }
1742
- }
1743
- if (gtlt === "<") {
1744
- pr = "-0";
1745
- }
1746
- ret = `${gtlt + M}.${m}.${p}${pr}`;
1747
- } else if (xm) {
1748
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1749
- } else if (xp) {
1750
- ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1751
- }
1752
- debug2("xRange return", ret);
1753
- return ret;
1754
- });
1755
- };
1756
- var replaceStars = (comp, options2) => {
1757
- debug2("replaceStars", comp, options2);
1758
- return comp.trim().replace(re[t.STAR], "");
1759
- };
1760
- var replaceGTE0 = (comp, options2) => {
1761
- debug2("replaceGTE0", comp, options2);
1762
- return comp.trim().replace(re[options2.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1763
- };
1764
- var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
1765
- if (isX(fM)) {
1766
- from = "";
1767
- } else if (isX(fm)) {
1768
- from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1769
- } else if (isX(fp)) {
1770
- from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1771
- } else if (fpr) {
1772
- from = `>=${from}`;
1773
- } else {
1774
- from = `>=${from}${incPr ? "-0" : ""}`;
1775
- }
1776
- if (isX(tM)) {
1777
- to = "";
1778
- } else if (isX(tm)) {
1779
- to = `<${+tM + 1}.0.0-0`;
1780
- } else if (isX(tp)) {
1781
- to = `<${tM}.${+tm + 1}.0-0`;
1782
- } else if (tpr) {
1783
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
1784
- } else if (incPr) {
1785
- to = `<${tM}.${tm}.${+tp + 1}-0`;
1786
- } else {
1787
- to = `<=${to}`;
1788
- }
1789
- return `${from} ${to}`.trim();
1790
- };
1791
- var testSet = (set, version3, options2) => {
1792
- for (let i = 0; i < set.length; i++) {
1793
- if (!set[i].test(version3)) {
1794
- return false;
1795
- }
1796
- }
1797
- if (version3.prerelease.length && !options2.includePrerelease) {
1798
- for (let i = 0; i < set.length; i++) {
1799
- debug2(set[i].semver);
1800
- if (set[i].semver === Comparator.ANY) {
1801
- continue;
1802
- }
1803
- if (set[i].semver.prerelease.length > 0) {
1804
- const allowed = set[i].semver;
1805
- if (allowed.major === version3.major && allowed.minor === version3.minor && allowed.patch === version3.patch) {
1806
- return true;
1807
- }
1808
- }
1809
- }
1810
- return false;
1811
- }
1812
- return true;
1813
- };
1814
- }
1815
- });
1816
-
1817
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/comparator.js
1818
- var require_comparator = __commonJS({
1819
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/comparator.js"(exports, module) {
1820
- "use strict";
1821
- var ANY = Symbol("SemVer ANY");
1822
- var Comparator = class _Comparator {
1823
- static get ANY() {
1824
- return ANY;
1825
- }
1826
- constructor(comp, options2) {
1827
- options2 = parseOptions(options2);
1828
- if (comp instanceof _Comparator) {
1829
- if (comp.loose === !!options2.loose) {
1830
- return comp;
1831
- } else {
1832
- comp = comp.value;
1833
- }
1834
- }
1835
- comp = comp.trim().split(/\s+/).join(" ");
1836
- debug2("comparator", comp, options2);
1837
- this.options = options2;
1838
- this.loose = !!options2.loose;
1839
- this.parse(comp);
1840
- if (this.semver === ANY) {
1841
- this.value = "";
1842
- } else {
1843
- this.value = this.operator + this.semver.version;
1844
- }
1845
- debug2("comp", this);
1846
- }
1847
- parse(comp) {
1848
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1849
- const m = comp.match(r);
1850
- if (!m) {
1851
- throw new TypeError(`Invalid comparator: ${comp}`);
1852
- }
1853
- this.operator = m[1] !== void 0 ? m[1] : "";
1854
- if (this.operator === "=") {
1855
- this.operator = "";
1856
- }
1857
- if (!m[2]) {
1858
- this.semver = ANY;
1859
- } else {
1860
- this.semver = new SemVer(m[2], this.options.loose);
1861
- }
1862
- }
1863
- toString() {
1864
- return this.value;
1865
- }
1866
- test(version3) {
1867
- debug2("Comparator.test", version3, this.options.loose);
1868
- if (this.semver === ANY || version3 === ANY) {
1869
- return true;
1870
- }
1871
- if (typeof version3 === "string") {
1872
- try {
1873
- version3 = new SemVer(version3, this.options);
1874
- } catch (er) {
1875
- return false;
1876
- }
1877
- }
1878
- return cmp(version3, this.operator, this.semver, this.options);
1879
- }
1880
- intersects(comp, options2) {
1881
- if (!(comp instanceof _Comparator)) {
1882
- throw new TypeError("a Comparator is required");
1883
- }
1884
- if (this.operator === "") {
1885
- if (this.value === "") {
1886
- return true;
1887
- }
1888
- return new Range(comp.value, options2).test(this.value);
1889
- } else if (comp.operator === "") {
1890
- if (comp.value === "") {
1891
- return true;
1892
- }
1893
- return new Range(this.value, options2).test(comp.semver);
1894
- }
1895
- options2 = parseOptions(options2);
1896
- if (options2.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
1897
- return false;
1898
- }
1899
- if (!options2.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
1900
- return false;
1901
- }
1902
- if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
1903
- return true;
1904
- }
1905
- if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
1906
- return true;
1907
- }
1908
- if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
1909
- return true;
1910
- }
1911
- if (cmp(this.semver, "<", comp.semver, options2) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
1912
- return true;
1913
- }
1914
- if (cmp(this.semver, ">", comp.semver, options2) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
1915
- return true;
1916
- }
1917
- return false;
1918
- }
1919
- };
1920
- module.exports = Comparator;
1921
- var parseOptions = require_parse_options();
1922
- var { safeRe: re, t } = require_re();
1923
- var cmp = require_cmp();
1924
- var debug2 = require_debug();
1925
- var SemVer = require_semver();
1926
- var Range = require_range();
1927
- }
1928
- });
1929
-
1930
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/satisfies.js
1931
- var require_satisfies = __commonJS({
1932
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/satisfies.js"(exports, module) {
1933
- "use strict";
1934
- var Range = require_range();
1935
- var satisfies3 = (version3, range, options2) => {
1936
- try {
1937
- range = new Range(range, options2);
1938
- } catch (er) {
1939
- return false;
1940
- }
1941
- return range.test(version3);
1942
- };
1943
- module.exports = satisfies3;
1944
- }
1945
- });
1946
-
1947
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/to-comparators.js
1948
- var require_to_comparators = __commonJS({
1949
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/to-comparators.js"(exports, module) {
1950
- "use strict";
1951
- var Range = require_range();
1952
- var toComparators = (range, options2) => new Range(range, options2).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
1953
- module.exports = toComparators;
1954
- }
1955
- });
1956
-
1957
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/max-satisfying.js
1958
- var require_max_satisfying = __commonJS({
1959
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/max-satisfying.js"(exports, module) {
1960
- "use strict";
1961
- var SemVer = require_semver();
1962
- var Range = require_range();
1963
- var maxSatisfying = (versions, range, options2) => {
1964
- let max = null;
1965
- let maxSV = null;
1966
- let rangeObj = null;
1967
- try {
1968
- rangeObj = new Range(range, options2);
1969
- } catch (er) {
1970
- return null;
1971
- }
1972
- versions.forEach((v) => {
1973
- if (rangeObj.test(v)) {
1974
- if (!max || maxSV.compare(v) === -1) {
1975
- max = v;
1976
- maxSV = new SemVer(max, options2);
1977
- }
1978
- }
1979
- });
1980
- return max;
1981
- };
1982
- module.exports = maxSatisfying;
1983
- }
1984
- });
1985
-
1986
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-satisfying.js
1987
- var require_min_satisfying = __commonJS({
1988
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-satisfying.js"(exports, module) {
1989
- "use strict";
1990
- var SemVer = require_semver();
1991
- var Range = require_range();
1992
- var minSatisfying = (versions, range, options2) => {
1993
- let min = null;
1994
- let minSV = null;
1995
- let rangeObj = null;
1996
- try {
1997
- rangeObj = new Range(range, options2);
1998
- } catch (er) {
1999
- return null;
2000
- }
2001
- versions.forEach((v) => {
2002
- if (rangeObj.test(v)) {
2003
- if (!min || minSV.compare(v) === 1) {
2004
- min = v;
2005
- minSV = new SemVer(min, options2);
2006
- }
2007
- }
2008
- });
2009
- return min;
2010
- };
2011
- module.exports = minSatisfying;
2012
- }
2013
- });
2014
-
2015
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-version.js
2016
- var require_min_version = __commonJS({
2017
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-version.js"(exports, module) {
2018
- "use strict";
2019
- var SemVer = require_semver();
2020
- var Range = require_range();
2021
- var gt = require_gt();
2022
- var minVersion = (range, loose) => {
2023
- range = new Range(range, loose);
2024
- let minver = new SemVer("0.0.0");
2025
- if (range.test(minver)) {
2026
- return minver;
2027
- }
2028
- minver = new SemVer("0.0.0-0");
2029
- if (range.test(minver)) {
2030
- return minver;
2031
- }
2032
- minver = null;
2033
- for (let i = 0; i < range.set.length; ++i) {
2034
- const comparators = range.set[i];
2035
- let setMin = null;
2036
- comparators.forEach((comparator) => {
2037
- const compver = new SemVer(comparator.semver.version);
2038
- switch (comparator.operator) {
2039
- case ">":
2040
- if (compver.prerelease.length === 0) {
2041
- compver.patch++;
2042
- } else {
2043
- compver.prerelease.push(0);
2044
- }
2045
- compver.raw = compver.format();
2046
- case "":
2047
- case ">=":
2048
- if (!setMin || gt(compver, setMin)) {
2049
- setMin = compver;
2050
- }
2051
- break;
2052
- case "<":
2053
- case "<=":
2054
- break;
2055
- default:
2056
- throw new Error(`Unexpected operation: ${comparator.operator}`);
2057
- }
2058
- });
2059
- if (setMin && (!minver || gt(minver, setMin))) {
2060
- minver = setMin;
2061
- }
2062
- }
2063
- if (minver && range.test(minver)) {
2064
- return minver;
2065
- }
2066
- return null;
2067
- };
2068
- module.exports = minVersion;
2069
- }
2070
- });
2071
-
2072
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/valid.js
2073
- var require_valid2 = __commonJS({
2074
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/valid.js"(exports, module) {
2075
- "use strict";
2076
- var Range = require_range();
2077
- var validRange = (range, options2) => {
2078
- try {
2079
- return new Range(range, options2).range || "*";
2080
- } catch (er) {
2081
- return null;
2082
- }
2083
- };
2084
- module.exports = validRange;
2085
- }
2086
- });
2087
-
2088
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/outside.js
2089
- var require_outside = __commonJS({
2090
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/outside.js"(exports, module) {
2091
- "use strict";
2092
- var SemVer = require_semver();
2093
- var Comparator = require_comparator();
2094
- var { ANY } = Comparator;
2095
- var Range = require_range();
2096
- var satisfies3 = require_satisfies();
2097
- var gt = require_gt();
2098
- var lt = require_lt();
2099
- var lte = require_lte();
2100
- var gte = require_gte();
2101
- var outside = (version3, range, hilo, options2) => {
2102
- version3 = new SemVer(version3, options2);
2103
- range = new Range(range, options2);
2104
- let gtfn, ltefn, ltfn, comp, ecomp;
2105
- switch (hilo) {
2106
- case ">":
2107
- gtfn = gt;
2108
- ltefn = lte;
2109
- ltfn = lt;
2110
- comp = ">";
2111
- ecomp = ">=";
2112
- break;
2113
- case "<":
2114
- gtfn = lt;
2115
- ltefn = gte;
2116
- ltfn = gt;
2117
- comp = "<";
2118
- ecomp = "<=";
2119
- break;
2120
- default:
2121
- throw new TypeError('Must provide a hilo val of "<" or ">"');
2122
- }
2123
- if (satisfies3(version3, range, options2)) {
2124
- return false;
2125
- }
2126
- for (let i = 0; i < range.set.length; ++i) {
2127
- const comparators = range.set[i];
2128
- let high = null;
2129
- let low = null;
2130
- comparators.forEach((comparator) => {
2131
- if (comparator.semver === ANY) {
2132
- comparator = new Comparator(">=0.0.0");
2133
- }
2134
- high = high || comparator;
2135
- low = low || comparator;
2136
- if (gtfn(comparator.semver, high.semver, options2)) {
2137
- high = comparator;
2138
- } else if (ltfn(comparator.semver, low.semver, options2)) {
2139
- low = comparator;
2140
- }
2141
- });
2142
- if (high.operator === comp || high.operator === ecomp) {
2143
- return false;
2144
- }
2145
- if ((!low.operator || low.operator === comp) && ltefn(version3, low.semver)) {
2146
- return false;
2147
- } else if (low.operator === ecomp && ltfn(version3, low.semver)) {
2148
- return false;
2149
- }
2150
- }
2151
- return true;
2152
- };
2153
- module.exports = outside;
2154
- }
2155
- });
2156
-
2157
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/gtr.js
2158
- var require_gtr = __commonJS({
2159
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/gtr.js"(exports, module) {
2160
- "use strict";
2161
- var outside = require_outside();
2162
- var gtr = (version3, range, options2) => outside(version3, range, ">", options2);
2163
- module.exports = gtr;
2164
- }
2165
- });
2166
-
2167
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/ltr.js
2168
- var require_ltr = __commonJS({
2169
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/ltr.js"(exports, module) {
2170
- "use strict";
2171
- var outside = require_outside();
2172
- var ltr = (version3, range, options2) => outside(version3, range, "<", options2);
2173
- module.exports = ltr;
2174
- }
2175
- });
2176
-
2177
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/intersects.js
2178
- var require_intersects = __commonJS({
2179
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/intersects.js"(exports, module) {
2180
- "use strict";
2181
- var Range = require_range();
2182
- var intersects = (r1, r2, options2) => {
2183
- r1 = new Range(r1, options2);
2184
- r2 = new Range(r2, options2);
2185
- return r1.intersects(r2, options2);
2186
- };
2187
- module.exports = intersects;
2188
- }
2189
- });
2190
-
2191
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/simplify.js
2192
- var require_simplify = __commonJS({
2193
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/simplify.js"(exports, module) {
2194
- "use strict";
2195
- var satisfies3 = require_satisfies();
2196
- var compare = require_compare();
2197
- module.exports = (versions, range, options2) => {
2198
- const set = [];
2199
- let first = null;
2200
- let prev = null;
2201
- const v = versions.sort((a, b) => compare(a, b, options2));
2202
- for (const version3 of v) {
2203
- const included = satisfies3(version3, range, options2);
2204
- if (included) {
2205
- prev = version3;
2206
- if (!first) {
2207
- first = version3;
2208
- }
2209
- } else {
2210
- if (prev) {
2211
- set.push([first, prev]);
2212
- }
2213
- prev = null;
2214
- first = null;
2215
- }
2216
- }
2217
- if (first) {
2218
- set.push([first, null]);
2219
- }
2220
- const ranges = [];
2221
- for (const [min, max] of set) {
2222
- if (min === max) {
2223
- ranges.push(min);
2224
- } else if (!max && min === v[0]) {
2225
- ranges.push("*");
2226
- } else if (!max) {
2227
- ranges.push(`>=${min}`);
2228
- } else if (min === v[0]) {
2229
- ranges.push(`<=${max}`);
2230
- } else {
2231
- ranges.push(`${min} - ${max}`);
2232
- }
2233
- }
2234
- const simplified = ranges.join(" || ");
2235
- const original = typeof range.raw === "string" ? range.raw : String(range);
2236
- return simplified.length < original.length ? simplified : range;
2237
- };
2238
- }
2239
- });
2240
-
2241
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/subset.js
2242
- var require_subset = __commonJS({
2243
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/subset.js"(exports, module) {
2244
- "use strict";
2245
- var Range = require_range();
2246
- var Comparator = require_comparator();
2247
- var { ANY } = Comparator;
2248
- var satisfies3 = require_satisfies();
2249
- var compare = require_compare();
2250
- var subset = (sub, dom, options2 = {}) => {
2251
- if (sub === dom) {
2252
- return true;
2253
- }
2254
- sub = new Range(sub, options2);
2255
- dom = new Range(dom, options2);
2256
- let sawNonNull = false;
2257
- OUTER:
2258
- for (const simpleSub of sub.set) {
2259
- for (const simpleDom of dom.set) {
2260
- const isSub = simpleSubset(simpleSub, simpleDom, options2);
2261
- sawNonNull = sawNonNull || isSub !== null;
2262
- if (isSub) {
2263
- continue OUTER;
2264
- }
2265
- }
2266
- if (sawNonNull) {
2267
- return false;
2268
- }
2269
- }
2270
- return true;
2271
- };
2272
- var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
2273
- var minimumVersion = [new Comparator(">=0.0.0")];
2274
- var simpleSubset = (sub, dom, options2) => {
2275
- if (sub === dom) {
2276
- return true;
2277
- }
2278
- if (sub.length === 1 && sub[0].semver === ANY) {
2279
- if (dom.length === 1 && dom[0].semver === ANY) {
2280
- return true;
2281
- } else if (options2.includePrerelease) {
2282
- sub = minimumVersionWithPreRelease;
2283
- } else {
2284
- sub = minimumVersion;
2285
- }
2286
- }
2287
- if (dom.length === 1 && dom[0].semver === ANY) {
2288
- if (options2.includePrerelease) {
2289
- return true;
2290
- } else {
2291
- dom = minimumVersion;
2292
- }
2293
- }
2294
- const eqSet = /* @__PURE__ */ new Set();
2295
- let gt, lt;
2296
- for (const c2 of sub) {
2297
- if (c2.operator === ">" || c2.operator === ">=") {
2298
- gt = higherGT(gt, c2, options2);
2299
- } else if (c2.operator === "<" || c2.operator === "<=") {
2300
- lt = lowerLT(lt, c2, options2);
2301
- } else {
2302
- eqSet.add(c2.semver);
2303
- }
2304
- }
2305
- if (eqSet.size > 1) {
2306
- return null;
2307
- }
2308
- let gtltComp;
2309
- if (gt && lt) {
2310
- gtltComp = compare(gt.semver, lt.semver, options2);
2311
- if (gtltComp > 0) {
2312
- return null;
2313
- } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
2314
- return null;
2315
- }
2316
- }
2317
- for (const eq of eqSet) {
2318
- if (gt && !satisfies3(eq, String(gt), options2)) {
2319
- return null;
2320
- }
2321
- if (lt && !satisfies3(eq, String(lt), options2)) {
2322
- return null;
2323
- }
2324
- for (const c2 of dom) {
2325
- if (!satisfies3(eq, String(c2), options2)) {
2326
- return false;
2327
- }
2328
- }
2329
- return true;
2330
- }
2331
- let higher, lower;
2332
- let hasDomLT, hasDomGT;
2333
- let needDomLTPre = lt && !options2.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
2334
- let needDomGTPre = gt && !options2.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
2335
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
2336
- needDomLTPre = false;
2337
- }
2338
- for (const c2 of dom) {
2339
- hasDomGT = hasDomGT || c2.operator === ">" || c2.operator === ">=";
2340
- hasDomLT = hasDomLT || c2.operator === "<" || c2.operator === "<=";
2341
- if (gt) {
2342
- if (needDomGTPre) {
2343
- if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomGTPre.major && c2.semver.minor === needDomGTPre.minor && c2.semver.patch === needDomGTPre.patch) {
2344
- needDomGTPre = false;
2345
- }
2346
- }
2347
- if (c2.operator === ">" || c2.operator === ">=") {
2348
- higher = higherGT(gt, c2, options2);
2349
- if (higher === c2 && higher !== gt) {
2350
- return false;
2351
- }
2352
- } else if (gt.operator === ">=" && !satisfies3(gt.semver, String(c2), options2)) {
2353
- return false;
2354
- }
2355
- }
2356
- if (lt) {
2357
- if (needDomLTPre) {
2358
- if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
2359
- needDomLTPre = false;
2360
- }
2361
- }
2362
- if (c2.operator === "<" || c2.operator === "<=") {
2363
- lower = lowerLT(lt, c2, options2);
2364
- if (lower === c2 && lower !== lt) {
2365
- return false;
2366
- }
2367
- } else if (lt.operator === "<=" && !satisfies3(lt.semver, String(c2), options2)) {
2368
- return false;
2369
- }
2370
- }
2371
- if (!c2.operator && (lt || gt) && gtltComp !== 0) {
2372
- return false;
2373
- }
2374
- }
2375
- if (gt && hasDomLT && !lt && gtltComp !== 0) {
2376
- return false;
2377
- }
2378
- if (lt && hasDomGT && !gt && gtltComp !== 0) {
2379
- return false;
2380
- }
2381
- if (needDomGTPre || needDomLTPre) {
2382
- return false;
2383
- }
2384
- return true;
2385
- };
2386
- var higherGT = (a, b, options2) => {
2387
- if (!a) {
2388
- return b;
2389
- }
2390
- const comp = compare(a.semver, b.semver, options2);
2391
- return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
2392
- };
2393
- var lowerLT = (a, b, options2) => {
2394
- if (!a) {
2395
- return b;
2396
- }
2397
- const comp = compare(a.semver, b.semver, options2);
2398
- return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
2399
- };
2400
- module.exports = subset;
2401
- }
2402
- });
2403
-
2404
- // ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/index.js
2405
- var require_semver2 = __commonJS({
2406
- "../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/index.js"(exports, module) {
2407
- "use strict";
2408
- var internalRe = require_re();
2409
- var constants2 = require_constants();
2410
- var SemVer = require_semver();
2411
- var identifiers = require_identifiers();
2412
- var parse2 = require_parse();
2413
- var valid = require_valid();
2414
- var clean = require_clean();
2415
- var inc = require_inc();
2416
- var diff = require_diff();
2417
- var major = require_major();
2418
- var minor = require_minor();
2419
- var patch = require_patch();
2420
- var prerelease = require_prerelease();
2421
- var compare = require_compare();
2422
- var rcompare = require_rcompare();
2423
- var compareLoose = require_compare_loose();
2424
- var compareBuild = require_compare_build();
2425
- var sort = require_sort();
2426
- var rsort = require_rsort();
2427
- var gt = require_gt();
2428
- var lt = require_lt();
2429
- var eq = require_eq();
2430
- var neq = require_neq();
2431
- var gte = require_gte();
2432
- var lte = require_lte();
2433
- var cmp = require_cmp();
2434
- var coerce = require_coerce();
2435
- var Comparator = require_comparator();
2436
- var Range = require_range();
2437
- var satisfies3 = require_satisfies();
2438
- var toComparators = require_to_comparators();
2439
- var maxSatisfying = require_max_satisfying();
2440
- var minSatisfying = require_min_satisfying();
2441
- var minVersion = require_min_version();
2442
- var validRange = require_valid2();
2443
- var outside = require_outside();
2444
- var gtr = require_gtr();
2445
- var ltr = require_ltr();
2446
- var intersects = require_intersects();
2447
- var simplifyRange = require_simplify();
2448
- var subset = require_subset();
2449
- module.exports = {
2450
- parse: parse2,
2451
- valid,
2452
- clean,
2453
- inc,
2454
- diff,
2455
- major,
2456
- minor,
2457
- patch,
2458
- prerelease,
2459
- compare,
2460
- rcompare,
2461
- compareLoose,
2462
- compareBuild,
2463
- sort,
2464
- rsort,
2465
- gt,
2466
- lt,
2467
- eq,
2468
- neq,
2469
- gte,
2470
- lte,
2471
- cmp,
2472
- coerce,
2473
- Comparator,
2474
- Range,
2475
- satisfies: satisfies3,
2476
- toComparators,
2477
- maxSatisfying,
2478
- minSatisfying,
2479
- minVersion,
2480
- validRange,
2481
- outside,
2482
- gtr,
2483
- ltr,
2484
- intersects,
2485
- simplifyRange,
2486
- subset,
2487
- SemVer,
2488
- re: internalRe.re,
2489
- src: internalRe.src,
2490
- tokens: internalRe.t,
2491
- SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
2492
- RELEASE_TYPES: constants2.RELEASE_TYPES,
2493
- compareIdentifiers: identifiers.compareIdentifiers,
2494
- rcompareIdentifiers: identifiers.rcompareIdentifiers
2495
- };
2496
- }
2497
- });
2498
-
2499
- // node/server.ts
2500
- import { join } from "node:path";
1
+ // node/resolver.ts
2
+ import { dirname as dirname2, join as join2, resolve as resolve2 } from "node:path";
3
+ import * as fs2 from "node:fs";
2501
4
  import process2 from "node:process";
2502
- import { createServer as createViteServer, mergeConfig } from "vite";
2503
- async function createServer(options2, viteConfig = {}, serverOptions = {}) {
2504
- process2.env.EDITOR = process2.env.EDITOR || "code";
2505
- const config2 = await mergeViteConfigs(
2506
- options2,
2507
- viteConfig,
2508
- {
2509
- root: options2.userRoot,
2510
- optimizeDeps: {
2511
- entries: [
2512
- join(options2.clientRoot, "main.ts")
2513
- ]
2514
- }
2515
- },
2516
- "serve"
2517
- );
2518
- const server = await createViteServer(
2519
- mergeConfig(
2520
- config2,
2521
- {
2522
- plugins: [
2523
- await ViteSlidevPlugin(options2, config2.slidev || {}, serverOptions)
2524
- ],
2525
- define: {
2526
- // Fixes Vue production mode breaking PDF Export #1245
2527
- __VUE_PROD_DEVTOOLS__: JSON.stringify(true)
2528
- }
2529
- }
2530
- )
2531
- );
2532
- return server;
2533
- }
2534
-
2535
- // node/parser.ts
2536
- import * as parser from "@slidev/parser/fs";
2537
-
2538
- // package.json
2539
- var version = "0.48.0-beta.3";
2540
-
2541
- // node/themes.ts
5
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
6
+ import { ensurePrefix, slash } from "@antfu/utils";
7
+ import isInstalledGlobally from "is-installed-globally";
8
+ import { resolveGlobal } from "resolve-global";
9
+ import { findClosestPkgJsonPath, findDepPkgJsonPath } from "vitefu";
10
+ import { resolvePath } from "mlly";
11
+ import globalDirs from "global-directory";
2542
12
  import prompts2 from "prompts";
2543
13
 
2544
14
  // ../../node_modules/.pnpm/@antfu+ni@0.21.12/node_modules/@antfu/ni/dist/shared/ni.f699cf8a.mjs
@@ -2876,7 +346,7 @@ function requireWindows() {
2876
346
  hasRequiredWindows = 1;
2877
347
  windows = isexe2;
2878
348
  isexe2.sync = sync2;
2879
- var fs4 = require$$0;
349
+ var fs3 = require$$0;
2880
350
  function checkPathExt2(path2, options2) {
2881
351
  var pathext = options2.pathExt !== void 0 ? options2.pathExt : process.env.PATHEXT;
2882
352
  if (!pathext) {
@@ -2901,12 +371,12 @@ function requireWindows() {
2901
371
  return checkPathExt2(path2, options2);
2902
372
  }
2903
373
  function isexe2(path2, options2, cb) {
2904
- fs4.stat(path2, function(er, stat) {
374
+ fs3.stat(path2, function(er, stat) {
2905
375
  cb(er, er ? false : checkStat2(stat, path2, options2));
2906
376
  });
2907
377
  }
2908
378
  function sync2(path2, options2) {
2909
- return checkStat2(fs4.statSync(path2), path2, options2);
379
+ return checkStat2(fs3.statSync(path2), path2, options2);
2910
380
  }
2911
381
  return windows;
2912
382
  }
@@ -2918,14 +388,14 @@ function requireMode() {
2918
388
  hasRequiredMode = 1;
2919
389
  mode = isexe2;
2920
390
  isexe2.sync = sync2;
2921
- var fs4 = require$$0;
391
+ var fs3 = require$$0;
2922
392
  function isexe2(path2, options2, cb) {
2923
- fs4.stat(path2, function(er, stat) {
393
+ fs3.stat(path2, function(er, stat) {
2924
394
  cb(er, er ? false : checkStat2(stat, options2));
2925
395
  });
2926
396
  }
2927
397
  function sync2(path2, options2) {
2928
- return checkStat2(fs4.statSync(path2), options2);
398
+ return checkStat2(fs3.statSync(path2), options2);
2929
399
  }
2930
400
  function checkStat2(stat, options2) {
2931
401
  return stat.isFile() && checkMode2(stat, options2);
@@ -3881,7 +1351,7 @@ if (process.platform !== "win32") {
3881
1351
  if (process.platform === "linux") {
3882
1352
  signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
3883
1353
  }
3884
- var processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
1354
+ var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
3885
1355
  var kExitEmitter = Symbol.for("signal-exit emitter");
3886
1356
  var global$1 = globalThis;
3887
1357
  var ObjectDefineProperty = Object.defineProperty.bind(Object);
@@ -3974,15 +1444,15 @@ var SignalExit = class extends SignalExitBase {
3974
1444
  #originalProcessReallyExit;
3975
1445
  #sigListeners = {};
3976
1446
  #loaded = false;
3977
- constructor(process4) {
1447
+ constructor(process3) {
3978
1448
  super();
3979
- this.#process = process4;
1449
+ this.#process = process3;
3980
1450
  this.#sigListeners = {};
3981
1451
  for (const sig of signals) {
3982
1452
  this.#sigListeners[sig] = () => {
3983
1453
  const listeners = this.#process.listeners(sig);
3984
1454
  let { count } = this.#emitter;
3985
- const p = process4;
1455
+ const p = process3;
3986
1456
  if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
3987
1457
  count += p.__signal_exit_emitter__.count;
3988
1458
  }
@@ -3991,12 +1461,12 @@ var SignalExit = class extends SignalExitBase {
3991
1461
  const ret = this.#emitter.emit("exit", null, sig);
3992
1462
  const s = sig === "SIGHUP" ? this.#hupSig : sig;
3993
1463
  if (!ret)
3994
- process4.kill(process4.pid, s);
1464
+ process3.kill(process3.pid, s);
3995
1465
  }
3996
1466
  };
3997
1467
  }
3998
- this.#originalProcessReallyExit = process4.reallyExit;
3999
- this.#originalProcessEmit = process4.emit;
1468
+ this.#originalProcessReallyExit = process3.reallyExit;
1469
+ this.#originalProcessEmit = process3.emit;
4000
1470
  }
4001
1471
  onExit(cb, opts) {
4002
1472
  if (!processOk(this.#process)) {
@@ -5079,10 +2549,10 @@ function supportsColor$1(haveStream, streamIsTTY) {
5079
2549
  return 3;
5080
2550
  }
5081
2551
  if ("TERM_PROGRAM" in env) {
5082
- const version3 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
2552
+ const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
5083
2553
  switch (env.TERM_PROGRAM) {
5084
2554
  case "iTerm.app":
5085
- return version3 >= 3 ? 3 : 2;
2555
+ return version2 >= 3 ? 3 : 2;
5086
2556
  case "Apple_Terminal":
5087
2557
  return 2;
5088
2558
  }
@@ -5155,21 +2625,21 @@ function supportsHyperlink(stream) {
5155
2625
  return false;
5156
2626
  }
5157
2627
  if ("TERM_PROGRAM" in env2) {
5158
- const version3 = parseVersion(env2.TERM_PROGRAM_VERSION);
2628
+ const version2 = parseVersion(env2.TERM_PROGRAM_VERSION);
5159
2629
  switch (env2.TERM_PROGRAM) {
5160
2630
  case "iTerm.app":
5161
- if (version3.major === 3) {
5162
- return version3.minor >= 1;
2631
+ if (version2.major === 3) {
2632
+ return version2.minor >= 1;
5163
2633
  }
5164
- return version3.major > 3;
2634
+ return version2.major > 3;
5165
2635
  }
5166
2636
  }
5167
2637
  if ("VTE_VERSION" in env2) {
5168
2638
  if (env2.VTE_VERSION === "0.50.0") {
5169
2639
  return false;
5170
2640
  }
5171
- const version3 = parseVersion(env2.VTE_VERSION);
5172
- return version3.major > 0 || version3.minor >= 50;
2641
+ const version2 = parseVersion(env2.VTE_VERSION);
2642
+ return version2.major > 0 || version2.minor >= 50;
5173
2643
  }
5174
2644
  return false;
5175
2645
  }
@@ -7513,7 +4983,7 @@ Object.defineProperty(options, "__esModule", { value: true });
7513
4983
  exports.sync = impl.sync;
7514
4984
  })(cjs);
7515
4985
  var { isexe, sync: isexeSync } = cjs;
7516
- var { join: join2, delimiter, sep, posix } = require$$0$1;
4986
+ var { join, delimiter, sep, posix } = require$$0$1;
7517
4987
  var isWindows = process.platform === "win32";
7518
4988
  var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
7519
4989
  var rRel = new RegExp(`^\\.${rSlash.source}`);
@@ -7542,7 +5012,7 @@ var getPathInfo = (cmd, {
7542
5012
  var getPathPart = (raw, cmd) => {
7543
5013
  const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
7544
5014
  const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
7545
- return prefix + join2(pathPart, cmd);
5015
+ return prefix + join(pathPart, cmd);
7546
5016
  };
7547
5017
  var which = async (cmd, opt = {}) => {
7548
5018
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
@@ -7615,7 +5085,7 @@ function getVoltaPrefix() {
7615
5085
  }
7616
5086
  async function detect({ autoInstall, programmatic, cwd } = {}) {
7617
5087
  let agent = null;
7618
- let version3 = null;
5088
+ let version2 = null;
7619
5089
  const lockPath = await findUp(Object.keys(LOCKS), { cwd });
7620
5090
  let packageJsonPath;
7621
5091
  if (lockPath)
@@ -7627,10 +5097,10 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
7627
5097
  const pkg = JSON.parse(fs$1.readFileSync(packageJsonPath, "utf8"));
7628
5098
  if (typeof pkg.packageManager === "string") {
7629
5099
  const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
7630
- version3 = ver;
5100
+ version2 = ver;
7631
5101
  if (name === "yarn" && Number.parseInt(ver) > 1) {
7632
5102
  agent = "yarn@berry";
7633
- version3 = "berry";
5103
+ version2 = "berry";
7634
5104
  } else if (name === "pnpm" && Number.parseInt(ver) < 7) {
7635
5105
  agent = "pnpm@6";
7636
5106
  } else if (name in AGENTS) {
@@ -7659,7 +5129,7 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
7659
5129
  if (!tryInstall)
7660
5130
  process$2.exit(1);
7661
5131
  }
7662
- await execaCommand(`npm i -g ${agent.split("@")[0]}${version3 ? `@${version3}` : ""}`, { stdio: "inherit", cwd });
5132
+ await execaCommand(`npm i -g ${agent.split("@")[0]}${version2 ? `@${version2}` : ""}`, { stdio: "inherit", cwd });
7663
5133
  }
7664
5134
  return agent;
7665
5135
  }
@@ -7823,7 +5293,7 @@ function init(open, close) {
7823
5293
  return txt === void 0 ? chain([open], [blk]) : $.enabled ? run$1([blk], txt + "") : txt + "";
7824
5294
  };
7825
5295
  }
7826
- var version2 = "0.21.12";
5296
+ var version = "0.21.12";
7827
5297
  var DEBUG_SIGN = "?";
7828
5298
  async function getCliCommand(fn, args, options2 = {}, cwd = options2.cwd ?? process$2.cwd()) {
7829
5299
  const isGlobal = args.includes("-g");
@@ -7847,8 +5317,8 @@ async function getCliCommand(fn, args, options2 = {}, cwd = options2.cwd ?? proc
7847
5317
  });
7848
5318
  }
7849
5319
  async function run(fn, args, options2 = {}) {
7850
- const debug2 = args.includes(DEBUG_SIGN);
7851
- if (debug2)
5320
+ const debug = args.includes(DEBUG_SIGN);
5321
+ if (debug)
7852
5322
  remove(args, DEBUG_SIGN);
7853
5323
  let cwd = options2.cwd ?? process$2.cwd();
7854
5324
  if (args[0] === "-C") {
@@ -7863,7 +5333,7 @@ async function run(fn, args, options2 = {}) {
7863
5333
  const agentPromise = detect({ ...options2, cwd }).then((a) => a || "");
7864
5334
  const agentVersionPromise = agentPromise.then((a) => a && getV(a, { cwd }));
7865
5335
  const nodeVersionPromise = getV("node", { cwd });
7866
- console.log(`@antfu/ni ${$.cyan(`v${version2}`)}`);
5336
+ console.log(`@antfu/ni ${$.cyan(`v${version}`)}`);
7867
5337
  console.log(`node ${$.green(await nodeVersionPromise)}`);
7868
5338
  const [agent, agentVersion] = await Promise.all([agentPromise, agentVersionPromise]);
7869
5339
  if (agent)
@@ -7875,12 +5345,12 @@ async function run(fn, args, options2 = {}) {
7875
5345
  return;
7876
5346
  }
7877
5347
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v")) {
7878
- console.log(`@antfu/ni v${version2}`);
5348
+ console.log(`@antfu/ni v${version}`);
7879
5349
  return;
7880
5350
  }
7881
5351
  if (args.length === 1 && ["-h", "--help"].includes(args[0])) {
7882
5352
  const dash = $.dim("-");
7883
- console.log($.green($.bold("@antfu/ni")) + $.dim(` use the right package manager v${version2}
5353
+ console.log($.green($.bold("@antfu/ni")) + $.dim(` use the right package manager v${version}
7884
5354
  `));
7885
5355
  console.log(`ni ${dash} install`);
7886
5356
  console.log(`nr ${dash} run`);
@@ -7899,237 +5369,184 @@ async function run(fn, args, options2 = {}) {
7899
5369
  const voltaPrefix = getVoltaPrefix();
7900
5370
  if (voltaPrefix)
7901
5371
  command = voltaPrefix.concat(" ").concat(command);
7902
- if (debug2) {
5372
+ if (debug) {
7903
5373
  console.log(command);
7904
5374
  return;
7905
5375
  }
7906
5376
  await execaCommand(command, { stdio: "inherit", cwd });
7907
5377
  }
7908
5378
 
7909
- // node/themes.ts
7910
- var import_semver2 = __toESM(require_semver2());
7911
- import isInstalledGlobally from "is-installed-globally";
7912
- import { underline } from "kolorist";
7913
- import fs3 from "fs-extra";
7914
-
7915
- // node/options.ts
7916
- import { dirname as dirname2, join as join3, resolve as resolve2 } from "node:path";
7917
- import process3 from "node:process";
7918
- import { fileURLToPath as fileURLToPath2 } from "node:url";
7919
- import { uniq } from "@antfu/utils";
7920
- import _debug from "debug";
7921
-
7922
- // node/addons.ts
7923
- var import_semver = __toESM(require_semver2());
7924
- import fs2 from "fs-extra";
7925
- async function getPackageJson(root) {
5379
+ // node/resolver.ts
5380
+ import { underline, yellow } from "kolorist";
5381
+ function toAtFS(path2) {
5382
+ return `/@fs${ensurePrefix("/", slash(path2))}`;
5383
+ }
5384
+ async function resolveImportPath(importName, ensure = false) {
7926
5385
  try {
7927
- const file = await resolveImportPath(`${root}/package.json`, true);
7928
- if (file && fs2.existsSync(file))
7929
- return await fs2.readJSON(file);
7930
- return {};
7931
- } catch (e) {
7932
- return {};
5386
+ return await resolvePath(importName, {
5387
+ url: fileURLToPath2(import.meta.url)
5388
+ });
5389
+ } catch {
7933
5390
  }
5391
+ if (isInstalledGlobally) {
5392
+ try {
5393
+ return resolveGlobal(importName);
5394
+ } catch {
5395
+ }
5396
+ }
5397
+ if (ensure)
5398
+ throw new Error(`Failed to resolve package "${importName}"`);
7934
5399
  }
7935
- async function getAddons(userRoot, config2) {
7936
- const { slidev = {} } = await getPackageJson(userRoot);
7937
- const configAddons = Array.isArray(config2.addons) ? config2.addons : [];
7938
- const addons = configAddons.concat(Array.isArray(slidev?.addons) ? slidev.addons : []);
7939
- return (await getRecursivePlugins(await Promise.all(addons.map(resolvePluginName)), 3)).filter(Boolean);
7940
- }
7941
- async function getRecursivePlugins(addons, depth) {
7942
- const addonsArray = await Promise.all(addons.map(async (addon) => {
7943
- const { slidev = {}, engines = {} } = await getPackageJson(addon);
7944
- checkEngine(addon, engines);
7945
- let addons2 = Array.isArray(slidev?.addons) ? slidev.addons : [];
7946
- if (addons2.length > 0 && depth)
7947
- addons2 = await getRecursivePlugins(addons2.map(resolvePluginName), depth - 1);
7948
- addons2.push(addon);
7949
- return addons2;
7950
- }));
7951
- return addonsArray.flat();
7952
- }
7953
- async function checkEngine(name, engines) {
7954
- if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev, { includePrerelease: true }))
7955
- throw new Error(`[slidev] addon "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
5400
+ async function findPkgRoot(dep, parent, ensure = false) {
5401
+ const pkgJsonPath = await findDepPkgJsonPath(dep, parent);
5402
+ const path2 = pkgJsonPath ? dirname2(pkgJsonPath) : isInstalledGlobally ? findGlobalPkgRoot(dep, false) : void 0;
5403
+ if (ensure && !path2)
5404
+ throw new Error(`Failed to resolve package "${dep}"`);
5405
+ return path2;
7956
5406
  }
7957
- async function resolvePluginName(name) {
7958
- if (!name)
7959
- return "";
7960
- if (isPath(name))
7961
- return name;
7962
- if (await packageExists(`slidev-addon-${name}`))
7963
- return `slidev-addon-${name}`;
7964
- return name;
5407
+ async function findGlobalPkgRoot(name, ensure = false) {
5408
+ const yarnPath = join2(globalDirs.yarn.packages, name);
5409
+ if (fs2.existsSync(`${yarnPath}/package.json`))
5410
+ return yarnPath;
5411
+ const npmPath = join2(globalDirs.npm.packages, name);
5412
+ if (fs2.existsSync(`${npmPath}/package.json`))
5413
+ return npmPath;
5414
+ if (ensure)
5415
+ throw new Error(`Failed to resolve global package "${name}"`);
7965
5416
  }
7966
-
7967
- // node/options.ts
7968
- var debug = _debug("slidev:options");
7969
- async function getClientRoot() {
7970
- return dirname2(await resolveImportPath("@slidev/client/package.json", true));
5417
+ async function resolveEntry(entryRaw, roots) {
5418
+ if (!fs2.existsSync(entryRaw) && !entryRaw.endsWith(".md") && !/\/\\/.test(entryRaw))
5419
+ entryRaw += ".md";
5420
+ const entry = entryRaw.startsWith("@/") ? join2(roots.userRoot, entryRaw.slice(2)) : resolve2(process2.cwd(), entryRaw);
5421
+ if (!fs2.existsSync(entry)) {
5422
+ const { create } = await prompts2({
5423
+ name: "create",
5424
+ type: "confirm",
5425
+ initial: "Y",
5426
+ message: `Entry file ${yellow(`"${entry}"`)} does not exist, do you want to create it?`
5427
+ });
5428
+ if (create)
5429
+ fs2.copyFileSync(resolve2(roots.cliRoot, "template.md"), entry);
5430
+ else
5431
+ process2.exit(0);
5432
+ }
5433
+ return entry;
7971
5434
  }
7972
- function getCLIRoot() {
7973
- return fileURLToPath2(new URL("..", import.meta.url));
5435
+ function createResolver(type, officials) {
5436
+ async function promptForInstallation(pkgName) {
5437
+ const { confirm: confirm2 } = await prompts2({
5438
+ name: "confirm",
5439
+ initial: "Y",
5440
+ type: "confirm",
5441
+ message: `The ${type} "${pkgName}" was not found ${underline(isInstalledGlobally ? "globally" : "in your project")}, do you want to install it now?`
5442
+ });
5443
+ if (!confirm2)
5444
+ process2.exit(1);
5445
+ if (isInstalledGlobally)
5446
+ await run(parseNi, ["-g", pkgName]);
5447
+ else
5448
+ await run(parseNi, [pkgName]);
5449
+ }
5450
+ return async function(name, importer) {
5451
+ const { userRoot } = await getRoots();
5452
+ if (name === "none")
5453
+ return ["", null];
5454
+ if (name[0] === "/")
5455
+ return [name, name];
5456
+ if (name.startsWith("@/"))
5457
+ return [name, join2(userRoot, name.slice(2))];
5458
+ if (name[0] === "." || name[0] !== "@" && name.includes("/"))
5459
+ return [name, join2(dirname2(importer), name)];
5460
+ if (name.startsWith(`@slidev/${type}-`) || name.startsWith(`slidev-${type}-`)) {
5461
+ const pkgRoot = await findPkgRoot(name, importer);
5462
+ if (!pkgRoot)
5463
+ await promptForInstallation(name);
5464
+ return [name, await findPkgRoot(name, importer, true)];
5465
+ }
5466
+ {
5467
+ const possiblePkgNames = [
5468
+ `@slidev/${type}-${name}`,
5469
+ `slidev-${type}-${name}`,
5470
+ name
5471
+ ];
5472
+ for (const pkgName2 of possiblePkgNames) {
5473
+ const pkgRoot = await findPkgRoot(pkgName2, importer);
5474
+ if (pkgRoot)
5475
+ return [pkgName2, pkgRoot];
5476
+ }
5477
+ }
5478
+ const pkgName = officials[name] ?? (name[0] === "@" ? name : `slidev-${type}-${name}`);
5479
+ await promptForInstallation(pkgName);
5480
+ return [pkgName, await findPkgRoot(pkgName, importer, true)];
5481
+ };
7974
5482
  }
7975
- function isPath(name) {
7976
- return name.startsWith("/") || /^\.\.?[\/\\]/.test(name);
5483
+ async function getUserRoot() {
5484
+ const pkgJsonPath = await findClosestPkgJsonPath(process2.cwd());
5485
+ return pkgJsonPath ? dirname2(pkgJsonPath) : process2.cwd();
7977
5486
  }
7978
- async function getThemeRoots(name, entry) {
7979
- if (!name)
7980
- return [];
7981
- return [await getRoot(name, entry)];
5487
+ function getUserPkgJson(userRoot) {
5488
+ const path2 = resolve2(userRoot, "package.json");
5489
+ if (fs2.existsSync(path2))
5490
+ return JSON.parse(fs2.readFileSync(path2, "utf-8"));
5491
+ return {};
7982
5492
  }
7983
- async function getAddonRoots(addons, entry) {
7984
- if (addons.length === 0)
7985
- return [];
7986
- return await Promise.all(addons.map((name) => getRoot(name, entry)));
5493
+ function hasWorkspacePackageJSON(root) {
5494
+ const path2 = join2(root, "package.json");
5495
+ try {
5496
+ fs2.accessSync(path2, fs2.constants.R_OK);
5497
+ } catch {
5498
+ return false;
5499
+ }
5500
+ const content = JSON.parse(fs2.readFileSync(path2, "utf-8")) || {};
5501
+ return !!content.workspaces;
7987
5502
  }
7988
- async function getRoot(name, entry) {
7989
- if (isPath(name))
7990
- return resolve2(dirname2(entry), name);
7991
- return dirname2(await resolveImportPath(`${name}/package.json`, true));
5503
+ function hasRootFile(root) {
5504
+ const ROOT_FILES = [
5505
+ // '.git',
5506
+ // https://pnpm.js.org/workspaces/
5507
+ "pnpm-workspace.yaml"
5508
+ // https://rushjs.io/pages/advanced/config_files/
5509
+ // 'rush.json',
5510
+ // https://nx.dev/latest/react/getting-started/nx-setup
5511
+ // 'workspace.json',
5512
+ // 'nx.json'
5513
+ ];
5514
+ return ROOT_FILES.some((file) => fs2.existsSync(join2(root, file)));
7992
5515
  }
7993
- function getUserRoot(options2) {
7994
- const {
7995
- entry: rawEntry = "slides.md",
7996
- userRoot = process3.cwd()
7997
- } = options2;
7998
- const fullEntry = resolve2(userRoot, rawEntry);
7999
- return {
8000
- entry: fullEntry,
8001
- userRoot: dirname2(fullEntry)
8002
- };
5516
+ function searchForWorkspaceRoot(current, root = current) {
5517
+ if (hasRootFile(current))
5518
+ return current;
5519
+ if (hasWorkspacePackageJSON(current))
5520
+ return current;
5521
+ const dir = dirname2(current);
5522
+ if (!dir || dir === current)
5523
+ return root;
5524
+ return searchForWorkspaceRoot(dir, root);
8003
5525
  }
8004
- async function resolveOptions(options2, mode2, promptForInstallation = true) {
8005
- const { remote, inspect } = options2;
8006
- const {
8007
- entry,
8008
- userRoot
8009
- } = getUserRoot(options2);
8010
- const data = await parser.load(userRoot, entry);
8011
- const theme = await resolveThemeName(options2.theme || data.config.theme);
8012
- if (promptForInstallation) {
8013
- if (await promptForThemeInstallation(theme) === false)
8014
- process3.exit(1);
8015
- } else {
8016
- if (!await packageExists(theme)) {
8017
- console.error(`Theme "${theme}" not found, have you installed it?`);
8018
- process3.exit(1);
8019
- }
8020
- }
8021
- const clientRoot = await getClientRoot();
8022
- const cliRoot = getCLIRoot();
8023
- const themeRoots = await getThemeRoots(theme, entry);
8024
- const addons = await getAddons(userRoot, data.config);
8025
- const addonRoots = await getAddonRoots(addons, entry);
8026
- const roots = uniq([clientRoot, ...themeRoots, ...addonRoots, userRoot]);
8027
- if (themeRoots.length) {
8028
- const themeMeta = await getThemeMeta(theme, join3(themeRoots[0], "package.json"));
8029
- data.themeMeta = themeMeta;
8030
- if (themeMeta)
8031
- data.config = parser.resolveConfig(data.headmatter, themeMeta, options2.entry);
8032
- }
8033
- debug({
8034
- config: data.config,
8035
- mode: mode2,
8036
- entry,
8037
- theme,
8038
- userRoot,
8039
- clientRoot,
5526
+ var rootsInfo = null;
5527
+ async function getRoots() {
5528
+ if (rootsInfo)
5529
+ return rootsInfo;
5530
+ const cliRoot = fileURLToPath2(new URL("..", import.meta.url));
5531
+ const clientRoot = await findPkgRoot("@slidev/client", cliRoot, true);
5532
+ const userRoot = await getUserRoot();
5533
+ const userPkgJson = getUserPkgJson(userRoot);
5534
+ const userWorkspaceRoot = searchForWorkspaceRoot(userRoot);
5535
+ rootsInfo = {
8040
5536
  cliRoot,
8041
- themeRoots,
8042
- addonRoots,
8043
- roots,
8044
- remote
8045
- });
8046
- return {
8047
- data,
8048
- mode: mode2,
8049
- entry,
8050
- theme,
8051
- userRoot,
8052
5537
  clientRoot,
8053
- cliRoot,
8054
- themeRoots,
8055
- addonRoots,
8056
- roots,
8057
- remote,
8058
- inspect
5538
+ userRoot,
5539
+ userPkgJson,
5540
+ userWorkspaceRoot
8059
5541
  };
8060
- }
8061
-
8062
- // node/themes.ts
8063
- var officialThemes = {
8064
- "none": "",
8065
- "default": "@slidev/theme-default",
8066
- "seriph": "@slidev/theme-seriph",
8067
- "apple-basic": "@slidev/theme-apple-basic",
8068
- "shibainu": "@slidev/theme-shibainu",
8069
- "bricks": "@slidev/theme-bricks"
8070
- };
8071
- async function getThemeMeta(name, path2) {
8072
- if (!fs3.existsSync(path2))
8073
- return {};
8074
- if (path2) {
8075
- const { slidev = {}, engines = {} } = await fs3.readJSON(path2);
8076
- if (engines.slidev && !(0, import_semver2.satisfies)(version, engines.slidev, { includePrerelease: true }))
8077
- throw new Error(`[slidev] theme "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
8078
- return slidev;
8079
- }
8080
- return void 0;
8081
- }
8082
- async function resolveThemeName(name) {
8083
- if (!name || name === "none")
8084
- return "";
8085
- if (name.startsWith("@slidev/theme-") || name.startsWith("slidev-theme-"))
8086
- return name;
8087
- if (isPath(name))
8088
- return name;
8089
- if (await packageExists(`@slidev/theme-${name}`))
8090
- return `@slidev/theme-${name}`;
8091
- if (await packageExists(`slidev-theme-${name}`))
8092
- return `slidev-theme-${name}`;
8093
- if (await packageExists(name))
8094
- return name;
8095
- if (officialThemes[name] != null)
8096
- return officialThemes[name];
8097
- if (name.indexOf("@") === 0 && name.includes("/"))
8098
- return name;
8099
- return `slidev-theme-${name}`;
8100
- }
8101
- async function promptForThemeInstallation(name) {
8102
- name = await resolveThemeName(name);
8103
- if (!name)
8104
- return name;
8105
- if (isPath(name) || await packageExists(name))
8106
- return name;
8107
- const { confirm: confirm2 } = await prompts2({
8108
- name: "confirm",
8109
- initial: "Y",
8110
- type: "confirm",
8111
- message: `The theme "${name}" was not found ${underline(isInstalledGlobally ? "globally" : "in your project")}, do you want to install it now?`
8112
- });
8113
- if (!confirm2)
8114
- return false;
8115
- if (isInstalledGlobally)
8116
- await run(parseNi, ["-g", name]);
8117
- else
8118
- await run(parseNi, [name]);
8119
- return name;
5542
+ return rootsInfo;
8120
5543
  }
8121
5544
 
8122
5545
  export {
8123
- createServer,
8124
- parser,
8125
- version,
8126
- resolveThemeName,
8127
- getClientRoot,
8128
- getCLIRoot,
8129
- isPath,
8130
- getThemeRoots,
8131
- getAddonRoots,
8132
- getRoot,
8133
- getUserRoot,
8134
- resolveOptions
5546
+ toAtFS,
5547
+ resolveImportPath,
5548
+ findPkgRoot,
5549
+ resolveEntry,
5550
+ createResolver,
5551
+ getRoots
8135
5552
  };