@vercel/remix-builder 2.0.3 → 2.0.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.
package/dist/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
6
11
  var __export = (target, all) => {
7
12
  for (var name in all)
8
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -15,20 +20,3718 @@ var __copyProps = (to, from, except, desc) => {
15
20
  }
16
21
  return to;
17
22
  };
18
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
19
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/constants.js
34
+ var require_constants = __commonJS({
35
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/constants.js"(exports, module2) {
36
+ var SEMVER_SPEC_VERSION = "2.0.0";
37
+ var MAX_LENGTH = 256;
38
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
39
+ 9007199254740991;
40
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
41
+ var RELEASE_TYPES = [
42
+ "major",
43
+ "premajor",
44
+ "minor",
45
+ "preminor",
46
+ "patch",
47
+ "prepatch",
48
+ "prerelease"
49
+ ];
50
+ module2.exports = {
51
+ MAX_LENGTH,
52
+ MAX_SAFE_COMPONENT_LENGTH,
53
+ MAX_SAFE_INTEGER,
54
+ RELEASE_TYPES,
55
+ SEMVER_SPEC_VERSION,
56
+ FLAG_INCLUDE_PRERELEASE: 1,
57
+ FLAG_LOOSE: 2
58
+ };
59
+ }
60
+ });
61
+
62
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/debug.js
63
+ var require_debug = __commonJS({
64
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/debug.js"(exports, module2) {
65
+ var debug3 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
66
+ };
67
+ module2.exports = debug3;
68
+ }
69
+ });
70
+
71
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/re.js
72
+ var require_re = __commonJS({
73
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/re.js"(exports, module2) {
74
+ var { MAX_SAFE_COMPONENT_LENGTH } = require_constants();
75
+ var debug3 = require_debug();
76
+ exports = module2.exports = {};
77
+ var re = exports.re = [];
78
+ var safeRe = exports.safeRe = [];
79
+ var src = exports.src = [];
80
+ var t = exports.t = {};
81
+ var R = 0;
82
+ var createToken = (name, value, isGlobal) => {
83
+ const safe = value.split("\\s*").join("\\s{0,1}").split("\\s+").join("\\s");
84
+ const index = R++;
85
+ debug3(name, index, value);
86
+ t[name] = index;
87
+ src[index] = value;
88
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
89
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
90
+ };
91
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
92
+ createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+");
93
+ createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
94
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
95
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
96
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
97
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
98
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
99
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
100
+ createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
101
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
102
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
103
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
104
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
105
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
106
+ createToken("GTLT", "((?:<|>)?=?)");
107
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
108
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
109
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
110
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
111
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
112
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
113
+ createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
114
+ createToken("COERCERTL", src[t.COERCE], true);
115
+ createToken("LONETILDE", "(?:~>?)");
116
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
117
+ exports.tildeTrimReplace = "$1~";
118
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
119
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
120
+ createToken("LONECARET", "(?:\\^)");
121
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
122
+ exports.caretTrimReplace = "$1^";
123
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
124
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
125
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
126
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
127
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
128
+ exports.comparatorTrimReplace = "$1$2$3";
129
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
130
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
131
+ createToken("STAR", "(<|>)?=?\\s*\\*");
132
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
133
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
134
+ }
135
+ });
136
+
137
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/parse-options.js
138
+ var require_parse_options = __commonJS({
139
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/parse-options.js"(exports, module2) {
140
+ var looseOption = Object.freeze({ loose: true });
141
+ var emptyOpts = Object.freeze({});
142
+ var parseOptions = (options) => {
143
+ if (!options) {
144
+ return emptyOpts;
145
+ }
146
+ if (typeof options !== "object") {
147
+ return looseOption;
148
+ }
149
+ return options;
150
+ };
151
+ module2.exports = parseOptions;
152
+ }
153
+ });
154
+
155
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/identifiers.js
156
+ var require_identifiers = __commonJS({
157
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/internal/identifiers.js"(exports, module2) {
158
+ var numeric = /^[0-9]+$/;
159
+ var compareIdentifiers = (a, b) => {
160
+ const anum = numeric.test(a);
161
+ const bnum = numeric.test(b);
162
+ if (anum && bnum) {
163
+ a = +a;
164
+ b = +b;
165
+ }
166
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
167
+ };
168
+ var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
169
+ module2.exports = {
170
+ compareIdentifiers,
171
+ rcompareIdentifiers
172
+ };
173
+ }
174
+ });
175
+
176
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/classes/semver.js
177
+ var require_semver = __commonJS({
178
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/classes/semver.js"(exports, module2) {
179
+ var debug3 = require_debug();
180
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
181
+ var { safeRe: re, t } = require_re();
182
+ var parseOptions = require_parse_options();
183
+ var { compareIdentifiers } = require_identifiers();
184
+ var SemVer = class _SemVer {
185
+ constructor(version2, options) {
186
+ options = parseOptions(options);
187
+ if (version2 instanceof _SemVer) {
188
+ if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
189
+ return version2;
190
+ } else {
191
+ version2 = version2.version;
192
+ }
193
+ } else if (typeof version2 !== "string") {
194
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
195
+ }
196
+ if (version2.length > MAX_LENGTH) {
197
+ throw new TypeError(
198
+ `version is longer than ${MAX_LENGTH} characters`
199
+ );
200
+ }
201
+ debug3("SemVer", version2, options);
202
+ this.options = options;
203
+ this.loose = !!options.loose;
204
+ this.includePrerelease = !!options.includePrerelease;
205
+ const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
206
+ if (!m) {
207
+ throw new TypeError(`Invalid Version: ${version2}`);
208
+ }
209
+ this.raw = version2;
210
+ this.major = +m[1];
211
+ this.minor = +m[2];
212
+ this.patch = +m[3];
213
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
214
+ throw new TypeError("Invalid major version");
215
+ }
216
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
217
+ throw new TypeError("Invalid minor version");
218
+ }
219
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
220
+ throw new TypeError("Invalid patch version");
221
+ }
222
+ if (!m[4]) {
223
+ this.prerelease = [];
224
+ } else {
225
+ this.prerelease = m[4].split(".").map((id) => {
226
+ if (/^[0-9]+$/.test(id)) {
227
+ const num = +id;
228
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
229
+ return num;
230
+ }
231
+ }
232
+ return id;
233
+ });
234
+ }
235
+ this.build = m[5] ? m[5].split(".") : [];
236
+ this.format();
237
+ }
238
+ format() {
239
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
240
+ if (this.prerelease.length) {
241
+ this.version += `-${this.prerelease.join(".")}`;
242
+ }
243
+ return this.version;
244
+ }
245
+ toString() {
246
+ return this.version;
247
+ }
248
+ compare(other) {
249
+ debug3("SemVer.compare", this.version, this.options, other);
250
+ if (!(other instanceof _SemVer)) {
251
+ if (typeof other === "string" && other === this.version) {
252
+ return 0;
253
+ }
254
+ other = new _SemVer(other, this.options);
255
+ }
256
+ if (other.version === this.version) {
257
+ return 0;
258
+ }
259
+ return this.compareMain(other) || this.comparePre(other);
260
+ }
261
+ compareMain(other) {
262
+ if (!(other instanceof _SemVer)) {
263
+ other = new _SemVer(other, this.options);
264
+ }
265
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
266
+ }
267
+ comparePre(other) {
268
+ if (!(other instanceof _SemVer)) {
269
+ other = new _SemVer(other, this.options);
270
+ }
271
+ if (this.prerelease.length && !other.prerelease.length) {
272
+ return -1;
273
+ } else if (!this.prerelease.length && other.prerelease.length) {
274
+ return 1;
275
+ } else if (!this.prerelease.length && !other.prerelease.length) {
276
+ return 0;
277
+ }
278
+ let i = 0;
279
+ do {
280
+ const a = this.prerelease[i];
281
+ const b = other.prerelease[i];
282
+ debug3("prerelease compare", i, a, b);
283
+ if (a === void 0 && b === void 0) {
284
+ return 0;
285
+ } else if (b === void 0) {
286
+ return 1;
287
+ } else if (a === void 0) {
288
+ return -1;
289
+ } else if (a === b) {
290
+ continue;
291
+ } else {
292
+ return compareIdentifiers(a, b);
293
+ }
294
+ } while (++i);
295
+ }
296
+ compareBuild(other) {
297
+ if (!(other instanceof _SemVer)) {
298
+ other = new _SemVer(other, this.options);
299
+ }
300
+ let i = 0;
301
+ do {
302
+ const a = this.build[i];
303
+ const b = other.build[i];
304
+ debug3("prerelease compare", i, a, b);
305
+ if (a === void 0 && b === void 0) {
306
+ return 0;
307
+ } else if (b === void 0) {
308
+ return 1;
309
+ } else if (a === void 0) {
310
+ return -1;
311
+ } else if (a === b) {
312
+ continue;
313
+ } else {
314
+ return compareIdentifiers(a, b);
315
+ }
316
+ } while (++i);
317
+ }
318
+ // preminor will bump the version up to the next minor release, and immediately
319
+ // down to pre-release. premajor and prepatch work the same way.
320
+ inc(release, identifier, identifierBase) {
321
+ switch (release) {
322
+ case "premajor":
323
+ this.prerelease.length = 0;
324
+ this.patch = 0;
325
+ this.minor = 0;
326
+ this.major++;
327
+ this.inc("pre", identifier, identifierBase);
328
+ break;
329
+ case "preminor":
330
+ this.prerelease.length = 0;
331
+ this.patch = 0;
332
+ this.minor++;
333
+ this.inc("pre", identifier, identifierBase);
334
+ break;
335
+ case "prepatch":
336
+ this.prerelease.length = 0;
337
+ this.inc("patch", identifier, identifierBase);
338
+ this.inc("pre", identifier, identifierBase);
339
+ break;
340
+ case "prerelease":
341
+ if (this.prerelease.length === 0) {
342
+ this.inc("patch", identifier, identifierBase);
343
+ }
344
+ this.inc("pre", identifier, identifierBase);
345
+ break;
346
+ case "major":
347
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
348
+ this.major++;
349
+ }
350
+ this.minor = 0;
351
+ this.patch = 0;
352
+ this.prerelease = [];
353
+ break;
354
+ case "minor":
355
+ if (this.patch !== 0 || this.prerelease.length === 0) {
356
+ this.minor++;
357
+ }
358
+ this.patch = 0;
359
+ this.prerelease = [];
360
+ break;
361
+ case "patch":
362
+ if (this.prerelease.length === 0) {
363
+ this.patch++;
364
+ }
365
+ this.prerelease = [];
366
+ break;
367
+ case "pre": {
368
+ const base = Number(identifierBase) ? 1 : 0;
369
+ if (!identifier && identifierBase === false) {
370
+ throw new Error("invalid increment argument: identifier is empty");
371
+ }
372
+ if (this.prerelease.length === 0) {
373
+ this.prerelease = [base];
374
+ } else {
375
+ let i = this.prerelease.length;
376
+ while (--i >= 0) {
377
+ if (typeof this.prerelease[i] === "number") {
378
+ this.prerelease[i]++;
379
+ i = -2;
380
+ }
381
+ }
382
+ if (i === -1) {
383
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
384
+ throw new Error("invalid increment argument: identifier already exists");
385
+ }
386
+ this.prerelease.push(base);
387
+ }
388
+ }
389
+ if (identifier) {
390
+ let prerelease = [identifier, base];
391
+ if (identifierBase === false) {
392
+ prerelease = [identifier];
393
+ }
394
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
395
+ if (isNaN(this.prerelease[1])) {
396
+ this.prerelease = prerelease;
397
+ }
398
+ } else {
399
+ this.prerelease = prerelease;
400
+ }
401
+ }
402
+ break;
403
+ }
404
+ default:
405
+ throw new Error(`invalid increment argument: ${release}`);
406
+ }
407
+ this.raw = this.format();
408
+ if (this.build.length) {
409
+ this.raw += `+${this.build.join(".")}`;
410
+ }
411
+ return this;
412
+ }
413
+ };
414
+ module2.exports = SemVer;
415
+ }
416
+ });
417
+
418
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/parse.js
419
+ var require_parse = __commonJS({
420
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/parse.js"(exports, module2) {
421
+ var SemVer = require_semver();
422
+ var parse = (version2, options, throwErrors = false) => {
423
+ if (version2 instanceof SemVer) {
424
+ return version2;
425
+ }
426
+ try {
427
+ return new SemVer(version2, options);
428
+ } catch (er) {
429
+ if (!throwErrors) {
430
+ return null;
431
+ }
432
+ throw er;
433
+ }
434
+ };
435
+ module2.exports = parse;
436
+ }
437
+ });
438
+
439
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/valid.js
440
+ var require_valid = __commonJS({
441
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/valid.js"(exports, module2) {
442
+ var parse = require_parse();
443
+ var valid = (version2, options) => {
444
+ const v = parse(version2, options);
445
+ return v ? v.version : null;
446
+ };
447
+ module2.exports = valid;
448
+ }
449
+ });
450
+
451
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/clean.js
452
+ var require_clean = __commonJS({
453
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/clean.js"(exports, module2) {
454
+ var parse = require_parse();
455
+ var clean = (version2, options) => {
456
+ const s = parse(version2.trim().replace(/^[=v]+/, ""), options);
457
+ return s ? s.version : null;
458
+ };
459
+ module2.exports = clean;
460
+ }
461
+ });
462
+
463
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/inc.js
464
+ var require_inc = __commonJS({
465
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/inc.js"(exports, module2) {
466
+ var SemVer = require_semver();
467
+ var inc = (version2, release, options, identifier, identifierBase) => {
468
+ if (typeof options === "string") {
469
+ identifierBase = identifier;
470
+ identifier = options;
471
+ options = void 0;
472
+ }
473
+ try {
474
+ return new SemVer(
475
+ version2 instanceof SemVer ? version2.version : version2,
476
+ options
477
+ ).inc(release, identifier, identifierBase).version;
478
+ } catch (er) {
479
+ return null;
480
+ }
481
+ };
482
+ module2.exports = inc;
483
+ }
484
+ });
485
+
486
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/diff.js
487
+ var require_diff = __commonJS({
488
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/diff.js"(exports, module2) {
489
+ var parse = require_parse();
490
+ var diff = (version1, version2) => {
491
+ const v1 = parse(version1, null, true);
492
+ const v2 = parse(version2, null, true);
493
+ const comparison = v1.compare(v2);
494
+ if (comparison === 0) {
495
+ return null;
496
+ }
497
+ const v1Higher = comparison > 0;
498
+ const highVersion = v1Higher ? v1 : v2;
499
+ const lowVersion = v1Higher ? v2 : v1;
500
+ const highHasPre = !!highVersion.prerelease.length;
501
+ const lowHasPre = !!lowVersion.prerelease.length;
502
+ if (lowHasPre && !highHasPre) {
503
+ if (!lowVersion.patch && !lowVersion.minor) {
504
+ return "major";
505
+ }
506
+ if (highVersion.patch) {
507
+ return "patch";
508
+ }
509
+ if (highVersion.minor) {
510
+ return "minor";
511
+ }
512
+ return "major";
513
+ }
514
+ const prefix = highHasPre ? "pre" : "";
515
+ if (v1.major !== v2.major) {
516
+ return prefix + "major";
517
+ }
518
+ if (v1.minor !== v2.minor) {
519
+ return prefix + "minor";
520
+ }
521
+ if (v1.patch !== v2.patch) {
522
+ return prefix + "patch";
523
+ }
524
+ return "prerelease";
525
+ };
526
+ module2.exports = diff;
527
+ }
528
+ });
529
+
530
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/major.js
531
+ var require_major = __commonJS({
532
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/major.js"(exports, module2) {
533
+ var SemVer = require_semver();
534
+ var major = (a, loose) => new SemVer(a, loose).major;
535
+ module2.exports = major;
536
+ }
537
+ });
538
+
539
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/minor.js
540
+ var require_minor = __commonJS({
541
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/minor.js"(exports, module2) {
542
+ var SemVer = require_semver();
543
+ var minor = (a, loose) => new SemVer(a, loose).minor;
544
+ module2.exports = minor;
545
+ }
546
+ });
547
+
548
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/patch.js
549
+ var require_patch = __commonJS({
550
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/patch.js"(exports, module2) {
551
+ var SemVer = require_semver();
552
+ var patch = (a, loose) => new SemVer(a, loose).patch;
553
+ module2.exports = patch;
554
+ }
555
+ });
556
+
557
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/prerelease.js
558
+ var require_prerelease = __commonJS({
559
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/prerelease.js"(exports, module2) {
560
+ var parse = require_parse();
561
+ var prerelease = (version2, options) => {
562
+ const parsed = parse(version2, options);
563
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
564
+ };
565
+ module2.exports = prerelease;
566
+ }
567
+ });
568
+
569
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/compare.js
570
+ var require_compare = __commonJS({
571
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/compare.js"(exports, module2) {
572
+ var SemVer = require_semver();
573
+ var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
574
+ module2.exports = compare;
575
+ }
576
+ });
577
+
578
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/rcompare.js
579
+ var require_rcompare = __commonJS({
580
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/rcompare.js"(exports, module2) {
581
+ var compare = require_compare();
582
+ var rcompare = (a, b, loose) => compare(b, a, loose);
583
+ module2.exports = rcompare;
584
+ }
585
+ });
586
+
587
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/compare-loose.js
588
+ var require_compare_loose = __commonJS({
589
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/compare-loose.js"(exports, module2) {
590
+ var compare = require_compare();
591
+ var compareLoose = (a, b) => compare(a, b, true);
592
+ module2.exports = compareLoose;
593
+ }
594
+ });
595
+
596
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/compare-build.js
597
+ var require_compare_build = __commonJS({
598
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/compare-build.js"(exports, module2) {
599
+ var SemVer = require_semver();
600
+ var compareBuild = (a, b, loose) => {
601
+ const versionA = new SemVer(a, loose);
602
+ const versionB = new SemVer(b, loose);
603
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
604
+ };
605
+ module2.exports = compareBuild;
606
+ }
607
+ });
608
+
609
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/sort.js
610
+ var require_sort = __commonJS({
611
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/sort.js"(exports, module2) {
612
+ var compareBuild = require_compare_build();
613
+ var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
614
+ module2.exports = sort;
615
+ }
616
+ });
617
+
618
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/rsort.js
619
+ var require_rsort = __commonJS({
620
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/rsort.js"(exports, module2) {
621
+ var compareBuild = require_compare_build();
622
+ var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
623
+ module2.exports = rsort;
624
+ }
625
+ });
626
+
627
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/gt.js
628
+ var require_gt = __commonJS({
629
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/gt.js"(exports, module2) {
630
+ var compare = require_compare();
631
+ var gt = (a, b, loose) => compare(a, b, loose) > 0;
632
+ module2.exports = gt;
633
+ }
634
+ });
635
+
636
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/lt.js
637
+ var require_lt = __commonJS({
638
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/lt.js"(exports, module2) {
639
+ var compare = require_compare();
640
+ var lt = (a, b, loose) => compare(a, b, loose) < 0;
641
+ module2.exports = lt;
642
+ }
643
+ });
644
+
645
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/eq.js
646
+ var require_eq = __commonJS({
647
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/eq.js"(exports, module2) {
648
+ var compare = require_compare();
649
+ var eq = (a, b, loose) => compare(a, b, loose) === 0;
650
+ module2.exports = eq;
651
+ }
652
+ });
653
+
654
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/neq.js
655
+ var require_neq = __commonJS({
656
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/neq.js"(exports, module2) {
657
+ var compare = require_compare();
658
+ var neq = (a, b, loose) => compare(a, b, loose) !== 0;
659
+ module2.exports = neq;
660
+ }
661
+ });
662
+
663
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/gte.js
664
+ var require_gte = __commonJS({
665
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/gte.js"(exports, module2) {
666
+ var compare = require_compare();
667
+ var gte = (a, b, loose) => compare(a, b, loose) >= 0;
668
+ module2.exports = gte;
669
+ }
670
+ });
671
+
672
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/lte.js
673
+ var require_lte = __commonJS({
674
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/lte.js"(exports, module2) {
675
+ var compare = require_compare();
676
+ var lte = (a, b, loose) => compare(a, b, loose) <= 0;
677
+ module2.exports = lte;
678
+ }
679
+ });
680
+
681
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/cmp.js
682
+ var require_cmp = __commonJS({
683
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/cmp.js"(exports, module2) {
684
+ var eq = require_eq();
685
+ var neq = require_neq();
686
+ var gt = require_gt();
687
+ var gte = require_gte();
688
+ var lt = require_lt();
689
+ var lte = require_lte();
690
+ var cmp = (a, op, b, loose) => {
691
+ switch (op) {
692
+ case "===":
693
+ if (typeof a === "object") {
694
+ a = a.version;
695
+ }
696
+ if (typeof b === "object") {
697
+ b = b.version;
698
+ }
699
+ return a === b;
700
+ case "!==":
701
+ if (typeof a === "object") {
702
+ a = a.version;
703
+ }
704
+ if (typeof b === "object") {
705
+ b = b.version;
706
+ }
707
+ return a !== b;
708
+ case "":
709
+ case "=":
710
+ case "==":
711
+ return eq(a, b, loose);
712
+ case "!=":
713
+ return neq(a, b, loose);
714
+ case ">":
715
+ return gt(a, b, loose);
716
+ case ">=":
717
+ return gte(a, b, loose);
718
+ case "<":
719
+ return lt(a, b, loose);
720
+ case "<=":
721
+ return lte(a, b, loose);
722
+ default:
723
+ throw new TypeError(`Invalid operator: ${op}`);
724
+ }
725
+ };
726
+ module2.exports = cmp;
727
+ }
728
+ });
729
+
730
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/coerce.js
731
+ var require_coerce = __commonJS({
732
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/coerce.js"(exports, module2) {
733
+ var SemVer = require_semver();
734
+ var parse = require_parse();
735
+ var { safeRe: re, t } = require_re();
736
+ var coerce = (version2, options) => {
737
+ if (version2 instanceof SemVer) {
738
+ return version2;
739
+ }
740
+ if (typeof version2 === "number") {
741
+ version2 = String(version2);
742
+ }
743
+ if (typeof version2 !== "string") {
744
+ return null;
745
+ }
746
+ options = options || {};
747
+ let match = null;
748
+ if (!options.rtl) {
749
+ match = version2.match(re[t.COERCE]);
750
+ } else {
751
+ let next;
752
+ while ((next = re[t.COERCERTL].exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
753
+ if (!match || next.index + next[0].length !== match.index + match[0].length) {
754
+ match = next;
755
+ }
756
+ re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
757
+ }
758
+ re[t.COERCERTL].lastIndex = -1;
759
+ }
760
+ if (match === null) {
761
+ return null;
762
+ }
763
+ return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
764
+ };
765
+ module2.exports = coerce;
766
+ }
767
+ });
768
+
769
+ // ../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js
770
+ var require_iterator = __commonJS({
771
+ "../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js"(exports, module2) {
772
+ "use strict";
773
+ module2.exports = function(Yallist) {
774
+ Yallist.prototype[Symbol.iterator] = function* () {
775
+ for (let walker = this.head; walker; walker = walker.next) {
776
+ yield walker.value;
777
+ }
778
+ };
779
+ };
780
+ }
781
+ });
782
+
783
+ // ../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js
784
+ var require_yallist = __commonJS({
785
+ "../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js"(exports, module2) {
786
+ "use strict";
787
+ module2.exports = Yallist;
788
+ Yallist.Node = Node2;
789
+ Yallist.create = Yallist;
790
+ function Yallist(list) {
791
+ var self = this;
792
+ if (!(self instanceof Yallist)) {
793
+ self = new Yallist();
794
+ }
795
+ self.tail = null;
796
+ self.head = null;
797
+ self.length = 0;
798
+ if (list && typeof list.forEach === "function") {
799
+ list.forEach(function(item) {
800
+ self.push(item);
801
+ });
802
+ } else if (arguments.length > 0) {
803
+ for (var i = 0, l = arguments.length; i < l; i++) {
804
+ self.push(arguments[i]);
805
+ }
806
+ }
807
+ return self;
808
+ }
809
+ Yallist.prototype.removeNode = function(node) {
810
+ if (node.list !== this) {
811
+ throw new Error("removing node which does not belong to this list");
812
+ }
813
+ var next = node.next;
814
+ var prev = node.prev;
815
+ if (next) {
816
+ next.prev = prev;
817
+ }
818
+ if (prev) {
819
+ prev.next = next;
820
+ }
821
+ if (node === this.head) {
822
+ this.head = next;
823
+ }
824
+ if (node === this.tail) {
825
+ this.tail = prev;
826
+ }
827
+ node.list.length--;
828
+ node.next = null;
829
+ node.prev = null;
830
+ node.list = null;
831
+ return next;
832
+ };
833
+ Yallist.prototype.unshiftNode = function(node) {
834
+ if (node === this.head) {
835
+ return;
836
+ }
837
+ if (node.list) {
838
+ node.list.removeNode(node);
839
+ }
840
+ var head = this.head;
841
+ node.list = this;
842
+ node.next = head;
843
+ if (head) {
844
+ head.prev = node;
845
+ }
846
+ this.head = node;
847
+ if (!this.tail) {
848
+ this.tail = node;
849
+ }
850
+ this.length++;
851
+ };
852
+ Yallist.prototype.pushNode = function(node) {
853
+ if (node === this.tail) {
854
+ return;
855
+ }
856
+ if (node.list) {
857
+ node.list.removeNode(node);
858
+ }
859
+ var tail = this.tail;
860
+ node.list = this;
861
+ node.prev = tail;
862
+ if (tail) {
863
+ tail.next = node;
864
+ }
865
+ this.tail = node;
866
+ if (!this.head) {
867
+ this.head = node;
868
+ }
869
+ this.length++;
870
+ };
871
+ Yallist.prototype.push = function() {
872
+ for (var i = 0, l = arguments.length; i < l; i++) {
873
+ push(this, arguments[i]);
874
+ }
875
+ return this.length;
876
+ };
877
+ Yallist.prototype.unshift = function() {
878
+ for (var i = 0, l = arguments.length; i < l; i++) {
879
+ unshift(this, arguments[i]);
880
+ }
881
+ return this.length;
882
+ };
883
+ Yallist.prototype.pop = function() {
884
+ if (!this.tail) {
885
+ return void 0;
886
+ }
887
+ var res = this.tail.value;
888
+ this.tail = this.tail.prev;
889
+ if (this.tail) {
890
+ this.tail.next = null;
891
+ } else {
892
+ this.head = null;
893
+ }
894
+ this.length--;
895
+ return res;
896
+ };
897
+ Yallist.prototype.shift = function() {
898
+ if (!this.head) {
899
+ return void 0;
900
+ }
901
+ var res = this.head.value;
902
+ this.head = this.head.next;
903
+ if (this.head) {
904
+ this.head.prev = null;
905
+ } else {
906
+ this.tail = null;
907
+ }
908
+ this.length--;
909
+ return res;
910
+ };
911
+ Yallist.prototype.forEach = function(fn, thisp) {
912
+ thisp = thisp || this;
913
+ for (var walker = this.head, i = 0; walker !== null; i++) {
914
+ fn.call(thisp, walker.value, i, this);
915
+ walker = walker.next;
916
+ }
917
+ };
918
+ Yallist.prototype.forEachReverse = function(fn, thisp) {
919
+ thisp = thisp || this;
920
+ for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
921
+ fn.call(thisp, walker.value, i, this);
922
+ walker = walker.prev;
923
+ }
924
+ };
925
+ Yallist.prototype.get = function(n) {
926
+ for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
927
+ walker = walker.next;
928
+ }
929
+ if (i === n && walker !== null) {
930
+ return walker.value;
931
+ }
932
+ };
933
+ Yallist.prototype.getReverse = function(n) {
934
+ for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
935
+ walker = walker.prev;
936
+ }
937
+ if (i === n && walker !== null) {
938
+ return walker.value;
939
+ }
940
+ };
941
+ Yallist.prototype.map = function(fn, thisp) {
942
+ thisp = thisp || this;
943
+ var res = new Yallist();
944
+ for (var walker = this.head; walker !== null; ) {
945
+ res.push(fn.call(thisp, walker.value, this));
946
+ walker = walker.next;
947
+ }
948
+ return res;
949
+ };
950
+ Yallist.prototype.mapReverse = function(fn, thisp) {
951
+ thisp = thisp || this;
952
+ var res = new Yallist();
953
+ for (var walker = this.tail; walker !== null; ) {
954
+ res.push(fn.call(thisp, walker.value, this));
955
+ walker = walker.prev;
956
+ }
957
+ return res;
958
+ };
959
+ Yallist.prototype.reduce = function(fn, initial) {
960
+ var acc;
961
+ var walker = this.head;
962
+ if (arguments.length > 1) {
963
+ acc = initial;
964
+ } else if (this.head) {
965
+ walker = this.head.next;
966
+ acc = this.head.value;
967
+ } else {
968
+ throw new TypeError("Reduce of empty list with no initial value");
969
+ }
970
+ for (var i = 0; walker !== null; i++) {
971
+ acc = fn(acc, walker.value, i);
972
+ walker = walker.next;
973
+ }
974
+ return acc;
975
+ };
976
+ Yallist.prototype.reduceReverse = function(fn, initial) {
977
+ var acc;
978
+ var walker = this.tail;
979
+ if (arguments.length > 1) {
980
+ acc = initial;
981
+ } else if (this.tail) {
982
+ walker = this.tail.prev;
983
+ acc = this.tail.value;
984
+ } else {
985
+ throw new TypeError("Reduce of empty list with no initial value");
986
+ }
987
+ for (var i = this.length - 1; walker !== null; i--) {
988
+ acc = fn(acc, walker.value, i);
989
+ walker = walker.prev;
990
+ }
991
+ return acc;
992
+ };
993
+ Yallist.prototype.toArray = function() {
994
+ var arr = new Array(this.length);
995
+ for (var i = 0, walker = this.head; walker !== null; i++) {
996
+ arr[i] = walker.value;
997
+ walker = walker.next;
998
+ }
999
+ return arr;
1000
+ };
1001
+ Yallist.prototype.toArrayReverse = function() {
1002
+ var arr = new Array(this.length);
1003
+ for (var i = 0, walker = this.tail; walker !== null; i++) {
1004
+ arr[i] = walker.value;
1005
+ walker = walker.prev;
1006
+ }
1007
+ return arr;
1008
+ };
1009
+ Yallist.prototype.slice = function(from, to) {
1010
+ to = to || this.length;
1011
+ if (to < 0) {
1012
+ to += this.length;
1013
+ }
1014
+ from = from || 0;
1015
+ if (from < 0) {
1016
+ from += this.length;
1017
+ }
1018
+ var ret = new Yallist();
1019
+ if (to < from || to < 0) {
1020
+ return ret;
1021
+ }
1022
+ if (from < 0) {
1023
+ from = 0;
1024
+ }
1025
+ if (to > this.length) {
1026
+ to = this.length;
1027
+ }
1028
+ for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
1029
+ walker = walker.next;
1030
+ }
1031
+ for (; walker !== null && i < to; i++, walker = walker.next) {
1032
+ ret.push(walker.value);
1033
+ }
1034
+ return ret;
1035
+ };
1036
+ Yallist.prototype.sliceReverse = function(from, to) {
1037
+ to = to || this.length;
1038
+ if (to < 0) {
1039
+ to += this.length;
1040
+ }
1041
+ from = from || 0;
1042
+ if (from < 0) {
1043
+ from += this.length;
1044
+ }
1045
+ var ret = new Yallist();
1046
+ if (to < from || to < 0) {
1047
+ return ret;
1048
+ }
1049
+ if (from < 0) {
1050
+ from = 0;
1051
+ }
1052
+ if (to > this.length) {
1053
+ to = this.length;
1054
+ }
1055
+ for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
1056
+ walker = walker.prev;
1057
+ }
1058
+ for (; walker !== null && i > from; i--, walker = walker.prev) {
1059
+ ret.push(walker.value);
1060
+ }
1061
+ return ret;
1062
+ };
1063
+ Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
1064
+ if (start > this.length) {
1065
+ start = this.length - 1;
1066
+ }
1067
+ if (start < 0) {
1068
+ start = this.length + start;
1069
+ }
1070
+ for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
1071
+ walker = walker.next;
1072
+ }
1073
+ var ret = [];
1074
+ for (var i = 0; walker && i < deleteCount; i++) {
1075
+ ret.push(walker.value);
1076
+ walker = this.removeNode(walker);
1077
+ }
1078
+ if (walker === null) {
1079
+ walker = this.tail;
1080
+ }
1081
+ if (walker !== this.head && walker !== this.tail) {
1082
+ walker = walker.prev;
1083
+ }
1084
+ for (var i = 0; i < nodes.length; i++) {
1085
+ walker = insert(this, walker, nodes[i]);
1086
+ }
1087
+ return ret;
1088
+ };
1089
+ Yallist.prototype.reverse = function() {
1090
+ var head = this.head;
1091
+ var tail = this.tail;
1092
+ for (var walker = head; walker !== null; walker = walker.prev) {
1093
+ var p = walker.prev;
1094
+ walker.prev = walker.next;
1095
+ walker.next = p;
1096
+ }
1097
+ this.head = tail;
1098
+ this.tail = head;
1099
+ return this;
1100
+ };
1101
+ function insert(self, node, value) {
1102
+ var inserted = node === self.head ? new Node2(value, null, node, self) : new Node2(value, node, node.next, self);
1103
+ if (inserted.next === null) {
1104
+ self.tail = inserted;
1105
+ }
1106
+ if (inserted.prev === null) {
1107
+ self.head = inserted;
1108
+ }
1109
+ self.length++;
1110
+ return inserted;
1111
+ }
1112
+ function push(self, item) {
1113
+ self.tail = new Node2(item, self.tail, null, self);
1114
+ if (!self.head) {
1115
+ self.head = self.tail;
1116
+ }
1117
+ self.length++;
1118
+ }
1119
+ function unshift(self, item) {
1120
+ self.head = new Node2(item, null, self.head, self);
1121
+ if (!self.tail) {
1122
+ self.tail = self.head;
1123
+ }
1124
+ self.length++;
1125
+ }
1126
+ function Node2(value, prev, next, list) {
1127
+ if (!(this instanceof Node2)) {
1128
+ return new Node2(value, prev, next, list);
1129
+ }
1130
+ this.list = list;
1131
+ this.value = value;
1132
+ if (prev) {
1133
+ prev.next = this;
1134
+ this.prev = prev;
1135
+ } else {
1136
+ this.prev = null;
1137
+ }
1138
+ if (next) {
1139
+ next.prev = this;
1140
+ this.next = next;
1141
+ } else {
1142
+ this.next = null;
1143
+ }
1144
+ }
1145
+ try {
1146
+ require_iterator()(Yallist);
1147
+ } catch (er) {
1148
+ }
1149
+ }
1150
+ });
1151
+
1152
+ // ../../node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js
1153
+ var require_lru_cache = __commonJS({
1154
+ "../../node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js"(exports, module2) {
1155
+ "use strict";
1156
+ var Yallist = require_yallist();
1157
+ var MAX = Symbol("max");
1158
+ var LENGTH = Symbol("length");
1159
+ var LENGTH_CALCULATOR = Symbol("lengthCalculator");
1160
+ var ALLOW_STALE = Symbol("allowStale");
1161
+ var MAX_AGE = Symbol("maxAge");
1162
+ var DISPOSE = Symbol("dispose");
1163
+ var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
1164
+ var LRU_LIST = Symbol("lruList");
1165
+ var CACHE = Symbol("cache");
1166
+ var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
1167
+ var naiveLength = () => 1;
1168
+ var LRUCache = class {
1169
+ constructor(options) {
1170
+ if (typeof options === "number")
1171
+ options = { max: options };
1172
+ if (!options)
1173
+ options = {};
1174
+ if (options.max && (typeof options.max !== "number" || options.max < 0))
1175
+ throw new TypeError("max must be a non-negative number");
1176
+ const max = this[MAX] = options.max || Infinity;
1177
+ const lc = options.length || naiveLength;
1178
+ this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
1179
+ this[ALLOW_STALE] = options.stale || false;
1180
+ if (options.maxAge && typeof options.maxAge !== "number")
1181
+ throw new TypeError("maxAge must be a number");
1182
+ this[MAX_AGE] = options.maxAge || 0;
1183
+ this[DISPOSE] = options.dispose;
1184
+ this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
1185
+ this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
1186
+ this.reset();
1187
+ }
1188
+ // resize the cache when the max changes.
1189
+ set max(mL) {
1190
+ if (typeof mL !== "number" || mL < 0)
1191
+ throw new TypeError("max must be a non-negative number");
1192
+ this[MAX] = mL || Infinity;
1193
+ trim(this);
1194
+ }
1195
+ get max() {
1196
+ return this[MAX];
1197
+ }
1198
+ set allowStale(allowStale) {
1199
+ this[ALLOW_STALE] = !!allowStale;
1200
+ }
1201
+ get allowStale() {
1202
+ return this[ALLOW_STALE];
1203
+ }
1204
+ set maxAge(mA) {
1205
+ if (typeof mA !== "number")
1206
+ throw new TypeError("maxAge must be a non-negative number");
1207
+ this[MAX_AGE] = mA;
1208
+ trim(this);
1209
+ }
1210
+ get maxAge() {
1211
+ return this[MAX_AGE];
1212
+ }
1213
+ // resize the cache when the lengthCalculator changes.
1214
+ set lengthCalculator(lC) {
1215
+ if (typeof lC !== "function")
1216
+ lC = naiveLength;
1217
+ if (lC !== this[LENGTH_CALCULATOR]) {
1218
+ this[LENGTH_CALCULATOR] = lC;
1219
+ this[LENGTH] = 0;
1220
+ this[LRU_LIST].forEach((hit) => {
1221
+ hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
1222
+ this[LENGTH] += hit.length;
1223
+ });
1224
+ }
1225
+ trim(this);
1226
+ }
1227
+ get lengthCalculator() {
1228
+ return this[LENGTH_CALCULATOR];
1229
+ }
1230
+ get length() {
1231
+ return this[LENGTH];
1232
+ }
1233
+ get itemCount() {
1234
+ return this[LRU_LIST].length;
1235
+ }
1236
+ rforEach(fn, thisp) {
1237
+ thisp = thisp || this;
1238
+ for (let walker = this[LRU_LIST].tail; walker !== null; ) {
1239
+ const prev = walker.prev;
1240
+ forEachStep(this, fn, walker, thisp);
1241
+ walker = prev;
1242
+ }
1243
+ }
1244
+ forEach(fn, thisp) {
1245
+ thisp = thisp || this;
1246
+ for (let walker = this[LRU_LIST].head; walker !== null; ) {
1247
+ const next = walker.next;
1248
+ forEachStep(this, fn, walker, thisp);
1249
+ walker = next;
1250
+ }
1251
+ }
1252
+ keys() {
1253
+ return this[LRU_LIST].toArray().map((k) => k.key);
1254
+ }
1255
+ values() {
1256
+ return this[LRU_LIST].toArray().map((k) => k.value);
1257
+ }
1258
+ reset() {
1259
+ if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
1260
+ this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
1261
+ }
1262
+ this[CACHE] = /* @__PURE__ */ new Map();
1263
+ this[LRU_LIST] = new Yallist();
1264
+ this[LENGTH] = 0;
1265
+ }
1266
+ dump() {
1267
+ return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
1268
+ k: hit.key,
1269
+ v: hit.value,
1270
+ e: hit.now + (hit.maxAge || 0)
1271
+ }).toArray().filter((h) => h);
1272
+ }
1273
+ dumpLru() {
1274
+ return this[LRU_LIST];
1275
+ }
1276
+ set(key, value, maxAge) {
1277
+ maxAge = maxAge || this[MAX_AGE];
1278
+ if (maxAge && typeof maxAge !== "number")
1279
+ throw new TypeError("maxAge must be a number");
1280
+ const now = maxAge ? Date.now() : 0;
1281
+ const len = this[LENGTH_CALCULATOR](value, key);
1282
+ if (this[CACHE].has(key)) {
1283
+ if (len > this[MAX]) {
1284
+ del(this, this[CACHE].get(key));
1285
+ return false;
1286
+ }
1287
+ const node = this[CACHE].get(key);
1288
+ const item = node.value;
1289
+ if (this[DISPOSE]) {
1290
+ if (!this[NO_DISPOSE_ON_SET])
1291
+ this[DISPOSE](key, item.value);
1292
+ }
1293
+ item.now = now;
1294
+ item.maxAge = maxAge;
1295
+ item.value = value;
1296
+ this[LENGTH] += len - item.length;
1297
+ item.length = len;
1298
+ this.get(key);
1299
+ trim(this);
1300
+ return true;
1301
+ }
1302
+ const hit = new Entry(key, value, len, now, maxAge);
1303
+ if (hit.length > this[MAX]) {
1304
+ if (this[DISPOSE])
1305
+ this[DISPOSE](key, value);
1306
+ return false;
1307
+ }
1308
+ this[LENGTH] += hit.length;
1309
+ this[LRU_LIST].unshift(hit);
1310
+ this[CACHE].set(key, this[LRU_LIST].head);
1311
+ trim(this);
1312
+ return true;
1313
+ }
1314
+ has(key) {
1315
+ if (!this[CACHE].has(key))
1316
+ return false;
1317
+ const hit = this[CACHE].get(key).value;
1318
+ return !isStale(this, hit);
1319
+ }
1320
+ get(key) {
1321
+ return get(this, key, true);
1322
+ }
1323
+ peek(key) {
1324
+ return get(this, key, false);
1325
+ }
1326
+ pop() {
1327
+ const node = this[LRU_LIST].tail;
1328
+ if (!node)
1329
+ return null;
1330
+ del(this, node);
1331
+ return node.value;
1332
+ }
1333
+ del(key) {
1334
+ del(this, this[CACHE].get(key));
1335
+ }
1336
+ load(arr) {
1337
+ this.reset();
1338
+ const now = Date.now();
1339
+ for (let l = arr.length - 1; l >= 0; l--) {
1340
+ const hit = arr[l];
1341
+ const expiresAt = hit.e || 0;
1342
+ if (expiresAt === 0)
1343
+ this.set(hit.k, hit.v);
1344
+ else {
1345
+ const maxAge = expiresAt - now;
1346
+ if (maxAge > 0) {
1347
+ this.set(hit.k, hit.v, maxAge);
1348
+ }
1349
+ }
1350
+ }
1351
+ }
1352
+ prune() {
1353
+ this[CACHE].forEach((value, key) => get(this, key, false));
1354
+ }
1355
+ };
1356
+ var get = (self, key, doUse) => {
1357
+ const node = self[CACHE].get(key);
1358
+ if (node) {
1359
+ const hit = node.value;
1360
+ if (isStale(self, hit)) {
1361
+ del(self, node);
1362
+ if (!self[ALLOW_STALE])
1363
+ return void 0;
1364
+ } else {
1365
+ if (doUse) {
1366
+ if (self[UPDATE_AGE_ON_GET])
1367
+ node.value.now = Date.now();
1368
+ self[LRU_LIST].unshiftNode(node);
1369
+ }
1370
+ }
1371
+ return hit.value;
1372
+ }
1373
+ };
1374
+ var isStale = (self, hit) => {
1375
+ if (!hit || !hit.maxAge && !self[MAX_AGE])
1376
+ return false;
1377
+ const diff = Date.now() - hit.now;
1378
+ return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
1379
+ };
1380
+ var trim = (self) => {
1381
+ if (self[LENGTH] > self[MAX]) {
1382
+ for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null; ) {
1383
+ const prev = walker.prev;
1384
+ del(self, walker);
1385
+ walker = prev;
1386
+ }
1387
+ }
1388
+ };
1389
+ var del = (self, node) => {
1390
+ if (node) {
1391
+ const hit = node.value;
1392
+ if (self[DISPOSE])
1393
+ self[DISPOSE](hit.key, hit.value);
1394
+ self[LENGTH] -= hit.length;
1395
+ self[CACHE].delete(hit.key);
1396
+ self[LRU_LIST].removeNode(node);
1397
+ }
1398
+ };
1399
+ var Entry = class {
1400
+ constructor(key, value, length, now, maxAge) {
1401
+ this.key = key;
1402
+ this.value = value;
1403
+ this.length = length;
1404
+ this.now = now;
1405
+ this.maxAge = maxAge || 0;
1406
+ }
1407
+ };
1408
+ var forEachStep = (self, fn, node, thisp) => {
1409
+ let hit = node.value;
1410
+ if (isStale(self, hit)) {
1411
+ del(self, node);
1412
+ if (!self[ALLOW_STALE])
1413
+ hit = void 0;
1414
+ }
1415
+ if (hit)
1416
+ fn.call(thisp, hit.value, hit.key, self);
1417
+ };
1418
+ module2.exports = LRUCache;
1419
+ }
1420
+ });
1421
+
1422
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/classes/range.js
1423
+ var require_range = __commonJS({
1424
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/classes/range.js"(exports, module2) {
1425
+ var Range = class _Range {
1426
+ constructor(range, options) {
1427
+ options = parseOptions(options);
1428
+ if (range instanceof _Range) {
1429
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
1430
+ return range;
1431
+ } else {
1432
+ return new _Range(range.raw, options);
1433
+ }
1434
+ }
1435
+ if (range instanceof Comparator) {
1436
+ this.raw = range.value;
1437
+ this.set = [[range]];
1438
+ this.format();
1439
+ return this;
1440
+ }
1441
+ this.options = options;
1442
+ this.loose = !!options.loose;
1443
+ this.includePrerelease = !!options.includePrerelease;
1444
+ this.raw = range.trim().split(/\s+/).join(" ");
1445
+ this.set = this.raw.split("||").map((r) => this.parseRange(r)).filter((c) => c.length);
1446
+ if (!this.set.length) {
1447
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
1448
+ }
1449
+ if (this.set.length > 1) {
1450
+ const first = this.set[0];
1451
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
1452
+ if (this.set.length === 0) {
1453
+ this.set = [first];
1454
+ } else if (this.set.length > 1) {
1455
+ for (const c of this.set) {
1456
+ if (c.length === 1 && isAny(c[0])) {
1457
+ this.set = [c];
1458
+ break;
1459
+ }
1460
+ }
1461
+ }
1462
+ }
1463
+ this.format();
1464
+ }
1465
+ format() {
1466
+ this.range = this.set.map((comps) => comps.join(" ").trim()).join("||").trim();
1467
+ return this.range;
1468
+ }
1469
+ toString() {
1470
+ return this.range;
1471
+ }
1472
+ parseRange(range) {
1473
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
1474
+ const memoKey = memoOpts + ":" + range;
1475
+ const cached = cache.get(memoKey);
1476
+ if (cached) {
1477
+ return cached;
1478
+ }
1479
+ const loose = this.options.loose;
1480
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1481
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1482
+ debug3("hyphen replace", range);
1483
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1484
+ debug3("comparator trim", range);
1485
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1486
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1487
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1488
+ if (loose) {
1489
+ rangeList = rangeList.filter((comp) => {
1490
+ debug3("loose invalid filter", comp, this.options);
1491
+ return !!comp.match(re[t.COMPARATORLOOSE]);
1492
+ });
1493
+ }
1494
+ debug3("range list", rangeList);
1495
+ const rangeMap = /* @__PURE__ */ new Map();
1496
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
1497
+ for (const comp of comparators) {
1498
+ if (isNullSet(comp)) {
1499
+ return [comp];
1500
+ }
1501
+ rangeMap.set(comp.value, comp);
1502
+ }
1503
+ if (rangeMap.size > 1 && rangeMap.has("")) {
1504
+ rangeMap.delete("");
1505
+ }
1506
+ const result = [...rangeMap.values()];
1507
+ cache.set(memoKey, result);
1508
+ return result;
1509
+ }
1510
+ intersects(range, options) {
1511
+ if (!(range instanceof _Range)) {
1512
+ throw new TypeError("a Range is required");
1513
+ }
1514
+ return this.set.some((thisComparators) => {
1515
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1516
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1517
+ return rangeComparators.every((rangeComparator) => {
1518
+ return thisComparator.intersects(rangeComparator, options);
1519
+ });
1520
+ });
1521
+ });
1522
+ });
1523
+ }
1524
+ // if ANY of the sets match ALL of its comparators, then pass
1525
+ test(version2) {
1526
+ if (!version2) {
1527
+ return false;
1528
+ }
1529
+ if (typeof version2 === "string") {
1530
+ try {
1531
+ version2 = new SemVer(version2, this.options);
1532
+ } catch (er) {
1533
+ return false;
1534
+ }
1535
+ }
1536
+ for (let i = 0; i < this.set.length; i++) {
1537
+ if (testSet(this.set[i], version2, this.options)) {
1538
+ return true;
1539
+ }
1540
+ }
1541
+ return false;
1542
+ }
1543
+ };
1544
+ module2.exports = Range;
1545
+ var LRU = require_lru_cache();
1546
+ var cache = new LRU({ max: 1e3 });
1547
+ var parseOptions = require_parse_options();
1548
+ var Comparator = require_comparator();
1549
+ var debug3 = require_debug();
1550
+ var SemVer = require_semver();
1551
+ var {
1552
+ safeRe: re,
1553
+ t,
1554
+ comparatorTrimReplace,
1555
+ tildeTrimReplace,
1556
+ caretTrimReplace
1557
+ } = require_re();
1558
+ var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1559
+ var isNullSet = (c) => c.value === "<0.0.0-0";
1560
+ var isAny = (c) => c.value === "";
1561
+ var isSatisfiable = (comparators, options) => {
1562
+ let result = true;
1563
+ const remainingComparators = comparators.slice();
1564
+ let testComparator = remainingComparators.pop();
1565
+ while (result && remainingComparators.length) {
1566
+ result = remainingComparators.every((otherComparator) => {
1567
+ return testComparator.intersects(otherComparator, options);
1568
+ });
1569
+ testComparator = remainingComparators.pop();
1570
+ }
1571
+ return result;
1572
+ };
1573
+ var parseComparator = (comp, options) => {
1574
+ debug3("comp", comp, options);
1575
+ comp = replaceCarets(comp, options);
1576
+ debug3("caret", comp);
1577
+ comp = replaceTildes(comp, options);
1578
+ debug3("tildes", comp);
1579
+ comp = replaceXRanges(comp, options);
1580
+ debug3("xrange", comp);
1581
+ comp = replaceStars(comp, options);
1582
+ debug3("stars", comp);
1583
+ return comp;
1584
+ };
1585
+ var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1586
+ var replaceTildes = (comp, options) => {
1587
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1588
+ };
1589
+ var replaceTilde = (comp, options) => {
1590
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1591
+ return comp.replace(r, (_, M, m, p, pr) => {
1592
+ debug3("tilde", comp, _, M, m, p, pr);
1593
+ let ret;
1594
+ if (isX(M)) {
1595
+ ret = "";
1596
+ } else if (isX(m)) {
1597
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1598
+ } else if (isX(p)) {
1599
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1600
+ } else if (pr) {
1601
+ debug3("replaceTilde pr", pr);
1602
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1603
+ } else {
1604
+ ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1605
+ }
1606
+ debug3("tilde return", ret);
1607
+ return ret;
1608
+ });
1609
+ };
1610
+ var replaceCarets = (comp, options) => {
1611
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
1612
+ };
1613
+ var replaceCaret = (comp, options) => {
1614
+ debug3("caret", comp, options);
1615
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1616
+ const z = options.includePrerelease ? "-0" : "";
1617
+ return comp.replace(r, (_, M, m, p, pr) => {
1618
+ debug3("caret", comp, _, M, m, p, pr);
1619
+ let ret;
1620
+ if (isX(M)) {
1621
+ ret = "";
1622
+ } else if (isX(m)) {
1623
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1624
+ } else if (isX(p)) {
1625
+ if (M === "0") {
1626
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1627
+ } else {
1628
+ ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1629
+ }
1630
+ } else if (pr) {
1631
+ debug3("replaceCaret pr", pr);
1632
+ if (M === "0") {
1633
+ if (m === "0") {
1634
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1635
+ } else {
1636
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1637
+ }
1638
+ } else {
1639
+ ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1640
+ }
1641
+ } else {
1642
+ debug3("no pr");
1643
+ if (M === "0") {
1644
+ if (m === "0") {
1645
+ ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1646
+ } else {
1647
+ ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1648
+ }
1649
+ } else {
1650
+ ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1651
+ }
1652
+ }
1653
+ debug3("caret return", ret);
1654
+ return ret;
1655
+ });
1656
+ };
1657
+ var replaceXRanges = (comp, options) => {
1658
+ debug3("replaceXRanges", comp, options);
1659
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
1660
+ };
1661
+ var replaceXRange = (comp, options) => {
1662
+ comp = comp.trim();
1663
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1664
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1665
+ debug3("xRange", comp, ret, gtlt, M, m, p, pr);
1666
+ const xM = isX(M);
1667
+ const xm = xM || isX(m);
1668
+ const xp = xm || isX(p);
1669
+ const anyX = xp;
1670
+ if (gtlt === "=" && anyX) {
1671
+ gtlt = "";
1672
+ }
1673
+ pr = options.includePrerelease ? "-0" : "";
1674
+ if (xM) {
1675
+ if (gtlt === ">" || gtlt === "<") {
1676
+ ret = "<0.0.0-0";
1677
+ } else {
1678
+ ret = "*";
1679
+ }
1680
+ } else if (gtlt && anyX) {
1681
+ if (xm) {
1682
+ m = 0;
1683
+ }
1684
+ p = 0;
1685
+ if (gtlt === ">") {
1686
+ gtlt = ">=";
1687
+ if (xm) {
1688
+ M = +M + 1;
1689
+ m = 0;
1690
+ p = 0;
1691
+ } else {
1692
+ m = +m + 1;
1693
+ p = 0;
1694
+ }
1695
+ } else if (gtlt === "<=") {
1696
+ gtlt = "<";
1697
+ if (xm) {
1698
+ M = +M + 1;
1699
+ } else {
1700
+ m = +m + 1;
1701
+ }
1702
+ }
1703
+ if (gtlt === "<") {
1704
+ pr = "-0";
1705
+ }
1706
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
1707
+ } else if (xm) {
1708
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1709
+ } else if (xp) {
1710
+ ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1711
+ }
1712
+ debug3("xRange return", ret);
1713
+ return ret;
1714
+ });
1715
+ };
1716
+ var replaceStars = (comp, options) => {
1717
+ debug3("replaceStars", comp, options);
1718
+ return comp.trim().replace(re[t.STAR], "");
1719
+ };
1720
+ var replaceGTE0 = (comp, options) => {
1721
+ debug3("replaceGTE0", comp, options);
1722
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1723
+ };
1724
+ var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
1725
+ if (isX(fM)) {
1726
+ from = "";
1727
+ } else if (isX(fm)) {
1728
+ from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1729
+ } else if (isX(fp)) {
1730
+ from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1731
+ } else if (fpr) {
1732
+ from = `>=${from}`;
1733
+ } else {
1734
+ from = `>=${from}${incPr ? "-0" : ""}`;
1735
+ }
1736
+ if (isX(tM)) {
1737
+ to = "";
1738
+ } else if (isX(tm)) {
1739
+ to = `<${+tM + 1}.0.0-0`;
1740
+ } else if (isX(tp)) {
1741
+ to = `<${tM}.${+tm + 1}.0-0`;
1742
+ } else if (tpr) {
1743
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
1744
+ } else if (incPr) {
1745
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
1746
+ } else {
1747
+ to = `<=${to}`;
1748
+ }
1749
+ return `${from} ${to}`.trim();
1750
+ };
1751
+ var testSet = (set, version2, options) => {
1752
+ for (let i = 0; i < set.length; i++) {
1753
+ if (!set[i].test(version2)) {
1754
+ return false;
1755
+ }
1756
+ }
1757
+ if (version2.prerelease.length && !options.includePrerelease) {
1758
+ for (let i = 0; i < set.length; i++) {
1759
+ debug3(set[i].semver);
1760
+ if (set[i].semver === Comparator.ANY) {
1761
+ continue;
1762
+ }
1763
+ if (set[i].semver.prerelease.length > 0) {
1764
+ const allowed = set[i].semver;
1765
+ if (allowed.major === version2.major && allowed.minor === version2.minor && allowed.patch === version2.patch) {
1766
+ return true;
1767
+ }
1768
+ }
1769
+ }
1770
+ return false;
1771
+ }
1772
+ return true;
1773
+ };
1774
+ }
1775
+ });
1776
+
1777
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/classes/comparator.js
1778
+ var require_comparator = __commonJS({
1779
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/classes/comparator.js"(exports, module2) {
1780
+ var ANY = Symbol("SemVer ANY");
1781
+ var Comparator = class _Comparator {
1782
+ static get ANY() {
1783
+ return ANY;
1784
+ }
1785
+ constructor(comp, options) {
1786
+ options = parseOptions(options);
1787
+ if (comp instanceof _Comparator) {
1788
+ if (comp.loose === !!options.loose) {
1789
+ return comp;
1790
+ } else {
1791
+ comp = comp.value;
1792
+ }
1793
+ }
1794
+ comp = comp.trim().split(/\s+/).join(" ");
1795
+ debug3("comparator", comp, options);
1796
+ this.options = options;
1797
+ this.loose = !!options.loose;
1798
+ this.parse(comp);
1799
+ if (this.semver === ANY) {
1800
+ this.value = "";
1801
+ } else {
1802
+ this.value = this.operator + this.semver.version;
1803
+ }
1804
+ debug3("comp", this);
1805
+ }
1806
+ parse(comp) {
1807
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1808
+ const m = comp.match(r);
1809
+ if (!m) {
1810
+ throw new TypeError(`Invalid comparator: ${comp}`);
1811
+ }
1812
+ this.operator = m[1] !== void 0 ? m[1] : "";
1813
+ if (this.operator === "=") {
1814
+ this.operator = "";
1815
+ }
1816
+ if (!m[2]) {
1817
+ this.semver = ANY;
1818
+ } else {
1819
+ this.semver = new SemVer(m[2], this.options.loose);
1820
+ }
1821
+ }
1822
+ toString() {
1823
+ return this.value;
1824
+ }
1825
+ test(version2) {
1826
+ debug3("Comparator.test", version2, this.options.loose);
1827
+ if (this.semver === ANY || version2 === ANY) {
1828
+ return true;
1829
+ }
1830
+ if (typeof version2 === "string") {
1831
+ try {
1832
+ version2 = new SemVer(version2, this.options);
1833
+ } catch (er) {
1834
+ return false;
1835
+ }
1836
+ }
1837
+ return cmp(version2, this.operator, this.semver, this.options);
1838
+ }
1839
+ intersects(comp, options) {
1840
+ if (!(comp instanceof _Comparator)) {
1841
+ throw new TypeError("a Comparator is required");
1842
+ }
1843
+ if (this.operator === "") {
1844
+ if (this.value === "") {
1845
+ return true;
1846
+ }
1847
+ return new Range(comp.value, options).test(this.value);
1848
+ } else if (comp.operator === "") {
1849
+ if (comp.value === "") {
1850
+ return true;
1851
+ }
1852
+ return new Range(this.value, options).test(comp.semver);
1853
+ }
1854
+ options = parseOptions(options);
1855
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
1856
+ return false;
1857
+ }
1858
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
1859
+ return false;
1860
+ }
1861
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
1862
+ return true;
1863
+ }
1864
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
1865
+ return true;
1866
+ }
1867
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
1868
+ return true;
1869
+ }
1870
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
1871
+ return true;
1872
+ }
1873
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
1874
+ return true;
1875
+ }
1876
+ return false;
1877
+ }
1878
+ };
1879
+ module2.exports = Comparator;
1880
+ var parseOptions = require_parse_options();
1881
+ var { safeRe: re, t } = require_re();
1882
+ var cmp = require_cmp();
1883
+ var debug3 = require_debug();
1884
+ var SemVer = require_semver();
1885
+ var Range = require_range();
1886
+ }
1887
+ });
1888
+
1889
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/satisfies.js
1890
+ var require_satisfies = __commonJS({
1891
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/functions/satisfies.js"(exports, module2) {
1892
+ var Range = require_range();
1893
+ var satisfies = (version2, range, options) => {
1894
+ try {
1895
+ range = new Range(range, options);
1896
+ } catch (er) {
1897
+ return false;
1898
+ }
1899
+ return range.test(version2);
1900
+ };
1901
+ module2.exports = satisfies;
1902
+ }
1903
+ });
1904
+
1905
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/to-comparators.js
1906
+ var require_to_comparators = __commonJS({
1907
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/to-comparators.js"(exports, module2) {
1908
+ var Range = require_range();
1909
+ var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
1910
+ module2.exports = toComparators;
1911
+ }
1912
+ });
1913
+
1914
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/max-satisfying.js
1915
+ var require_max_satisfying = __commonJS({
1916
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/max-satisfying.js"(exports, module2) {
1917
+ var SemVer = require_semver();
1918
+ var Range = require_range();
1919
+ var maxSatisfying = (versions, range, options) => {
1920
+ let max = null;
1921
+ let maxSV = null;
1922
+ let rangeObj = null;
1923
+ try {
1924
+ rangeObj = new Range(range, options);
1925
+ } catch (er) {
1926
+ return null;
1927
+ }
1928
+ versions.forEach((v) => {
1929
+ if (rangeObj.test(v)) {
1930
+ if (!max || maxSV.compare(v) === -1) {
1931
+ max = v;
1932
+ maxSV = new SemVer(max, options);
1933
+ }
1934
+ }
1935
+ });
1936
+ return max;
1937
+ };
1938
+ module2.exports = maxSatisfying;
1939
+ }
1940
+ });
1941
+
1942
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/min-satisfying.js
1943
+ var require_min_satisfying = __commonJS({
1944
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/min-satisfying.js"(exports, module2) {
1945
+ var SemVer = require_semver();
1946
+ var Range = require_range();
1947
+ var minSatisfying = (versions, range, options) => {
1948
+ let min = null;
1949
+ let minSV = null;
1950
+ let rangeObj = null;
1951
+ try {
1952
+ rangeObj = new Range(range, options);
1953
+ } catch (er) {
1954
+ return null;
1955
+ }
1956
+ versions.forEach((v) => {
1957
+ if (rangeObj.test(v)) {
1958
+ if (!min || minSV.compare(v) === 1) {
1959
+ min = v;
1960
+ minSV = new SemVer(min, options);
1961
+ }
1962
+ }
1963
+ });
1964
+ return min;
1965
+ };
1966
+ module2.exports = minSatisfying;
1967
+ }
1968
+ });
1969
+
1970
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/min-version.js
1971
+ var require_min_version = __commonJS({
1972
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/min-version.js"(exports, module2) {
1973
+ var SemVer = require_semver();
1974
+ var Range = require_range();
1975
+ var gt = require_gt();
1976
+ var minVersion = (range, loose) => {
1977
+ range = new Range(range, loose);
1978
+ let minver = new SemVer("0.0.0");
1979
+ if (range.test(minver)) {
1980
+ return minver;
1981
+ }
1982
+ minver = new SemVer("0.0.0-0");
1983
+ if (range.test(minver)) {
1984
+ return minver;
1985
+ }
1986
+ minver = null;
1987
+ for (let i = 0; i < range.set.length; ++i) {
1988
+ const comparators = range.set[i];
1989
+ let setMin = null;
1990
+ comparators.forEach((comparator) => {
1991
+ const compver = new SemVer(comparator.semver.version);
1992
+ switch (comparator.operator) {
1993
+ case ">":
1994
+ if (compver.prerelease.length === 0) {
1995
+ compver.patch++;
1996
+ } else {
1997
+ compver.prerelease.push(0);
1998
+ }
1999
+ compver.raw = compver.format();
2000
+ case "":
2001
+ case ">=":
2002
+ if (!setMin || gt(compver, setMin)) {
2003
+ setMin = compver;
2004
+ }
2005
+ break;
2006
+ case "<":
2007
+ case "<=":
2008
+ break;
2009
+ default:
2010
+ throw new Error(`Unexpected operation: ${comparator.operator}`);
2011
+ }
2012
+ });
2013
+ if (setMin && (!minver || gt(minver, setMin))) {
2014
+ minver = setMin;
2015
+ }
2016
+ }
2017
+ if (minver && range.test(minver)) {
2018
+ return minver;
2019
+ }
2020
+ return null;
2021
+ };
2022
+ module2.exports = minVersion;
2023
+ }
2024
+ });
2025
+
2026
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/valid.js
2027
+ var require_valid2 = __commonJS({
2028
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/valid.js"(exports, module2) {
2029
+ var Range = require_range();
2030
+ var validRange = (range, options) => {
2031
+ try {
2032
+ return new Range(range, options).range || "*";
2033
+ } catch (er) {
2034
+ return null;
2035
+ }
2036
+ };
2037
+ module2.exports = validRange;
2038
+ }
2039
+ });
2040
+
2041
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/outside.js
2042
+ var require_outside = __commonJS({
2043
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/outside.js"(exports, module2) {
2044
+ var SemVer = require_semver();
2045
+ var Comparator = require_comparator();
2046
+ var { ANY } = Comparator;
2047
+ var Range = require_range();
2048
+ var satisfies = require_satisfies();
2049
+ var gt = require_gt();
2050
+ var lt = require_lt();
2051
+ var lte = require_lte();
2052
+ var gte = require_gte();
2053
+ var outside = (version2, range, hilo, options) => {
2054
+ version2 = new SemVer(version2, options);
2055
+ range = new Range(range, options);
2056
+ let gtfn, ltefn, ltfn, comp, ecomp;
2057
+ switch (hilo) {
2058
+ case ">":
2059
+ gtfn = gt;
2060
+ ltefn = lte;
2061
+ ltfn = lt;
2062
+ comp = ">";
2063
+ ecomp = ">=";
2064
+ break;
2065
+ case "<":
2066
+ gtfn = lt;
2067
+ ltefn = gte;
2068
+ ltfn = gt;
2069
+ comp = "<";
2070
+ ecomp = "<=";
2071
+ break;
2072
+ default:
2073
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
2074
+ }
2075
+ if (satisfies(version2, range, options)) {
2076
+ return false;
2077
+ }
2078
+ for (let i = 0; i < range.set.length; ++i) {
2079
+ const comparators = range.set[i];
2080
+ let high = null;
2081
+ let low = null;
2082
+ comparators.forEach((comparator) => {
2083
+ if (comparator.semver === ANY) {
2084
+ comparator = new Comparator(">=0.0.0");
2085
+ }
2086
+ high = high || comparator;
2087
+ low = low || comparator;
2088
+ if (gtfn(comparator.semver, high.semver, options)) {
2089
+ high = comparator;
2090
+ } else if (ltfn(comparator.semver, low.semver, options)) {
2091
+ low = comparator;
2092
+ }
2093
+ });
2094
+ if (high.operator === comp || high.operator === ecomp) {
2095
+ return false;
2096
+ }
2097
+ if ((!low.operator || low.operator === comp) && ltefn(version2, low.semver)) {
2098
+ return false;
2099
+ } else if (low.operator === ecomp && ltfn(version2, low.semver)) {
2100
+ return false;
2101
+ }
2102
+ }
2103
+ return true;
2104
+ };
2105
+ module2.exports = outside;
2106
+ }
2107
+ });
2108
+
2109
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/gtr.js
2110
+ var require_gtr = __commonJS({
2111
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/gtr.js"(exports, module2) {
2112
+ var outside = require_outside();
2113
+ var gtr = (version2, range, options) => outside(version2, range, ">", options);
2114
+ module2.exports = gtr;
2115
+ }
2116
+ });
2117
+
2118
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/ltr.js
2119
+ var require_ltr = __commonJS({
2120
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/ltr.js"(exports, module2) {
2121
+ var outside = require_outside();
2122
+ var ltr = (version2, range, options) => outside(version2, range, "<", options);
2123
+ module2.exports = ltr;
2124
+ }
2125
+ });
2126
+
2127
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/intersects.js
2128
+ var require_intersects = __commonJS({
2129
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/intersects.js"(exports, module2) {
2130
+ var Range = require_range();
2131
+ var intersects = (r1, r2, options) => {
2132
+ r1 = new Range(r1, options);
2133
+ r2 = new Range(r2, options);
2134
+ return r1.intersects(r2, options);
2135
+ };
2136
+ module2.exports = intersects;
2137
+ }
2138
+ });
2139
+
2140
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/simplify.js
2141
+ var require_simplify = __commonJS({
2142
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/simplify.js"(exports, module2) {
2143
+ var satisfies = require_satisfies();
2144
+ var compare = require_compare();
2145
+ module2.exports = (versions, range, options) => {
2146
+ const set = [];
2147
+ let first = null;
2148
+ let prev = null;
2149
+ const v = versions.sort((a, b) => compare(a, b, options));
2150
+ for (const version2 of v) {
2151
+ const included = satisfies(version2, range, options);
2152
+ if (included) {
2153
+ prev = version2;
2154
+ if (!first) {
2155
+ first = version2;
2156
+ }
2157
+ } else {
2158
+ if (prev) {
2159
+ set.push([first, prev]);
2160
+ }
2161
+ prev = null;
2162
+ first = null;
2163
+ }
2164
+ }
2165
+ if (first) {
2166
+ set.push([first, null]);
2167
+ }
2168
+ const ranges = [];
2169
+ for (const [min, max] of set) {
2170
+ if (min === max) {
2171
+ ranges.push(min);
2172
+ } else if (!max && min === v[0]) {
2173
+ ranges.push("*");
2174
+ } else if (!max) {
2175
+ ranges.push(`>=${min}`);
2176
+ } else if (min === v[0]) {
2177
+ ranges.push(`<=${max}`);
2178
+ } else {
2179
+ ranges.push(`${min} - ${max}`);
2180
+ }
2181
+ }
2182
+ const simplified = ranges.join(" || ");
2183
+ const original = typeof range.raw === "string" ? range.raw : String(range);
2184
+ return simplified.length < original.length ? simplified : range;
2185
+ };
2186
+ }
2187
+ });
2188
+
2189
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/subset.js
2190
+ var require_subset = __commonJS({
2191
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/ranges/subset.js"(exports, module2) {
2192
+ var Range = require_range();
2193
+ var Comparator = require_comparator();
2194
+ var { ANY } = Comparator;
2195
+ var satisfies = require_satisfies();
2196
+ var compare = require_compare();
2197
+ var subset = (sub, dom, options = {}) => {
2198
+ if (sub === dom) {
2199
+ return true;
2200
+ }
2201
+ sub = new Range(sub, options);
2202
+ dom = new Range(dom, options);
2203
+ let sawNonNull = false;
2204
+ OUTER:
2205
+ for (const simpleSub of sub.set) {
2206
+ for (const simpleDom of dom.set) {
2207
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
2208
+ sawNonNull = sawNonNull || isSub !== null;
2209
+ if (isSub) {
2210
+ continue OUTER;
2211
+ }
2212
+ }
2213
+ if (sawNonNull) {
2214
+ return false;
2215
+ }
2216
+ }
2217
+ return true;
2218
+ };
2219
+ var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
2220
+ var minimumVersion = [new Comparator(">=0.0.0")];
2221
+ var simpleSubset = (sub, dom, options) => {
2222
+ if (sub === dom) {
2223
+ return true;
2224
+ }
2225
+ if (sub.length === 1 && sub[0].semver === ANY) {
2226
+ if (dom.length === 1 && dom[0].semver === ANY) {
2227
+ return true;
2228
+ } else if (options.includePrerelease) {
2229
+ sub = minimumVersionWithPreRelease;
2230
+ } else {
2231
+ sub = minimumVersion;
2232
+ }
2233
+ }
2234
+ if (dom.length === 1 && dom[0].semver === ANY) {
2235
+ if (options.includePrerelease) {
2236
+ return true;
2237
+ } else {
2238
+ dom = minimumVersion;
2239
+ }
2240
+ }
2241
+ const eqSet = /* @__PURE__ */ new Set();
2242
+ let gt, lt;
2243
+ for (const c of sub) {
2244
+ if (c.operator === ">" || c.operator === ">=") {
2245
+ gt = higherGT(gt, c, options);
2246
+ } else if (c.operator === "<" || c.operator === "<=") {
2247
+ lt = lowerLT(lt, c, options);
2248
+ } else {
2249
+ eqSet.add(c.semver);
2250
+ }
2251
+ }
2252
+ if (eqSet.size > 1) {
2253
+ return null;
2254
+ }
2255
+ let gtltComp;
2256
+ if (gt && lt) {
2257
+ gtltComp = compare(gt.semver, lt.semver, options);
2258
+ if (gtltComp > 0) {
2259
+ return null;
2260
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
2261
+ return null;
2262
+ }
2263
+ }
2264
+ for (const eq of eqSet) {
2265
+ if (gt && !satisfies(eq, String(gt), options)) {
2266
+ return null;
2267
+ }
2268
+ if (lt && !satisfies(eq, String(lt), options)) {
2269
+ return null;
2270
+ }
2271
+ for (const c of dom) {
2272
+ if (!satisfies(eq, String(c), options)) {
2273
+ return false;
2274
+ }
2275
+ }
2276
+ return true;
2277
+ }
2278
+ let higher, lower;
2279
+ let hasDomLT, hasDomGT;
2280
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
2281
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
2282
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
2283
+ needDomLTPre = false;
2284
+ }
2285
+ for (const c of dom) {
2286
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
2287
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
2288
+ if (gt) {
2289
+ if (needDomGTPre) {
2290
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
2291
+ needDomGTPre = false;
2292
+ }
2293
+ }
2294
+ if (c.operator === ">" || c.operator === ">=") {
2295
+ higher = higherGT(gt, c, options);
2296
+ if (higher === c && higher !== gt) {
2297
+ return false;
2298
+ }
2299
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
2300
+ return false;
2301
+ }
2302
+ }
2303
+ if (lt) {
2304
+ if (needDomLTPre) {
2305
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
2306
+ needDomLTPre = false;
2307
+ }
2308
+ }
2309
+ if (c.operator === "<" || c.operator === "<=") {
2310
+ lower = lowerLT(lt, c, options);
2311
+ if (lower === c && lower !== lt) {
2312
+ return false;
2313
+ }
2314
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
2315
+ return false;
2316
+ }
2317
+ }
2318
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
2319
+ return false;
2320
+ }
2321
+ }
2322
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
2323
+ return false;
2324
+ }
2325
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
2326
+ return false;
2327
+ }
2328
+ if (needDomGTPre || needDomLTPre) {
2329
+ return false;
2330
+ }
2331
+ return true;
2332
+ };
2333
+ var higherGT = (a, b, options) => {
2334
+ if (!a) {
2335
+ return b;
2336
+ }
2337
+ const comp = compare(a.semver, b.semver, options);
2338
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
2339
+ };
2340
+ var lowerLT = (a, b, options) => {
2341
+ if (!a) {
2342
+ return b;
2343
+ }
2344
+ const comp = compare(a.semver, b.semver, options);
2345
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
2346
+ };
2347
+ module2.exports = subset;
2348
+ }
2349
+ });
2350
+
2351
+ // ../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/index.js
2352
+ var require_semver2 = __commonJS({
2353
+ "../../node_modules/.pnpm/semver@7.5.2/node_modules/semver/index.js"(exports, module2) {
2354
+ var internalRe = require_re();
2355
+ var constants = require_constants();
2356
+ var SemVer = require_semver();
2357
+ var identifiers = require_identifiers();
2358
+ var parse = require_parse();
2359
+ var valid = require_valid();
2360
+ var clean = require_clean();
2361
+ var inc = require_inc();
2362
+ var diff = require_diff();
2363
+ var major = require_major();
2364
+ var minor = require_minor();
2365
+ var patch = require_patch();
2366
+ var prerelease = require_prerelease();
2367
+ var compare = require_compare();
2368
+ var rcompare = require_rcompare();
2369
+ var compareLoose = require_compare_loose();
2370
+ var compareBuild = require_compare_build();
2371
+ var sort = require_sort();
2372
+ var rsort = require_rsort();
2373
+ var gt = require_gt();
2374
+ var lt = require_lt();
2375
+ var eq = require_eq();
2376
+ var neq = require_neq();
2377
+ var gte = require_gte();
2378
+ var lte = require_lte();
2379
+ var cmp = require_cmp();
2380
+ var coerce = require_coerce();
2381
+ var Comparator = require_comparator();
2382
+ var Range = require_range();
2383
+ var satisfies = require_satisfies();
2384
+ var toComparators = require_to_comparators();
2385
+ var maxSatisfying = require_max_satisfying();
2386
+ var minSatisfying = require_min_satisfying();
2387
+ var minVersion = require_min_version();
2388
+ var validRange = require_valid2();
2389
+ var outside = require_outside();
2390
+ var gtr = require_gtr();
2391
+ var ltr = require_ltr();
2392
+ var intersects = require_intersects();
2393
+ var simplifyRange = require_simplify();
2394
+ var subset = require_subset();
2395
+ module2.exports = {
2396
+ parse,
2397
+ valid,
2398
+ clean,
2399
+ inc,
2400
+ diff,
2401
+ major,
2402
+ minor,
2403
+ patch,
2404
+ prerelease,
2405
+ compare,
2406
+ rcompare,
2407
+ compareLoose,
2408
+ compareBuild,
2409
+ sort,
2410
+ rsort,
2411
+ gt,
2412
+ lt,
2413
+ eq,
2414
+ neq,
2415
+ gte,
2416
+ lte,
2417
+ cmp,
2418
+ coerce,
2419
+ Comparator,
2420
+ Range,
2421
+ satisfies,
2422
+ toComparators,
2423
+ maxSatisfying,
2424
+ minSatisfying,
2425
+ minVersion,
2426
+ validRange,
2427
+ outside,
2428
+ gtr,
2429
+ ltr,
2430
+ intersects,
2431
+ simplifyRange,
2432
+ subset,
2433
+ SemVer,
2434
+ re: internalRe.re,
2435
+ src: internalRe.src,
2436
+ tokens: internalRe.t,
2437
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
2438
+ RELEASE_TYPES: constants.RELEASE_TYPES,
2439
+ compareIdentifiers: identifiers.compareIdentifiers,
2440
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
2441
+ };
2442
+ }
2443
+ });
2444
+
2445
+ // ../../node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/dist/index.js
2446
+ var require_dist = __commonJS({
2447
+ "../../node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/dist/index.js"(exports) {
2448
+ "use strict";
2449
+ Object.defineProperty(exports, "__esModule", { value: true });
2450
+ exports.pathToRegexp = exports.tokensToRegexp = exports.regexpToFunction = exports.match = exports.tokensToFunction = exports.compile = exports.parse = void 0;
2451
+ function lexer(str) {
2452
+ var tokens = [];
2453
+ var i = 0;
2454
+ while (i < str.length) {
2455
+ var char = str[i];
2456
+ if (char === "*" || char === "+" || char === "?") {
2457
+ tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
2458
+ continue;
2459
+ }
2460
+ if (char === "\\") {
2461
+ tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
2462
+ continue;
2463
+ }
2464
+ if (char === "{") {
2465
+ tokens.push({ type: "OPEN", index: i, value: str[i++] });
2466
+ continue;
2467
+ }
2468
+ if (char === "}") {
2469
+ tokens.push({ type: "CLOSE", index: i, value: str[i++] });
2470
+ continue;
2471
+ }
2472
+ if (char === ":") {
2473
+ var name = "";
2474
+ var j = i + 1;
2475
+ while (j < str.length) {
2476
+ var code = str.charCodeAt(j);
2477
+ if (
2478
+ // `0-9`
2479
+ code >= 48 && code <= 57 || // `A-Z`
2480
+ code >= 65 && code <= 90 || // `a-z`
2481
+ code >= 97 && code <= 122 || // `_`
2482
+ code === 95
2483
+ ) {
2484
+ name += str[j++];
2485
+ continue;
2486
+ }
2487
+ break;
2488
+ }
2489
+ if (!name)
2490
+ throw new TypeError("Missing parameter name at ".concat(i));
2491
+ tokens.push({ type: "NAME", index: i, value: name });
2492
+ i = j;
2493
+ continue;
2494
+ }
2495
+ if (char === "(") {
2496
+ var count = 1;
2497
+ var pattern = "";
2498
+ var j = i + 1;
2499
+ if (str[j] === "?") {
2500
+ throw new TypeError('Pattern cannot start with "?" at '.concat(j));
2501
+ }
2502
+ while (j < str.length) {
2503
+ if (str[j] === "\\") {
2504
+ pattern += str[j++] + str[j++];
2505
+ continue;
2506
+ }
2507
+ if (str[j] === ")") {
2508
+ count--;
2509
+ if (count === 0) {
2510
+ j++;
2511
+ break;
2512
+ }
2513
+ } else if (str[j] === "(") {
2514
+ count++;
2515
+ if (str[j + 1] !== "?") {
2516
+ throw new TypeError("Capturing groups are not allowed at ".concat(j));
2517
+ }
2518
+ }
2519
+ pattern += str[j++];
2520
+ }
2521
+ if (count)
2522
+ throw new TypeError("Unbalanced pattern at ".concat(i));
2523
+ if (!pattern)
2524
+ throw new TypeError("Missing pattern at ".concat(i));
2525
+ tokens.push({ type: "PATTERN", index: i, value: pattern });
2526
+ i = j;
2527
+ continue;
2528
+ }
2529
+ tokens.push({ type: "CHAR", index: i, value: str[i++] });
2530
+ }
2531
+ tokens.push({ type: "END", index: i, value: "" });
2532
+ return tokens;
2533
+ }
2534
+ function parse(str, options) {
2535
+ if (options === void 0) {
2536
+ options = {};
2537
+ }
2538
+ var tokens = lexer(str);
2539
+ var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a;
2540
+ var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?");
2541
+ var result = [];
2542
+ var key = 0;
2543
+ var i = 0;
2544
+ var path = "";
2545
+ var tryConsume = function(type) {
2546
+ if (i < tokens.length && tokens[i].type === type)
2547
+ return tokens[i++].value;
2548
+ };
2549
+ var mustConsume = function(type) {
2550
+ var value2 = tryConsume(type);
2551
+ if (value2 !== void 0)
2552
+ return value2;
2553
+ var _a2 = tokens[i], nextType = _a2.type, index = _a2.index;
2554
+ throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
2555
+ };
2556
+ var consumeText = function() {
2557
+ var result2 = "";
2558
+ var value2;
2559
+ while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
2560
+ result2 += value2;
2561
+ }
2562
+ return result2;
2563
+ };
2564
+ while (i < tokens.length) {
2565
+ var char = tryConsume("CHAR");
2566
+ var name = tryConsume("NAME");
2567
+ var pattern = tryConsume("PATTERN");
2568
+ if (name || pattern) {
2569
+ var prefix = char || "";
2570
+ if (prefixes.indexOf(prefix) === -1) {
2571
+ path += prefix;
2572
+ prefix = "";
2573
+ }
2574
+ if (path) {
2575
+ result.push(path);
2576
+ path = "";
2577
+ }
2578
+ result.push({
2579
+ name: name || key++,
2580
+ prefix,
2581
+ suffix: "",
2582
+ pattern: pattern || defaultPattern,
2583
+ modifier: tryConsume("MODIFIER") || ""
2584
+ });
2585
+ continue;
2586
+ }
2587
+ var value = char || tryConsume("ESCAPED_CHAR");
2588
+ if (value) {
2589
+ path += value;
2590
+ continue;
2591
+ }
2592
+ if (path) {
2593
+ result.push(path);
2594
+ path = "";
2595
+ }
2596
+ var open = tryConsume("OPEN");
2597
+ if (open) {
2598
+ var prefix = consumeText();
2599
+ var name_1 = tryConsume("NAME") || "";
2600
+ var pattern_1 = tryConsume("PATTERN") || "";
2601
+ var suffix = consumeText();
2602
+ mustConsume("CLOSE");
2603
+ result.push({
2604
+ name: name_1 || (pattern_1 ? key++ : ""),
2605
+ pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1,
2606
+ prefix,
2607
+ suffix,
2608
+ modifier: tryConsume("MODIFIER") || ""
2609
+ });
2610
+ continue;
2611
+ }
2612
+ mustConsume("END");
2613
+ }
2614
+ return result;
2615
+ }
2616
+ exports.parse = parse;
2617
+ function compile(str, options) {
2618
+ return tokensToFunction(parse(str, options), options);
2619
+ }
2620
+ exports.compile = compile;
2621
+ function tokensToFunction(tokens, options) {
2622
+ if (options === void 0) {
2623
+ options = {};
2624
+ }
2625
+ var reFlags = flags(options);
2626
+ var _a = options.encode, encode = _a === void 0 ? function(x) {
2627
+ return x;
2628
+ } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
2629
+ var matches = tokens.map(function(token) {
2630
+ if (typeof token === "object") {
2631
+ return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
2632
+ }
2633
+ });
2634
+ return function(data) {
2635
+ var path = "";
2636
+ for (var i = 0; i < tokens.length; i++) {
2637
+ var token = tokens[i];
2638
+ if (typeof token === "string") {
2639
+ path += token;
2640
+ continue;
2641
+ }
2642
+ var value = data ? data[token.name] : void 0;
2643
+ var optional = token.modifier === "?" || token.modifier === "*";
2644
+ var repeat = token.modifier === "*" || token.modifier === "+";
2645
+ if (Array.isArray(value)) {
2646
+ if (!repeat) {
2647
+ throw new TypeError('Expected "'.concat(token.name, '" to not repeat, but got an array'));
2648
+ }
2649
+ if (value.length === 0) {
2650
+ if (optional)
2651
+ continue;
2652
+ throw new TypeError('Expected "'.concat(token.name, '" to not be empty'));
2653
+ }
2654
+ for (var j = 0; j < value.length; j++) {
2655
+ var segment = encode(value[j], token);
2656
+ if (validate && !matches[i].test(segment)) {
2657
+ throw new TypeError('Expected all "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
2658
+ }
2659
+ path += token.prefix + segment + token.suffix;
2660
+ }
2661
+ continue;
2662
+ }
2663
+ if (typeof value === "string" || typeof value === "number") {
2664
+ var segment = encode(String(value), token);
2665
+ if (validate && !matches[i].test(segment)) {
2666
+ throw new TypeError('Expected "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
2667
+ }
2668
+ path += token.prefix + segment + token.suffix;
2669
+ continue;
2670
+ }
2671
+ if (optional)
2672
+ continue;
2673
+ var typeOfMessage = repeat ? "an array" : "a string";
2674
+ throw new TypeError('Expected "'.concat(token.name, '" to be ').concat(typeOfMessage));
2675
+ }
2676
+ return path;
2677
+ };
2678
+ }
2679
+ exports.tokensToFunction = tokensToFunction;
2680
+ function match(str, options) {
2681
+ var keys = [];
2682
+ var re = pathToRegexp2(str, keys, options);
2683
+ return regexpToFunction(re, keys, options);
2684
+ }
2685
+ exports.match = match;
2686
+ function regexpToFunction(re, keys, options) {
2687
+ if (options === void 0) {
2688
+ options = {};
2689
+ }
2690
+ var _a = options.decode, decode = _a === void 0 ? function(x) {
2691
+ return x;
2692
+ } : _a;
2693
+ return function(pathname) {
2694
+ var m = re.exec(pathname);
2695
+ if (!m)
2696
+ return false;
2697
+ var path = m[0], index = m.index;
2698
+ var params = /* @__PURE__ */ Object.create(null);
2699
+ var _loop_1 = function(i2) {
2700
+ if (m[i2] === void 0)
2701
+ return "continue";
2702
+ var key = keys[i2 - 1];
2703
+ if (key.modifier === "*" || key.modifier === "+") {
2704
+ params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value) {
2705
+ return decode(value, key);
2706
+ });
2707
+ } else {
2708
+ params[key.name] = decode(m[i2], key);
2709
+ }
2710
+ };
2711
+ for (var i = 1; i < m.length; i++) {
2712
+ _loop_1(i);
2713
+ }
2714
+ return { path, index, params };
2715
+ };
2716
+ }
2717
+ exports.regexpToFunction = regexpToFunction;
2718
+ function escapeString(str) {
2719
+ return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
2720
+ }
2721
+ function flags(options) {
2722
+ return options && options.sensitive ? "" : "i";
2723
+ }
2724
+ function regexpToRegexp(path, keys) {
2725
+ if (!keys)
2726
+ return path;
2727
+ var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
2728
+ var index = 0;
2729
+ var execResult = groupsRegex.exec(path.source);
2730
+ while (execResult) {
2731
+ keys.push({
2732
+ // Use parenthesized substring match if available, index otherwise
2733
+ name: execResult[1] || index++,
2734
+ prefix: "",
2735
+ suffix: "",
2736
+ modifier: "",
2737
+ pattern: ""
2738
+ });
2739
+ execResult = groupsRegex.exec(path.source);
2740
+ }
2741
+ return path;
2742
+ }
2743
+ function arrayToRegexp(paths, keys, options) {
2744
+ var parts = paths.map(function(path) {
2745
+ return pathToRegexp2(path, keys, options).source;
2746
+ });
2747
+ return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
2748
+ }
2749
+ function stringToRegexp(path, keys, options) {
2750
+ return tokensToRegexp(parse(path, options), keys, options);
2751
+ }
2752
+ function tokensToRegexp(tokens, keys, options) {
2753
+ if (options === void 0) {
2754
+ options = {};
2755
+ }
2756
+ var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
2757
+ return x;
2758
+ } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
2759
+ var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
2760
+ var delimiterRe = "[".concat(escapeString(delimiter), "]");
2761
+ var route = start ? "^" : "";
2762
+ for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
2763
+ var token = tokens_1[_i];
2764
+ if (typeof token === "string") {
2765
+ route += escapeString(encode(token));
2766
+ } else {
2767
+ var prefix = escapeString(encode(token.prefix));
2768
+ var suffix = escapeString(encode(token.suffix));
2769
+ if (token.pattern) {
2770
+ if (keys)
2771
+ keys.push(token);
2772
+ if (prefix || suffix) {
2773
+ if (token.modifier === "+" || token.modifier === "*") {
2774
+ var mod = token.modifier === "*" ? "?" : "";
2775
+ route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
2776
+ } else {
2777
+ route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
2778
+ }
2779
+ } else {
2780
+ if (token.modifier === "+" || token.modifier === "*") {
2781
+ route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")");
2782
+ } else {
2783
+ route += "(".concat(token.pattern, ")").concat(token.modifier);
2784
+ }
2785
+ }
2786
+ } else {
2787
+ route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
2788
+ }
2789
+ }
2790
+ }
2791
+ if (end) {
2792
+ if (!strict)
2793
+ route += "".concat(delimiterRe, "?");
2794
+ route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
2795
+ } else {
2796
+ var endToken = tokens[tokens.length - 1];
2797
+ var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
2798
+ if (!strict) {
2799
+ route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
2800
+ }
2801
+ if (!isEndDelimited) {
2802
+ route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
2803
+ }
2804
+ }
2805
+ return new RegExp(route, flags(options));
2806
+ }
2807
+ exports.tokensToRegexp = tokensToRegexp;
2808
+ function pathToRegexp2(path, keys, options) {
2809
+ if (path instanceof RegExp)
2810
+ return regexpToRegexp(path, keys);
2811
+ if (Array.isArray(path))
2812
+ return arrayToRegexp(path, keys, options);
2813
+ return stringToRegexp(path, keys, options);
2814
+ }
2815
+ exports.pathToRegexp = pathToRegexp2;
2816
+ }
2817
+ });
2818
+
2819
+ // src/index.ts
20
2820
  var src_exports = {};
