next-ws 0.0.0-beta-20250820141901 → 0.0.0-beta-20250822123253

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/cli.cjs CHANGED
@@ -6,9 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __commonJS = (cb, mod) => function __require() {
10
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
- };
12
9
  var __copyProps = (to, from, except, desc) => {
13
10
  if (from && typeof from === "object" || typeof from === "function") {
14
11
  for (let key of __getOwnPropNames(from))
@@ -26,1477 +23,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
23
  mod
27
24
  ));
28
25
 
29
- // node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js
30
- var require_minimist = __commonJS({
31
- "node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js"(exports2, module2) {
32
- "use strict";
33
- function hasKey(obj, keys) {
34
- var o = obj;
35
- keys.slice(0, -1).forEach(function(key2) {
36
- o = o[key2] || {};
37
- });
38
- var key = keys[keys.length - 1];
39
- return key in o;
40
- }
41
- function isNumber(x) {
42
- if (typeof x === "number") {
43
- return true;
44
- }
45
- if (/^0x[0-9a-f]+$/i.test(x)) {
46
- return true;
47
- }
48
- return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
49
- }
50
- function isConstructorOrProto(obj, key) {
51
- return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
52
- }
53
- module2.exports = function(args, opts) {
54
- if (!opts) {
55
- opts = {};
56
- }
57
- var flags = {
58
- bools: {},
59
- strings: {},
60
- unknownFn: null
61
- };
62
- if (typeof opts.unknown === "function") {
63
- flags.unknownFn = opts.unknown;
64
- }
65
- if (typeof opts.boolean === "boolean" && opts.boolean) {
66
- flags.allBools = true;
67
- } else {
68
- [].concat(opts.boolean).filter(Boolean).forEach(function(key2) {
69
- flags.bools[key2] = true;
70
- });
71
- }
72
- var aliases = {};
73
- function aliasIsBoolean(key2) {
74
- return aliases[key2].some(function(x) {
75
- return flags.bools[x];
76
- });
77
- }
78
- Object.keys(opts.alias || {}).forEach(function(key2) {
79
- aliases[key2] = [].concat(opts.alias[key2]);
80
- aliases[key2].forEach(function(x) {
81
- aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
82
- return x !== y;
83
- }));
84
- });
85
- });
86
- [].concat(opts.string).filter(Boolean).forEach(function(key2) {
87
- flags.strings[key2] = true;
88
- if (aliases[key2]) {
89
- [].concat(aliases[key2]).forEach(function(k) {
90
- flags.strings[k] = true;
91
- });
92
- }
93
- });
94
- var defaults = opts.default || {};
95
- var argv = { _: [] };
96
- function argDefined(key2, arg2) {
97
- return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
98
- }
99
- function setKey(obj, keys, value2) {
100
- var o = obj;
101
- for (var i2 = 0; i2 < keys.length - 1; i2++) {
102
- var key2 = keys[i2];
103
- if (isConstructorOrProto(o, key2)) {
104
- return;
105
- }
106
- if (o[key2] === void 0) {
107
- o[key2] = {};
108
- }
109
- if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) {
110
- o[key2] = {};
111
- }
112
- if (o[key2] === Array.prototype) {
113
- o[key2] = [];
114
- }
115
- o = o[key2];
116
- }
117
- var lastKey = keys[keys.length - 1];
118
- if (isConstructorOrProto(o, lastKey)) {
119
- return;
120
- }
121
- if (o === Object.prototype || o === Number.prototype || o === String.prototype) {
122
- o = {};
123
- }
124
- if (o === Array.prototype) {
125
- o = [];
126
- }
127
- if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") {
128
- o[lastKey] = value2;
129
- } else if (Array.isArray(o[lastKey])) {
130
- o[lastKey].push(value2);
131
- } else {
132
- o[lastKey] = [o[lastKey], value2];
133
- }
134
- }
135
- function setArg(key2, val, arg2) {
136
- if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
137
- if (flags.unknownFn(arg2) === false) {
138
- return;
139
- }
140
- }
141
- var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
142
- setKey(argv, key2.split("."), value2);
143
- (aliases[key2] || []).forEach(function(x) {
144
- setKey(argv, x.split("."), value2);
145
- });
146
- }
147
- Object.keys(flags.bools).forEach(function(key2) {
148
- setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
149
- });
150
- var notFlags = [];
151
- if (args.indexOf("--") !== -1) {
152
- notFlags = args.slice(args.indexOf("--") + 1);
153
- args = args.slice(0, args.indexOf("--"));
154
- }
155
- for (var i = 0; i < args.length; i++) {
156
- var arg = args[i];
157
- var key;
158
- var next;
159
- if (/^--.+=/.test(arg)) {
160
- var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
161
- key = m[1];
162
- var value = m[2];
163
- if (flags.bools[key]) {
164
- value = value !== "false";
165
- }
166
- setArg(key, value, arg);
167
- } else if (/^--no-.+/.test(arg)) {
168
- key = arg.match(/^--no-(.+)/)[1];
169
- setArg(key, false, arg);
170
- } else if (/^--.+/.test(arg)) {
171
- key = arg.match(/^--(.+)/)[1];
172
- next = args[i + 1];
173
- if (next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
174
- setArg(key, next, arg);
175
- i += 1;
176
- } else if (/^(true|false)$/.test(next)) {
177
- setArg(key, next === "true", arg);
178
- i += 1;
179
- } else {
180
- setArg(key, flags.strings[key] ? "" : true, arg);
181
- }
182
- } else if (/^-[^-]+/.test(arg)) {
183
- var letters = arg.slice(1, -1).split("");
184
- var broken = false;
185
- for (var j = 0; j < letters.length; j++) {
186
- next = arg.slice(j + 2);
187
- if (next === "-") {
188
- setArg(letters[j], next, arg);
189
- continue;
190
- }
191
- if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
192
- setArg(letters[j], next.slice(1), arg);
193
- broken = true;
194
- break;
195
- }
196
- if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
197
- setArg(letters[j], next, arg);
198
- broken = true;
199
- break;
200
- }
201
- if (letters[j + 1] && letters[j + 1].match(/\W/)) {
202
- setArg(letters[j], arg.slice(j + 2), arg);
203
- broken = true;
204
- break;
205
- } else {
206
- setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
207
- }
208
- }
209
- key = arg.slice(-1)[0];
210
- if (!broken && key !== "-") {
211
- if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
212
- setArg(key, args[i + 1], arg);
213
- i += 1;
214
- } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
215
- setArg(key, args[i + 1] === "true", arg);
216
- i += 1;
217
- } else {
218
- setArg(key, flags.strings[key] ? "" : true, arg);
219
- }
220
- }
221
- } else {
222
- if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
223
- argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
224
- }
225
- if (opts.stopEarly) {
226
- argv._.push.apply(argv._, args.slice(i + 1));
227
- break;
228
- }
229
- }
230
- }
231
- Object.keys(defaults).forEach(function(k) {
232
- if (!hasKey(argv, k.split("."))) {
233
- setKey(argv, k.split("."), defaults[k]);
234
- (aliases[k] || []).forEach(function(x) {
235
- setKey(argv, x.split("."), defaults[k]);
236
- });
237
- }
238
- });
239
- if (opts["--"]) {
240
- argv["--"] = notFlags.slice();
241
- } else {
242
- notFlags.forEach(function(k) {
243
- argv._.push(k);
244
- });
245
- }
246
- return argv;
247
- };
248
- }
249
- });
250
-
251
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js
252
- var require_lrucache = __commonJS({
253
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js"(exports2, module2) {
254
- "use strict";
255
- var LRUCache = class {
256
- constructor() {
257
- this.max = 1e3;
258
- this.map = /* @__PURE__ */ new Map();
259
- }
260
- get(key) {
261
- const value = this.map.get(key);
262
- if (value === void 0) {
263
- return void 0;
264
- } else {
265
- this.map.delete(key);
266
- this.map.set(key, value);
267
- return value;
268
- }
269
- }
270
- delete(key) {
271
- return this.map.delete(key);
272
- }
273
- set(key, value) {
274
- const deleted = this.delete(key);
275
- if (!deleted && value !== void 0) {
276
- if (this.map.size >= this.max) {
277
- const firstKey = this.map.keys().next().value;
278
- this.delete(firstKey);
279
- }
280
- this.map.set(key, value);
281
- }
282
- return this;
283
- }
284
- };
285
- module2.exports = LRUCache;
286
- }
287
- });
288
-
289
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js
290
- var require_parse_options = __commonJS({
291
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js"(exports2, module2) {
292
- "use strict";
293
- var looseOption = Object.freeze({ loose: true });
294
- var emptyOpts = Object.freeze({});
295
- var parseOptions = (options) => {
296
- if (!options) {
297
- return emptyOpts;
298
- }
299
- if (typeof options !== "object") {
300
- return looseOption;
301
- }
302
- return options;
303
- };
304
- module2.exports = parseOptions;
305
- }
306
- });
307
-
308
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js
309
- var require_constants = __commonJS({
310
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js"(exports2, module2) {
311
- "use strict";
312
- var SEMVER_SPEC_VERSION = "2.0.0";
313
- var MAX_LENGTH = 256;
314
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
315
- 9007199254740991;
316
- var MAX_SAFE_COMPONENT_LENGTH = 16;
317
- var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
318
- var RELEASE_TYPES = [
319
- "major",
320
- "premajor",
321
- "minor",
322
- "preminor",
323
- "patch",
324
- "prepatch",
325
- "prerelease"
326
- ];
327
- module2.exports = {
328
- MAX_LENGTH,
329
- MAX_SAFE_COMPONENT_LENGTH,
330
- MAX_SAFE_BUILD_LENGTH,
331
- MAX_SAFE_INTEGER,
332
- RELEASE_TYPES,
333
- SEMVER_SPEC_VERSION,
334
- FLAG_INCLUDE_PRERELEASE: 1,
335
- FLAG_LOOSE: 2
336
- };
337
- }
338
- });
339
-
340
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js
341
- var require_debug = __commonJS({
342
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js"(exports2, module2) {
343
- "use strict";
344
- var debug2 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
345
- };
346
- module2.exports = debug2;
347
- }
348
- });
349
-
350
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js
351
- var require_re = __commonJS({
352
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js"(exports2, module2) {
353
- "use strict";
354
- var {
355
- MAX_SAFE_COMPONENT_LENGTH,
356
- MAX_SAFE_BUILD_LENGTH,
357
- MAX_LENGTH
358
- } = require_constants();
359
- var debug2 = require_debug();
360
- exports2 = module2.exports = {};
361
- var re = exports2.re = [];
362
- var safeRe = exports2.safeRe = [];
363
- var src = exports2.src = [];
364
- var safeSrc = exports2.safeSrc = [];
365
- var t = exports2.t = {};
366
- var R = 0;
367
- var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
368
- var safeRegexReplacements = [
369
- ["\\s", 1],
370
- ["\\d", MAX_LENGTH],
371
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
372
- ];
373
- var makeSafeRegex = (value) => {
374
- for (const [token, max] of safeRegexReplacements) {
375
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
376
- }
377
- return value;
378
- };
379
- var createToken = (name, value, isGlobal) => {
380
- const safe = makeSafeRegex(value);
381
- const index = R++;
382
- debug2(name, index, value);
383
- t[name] = index;
384
- src[index] = value;
385
- safeSrc[index] = safe;
386
- re[index] = new RegExp(value, isGlobal ? "g" : void 0);
387
- safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
388
- };
389
- createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
390
- createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
391
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
392
- createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
393
- createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
394
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
395
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
396
- createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
397
- createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
398
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
399
- createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
400
- createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
401
- createToken("FULL", `^${src[t.FULLPLAIN]}$`);
402
- createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
403
- createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
404
- createToken("GTLT", "((?:<|>)?=?)");
405
- createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
406
- createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
407
- createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
408
- createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
409
- createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
410
- createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
411
- createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
412
- createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
413
- createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
414
- createToken("COERCERTL", src[t.COERCE], true);
415
- createToken("COERCERTLFULL", src[t.COERCEFULL], true);
416
- createToken("LONETILDE", "(?:~>?)");
417
- createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
418
- exports2.tildeTrimReplace = "$1~";
419
- createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
420
- createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
421
- createToken("LONECARET", "(?:\\^)");
422
- createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
423
- exports2.caretTrimReplace = "$1^";
424
- createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
425
- createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
426
- createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
427
- createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
428
- createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
429
- exports2.comparatorTrimReplace = "$1$2$3";
430
- createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
431
- createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
432
- createToken("STAR", "(<|>)?=?\\s*\\*");
433
- createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
434
- createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
435
- }
436
- });
437
-
438
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js
439
- var require_identifiers = __commonJS({
440
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js"(exports2, module2) {
441
- "use strict";
442
- var numeric = /^[0-9]+$/;
443
- var compareIdentifiers = (a, b) => {
444
- const anum = numeric.test(a);
445
- const bnum = numeric.test(b);
446
- if (anum && bnum) {
447
- a = +a;
448
- b = +b;
449
- }
450
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
451
- };
452
- var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
453
- module2.exports = {
454
- compareIdentifiers,
455
- rcompareIdentifiers
456
- };
457
- }
458
- });
459
-
460
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js
461
- var require_semver = __commonJS({
462
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js"(exports2, module2) {
463
- "use strict";
464
- var debug2 = require_debug();
465
- var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
466
- var { safeRe: re, t } = require_re();
467
- var parseOptions = require_parse_options();
468
- var { compareIdentifiers } = require_identifiers();
469
- var SemVer2 = class _SemVer {
470
- constructor(version2, options) {
471
- options = parseOptions(options);
472
- if (version2 instanceof _SemVer) {
473
- if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
474
- return version2;
475
- } else {
476
- version2 = version2.version;
477
- }
478
- } else if (typeof version2 !== "string") {
479
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
480
- }
481
- if (version2.length > MAX_LENGTH) {
482
- throw new TypeError(
483
- `version is longer than ${MAX_LENGTH} characters`
484
- );
485
- }
486
- debug2("SemVer", version2, options);
487
- this.options = options;
488
- this.loose = !!options.loose;
489
- this.includePrerelease = !!options.includePrerelease;
490
- const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
491
- if (!m) {
492
- throw new TypeError(`Invalid Version: ${version2}`);
493
- }
494
- this.raw = version2;
495
- this.major = +m[1];
496
- this.minor = +m[2];
497
- this.patch = +m[3];
498
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
499
- throw new TypeError("Invalid major version");
500
- }
501
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
502
- throw new TypeError("Invalid minor version");
503
- }
504
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
505
- throw new TypeError("Invalid patch version");
506
- }
507
- if (!m[4]) {
508
- this.prerelease = [];
509
- } else {
510
- this.prerelease = m[4].split(".").map((id) => {
511
- if (/^[0-9]+$/.test(id)) {
512
- const num = +id;
513
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
514
- return num;
515
- }
516
- }
517
- return id;
518
- });
519
- }
520
- this.build = m[5] ? m[5].split(".") : [];
521
- this.format();
522
- }
523
- format() {
524
- this.version = `${this.major}.${this.minor}.${this.patch}`;
525
- if (this.prerelease.length) {
526
- this.version += `-${this.prerelease.join(".")}`;
527
- }
528
- return this.version;
529
- }
530
- toString() {
531
- return this.version;
532
- }
533
- compare(other) {
534
- debug2("SemVer.compare", this.version, this.options, other);
535
- if (!(other instanceof _SemVer)) {
536
- if (typeof other === "string" && other === this.version) {
537
- return 0;
538
- }
539
- other = new _SemVer(other, this.options);
540
- }
541
- if (other.version === this.version) {
542
- return 0;
543
- }
544
- return this.compareMain(other) || this.comparePre(other);
545
- }
546
- compareMain(other) {
547
- if (!(other instanceof _SemVer)) {
548
- other = new _SemVer(other, this.options);
549
- }
550
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
551
- }
552
- comparePre(other) {
553
- if (!(other instanceof _SemVer)) {
554
- other = new _SemVer(other, this.options);
555
- }
556
- if (this.prerelease.length && !other.prerelease.length) {
557
- return -1;
558
- } else if (!this.prerelease.length && other.prerelease.length) {
559
- return 1;
560
- } else if (!this.prerelease.length && !other.prerelease.length) {
561
- return 0;
562
- }
563
- let i = 0;
564
- do {
565
- const a = this.prerelease[i];
566
- const b = other.prerelease[i];
567
- debug2("prerelease compare", i, a, b);
568
- if (a === void 0 && b === void 0) {
569
- return 0;
570
- } else if (b === void 0) {
571
- return 1;
572
- } else if (a === void 0) {
573
- return -1;
574
- } else if (a === b) {
575
- continue;
576
- } else {
577
- return compareIdentifiers(a, b);
578
- }
579
- } while (++i);
580
- }
581
- compareBuild(other) {
582
- if (!(other instanceof _SemVer)) {
583
- other = new _SemVer(other, this.options);
584
- }
585
- let i = 0;
586
- do {
587
- const a = this.build[i];
588
- const b = other.build[i];
589
- debug2("build compare", i, a, b);
590
- if (a === void 0 && b === void 0) {
591
- return 0;
592
- } else if (b === void 0) {
593
- return 1;
594
- } else if (a === void 0) {
595
- return -1;
596
- } else if (a === b) {
597
- continue;
598
- } else {
599
- return compareIdentifiers(a, b);
600
- }
601
- } while (++i);
602
- }
603
- // preminor will bump the version up to the next minor release, and immediately
604
- // down to pre-release. premajor and prepatch work the same way.
605
- inc(release, identifier, identifierBase) {
606
- if (release.startsWith("pre")) {
607
- if (!identifier && identifierBase === false) {
608
- throw new Error("invalid increment argument: identifier is empty");
609
- }
610
- if (identifier) {
611
- const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
612
- if (!match || match[1] !== identifier) {
613
- throw new Error(`invalid identifier: ${identifier}`);
614
- }
615
- }
616
- }
617
- switch (release) {
618
- case "premajor":
619
- this.prerelease.length = 0;
620
- this.patch = 0;
621
- this.minor = 0;
622
- this.major++;
623
- this.inc("pre", identifier, identifierBase);
624
- break;
625
- case "preminor":
626
- this.prerelease.length = 0;
627
- this.patch = 0;
628
- this.minor++;
629
- this.inc("pre", identifier, identifierBase);
630
- break;
631
- case "prepatch":
632
- this.prerelease.length = 0;
633
- this.inc("patch", identifier, identifierBase);
634
- this.inc("pre", identifier, identifierBase);
635
- break;
636
- // If the input is a non-prerelease version, this acts the same as
637
- // prepatch.
638
- case "prerelease":
639
- if (this.prerelease.length === 0) {
640
- this.inc("patch", identifier, identifierBase);
641
- }
642
- this.inc("pre", identifier, identifierBase);
643
- break;
644
- case "release":
645
- if (this.prerelease.length === 0) {
646
- throw new Error(`version ${this.raw} is not a prerelease`);
647
- }
648
- this.prerelease.length = 0;
649
- break;
650
- case "major":
651
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
652
- this.major++;
653
- }
654
- this.minor = 0;
655
- this.patch = 0;
656
- this.prerelease = [];
657
- break;
658
- case "minor":
659
- if (this.patch !== 0 || this.prerelease.length === 0) {
660
- this.minor++;
661
- }
662
- this.patch = 0;
663
- this.prerelease = [];
664
- break;
665
- case "patch":
666
- if (this.prerelease.length === 0) {
667
- this.patch++;
668
- }
669
- this.prerelease = [];
670
- break;
671
- // This probably shouldn't be used publicly.
672
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
673
- case "pre": {
674
- const base = Number(identifierBase) ? 1 : 0;
675
- if (this.prerelease.length === 0) {
676
- this.prerelease = [base];
677
- } else {
678
- let i = this.prerelease.length;
679
- while (--i >= 0) {
680
- if (typeof this.prerelease[i] === "number") {
681
- this.prerelease[i]++;
682
- i = -2;
683
- }
684
- }
685
- if (i === -1) {
686
- if (identifier === this.prerelease.join(".") && identifierBase === false) {
687
- throw new Error("invalid increment argument: identifier already exists");
688
- }
689
- this.prerelease.push(base);
690
- }
691
- }
692
- if (identifier) {
693
- let prerelease = [identifier, base];
694
- if (identifierBase === false) {
695
- prerelease = [identifier];
696
- }
697
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
698
- if (isNaN(this.prerelease[1])) {
699
- this.prerelease = prerelease;
700
- }
701
- } else {
702
- this.prerelease = prerelease;
703
- }
704
- }
705
- break;
706
- }
707
- default:
708
- throw new Error(`invalid increment argument: ${release}`);
709
- }
710
- this.raw = this.format();
711
- if (this.build.length) {
712
- this.raw += `+${this.build.join(".")}`;
713
- }
714
- return this;
715
- }
716
- };
717
- module2.exports = SemVer2;
718
- }
719
- });
720
-
721
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js
722
- var require_compare = __commonJS({
723
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js"(exports2, module2) {
724
- "use strict";
725
- var SemVer2 = require_semver();
726
- var compare = (a, b, loose) => new SemVer2(a, loose).compare(new SemVer2(b, loose));
727
- module2.exports = compare;
728
- }
729
- });
730
-
731
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js
732
- var require_eq = __commonJS({
733
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js"(exports2, module2) {
734
- "use strict";
735
- var compare = require_compare();
736
- var eq = (a, b, loose) => compare(a, b, loose) === 0;
737
- module2.exports = eq;
738
- }
739
- });
740
-
741
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js
742
- var require_neq = __commonJS({
743
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js"(exports2, module2) {
744
- "use strict";
745
- var compare = require_compare();
746
- var neq = (a, b, loose) => compare(a, b, loose) !== 0;
747
- module2.exports = neq;
748
- }
749
- });
750
-
751
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js
752
- var require_gt = __commonJS({
753
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js"(exports2, module2) {
754
- "use strict";
755
- var compare = require_compare();
756
- var gt2 = (a, b, loose) => compare(a, b, loose) > 0;
757
- module2.exports = gt2;
758
- }
759
- });
760
-
761
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js
762
- var require_gte = __commonJS({
763
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js"(exports2, module2) {
764
- "use strict";
765
- var compare = require_compare();
766
- var gte = (a, b, loose) => compare(a, b, loose) >= 0;
767
- module2.exports = gte;
768
- }
769
- });
770
-
771
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js
772
- var require_lt = __commonJS({
773
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js"(exports2, module2) {
774
- "use strict";
775
- var compare = require_compare();
776
- var lt = (a, b, loose) => compare(a, b, loose) < 0;
777
- module2.exports = lt;
778
- }
779
- });
780
-
781
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js
782
- var require_lte = __commonJS({
783
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js"(exports2, module2) {
784
- "use strict";
785
- var compare = require_compare();
786
- var lte = (a, b, loose) => compare(a, b, loose) <= 0;
787
- module2.exports = lte;
788
- }
789
- });
790
-
791
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js
792
- var require_cmp = __commonJS({
793
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js"(exports2, module2) {
794
- "use strict";
795
- var eq = require_eq();
796
- var neq = require_neq();
797
- var gt2 = require_gt();
798
- var gte = require_gte();
799
- var lt = require_lt();
800
- var lte = require_lte();
801
- var cmp = (a, op, b, loose) => {
802
- switch (op) {
803
- case "===":
804
- if (typeof a === "object") {
805
- a = a.version;
806
- }
807
- if (typeof b === "object") {
808
- b = b.version;
809
- }
810
- return a === b;
811
- case "!==":
812
- if (typeof a === "object") {
813
- a = a.version;
814
- }
815
- if (typeof b === "object") {
816
- b = b.version;
817
- }
818
- return a !== b;
819
- case "":
820
- case "=":
821
- case "==":
822
- return eq(a, b, loose);
823
- case "!=":
824
- return neq(a, b, loose);
825
- case ">":
826
- return gt2(a, b, loose);
827
- case ">=":
828
- return gte(a, b, loose);
829
- case "<":
830
- return lt(a, b, loose);
831
- case "<=":
832
- return lte(a, b, loose);
833
- default:
834
- throw new TypeError(`Invalid operator: ${op}`);
835
- }
836
- };
837
- module2.exports = cmp;
838
- }
839
- });
840
-
841
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js
842
- var require_comparator = __commonJS({
843
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js"(exports2, module2) {
844
- "use strict";
845
- var ANY = Symbol("SemVer ANY");
846
- var Comparator = class _Comparator {
847
- static get ANY() {
848
- return ANY;
849
- }
850
- constructor(comp, options) {
851
- options = parseOptions(options);
852
- if (comp instanceof _Comparator) {
853
- if (comp.loose === !!options.loose) {
854
- return comp;
855
- } else {
856
- comp = comp.value;
857
- }
858
- }
859
- comp = comp.trim().split(/\s+/).join(" ");
860
- debug2("comparator", comp, options);
861
- this.options = options;
862
- this.loose = !!options.loose;
863
- this.parse(comp);
864
- if (this.semver === ANY) {
865
- this.value = "";
866
- } else {
867
- this.value = this.operator + this.semver.version;
868
- }
869
- debug2("comp", this);
870
- }
871
- parse(comp) {
872
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
873
- const m = comp.match(r);
874
- if (!m) {
875
- throw new TypeError(`Invalid comparator: ${comp}`);
876
- }
877
- this.operator = m[1] !== void 0 ? m[1] : "";
878
- if (this.operator === "=") {
879
- this.operator = "";
880
- }
881
- if (!m[2]) {
882
- this.semver = ANY;
883
- } else {
884
- this.semver = new SemVer2(m[2], this.options.loose);
885
- }
886
- }
887
- toString() {
888
- return this.value;
889
- }
890
- test(version2) {
891
- debug2("Comparator.test", version2, this.options.loose);
892
- if (this.semver === ANY || version2 === ANY) {
893
- return true;
894
- }
895
- if (typeof version2 === "string") {
896
- try {
897
- version2 = new SemVer2(version2, this.options);
898
- } catch (er) {
899
- return false;
900
- }
901
- }
902
- return cmp(version2, this.operator, this.semver, this.options);
903
- }
904
- intersects(comp, options) {
905
- if (!(comp instanceof _Comparator)) {
906
- throw new TypeError("a Comparator is required");
907
- }
908
- if (this.operator === "") {
909
- if (this.value === "") {
910
- return true;
911
- }
912
- return new Range2(comp.value, options).test(this.value);
913
- } else if (comp.operator === "") {
914
- if (comp.value === "") {
915
- return true;
916
- }
917
- return new Range2(this.value, options).test(comp.semver);
918
- }
919
- options = parseOptions(options);
920
- if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
921
- return false;
922
- }
923
- if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
924
- return false;
925
- }
926
- if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
927
- return true;
928
- }
929
- if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
930
- return true;
931
- }
932
- if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
933
- return true;
934
- }
935
- if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
936
- return true;
937
- }
938
- if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
939
- return true;
940
- }
941
- return false;
942
- }
943
- };
944
- module2.exports = Comparator;
945
- var parseOptions = require_parse_options();
946
- var { safeRe: re, t } = require_re();
947
- var cmp = require_cmp();
948
- var debug2 = require_debug();
949
- var SemVer2 = require_semver();
950
- var Range2 = require_range();
951
- }
952
- });
953
-
954
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js
955
- var require_range = __commonJS({
956
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js"(exports2, module2) {
957
- "use strict";
958
- var SPACE_CHARACTERS = /\s+/g;
959
- var Range2 = class _Range {
960
- constructor(range, options) {
961
- options = parseOptions(options);
962
- if (range instanceof _Range) {
963
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
964
- return range;
965
- } else {
966
- return new _Range(range.raw, options);
967
- }
968
- }
969
- if (range instanceof Comparator) {
970
- this.raw = range.value;
971
- this.set = [[range]];
972
- this.formatted = void 0;
973
- return this;
974
- }
975
- this.options = options;
976
- this.loose = !!options.loose;
977
- this.includePrerelease = !!options.includePrerelease;
978
- this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
979
- this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
980
- if (!this.set.length) {
981
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
982
- }
983
- if (this.set.length > 1) {
984
- const first = this.set[0];
985
- this.set = this.set.filter((c) => !isNullSet(c[0]));
986
- if (this.set.length === 0) {
987
- this.set = [first];
988
- } else if (this.set.length > 1) {
989
- for (const c of this.set) {
990
- if (c.length === 1 && isAny(c[0])) {
991
- this.set = [c];
992
- break;
993
- }
994
- }
995
- }
996
- }
997
- this.formatted = void 0;
998
- }
999
- get range() {
1000
- if (this.formatted === void 0) {
1001
- this.formatted = "";
1002
- for (let i = 0; i < this.set.length; i++) {
1003
- if (i > 0) {
1004
- this.formatted += "||";
1005
- }
1006
- const comps = this.set[i];
1007
- for (let k = 0; k < comps.length; k++) {
1008
- if (k > 0) {
1009
- this.formatted += " ";
1010
- }
1011
- this.formatted += comps[k].toString().trim();
1012
- }
1013
- }
1014
- }
1015
- return this.formatted;
1016
- }
1017
- format() {
1018
- return this.range;
1019
- }
1020
- toString() {
1021
- return this.range;
1022
- }
1023
- parseRange(range) {
1024
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
1025
- const memoKey = memoOpts + ":" + range;
1026
- const cached = cache.get(memoKey);
1027
- if (cached) {
1028
- return cached;
1029
- }
1030
- const loose = this.options.loose;
1031
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1032
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1033
- debug2("hyphen replace", range);
1034
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1035
- debug2("comparator trim", range);
1036
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1037
- debug2("tilde trim", range);
1038
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1039
- debug2("caret trim", range);
1040
- let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1041
- if (loose) {
1042
- rangeList = rangeList.filter((comp) => {
1043
- debug2("loose invalid filter", comp, this.options);
1044
- return !!comp.match(re[t.COMPARATORLOOSE]);
1045
- });
1046
- }
1047
- debug2("range list", rangeList);
1048
- const rangeMap = /* @__PURE__ */ new Map();
1049
- const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
1050
- for (const comp of comparators) {
1051
- if (isNullSet(comp)) {
1052
- return [comp];
1053
- }
1054
- rangeMap.set(comp.value, comp);
1055
- }
1056
- if (rangeMap.size > 1 && rangeMap.has("")) {
1057
- rangeMap.delete("");
1058
- }
1059
- const result = [...rangeMap.values()];
1060
- cache.set(memoKey, result);
1061
- return result;
1062
- }
1063
- intersects(range, options) {
1064
- if (!(range instanceof _Range)) {
1065
- throw new TypeError("a Range is required");
1066
- }
1067
- return this.set.some((thisComparators) => {
1068
- return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1069
- return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1070
- return rangeComparators.every((rangeComparator) => {
1071
- return thisComparator.intersects(rangeComparator, options);
1072
- });
1073
- });
1074
- });
1075
- });
1076
- }
1077
- // if ANY of the sets match ALL of its comparators, then pass
1078
- test(version2) {
1079
- if (!version2) {
1080
- return false;
1081
- }
1082
- if (typeof version2 === "string") {
1083
- try {
1084
- version2 = new SemVer2(version2, this.options);
1085
- } catch (er) {
1086
- return false;
1087
- }
1088
- }
1089
- for (let i = 0; i < this.set.length; i++) {
1090
- if (testSet(this.set[i], version2, this.options)) {
1091
- return true;
1092
- }
1093
- }
1094
- return false;
1095
- }
1096
- };
1097
- module2.exports = Range2;
1098
- var LRU = require_lrucache();
1099
- var cache = new LRU();
1100
- var parseOptions = require_parse_options();
1101
- var Comparator = require_comparator();
1102
- var debug2 = require_debug();
1103
- var SemVer2 = require_semver();
1104
- var {
1105
- safeRe: re,
1106
- t,
1107
- comparatorTrimReplace,
1108
- tildeTrimReplace,
1109
- caretTrimReplace
1110
- } = require_re();
1111
- var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1112
- var isNullSet = (c) => c.value === "<0.0.0-0";
1113
- var isAny = (c) => c.value === "";
1114
- var isSatisfiable = (comparators, options) => {
1115
- let result = true;
1116
- const remainingComparators = comparators.slice();
1117
- let testComparator = remainingComparators.pop();
1118
- while (result && remainingComparators.length) {
1119
- result = remainingComparators.every((otherComparator) => {
1120
- return testComparator.intersects(otherComparator, options);
1121
- });
1122
- testComparator = remainingComparators.pop();
1123
- }
1124
- return result;
1125
- };
1126
- var parseComparator = (comp, options) => {
1127
- debug2("comp", comp, options);
1128
- comp = replaceCarets(comp, options);
1129
- debug2("caret", comp);
1130
- comp = replaceTildes(comp, options);
1131
- debug2("tildes", comp);
1132
- comp = replaceXRanges(comp, options);
1133
- debug2("xrange", comp);
1134
- comp = replaceStars(comp, options);
1135
- debug2("stars", comp);
1136
- return comp;
1137
- };
1138
- var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1139
- var replaceTildes = (comp, options) => {
1140
- return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1141
- };
1142
- var replaceTilde = (comp, options) => {
1143
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1144
- return comp.replace(r, (_, M, m, p, pr) => {
1145
- debug2("tilde", comp, _, M, m, p, pr);
1146
- let ret;
1147
- if (isX(M)) {
1148
- ret = "";
1149
- } else if (isX(m)) {
1150
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1151
- } else if (isX(p)) {
1152
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1153
- } else if (pr) {
1154
- debug2("replaceTilde pr", pr);
1155
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1156
- } else {
1157
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1158
- }
1159
- debug2("tilde return", ret);
1160
- return ret;
1161
- });
1162
- };
1163
- var replaceCarets = (comp, options) => {
1164
- return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
1165
- };
1166
- var replaceCaret = (comp, options) => {
1167
- debug2("caret", comp, options);
1168
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1169
- const z = options.includePrerelease ? "-0" : "";
1170
- return comp.replace(r, (_, M, m, p, pr) => {
1171
- debug2("caret", comp, _, M, m, p, pr);
1172
- let ret;
1173
- if (isX(M)) {
1174
- ret = "";
1175
- } else if (isX(m)) {
1176
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1177
- } else if (isX(p)) {
1178
- if (M === "0") {
1179
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1180
- } else {
1181
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1182
- }
1183
- } else if (pr) {
1184
- debug2("replaceCaret pr", pr);
1185
- if (M === "0") {
1186
- if (m === "0") {
1187
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1188
- } else {
1189
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1190
- }
1191
- } else {
1192
- ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1193
- }
1194
- } else {
1195
- debug2("no pr");
1196
- if (M === "0") {
1197
- if (m === "0") {
1198
- ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1199
- } else {
1200
- ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1201
- }
1202
- } else {
1203
- ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1204
- }
1205
- }
1206
- debug2("caret return", ret);
1207
- return ret;
1208
- });
1209
- };
1210
- var replaceXRanges = (comp, options) => {
1211
- debug2("replaceXRanges", comp, options);
1212
- return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
1213
- };
1214
- var replaceXRange = (comp, options) => {
1215
- comp = comp.trim();
1216
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1217
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1218
- debug2("xRange", comp, ret, gtlt, M, m, p, pr);
1219
- const xM = isX(M);
1220
- const xm = xM || isX(m);
1221
- const xp = xm || isX(p);
1222
- const anyX = xp;
1223
- if (gtlt === "=" && anyX) {
1224
- gtlt = "";
1225
- }
1226
- pr = options.includePrerelease ? "-0" : "";
1227
- if (xM) {
1228
- if (gtlt === ">" || gtlt === "<") {
1229
- ret = "<0.0.0-0";
1230
- } else {
1231
- ret = "*";
1232
- }
1233
- } else if (gtlt && anyX) {
1234
- if (xm) {
1235
- m = 0;
1236
- }
1237
- p = 0;
1238
- if (gtlt === ">") {
1239
- gtlt = ">=";
1240
- if (xm) {
1241
- M = +M + 1;
1242
- m = 0;
1243
- p = 0;
1244
- } else {
1245
- m = +m + 1;
1246
- p = 0;
1247
- }
1248
- } else if (gtlt === "<=") {
1249
- gtlt = "<";
1250
- if (xm) {
1251
- M = +M + 1;
1252
- } else {
1253
- m = +m + 1;
1254
- }
1255
- }
1256
- if (gtlt === "<") {
1257
- pr = "-0";
1258
- }
1259
- ret = `${gtlt + M}.${m}.${p}${pr}`;
1260
- } else if (xm) {
1261
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1262
- } else if (xp) {
1263
- ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1264
- }
1265
- debug2("xRange return", ret);
1266
- return ret;
1267
- });
1268
- };
1269
- var replaceStars = (comp, options) => {
1270
- debug2("replaceStars", comp, options);
1271
- return comp.trim().replace(re[t.STAR], "");
1272
- };
1273
- var replaceGTE0 = (comp, options) => {
1274
- debug2("replaceGTE0", comp, options);
1275
- return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1276
- };
1277
- var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
1278
- if (isX(fM)) {
1279
- from = "";
1280
- } else if (isX(fm)) {
1281
- from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1282
- } else if (isX(fp)) {
1283
- from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1284
- } else if (fpr) {
1285
- from = `>=${from}`;
1286
- } else {
1287
- from = `>=${from}${incPr ? "-0" : ""}`;
1288
- }
1289
- if (isX(tM)) {
1290
- to = "";
1291
- } else if (isX(tm)) {
1292
- to = `<${+tM + 1}.0.0-0`;
1293
- } else if (isX(tp)) {
1294
- to = `<${tM}.${+tm + 1}.0-0`;
1295
- } else if (tpr) {
1296
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
1297
- } else if (incPr) {
1298
- to = `<${tM}.${tm}.${+tp + 1}-0`;
1299
- } else {
1300
- to = `<=${to}`;
1301
- }
1302
- return `${from} ${to}`.trim();
1303
- };
1304
- var testSet = (set, version2, options) => {
1305
- for (let i = 0; i < set.length; i++) {
1306
- if (!set[i].test(version2)) {
1307
- return false;
1308
- }
1309
- }
1310
- if (version2.prerelease.length && !options.includePrerelease) {
1311
- for (let i = 0; i < set.length; i++) {
1312
- debug2(set[i].semver);
1313
- if (set[i].semver === Comparator.ANY) {
1314
- continue;
1315
- }
1316
- if (set[i].semver.prerelease.length > 0) {
1317
- const allowed = set[i].semver;
1318
- if (allowed.major === version2.major && allowed.minor === version2.minor && allowed.patch === version2.patch) {
1319
- return true;
1320
- }
1321
- }
1322
- }
1323
- return false;
1324
- }
1325
- return true;
1326
- };
1327
- }
1328
- });
1329
-
1330
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js
1331
- var require_min_version = __commonJS({
1332
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js"(exports2, module2) {
1333
- "use strict";
1334
- var SemVer2 = require_semver();
1335
- var Range2 = require_range();
1336
- var gt2 = require_gt();
1337
- var minVersion = (range, loose) => {
1338
- range = new Range2(range, loose);
1339
- let minver = new SemVer2("0.0.0");
1340
- if (range.test(minver)) {
1341
- return minver;
1342
- }
1343
- minver = new SemVer2("0.0.0-0");
1344
- if (range.test(minver)) {
1345
- return minver;
1346
- }
1347
- minver = null;
1348
- for (let i = 0; i < range.set.length; ++i) {
1349
- const comparators = range.set[i];
1350
- let setMin = null;
1351
- comparators.forEach((comparator) => {
1352
- const compver = new SemVer2(comparator.semver.version);
1353
- switch (comparator.operator) {
1354
- case ">":
1355
- if (compver.prerelease.length === 0) {
1356
- compver.patch++;
1357
- } else {
1358
- compver.prerelease.push(0);
1359
- }
1360
- compver.raw = compver.format();
1361
- /* fallthrough */
1362
- case "":
1363
- case ">=":
1364
- if (!setMin || gt2(compver, setMin)) {
1365
- setMin = compver;
1366
- }
1367
- break;
1368
- case "<":
1369
- case "<=":
1370
- break;
1371
- /* istanbul ignore next */
1372
- default:
1373
- throw new Error(`Unexpected operation: ${comparator.operator}`);
1374
- }
1375
- });
1376
- if (setMin && (!minver || gt2(minver, setMin))) {
1377
- minver = setMin;
1378
- }
1379
- }
1380
- if (minver && range.test(minver)) {
1381
- return minver;
1382
- }
1383
- return null;
1384
- };
1385
- module2.exports = minVersion;
1386
- }
1387
- });
1388
-
1389
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js
1390
- var require_satisfies = __commonJS({
1391
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js"(exports2, module2) {
1392
- "use strict";
1393
- var Range2 = require_range();
1394
- var satisfies = (version2, range, options) => {
1395
- try {
1396
- range = new Range2(range, options);
1397
- } catch (er) {
1398
- return false;
1399
- }
1400
- return range.test(version2);
1401
- };
1402
- module2.exports = satisfies;
1403
- }
1404
- });
1405
-
1406
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js
1407
- var require_outside = __commonJS({
1408
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js"(exports2, module2) {
1409
- "use strict";
1410
- var SemVer2 = require_semver();
1411
- var Comparator = require_comparator();
1412
- var { ANY } = Comparator;
1413
- var Range2 = require_range();
1414
- var satisfies = require_satisfies();
1415
- var gt2 = require_gt();
1416
- var lt = require_lt();
1417
- var lte = require_lte();
1418
- var gte = require_gte();
1419
- var outside = (version2, range, hilo, options) => {
1420
- version2 = new SemVer2(version2, options);
1421
- range = new Range2(range, options);
1422
- let gtfn, ltefn, ltfn, comp, ecomp;
1423
- switch (hilo) {
1424
- case ">":
1425
- gtfn = gt2;
1426
- ltefn = lte;
1427
- ltfn = lt;
1428
- comp = ">";
1429
- ecomp = ">=";
1430
- break;
1431
- case "<":
1432
- gtfn = lt;
1433
- ltefn = gte;
1434
- ltfn = gt2;
1435
- comp = "<";
1436
- ecomp = "<=";
1437
- break;
1438
- default:
1439
- throw new TypeError('Must provide a hilo val of "<" or ">"');
1440
- }
1441
- if (satisfies(version2, range, options)) {
1442
- return false;
1443
- }
1444
- for (let i = 0; i < range.set.length; ++i) {
1445
- const comparators = range.set[i];
1446
- let high = null;
1447
- let low = null;
1448
- comparators.forEach((comparator) => {
1449
- if (comparator.semver === ANY) {
1450
- comparator = new Comparator(">=0.0.0");
1451
- }
1452
- high = high || comparator;
1453
- low = low || comparator;
1454
- if (gtfn(comparator.semver, high.semver, options)) {
1455
- high = comparator;
1456
- } else if (ltfn(comparator.semver, low.semver, options)) {
1457
- low = comparator;
1458
- }
1459
- });
1460
- if (high.operator === comp || high.operator === ecomp) {
1461
- return false;
1462
- }
1463
- if ((!low.operator || low.operator === comp) && ltefn(version2, low.semver)) {
1464
- return false;
1465
- } else if (low.operator === ecomp && ltfn(version2, low.semver)) {
1466
- return false;
1467
- }
1468
- }
1469
- return true;
1470
- };
1471
- module2.exports = outside;
1472
- }
1473
- });
1474
-
1475
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js
1476
- var require_ltr = __commonJS({
1477
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js"(exports2, module2) {
1478
- "use strict";
1479
- var outside = require_outside();
1480
- var ltr = (version2, range, options) => outside(version2, range, "<", options);
1481
- module2.exports = ltr;
1482
- }
1483
- });
1484
-
1485
- // node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js
1486
- var require_gtr = __commonJS({
1487
- "node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js"(exports2, module2) {
1488
- "use strict";
1489
- var outside = require_outside();
1490
- var gtr = (version2, range, options) => outside(version2, range, ">", options);
1491
- module2.exports = gtr;
1492
- }
1493
- });
1494
-
1495
26
  // src/commands/helpers/define.ts
