@saasmakers/eslint 1.0.1 → 1.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.
Files changed (62) hide show
  1. package/dist/eslint.config.cjs +10905 -19
  2. package/dist/eslint.config.d.cts +11 -3875
  3. package/dist/eslint.config.d.mts +11 -3875
  4. package/dist/eslint.config.d.ts +11 -3875
  5. package/dist/eslint.config.mjs +10883 -18
  6. package/dist/index.cjs +9 -8
  7. package/dist/index.mjs +9 -8
  8. package/dist/shared/{eslint.C6EaTeQZ.mjs → eslint.CohBuu1-.mjs} +1 -34
  9. package/dist/shared/{eslint.Dxl4X46J.cjs → eslint.DhFjwkxh.cjs} +0 -37
  10. package/package.json +1 -2
  11. package/dist/chunks/formatters.cjs +0 -248
  12. package/dist/chunks/formatters.mjs +0 -246
  13. package/dist/chunks/import.cjs +0 -53
  14. package/dist/chunks/import.mjs +0 -51
  15. package/dist/chunks/index.cjs +0 -120
  16. package/dist/chunks/index.mjs +0 -101
  17. package/dist/chunks/index2.cjs +0 -880
  18. package/dist/chunks/index2.mjs +0 -868
  19. package/dist/chunks/index3.cjs +0 -982
  20. package/dist/chunks/index3.mjs +0 -979
  21. package/dist/chunks/index4.cjs +0 -12099
  22. package/dist/chunks/index4.mjs +0 -12077
  23. package/dist/chunks/jsdoc.cjs +0 -38398
  24. package/dist/chunks/jsdoc.mjs +0 -38391
  25. package/dist/chunks/regexp.cjs +0 -18518
  26. package/dist/chunks/regexp.mjs +0 -18511
  27. package/dist/chunks/stylistic.cjs +0 -23935
  28. package/dist/chunks/stylistic.mjs +0 -23932
  29. package/dist/chunks/typescript.cjs +0 -56168
  30. package/dist/chunks/typescript.mjs +0 -56154
  31. package/dist/chunks/unicorn.cjs +0 -82775
  32. package/dist/chunks/unicorn.mjs +0 -82764
  33. package/dist/chunks/vue.cjs +0 -96233
  34. package/dist/chunks/vue.mjs +0 -96220
  35. package/dist/shared/eslint.05nu4VbT.mjs +0 -9
  36. package/dist/shared/eslint.07qTxm9w.mjs +0 -3352
  37. package/dist/shared/eslint.6MAvpL4q.cjs +0 -2141
  38. package/dist/shared/eslint.7dipMixF.cjs +0 -14
  39. package/dist/shared/eslint.B4kWSx8Y.mjs +0 -36946
  40. package/dist/shared/eslint.B6FFUbNC.mjs +0 -3814
  41. package/dist/shared/eslint.BGpVg2tt.cjs +0 -13
  42. package/dist/shared/eslint.BHA6t2Iw.cjs +0 -36994
  43. package/dist/shared/eslint.BL4sYiVQ.cjs +0 -820
  44. package/dist/shared/eslint.BOOP2x9L.cjs +0 -67
  45. package/dist/shared/eslint.BXzpdiiq.mjs +0 -10
  46. package/dist/shared/eslint.Bl69eiyD.cjs +0 -7073
  47. package/dist/shared/eslint.BtkqW7nC.mjs +0 -818
  48. package/dist/shared/eslint.C12_M0Cw.cjs +0 -9
  49. package/dist/shared/eslint.COweQ1RR.mjs +0 -5
  50. package/dist/shared/eslint.CUi9znUC.mjs +0 -13
  51. package/dist/shared/eslint.Cg6Ty7p7.mjs +0 -2699
  52. package/dist/shared/eslint.CxAZpd0w.cjs +0 -3365
  53. package/dist/shared/eslint.DDD2xc4l.cjs +0 -25
  54. package/dist/shared/eslint.DI7QBrVD.mjs +0 -6
  55. package/dist/shared/eslint.DP_6nQqR.cjs +0 -3822
  56. package/dist/shared/eslint.DUamuDzp.cjs +0 -7
  57. package/dist/shared/eslint.Difk5awg.mjs +0 -2139
  58. package/dist/shared/eslint.Dlgr3LGM.mjs +0 -7070
  59. package/dist/shared/eslint.DoYGbUIG.cjs +0 -2724
  60. package/dist/shared/eslint.Dprsk9zl.mjs +0 -65
  61. package/dist/shared/eslint.MfgVmFE7.cjs +0 -3054
  62. package/dist/shared/eslint.W7RM7aEw.mjs +0 -3052