21
2821
  __export(src_exports, {
2822
+ build: () => build,
2823
+ prepareCache: () => prepareCache,
22
2824
  version: () => version
23
2825
  });
24
2826
  module.exports = __toCommonJS(src_exports);
25
- __reExport(src_exports, require("./build"), module.exports);
26
- __reExport(src_exports, require("./prepare-cache"), module.exports);
27
- const version = 2;
2827
+
2828
+ // src/build.ts
2829
+ var import_ts_morph2 = require("ts-morph");
2830
+ var import_fs2 = require("fs");
2831
+ var import_path3 = require("path");
2832
+ var import_build_utils3 = require("@vercel/build-utils");
2833
+ var import_static_config = require("@vercel/static-config");
2834
+ var import_nft = require("@vercel/nft");
2835
+
2836
+ // src/utils.ts
2837
+ var import_semver = __toESM(require_semver2());
2838
+ var import_child_process = require("child_process");
2839
+ var import_fs = require("fs");
2840
+ var import_path = require("path");
2841
+ var import_path_to_regexp = __toESM(require_dist());
2842
+ var import_build_utils = require("@vercel/build-utils");
2843
+ var import_build_utils2 = require("@vercel/build-utils");
2844
+ var import_module = require("module");
2845
+ var require_ = (0, import_module.createRequire)(__filename);
2846
+ var SPLAT_PATH = "/:params*";
2847
+ var entryExts = [".js", ".jsx", ".ts", ".tsx"];
2848
+ function findEntry(dir, basename4) {
2849
+ for (const ext of entryExts) {
2850
+ const file = (0, import_path.resolve)(dir, basename4 + ext);
2851
+ if ((0, import_fs.existsSync)(file))
2852
+ return (0, import_path.relative)(dir, file);
2853
+ }
2854
+ return void 0;
2855
+ }
2856
+ var configExts = [".js", ".cjs", ".mjs"];
2857
+ function findConfig(dir, basename4) {
2858
+ for (const ext of configExts) {
2859
+ const name = basename4 + ext;
2860
+ const file = (0, import_path.join)(dir, name);
2861
+ if ((0, import_fs.existsSync)(file))
2862
+ return file;
2863
+ }
2864
+ return void 0;
2865
+ }
2866
+ function isEdgeRuntime(runtime) {
2867
+ return runtime === "edge" || runtime === "experimental-edge";
2868
+ }
2869
+ function getResolvedRouteConfig(route, routes, configs, isHydrogen2) {
2870
+ let runtime;
2871
+ let regions;
2872
+ let maxDuration;
2873
+ let memory;
2874
+ for (const currentRoute of getRouteIterator(route, routes)) {
2875
+ const staticConfig = configs.get(currentRoute);
2876
+ if (staticConfig) {
2877
+ if (typeof runtime === "undefined" && staticConfig.runtime) {
2878
+ runtime = isEdgeRuntime(staticConfig.runtime) ? "edge" : "nodejs";
2879
+ }
2880
+ if (typeof regions === "undefined") {
2881
+ regions = staticConfig.regions;
2882
+ }
2883
+ if (typeof maxDuration === "undefined") {
2884
+ maxDuration = staticConfig.maxDuration;
2885
+ }
2886
+ if (typeof memory === "undefined") {
2887
+ memory = staticConfig.memory;
2888
+ }
2889
+ }
2890
+ }
2891
+ if (Array.isArray(regions)) {
2892
+ regions = Array.from(new Set(regions)).sort();
2893
+ }
2894
+ if (isHydrogen2 || runtime === "edge") {
2895
+ return { runtime: "edge", regions };
2896
+ }
2897
+ if (regions && !Array.isArray(regions)) {
2898
+ throw new Error(
2899
+ `"regions" for route "${route.id}" must be an array of strings`
2900
+ );
2901
+ }
2902
+ return { runtime: "nodejs", regions, maxDuration, memory };
2903
+ }
2904
+ function calculateRouteConfigHash(config) {
2905
+ const str = JSON.stringify(config);
2906
+ return Buffer.from(str).toString("base64url");
2907
+ }
2908
+ function isLayoutRoute(routeId, routes) {
2909
+ return routes.some((r) => r.parentId === routeId);
2910
+ }
2911
+ function* getRouteIterator(route, routes) {
2912
+ let currentRoute = route;
2913
+ do {
2914
+ yield currentRoute;
2915
+ if (currentRoute.parentId) {
2916
+ currentRoute = routes[currentRoute.parentId];
2917
+ } else {
2918
+ break;
2919
+ }
2920
+ } while (currentRoute);
2921
+ }
2922
+ function getPathFromRoute(route, routes) {
2923
+ if (route.id === "root" || route.parentId === "root" && !route.path && route.index) {
2924
+ return { path: "index", rePath: "/index" };
2925
+ }
2926
+ const pathParts = [];
2927
+ const rePathParts = [];
2928
+ for (const currentRoute of getRouteIterator(route, routes)) {
2929
+ if (!currentRoute.path)
2930
+ continue;
2931
+ const currentRouteParts = currentRoute.path.split("/").reverse();
2932
+ for (const part of currentRouteParts) {
2933
+ if (part.endsWith("?")) {
2934
+ if (part.startsWith(":")) {
2935
+ pathParts.push(`(${part.substring(0, part.length - 1)})`);
2936
+ rePathParts.push(part);
2937
+ } else {
2938
+ const p = `(${part.substring(0, part.length - 1)})`;
2939
+ pathParts.push(p);
2940
+ rePathParts.push(`${p}?`);
2941
+ }
2942
+ } else {
2943
+ pathParts.push(part);
2944
+ rePathParts.push(part);
2945
+ }
2946
+ }
2947
+ }
2948
+ const path = pathParts.reverse().join("/");
2949
+ let rePath = rePathParts.reverse().join("/");
2950
+ rePath = rePath === "*" ? SPLAT_PATH : `/${rePath.replace(/\/\*$/, SPLAT_PATH)}`;
2951
+ return { path, rePath };
2952
+ }
2953
+ function getRegExpFromPath(rePath) {
2954
+ const keys = [];
2955
+ const re = (0, import_path_to_regexp.pathToRegexp)(rePath, keys);
2956
+ return keys.length > 0 ? re : false;
2957
+ }
2958
+ async function chdirAndReadConfig(remixRunDevPath, dir, packageJsonPath) {
2959
+ const { readConfig } = await import((0, import_path.join)(remixRunDevPath, "dist/config.js"));
2960
+ const originalCwd = process.cwd();
2961
+ let modifiedPackageJson = false;
2962
+ const pkgRaw = await import_fs.promises.readFile(packageJsonPath, "utf8");
2963
+ const pkg = JSON.parse(pkgRaw);
2964
+ if (!pkg.dependencies?.["isbot"]) {
2965
+ pkg.dependencies.isbot = "latest";
2966
+ await import_fs.promises.writeFile(packageJsonPath, JSON.stringify(pkg));
2967
+ modifiedPackageJson = true;
2968
+ }
2969
+ const warn = console.warn;
2970
+ console.warn = import_build_utils.debug;
2971
+ let remixConfig;
2972
+ try {
2973
+ process.chdir(dir);
2974
+ remixConfig = await readConfig(dir);
2975
+ } finally {
2976
+ console.warn = warn;
2977
+ process.chdir(originalCwd);
2978
+ if (modifiedPackageJson) {
2979
+ await import_fs.promises.writeFile(packageJsonPath, pkgRaw);
2980
+ }
2981
+ }
2982
+ return remixConfig;
2983
+ }
2984
+ function addDependencies(cliType, names, opts = {}) {
2985
+ (0, import_build_utils.debug)("Installing additional dependencies:");
2986
+ for (const name of names) {
2987
+ (0, import_build_utils.debug)(` - ${name}`);
2988
+ }
2989
+ const args = [];
2990
+ if (cliType === "npm" || cliType === "pnpm") {
2991
+ args.push("install");
2992
+ if (opts.saveDev) {
2993
+ args.push("--save-dev");
2994
+ }
2995
+ } else {
2996
+ args.push("add");
2997
+ if (opts.saveDev) {
2998
+ args.push("--dev");
2999
+ }
3000
+ const yarnVersion = (0, import_child_process.execSync)("yarn -v", { encoding: "utf8" }).trim();
3001
+ const isYarnV1 = import_semver.default.satisfies(yarnVersion, "1");
3002
+ if (isYarnV1) {
3003
+ args.push("--ignore-workspace-root-check");
3004
+ }
3005
+ }
3006
+ if (cliType === "pnpm" && opts.cwd) {
3007
+ if ((0, import_fs.existsSync)((0, import_path.join)(opts.cwd, "pnpm-workspace.yaml"))) {
3008
+ args.push("--workspace-root");
3009
+ }
3010
+ }
3011
+ return (0, import_build_utils.spawnAsync)(cliType, args.concat(names), opts);
3012
+ }
3013
+ function resolveSemverMinMax(min, max, version2) {
3014
+ const floored = import_semver.default.intersects(version2, `>= ${min}`) ? version2 : min;
3015
+ return import_semver.default.intersects(floored, `<= ${max}`) ? floored : max;
3016
+ }
3017
+ async function ensureResolvable(start, base, pkgName) {
3018
+ try {
3019
+ const resolvedPkgPath = require_.resolve(`${pkgName}/package.json`, {
3020
+ paths: [start]
3021
+ });
3022
+ const resolvedPath = (0, import_path.dirname)(resolvedPkgPath);
3023
+ if (!(0, import_path.relative)(base, resolvedPath).startsWith(`..${import_path.sep}`)) {
3024
+ (0, import_build_utils.debug)(`"${pkgName}" resolved to '${resolvedPath}'`);
3025
+ return resolvedPath;
3026
+ }
3027
+ } catch (err) {
3028
+ if (err.code !== "MODULE_NOT_FOUND") {
3029
+ throw err;
3030
+ }
3031
+ }
3032
+ const pnpmDir = await (0, import_build_utils2.walkParentDirs)({
3033
+ base,
3034
+ start,
3035
+ filename: "node_modules/.pnpm"
3036
+ });
3037
+ if (pnpmDir) {
3038
+ const prefix = `${pkgName.replace("/", "+")}@`;
3039
+ const packages = await import_fs.promises.readdir(pnpmDir);
3040
+ const match = packages.find((p) => p.startsWith(prefix));
3041
+ if (match) {
3042
+ const pkgDir = (0, import_path.join)(pnpmDir, match, "node_modules", pkgName);
3043
+ await ensureSymlink(pkgDir, (0, import_path.join)(start, "node_modules"), pkgName);
3044
+ return pkgDir;
3045
+ }
3046
+ }
3047
+ const npmDir = await (0, import_build_utils2.walkParentDirs)({
3048
+ base,
3049
+ start,
3050
+ filename: "node_modules/.store"
3051
+ });
3052
+ if (npmDir) {
3053
+ const prefix = `${(0, import_path.basename)(pkgName)}@`;
3054
+ const prefixDir = (0, import_path.join)(npmDir, (0, import_path.dirname)(pkgName));
3055
+ const packages = await import_fs.promises.readdir(prefixDir);
3056
+ const match = packages.find((p) => p.startsWith(prefix));
3057
+ if (match) {
3058
+ const pkgDir = (0, import_path.join)(prefixDir, match, "node_modules", pkgName);
3059
+ await ensureSymlink(pkgDir, (0, import_path.join)(start, "node_modules"), pkgName);
3060
+ return pkgDir;
3061
+ }
3062
+ }
3063
+ throw new Error(
3064
+ `Failed to resolve "${pkgName}". To fix this error, add "${pkgName}" to "dependencies" in your \`package.json\` file.`
3065
+ );
3066
+ }
3067
+ async function ensureSymlink(target, nodeModulesDir, pkgName) {
3068
+ const symlinkPath = (0, import_path.join)(nodeModulesDir, pkgName);
3069
+ const symlinkDir = (0, import_path.dirname)(symlinkPath);
3070
+ const relativeTarget = (0, import_path.relative)(symlinkDir, target);
3071
+ try {
3072
+ const existingTarget = await import_fs.promises.readlink(symlinkPath);
3073
+ if (existingTarget === relativeTarget) {
3074
+ return;
3075
+ } else {
3076
+ await import_fs.promises.unlink(symlinkPath);
3077
+ }
3078
+ } catch (err) {
3079
+ if (err.code !== "ENOENT" && err.code !== "EINVAL") {
3080
+ throw err;
3081
+ }
3082
+ }
3083
+ await import_fs.promises.symlink(relativeTarget, symlinkPath);
3084
+ (0, import_build_utils.debug)(`Created symlink for "${pkgName}"`);
3085
+ }
3086
+ function isESM(path) {
3087
+ let isESM2 = false;
3088
+ try {
3089
+ require_(path);
3090
+ } catch (err) {
3091
+ isESM2 = err.code === "ERR_REQUIRE_ESM";
3092
+ }
3093
+ return isESM2;
3094
+ }
3095
+
3096
+ // src/hydrogen.ts
3097
+ var import_path2 = require("path");
3098
+ var import_ts_morph = require("ts-morph");
3099
+ function patchHydrogenServer(project, serverEntryPoint) {
3100
+ const sourceFile = project.addSourceFileAtPath(serverEntryPoint);
3101
+ const defaultExportSymbol = sourceFile.getDescendantsOfKind(
3102
+ import_ts_morph.SyntaxKind.ExportAssignment
3103
+ )[0];
3104
+ const envProperties = [];
3105
+ if (!defaultExportSymbol) {
3106
+ console.log(
3107
+ `WARN: No default export found in "${(0, import_path2.basename)(serverEntryPoint)}"`
3108
+ );
3109
+ return;
3110
+ }
3111
+ const objectLiteral = defaultExportSymbol.getFirstChildByKind(
3112
+ import_ts_morph.SyntaxKind.ObjectLiteralExpression
3113
+ );
3114
+ if (!import_ts_morph.Node.isObjectLiteralExpression(objectLiteral)) {
3115
+ console.log(
3116
+ `WARN: Default export in "${(0, import_path2.basename)(
3117
+ serverEntryPoint
3118
+ )}" does not conform to Oxygen syntax`
3119
+ );
3120
+ return;
3121
+ }
3122
+ const fetchMethod = objectLiteral.getProperty("fetch");
3123
+ if (!fetchMethod || !import_ts_morph.Node.isMethodDeclaration(fetchMethod)) {
3124
+ console.log(
3125
+ `WARN: Default export in "${(0, import_path2.basename)(
3126
+ serverEntryPoint
3127
+ )}" does not conform to Oxygen syntax`
3128
+ );
3129
+ return;
3130
+ }
3131
+ const parameters = fetchMethod.getParameters();
3132
+ const envParam = parameters[1];
3133
+ const envParamName = envParam.getName();
3134
+ if (envParam) {
3135
+ fetchMethod.forEachDescendant((node) => {
3136
+ if (import_ts_morph.Node.isPropertyAccessExpression(node) && node.getExpression().getText() === envParamName) {
3137
+ envProperties.push(node.getName());
3138
+ }
3139
+ });
3140
+ }
3141
+ fetchMethod.forEachDescendant((node) => {
3142
+ if (import_ts_morph.Node.isCallExpression(node) && node.getExpression().getText() === "caches.open") {
3143
+ node.replaceWithText(`undefined /* ${node.getText()} */`);
3144
+ }
3145
+ });
3146
+ parameters.splice(1, 1);
3147
+ const newFunction = `export default async function(${parameters.map((p) => p.getText()).join(", ")}) ${fetchMethod.getBody().getText()}`;
3148
+ defaultExportSymbol.replaceWithText(newFunction);
3149
+ const defaultEnvVars = {
3150
+ SESSION_SECRET: "foobar",
3151
+ PUBLIC_STORE_DOMAIN: "mock.shop"
3152
+ };
3153
+ const envCode = `const env = { ${envProperties.map((name) => `${name}: process.env.${name}`).join(", ")} };
3154
+ ${Object.entries(defaultEnvVars).map(
3155
+ ([k, v]) => `if (!env.${k}) { env.${k} = ${JSON.stringify(
3156
+ v
3157
+ )}; console.warn('Warning: ${JSON.stringify(
3158
+ k
3159
+ )} env var not set - using default value ${JSON.stringify(v)}'); }`
3160
+ ).join("\n")}`;
3161
+ const updatedCodeString = sourceFile.getFullText();
3162
+ return `${envCode}
3163
+ ${updatedCodeString}`;
3164
+ }
3165
+
3166
+ // src/build.ts
3167
+ var remixBuilderPkg = JSON.parse(
3168
+ (0, import_fs2.readFileSync)((0, import_path3.join)(__dirname, "../package.json"), "utf8")
3169
+ );
3170
+ var remixRunDevForkVersion = remixBuilderPkg.devDependencies["@remix-run/dev"];
3171
+ var DEFAULTS_PATH = (0, import_path3.join)(__dirname, "../defaults");
3172
+ var edgeServerSrcPromise = import_fs2.promises.readFile(
3173
+ (0, import_path3.join)(DEFAULTS_PATH, "server-edge.mjs"),
3174
+ "utf-8"
3175
+ );
3176
+ var nodeServerSrcPromise = import_fs2.promises.readFile(
3177
+ (0, import_path3.join)(DEFAULTS_PATH, "server-node.mjs"),
3178
+ "utf-8"
3179
+ );
3180
+ var VERCEL_REMIX_MIN_VERSION = "1.10.0";
3181
+ var REMIX_RUN_DEV_MIN_VERSION = "1.15.0";
3182
+ var REMIX_RUN_DEV_MAX_VERSION = remixRunDevForkVersion.slice(
3183
+ remixRunDevForkVersion.lastIndexOf("@") + 1
3184
+ );
3185
+ var build = async ({
3186
+ entrypoint,
3187
+ files,
3188
+ workPath,
3189
+ repoRootPath,
3190
+ config,
3191
+ meta = {}
3192
+ }) => {
3193
+ const { installCommand, buildCommand } = config;
3194
+ await (0, import_build_utils3.download)(files, workPath, meta);
3195
+ const mountpoint = (0, import_path3.dirname)(entrypoint);
3196
+ const entrypointFsDirname = (0, import_path3.join)(workPath, mountpoint);
3197
+ const nodeVersion = await (0, import_build_utils3.getNodeVersion)(
3198
+ entrypointFsDirname,
3199
+ void 0,
3200
+ config,
3201
+ meta
3202
+ );
3203
+ const { cliType, packageJsonPath, lockfileVersion } = await (0, import_build_utils3.scanParentDirs)(
3204
+ entrypointFsDirname
3205
+ );
3206
+ if (!packageJsonPath) {
3207
+ throw new Error("Failed to locate `package.json` file in your project");
3208
+ }
3209
+ const pkgRaw = await import_fs2.promises.readFile(packageJsonPath, "utf8");
3210
+ const pkg = JSON.parse(pkgRaw);
3211
+ const spawnOpts = (0, import_build_utils3.getSpawnOptions)(meta, nodeVersion);
3212
+ if (!spawnOpts.env) {
3213
+ spawnOpts.env = {};
3214
+ }
3215
+ spawnOpts.env = (0, import_build_utils3.getEnvForPackageManager)({
3216
+ cliType,
3217
+ lockfileVersion,
3218
+ nodeVersion,
3219
+ env: spawnOpts.env
3220
+ });
3221
+ if (typeof installCommand === "string") {
3222
+ if (installCommand.trim()) {
3223
+ console.log(`Running "install" command: \`${installCommand}\`...`);
3224
+ await (0, import_build_utils3.execCommand)(installCommand, {
3225
+ ...spawnOpts,
3226
+ cwd: entrypointFsDirname
3227
+ });
3228
+ } else {
3229
+ console.log(`Skipping "install" command...`);
3230
+ }
3231
+ } else {
3232
+ await (0, import_build_utils3.runNpmInstall)(entrypointFsDirname, [], spawnOpts, meta, nodeVersion);
3233
+ }
3234
+ const isHydrogen2 = pkg.dependencies?.["@shopify/remix-oxygen"] || pkg.devDependencies?.["@shopify/remix-oxygen"];
3235
+ const remixRunDevPath = await ensureResolvable(
3236
+ entrypointFsDirname,
3237
+ repoRootPath,
3238
+ "@remix-run/dev"
3239
+ );
3240
+ const remixRunDevPkg = JSON.parse(
3241
+ (0, import_fs2.readFileSync)((0, import_path3.join)(remixRunDevPath, "package.json"), "utf8")
3242
+ );
3243
+ const remixVersion = remixRunDevPkg.version;
3244
+ const remixConfig = await chdirAndReadConfig(
3245
+ remixRunDevPath,
3246
+ entrypointFsDirname,
3247
+ packageJsonPath
3248
+ );
3249
+ const { serverEntryPoint, appDirectory } = remixConfig;
3250
+ const remixRoutes = Object.values(remixConfig.routes);
3251
+ const depsToAdd = [];
3252
+ if (!isHydrogen2 && remixRunDevPkg.name !== "@vercel/remix-run-dev") {
3253
+ const remixDevForkVersion = resolveSemverMinMax(
3254
+ REMIX_RUN_DEV_MIN_VERSION,
3255
+ REMIX_RUN_DEV_MAX_VERSION,
3256
+ remixVersion
3257
+ );
3258
+ depsToAdd.push(
3259
+ `@remix-run/dev@npm:@vercel/remix-run-dev@${remixDevForkVersion}`
3260
+ );
3261
+ }
3262
+ const userEntryServerFile = findEntry(appDirectory, "entry.server");
3263
+ if (!userEntryServerFile) {
3264
+ await import_fs2.promises.copyFile(
3265
+ (0, import_path3.join)(DEFAULTS_PATH, "entry.server.jsx"),
3266
+ (0, import_path3.join)(appDirectory, "entry.server.jsx")
3267
+ );
3268
+ if (!pkg.dependencies["@vercel/remix"]) {
3269
+ const vercelRemixVersion = resolveSemverMinMax(
3270
+ VERCEL_REMIX_MIN_VERSION,
3271
+ REMIX_RUN_DEV_MAX_VERSION,
3272
+ remixVersion
3273
+ );
3274
+ depsToAdd.push(`@vercel/remix@${vercelRemixVersion}`);
3275
+ }
3276
+ }
3277
+ if (depsToAdd.length) {
3278
+ await addDependencies(cliType, depsToAdd, {
3279
+ ...spawnOpts,
3280
+ cwd: entrypointFsDirname
3281
+ });
3282
+ }
3283
+ const userEntryClientFile = findEntry(
3284
+ remixConfig.appDirectory,
3285
+ "entry.client"
3286
+ );
3287
+ if (!userEntryClientFile) {
3288
+ await import_fs2.promises.copyFile(
3289
+ (0, import_path3.join)(DEFAULTS_PATH, "entry.client.react.jsx"),
3290
+ (0, import_path3.join)(appDirectory, "entry.client.jsx")
3291
+ );
3292
+ }
3293
+ let remixConfigWrapped = false;
3294
+ let serverEntryPointAbs;
3295
+ let originalServerEntryPoint;
3296
+ const remixConfigPath = findConfig(entrypointFsDirname, "remix.config");
3297
+ const renamedRemixConfigPath = remixConfigPath ? `${remixConfigPath}.original${(0, import_path3.extname)(remixConfigPath)}` : void 0;
3298
+ let serverBundles;
3299
+ const serverBundlesMap = /* @__PURE__ */ new Map();
3300
+ const resolvedConfigsMap = /* @__PURE__ */ new Map();
3301
+ try {
3302
+ const project = new import_ts_morph2.Project();
3303
+ const staticConfigsMap = /* @__PURE__ */ new Map();
3304
+ for (const route of remixRoutes) {
3305
+ const routePath = (0, import_path3.join)(remixConfig.appDirectory, route.file);
3306
+ let staticConfig = (0, import_static_config.getConfig)(project, routePath);
3307
+ if (staticConfig && isHydrogen2) {
3308
+ console.log(
3309
+ "WARN: `export const config` is currently not supported for Hydrogen v2 apps"
3310
+ );
3311
+ staticConfig = null;
3312
+ }
3313
+ staticConfigsMap.set(route, staticConfig);
3314
+ }
3315
+ for (const route of remixRoutes) {
3316
+ const config2 = getResolvedRouteConfig(
3317
+ route,
3318
+ remixConfig.routes,
3319
+ staticConfigsMap,
3320
+ isHydrogen2
3321
+ );
3322
+ resolvedConfigsMap.set(route, config2);
3323
+ }
3324
+ for (const route of remixRoutes) {
3325
+ if (isLayoutRoute(route.id, remixRoutes))
3326
+ continue;
3327
+ const config2 = resolvedConfigsMap.get(route);
3328
+ if (!config2) {
3329
+ throw new Error(`Expected resolved config for "${route.id}"`);
3330
+ }
3331
+ const hash = calculateRouteConfigHash(config2);
3332
+ let routesForHash = serverBundlesMap.get(hash);
3333
+ if (!Array.isArray(routesForHash)) {
3334
+ routesForHash = [];
3335
+ serverBundlesMap.set(hash, routesForHash);
3336
+ }
3337
+ routesForHash.push(route);
3338
+ }
3339
+ serverBundles = Array.from(serverBundlesMap.entries()).map(
3340
+ ([hash, routes2]) => {
3341
+ const runtime = resolvedConfigsMap.get(routes2[0])?.runtime ?? "nodejs";
3342
+ return {
3343
+ serverBuildPath: isHydrogen2 ? (0, import_path3.relative)(entrypointFsDirname, remixConfig.serverBuildPath) : `${(0, import_path3.relative)(
3344
+ entrypointFsDirname,
3345
+ (0, import_path3.dirname)(remixConfig.serverBuildPath)
3346
+ )}/build-${runtime}-${hash}.js`,
3347
+ routes: routes2.map((r) => r.id)
3348
+ };
3349
+ }
3350
+ );
3351
+ if (!isHydrogen2 && remixConfigPath && renamedRemixConfigPath) {
3352
+ await import_fs2.promises.rename(remixConfigPath, renamedRemixConfigPath);
3353
+ let patchedConfig;
3354
+ if (isESM(renamedRemixConfigPath)) {
3355
+ patchedConfig = `import config from './${(0, import_path3.basename)(
3356
+ renamedRemixConfigPath
3357
+ )}';
3358
+ config.serverBuildTarget = undefined;
3359
+ config.serverModuleFormat = 'cjs';
3360
+ config.serverPlatform = 'node';
3361
+ config.serverBuildPath = undefined;
3362
+ config.serverBundles = ${JSON.stringify(serverBundles)};
3363
+ export default config;`;
3364
+ } else {
3365
+ patchedConfig = `const config = require('./${(0, import_path3.basename)(
3366
+ renamedRemixConfigPath
3367
+ )}');
3368
+ config.serverBuildTarget = undefined;
3369
+ config.serverModuleFormat = 'cjs';
3370
+ config.serverPlatform = 'node';
3371
+ config.serverBuildPath = undefined;
3372
+ config.serverBundles = ${JSON.stringify(serverBundles)};
3373
+ module.exports = config;`;
3374
+ }
3375
+ await import_fs2.promises.writeFile(remixConfigPath, patchedConfig);
3376
+ remixConfigWrapped = true;
3377
+ }
3378
+ if (isHydrogen2) {
3379
+ if (remixConfig.serverEntryPoint) {
3380
+ serverEntryPointAbs = (0, import_path3.join)(
3381
+ entrypointFsDirname,
3382
+ remixConfig.serverEntryPoint
3383
+ );
3384
+ originalServerEntryPoint = await import_fs2.promises.readFile(
3385
+ serverEntryPointAbs,
3386
+ "utf8"
3387
+ );
3388
+ const patchedServerEntryPoint = patchHydrogenServer(
3389
+ project,
3390
+ serverEntryPointAbs
3391
+ );
3392
+ if (patchedServerEntryPoint) {
3393
+ (0, import_build_utils3.debug)(
3394
+ `Patched Hydrogen server file: ${remixConfig.serverEntryPoint}`
3395
+ );
3396
+ await import_fs2.promises.writeFile(serverEntryPointAbs, patchedServerEntryPoint);
3397
+ }
3398
+ } else {
3399
+ console.log('WARN: No "server" field found in Remix config');
3400
+ }
3401
+ }
3402
+ spawnOpts.env.NODE_ENV = "production";
3403
+ if (buildCommand) {
3404
+ (0, import_build_utils3.debug)(`Executing build command "${buildCommand}"`);
3405
+ await (0, import_build_utils3.execCommand)(buildCommand, {
3406
+ ...spawnOpts,
3407
+ cwd: entrypointFsDirname
3408
+ });
3409
+ } else {
3410
+ if (hasScript("vercel-build", pkg)) {
3411
+ (0, import_build_utils3.debug)(`Executing "yarn vercel-build"`);
3412
+ await (0, import_build_utils3.runPackageJsonScript)(
3413
+ entrypointFsDirname,
3414
+ "vercel-build",
3415
+ spawnOpts
3416
+ );
3417
+ } else if (hasScript("build", pkg)) {
3418
+ (0, import_build_utils3.debug)(`Executing "yarn build"`);
3419
+ await (0, import_build_utils3.runPackageJsonScript)(entrypointFsDirname, "build", spawnOpts);
3420
+ } else {
3421
+ await (0, import_build_utils3.execCommand)("remix build", {
3422
+ ...spawnOpts,
3423
+ cwd: entrypointFsDirname
3424
+ });
3425
+ }
3426
+ }
3427
+ } finally {
3428
+ const cleanupOps = [];
3429
+ if (remixConfigWrapped && remixConfigPath && renamedRemixConfigPath) {
3430
+ cleanupOps.push(
3431
+ import_fs2.promises.rename(renamedRemixConfigPath, remixConfigPath).then(
3432
+ () => (0, import_build_utils3.debug)(`Restored original "${(0, import_path3.basename)(remixConfigPath)}" file`)
3433
+ )
3434
+ );
3435
+ }
3436
+ if (serverEntryPointAbs && originalServerEntryPoint) {
3437
+ cleanupOps.push(
3438
+ import_fs2.promises.writeFile(serverEntryPointAbs, originalServerEntryPoint).then(
3439
+ () => (0, import_build_utils3.debug)(`Restored original "${(0, import_path3.basename)(serverEntryPointAbs)}" file`)
3440
+ )
3441
+ );
3442
+ }
3443
+ await Promise.all(cleanupOps);
3444
+ }
3445
+ await Promise.all([
3446
+ ensureResolvable(
3447
+ entrypointFsDirname,
3448
+ repoRootPath,
3449
+ "@remix-run/server-runtime"
3450
+ ),
3451
+ !isHydrogen2 ? ensureResolvable(entrypointFsDirname, repoRootPath, "@remix-run/node") : null
3452
+ ]);
3453
+ const staticDir = (0, import_path3.join)(
3454
+ remixConfig.assetsBuildDirectory,
3455
+ ...remixConfig.publicPath.replace(/^\/|\/$/g, "").split("/").map((_) => "..")
3456
+ );
3457
+ const [staticFiles, ...functions] = await Promise.all([
3458
+ (0, import_build_utils3.glob)("**", staticDir),
3459
+ ...serverBundles.map((bundle) => {
3460
+ const firstRoute = remixConfig.routes[bundle.routes[0]];
3461
+ const config2 = resolvedConfigsMap.get(firstRoute) ?? {
3462
+ runtime: "nodejs"
3463
+ };
3464
+ if (config2.runtime === "edge") {
3465
+ return createRenderEdgeFunction(
3466
+ entrypointFsDirname,
3467
+ repoRootPath,
3468
+ (0, import_path3.join)(entrypointFsDirname, bundle.serverBuildPath),
3469
+ serverEntryPoint,
3470
+ remixVersion,
3471
+ config2
3472
+ );
3473
+ }
3474
+ return createRenderNodeFunction(
3475
+ nodeVersion,
3476
+ entrypointFsDirname,
3477
+ repoRootPath,
3478
+ (0, import_path3.join)(entrypointFsDirname, bundle.serverBuildPath),
3479
+ serverEntryPoint,
3480
+ remixVersion,
3481
+ config2
3482
+ );
3483
+ })
3484
+ ]);
3485
+ const output = staticFiles;
3486
+ const routes = [
3487
+ {
3488
+ src: "^/build/(.*)$",
3489
+ headers: { "cache-control": "public, max-age=31536000, immutable" },
3490
+ continue: true
3491
+ },
3492
+ {
3493
+ handle: "filesystem"
3494
+ }
3495
+ ];
3496
+ for (const route of remixRoutes) {
3497
+ if (isLayoutRoute(route.id, remixRoutes))
3498
+ continue;
3499
+ const { path, rePath } = getPathFromRoute(route, remixConfig.routes);
3500
+ if (!path) {
3501
+ continue;
3502
+ }
3503
+ const funcIndex = serverBundles.findIndex((bundle) => {
3504
+ return bundle.routes.includes(route.id);
3505
+ });
3506
+ const func = functions[funcIndex];
3507
+ if (!func) {
3508
+ throw new Error(`Could not determine server bundle for "${route.id}"`);
3509
+ }
3510
+ output[path] = func instanceof import_build_utils3.EdgeFunction ? (
3511
+ // `EdgeFunction` currently requires the "name" property to be set.
3512
+ // Ideally this property will be removed, at which point we can
3513
+ // return the same `edgeFunction` instance instead of creating a
3514
+ // new one for each page.
3515
+ new import_build_utils3.EdgeFunction({
3516
+ ...func,
3517
+ name: path
3518
+ })
3519
+ ) : func;
3520
+ const re = getRegExpFromPath(rePath);
3521
+ if (re) {
3522
+ routes.push({
3523
+ src: re.source,
3524
+ dest: path
3525
+ });
3526
+ }
3527
+ }
3528
+ if (!output["404"]) {
3529
+ const edgeFunctionIndex = Array.from(serverBundlesMap.values()).findIndex(
3530
+ (routes2) => {
3531
+ const runtime = resolvedConfigsMap.get(routes2[0])?.runtime;
3532
+ return runtime === "edge";
3533
+ }
3534
+ );
3535
+ const func = edgeFunctionIndex !== -1 ? functions[edgeFunctionIndex] : functions[0];
3536
+ output["404"] = func instanceof import_build_utils3.EdgeFunction ? new import_build_utils3.EdgeFunction({ ...func, name: "404" }) : func;
3537
+ }
3538
+ routes.push({
3539
+ src: "/(.*)",
3540
+ dest: "/404"
3541
+ });
3542
+ return { routes, output, framework: { version: remixVersion } };
3543
+ };
3544
+ function hasScript(scriptName, pkg) {
3545
+ const scripts = pkg && pkg.scripts || {};
3546
+ return typeof scripts[scriptName] === "string";
3547
+ }
3548
+ async function createRenderNodeFunction(nodeVersion, entrypointDir, rootDir, serverBuildPath, serverEntryPoint, remixVersion, config) {
3549
+ const files = {};
3550
+ let handler = (0, import_path3.relative)(rootDir, serverBuildPath);
3551
+ let handlerPath = (0, import_path3.join)(rootDir, handler);
3552
+ if (!serverEntryPoint) {
3553
+ const baseServerBuildPath = (0, import_path3.basename)(serverBuildPath, ".js");
3554
+ handler = (0, import_path3.join)((0, import_path3.dirname)(handler), `server-${baseServerBuildPath}.mjs`);
3555
+ handlerPath = (0, import_path3.join)(rootDir, handler);
3556
+ const nodeServerSrc = await nodeServerSrcPromise;
3557
+ await writeEntrypointFile(
3558
+ handlerPath,
3559
+ nodeServerSrc.replace(
3560
+ "@remix-run/dev/server-build",
3561
+ `./${baseServerBuildPath}.js`
3562
+ ),
3563
+ rootDir
3564
+ );
3565
+ }
3566
+ const trace = await (0, import_nft.nodeFileTrace)([handlerPath], {
3567
+ base: rootDir,
3568
+ processCwd: entrypointDir
3569
+ });
3570
+ for (const warning of trace.warnings) {
3571
+ (0, import_build_utils3.debug)(`Warning from trace: ${warning.message}`);
3572
+ }
3573
+ for (const file of trace.fileList) {
3574
+ files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path3.join)(rootDir, file) });
3575
+ }
3576
+ const fn = new import_build_utils3.NodejsLambda({
3577
+ files,
3578
+ handler,
3579
+ runtime: nodeVersion.runtime,
3580
+ shouldAddHelpers: false,
3581
+ shouldAddSourcemapSupport: false,
3582
+ operationType: "SSR",
3583
+ supportsResponseStreaming: true,
3584
+ regions: config.regions,
3585
+ memory: config.memory,
3586
+ maxDuration: config.maxDuration,
3587
+ framework: {
3588
+ slug: "remix",
3589
+ version: remixVersion
3590
+ }
3591
+ });
3592
+ return fn;
3593
+ }
3594
+ async function createRenderEdgeFunction(entrypointDir, rootDir, serverBuildPath, serverEntryPoint, remixVersion, config) {
3595
+ const files = {};
3596
+ let handler = (0, import_path3.relative)(rootDir, serverBuildPath);
3597
+ let handlerPath = (0, import_path3.join)(rootDir, handler);
3598
+ if (!serverEntryPoint) {
3599
+ const baseServerBuildPath = (0, import_path3.basename)(serverBuildPath, ".js");
3600
+ handler = (0, import_path3.join)((0, import_path3.dirname)(handler), `server-${baseServerBuildPath}.mjs`);
3601
+ handlerPath = (0, import_path3.join)(rootDir, handler);
3602
+ const edgeServerSrc = await edgeServerSrcPromise;
3603
+ await writeEntrypointFile(
3604
+ handlerPath,
3605
+ edgeServerSrc.replace(
3606
+ "@remix-run/dev/server-build",
3607
+ `./${baseServerBuildPath}.js`
3608
+ ),
3609
+ rootDir
3610
+ );
3611
+ }
3612
+ let remixRunVercelPkgJson;
3613
+ const trace = await (0, import_nft.nodeFileTrace)([handlerPath], {
3614
+ base: rootDir,
3615
+ processCwd: entrypointDir,
3616
+ conditions: ["edge-light", "browser", "module", "import", "require"],
3617
+ async readFile(fsPath) {
3618
+ let source;
3619
+ try {
3620
+ source = await import_fs2.promises.readFile(fsPath);
3621
+ } catch (err) {
3622
+ if (err.code === "ENOENT" || err.code === "EISDIR") {
3623
+ return null;
3624
+ }
3625
+ throw err;
3626
+ }
3627
+ if ((0, import_path3.basename)(fsPath) === "package.json") {
3628
+ const pkgJson = JSON.parse(source.toString());
3629
+ if (pkgJson.name === "@remix-run/vercel") {
3630
+ pkgJson.browser = "dist/edge.js";
3631
+ pkgJson.dependencies["@remix-run/server-runtime"] = pkgJson.dependencies["@remix-run/node"];
3632
+ if (!remixRunVercelPkgJson) {
3633
+ remixRunVercelPkgJson = JSON.stringify(pkgJson, null, 2) + "\n";
3634
+ const vercelEdgeEntrypointPath = (0, import_path3.join)(
3635
+ DEFAULTS_PATH,
3636
+ "vercel-edge-entrypoint.js"
3637
+ );
3638
+ const vercelEdgeEntrypointDest = (0, import_path3.join)(
3639
+ (0, import_path3.dirname)(fsPath),
3640
+ "dist/edge.js"
3641
+ );
3642
+ await import_fs2.promises.copyFile(
3643
+ vercelEdgeEntrypointPath,
3644
+ vercelEdgeEntrypointDest
3645
+ );
3646
+ }
3647
+ }
3648
+ for (const prop of ["browser", "module"]) {
3649
+ const val = pkgJson[prop];
3650
+ if (typeof val === "string") {
3651
+ pkgJson.main = val;
3652
+ source = JSON.stringify(pkgJson);
3653
+ break;
3654
+ }
3655
+ }
3656
+ }
3657
+ return source;
3658
+ }
3659
+ });
3660
+ for (const warning of trace.warnings) {
3661
+ (0, import_build_utils3.debug)(`Warning from trace: ${warning.message}`);
3662
+ }
3663
+ for (const file of trace.fileList) {
3664
+ if (remixRunVercelPkgJson && file.endsWith(`@remix-run${import_path3.sep}vercel${import_path3.sep}package.json`)) {
3665
+ files[file] = new import_build_utils3.FileBlob({ data: remixRunVercelPkgJson });
3666
+ } else {
3667
+ files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path3.join)(rootDir, file) });
3668
+ }
3669
+ }
3670
+ const fn = new import_build_utils3.EdgeFunction({
3671
+ files,
3672
+ deploymentTarget: "v8-worker",
3673
+ name: "render",
3674
+ entrypoint: handler,
3675
+ regions: config.regions,
3676
+ framework: {
3677
+ slug: "remix",
3678
+ version: remixVersion
3679
+ }
3680
+ });
3681
+ return fn;
3682
+ }
3683
+ async function writeEntrypointFile(path, data, rootDir) {
3684
+ try {
3685
+ await import_fs2.promises.writeFile(path, data);
3686
+ } catch (err) {
3687
+ if (err.code === "ENOENT") {
3688
+ throw new Error(
3689
+ `The "${(0, import_path3.relative)(
3690
+ rootDir,
3691
+ (0, import_path3.dirname)(path)
3692
+ )}" directory does not exist. Please contact support at https://vercel.com/help.`
3693
+ );
3694
+ }
3695
+ throw err;
3696
+ }
3697
+ }
3698
+
3699
+ // src/prepare-cache.ts
3700
+ var import_build_utils4 = require("@vercel/build-utils");
3701
+ var import_path4 = require("path");
3702
+ var prepareCache = async ({
3703
+ entrypoint,
3704
+ repoRootPath,
3705
+ workPath
3706
+ }) => {
3707
+ const root = repoRootPath || workPath;
3708
+ const mountpoint = (0, import_path4.dirname)(entrypoint);
3709
+ const entrypointFsDirname = (0, import_path4.join)(workPath, mountpoint);
3710
+ const packageJsonPath = (0, import_path4.join)(entrypointFsDirname, "package.json");
3711
+ const remixRunDevPath = (0, import_path4.dirname)(
3712
+ require_.resolve("@remix-run/dev/package.json", {
3713
+ paths: [entrypointFsDirname]
3714
+ })
3715
+ );
3716
+ const remixConfig = await chdirAndReadConfig(
3717
+ remixRunDevPath,
3718
+ entrypointFsDirname,
3719
+ packageJsonPath
3720
+ );
3721
+ const [nodeModulesFiles, cacheDirFiles] = await Promise.all([
3722
+ // Cache `node_modules`
3723
+ (0, import_build_utils4.glob)("**/node_modules/**", root),
3724
+ // Cache the Remix "cacheDirectory" (typically `.cache`)
3725
+ (0, import_build_utils4.glob)((0, import_path4.relative)(root, (0, import_path4.join)(remixConfig.cacheDirectory, "**")), root)
3726
+ ]);
3727
+ return { ...nodeModulesFiles, ...cacheDirFiles };
3728
+ };
3729
+
3730
+ // src/index.ts
3731
+ var version = 2;
28
3732
  // Annotate the CommonJS export names for ESM import in node:
29
3733
  0 && (module.exports = {
30
- version,
31
- ...require("./build"),
32
- ...require("./prepare-cache")
3734
+ build,
3735
+ prepareCache,
3736
+ version
33
3737
  });
34
- //# sourceMappingURL=index.js.map