1496
- var import_minimist = __toESM(require_minimist());
27
+ var import_minimist = __toESM(require("minimist"));
1497
28
 
1498
29
  // package.json
1499
- var version = "0.0.0-beta-20250820141901";
30
+ var version = "0.0.0-beta-20250822123253";
1500
31
 
1501
32
  // src/commands/helpers/define.ts
1502
33
  function defineCommandGroup(definition) {
@@ -1548,6 +79,41 @@ Options:
1548
79
  `;
1549
80
  }
1550
81
 
82
+ // src/patches/helpers/next.ts
83
+ var import_promises = require("fs/promises");
84
+ var import_node_path = require("path");
85
+ function resolveNextWsDirectory() {
86
+ const id = (
87
+ //
88
+ require.resolve("next-ws/package.json", { paths: [process.cwd()] })
89
+ );
90
+ return (0, import_node_path.dirname)(id);
91
+ }
92
+ function resolveNextDirectory() {
93
+ const id = (
94
+ //
95
+ require.resolve("next/package.json", { paths: [process.cwd()] })
96
+ );
97
+ return (0, import_node_path.dirname)(id);
98
+ }
99
+ async function getInstalledNextVersion() {
100
+ const id = (0, import_node_path.join)(resolveNextDirectory(), "package.json");
101
+ const pkg = await (0, import_promises.readFile)(id, "utf8").then(JSON.parse);
102
+ return String(pkg.version.split("-")[0]);
103
+ }
104
+ async function readTrace() {
105
+ const id = (0, import_node_path.join)(resolveNextDirectory(), ".next-ws-trace.json");
106
+ return (0, import_promises.readFile)(id, "utf-8").then(JSON.parse).catch(() => null);
107
+ }
108
+ async function writeTrace(trace) {
109
+ const id = (0, import_node_path.join)(resolveNextDirectory(), ".next-ws-trace.json");
110
+ await (0, import_promises.writeFile)(id, JSON.stringify(trace, null, 2));
111
+ }
112
+
113
+ // src/patches/patch-1.ts
114
+ var import_node_path3 = require("path");
115
+ var import_jscodeshift = __toESM(require("jscodeshift"));
116
+
1551
117
  // src/patches/helpers/define.ts
1552
118
  var import_promises2 = require("fs/promises");
1553
119
  var import_node_path2 = require("path");
@@ -2093,7 +659,7 @@ async function task(promise, ...message) {
2093
659
  let spinnerIndex = 0;
2094
660
  const spinnerInterval = setInterval(() => {
2095
661
  import_node_readline.default.cursorTo(process.stdout, 0);
2096
- const spinnerChar = spinnerChars[spinnerIndex++ % spinnerChars.length];
662
+ const spinnerChar = spinnerChars[spinnerIndex++ % spinnerChars.length] ?? " ";
2097
663
  process.stdout.write(source_default.cyan("[next-ws]", spinnerChar, ...message));
2098
664
  }, 100);
2099
665
  return promise.then((value) => {
@@ -2113,70 +679,33 @@ async function task(promise, ...message) {
2113
679
  });
2114
680
  }
2115
681
 
2116
- // src/patches/helpers/next.ts
2117
- var import_promises = require("fs/promises");
2118
- var import_node_path = require("path");
2119
- function getDistDirname() {
2120
- const resolveOptions = { paths: [process.cwd()] };
2121
- const nextWsPackagePath = (
2122
- //
2123
- require.resolve("next-ws/package.json", resolveOptions)
2124
- );
2125
- const nextWsDirName = (0, import_node_path.dirname)(nextWsPackagePath);
2126
- return `${nextWsDirName}/dist`.replace(/\\/g, "/").replace(/'/g, "\\'");
2127
- }
2128
- async function findNextDirectory() {
2129
- const resolveOptions = { paths: [process.cwd()] };
2130
- const nextPackagePath = require.resolve("next/package.json", resolveOptions);
2131
- return (0, import_node_path.dirname)(nextPackagePath);
2132
- }
2133
- async function getNextVersion() {
2134
- const nextDirectory = await findNextDirectory();
2135
- const nextPackagePath = (0, import_node_path.join)(nextDirectory, "package.json");
2136
- const nextPackage = await (0, import_promises.readFile)(nextPackagePath, "utf-8").then(JSON.parse);
2137
- return String(nextPackage.version.split("-")[0]);
2138
- }
2139
- async function getTrace() {
2140
- const nextDirectory = await findNextDirectory();
2141
- const tracePath = (0, import_node_path.join)(nextDirectory, ".next-ws-trace.json");
2142
- return (0, import_promises.readFile)(tracePath, "utf-8").then(JSON.parse).catch(() => null);
2143
- }
2144
- async function setTrace(trace) {
2145
- const nextDirectory = await findNextDirectory();
2146
- const tracePath = (0, import_node_path.join)(nextDirectory, ".next-ws-trace.json");
2147
- await (0, import_promises.writeFile)(tracePath, JSON.stringify(trace, null, 2));
2148
- }
2149
-
2150
682
  // src/patches/helpers/define.ts
2151
683
  function definePatch(definition) {
2152
684
  return {
2153
685
  ...definition,
2154
686
  async execute() {
2155
- const results = [];
2156
687
  for (const step of this.steps)
2157
- await task(step.execute(), step.title).then((r) => results.push(r));
2158
- return results.every((r) => r);
688
+ await task(step.execute(), step.title);
2159
689
  }
2160
690
  };
2161
691
  }
2162
692
  function definePatchStep(definition) {
2163
693
  return {
2164
694
  ...definition,
695
+ get path() {
696
+ return resolvePath(definition.path);
697
+ },
2165
698
  async execute() {
2166
- const path = await resolvePath(this.path);
2167
- debug("Applying", `"${this.title}"`, "to", `"${path}"`);
2168
- const source = await (0, import_promises2.readFile)(path, "utf-8");
2169
- if (this.ignore && source.includes(this.ignore)) return false;
2170
- const newSource = await this.modify(source);
2171
- await (0, import_promises2.writeFile)(path, newSource);
2172
- return true;
699
+ debug(`Applying '${this.title}' to '${this.path}'`);
700
+ const code = await (0, import_promises2.readFile)(this.path, "utf8").then((code2) => this.transform(code2));
701
+ await (0, import_promises2.writeFile)(this.path, code);
2173
702
  }
2174
703
  };
2175
704
  }
2176
- async function resolvePath(path) {
705
+ function resolvePath(path) {
2177
706
  switch (path.split(":")[0]) {
2178
707
  case "next": {
2179
- const nextDirectory = await findNextDirectory();
708
+ const nextDirectory = resolveNextDirectory();
2180
709
  const realPath = path.slice(5);
2181
710
  return (0, import_node_path2.resolve)(nextDirectory, realPath);
2182
711
  }
@@ -2187,90 +716,64 @@ async function resolvePath(path) {
2187
716
  }
2188
717
 
2189
718
  // src/patches/patch-1.ts
719
+ var CommentLine = import_jscodeshift.default.Comment;
2190
720
  var patchNextNodeServer = definePatchStep({
2191
- title: "Add WebSocket server setup script to NextNodeServer constructor.",
721
+ title: "Add WebSocket server setup script to NextNodeServer constructor",
2192
722
  path: "next:dist/server/next-server.js",
2193
- ignore: "setupWebSocketServer(this)",
2194
- async modify(source) {
2195
- const sourceLines = source.split("\n");
2196
- let inConstructor = false;
2197
- let constructorEndIndex = -1;
2198
- let braceCount = 0;
2199
- for (let i = 0; i < sourceLines.length; i++) {
2200
- const line = sourceLines[i] ?? "";
2201
- if (!inConstructor && line.includes("constructor(")) {
2202
- inConstructor = true;
2203
- braceCount = 0;
2204
- }
2205
- if (inConstructor) {
2206
- braceCount += (line.match(/{/g) || []).length;
2207
- braceCount -= (line.match(/}/g) || []).length;
2208
- if (braceCount === 0) {
2209
- constructorEndIndex = i;
2210
- break;
2211
- }
2212
- }
2213
- }
2214
- if (constructorEndIndex === -1)
2215
- throw new Error("Could not find constructor end index.");
2216
- const setupScript = `;{
723
+ async transform(code) {
724
+ const marker = "@patch attach-websocket-server";
725
+ const snippet = (0, import_jscodeshift.default)(`
726
+ // ${marker}
2217
727
  let nextWs;
2218
- try { nextWs = require('next-ws/server') } catch {
2219
- try { nextWs = require('${getDistDirname()}/server/index.cjs') } catch {
2220
- /* don't let this crash apps that don't use next-ws */ }}
728
+ try { nextWs ??= require('next-ws/server') } catch {}
729
+ try { nextWs ??= require(require.resolve('next-ws/server', { paths: [process.cwd()] }) )} catch {}
730
+ try { nextWs ??= require('${resolveNextWsDirectory().replaceAll(import_node_path3.sep, "/").replaceAll("'", "\\'")}/dist/server/index.cjs') } catch {}
2221
731
  nextWs?.setupWebSocketServer(this);
2222
- };`;
2223
- sourceLines.splice(constructorEndIndex, 0, setupScript);
2224
- const newSource = sourceLines.join("\n");
2225
- return newSource;
2226
- }
2227
- });
2228
- var patchNextTypesPlugin = definePatchStep({
2229
- title: "Add SOCKET type to Next types",
2230
- path: "next:dist/build/webpack/plugins/next-types-plugin.js",
2231
- ignore: "SOCKET?: Function;",
2232
- async modify(source) {
2233
- const mapRegex = /\.map\(\(method\)=>`\${method}\?: Function`\).join\(['"]\\n +['"]\)/g;
2234
- const newSource = source.replace(mapRegex, (m) => `${m} + "; SOCKET?: Function;"`);
2235
- return newSource;
732
+ `);
733
+ const block = import_jscodeshift.default.blockStatement(snippet.nodes()[0].program.body);
734
+ return (0, import_jscodeshift.default)(code).find(import_jscodeshift.default.ClassDeclaration, { id: { name: "NextNodeServer" } }).find(import_jscodeshift.default.MethodDefinition, { kind: "constructor" }).forEach(({ node }) => {
735
+ const body = node.value.body.body;
736
+ const existing = (0, import_jscodeshift.default)(body).find(CommentLine, { value: ` ${marker}` }).paths()[0];
737
+ const idx = body.indexOf(existing?.parent.node);
738
+ if (existing && idx > -1) body[idx] = block;
739
+ else body.push(block);
740
+ }).toSource();
2236
741
  }
2237
742
  });
2238
- var patch_1_default = definePatch({
2239
- name: "patch-1",
2240
- versions: ">=13.2.0 <=13.4.8",
2241
- steps: [patchNextNodeServer, patchNextTypesPlugin]
2242
- });
2243
-
2244
- // src/patches/patch-2.ts
2245
- var patchNextTypesPlugin2 = definePatchStep({
2246
- ...patchNextTypesPlugin,
2247
- path: "next:dist/build/webpack/plugins/next-types-plugin/index.js"
2248
- });
2249
743
  var patchRouterServer = definePatchStep({
2250
744
  title: "Prevent Next.js from immediately closing WebSocket connections",
2251
745
  path: "next:dist/server/lib/router-server.js",
2252
- async modify(source) {
2253
- const newSource = source.replaceAll("return socket.end();", "").replaceAll(/(\/\/ [a-zA-Z .]+\s+)socket\.end\(\);/g, "");
2254
- return newSource;
746
+ async transform(code) {
747
+ return (0, import_jscodeshift.default)(code).find(import_jscodeshift.default.ReturnStatement).find(import_jscodeshift.default.CallExpression, {
748
+ callee: {
749
+ type: "MemberExpression",
750
+ object: { type: "Identifier", name: "socket" },
751
+ property: { type: "Identifier", name: "end" }
752
+ }
753
+ }).replaceWith((path) => {
754
+ const expr = import_jscodeshift.default.unaryExpression("void", import_jscodeshift.default.literal(0));
755
+ expr.comments = [import_jscodeshift.default.commentLine(` ${(0, import_jscodeshift.default)(path.node).toSource()}`)];
756
+ return expr;
757
+ }).toSource();
2255
758
  }
2256
759
  });
2257
- var patch_2_default = definePatch({
2258
- name: "patch-2",
760
+ var patch_1_default = definePatch({
761
+ name: "patch-1",
2259
762
  versions: ">=13.5.1 <=15.5.0",
2260
- steps: [patchNextNodeServer, patchRouterServer, patchNextTypesPlugin2]
763
+ steps: [patchNextNodeServer, patchRouterServer]
2261
764
  });
2262
765
 
2263
766
  // src/patches/index.ts
2264
- var patches_default = [patch_1_default, patch_2_default];
767
+ var patches_default = [patch_1_default];
2265
768
 
2266
769
  // src/commands/helpers/semver.ts
2267
- var import_range = __toESM(require_range());
2268
- var import_semver = __toESM(require_semver());
2269
- var import_gt = __toESM(require_gt());
2270
- var import_min_version = __toESM(require_min_version());
2271
- var import_ltr = __toESM(require_ltr());
2272
- var import_gtr = __toESM(require_gtr());
2273
- var import_satisfies = __toESM(require_satisfies());
770
+ var import_range = __toESM(require("semver/classes/range.js"));
771
+ var import_semver = __toESM(require("semver/classes/semver.js"));
772
+ var import_gt = __toESM(require("semver/functions/gt.js"));
773
+ var import_satisfies = __toESM(require("semver/functions/satisfies"));
774
+ var import_gtr = __toESM(require("semver/ranges/gtr"));
775
+ var import_ltr = __toESM(require("semver/ranges/ltr"));
776
+ var import_min_version = __toESM(require("semver/ranges/min-version"));
2274
777
  function maxVersion(range, loose) {
2275
778
  range = new import_range.default(range, loose);
2276
779
  let maximumVersion = null;
@@ -2307,7 +810,7 @@ var patch_default = defineCommand({
2307
810
  const supported = patches_default.map((p) => p.versions).join(" || ");
2308
811
  const minimum = import_min_version.default(supported)?.version ?? supported;
2309
812
  const maximum = maxVersion(supported)?.version ?? supported;
2310
- const current = await getNextVersion();
813
+ const current = await getInstalledNextVersion();
2311
814
  if (import_ltr.default(current, minimum)) {
2312
815
  error(
2313
816
  `Next.js v${current} is not supported, a minimum of v${minimum} is required`
@@ -2340,7 +843,7 @@ var patch_default = defineCommand({
2340
843
  info(`Patching Next.js v${current} with '${patch.versions}'`);
2341
844
  await patch.execute();
2342
845
  info("Saving patch trace file...");
2343
- await setTrace({ patch: patch.versions, version: current });
846
+ await writeTrace({ patch: patch.versions, version: current });
2344
847
  info("All done!");
2345
848
  }
2346
849
  });
@@ -2357,7 +860,7 @@ var verify_default = defineCommand({
2357
860
  }
2358
861
  ],
2359
862
  async action(options) {
2360
- const trace = await getTrace();
863
+ const trace = await readTrace();
2361
864
  if (!trace) {
2362
865
  if (options.ensure) {
2363
866
  warn("Next.js has not been patched, running the patch command");
@@ -2369,7 +872,7 @@ var verify_default = defineCommand({
2369
872
  process.exit(1);
2370
873
  }
2371
874
  }
2372
- const current = await getNextVersion();
875
+ const current = await getInstalledNextVersion();
2373
876
  if (current !== trace.version) {
2374
877
  error(
2375
878
  "Next.js has been patched with a different version, you'll need to run the patch command"