@@ -1,3814 +0,0 @@
1
- import require$$0 from 'tty';
2
- import require$$1 from 'util';
3
- import { g as getAugmentedNamespace } from './eslint.C6EaTeQZ.mjs';
4
-
5
- var src = {exports: {}};
6
-
7
- var browser$1 = {exports: {}};
8
-
9
- /**
10
- * Helpers.
11
- */
12
-
13
- var ms;
14
- var hasRequiredMs;
15
-
16
- function requireMs () {
17
- if (hasRequiredMs) return ms;
18
- hasRequiredMs = 1;
19
- var s = 1000;
20
- var m = s * 60;
21
- var h = m * 60;
22
- var d = h * 24;
23
- var w = d * 7;
24
- var y = d * 365.25;
25
-
26
- /**
27
- * Parse or format the given `val`.
28
- *
29
- * Options:
30
- *
31
- * - `long` verbose formatting [false]
32
- *
33
- * @param {String|Number} val
34
- * @param {Object} [options]
35
- * @throws {Error} throw an error if val is not a non-empty string or a number
36
- * @return {String|Number}
37
- * @api public
38
- */
39
-
40
- ms = function (val, options) {
41
- options = options || {};
42
- var type = typeof val;
43
- if (type === 'string' && val.length > 0) {
44
- return parse(val);
45
- } else if (type === 'number' && isFinite(val)) {
46
- return options.long ? fmtLong(val) : fmtShort(val);
47
- }
48
- throw new Error(
49
- 'val is not a non-empty string or a valid number. val=' +
50
- JSON.stringify(val)
51
- );
52
- };
53
-
54
- /**
55
- * Parse the given `str` and return milliseconds.
56
- *
57
- * @param {String} str
58
- * @return {Number}
59
- * @api private
60
- */
61
-
62
- function parse(str) {
63
- str = String(str);
64
- if (str.length > 100) {
65
- return;
66
- }
67
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
68
- str
69
- );
70
- if (!match) {
71
- return;
72
- }
73
- var n = parseFloat(match[1]);
74
- var type = (match[2] || 'ms').toLowerCase();
75
- switch (type) {
76
- case 'years':
77
- case 'year':
78
- case 'yrs':
79
- case 'yr':
80
- case 'y':
81
- return n * y;
82
- case 'weeks':
83
- case 'week':
84
- case 'w':
85
- return n * w;
86
- case 'days':
87
- case 'day':
88
- case 'd':
89
- return n * d;
90
- case 'hours':
91
- case 'hour':
92
- case 'hrs':
93
- case 'hr':
94
- case 'h':
95
- return n * h;
96
- case 'minutes':
97
- case 'minute':
98
- case 'mins':
99
- case 'min':
100
- case 'm':
101
- return n * m;
102
- case 'seconds':
103
- case 'second':
104
- case 'secs':
105
- case 'sec':
106
- case 's':
107
- return n * s;
108
- case 'milliseconds':
109
- case 'millisecond':
110
- case 'msecs':
111
- case 'msec':
112
- case 'ms':
113
- return n;
114
- default:
115
- return undefined;
116
- }
117
- }
118
-
119
- /**
120
- * Short format for `ms`.
121
- *
122
- * @param {Number} ms
123
- * @return {String}
124
- * @api private
125
- */
126
-
127
- function fmtShort(ms) {
128
- var msAbs = Math.abs(ms);
129
- if (msAbs >= d) {
130
- return Math.round(ms / d) + 'd';
131
- }
132
- if (msAbs >= h) {
133
- return Math.round(ms / h) + 'h';
134
- }
135
- if (msAbs >= m) {
136
- return Math.round(ms / m) + 'm';
137
- }
138
- if (msAbs >= s) {
139
- return Math.round(ms / s) + 's';
140
- }
141
- return ms + 'ms';
142
- }
143
-
144
- /**
145
- * Long format for `ms`.
146
- *
147
- * @param {Number} ms
148
- * @return {String}
149
- * @api private
150
- */
151
-
152
- function fmtLong(ms) {
153
- var msAbs = Math.abs(ms);
154
- if (msAbs >= d) {
155
- return plural(ms, msAbs, d, 'day');
156
- }
157
- if (msAbs >= h) {
158
- return plural(ms, msAbs, h, 'hour');
159
- }
160
- if (msAbs >= m) {
161
- return plural(ms, msAbs, m, 'minute');
162
- }
163
- if (msAbs >= s) {
164
- return plural(ms, msAbs, s, 'second');
165
- }
166
- return ms + ' ms';
167
- }
168
-
169
- /**
170
- * Pluralization helper.
171
- */
172
-
173
- function plural(ms, msAbs, n, name) {
174
- var isPlural = msAbs >= n * 1.5;
175
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
176
- }
177
- return ms;
178
- }
179
-
180
- var common;
181
- var hasRequiredCommon;
182
-
183
- function requireCommon () {
184
- if (hasRequiredCommon) return common;
185
- hasRequiredCommon = 1;
186
- /**
187
- * This is the common logic for both the Node.js and web browser
188
- * implementations of `debug()`.
189
- */
190
-
191
- function setup(env) {
192
- createDebug.debug = createDebug;
193
- createDebug.default = createDebug;
194
- createDebug.coerce = coerce;
195
- createDebug.disable = disable;
196
- createDebug.enable = enable;
197
- createDebug.enabled = enabled;
198
- createDebug.humanize = requireMs();
199
- createDebug.destroy = destroy;
200
-
201
- Object.keys(env).forEach(key => {
202
- createDebug[key] = env[key];
203
- });
204
-
205
- /**
206
- * The currently active debug mode names, and names to skip.
207
- */
208
-
209
- createDebug.names = [];
210
- createDebug.skips = [];
211
-
212
- /**
213
- * Map of special "%n" handling functions, for the debug "format" argument.
214
- *
215
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
216
- */
217
- createDebug.formatters = {};
218
-
219
- /**
220
- * Selects a color for a debug namespace
221
- * @param {String} namespace The namespace string for the debug instance to be colored
222
- * @return {Number|String} An ANSI color code for the given namespace
223
- * @api private
224
- */
225
- function selectColor(namespace) {
226
- let hash = 0;
227
-
228
- for (let i = 0; i < namespace.length; i++) {
229
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
230
- hash |= 0; // Convert to 32bit integer
231
- }
232
-
233
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
234
- }
235
- createDebug.selectColor = selectColor;
236
-
237
- /**
238
- * Create a debugger with the given `namespace`.
239
- *
240
- * @param {String} namespace
241
- * @return {Function}
242
- * @api public
243
- */
244
- function createDebug(namespace) {
245
- let prevTime;
246
- let enableOverride = null;
247
- let namespacesCache;
248
- let enabledCache;
249
-
250
- function debug(...args) {
251
- // Disabled?
252
- if (!debug.enabled) {
253
- return;
254
- }
255
-
256
- const self = debug;
257
-
258
- // Set `diff` timestamp
259
- const curr = Number(new Date());
260
- const ms = curr - (prevTime || curr);
261
- self.diff = ms;
262
- self.prev = prevTime;
263
- self.curr = curr;
264
- prevTime = curr;
265
-
266
- args[0] = createDebug.coerce(args[0]);
267
-
268
- if (typeof args[0] !== 'string') {
269
- // Anything else let's inspect with %O
270
- args.unshift('%O');
271
- }
272
-
273
- // Apply any `formatters` transformations
274
- let index = 0;
275
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
276
- // If we encounter an escaped % then don't increase the array index
277
- if (match === '%%') {
278
- return '%';
279
- }
280
- index++;
281
- const formatter = createDebug.formatters[format];
282
- if (typeof formatter === 'function') {
283
- const val = args[index];
284
- match = formatter.call(self, val);
285
-
286
- // Now we need to remove `args[index]` since it's inlined in the `format`
287
- args.splice(index, 1);
288
- index--;
289
- }
290
- return match;
291
- });
292
-
293
- // Apply env-specific formatting (colors, etc.)
294
- createDebug.formatArgs.call(self, args);
295
-
296
- const logFn = self.log || createDebug.log;
297
- logFn.apply(self, args);
298
- }
299
-
300
- debug.namespace = namespace;
301
- debug.useColors = createDebug.useColors();
302
- debug.color = createDebug.selectColor(namespace);
303
- debug.extend = extend;
304
- debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
305
-
306
- Object.defineProperty(debug, 'enabled', {
307
- enumerable: true,
308
- configurable: false,
309
- get: () => {
310
- if (enableOverride !== null) {
311
- return enableOverride;
312
- }
313
- if (namespacesCache !== createDebug.namespaces) {
314
- namespacesCache = createDebug.namespaces;
315
- enabledCache = createDebug.enabled(namespace);
316
- }
317
-
318
- return enabledCache;
319
- },
320
- set: v => {
321
- enableOverride = v;
322
- }
323
- });
324
-
325
- // Env-specific initialization logic for debug instances
326
- if (typeof createDebug.init === 'function') {
327
- createDebug.init(debug);
328
- }
329
-
330
- return debug;
331
- }
332
-
333
- function extend(namespace, delimiter) {
334
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
335
- newDebug.log = this.log;
336
- return newDebug;
337
- }
338
-
339
- /**
340
- * Enables a debug mode by namespaces. This can include modes
341
- * separated by a colon and wildcards.
342
- *
343
- * @param {String} namespaces
344
- * @api public
345
- */
346
- function enable(namespaces) {
347
- createDebug.save(namespaces);
348
- createDebug.namespaces = namespaces;
349
-
350
- createDebug.names = [];
351
- createDebug.skips = [];
352
-
353
- const split = (typeof namespaces === 'string' ? namespaces : '')
354
- .trim()
355
- .replace(/\s+/g, ',')
356
- .split(',')
357
- .filter(Boolean);
358
-
359
- for (const ns of split) {
360
- if (ns[0] === '-') {
361
- createDebug.skips.push(ns.slice(1));
362
- } else {
363
- createDebug.names.push(ns);
364
- }
365
- }
366
- }
367
-
368
- /**
369
- * Checks if the given string matches a namespace template, honoring
370
- * asterisks as wildcards.
371
- *
372
- * @param {String} search
373
- * @param {String} template
374
- * @return {Boolean}
375
- */
376
- function matchesTemplate(search, template) {
377
- let searchIndex = 0;
378
- let templateIndex = 0;
379
- let starIndex = -1;
380
- let matchIndex = 0;
381
-
382
- while (searchIndex < search.length) {
383
- if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
384
- // Match character or proceed with wildcard
385
- if (template[templateIndex] === '*') {
386
- starIndex = templateIndex;
387
- matchIndex = searchIndex;
388
- templateIndex++; // Skip the '*'
389
- } else {
390
- searchIndex++;
391
- templateIndex++;
392
- }
393
- } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
394
- // Backtrack to the last '*' and try to match more characters
395
- templateIndex = starIndex + 1;
396
- matchIndex++;
397
- searchIndex = matchIndex;
398
- } else {
399
- return false; // No match
400
- }
401
- }
402
-
403
- // Handle trailing '*' in template
404
- while (templateIndex < template.length && template[templateIndex] === '*') {
405
- templateIndex++;
406
- }
407
-
408
- return templateIndex === template.length;
409
- }
410
-
411
- /**
412
- * Disable debug output.
413
- *
414
- * @return {String} namespaces
415
- * @api public
416
- */
417
- function disable() {
418
- const namespaces = [
419
- ...createDebug.names,
420
- ...createDebug.skips.map(namespace => '-' + namespace)
421
- ].join(',');
422
- createDebug.enable('');
423
- return namespaces;
424
- }
425
-
426
- /**
427
- * Returns true if the given mode name is enabled, false otherwise.
428
- *
429
- * @param {String} name
430
- * @return {Boolean}
431
- * @api public
432
- */
433
- function enabled(name) {
434
- for (const skip of createDebug.skips) {
435
- if (matchesTemplate(name, skip)) {
436
- return false;
437
- }
438
- }
439
-
440
- for (const ns of createDebug.names) {
441
- if (matchesTemplate(name, ns)) {
442
- return true;
443
- }
444
- }
445
-
446
- return false;
447
- }
448
-
449
- /**
450
- * Coerce `val`.
451
- *
452
- * @param {Mixed} val
453
- * @return {Mixed}
454
- * @api private
455
- */
456
- function coerce(val) {
457
- if (val instanceof Error) {
458
- return val.stack || val.message;
459
- }
460
- return val;
461
- }
462
-
463
- /**
464
- * XXX DO NOT USE. This is a temporary stub function.
465
- * XXX It WILL be removed in the next major release.
466
- */
467
- function destroy() {
468
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
469
- }
470
-
471
- createDebug.enable(createDebug.load());
472
-
473
- return createDebug;
474
- }
475
-
476
- common = setup;
477
- return common;
478
- }
479
-
480
- /* eslint-env browser */
481
-
482
- var hasRequiredBrowser;
483
-
484
- function requireBrowser () {
485
- if (hasRequiredBrowser) return browser$1.exports;
486
- hasRequiredBrowser = 1;
487
- (function (module, exports$1) {
488
- /**
489
- * This is the web browser implementation of `debug()`.
490
- */
491
-
492
- exports$1.formatArgs = formatArgs;
493
- exports$1.save = save;
494
- exports$1.load = load;
495
- exports$1.useColors = useColors;
496
- exports$1.storage = localstorage();
497
- exports$1.destroy = (() => {
498
- let warned = false;
499
-
500
- return () => {
501
- if (!warned) {
502
- warned = true;
503
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
504
- }
505
- };
506
- })();
507
-
508
- /**
509
- * Colors.
510
- */
511
-
512
- exports$1.colors = [
513
- '#0000CC',
514
- '#0000FF',
515
- '#0033CC',
516
- '#0033FF',
517
- '#0066CC',
518
- '#0066FF',
519
- '#0099CC',
520
- '#0099FF',
521
- '#00CC00',
522
- '#00CC33',
523
- '#00CC66',
524
- '#00CC99',
525
- '#00CCCC',
526
- '#00CCFF',
527
- '#3300CC',
528
- '#3300FF',
529
- '#3333CC',
530
- '#3333FF',
531
- '#3366CC',
532
- '#3366FF',
533
- '#3399CC',
534
- '#3399FF',
535
- '#33CC00',
536
- '#33CC33',
537
- '#33CC66',
538
- '#33CC99',
539
- '#33CCCC',
540
- '#33CCFF',
541
- '#6600CC',
542
- '#6600FF',
543
- '#6633CC',
544
- '#6633FF',
545
- '#66CC00',
546
- '#66CC33',
547
- '#9900CC',
548
- '#9900FF',
549
- '#9933CC',
550
- '#9933FF',
551
- '#99CC00',
552
- '#99CC33',
553
- '#CC0000',
554
- '#CC0033',
555
- '#CC0066',
556
- '#CC0099',
557
- '#CC00CC',
558
- '#CC00FF',
559
- '#CC3300',
560
- '#CC3333',
561
- '#CC3366',
562
- '#CC3399',
563
- '#CC33CC',
564
- '#CC33FF',
565
- '#CC6600',
566
- '#CC6633',
567
- '#CC9900',
568
- '#CC9933',
569
- '#CCCC00',
570
- '#CCCC33',
571
- '#FF0000',
572
- '#FF0033',
573
- '#FF0066',
574
- '#FF0099',
575
- '#FF00CC',
576
- '#FF00FF',
577
- '#FF3300',
578
- '#FF3333',
579
- '#FF3366',
580
- '#FF3399',
581
- '#FF33CC',
582
- '#FF33FF',
583
- '#FF6600',
584
- '#FF6633',
585
- '#FF9900',
586
- '#FF9933',
587
- '#FFCC00',
588
- '#FFCC33'
589
- ];
590
-
591
- /**
592
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
593
- * and the Firebug extension (any Firefox version) are known
594
- * to support "%c" CSS customizations.
595
- *
596
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
597
- */
598
-
599
- // eslint-disable-next-line complexity
600
- function useColors() {
601
- // NB: In an Electron preload script, document will be defined but not fully
602
- // initialized. Since we know we're in Chrome, we'll just detect this case
603
- // explicitly
604
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
605
- return true;
606
- }
607
-
608
- // Internet Explorer and Edge do not support colors.
609
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
610
- return false;
611
- }
612
-
613
- let m;
614
-
615
- // Is webkit? http://stackoverflow.com/a/16459606/376773
616
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
617
- // eslint-disable-next-line no-return-assign
618
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
619
- // Is firebug? http://stackoverflow.com/a/398120/376773
620
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
621
- // Is firefox >= v31?
622
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
623
- (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
624
- // Double check webkit in userAgent just in case we are in a worker
625
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
626
- }
627
-
628
- /**
629
- * Colorize log arguments if enabled.
630
- *
631
- * @api public
632
- */
633
-
634
- function formatArgs(args) {
635
- args[0] = (this.useColors ? '%c' : '') +
636
- this.namespace +
637
- (this.useColors ? ' %c' : ' ') +
638
- args[0] +
639
- (this.useColors ? '%c ' : ' ') +
640
- '+' + module.exports.humanize(this.diff);
641
-
642
- if (!this.useColors) {
643
- return;
644
- }
645
-
646
- const c = 'color: ' + this.color;
647
- args.splice(1, 0, c, 'color: inherit');
648
-
649
- // The final "%c" is somewhat tricky, because there could be other
650
- // arguments passed either before or after the %c, so we need to
651
- // figure out the correct index to insert the CSS into
652
- let index = 0;
653
- let lastC = 0;
654
- args[0].replace(/%[a-zA-Z%]/g, match => {
655
- if (match === '%%') {
656
- return;
657
- }
658
- index++;
659
- if (match === '%c') {
660
- // We only are interested in the *last* %c
661
- // (the user may have provided their own)
662
- lastC = index;
663
- }
664
- });
665
-
666
- args.splice(lastC, 0, c);
667
- }
668
-
669
- /**
670
- * Invokes `console.debug()` when available.
671
- * No-op when `console.debug` is not a "function".
672
- * If `console.debug` is not available, falls back
673
- * to `console.log`.
674
- *
675
- * @api public
676
- */
677
- exports$1.log = console.debug || console.log || (() => {});
678
-
679
- /**
680
- * Save `namespaces`.
681
- *
682
- * @param {String} namespaces
683
- * @api private
684
- */
685
- function save(namespaces) {
686
- try {
687
- if (namespaces) {
688
- exports$1.storage.setItem('debug', namespaces);
689
- } else {
690
- exports$1.storage.removeItem('debug');
691
- }
692
- } catch (error) {
693
- // Swallow
694
- // XXX (@Qix-) should we be logging these?
695
- }
696
- }
697
-
698
- /**
699
- * Load `namespaces`.
700
- *
701
- * @return {String} returns the previously persisted debug modes
702
- * @api private
703
- */
704
- function load() {
705
- let r;
706
- try {
707
- r = exports$1.storage.getItem('debug') || exports$1.storage.getItem('DEBUG') ;
708
- } catch (error) {
709
- // Swallow
710
- // XXX (@Qix-) should we be logging these?
711
- }
712
-
713
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
714
- if (!r && typeof process !== 'undefined' && 'env' in process) {
715
- r = process.env.DEBUG;
716
- }
717
-
718
- return r;
719
- }
720
-
721
- /**
722
- * Localstorage attempts to return the localstorage.
723
- *
724
- * This is necessary because safari throws
725
- * when a user disables cookies/localstorage
726
- * and you attempt to access it.
727
- *
728
- * @return {LocalStorage}
729
- * @api private
730
- */
731
-
732
- function localstorage() {
733
- try {
734
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
735
- // The Browser also has localStorage in the global context.
736
- return localStorage;
737
- } catch (error) {
738
- // Swallow
739
- // XXX (@Qix-) should we be logging these?
740
- }
741
- }
742
-
743
- module.exports = requireCommon()(exports$1);
744
-
745
- const {formatters} = module.exports;
746
-
747
- /**
748
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
749
- */
750
-
751
- formatters.j = function (v) {
752
- try {
753
- return JSON.stringify(v);
754
- } catch (error) {
755
- return '[UnexpectedJSONParseError]: ' + error.message;
756
- }
757
- };
758
- } (browser$1, browser$1.exports));
759
- return browser$1.exports;
760
- }
761
-
762
- var node = {exports: {}};
763
-
764
- /* eslint-env browser */
765
- /* eslint-disable n/no-unsupported-features/node-builtins */
766
-
767
- const level = (() => {
768
- if (!('navigator' in globalThis)) {
769
- return 0;
770
- }
771
-
772
- if (globalThis.navigator.userAgentData) {
773
- const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
774
- if (brand?.version > 93) {
775
- return 3;
776
- }
777
- }
778
-
779
- if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
780
- return 1;
781
- }
782
-
783
- return 0;
784
- })();
785
-
786
- const colorSupport = level !== 0 && {
787
- level,
788
- hasBasic: true,
789
- has256: level >= 2,
790
- has16m: level >= 3,
791
- };
792
-
793
- const supportsColor = {
794
- stdout: colorSupport,
795
- stderr: colorSupport,
796
- };
797
-
798
- const browser = {
799
- __proto__: null,
800
- default: supportsColor
801
- };
802
-
803
- const require$$2 = /*@__PURE__*/getAugmentedNamespace(browser);
804
-
805
- /**
806
- * Module dependencies.
807
- */
808
-
809
- var hasRequiredNode;
810
-
811
- function requireNode () {
812
- if (hasRequiredNode) return node.exports;
813
- hasRequiredNode = 1;
814
- (function (module, exports$1) {
815
- const tty = require$$0;
816
- const util = require$$1;
817
-
818
- /**
819
- * This is the Node.js implementation of `debug()`.
820
- */
821
-
822
- exports$1.init = init;
823
- exports$1.log = log;
824
- exports$1.formatArgs = formatArgs;
825
- exports$1.save = save;
826
- exports$1.load = load;
827
- exports$1.useColors = useColors;
828
- exports$1.destroy = util.deprecate(
829
- () => {},
830
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
831
- );
832
-
833
- /**
834
- * Colors.
835
- */
836
-
837
- exports$1.colors = [6, 2, 3, 4, 5, 1];
838
-
839
- try {
840
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
841
- // eslint-disable-next-line import/no-extraneous-dependencies
842
- const supportsColor = require$$2;
843
-
844
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
845
- exports$1.colors = [
846
- 20,
847
- 21,
848
- 26,
849
- 27,
850
- 32,
851
- 33,
852
- 38,
853
- 39,
854
- 40,
855
- 41,
856
- 42,
857
- 43,
858
- 44,
859
- 45,
860
- 56,
861
- 57,
862
- 62,
863
- 63,
864
- 68,
865
- 69,
866
- 74,
867
- 75,
868
- 76,
869
- 77,
870
- 78,
871
- 79,
872
- 80,
873
- 81,
874
- 92,
875
- 93,
876
- 98,
877
- 99,
878
- 112,
879
- 113,
880
- 128,
881
- 129,
882
- 134,
883
- 135,
884
- 148,
885
- 149,
886
- 160,
887
- 161,
888
- 162,
889
- 163,
890
- 164,
891
- 165,
892
- 166,
893
- 167,
894
- 168,
895
- 169,
896
- 170,
897
- 171,
898
- 172,
899
- 173,
900
- 178,
901
- 179,
902
- 184,
903
- 185,
904
- 196,
905
- 197,
906
- 198,
907
- 199,
908
- 200,
909
- 201,
910
- 202,
911
- 203,
912
- 204,
913
- 205,
914
- 206,
915
- 207,
916
- 208,
917
- 209,
918
- 214,
919
- 215,
920
- 220,
921
- 221
922
- ];
923
- }
924
- } catch (error) {
925
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
926
- }
927
-
928
- /**
929
- * Build up the default `inspectOpts` object from the environment variables.
930
- *
931
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
932
- */
933
-
934
- exports$1.inspectOpts = Object.keys(process.env).filter(key => {
935
- return /^debug_/i.test(key);
936
- }).reduce((obj, key) => {
937
- // Camel-case
938
- const prop = key
939
- .substring(6)
940
- .toLowerCase()
941
- .replace(/_([a-z])/g, (_, k) => {
942
- return k.toUpperCase();
943
- });
944
-
945
- // Coerce string value into JS value
946
- let val = process.env[key];
947
- if (/^(yes|on|true|enabled)$/i.test(val)) {
948
- val = true;
949
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
950
- val = false;
951
- } else if (val === 'null') {
952
- val = null;
953
- } else {
954
- val = Number(val);
955
- }
956
-
957
- obj[prop] = val;
958
- return obj;
959
- }, {});
960
-
961
- /**
962
- * Is stdout a TTY? Colored output is enabled when `true`.
963
- */
964
-
965
- function useColors() {
966
- return 'colors' in exports$1.inspectOpts ?
967
- Boolean(exports$1.inspectOpts.colors) :
968
- tty.isatty(process.stderr.fd);
969
- }
970
-
971
- /**
972
- * Adds ANSI color escape codes if enabled.
973
- *
974
- * @api public
975
- */
976
-
977
- function formatArgs(args) {
978
- const {namespace: name, useColors} = this;
979
-
980
- if (useColors) {
981
- const c = this.color;
982
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
983
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
984
-
985
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
986
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
987
- } else {
988
- args[0] = getDate() + name + ' ' + args[0];
989
- }
990
- }
991
-
992
- function getDate() {
993
- if (exports$1.inspectOpts.hideDate) {
994
- return '';
995
- }
996
- return new Date().toISOString() + ' ';
997
- }
998
-
999
- /**
1000
- * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
1001
- */
1002
-
1003
- function log(...args) {
1004
- return process.stderr.write(util.formatWithOptions(exports$1.inspectOpts, ...args) + '\n');
1005
- }
1006
-
1007
- /**
1008
- * Save `namespaces`.
1009
- *
1010
- * @param {String} namespaces
1011
- * @api private
1012
- */
1013
- function save(namespaces) {
1014
- if (namespaces) {
1015
- process.env.DEBUG = namespaces;
1016
- } else {
1017
- // If you set a process.env field to null or undefined, it gets cast to the
1018
- // string 'null' or 'undefined'. Just delete instead.
1019
- delete process.env.DEBUG;
1020
- }
1021
- }
1022
-
1023
- /**
1024
- * Load `namespaces`.
1025
- *
1026
- * @return {String} returns the previously persisted debug modes
1027
- * @api private
1028
- */
1029
-
1030
- function load() {
1031
- return process.env.DEBUG;
1032
- }
1033
-
1034
- /**
1035
- * Init logic for `debug` instances.
1036
- *
1037
- * Create a new `inspectOpts` object in case `useColors` is set
1038
- * differently for a particular `debug` instance.
1039
- */
1040
-
1041
- function init(debug) {
1042
- debug.inspectOpts = {};
1043
-
1044
- const keys = Object.keys(exports$1.inspectOpts);
1045
- for (let i = 0; i < keys.length; i++) {
1046
- debug.inspectOpts[keys[i]] = exports$1.inspectOpts[keys[i]];
1047
- }
1048
- }
1049
-
1050
- module.exports = requireCommon()(exports$1);
1051
-
1052
- const {formatters} = module.exports;
1053
-
1054
- /**
1055
- * Map %o to `util.inspect()`, all on a single line.
1056
- */
1057
-
1058
- formatters.o = function (v) {
1059
- this.inspectOpts.colors = this.useColors;
1060
- return util.inspect(v, this.inspectOpts)
1061
- .split('\n')
1062
- .map(str => str.trim())
1063
- .join(' ');
1064
- };
1065
-
1066
- /**
1067
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
1068
- */
1069
-
1070
- formatters.O = function (v) {
1071
- this.inspectOpts.colors = this.useColors;
1072
- return util.inspect(v, this.inspectOpts);
1073
- };
1074
- } (node, node.exports));
1075
- return node.exports;
1076
- }
1077
-
1078
- /**
1079
- * Detect Electron renderer / nwjs process, which is node, but we should
1080
- * treat as a browser.
1081
- */
1082
-
1083
- var hasRequiredSrc;
1084
-
1085
- function requireSrc () {
1086
- if (hasRequiredSrc) return src.exports;
1087
- hasRequiredSrc = 1;
1088
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
1089
- src.exports = requireBrowser();
1090
- } else {
1091
- src.exports = requireNode();
1092
- }
1093
- return src.exports;
1094
- }
1095
-
1096
- var re = {exports: {}};
1097
-
1098
- var constants;
1099
- var hasRequiredConstants;
1100
-
1101
- function requireConstants () {
1102
- if (hasRequiredConstants) return constants;
1103
- hasRequiredConstants = 1;
1104
-
1105
- // Note: this is the semver.org version of the spec that it implements
1106
- // Not necessarily the package version of this code.
1107
- const SEMVER_SPEC_VERSION = '2.0.0';
1108
-
1109
- const MAX_LENGTH = 256;
1110
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
1111
- /* istanbul ignore next */ 9007199254740991;
1112
-
1113
- // Max safe segment length for coercion.
1114
- const MAX_SAFE_COMPONENT_LENGTH = 16;
1115
-
1116
- // Max safe length for a build identifier. The max length minus 6 characters for
1117
- // the shortest version with a build 0.0.0+BUILD.
1118
- const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
1119
-
1120
- const RELEASE_TYPES = [
1121
- 'major',
1122
- 'premajor',
1123
- 'minor',
1124
- 'preminor',
1125
- 'patch',
1126
- 'prepatch',
1127
- 'prerelease',
1128
- ];
1129
-
1130
- constants = {
1131
- MAX_LENGTH,
1132
- MAX_SAFE_COMPONENT_LENGTH,
1133
- MAX_SAFE_BUILD_LENGTH,
1134
- MAX_SAFE_INTEGER,
1135
- RELEASE_TYPES,
1136
- SEMVER_SPEC_VERSION,
1137
- FLAG_INCLUDE_PRERELEASE: 0b001,
1138
- FLAG_LOOSE: 0b010,
1139
- };
1140
- return constants;
1141
- }
1142
-
1143
- var debug_1;
1144
- var hasRequiredDebug;
1145
-
1146
- function requireDebug () {
1147
- if (hasRequiredDebug) return debug_1;
1148
- hasRequiredDebug = 1;
1149
-
1150
- const debug = (
1151
- typeof process === 'object' &&
1152
- process.env &&
1153
- process.env.NODE_DEBUG &&
1154
- /\bsemver\b/i.test(process.env.NODE_DEBUG)
1155
- ) ? (...args) => console.error('SEMVER', ...args)
1156
- : () => {};
1157
-
1158
- debug_1 = debug;
1159
- return debug_1;
1160
- }
1161
-
1162
- var hasRequiredRe;
1163
-
1164
- function requireRe () {
1165
- if (hasRequiredRe) return re.exports;
1166
- hasRequiredRe = 1;
1167
- (function (module, exports$1) {
1168
-
1169
- const {
1170
- MAX_SAFE_COMPONENT_LENGTH,
1171
- MAX_SAFE_BUILD_LENGTH,
1172
- MAX_LENGTH,
1173
- } = requireConstants();
1174
- const debug = requireDebug();
1175
- exports$1 = module.exports = {};
1176
-
1177
- // The actual regexps go on exports.re
1178
- const re = exports$1.re = [];
1179
- const safeRe = exports$1.safeRe = [];
1180
- const src = exports$1.src = [];
1181
- const safeSrc = exports$1.safeSrc = [];
1182
- const t = exports$1.t = {};
1183
- let R = 0;
1184
-
1185
- const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
1186
-
1187
- // Replace some greedy regex tokens to prevent regex dos issues. These regex are
1188
- // used internally via the safeRe object since all inputs in this library get
1189
- // normalized first to trim and collapse all extra whitespace. The original
1190
- // regexes are exported for userland consumption and lower level usage. A
1191
- // future breaking change could export the safer regex only with a note that
1192
- // all input should have extra whitespace removed.
1193
- const safeRegexReplacements = [
1194
- ['\\s', 1],
1195
- ['\\d', MAX_LENGTH],
1196
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
1197
- ];
1198
-
1199
- const makeSafeRegex = (value) => {
1200
- for (const [token, max] of safeRegexReplacements) {
1201
- value = value
1202
- .split(`${token}*`).join(`${token}{0,${max}}`)
1203
- .split(`${token}+`).join(`${token}{1,${max}}`);
1204
- }
1205
- return value
1206
- };
1207
-
1208
- const createToken = (name, value, isGlobal) => {
1209
- const safe = makeSafeRegex(value);
1210
- const index = R++;
1211
- debug(name, index, value);
1212
- t[name] = index;
1213
- src[index] = value;
1214
- safeSrc[index] = safe;
1215
- re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
1216
- safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
1217
- };
1218
-
1219
- // The following Regular Expressions can be used for tokenizing,
1220
- // validating, and parsing SemVer version strings.
1221
-
1222
- // ## Numeric Identifier
1223
- // A single `0`, or a non-zero digit followed by zero or more digits.
1224
-
1225
- createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
1226
- createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
1227
-
1228
- // ## Non-numeric Identifier
1229
- // Zero or more digits, followed by a letter or hyphen, and then zero or
1230
- // more letters, digits, or hyphens.
1231
-
1232
- createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
1233
-
1234
- // ## Main Version
1235
- // Three dot-separated numeric identifiers.
1236
-
1237
- createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
1238
- `(${src[t.NUMERICIDENTIFIER]})\\.` +
1239
- `(${src[t.NUMERICIDENTIFIER]})`);
1240
-
1241
- createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
1242
- `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
1243
- `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
1244
-
1245
- // ## Pre-release Version Identifier
1246
- // A numeric identifier, or a non-numeric identifier.
1247
- // Non-numeric identifiers include numeric identifiers but can be longer.
1248
- // Therefore non-numeric identifiers must go first.
1249
-
1250
- createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
1251
- }|${src[t.NUMERICIDENTIFIER]})`);
1252
-
1253
- createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
1254
- }|${src[t.NUMERICIDENTIFIERLOOSE]})`);
1255
-
1256
- // ## Pre-release Version
1257
- // Hyphen, followed by one or more dot-separated pre-release version
1258
- // identifiers.
1259
-
1260
- createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
1261
- }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
1262
-
1263
- createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
1264
- }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
1265
-
1266
- // ## Build Metadata Identifier
1267
- // Any combination of digits, letters, or hyphens.
1268
-
1269
- createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
1270
-
1271
- // ## Build Metadata
1272
- // Plus sign, followed by one or more period-separated build metadata
1273
- // identifiers.
1274
-
1275
- createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
1276
- }(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
1277
-
1278
- // ## Full Version String
1279
- // A main version, followed optionally by a pre-release version and
1280
- // build metadata.
1281
-
1282
- // Note that the only major, minor, patch, and pre-release sections of
1283
- // the version string are capturing groups. The build metadata is not a
1284
- // capturing group, because it should not ever be used in version
1285
- // comparison.
1286
-
1287
- createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
1288
- }${src[t.PRERELEASE]}?${
1289
- src[t.BUILD]}?`);
1290
-
1291
- createToken('FULL', `^${src[t.FULLPLAIN]}$`);
1292
-
1293
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
1294
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
1295
- // common in the npm registry.
1296
- createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
1297
- }${src[t.PRERELEASELOOSE]}?${
1298
- src[t.BUILD]}?`);
1299
-
1300
- createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
1301
-
1302
- createToken('GTLT', '((?:<|>)?=?)');
1303
-
1304
- // Something like "2.*" or "1.2.x".
1305
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
1306
- // Only the first item is strictly required.
1307
- createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
1308
- createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
1309
-
1310
- createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
1311
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
1312
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
1313
- `(?:${src[t.PRERELEASE]})?${
1314
- src[t.BUILD]}?` +
1315
- `)?)?`);
1316
-
1317
- createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
1318
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
1319
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
1320
- `(?:${src[t.PRERELEASELOOSE]})?${
1321
- src[t.BUILD]}?` +
1322
- `)?)?`);
1323
-
1324
- createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
1325
- createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
1326
-
1327
- // Coercion.
1328
- // Extract anything that could conceivably be a part of a valid semver
1329
- createToken('COERCEPLAIN', `${'(^|[^\\d])' +
1330
- '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
1331
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
1332
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
1333
- createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
1334
- createToken('COERCEFULL', src[t.COERCEPLAIN] +
1335
- `(?:${src[t.PRERELEASE]})?` +
1336
- `(?:${src[t.BUILD]})?` +
1337
- `(?:$|[^\\d])`);
1338
- createToken('COERCERTL', src[t.COERCE], true);
1339
- createToken('COERCERTLFULL', src[t.COERCEFULL], true);
1340
-
1341
- // Tilde ranges.
1342
- // Meaning is "reasonably at or greater than"
1343
- createToken('LONETILDE', '(?:~>?)');
1344
-
1345
- createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
1346
- exports$1.tildeTrimReplace = '$1~';
1347
-
1348
- createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
1349
- createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
1350
-
1351
- // Caret ranges.
1352
- // Meaning is "at least and backwards compatible with"
1353
- createToken('LONECARET', '(?:\\^)');
1354
-
1355
- createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
1356
- exports$1.caretTrimReplace = '$1^';
1357
-
1358
- createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
1359
- createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
1360
-
1361
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
1362
- createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
1363
- createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
1364
-
1365
- // An expression to strip any whitespace between the gtlt and the thing
1366
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
1367
- createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
1368
- }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
1369
- exports$1.comparatorTrimReplace = '$1$2$3';
1370
-
1371
- // Something like `1.2.3 - 1.2.4`
1372
- // Note that these all use the loose form, because they'll be
1373
- // checked against either the strict or loose comparator form
1374
- // later.
1375
- createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
1376
- `\\s+-\\s+` +
1377
- `(${src[t.XRANGEPLAIN]})` +
1378
- `\\s*$`);
1379
-
1380
- createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
1381
- `\\s+-\\s+` +
1382
- `(${src[t.XRANGEPLAINLOOSE]})` +
1383
- `\\s*$`);
1384
-
1385
- // Star ranges basically just allow anything at all.
1386
- createToken('STAR', '(<|>)?=?\\s*\\*');
1387
- // >=0.0.0 is like a star
1388
- createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
1389
- createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
1390
- } (re, re.exports));
1391
- return re.exports;
1392
- }
1393
-
1394
- var parseOptions_1;
1395
- var hasRequiredParseOptions;
1396
-
1397
- function requireParseOptions () {
1398
- if (hasRequiredParseOptions) return parseOptions_1;
1399
- hasRequiredParseOptions = 1;
1400
-
1401
- // parse out just the options we care about
1402
- const looseOption = Object.freeze({ loose: true });
1403
- const emptyOpts = Object.freeze({ });
1404
- const parseOptions = options => {
1405
- if (!options) {
1406
- return emptyOpts
1407
- }
1408
-
1409
- if (typeof options !== 'object') {
1410
- return looseOption
1411
- }
1412
-
1413
- return options
1414
- };
1415
- parseOptions_1 = parseOptions;
1416
- return parseOptions_1;
1417
- }
1418
-
1419
- var identifiers;
1420
- var hasRequiredIdentifiers;
1421
-
1422
- function requireIdentifiers () {
1423
- if (hasRequiredIdentifiers) return identifiers;
1424
- hasRequiredIdentifiers = 1;
1425
-
1426
- const numeric = /^[0-9]+$/;
1427
- const compareIdentifiers = (a, b) => {
1428
- if (typeof a === 'number' && typeof b === 'number') {
1429
- return a === b ? 0 : a < b ? -1 : 1
1430
- }
1431
-
1432
- const anum = numeric.test(a);
1433
- const bnum = numeric.test(b);
1434
-
1435
- if (anum && bnum) {
1436
- a = +a;
1437
- b = +b;
1438
- }
1439
-
1440
- return a === b ? 0
1441
- : (anum && !bnum) ? -1
1442
- : (bnum && !anum) ? 1
1443
- : a < b ? -1
1444
- : 1
1445
- };
1446
-
1447
- const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
1448
-
1449
- identifiers = {
1450
- compareIdentifiers,
1451
- rcompareIdentifiers,
1452
- };
1453
- return identifiers;
1454
- }
1455
-
1456
- var semver$1;
1457
- var hasRequiredSemver$1;
1458
-
1459
- function requireSemver$1 () {
1460
- if (hasRequiredSemver$1) return semver$1;
1461
- hasRequiredSemver$1 = 1;
1462
-
1463
- const debug = requireDebug();
1464
- const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
1465
- const { safeRe: re, t } = requireRe();
1466
-
1467
- const parseOptions = requireParseOptions();
1468
- const { compareIdentifiers } = requireIdentifiers();
1469
- class SemVer {
1470
- constructor (version, options) {
1471
- options = parseOptions(options);
1472
-
1473
- if (version instanceof SemVer) {
1474
- if (version.loose === !!options.loose &&
1475
- version.includePrerelease === !!options.includePrerelease) {
1476
- return version
1477
- } else {
1478
- version = version.version;
1479
- }
1480
- } else if (typeof version !== 'string') {
1481
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
1482
- }
1483
-
1484
- if (version.length > MAX_LENGTH) {
1485
- throw new TypeError(
1486
- `version is longer than ${MAX_LENGTH} characters`
1487
- )
1488
- }
1489
-
1490
- debug('SemVer', version, options);
1491
- this.options = options;
1492
- this.loose = !!options.loose;
1493
- // this isn't actually relevant for versions, but keep it so that we
1494
- // don't run into trouble passing this.options around.
1495
- this.includePrerelease = !!options.includePrerelease;
1496
-
1497
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
1498
-
1499
- if (!m) {
1500
- throw new TypeError(`Invalid Version: ${version}`)
1501
- }
1502
-
1503
- this.raw = version;
1504
-
1505
- // these are actually numbers
1506
- this.major = +m[1];
1507
- this.minor = +m[2];
1508
- this.patch = +m[3];
1509
-
1510
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
1511
- throw new TypeError('Invalid major version')
1512
- }
1513
-
1514
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
1515
- throw new TypeError('Invalid minor version')
1516
- }
1517
-
1518
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
1519
- throw new TypeError('Invalid patch version')
1520
- }
1521
-
1522
- // numberify any prerelease numeric ids
1523
- if (!m[4]) {
1524
- this.prerelease = [];
1525
- } else {
1526
- this.prerelease = m[4].split('.').map((id) => {
1527
- if (/^[0-9]+$/.test(id)) {
1528
- const num = +id;
1529
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
1530
- return num
1531
- }
1532
- }
1533
- return id
1534
- });
1535
- }
1536
-
1537
- this.build = m[5] ? m[5].split('.') : [];
1538
- this.format();
1539
- }
1540
-
1541
- format () {
1542
- this.version = `${this.major}.${this.minor}.${this.patch}`;
1543
- if (this.prerelease.length) {
1544
- this.version += `-${this.prerelease.join('.')}`;
1545
- }
1546
- return this.version
1547
- }
1548
-
1549
- toString () {
1550
- return this.version
1551
- }
1552
-
1553
- compare (other) {
1554
- debug('SemVer.compare', this.version, this.options, other);
1555
- if (!(other instanceof SemVer)) {
1556
- if (typeof other === 'string' && other === this.version) {
1557
- return 0
1558
- }
1559
- other = new SemVer(other, this.options);
1560
- }
1561
-
1562
- if (other.version === this.version) {
1563
- return 0
1564
- }
1565
-
1566
- return this.compareMain(other) || this.comparePre(other)
1567
- }
1568
-
1569
- compareMain (other) {
1570
- if (!(other instanceof SemVer)) {
1571
- other = new SemVer(other, this.options);
1572
- }
1573
-
1574
- if (this.major < other.major) {
1575
- return -1
1576
- }
1577
- if (this.major > other.major) {
1578
- return 1
1579
- }
1580
- if (this.minor < other.minor) {
1581
- return -1
1582
- }
1583
- if (this.minor > other.minor) {
1584
- return 1
1585
- }
1586
- if (this.patch < other.patch) {
1587
- return -1
1588
- }
1589
- if (this.patch > other.patch) {
1590
- return 1
1591
- }
1592
- return 0
1593
- }
1594
-
1595
- comparePre (other) {
1596
- if (!(other instanceof SemVer)) {
1597
- other = new SemVer(other, this.options);
1598
- }
1599
-
1600
- // NOT having a prerelease is > having one
1601
- if (this.prerelease.length && !other.prerelease.length) {
1602
- return -1
1603
- } else if (!this.prerelease.length && other.prerelease.length) {
1604
- return 1
1605
- } else if (!this.prerelease.length && !other.prerelease.length) {
1606
- return 0
1607
- }
1608
-
1609
- let i = 0;
1610
- do {
1611
- const a = this.prerelease[i];
1612
- const b = other.prerelease[i];
1613
- debug('prerelease compare', i, a, b);
1614
- if (a === undefined && b === undefined) {
1615
- return 0
1616
- } else if (b === undefined) {
1617
- return 1
1618
- } else if (a === undefined) {
1619
- return -1
1620
- } else if (a === b) {
1621
- continue
1622
- } else {
1623
- return compareIdentifiers(a, b)
1624
- }
1625
- } while (++i)
1626
- }
1627
-
1628
- compareBuild (other) {
1629
- if (!(other instanceof SemVer)) {
1630
- other = new SemVer(other, this.options);
1631
- }
1632
-
1633
- let i = 0;
1634
- do {
1635
- const a = this.build[i];
1636
- const b = other.build[i];
1637
- debug('build compare', i, a, b);
1638
- if (a === undefined && b === undefined) {
1639
- return 0
1640
- } else if (b === undefined) {
1641
- return 1
1642
- } else if (a === undefined) {
1643
- return -1
1644
- } else if (a === b) {
1645
- continue
1646
- } else {
1647
- return compareIdentifiers(a, b)
1648
- }
1649
- } while (++i)
1650
- }
1651
-
1652
- // preminor will bump the version up to the next minor release, and immediately
1653
- // down to pre-release. premajor and prepatch work the same way.
1654
- inc (release, identifier, identifierBase) {
1655
- if (release.startsWith('pre')) {
1656
- if (!identifier && identifierBase === false) {
1657
- throw new Error('invalid increment argument: identifier is empty')
1658
- }
1659
- // Avoid an invalid semver results
1660
- if (identifier) {
1661
- const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
1662
- if (!match || match[1] !== identifier) {
1663
- throw new Error(`invalid identifier: ${identifier}`)
1664
- }
1665
- }
1666
- }
1667
-
1668
- switch (release) {
1669
- case 'premajor':
1670
- this.prerelease.length = 0;
1671
- this.patch = 0;
1672
- this.minor = 0;
1673
- this.major++;
1674
- this.inc('pre', identifier, identifierBase);
1675
- break
1676
- case 'preminor':
1677
- this.prerelease.length = 0;
1678
- this.patch = 0;
1679
- this.minor++;
1680
- this.inc('pre', identifier, identifierBase);
1681
- break
1682
- case 'prepatch':
1683
- // If this is already a prerelease, it will bump to the next version
1684
- // drop any prereleases that might already exist, since they are not
1685
- // relevant at this point.
1686
- this.prerelease.length = 0;
1687
- this.inc('patch', identifier, identifierBase);
1688
- this.inc('pre', identifier, identifierBase);
1689
- break
1690
- // If the input is a non-prerelease version, this acts the same as
1691
- // prepatch.
1692
- case 'prerelease':
1693
- if (this.prerelease.length === 0) {
1694
- this.inc('patch', identifier, identifierBase);
1695
- }
1696
- this.inc('pre', identifier, identifierBase);
1697
- break
1698
- case 'release':
1699
- if (this.prerelease.length === 0) {
1700
- throw new Error(`version ${this.raw} is not a prerelease`)
1701
- }
1702
- this.prerelease.length = 0;
1703
- break
1704
-
1705
- case 'major':
1706
- // If this is a pre-major version, bump up to the same major version.
1707
- // Otherwise increment major.
1708
- // 1.0.0-5 bumps to 1.0.0
1709
- // 1.1.0 bumps to 2.0.0
1710
- if (
1711
- this.minor !== 0 ||
1712
- this.patch !== 0 ||
1713
- this.prerelease.length === 0
1714
- ) {
1715
- this.major++;
1716
- }
1717
- this.minor = 0;
1718
- this.patch = 0;
1719
- this.prerelease = [];
1720
- break
1721
- case 'minor':
1722
- // If this is a pre-minor version, bump up to the same minor version.
1723
- // Otherwise increment minor.
1724
- // 1.2.0-5 bumps to 1.2.0
1725
- // 1.2.1 bumps to 1.3.0
1726
- if (this.patch !== 0 || this.prerelease.length === 0) {
1727
- this.minor++;
1728
- }
1729
- this.patch = 0;
1730
- this.prerelease = [];
1731
- break
1732
- case 'patch':
1733
- // If this is not a pre-release version, it will increment the patch.
1734
- // If it is a pre-release it will bump up to the same patch version.
1735
- // 1.2.0-5 patches to 1.2.0
1736
- // 1.2.0 patches to 1.2.1
1737
- if (this.prerelease.length === 0) {
1738
- this.patch++;
1739
- }
1740
- this.prerelease = [];
1741
- break
1742
- // This probably shouldn't be used publicly.
1743
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
1744
- case 'pre': {
1745
- const base = Number(identifierBase) ? 1 : 0;
1746
-
1747
- if (this.prerelease.length === 0) {
1748
- this.prerelease = [base];
1749
- } else {
1750
- let i = this.prerelease.length;
1751
- while (--i >= 0) {
1752
- if (typeof this.prerelease[i] === 'number') {
1753
- this.prerelease[i]++;
1754
- i = -2;
1755
- }
1756
- }
1757
- if (i === -1) {
1758
- // didn't increment anything
1759
- if (identifier === this.prerelease.join('.') && identifierBase === false) {
1760
- throw new Error('invalid increment argument: identifier already exists')
1761
- }
1762
- this.prerelease.push(base);
1763
- }
1764
- }
1765
- if (identifier) {
1766
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
1767
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
1768
- let prerelease = [identifier, base];
1769
- if (identifierBase === false) {
1770
- prerelease = [identifier];
1771
- }
1772
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
1773
- if (isNaN(this.prerelease[1])) {
1774
- this.prerelease = prerelease;
1775
- }
1776
- } else {
1777
- this.prerelease = prerelease;
1778
- }
1779
- }
1780
- break
1781
- }
1782
- default:
1783
- throw new Error(`invalid increment argument: ${release}`)
1784
- }
1785
- this.raw = this.format();
1786
- if (this.build.length) {
1787
- this.raw += `+${this.build.join('.')}`;
1788
- }
1789
- return this
1790
- }
1791
- }
1792
-
1793
- semver$1 = SemVer;
1794
- return semver$1;
1795
- }
1796
-
1797
- var parse_1;
1798
- var hasRequiredParse;
1799
-
1800
- function requireParse () {
1801
- if (hasRequiredParse) return parse_1;
1802
- hasRequiredParse = 1;
1803
-
1804
- const SemVer = requireSemver$1();
1805
- const parse = (version, options, throwErrors = false) => {
1806
- if (version instanceof SemVer) {
1807
- return version
1808
- }
1809
- try {
1810
- return new SemVer(version, options)
1811
- } catch (er) {
1812
- if (!throwErrors) {
1813
- return null
1814
- }
1815
- throw er
1816
- }
1817
- };
1818
-
1819
- parse_1 = parse;
1820
- return parse_1;
1821
- }
1822
-
1823
- var valid_1;
1824
- var hasRequiredValid$1;
1825
-
1826
- function requireValid$1 () {
1827
- if (hasRequiredValid$1) return valid_1;
1828
- hasRequiredValid$1 = 1;
1829
-
1830
- const parse = requireParse();
1831
- const valid = (version, options) => {
1832
- const v = parse(version, options);
1833
- return v ? v.version : null
1834
- };
1835
- valid_1 = valid;
1836
- return valid_1;
1837
- }
1838
-
1839
- var clean_1;
1840
- var hasRequiredClean;
1841
-
1842
- function requireClean () {
1843
- if (hasRequiredClean) return clean_1;
1844
- hasRequiredClean = 1;
1845
-
1846
- const parse = requireParse();
1847
- const clean = (version, options) => {
1848
- const s = parse(version.trim().replace(/^[=v]+/, ''), options);
1849
- return s ? s.version : null
1850
- };
1851
- clean_1 = clean;
1852
- return clean_1;
1853
- }
1854
-
1855
- var inc_1;
1856
- var hasRequiredInc;
1857
-
1858
- function requireInc () {
1859
- if (hasRequiredInc) return inc_1;
1860
- hasRequiredInc = 1;
1861
-
1862
- const SemVer = requireSemver$1();
1863
-
1864
- const inc = (version, release, options, identifier, identifierBase) => {
1865
- if (typeof (options) === 'string') {
1866
- identifierBase = identifier;
1867
- identifier = options;
1868
- options = undefined;
1869
- }
1870
-
1871
- try {
1872
- return new SemVer(
1873
- version instanceof SemVer ? version.version : version,
1874
- options
1875
- ).inc(release, identifier, identifierBase).version
1876
- } catch (er) {
1877
- return null
1878
- }
1879
- };
1880
- inc_1 = inc;
1881
- return inc_1;
1882
- }
1883
-
1884
- var diff_1;
1885
- var hasRequiredDiff;
1886
-
1887
- function requireDiff () {
1888
- if (hasRequiredDiff) return diff_1;
1889
- hasRequiredDiff = 1;
1890
-
1891
- const parse = requireParse();
1892
-
1893
- const diff = (version1, version2) => {
1894
- const v1 = parse(version1, null, true);
1895
- const v2 = parse(version2, null, true);
1896
- const comparison = v1.compare(v2);
1897
-
1898
- if (comparison === 0) {
1899
- return null
1900
- }
1901
-
1902
- const v1Higher = comparison > 0;
1903
- const highVersion = v1Higher ? v1 : v2;
1904
- const lowVersion = v1Higher ? v2 : v1;
1905
- const highHasPre = !!highVersion.prerelease.length;
1906
- const lowHasPre = !!lowVersion.prerelease.length;
1907
-
1908
- if (lowHasPre && !highHasPre) {
1909
- // Going from prerelease -> no prerelease requires some special casing
1910
-
1911
- // If the low version has only a major, then it will always be a major
1912
- // Some examples:
1913
- // 1.0.0-1 -> 1.0.0
1914
- // 1.0.0-1 -> 1.1.1
1915
- // 1.0.0-1 -> 2.0.0
1916
- if (!lowVersion.patch && !lowVersion.minor) {
1917
- return 'major'
1918
- }
1919
-
1920
- // If the main part has no difference
1921
- if (lowVersion.compareMain(highVersion) === 0) {
1922
- if (lowVersion.minor && !lowVersion.patch) {
1923
- return 'minor'
1924
- }
1925
- return 'patch'
1926
- }
1927
- }
1928
-
1929
- // add the `pre` prefix if we are going to a prerelease version
1930
- const prefix = highHasPre ? 'pre' : '';
1931
-
1932
- if (v1.major !== v2.major) {
1933
- return prefix + 'major'
1934
- }
1935
-
1936
- if (v1.minor !== v2.minor) {
1937
- return prefix + 'minor'
1938
- }
1939
-
1940
- if (v1.patch !== v2.patch) {
1941
- return prefix + 'patch'
1942
- }
1943
-
1944
- // high and low are prereleases
1945
- return 'prerelease'
1946
- };
1947
-
1948
- diff_1 = diff;
1949
- return diff_1;
1950
- }
1951
-
1952
- var major_1;
1953
- var hasRequiredMajor;
1954
-
1955
- function requireMajor () {
1956
- if (hasRequiredMajor) return major_1;
1957
- hasRequiredMajor = 1;
1958
-
1959
- const SemVer = requireSemver$1();
1960
- const major = (a, loose) => new SemVer(a, loose).major;
1961
- major_1 = major;
1962
- return major_1;
1963
- }
1964
-
1965
- var minor_1;
1966
- var hasRequiredMinor;
1967
-
1968
- function requireMinor () {
1969
- if (hasRequiredMinor) return minor_1;
1970
- hasRequiredMinor = 1;
1971
-
1972
- const SemVer = requireSemver$1();
1973
- const minor = (a, loose) => new SemVer(a, loose).minor;
1974
- minor_1 = minor;
1975
- return minor_1;
1976
- }
1977
-
1978
- var patch_1;
1979
- var hasRequiredPatch;
1980
-
1981
- function requirePatch () {
1982
- if (hasRequiredPatch) return patch_1;
1983
- hasRequiredPatch = 1;
1984
-
1985
- const SemVer = requireSemver$1();
1986
- const patch = (a, loose) => new SemVer(a, loose).patch;
1987
- patch_1 = patch;
1988
- return patch_1;
1989
- }
1990
-
1991
- var prerelease_1;
1992
- var hasRequiredPrerelease;
1993
-
1994
- function requirePrerelease () {
1995
- if (hasRequiredPrerelease) return prerelease_1;
1996
- hasRequiredPrerelease = 1;
1997
-
1998
- const parse = requireParse();
1999
- const prerelease = (version, options) => {
2000
- const parsed = parse(version, options);
2001
- return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
2002
- };
2003
- prerelease_1 = prerelease;
2004
- return prerelease_1;
2005
- }
2006
-
2007
- var compare_1;
2008
- var hasRequiredCompare;
2009
-
2010
- function requireCompare () {
2011
- if (hasRequiredCompare) return compare_1;
2012
- hasRequiredCompare = 1;
2013
-
2014
- const SemVer = requireSemver$1();
2015
- const compare = (a, b, loose) =>
2016
- new SemVer(a, loose).compare(new SemVer(b, loose));
2017
-
2018
- compare_1 = compare;
2019
- return compare_1;
2020
- }
2021
-
2022
- var rcompare_1;
2023
- var hasRequiredRcompare;
2024
-
2025
- function requireRcompare () {
2026
- if (hasRequiredRcompare) return rcompare_1;
2027
- hasRequiredRcompare = 1;
2028
-
2029
- const compare = requireCompare();
2030
- const rcompare = (a, b, loose) => compare(b, a, loose);
2031
- rcompare_1 = rcompare;
2032
- return rcompare_1;
2033
- }
2034
-
2035
- var compareLoose_1;
2036
- var hasRequiredCompareLoose;
2037
-
2038
- function requireCompareLoose () {
2039
- if (hasRequiredCompareLoose) return compareLoose_1;
2040
- hasRequiredCompareLoose = 1;
2041
-
2042
- const compare = requireCompare();
2043
- const compareLoose = (a, b) => compare(a, b, true);
2044
- compareLoose_1 = compareLoose;
2045
- return compareLoose_1;
2046
- }
2047
-
2048
- var compareBuild_1;
2049
- var hasRequiredCompareBuild;
2050
-
2051
- function requireCompareBuild () {
2052
- if (hasRequiredCompareBuild) return compareBuild_1;
2053
- hasRequiredCompareBuild = 1;
2054
-
2055
- const SemVer = requireSemver$1();
2056
- const compareBuild = (a, b, loose) => {
2057
- const versionA = new SemVer(a, loose);
2058
- const versionB = new SemVer(b, loose);
2059
- return versionA.compare(versionB) || versionA.compareBuild(versionB)
2060
- };
2061
- compareBuild_1 = compareBuild;
2062
- return compareBuild_1;
2063
- }
2064
-
2065
- var sort_1;
2066
- var hasRequiredSort;
2067
-
2068
- function requireSort () {
2069
- if (hasRequiredSort) return sort_1;
2070
- hasRequiredSort = 1;
2071
-
2072
- const compareBuild = requireCompareBuild();
2073
- const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
2074
- sort_1 = sort;
2075
- return sort_1;
2076
- }
2077
-
2078
- var rsort_1;
2079
- var hasRequiredRsort;
2080
-
2081
- function requireRsort () {
2082
- if (hasRequiredRsort) return rsort_1;
2083
- hasRequiredRsort = 1;
2084
-
2085
- const compareBuild = requireCompareBuild();
2086
- const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
2087
- rsort_1 = rsort;
2088
- return rsort_1;
2089
- }
2090
-
2091
- var gt_1;
2092
- var hasRequiredGt;
2093
-
2094
- function requireGt () {
2095
- if (hasRequiredGt) return gt_1;
2096
- hasRequiredGt = 1;
2097
-
2098
- const compare = requireCompare();
2099
- const gt = (a, b, loose) => compare(a, b, loose) > 0;
2100
- gt_1 = gt;
2101
- return gt_1;
2102
- }
2103
-
2104
- var lt_1;
2105
- var hasRequiredLt;
2106
-
2107
- function requireLt () {
2108
- if (hasRequiredLt) return lt_1;
2109
- hasRequiredLt = 1;
2110
-
2111
- const compare = requireCompare();
2112
- const lt = (a, b, loose) => compare(a, b, loose) < 0;
2113
- lt_1 = lt;
2114
- return lt_1;
2115
- }
2116
-
2117
- var eq_1;
2118
- var hasRequiredEq;
2119
-
2120
- function requireEq () {
2121
- if (hasRequiredEq) return eq_1;
2122
- hasRequiredEq = 1;
2123
-
2124
- const compare = requireCompare();
2125
- const eq = (a, b, loose) => compare(a, b, loose) === 0;
2126
- eq_1 = eq;
2127
- return eq_1;
2128
- }
2129
-
2130
- var neq_1;
2131
- var hasRequiredNeq;
2132
-
2133
- function requireNeq () {
2134
- if (hasRequiredNeq) return neq_1;
2135
- hasRequiredNeq = 1;
2136
-
2137
- const compare = requireCompare();
2138
- const neq = (a, b, loose) => compare(a, b, loose) !== 0;
2139
- neq_1 = neq;
2140
- return neq_1;
2141
- }
2142
-
2143
- var gte_1;
2144
- var hasRequiredGte;
2145
-
2146
- function requireGte () {
2147
- if (hasRequiredGte) return gte_1;
2148
- hasRequiredGte = 1;
2149
-
2150
- const compare = requireCompare();
2151
- const gte = (a, b, loose) => compare(a, b, loose) >= 0;
2152
- gte_1 = gte;
2153
- return gte_1;
2154
- }
2155
-
2156
- var lte_1;
2157
- var hasRequiredLte;
2158
-
2159
- function requireLte () {
2160
- if (hasRequiredLte) return lte_1;
2161
- hasRequiredLte = 1;
2162
-
2163
- const compare = requireCompare();
2164
- const lte = (a, b, loose) => compare(a, b, loose) <= 0;
2165
- lte_1 = lte;
2166
- return lte_1;
2167
- }
2168
-
2169
- var cmp_1;
2170
- var hasRequiredCmp;
2171
-
2172
- function requireCmp () {
2173
- if (hasRequiredCmp) return cmp_1;
2174
- hasRequiredCmp = 1;
2175
-
2176
- const eq = requireEq();
2177
- const neq = requireNeq();
2178
- const gt = requireGt();
2179
- const gte = requireGte();
2180
- const lt = requireLt();
2181
- const lte = requireLte();
2182
-
2183
- const cmp = (a, op, b, loose) => {
2184
- switch (op) {
2185
- case '===':
2186
- if (typeof a === 'object') {
2187
- a = a.version;
2188
- }
2189
- if (typeof b === 'object') {
2190
- b = b.version;
2191
- }
2192
- return a === b
2193
-
2194
- case '!==':
2195
- if (typeof a === 'object') {
2196
- a = a.version;
2197
- }
2198
- if (typeof b === 'object') {
2199
- b = b.version;
2200
- }
2201
- return a !== b
2202
-
2203
- case '':
2204
- case '=':
2205
- case '==':
2206
- return eq(a, b, loose)
2207
-
2208
- case '!=':
2209
- return neq(a, b, loose)
2210
-
2211
- case '>':
2212
- return gt(a, b, loose)
2213
-
2214
- case '>=':
2215
- return gte(a, b, loose)
2216
-
2217
- case '<':
2218
- return lt(a, b, loose)
2219
-
2220
- case '<=':
2221
- return lte(a, b, loose)
2222
-
2223
- default:
2224
- throw new TypeError(`Invalid operator: ${op}`)
2225
- }
2226
- };
2227
- cmp_1 = cmp;
2228
- return cmp_1;
2229
- }
2230
-
2231
- var coerce_1;
2232
- var hasRequiredCoerce;
2233
-
2234
- function requireCoerce () {
2235
- if (hasRequiredCoerce) return coerce_1;
2236
- hasRequiredCoerce = 1;
2237
-
2238
- const SemVer = requireSemver$1();
2239
- const parse = requireParse();
2240
- const { safeRe: re, t } = requireRe();
2241
-
2242
- const coerce = (version, options) => {
2243
- if (version instanceof SemVer) {
2244
- return version
2245
- }
2246
-
2247
- if (typeof version === 'number') {
2248
- version = String(version);
2249
- }
2250
-
2251
- if (typeof version !== 'string') {
2252
- return null
2253
- }
2254
-
2255
- options = options || {};
2256
-
2257
- let match = null;
2258
- if (!options.rtl) {
2259
- match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
2260
- } else {
2261
- // Find the right-most coercible string that does not share
2262
- // a terminus with a more left-ward coercible string.
2263
- // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
2264
- // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
2265
- //
2266
- // Walk through the string checking with a /g regexp
2267
- // Manually set the index so as to pick up overlapping matches.
2268
- // Stop when we get a match that ends at the string end, since no
2269
- // coercible string can be more right-ward without the same terminus.
2270
- const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
2271
- let next;
2272
- while ((next = coerceRtlRegex.exec(version)) &&
2273
- (!match || match.index + match[0].length !== version.length)
2274
- ) {
2275
- if (!match ||
2276
- next.index + next[0].length !== match.index + match[0].length) {
2277
- match = next;
2278
- }
2279
- coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
2280
- }
2281
- // leave it in a clean state
2282
- coerceRtlRegex.lastIndex = -1;
2283
- }
2284
-
2285
- if (match === null) {
2286
- return null
2287
- }
2288
-
2289
- const major = match[2];
2290
- const minor = match[3] || '0';
2291
- const patch = match[4] || '0';
2292
- const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '';
2293
- const build = options.includePrerelease && match[6] ? `+${match[6]}` : '';
2294
-
2295
- return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
2296
- };
2297
- coerce_1 = coerce;
2298
- return coerce_1;
2299
- }
2300
-
2301
- var lrucache;
2302
- var hasRequiredLrucache;
2303
-
2304
- function requireLrucache () {
2305
- if (hasRequiredLrucache) return lrucache;
2306
- hasRequiredLrucache = 1;
2307
-
2308
- class LRUCache {
2309
- constructor () {
2310
- this.max = 1000;
2311
- this.map = new Map();
2312
- }
2313
-
2314
- get (key) {
2315
- const value = this.map.get(key);
2316
- if (value === undefined) {
2317
- return undefined
2318
- } else {
2319
- // Remove the key from the map and add it to the end
2320
- this.map.delete(key);
2321
- this.map.set(key, value);
2322
- return value
2323
- }
2324
- }
2325
-
2326
- delete (key) {
2327
- return this.map.delete(key)
2328
- }
2329
-
2330
- set (key, value) {
2331
- const deleted = this.delete(key);
2332
-
2333
- if (!deleted && value !== undefined) {
2334
- // If cache is full, delete the least recently used item
2335
- if (this.map.size >= this.max) {
2336
- const firstKey = this.map.keys().next().value;
2337
- this.delete(firstKey);
2338
- }
2339
-
2340
- this.map.set(key, value);
2341
- }
2342
-
2343
- return this
2344
- }
2345
- }
2346
-
2347
- lrucache = LRUCache;
2348
- return lrucache;
2349
- }
2350
-
2351
- var range;
2352
- var hasRequiredRange;
2353
-
2354
- function requireRange () {
2355
- if (hasRequiredRange) return range;
2356
- hasRequiredRange = 1;
2357
-
2358
- const SPACE_CHARACTERS = /\s+/g;
2359
-
2360
- // hoisted class for cyclic dependency
2361
- class Range {
2362
- constructor (range, options) {
2363
- options = parseOptions(options);
2364
-
2365
- if (range instanceof Range) {
2366
- if (
2367
- range.loose === !!options.loose &&
2368
- range.includePrerelease === !!options.includePrerelease
2369
- ) {
2370
- return range
2371
- } else {
2372
- return new Range(range.raw, options)
2373
- }
2374
- }
2375
-
2376
- if (range instanceof Comparator) {
2377
- // just put it in the set and return
2378
- this.raw = range.value;
2379
- this.set = [[range]];
2380
- this.formatted = undefined;
2381
- return this
2382
- }
2383
-
2384
- this.options = options;
2385
- this.loose = !!options.loose;
2386
- this.includePrerelease = !!options.includePrerelease;
2387
-
2388
- // First reduce all whitespace as much as possible so we do not have to rely
2389
- // on potentially slow regexes like \s*. This is then stored and used for
2390
- // future error messages as well.
2391
- this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
2392
-
2393
- // First, split on ||
2394
- this.set = this.raw
2395
- .split('||')
2396
- // map the range to a 2d array of comparators
2397
- .map(r => this.parseRange(r.trim()))
2398
- // throw out any comparator lists that are empty
2399
- // this generally means that it was not a valid range, which is allowed
2400
- // in loose mode, but will still throw if the WHOLE range is invalid.
2401
- .filter(c => c.length);
2402
-
2403
- if (!this.set.length) {
2404
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
2405
- }
2406
-
2407
- // if we have any that are not the null set, throw out null sets.
2408
- if (this.set.length > 1) {
2409
- // keep the first one, in case they're all null sets
2410
- const first = this.set[0];
2411
- this.set = this.set.filter(c => !isNullSet(c[0]));
2412
- if (this.set.length === 0) {
2413
- this.set = [first];
2414
- } else if (this.set.length > 1) {
2415
- // if we have any that are *, then the range is just *
2416
- for (const c of this.set) {
2417
- if (c.length === 1 && isAny(c[0])) {
2418
- this.set = [c];
2419
- break
2420
- }
2421
- }
2422
- }
2423
- }
2424
-
2425
- this.formatted = undefined;
2426
- }
2427
-
2428
- get range () {
2429
- if (this.formatted === undefined) {
2430
- this.formatted = '';
2431
- for (let i = 0; i < this.set.length; i++) {
2432
- if (i > 0) {
2433
- this.formatted += '||';
2434
- }
2435
- const comps = this.set[i];
2436
- for (let k = 0; k < comps.length; k++) {
2437
- if (k > 0) {
2438
- this.formatted += ' ';
2439
- }
2440
- this.formatted += comps[k].toString().trim();
2441
- }
2442
- }
2443
- }
2444
- return this.formatted
2445
- }
2446
-
2447
- format () {
2448
- return this.range
2449
- }
2450
-
2451
- toString () {
2452
- return this.range
2453
- }
2454
-
2455
- parseRange (range) {
2456
- // memoize range parsing for performance.
2457
- // this is a very hot path, and fully deterministic.
2458
- const memoOpts =
2459
- (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
2460
- (this.options.loose && FLAG_LOOSE);
2461
- const memoKey = memoOpts + ':' + range;
2462
- const cached = cache.get(memoKey);
2463
- if (cached) {
2464
- return cached
2465
- }
2466
-
2467
- const loose = this.options.loose;
2468
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
2469
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
2470
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
2471
- debug('hyphen replace', range);
2472
-
2473
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
2474
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
2475
- debug('comparator trim', range);
2476
-
2477
- // `~ 1.2.3` => `~1.2.3`
2478
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
2479
- debug('tilde trim', range);
2480
-
2481
- // `^ 1.2.3` => `^1.2.3`
2482
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
2483
- debug('caret trim', range);
2484
-
2485
- // At this point, the range is completely trimmed and
2486
- // ready to be split into comparators.
2487
-
2488
- let rangeList = range
2489
- .split(' ')
2490
- .map(comp => parseComparator(comp, this.options))
2491
- .join(' ')
2492
- .split(/\s+/)
2493
- // >=0.0.0 is equivalent to *
2494
- .map(comp => replaceGTE0(comp, this.options));
2495
-
2496
- if (loose) {
2497
- // in loose mode, throw out any that are not valid comparators
2498
- rangeList = rangeList.filter(comp => {
2499
- debug('loose invalid filter', comp, this.options);
2500
- return !!comp.match(re[t.COMPARATORLOOSE])
2501
- });
2502
- }
2503
- debug('range list', rangeList);
2504
-
2505
- // if any comparators are the null set, then replace with JUST null set
2506
- // if more than one comparator, remove any * comparators
2507
- // also, don't include the same comparator more than once
2508
- const rangeMap = new Map();
2509
- const comparators = rangeList.map(comp => new Comparator(comp, this.options));
2510
- for (const comp of comparators) {
2511
- if (isNullSet(comp)) {
2512
- return [comp]
2513
- }
2514
- rangeMap.set(comp.value, comp);
2515
- }
2516
- if (rangeMap.size > 1 && rangeMap.has('')) {
2517
- rangeMap.delete('');
2518
- }
2519
-
2520
- const result = [...rangeMap.values()];
2521
- cache.set(memoKey, result);
2522
- return result
2523
- }
2524
-
2525
- intersects (range, options) {
2526
- if (!(range instanceof Range)) {
2527
- throw new TypeError('a Range is required')
2528
- }
2529
-
2530
- return this.set.some((thisComparators) => {
2531
- return (
2532
- isSatisfiable(thisComparators, options) &&
2533
- range.set.some((rangeComparators) => {
2534
- return (
2535
- isSatisfiable(rangeComparators, options) &&
2536
- thisComparators.every((thisComparator) => {
2537
- return rangeComparators.every((rangeComparator) => {
2538
- return thisComparator.intersects(rangeComparator, options)
2539
- })
2540
- })
2541
- )
2542
- })
2543
- )
2544
- })
2545
- }
2546
-
2547
- // if ANY of the sets match ALL of its comparators, then pass
2548
- test (version) {
2549
- if (!version) {
2550
- return false
2551
- }
2552
-
2553
- if (typeof version === 'string') {
2554
- try {
2555
- version = new SemVer(version, this.options);
2556
- } catch (er) {
2557
- return false
2558
- }
2559
- }
2560
-
2561
- for (let i = 0; i < this.set.length; i++) {
2562
- if (testSet(this.set[i], version, this.options)) {
2563
- return true
2564
- }
2565
- }
2566
- return false
2567
- }
2568
- }
2569
-
2570
- range = Range;
2571
-
2572
- const LRU = requireLrucache();
2573
- const cache = new LRU();
2574
-
2575
- const parseOptions = requireParseOptions();
2576
- const Comparator = requireComparator();
2577
- const debug = requireDebug();
2578
- const SemVer = requireSemver$1();
2579
- const {
2580
- safeRe: re,
2581
- t,
2582
- comparatorTrimReplace,
2583
- tildeTrimReplace,
2584
- caretTrimReplace,
2585
- } = requireRe();
2586
- const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
2587
-
2588
- const isNullSet = c => c.value === '<0.0.0-0';
2589
- const isAny = c => c.value === '';
2590
-
2591
- // take a set of comparators and determine whether there
2592
- // exists a version which can satisfy it
2593
- const isSatisfiable = (comparators, options) => {
2594
- let result = true;
2595
- const remainingComparators = comparators.slice();
2596
- let testComparator = remainingComparators.pop();
2597
-
2598
- while (result && remainingComparators.length) {
2599
- result = remainingComparators.every((otherComparator) => {
2600
- return testComparator.intersects(otherComparator, options)
2601
- });
2602
-
2603
- testComparator = remainingComparators.pop();
2604
- }
2605
-
2606
- return result
2607
- };
2608
-
2609
- // comprised of xranges, tildes, stars, and gtlt's at this point.
2610
- // already replaced the hyphen ranges
2611
- // turn into a set of JUST comparators.
2612
- const parseComparator = (comp, options) => {
2613
- comp = comp.replace(re[t.BUILD], '');
2614
- debug('comp', comp, options);
2615
- comp = replaceCarets(comp, options);
2616
- debug('caret', comp);
2617
- comp = replaceTildes(comp, options);
2618
- debug('tildes', comp);
2619
- comp = replaceXRanges(comp, options);
2620
- debug('xrange', comp);
2621
- comp = replaceStars(comp, options);
2622
- debug('stars', comp);
2623
- return comp
2624
- };
2625
-
2626
- const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
2627
-
2628
- // ~, ~> --> * (any, kinda silly)
2629
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
2630
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
2631
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
2632
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
2633
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
2634
- // ~0.0.1 --> >=0.0.1 <0.1.0-0
2635
- const replaceTildes = (comp, options) => {
2636
- return comp
2637
- .trim()
2638
- .split(/\s+/)
2639
- .map((c) => replaceTilde(c, options))
2640
- .join(' ')
2641
- };
2642
-
2643
- const replaceTilde = (comp, options) => {
2644
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
2645
- return comp.replace(r, (_, M, m, p, pr) => {
2646
- debug('tilde', comp, _, M, m, p, pr);
2647
- let ret;
2648
-
2649
- if (isX(M)) {
2650
- ret = '';
2651
- } else if (isX(m)) {
2652
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
2653
- } else if (isX(p)) {
2654
- // ~1.2 == >=1.2.0 <1.3.0-0
2655
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
2656
- } else if (pr) {
2657
- debug('replaceTilde pr', pr);
2658
- ret = `>=${M}.${m}.${p}-${pr
2659
- } <${M}.${+m + 1}.0-0`;
2660
- } else {
2661
- // ~1.2.3 == >=1.2.3 <1.3.0-0
2662
- ret = `>=${M}.${m}.${p
2663
- } <${M}.${+m + 1}.0-0`;
2664
- }
2665
-
2666
- debug('tilde return', ret);
2667
- return ret
2668
- })
2669
- };
2670
-
2671
- // ^ --> * (any, kinda silly)
2672
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
2673
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
2674
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
2675
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
2676
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
2677
- // ^0.0.1 --> >=0.0.1 <0.0.2-0
2678
- // ^0.1.0 --> >=0.1.0 <0.2.0-0
2679
- const replaceCarets = (comp, options) => {
2680
- return comp
2681
- .trim()
2682
- .split(/\s+/)
2683
- .map((c) => replaceCaret(c, options))
2684
- .join(' ')
2685
- };
2686
-
2687
- const replaceCaret = (comp, options) => {
2688
- debug('caret', comp, options);
2689
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
2690
- const z = options.includePrerelease ? '-0' : '';
2691
- return comp.replace(r, (_, M, m, p, pr) => {
2692
- debug('caret', comp, _, M, m, p, pr);
2693
- let ret;
2694
-
2695
- if (isX(M)) {
2696
- ret = '';
2697
- } else if (isX(m)) {
2698
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
2699
- } else if (isX(p)) {
2700
- if (M === '0') {
2701
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
2702
- } else {
2703
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
2704
- }
2705
- } else if (pr) {
2706
- debug('replaceCaret pr', pr);
2707
- if (M === '0') {
2708
- if (m === '0') {
2709
- ret = `>=${M}.${m}.${p}-${pr
2710
- } <${M}.${m}.${+p + 1}-0`;
2711
- } else {
2712
- ret = `>=${M}.${m}.${p}-${pr
2713
- } <${M}.${+m + 1}.0-0`;
2714
- }
2715
- } else {
2716
- ret = `>=${M}.${m}.${p}-${pr
2717
- } <${+M + 1}.0.0-0`;
2718
- }
2719
- } else {
2720
- debug('no pr');
2721
- if (M === '0') {
2722
- if (m === '0') {
2723
- ret = `>=${M}.${m}.${p
2724
- }${z} <${M}.${m}.${+p + 1}-0`;
2725
- } else {
2726
- ret = `>=${M}.${m}.${p
2727
- }${z} <${M}.${+m + 1}.0-0`;
2728
- }
2729
- } else {
2730
- ret = `>=${M}.${m}.${p
2731
- } <${+M + 1}.0.0-0`;
2732
- }
2733
- }
2734
-
2735
- debug('caret return', ret);
2736
- return ret
2737
- })
2738
- };
2739
-
2740
- const replaceXRanges = (comp, options) => {
2741
- debug('replaceXRanges', comp, options);
2742
- return comp
2743
- .split(/\s+/)
2744
- .map((c) => replaceXRange(c, options))
2745
- .join(' ')
2746
- };
2747
-
2748
- const replaceXRange = (comp, options) => {
2749
- comp = comp.trim();
2750
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
2751
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
2752
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
2753
- const xM = isX(M);
2754
- const xm = xM || isX(m);
2755
- const xp = xm || isX(p);
2756
- const anyX = xp;
2757
-
2758
- if (gtlt === '=' && anyX) {
2759
- gtlt = '';
2760
- }
2761
-
2762
- // if we're including prereleases in the match, then we need
2763
- // to fix this to -0, the lowest possible prerelease value
2764
- pr = options.includePrerelease ? '-0' : '';
2765
-
2766
- if (xM) {
2767
- if (gtlt === '>' || gtlt === '<') {
2768
- // nothing is allowed
2769
- ret = '<0.0.0-0';
2770
- } else {
2771
- // nothing is forbidden
2772
- ret = '*';
2773
- }
2774
- } else if (gtlt && anyX) {
2775
- // we know patch is an x, because we have any x at all.
2776
- // replace X with 0
2777
- if (xm) {
2778
- m = 0;
2779
- }
2780
- p = 0;
2781
-
2782
- if (gtlt === '>') {
2783
- // >1 => >=2.0.0
2784
- // >1.2 => >=1.3.0
2785
- gtlt = '>=';
2786
- if (xm) {
2787
- M = +M + 1;
2788
- m = 0;
2789
- p = 0;
2790
- } else {
2791
- m = +m + 1;
2792
- p = 0;
2793
- }
2794
- } else if (gtlt === '<=') {
2795
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
2796
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
2797
- gtlt = '<';
2798
- if (xm) {
2799
- M = +M + 1;
2800
- } else {
2801
- m = +m + 1;
2802
- }
2803
- }
2804
-
2805
- if (gtlt === '<') {
2806
- pr = '-0';
2807
- }
2808
-
2809
- ret = `${gtlt + M}.${m}.${p}${pr}`;
2810
- } else if (xm) {
2811
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
2812
- } else if (xp) {
2813
- ret = `>=${M}.${m}.0${pr
2814
- } <${M}.${+m + 1}.0-0`;
2815
- }
2816
-
2817
- debug('xRange return', ret);
2818
-
2819
- return ret
2820
- })
2821
- };
2822
-
2823
- // Because * is AND-ed with everything else in the comparator,
2824
- // and '' means "any version", just remove the *s entirely.
2825
- const replaceStars = (comp, options) => {
2826
- debug('replaceStars', comp, options);
2827
- // Looseness is ignored here. star is always as loose as it gets!
2828
- return comp
2829
- .trim()
2830
- .replace(re[t.STAR], '')
2831
- };
2832
-
2833
- const replaceGTE0 = (comp, options) => {
2834
- debug('replaceGTE0', comp, options);
2835
- return comp
2836
- .trim()
2837
- .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
2838
- };
2839
-
2840
- // This function is passed to string.replace(re[t.HYPHENRANGE])
2841
- // M, m, patch, prerelease, build
2842
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
2843
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
2844
- // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
2845
- // TODO build?
2846
- const hyphenReplace = incPr => ($0,
2847
- from, fM, fm, fp, fpr, fb,
2848
- to, tM, tm, tp, tpr) => {
2849
- if (isX(fM)) {
2850
- from = '';
2851
- } else if (isX(fm)) {
2852
- from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
2853
- } else if (isX(fp)) {
2854
- from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
2855
- } else if (fpr) {
2856
- from = `>=${from}`;
2857
- } else {
2858
- from = `>=${from}${incPr ? '-0' : ''}`;
2859
- }
2860
-
2861
- if (isX(tM)) {
2862
- to = '';
2863
- } else if (isX(tm)) {
2864
- to = `<${+tM + 1}.0.0-0`;
2865
- } else if (isX(tp)) {
2866
- to = `<${tM}.${+tm + 1}.0-0`;
2867
- } else if (tpr) {
2868
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
2869
- } else if (incPr) {
2870
- to = `<${tM}.${tm}.${+tp + 1}-0`;
2871
- } else {
2872
- to = `<=${to}`;
2873
- }
2874
-
2875
- return `${from} ${to}`.trim()
2876
- };
2877
-
2878
- const testSet = (set, version, options) => {
2879
- for (let i = 0; i < set.length; i++) {
2880
- if (!set[i].test(version)) {
2881
- return false
2882
- }
2883
- }
2884
-
2885
- if (version.prerelease.length && !options.includePrerelease) {
2886
- // Find the set of versions that are allowed to have prereleases
2887
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
2888
- // That should allow `1.2.3-pr.2` to pass.
2889
- // However, `1.2.4-alpha.notready` should NOT be allowed,
2890
- // even though it's within the range set by the comparators.
2891
- for (let i = 0; i < set.length; i++) {
2892
- debug(set[i].semver);
2893
- if (set[i].semver === Comparator.ANY) {
2894
- continue
2895
- }
2896
-
2897
- if (set[i].semver.prerelease.length > 0) {
2898
- const allowed = set[i].semver;
2899
- if (allowed.major === version.major &&
2900
- allowed.minor === version.minor &&
2901
- allowed.patch === version.patch) {
2902
- return true
2903
- }
2904
- }
2905
- }
2906
-
2907
- // Version has a -pre, but it's not one of the ones we like.
2908
- return false
2909
- }
2910
-
2911
- return true
2912
- };
2913
- return range;
2914
- }
2915
-
2916
- var comparator;
2917
- var hasRequiredComparator;
2918
-
2919
- function requireComparator () {
2920
- if (hasRequiredComparator) return comparator;
2921
- hasRequiredComparator = 1;
2922
-
2923
- const ANY = Symbol('SemVer ANY');
2924
- // hoisted class for cyclic dependency
2925
- class Comparator {
2926
- static get ANY () {
2927
- return ANY
2928
- }
2929
-
2930
- constructor (comp, options) {
2931
- options = parseOptions(options);
2932
-
2933
- if (comp instanceof Comparator) {
2934
- if (comp.loose === !!options.loose) {
2935
- return comp
2936
- } else {
2937
- comp = comp.value;
2938
- }
2939
- }
2940
-
2941
- comp = comp.trim().split(/\s+/).join(' ');
2942
- debug('comparator', comp, options);
2943
- this.options = options;
2944
- this.loose = !!options.loose;
2945
- this.parse(comp);
2946
-
2947
- if (this.semver === ANY) {
2948
- this.value = '';
2949
- } else {
2950
- this.value = this.operator + this.semver.version;
2951
- }
2952
-
2953
- debug('comp', this);
2954
- }
2955
-
2956
- parse (comp) {
2957
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
2958
- const m = comp.match(r);
2959
-
2960
- if (!m) {
2961
- throw new TypeError(`Invalid comparator: ${comp}`)
2962
- }
2963
-
2964
- this.operator = m[1] !== undefined ? m[1] : '';
2965
- if (this.operator === '=') {
2966
- this.operator = '';
2967
- }
2968
-
2969
- // if it literally is just '>' or '' then allow anything.
2970
- if (!m[2]) {
2971
- this.semver = ANY;
2972
- } else {
2973
- this.semver = new SemVer(m[2], this.options.loose);
2974
- }
2975
- }
2976
-
2977
- toString () {
2978
- return this.value
2979
- }
2980
-
2981
- test (version) {
2982
- debug('Comparator.test', version, this.options.loose);
2983
-
2984
- if (this.semver === ANY || version === ANY) {
2985
- return true
2986
- }
2987
-
2988
- if (typeof version === 'string') {
2989
- try {
2990
- version = new SemVer(version, this.options);
2991
- } catch (er) {
2992
- return false
2993
- }
2994
- }
2995
-
2996
- return cmp(version, this.operator, this.semver, this.options)
2997
- }
2998
-
2999
- intersects (comp, options) {
3000
- if (!(comp instanceof Comparator)) {
3001
- throw new TypeError('a Comparator is required')
3002
- }
3003
-
3004
- if (this.operator === '') {
3005
- if (this.value === '') {
3006
- return true
3007
- }
3008
- return new Range(comp.value, options).test(this.value)
3009
- } else if (comp.operator === '') {
3010
- if (comp.value === '') {
3011
- return true
3012
- }
3013
- return new Range(this.value, options).test(comp.semver)
3014
- }
3015
-
3016
- options = parseOptions(options);
3017
-
3018
- // Special cases where nothing can possibly be lower
3019
- if (options.includePrerelease &&
3020
- (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
3021
- return false
3022
- }
3023
- if (!options.includePrerelease &&
3024
- (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
3025
- return false
3026
- }
3027
-
3028
- // Same direction increasing (> or >=)
3029
- if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
3030
- return true
3031
- }
3032
- // Same direction decreasing (< or <=)
3033
- if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
3034
- return true
3035
- }
3036
- // same SemVer and both sides are inclusive (<= or >=)
3037
- if (
3038
- (this.semver.version === comp.semver.version) &&
3039
- this.operator.includes('=') && comp.operator.includes('=')) {
3040
- return true
3041
- }
3042
- // opposite directions less than
3043
- if (cmp(this.semver, '<', comp.semver, options) &&
3044
- this.operator.startsWith('>') && comp.operator.startsWith('<')) {
3045
- return true
3046
- }
3047
- // opposite directions greater than
3048
- if (cmp(this.semver, '>', comp.semver, options) &&
3049
- this.operator.startsWith('<') && comp.operator.startsWith('>')) {
3050
- return true
3051
- }
3052
- return false
3053
- }
3054
- }
3055
-
3056
- comparator = Comparator;
3057
-
3058
- const parseOptions = requireParseOptions();
3059
- const { safeRe: re, t } = requireRe();
3060
- const cmp = requireCmp();
3061
- const debug = requireDebug();
3062
- const SemVer = requireSemver$1();
3063
- const Range = requireRange();
3064
- return comparator;
3065
- }
3066
-
3067
- var satisfies_1;
3068
- var hasRequiredSatisfies;
3069
-
3070
- function requireSatisfies () {
3071
- if (hasRequiredSatisfies) return satisfies_1;
3072
- hasRequiredSatisfies = 1;
3073
-
3074
- const Range = requireRange();
3075
- const satisfies = (version, range, options) => {
3076
- try {
3077
- range = new Range(range, options);
3078
- } catch (er) {
3079
- return false
3080
- }
3081
- return range.test(version)
3082
- };
3083
- satisfies_1 = satisfies;
3084
- return satisfies_1;
3085
- }
3086
-
3087
- var toComparators_1;
3088
- var hasRequiredToComparators;
3089
-
3090
- function requireToComparators () {
3091
- if (hasRequiredToComparators) return toComparators_1;
3092
- hasRequiredToComparators = 1;
3093
-
3094
- const Range = requireRange();
3095
-
3096
- // Mostly just for testing and legacy API reasons
3097
- const toComparators = (range, options) =>
3098
- new Range(range, options).set
3099
- .map(comp => comp.map(c => c.value).join(' ').trim().split(' '));
3100
-
3101
- toComparators_1 = toComparators;
3102
- return toComparators_1;
3103
- }
3104
-
3105
- var maxSatisfying_1;
3106
- var hasRequiredMaxSatisfying;
3107
-
3108
- function requireMaxSatisfying () {
3109
- if (hasRequiredMaxSatisfying) return maxSatisfying_1;
3110
- hasRequiredMaxSatisfying = 1;
3111
-
3112
- const SemVer = requireSemver$1();
3113
- const Range = requireRange();
3114
-
3115
- const maxSatisfying = (versions, range, options) => {
3116
- let max = null;
3117
- let maxSV = null;
3118
- let rangeObj = null;
3119
- try {
3120
- rangeObj = new Range(range, options);
3121
- } catch (er) {
3122
- return null
3123
- }
3124
- versions.forEach((v) => {
3125
- if (rangeObj.test(v)) {
3126
- // satisfies(v, range, options)
3127
- if (!max || maxSV.compare(v) === -1) {
3128
- // compare(max, v, true)
3129
- max = v;
3130
- maxSV = new SemVer(max, options);
3131
- }
3132
- }
3133
- });
3134
- return max
3135
- };
3136
- maxSatisfying_1 = maxSatisfying;
3137
- return maxSatisfying_1;
3138
- }
3139
-
3140
- var minSatisfying_1;
3141
- var hasRequiredMinSatisfying;
3142
-
3143
- function requireMinSatisfying () {
3144
- if (hasRequiredMinSatisfying) return minSatisfying_1;
3145
- hasRequiredMinSatisfying = 1;
3146
-
3147
- const SemVer = requireSemver$1();
3148
- const Range = requireRange();
3149
- const minSatisfying = (versions, range, options) => {
3150
- let min = null;
3151
- let minSV = null;
3152
- let rangeObj = null;
3153
- try {
3154
- rangeObj = new Range(range, options);
3155
- } catch (er) {
3156
- return null
3157
- }
3158
- versions.forEach((v) => {
3159
- if (rangeObj.test(v)) {
3160
- // satisfies(v, range, options)
3161
- if (!min || minSV.compare(v) === 1) {
3162
- // compare(min, v, true)
3163
- min = v;
3164
- minSV = new SemVer(min, options);
3165
- }
3166
- }
3167
- });
3168
- return min
3169
- };
3170
- minSatisfying_1 = minSatisfying;
3171
- return minSatisfying_1;
3172
- }
3173
-
3174
- var minVersion_1;
3175
- var hasRequiredMinVersion;
3176
-
3177
- function requireMinVersion () {
3178
- if (hasRequiredMinVersion) return minVersion_1;
3179
- hasRequiredMinVersion = 1;
3180
-
3181
- const SemVer = requireSemver$1();
3182
- const Range = requireRange();
3183
- const gt = requireGt();
3184
-
3185
- const minVersion = (range, loose) => {
3186
- range = new Range(range, loose);
3187
-
3188
- let minver = new SemVer('0.0.0');
3189
- if (range.test(minver)) {
3190
- return minver
3191
- }
3192
-
3193
- minver = new SemVer('0.0.0-0');
3194
- if (range.test(minver)) {
3195
- return minver
3196
- }
3197
-
3198
- minver = null;
3199
- for (let i = 0; i < range.set.length; ++i) {
3200
- const comparators = range.set[i];
3201
-
3202
- let setMin = null;
3203
- comparators.forEach((comparator) => {
3204
- // Clone to avoid manipulating the comparator's semver object.
3205
- const compver = new SemVer(comparator.semver.version);
3206
- switch (comparator.operator) {
3207
- case '>':
3208
- if (compver.prerelease.length === 0) {
3209
- compver.patch++;
3210
- } else {
3211
- compver.prerelease.push(0);
3212
- }
3213
- compver.raw = compver.format();
3214
- /* fallthrough */
3215
- case '':
3216
- case '>=':
3217
- if (!setMin || gt(compver, setMin)) {
3218
- setMin = compver;
3219
- }
3220
- break
3221
- case '<':
3222
- case '<=':
3223
- /* Ignore maximum versions */
3224
- break
3225
- /* istanbul ignore next */
3226
- default:
3227
- throw new Error(`Unexpected operation: ${comparator.operator}`)
3228
- }
3229
- });
3230
- if (setMin && (!minver || gt(minver, setMin))) {
3231
- minver = setMin;
3232
- }
3233
- }
3234
-
3235
- if (minver && range.test(minver)) {
3236
- return minver
3237
- }
3238
-
3239
- return null
3240
- };
3241
- minVersion_1 = minVersion;
3242
- return minVersion_1;
3243
- }
3244
-
3245
- var valid;
3246
- var hasRequiredValid;
3247
-
3248
- function requireValid () {
3249
- if (hasRequiredValid) return valid;
3250
- hasRequiredValid = 1;
3251
-
3252
- const Range = requireRange();
3253
- const validRange = (range, options) => {
3254
- try {
3255
- // Return '*' instead of '' so that truthiness works.
3256
- // This will throw if it's invalid anyway
3257
- return new Range(range, options).range || '*'
3258
- } catch (er) {
3259
- return null
3260
- }
3261
- };
3262
- valid = validRange;
3263
- return valid;
3264
- }
3265
-
3266
- var outside_1;
3267
- var hasRequiredOutside;
3268
-
3269
- function requireOutside () {
3270
- if (hasRequiredOutside) return outside_1;
3271
- hasRequiredOutside = 1;
3272
-
3273
- const SemVer = requireSemver$1();
3274
- const Comparator = requireComparator();
3275
- const { ANY } = Comparator;
3276
- const Range = requireRange();
3277
- const satisfies = requireSatisfies();
3278
- const gt = requireGt();
3279
- const lt = requireLt();
3280
- const lte = requireLte();
3281
- const gte = requireGte();
3282
-
3283
- const outside = (version, range, hilo, options) => {
3284
- version = new SemVer(version, options);
3285
- range = new Range(range, options);
3286
-
3287
- let gtfn, ltefn, ltfn, comp, ecomp;
3288
- switch (hilo) {
3289
- case '>':
3290
- gtfn = gt;
3291
- ltefn = lte;
3292
- ltfn = lt;
3293
- comp = '>';
3294
- ecomp = '>=';
3295
- break
3296
- case '<':
3297
- gtfn = lt;
3298
- ltefn = gte;
3299
- ltfn = gt;
3300
- comp = '<';
3301
- ecomp = '<=';
3302
- break
3303
- default:
3304
- throw new TypeError('Must provide a hilo val of "<" or ">"')
3305
- }
3306
-
3307
- // If it satisfies the range it is not outside
3308
- if (satisfies(version, range, options)) {
3309
- return false
3310
- }
3311
-
3312
- // From now on, variable terms are as if we're in "gtr" mode.
3313
- // but note that everything is flipped for the "ltr" function.
3314
-
3315
- for (let i = 0; i < range.set.length; ++i) {
3316
- const comparators = range.set[i];
3317
-
3318
- let high = null;
3319
- let low = null;
3320
-
3321
- comparators.forEach((comparator) => {
3322
- if (comparator.semver === ANY) {
3323
- comparator = new Comparator('>=0.0.0');
3324
- }
3325
- high = high || comparator;
3326
- low = low || comparator;
3327
- if (gtfn(comparator.semver, high.semver, options)) {
3328
- high = comparator;
3329
- } else if (ltfn(comparator.semver, low.semver, options)) {
3330
- low = comparator;
3331
- }
3332
- });
3333
-
3334
- // If the edge version comparator has a operator then our version
3335
- // isn't outside it
3336
- if (high.operator === comp || high.operator === ecomp) {
3337
- return false
3338
- }
3339
-
3340
- // If the lowest version comparator has an operator and our version
3341
- // is less than it then it isn't higher than the range
3342
- if ((!low.operator || low.operator === comp) &&
3343
- ltefn(version, low.semver)) {
3344
- return false
3345
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
3346
- return false
3347
- }
3348
- }
3349
- return true
3350
- };
3351
-
3352
- outside_1 = outside;
3353
- return outside_1;
3354
- }
3355
-
3356
- var gtr_1;
3357
- var hasRequiredGtr;
3358
-
3359
- function requireGtr () {
3360
- if (hasRequiredGtr) return gtr_1;
3361
- hasRequiredGtr = 1;
3362
-
3363
- // Determine if version is greater than all the versions possible in the range.
3364
- const outside = requireOutside();
3365
- const gtr = (version, range, options) => outside(version, range, '>', options);
3366
- gtr_1 = gtr;
3367
- return gtr_1;
3368
- }
3369
-
3370
- var ltr_1;
3371
- var hasRequiredLtr;
3372
-
3373
- function requireLtr () {
3374
- if (hasRequiredLtr) return ltr_1;
3375
- hasRequiredLtr = 1;
3376
-
3377
- const outside = requireOutside();
3378
- // Determine if version is less than all the versions possible in the range
3379
- const ltr = (version, range, options) => outside(version, range, '<', options);
3380
- ltr_1 = ltr;
3381
- return ltr_1;
3382
- }
3383
-
3384
- var intersects_1;
3385
- var hasRequiredIntersects;
3386
-
3387
- function requireIntersects () {
3388
- if (hasRequiredIntersects) return intersects_1;
3389
- hasRequiredIntersects = 1;
3390
-
3391
- const Range = requireRange();
3392
- const intersects = (r1, r2, options) => {
3393
- r1 = new Range(r1, options);
3394
- r2 = new Range(r2, options);
3395
- return r1.intersects(r2, options)
3396
- };
3397
- intersects_1 = intersects;
3398
- return intersects_1;
3399
- }
3400
-
3401
- var simplify;
3402
- var hasRequiredSimplify;
3403
-
3404
- function requireSimplify () {
3405
- if (hasRequiredSimplify) return simplify;
3406
- hasRequiredSimplify = 1;
3407
-
3408
- // given a set of versions and a range, create a "simplified" range
3409
- // that includes the same versions that the original range does
3410
- // If the original range is shorter than the simplified one, return that.
3411
- const satisfies = requireSatisfies();
3412
- const compare = requireCompare();
3413
- simplify = (versions, range, options) => {
3414
- const set = [];
3415
- let first = null;
3416
- let prev = null;
3417
- const v = versions.sort((a, b) => compare(a, b, options));
3418
- for (const version of v) {
3419
- const included = satisfies(version, range, options);
3420
- if (included) {
3421
- prev = version;
3422
- if (!first) {
3423
- first = version;
3424
- }
3425
- } else {
3426
- if (prev) {
3427
- set.push([first, prev]);
3428
- }
3429
- prev = null;
3430
- first = null;
3431
- }
3432
- }
3433
- if (first) {
3434
- set.push([first, null]);
3435
- }
3436
-
3437
- const ranges = [];
3438
- for (const [min, max] of set) {
3439
- if (min === max) {
3440
- ranges.push(min);
3441
- } else if (!max && min === v[0]) {
3442
- ranges.push('*');
3443
- } else if (!max) {
3444
- ranges.push(`>=${min}`);
3445
- } else if (min === v[0]) {
3446
- ranges.push(`<=${max}`);
3447
- } else {
3448
- ranges.push(`${min} - ${max}`);
3449
- }
3450
- }
3451
- const simplified = ranges.join(' || ');
3452
- const original = typeof range.raw === 'string' ? range.raw : String(range);
3453
- return simplified.length < original.length ? simplified : range
3454
- };
3455
- return simplify;
3456
- }
3457
-
3458
- var subset_1;
3459
- var hasRequiredSubset;
3460
-
3461
- function requireSubset () {
3462
- if (hasRequiredSubset) return subset_1;
3463
- hasRequiredSubset = 1;
3464
-
3465
- const Range = requireRange();
3466
- const Comparator = requireComparator();
3467
- const { ANY } = Comparator;
3468
- const satisfies = requireSatisfies();
3469
- const compare = requireCompare();
3470
-
3471
- // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
3472
- // - Every simple range `r1, r2, ...` is a null set, OR
3473
- // - Every simple range `r1, r2, ...` which is not a null set is a subset of
3474
- // some `R1, R2, ...`
3475
- //
3476
- // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
3477
- // - If c is only the ANY comparator
3478
- // - If C is only the ANY comparator, return true
3479
- // - Else if in prerelease mode, return false
3480
- // - else replace c with `[>=0.0.0]`
3481
- // - If C is only the ANY comparator
3482
- // - if in prerelease mode, return true
3483
- // - else replace C with `[>=0.0.0]`
3484
- // - Let EQ be the set of = comparators in c
3485
- // - If EQ is more than one, return true (null set)
3486
- // - Let GT be the highest > or >= comparator in c
3487
- // - Let LT be the lowest < or <= comparator in c
3488
- // - If GT and LT, and GT.semver > LT.semver, return true (null set)
3489
- // - If any C is a = range, and GT or LT are set, return false
3490
- // - If EQ
3491
- // - If GT, and EQ does not satisfy GT, return true (null set)
3492
- // - If LT, and EQ does not satisfy LT, return true (null set)
3493
- // - If EQ satisfies every C, return true
3494
- // - Else return false
3495
- // - If GT
3496
- // - If GT.semver is lower than any > or >= comp in C, return false
3497
- // - If GT is >=, and GT.semver does not satisfy every C, return false
3498
- // - If GT.semver has a prerelease, and not in prerelease mode
3499
- // - If no C has a prerelease and the GT.semver tuple, return false
3500
- // - If LT
3501
- // - If LT.semver is greater than any < or <= comp in C, return false
3502
- // - If LT is <=, and LT.semver does not satisfy every C, return false
3503
- // - If LT.semver has a prerelease, and not in prerelease mode
3504
- // - If no C has a prerelease and the LT.semver tuple, return false
3505
- // - Else return true
3506
-
3507
- const subset = (sub, dom, options = {}) => {
3508
- if (sub === dom) {
3509
- return true
3510
- }
3511
-
3512
- sub = new Range(sub, options);
3513
- dom = new Range(dom, options);
3514
- let sawNonNull = false;
3515
-
3516
- OUTER: for (const simpleSub of sub.set) {
3517
- for (const simpleDom of dom.set) {
3518
- const isSub = simpleSubset(simpleSub, simpleDom, options);
3519
- sawNonNull = sawNonNull || isSub !== null;
3520
- if (isSub) {
3521
- continue OUTER
3522
- }
3523
- }
3524
- // the null set is a subset of everything, but null simple ranges in
3525
- // a complex range should be ignored. so if we saw a non-null range,
3526
- // then we know this isn't a subset, but if EVERY simple range was null,
3527
- // then it is a subset.
3528
- if (sawNonNull) {
3529
- return false
3530
- }
3531
- }
3532
- return true
3533
- };
3534
-
3535
- const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')];
3536
- const minimumVersion = [new Comparator('>=0.0.0')];
3537
-
3538
- const simpleSubset = (sub, dom, options) => {
3539
- if (sub === dom) {
3540
- return true
3541
- }
3542
-
3543
- if (sub.length === 1 && sub[0].semver === ANY) {
3544
- if (dom.length === 1 && dom[0].semver === ANY) {
3545
- return true
3546
- } else if (options.includePrerelease) {
3547
- sub = minimumVersionWithPreRelease;
3548
- } else {
3549
- sub = minimumVersion;
3550
- }
3551
- }
3552
-
3553
- if (dom.length === 1 && dom[0].semver === ANY) {
3554
- if (options.includePrerelease) {
3555
- return true
3556
- } else {
3557
- dom = minimumVersion;
3558
- }
3559
- }
3560
-
3561
- const eqSet = new Set();
3562
- let gt, lt;
3563
- for (const c of sub) {
3564
- if (c.operator === '>' || c.operator === '>=') {
3565
- gt = higherGT(gt, c, options);
3566
- } else if (c.operator === '<' || c.operator === '<=') {
3567
- lt = lowerLT(lt, c, options);
3568
- } else {
3569
- eqSet.add(c.semver);
3570
- }
3571
- }
3572
-
3573
- if (eqSet.size > 1) {
3574
- return null
3575
- }
3576
-
3577
- let gtltComp;
3578
- if (gt && lt) {
3579
- gtltComp = compare(gt.semver, lt.semver, options);
3580
- if (gtltComp > 0) {
3581
- return null
3582
- } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
3583
- return null
3584
- }
3585
- }
3586
-
3587
- // will iterate one or zero times
3588
- for (const eq of eqSet) {
3589
- if (gt && !satisfies(eq, String(gt), options)) {
3590
- return null
3591
- }
3592
-
3593
- if (lt && !satisfies(eq, String(lt), options)) {
3594
- return null
3595
- }
3596
-
3597
- for (const c of dom) {
3598
- if (!satisfies(eq, String(c), options)) {
3599
- return false
3600
- }
3601
- }
3602
-
3603
- return true
3604
- }
3605
-
3606
- let higher, lower;
3607
- let hasDomLT, hasDomGT;
3608
- // if the subset has a prerelease, we need a comparator in the superset
3609
- // with the same tuple and a prerelease, or it's not a subset
3610
- let needDomLTPre = lt &&
3611
- !options.includePrerelease &&
3612
- lt.semver.prerelease.length ? lt.semver : false;
3613
- let needDomGTPre = gt &&
3614
- !options.includePrerelease &&
3615
- gt.semver.prerelease.length ? gt.semver : false;
3616
- // exception: <1.2.3-0 is the same as <1.2.3
3617
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
3618
- lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
3619
- needDomLTPre = false;
3620
- }
3621
-
3622
- for (const c of dom) {
3623
- hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';
3624
- hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';
3625
- if (gt) {
3626
- if (needDomGTPre) {
3627
- if (c.semver.prerelease && c.semver.prerelease.length &&
3628
- c.semver.major === needDomGTPre.major &&
3629
- c.semver.minor === needDomGTPre.minor &&
3630
- c.semver.patch === needDomGTPre.patch) {
3631
- needDomGTPre = false;
3632
- }
3633
- }
3634
- if (c.operator === '>' || c.operator === '>=') {
3635
- higher = higherGT(gt, c, options);
3636
- if (higher === c && higher !== gt) {
3637
- return false
3638
- }
3639
- } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
3640
- return false
3641
- }
3642
- }
3643
- if (lt) {
3644
- if (needDomLTPre) {
3645
- if (c.semver.prerelease && c.semver.prerelease.length &&
3646
- c.semver.major === needDomLTPre.major &&
3647
- c.semver.minor === needDomLTPre.minor &&
3648
- c.semver.patch === needDomLTPre.patch) {
3649
- needDomLTPre = false;
3650
- }
3651
- }
3652
- if (c.operator === '<' || c.operator === '<=') {
3653
- lower = lowerLT(lt, c, options);
3654
- if (lower === c && lower !== lt) {
3655
- return false
3656
- }
3657
- } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
3658
- return false
3659
- }
3660
- }
3661
- if (!c.operator && (lt || gt) && gtltComp !== 0) {
3662
- return false
3663
- }
3664
- }
3665
-
3666
- // if there was a < or >, and nothing in the dom, then must be false
3667
- // UNLESS it was limited by another range in the other direction.
3668
- // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
3669
- if (gt && hasDomLT && !lt && gtltComp !== 0) {
3670
- return false
3671
- }
3672
-
3673
- if (lt && hasDomGT && !gt && gtltComp !== 0) {
3674
- return false
3675
- }
3676
-
3677
- // we needed a prerelease range in a specific tuple, but didn't get one
3678
- // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
3679
- // because it includes prereleases in the 1.2.3 tuple
3680
- if (needDomGTPre || needDomLTPre) {
3681
- return false
3682
- }
3683
-
3684
- return true
3685
- };
3686
-
3687
- // >=1.2.3 is lower than >1.2.3
3688
- const higherGT = (a, b, options) => {
3689
- if (!a) {
3690
- return b
3691
- }
3692
- const comp = compare(a.semver, b.semver, options);
3693
- return comp > 0 ? a
3694
- : comp < 0 ? b
3695
- : b.operator === '>' && a.operator === '>=' ? b
3696
- : a
3697
- };
3698
-
3699
- // <=1.2.3 is higher than <1.2.3
3700
- const lowerLT = (a, b, options) => {
3701
- if (!a) {
3702
- return b
3703
- }
3704
- const comp = compare(a.semver, b.semver, options);
3705
- return comp < 0 ? a
3706
- : comp > 0 ? b
3707
- : b.operator === '<' && a.operator === '<=' ? b
3708
- : a
3709
- };
3710
-
3711
- subset_1 = subset;
3712
- return subset_1;
3713
- }
3714
-
3715
- var semver;
3716
- var hasRequiredSemver;
3717
-
3718
- function requireSemver () {
3719
- if (hasRequiredSemver) return semver;
3720
- hasRequiredSemver = 1;
3721
-
3722
- // just pre-load all the stuff that index.js lazily exports
3723
- const internalRe = requireRe();
3724
- const constants = requireConstants();
3725
- const SemVer = requireSemver$1();
3726
- const identifiers = requireIdentifiers();
3727
- const parse = requireParse();
3728
- const valid = requireValid$1();
3729
- const clean = requireClean();
3730
- const inc = requireInc();
3731
- const diff = requireDiff();
3732
- const major = requireMajor();
3733
- const minor = requireMinor();
3734
- const patch = requirePatch();
3735
- const prerelease = requirePrerelease();
3736
- const compare = requireCompare();
3737
- const rcompare = requireRcompare();
3738
- const compareLoose = requireCompareLoose();
3739
- const compareBuild = requireCompareBuild();
3740
- const sort = requireSort();
3741
- const rsort = requireRsort();
3742
- const gt = requireGt();
3743
- const lt = requireLt();
3744
- const eq = requireEq();
3745
- const neq = requireNeq();
3746
- const gte = requireGte();
3747
- const lte = requireLte();
3748
- const cmp = requireCmp();
3749
- const coerce = requireCoerce();
3750
- const Comparator = requireComparator();
3751
- const Range = requireRange();
3752
- const satisfies = requireSatisfies();
3753
- const toComparators = requireToComparators();
3754
- const maxSatisfying = requireMaxSatisfying();
3755
- const minSatisfying = requireMinSatisfying();
3756
- const minVersion = requireMinVersion();
3757
- const validRange = requireValid();
3758
- const outside = requireOutside();
3759
- const gtr = requireGtr();
3760
- const ltr = requireLtr();
3761
- const intersects = requireIntersects();
3762
- const simplifyRange = requireSimplify();
3763
- const subset = requireSubset();
3764
- semver = {
3765
- parse,
3766
- valid,
3767
- clean,
3768
- inc,
3769
- diff,
3770
- major,
3771
- minor,
3772
- patch,
3773
- prerelease,
3774
- compare,
3775
- rcompare,
3776
- compareLoose,
3777
- compareBuild,
3778
- sort,
3779
- rsort,
3780
- gt,
3781
- lt,
3782
- eq,
3783
- neq,
3784
- gte,
3785
- lte,
3786
- cmp,
3787
- coerce,
3788
- Comparator,
3789
- Range,
3790
- satisfies,
3791
- toComparators,
3792
- maxSatisfying,
3793
- minSatisfying,
3794
- minVersion,
3795
- validRange,
3796
- outside,
3797
- gtr,
3798
- ltr,
3799
- intersects,
3800
- simplifyRange,
3801
- subset,
3802
- SemVer,
3803
- re: internalRe.re,
3804
- src: internalRe.src,
3805
- tokens: internalRe.t,
3806
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
3807
- RELEASE_TYPES: constants.RELEASE_TYPES,
3808
- compareIdentifiers: identifiers.compareIdentifiers,
3809
- rcompareIdentifiers: identifiers.rcompareIdentifiers,
3810
- };
3811
- return semver;
3812
- }
3813
-
3814
- export { requireSemver as a, requireSrc as r };