@dcf-micro/eslint-config 5.0.0

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 (46) hide show
  1. package/dist/chunks/eslint-plugin-prettier.mjs +1716 -0
  2. package/dist/chunks/index.mjs +1341 -0
  3. package/dist/chunks/index10.mjs +39595 -0
  4. package/dist/chunks/index11.mjs +24 -0
  5. package/dist/chunks/index12.mjs +75273 -0
  6. package/dist/chunks/index13.mjs +55129 -0
  7. package/dist/chunks/index14.mjs +24 -0
  8. package/dist/chunks/index15.mjs +1441 -0
  9. package/dist/chunks/index2.mjs +31864 -0
  10. package/dist/chunks/index3.mjs +8154 -0
  11. package/dist/chunks/index4.mjs +24 -0
  12. package/dist/chunks/index5.mjs +44093 -0
  13. package/dist/chunks/index6.mjs +10371 -0
  14. package/dist/chunks/index7.mjs +21890 -0
  15. package/dist/chunks/index8.mjs +14424 -0
  16. package/dist/chunks/index9.mjs +194 -0
  17. package/dist/chunks/jiti.mjs +320 -0
  18. package/dist/index.d.mts +3897 -0
  19. package/dist/index.d.ts +3897 -0
  20. package/dist/index.mjs +4 -0
  21. package/dist/shared/eslint-config.BDBLGvXj.mjs +5282 -0
  22. package/dist/shared/eslint-config.BEdqg1el.mjs +12256 -0
  23. package/dist/shared/eslint-config.BKmXKm8B.mjs +5533 -0
  24. package/dist/shared/eslint-config.BjUMgISS.mjs +9012 -0
  25. package/dist/shared/eslint-config.Bk-3rH6Y.mjs +1355 -0
  26. package/dist/shared/eslint-config.BytuZ0Ec.mjs +20 -0
  27. package/dist/shared/eslint-config.C1V0I4Np.mjs +16900 -0
  28. package/dist/shared/eslint-config.CGxZQKHV.mjs +2091 -0
  29. package/dist/shared/eslint-config.COweQ1RR.mjs +5 -0
  30. package/dist/shared/eslint-config.CSnk9Q4w.mjs +9339 -0
  31. package/dist/shared/eslint-config.CWvTq0mr.mjs +2914 -0
  32. package/dist/shared/eslint-config.Ca4PTK8E.mjs +646 -0
  33. package/dist/shared/eslint-config.CmPTszkJ.mjs +3583 -0
  34. package/dist/shared/eslint-config.CqEANaNA.mjs +139622 -0
  35. package/dist/shared/eslint-config.CsePEcYJ.mjs +71 -0
  36. package/dist/shared/eslint-config.Cw6mETSZ.mjs +2580 -0
  37. package/dist/shared/eslint-config.DTVnsecK.mjs +1751 -0
  38. package/dist/shared/eslint-config.DWoU09EE.mjs +6958 -0
  39. package/dist/shared/eslint-config.DZvqTQUU.mjs +3818 -0
  40. package/dist/shared/eslint-config.Dhg7lT0g.mjs +1807 -0
  41. package/dist/shared/eslint-config.Du5y5qmf.mjs +200673 -0
  42. package/dist/shared/eslint-config.FKVuBSa4.mjs +394 -0
  43. package/dist/shared/eslint-config.I8d-HnmI.mjs +2654 -0
  44. package/dist/shared/eslint-config.YntqsQY1.mjs +40 -0
  45. package/dist/shared/eslint-config.uGTBNMD0.mjs +687 -0
  46. package/package.json +56 -0
@@ -0,0 +1,2654 @@
1
+ var re = {exports: {}};
2
+
3
+ var constants;
4
+ var hasRequiredConstants;
5
+
6
+ function requireConstants () {
7
+ if (hasRequiredConstants) return constants;
8
+ hasRequiredConstants = 1;
9
+ // Note: this is the semver.org version of the spec that it implements
10
+ // Not necessarily the package version of this code.
11
+ const SEMVER_SPEC_VERSION = '2.0.0';
12
+
13
+ const MAX_LENGTH = 256;
14
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
15
+ /* istanbul ignore next */ 9007199254740991;
16
+
17
+ // Max safe segment length for coercion.
18
+ const MAX_SAFE_COMPONENT_LENGTH = 16;
19
+
20
+ // Max safe length for a build identifier. The max length minus 6 characters for
21
+ // the shortest version with a build 0.0.0+BUILD.
22
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
23
+
24
+ const RELEASE_TYPES = [
25
+ 'major',
26
+ 'premajor',
27
+ 'minor',
28
+ 'preminor',
29
+ 'patch',
30
+ 'prepatch',
31
+ 'prerelease',
32
+ ];
33
+
34
+ constants = {
35
+ MAX_LENGTH,
36
+ MAX_SAFE_COMPONENT_LENGTH,
37
+ MAX_SAFE_BUILD_LENGTH,
38
+ MAX_SAFE_INTEGER,
39
+ RELEASE_TYPES,
40
+ SEMVER_SPEC_VERSION,
41
+ FLAG_INCLUDE_PRERELEASE: 0b001,
42
+ FLAG_LOOSE: 0b010,
43
+ };
44
+ return constants;
45
+ }
46
+
47
+ var debug_1;
48
+ var hasRequiredDebug;
49
+
50
+ function requireDebug () {
51
+ if (hasRequiredDebug) return debug_1;
52
+ hasRequiredDebug = 1;
53
+ const debug = (
54
+ typeof process === 'object' &&
55
+ process.env &&
56
+ process.env.NODE_DEBUG &&
57
+ /\bsemver\b/i.test(process.env.NODE_DEBUG)
58
+ ) ? (...args) => console.error('SEMVER', ...args)
59
+ : () => {};
60
+
61
+ debug_1 = debug;
62
+ return debug_1;
63
+ }
64
+
65
+ var hasRequiredRe;
66
+
67
+ function requireRe () {
68
+ if (hasRequiredRe) return re.exports;
69
+ hasRequiredRe = 1;
70
+ (function (module, exports) {
71
+ const {
72
+ MAX_SAFE_COMPONENT_LENGTH,
73
+ MAX_SAFE_BUILD_LENGTH,
74
+ MAX_LENGTH,
75
+ } = requireConstants();
76
+ const debug = requireDebug();
77
+ exports = module.exports = {};
78
+
79
+ // The actual regexps go on exports.re
80
+ const re = exports.re = [];
81
+ const safeRe = exports.safeRe = [];
82
+ const src = exports.src = [];
83
+ const safeSrc = exports.safeSrc = [];
84
+ const t = exports.t = {};
85
+ let R = 0;
86
+
87
+ const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
88
+
89
+ // Replace some greedy regex tokens to prevent regex dos issues. These regex are
90
+ // used internally via the safeRe object since all inputs in this library get
91
+ // normalized first to trim and collapse all extra whitespace. The original
92
+ // regexes are exported for userland consumption and lower level usage. A
93
+ // future breaking change could export the safer regex only with a note that
94
+ // all input should have extra whitespace removed.
95
+ const safeRegexReplacements = [
96
+ ['\\s', 1],
97
+ ['\\d', MAX_LENGTH],
98
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
99
+ ];
100
+
101
+ const makeSafeRegex = (value) => {
102
+ for (const [token, max] of safeRegexReplacements) {
103
+ value = value
104
+ .split(`${token}*`).join(`${token}{0,${max}}`)
105
+ .split(`${token}+`).join(`${token}{1,${max}}`);
106
+ }
107
+ return value
108
+ };
109
+
110
+ const createToken = (name, value, isGlobal) => {
111
+ const safe = makeSafeRegex(value);
112
+ const index = R++;
113
+ debug(name, index, value);
114
+ t[name] = index;
115
+ src[index] = value;
116
+ safeSrc[index] = safe;
117
+ re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
118
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
119
+ };
120
+
121
+ // The following Regular Expressions can be used for tokenizing,
122
+ // validating, and parsing SemVer version strings.
123
+
124
+ // ## Numeric Identifier
125
+ // A single `0`, or a non-zero digit followed by zero or more digits.
126
+
127
+ createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
128
+ createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
129
+
130
+ // ## Non-numeric Identifier
131
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
132
+ // more letters, digits, or hyphens.
133
+
134
+ createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
135
+
136
+ // ## Main Version
137
+ // Three dot-separated numeric identifiers.
138
+
139
+ createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
140
+ `(${src[t.NUMERICIDENTIFIER]})\\.` +
141
+ `(${src[t.NUMERICIDENTIFIER]})`);
142
+
143
+ createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
144
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
145
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
146
+
147
+ // ## Pre-release Version Identifier
148
+ // A numeric identifier, or a non-numeric identifier.
149
+
150
+ createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
151
+ }|${src[t.NONNUMERICIDENTIFIER]})`);
152
+
153
+ createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
154
+ }|${src[t.NONNUMERICIDENTIFIER]})`);
155
+
156
+ // ## Pre-release Version
157
+ // Hyphen, followed by one or more dot-separated pre-release version
158
+ // identifiers.
159
+
160
+ createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
161
+ }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
162
+
163
+ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
164
+ }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
165
+
166
+ // ## Build Metadata Identifier
167
+ // Any combination of digits, letters, or hyphens.
168
+
169
+ createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
170
+
171
+ // ## Build Metadata
172
+ // Plus sign, followed by one or more period-separated build metadata
173
+ // identifiers.
174
+
175
+ createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
176
+ }(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
177
+
178
+ // ## Full Version String
179
+ // A main version, followed optionally by a pre-release version and
180
+ // build metadata.
181
+
182
+ // Note that the only major, minor, patch, and pre-release sections of
183
+ // the version string are capturing groups. The build metadata is not a
184
+ // capturing group, because it should not ever be used in version
185
+ // comparison.
186
+
187
+ createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
188
+ }${src[t.PRERELEASE]}?${
189
+ src[t.BUILD]}?`);
190
+
191
+ createToken('FULL', `^${src[t.FULLPLAIN]}$`);
192
+
193
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
194
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
195
+ // common in the npm registry.
196
+ createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
197
+ }${src[t.PRERELEASELOOSE]}?${
198
+ src[t.BUILD]}?`);
199
+
200
+ createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
201
+
202
+ createToken('GTLT', '((?:<|>)?=?)');
203
+
204
+ // Something like "2.*" or "1.2.x".
205
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
206
+ // Only the first item is strictly required.
207
+ createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
208
+ createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
209
+
210
+ createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
211
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
212
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
213
+ `(?:${src[t.PRERELEASE]})?${
214
+ src[t.BUILD]}?` +
215
+ `)?)?`);
216
+
217
+ createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
218
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
219
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
220
+ `(?:${src[t.PRERELEASELOOSE]})?${
221
+ src[t.BUILD]}?` +
222
+ `)?)?`);
223
+
224
+ createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
225
+ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
226
+
227
+ // Coercion.
228
+ // Extract anything that could conceivably be a part of a valid semver
229
+ createToken('COERCEPLAIN', `${'(^|[^\\d])' +
230
+ '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
231
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
232
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
233
+ createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
234
+ createToken('COERCEFULL', src[t.COERCEPLAIN] +
235
+ `(?:${src[t.PRERELEASE]})?` +
236
+ `(?:${src[t.BUILD]})?` +
237
+ `(?:$|[^\\d])`);
238
+ createToken('COERCERTL', src[t.COERCE], true);
239
+ createToken('COERCERTLFULL', src[t.COERCEFULL], true);
240
+
241
+ // Tilde ranges.
242
+ // Meaning is "reasonably at or greater than"
243
+ createToken('LONETILDE', '(?:~>?)');
244
+
245
+ createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
246
+ exports.tildeTrimReplace = '$1~';
247
+
248
+ createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
249
+ createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
250
+
251
+ // Caret ranges.
252
+ // Meaning is "at least and backwards compatible with"
253
+ createToken('LONECARET', '(?:\\^)');
254
+
255
+ createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
256
+ exports.caretTrimReplace = '$1^';
257
+
258
+ createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
259
+ createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
260
+
261
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
262
+ createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
263
+ createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
264
+
265
+ // An expression to strip any whitespace between the gtlt and the thing
266
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
267
+ createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
268
+ }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
269
+ exports.comparatorTrimReplace = '$1$2$3';
270
+
271
+ // Something like `1.2.3 - 1.2.4`
272
+ // Note that these all use the loose form, because they'll be
273
+ // checked against either the strict or loose comparator form
274
+ // later.
275
+ createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
276
+ `\\s+-\\s+` +
277
+ `(${src[t.XRANGEPLAIN]})` +
278
+ `\\s*$`);
279
+
280
+ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
281
+ `\\s+-\\s+` +
282
+ `(${src[t.XRANGEPLAINLOOSE]})` +
283
+ `\\s*$`);
284
+
285
+ // Star ranges basically just allow anything at all.
286
+ createToken('STAR', '(<|>)?=?\\s*\\*');
287
+ // >=0.0.0 is like a star
288
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
289
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
290
+ } (re, re.exports));
291
+ return re.exports;
292
+ }
293
+
294
+ var parseOptions_1;
295
+ var hasRequiredParseOptions;
296
+
297
+ function requireParseOptions () {
298
+ if (hasRequiredParseOptions) return parseOptions_1;
299
+ hasRequiredParseOptions = 1;
300
+ // parse out just the options we care about
301
+ const looseOption = Object.freeze({ loose: true });
302
+ const emptyOpts = Object.freeze({ });
303
+ const parseOptions = options => {
304
+ if (!options) {
305
+ return emptyOpts
306
+ }
307
+
308
+ if (typeof options !== 'object') {
309
+ return looseOption
310
+ }
311
+
312
+ return options
313
+ };
314
+ parseOptions_1 = parseOptions;
315
+ return parseOptions_1;
316
+ }
317
+
318
+ var identifiers;
319
+ var hasRequiredIdentifiers;
320
+
321
+ function requireIdentifiers () {
322
+ if (hasRequiredIdentifiers) return identifiers;
323
+ hasRequiredIdentifiers = 1;
324
+ const numeric = /^[0-9]+$/;
325
+ const compareIdentifiers = (a, b) => {
326
+ const anum = numeric.test(a);
327
+ const bnum = numeric.test(b);
328
+
329
+ if (anum && bnum) {
330
+ a = +a;
331
+ b = +b;
332
+ }
333
+
334
+ return a === b ? 0
335
+ : (anum && !bnum) ? -1
336
+ : (bnum && !anum) ? 1
337
+ : a < b ? -1
338
+ : 1
339
+ };
340
+
341
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
342
+
343
+ identifiers = {
344
+ compareIdentifiers,
345
+ rcompareIdentifiers,
346
+ };
347
+ return identifiers;
348
+ }
349
+
350
+ var semver$1;
351
+ var hasRequiredSemver$1;
352
+
353
+ function requireSemver$1 () {
354
+ if (hasRequiredSemver$1) return semver$1;
355
+ hasRequiredSemver$1 = 1;
356
+ const debug = requireDebug();
357
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
358
+ const { safeRe: re, safeSrc: src, t } = requireRe();
359
+
360
+ const parseOptions = requireParseOptions();
361
+ const { compareIdentifiers } = requireIdentifiers();
362
+ class SemVer {
363
+ constructor (version, options) {
364
+ options = parseOptions(options);
365
+
366
+ if (version instanceof SemVer) {
367
+ if (version.loose === !!options.loose &&
368
+ version.includePrerelease === !!options.includePrerelease) {
369
+ return version
370
+ } else {
371
+ version = version.version;
372
+ }
373
+ } else if (typeof version !== 'string') {
374
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
375
+ }
376
+
377
+ if (version.length > MAX_LENGTH) {
378
+ throw new TypeError(
379
+ `version is longer than ${MAX_LENGTH} characters`
380
+ )
381
+ }
382
+
383
+ debug('SemVer', version, options);
384
+ this.options = options;
385
+ this.loose = !!options.loose;
386
+ // this isn't actually relevant for versions, but keep it so that we
387
+ // don't run into trouble passing this.options around.
388
+ this.includePrerelease = !!options.includePrerelease;
389
+
390
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
391
+
392
+ if (!m) {
393
+ throw new TypeError(`Invalid Version: ${version}`)
394
+ }
395
+
396
+ this.raw = version;
397
+
398
+ // these are actually numbers
399
+ this.major = +m[1];
400
+ this.minor = +m[2];
401
+ this.patch = +m[3];
402
+
403
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
404
+ throw new TypeError('Invalid major version')
405
+ }
406
+
407
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
408
+ throw new TypeError('Invalid minor version')
409
+ }
410
+
411
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
412
+ throw new TypeError('Invalid patch version')
413
+ }
414
+
415
+ // numberify any prerelease numeric ids
416
+ if (!m[4]) {
417
+ this.prerelease = [];
418
+ } else {
419
+ this.prerelease = m[4].split('.').map((id) => {
420
+ if (/^[0-9]+$/.test(id)) {
421
+ const num = +id;
422
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
423
+ return num
424
+ }
425
+ }
426
+ return id
427
+ });
428
+ }
429
+
430
+ this.build = m[5] ? m[5].split('.') : [];
431
+ this.format();
432
+ }
433
+
434
+ format () {
435
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
436
+ if (this.prerelease.length) {
437
+ this.version += `-${this.prerelease.join('.')}`;
438
+ }
439
+ return this.version
440
+ }
441
+
442
+ toString () {
443
+ return this.version
444
+ }
445
+
446
+ compare (other) {
447
+ debug('SemVer.compare', this.version, this.options, other);
448
+ if (!(other instanceof SemVer)) {
449
+ if (typeof other === 'string' && other === this.version) {
450
+ return 0
451
+ }
452
+ other = new SemVer(other, this.options);
453
+ }
454
+
455
+ if (other.version === this.version) {
456
+ return 0
457
+ }
458
+
459
+ return this.compareMain(other) || this.comparePre(other)
460
+ }
461
+
462
+ compareMain (other) {
463
+ if (!(other instanceof SemVer)) {
464
+ other = new SemVer(other, this.options);
465
+ }
466
+
467
+ return (
468
+ compareIdentifiers(this.major, other.major) ||
469
+ compareIdentifiers(this.minor, other.minor) ||
470
+ compareIdentifiers(this.patch, other.patch)
471
+ )
472
+ }
473
+
474
+ comparePre (other) {
475
+ if (!(other instanceof SemVer)) {
476
+ other = new SemVer(other, this.options);
477
+ }
478
+
479
+ // NOT having a prerelease is > having one
480
+ if (this.prerelease.length && !other.prerelease.length) {
481
+ return -1
482
+ } else if (!this.prerelease.length && other.prerelease.length) {
483
+ return 1
484
+ } else if (!this.prerelease.length && !other.prerelease.length) {
485
+ return 0
486
+ }
487
+
488
+ let i = 0;
489
+ do {
490
+ const a = this.prerelease[i];
491
+ const b = other.prerelease[i];
492
+ debug('prerelease compare', i, a, b);
493
+ if (a === undefined && b === undefined) {
494
+ return 0
495
+ } else if (b === undefined) {
496
+ return 1
497
+ } else if (a === undefined) {
498
+ return -1
499
+ } else if (a === b) {
500
+ continue
501
+ } else {
502
+ return compareIdentifiers(a, b)
503
+ }
504
+ } while (++i)
505
+ }
506
+
507
+ compareBuild (other) {
508
+ if (!(other instanceof SemVer)) {
509
+ other = new SemVer(other, this.options);
510
+ }
511
+
512
+ let i = 0;
513
+ do {
514
+ const a = this.build[i];
515
+ const b = other.build[i];
516
+ debug('build compare', i, a, b);
517
+ if (a === undefined && b === undefined) {
518
+ return 0
519
+ } else if (b === undefined) {
520
+ return 1
521
+ } else if (a === undefined) {
522
+ return -1
523
+ } else if (a === b) {
524
+ continue
525
+ } else {
526
+ return compareIdentifiers(a, b)
527
+ }
528
+ } while (++i)
529
+ }
530
+
531
+ // preminor will bump the version up to the next minor release, and immediately
532
+ // down to pre-release. premajor and prepatch work the same way.
533
+ inc (release, identifier, identifierBase) {
534
+ if (release.startsWith('pre')) {
535
+ if (!identifier && identifierBase === false) {
536
+ throw new Error('invalid increment argument: identifier is empty')
537
+ }
538
+ // Avoid an invalid semver results
539
+ if (identifier) {
540
+ const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`);
541
+ const match = `-${identifier}`.match(r);
542
+ if (!match || match[1] !== identifier) {
543
+ throw new Error(`invalid identifier: ${identifier}`)
544
+ }
545
+ }
546
+ }
547
+
548
+ switch (release) {
549
+ case 'premajor':
550
+ this.prerelease.length = 0;
551
+ this.patch = 0;
552
+ this.minor = 0;
553
+ this.major++;
554
+ this.inc('pre', identifier, identifierBase);
555
+ break
556
+ case 'preminor':
557
+ this.prerelease.length = 0;
558
+ this.patch = 0;
559
+ this.minor++;
560
+ this.inc('pre', identifier, identifierBase);
561
+ break
562
+ case 'prepatch':
563
+ // If this is already a prerelease, it will bump to the next version
564
+ // drop any prereleases that might already exist, since they are not
565
+ // relevant at this point.
566
+ this.prerelease.length = 0;
567
+ this.inc('patch', identifier, identifierBase);
568
+ this.inc('pre', identifier, identifierBase);
569
+ break
570
+ // If the input is a non-prerelease version, this acts the same as
571
+ // prepatch.
572
+ case 'prerelease':
573
+ if (this.prerelease.length === 0) {
574
+ this.inc('patch', identifier, identifierBase);
575
+ }
576
+ this.inc('pre', identifier, identifierBase);
577
+ break
578
+ case 'release':
579
+ if (this.prerelease.length === 0) {
580
+ throw new Error(`version ${this.raw} is not a prerelease`)
581
+ }
582
+ this.prerelease.length = 0;
583
+ break
584
+
585
+ case 'major':
586
+ // If this is a pre-major version, bump up to the same major version.
587
+ // Otherwise increment major.
588
+ // 1.0.0-5 bumps to 1.0.0
589
+ // 1.1.0 bumps to 2.0.0
590
+ if (
591
+ this.minor !== 0 ||
592
+ this.patch !== 0 ||
593
+ this.prerelease.length === 0
594
+ ) {
595
+ this.major++;
596
+ }
597
+ this.minor = 0;
598
+ this.patch = 0;
599
+ this.prerelease = [];
600
+ break
601
+ case 'minor':
602
+ // If this is a pre-minor version, bump up to the same minor version.
603
+ // Otherwise increment minor.
604
+ // 1.2.0-5 bumps to 1.2.0
605
+ // 1.2.1 bumps to 1.3.0
606
+ if (this.patch !== 0 || this.prerelease.length === 0) {
607
+ this.minor++;
608
+ }
609
+ this.patch = 0;
610
+ this.prerelease = [];
611
+ break
612
+ case 'patch':
613
+ // If this is not a pre-release version, it will increment the patch.
614
+ // If it is a pre-release it will bump up to the same patch version.
615
+ // 1.2.0-5 patches to 1.2.0
616
+ // 1.2.0 patches to 1.2.1
617
+ if (this.prerelease.length === 0) {
618
+ this.patch++;
619
+ }
620
+ this.prerelease = [];
621
+ break
622
+ // This probably shouldn't be used publicly.
623
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
624
+ case 'pre': {
625
+ const base = Number(identifierBase) ? 1 : 0;
626
+
627
+ if (this.prerelease.length === 0) {
628
+ this.prerelease = [base];
629
+ } else {
630
+ let i = this.prerelease.length;
631
+ while (--i >= 0) {
632
+ if (typeof this.prerelease[i] === 'number') {
633
+ this.prerelease[i]++;
634
+ i = -2;
635
+ }
636
+ }
637
+ if (i === -1) {
638
+ // didn't increment anything
639
+ if (identifier === this.prerelease.join('.') && identifierBase === false) {
640
+ throw new Error('invalid increment argument: identifier already exists')
641
+ }
642
+ this.prerelease.push(base);
643
+ }
644
+ }
645
+ if (identifier) {
646
+ // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
647
+ // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
648
+ let prerelease = [identifier, base];
649
+ if (identifierBase === false) {
650
+ prerelease = [identifier];
651
+ }
652
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
653
+ if (isNaN(this.prerelease[1])) {
654
+ this.prerelease = prerelease;
655
+ }
656
+ } else {
657
+ this.prerelease = prerelease;
658
+ }
659
+ }
660
+ break
661
+ }
662
+ default:
663
+ throw new Error(`invalid increment argument: ${release}`)
664
+ }
665
+ this.raw = this.format();
666
+ if (this.build.length) {
667
+ this.raw += `+${this.build.join('.')}`;
668
+ }
669
+ return this
670
+ }
671
+ }
672
+
673
+ semver$1 = SemVer;
674
+ return semver$1;
675
+ }
676
+
677
+ var parse_1;
678
+ var hasRequiredParse;
679
+
680
+ function requireParse () {
681
+ if (hasRequiredParse) return parse_1;
682
+ hasRequiredParse = 1;
683
+ const SemVer = requireSemver$1();
684
+ const parse = (version, options, throwErrors = false) => {
685
+ if (version instanceof SemVer) {
686
+ return version
687
+ }
688
+ try {
689
+ return new SemVer(version, options)
690
+ } catch (er) {
691
+ if (!throwErrors) {
692
+ return null
693
+ }
694
+ throw er
695
+ }
696
+ };
697
+
698
+ parse_1 = parse;
699
+ return parse_1;
700
+ }
701
+
702
+ var valid_1;
703
+ var hasRequiredValid$1;
704
+
705
+ function requireValid$1 () {
706
+ if (hasRequiredValid$1) return valid_1;
707
+ hasRequiredValid$1 = 1;
708
+ const parse = requireParse();
709
+ const valid = (version, options) => {
710
+ const v = parse(version, options);
711
+ return v ? v.version : null
712
+ };
713
+ valid_1 = valid;
714
+ return valid_1;
715
+ }
716
+
717
+ var clean_1;
718
+ var hasRequiredClean;
719
+
720
+ function requireClean () {
721
+ if (hasRequiredClean) return clean_1;
722
+ hasRequiredClean = 1;
723
+ const parse = requireParse();
724
+ const clean = (version, options) => {
725
+ const s = parse(version.trim().replace(/^[=v]+/, ''), options);
726
+ return s ? s.version : null
727
+ };
728
+ clean_1 = clean;
729
+ return clean_1;
730
+ }
731
+
732
+ var inc_1;
733
+ var hasRequiredInc;
734
+
735
+ function requireInc () {
736
+ if (hasRequiredInc) return inc_1;
737
+ hasRequiredInc = 1;
738
+ const SemVer = requireSemver$1();
739
+
740
+ const inc = (version, release, options, identifier, identifierBase) => {
741
+ if (typeof (options) === 'string') {
742
+ identifierBase = identifier;
743
+ identifier = options;
744
+ options = undefined;
745
+ }
746
+
747
+ try {
748
+ return new SemVer(
749
+ version instanceof SemVer ? version.version : version,
750
+ options
751
+ ).inc(release, identifier, identifierBase).version
752
+ } catch (er) {
753
+ return null
754
+ }
755
+ };
756
+ inc_1 = inc;
757
+ return inc_1;
758
+ }
759
+
760
+ var diff_1;
761
+ var hasRequiredDiff;
762
+
763
+ function requireDiff () {
764
+ if (hasRequiredDiff) return diff_1;
765
+ hasRequiredDiff = 1;
766
+ const parse = requireParse();
767
+
768
+ const diff = (version1, version2) => {
769
+ const v1 = parse(version1, null, true);
770
+ const v2 = parse(version2, null, true);
771
+ const comparison = v1.compare(v2);
772
+
773
+ if (comparison === 0) {
774
+ return null
775
+ }
776
+
777
+ const v1Higher = comparison > 0;
778
+ const highVersion = v1Higher ? v1 : v2;
779
+ const lowVersion = v1Higher ? v2 : v1;
780
+ const highHasPre = !!highVersion.prerelease.length;
781
+ const lowHasPre = !!lowVersion.prerelease.length;
782
+
783
+ if (lowHasPre && !highHasPre) {
784
+ // Going from prerelease -> no prerelease requires some special casing
785
+
786
+ // If the low version has only a major, then it will always be a major
787
+ // Some examples:
788
+ // 1.0.0-1 -> 1.0.0
789
+ // 1.0.0-1 -> 1.1.1
790
+ // 1.0.0-1 -> 2.0.0
791
+ if (!lowVersion.patch && !lowVersion.minor) {
792
+ return 'major'
793
+ }
794
+
795
+ // If the main part has no difference
796
+ if (lowVersion.compareMain(highVersion) === 0) {
797
+ if (lowVersion.minor && !lowVersion.patch) {
798
+ return 'minor'
799
+ }
800
+ return 'patch'
801
+ }
802
+ }
803
+
804
+ // add the `pre` prefix if we are going to a prerelease version
805
+ const prefix = highHasPre ? 'pre' : '';
806
+
807
+ if (v1.major !== v2.major) {
808
+ return prefix + 'major'
809
+ }
810
+
811
+ if (v1.minor !== v2.minor) {
812
+ return prefix + 'minor'
813
+ }
814
+
815
+ if (v1.patch !== v2.patch) {
816
+ return prefix + 'patch'
817
+ }
818
+
819
+ // high and low are preleases
820
+ return 'prerelease'
821
+ };
822
+
823
+ diff_1 = diff;
824
+ return diff_1;
825
+ }
826
+
827
+ var major_1;
828
+ var hasRequiredMajor;
829
+
830
+ function requireMajor () {
831
+ if (hasRequiredMajor) return major_1;
832
+ hasRequiredMajor = 1;
833
+ const SemVer = requireSemver$1();
834
+ const major = (a, loose) => new SemVer(a, loose).major;
835
+ major_1 = major;
836
+ return major_1;
837
+ }
838
+
839
+ var minor_1;
840
+ var hasRequiredMinor;
841
+
842
+ function requireMinor () {
843
+ if (hasRequiredMinor) return minor_1;
844
+ hasRequiredMinor = 1;
845
+ const SemVer = requireSemver$1();
846
+ const minor = (a, loose) => new SemVer(a, loose).minor;
847
+ minor_1 = minor;
848
+ return minor_1;
849
+ }
850
+
851
+ var patch_1;
852
+ var hasRequiredPatch;
853
+
854
+ function requirePatch () {
855
+ if (hasRequiredPatch) return patch_1;
856
+ hasRequiredPatch = 1;
857
+ const SemVer = requireSemver$1();
858
+ const patch = (a, loose) => new SemVer(a, loose).patch;
859
+ patch_1 = patch;
860
+ return patch_1;
861
+ }
862
+
863
+ var prerelease_1;
864
+ var hasRequiredPrerelease;
865
+
866
+ function requirePrerelease () {
867
+ if (hasRequiredPrerelease) return prerelease_1;
868
+ hasRequiredPrerelease = 1;
869
+ const parse = requireParse();
870
+ const prerelease = (version, options) => {
871
+ const parsed = parse(version, options);
872
+ return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
873
+ };
874
+ prerelease_1 = prerelease;
875
+ return prerelease_1;
876
+ }
877
+
878
+ var compare_1;
879
+ var hasRequiredCompare;
880
+
881
+ function requireCompare () {
882
+ if (hasRequiredCompare) return compare_1;
883
+ hasRequiredCompare = 1;
884
+ const SemVer = requireSemver$1();
885
+ const compare = (a, b, loose) =>
886
+ new SemVer(a, loose).compare(new SemVer(b, loose));
887
+
888
+ compare_1 = compare;
889
+ return compare_1;
890
+ }
891
+
892
+ var rcompare_1;
893
+ var hasRequiredRcompare;
894
+
895
+ function requireRcompare () {
896
+ if (hasRequiredRcompare) return rcompare_1;
897
+ hasRequiredRcompare = 1;
898
+ const compare = requireCompare();
899
+ const rcompare = (a, b, loose) => compare(b, a, loose);
900
+ rcompare_1 = rcompare;
901
+ return rcompare_1;
902
+ }
903
+
904
+ var compareLoose_1;
905
+ var hasRequiredCompareLoose;
906
+
907
+ function requireCompareLoose () {
908
+ if (hasRequiredCompareLoose) return compareLoose_1;
909
+ hasRequiredCompareLoose = 1;
910
+ const compare = requireCompare();
911
+ const compareLoose = (a, b) => compare(a, b, true);
912
+ compareLoose_1 = compareLoose;
913
+ return compareLoose_1;
914
+ }
915
+
916
+ var compareBuild_1;
917
+ var hasRequiredCompareBuild;
918
+
919
+ function requireCompareBuild () {
920
+ if (hasRequiredCompareBuild) return compareBuild_1;
921
+ hasRequiredCompareBuild = 1;
922
+ const SemVer = requireSemver$1();
923
+ const compareBuild = (a, b, loose) => {
924
+ const versionA = new SemVer(a, loose);
925
+ const versionB = new SemVer(b, loose);
926
+ return versionA.compare(versionB) || versionA.compareBuild(versionB)
927
+ };
928
+ compareBuild_1 = compareBuild;
929
+ return compareBuild_1;
930
+ }
931
+
932
+ var sort_1;
933
+ var hasRequiredSort;
934
+
935
+ function requireSort () {
936
+ if (hasRequiredSort) return sort_1;
937
+ hasRequiredSort = 1;
938
+ const compareBuild = requireCompareBuild();
939
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
940
+ sort_1 = sort;
941
+ return sort_1;
942
+ }
943
+
944
+ var rsort_1;
945
+ var hasRequiredRsort;
946
+
947
+ function requireRsort () {
948
+ if (hasRequiredRsort) return rsort_1;
949
+ hasRequiredRsort = 1;
950
+ const compareBuild = requireCompareBuild();
951
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
952
+ rsort_1 = rsort;
953
+ return rsort_1;
954
+ }
955
+
956
+ var gt_1;
957
+ var hasRequiredGt;
958
+
959
+ function requireGt () {
960
+ if (hasRequiredGt) return gt_1;
961
+ hasRequiredGt = 1;
962
+ const compare = requireCompare();
963
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
964
+ gt_1 = gt;
965
+ return gt_1;
966
+ }
967
+
968
+ var lt_1;
969
+ var hasRequiredLt;
970
+
971
+ function requireLt () {
972
+ if (hasRequiredLt) return lt_1;
973
+ hasRequiredLt = 1;
974
+ const compare = requireCompare();
975
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
976
+ lt_1 = lt;
977
+ return lt_1;
978
+ }
979
+
980
+ var eq_1;
981
+ var hasRequiredEq;
982
+
983
+ function requireEq () {
984
+ if (hasRequiredEq) return eq_1;
985
+ hasRequiredEq = 1;
986
+ const compare = requireCompare();
987
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
988
+ eq_1 = eq;
989
+ return eq_1;
990
+ }
991
+
992
+ var neq_1;
993
+ var hasRequiredNeq;
994
+
995
+ function requireNeq () {
996
+ if (hasRequiredNeq) return neq_1;
997
+ hasRequiredNeq = 1;
998
+ const compare = requireCompare();
999
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
1000
+ neq_1 = neq;
1001
+ return neq_1;
1002
+ }
1003
+
1004
+ var gte_1;
1005
+ var hasRequiredGte;
1006
+
1007
+ function requireGte () {
1008
+ if (hasRequiredGte) return gte_1;
1009
+ hasRequiredGte = 1;
1010
+ const compare = requireCompare();
1011
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
1012
+ gte_1 = gte;
1013
+ return gte_1;
1014
+ }
1015
+
1016
+ var lte_1;
1017
+ var hasRequiredLte;
1018
+
1019
+ function requireLte () {
1020
+ if (hasRequiredLte) return lte_1;
1021
+ hasRequiredLte = 1;
1022
+ const compare = requireCompare();
1023
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
1024
+ lte_1 = lte;
1025
+ return lte_1;
1026
+ }
1027
+
1028
+ var cmp_1;
1029
+ var hasRequiredCmp;
1030
+
1031
+ function requireCmp () {
1032
+ if (hasRequiredCmp) return cmp_1;
1033
+ hasRequiredCmp = 1;
1034
+ const eq = requireEq();
1035
+ const neq = requireNeq();
1036
+ const gt = requireGt();
1037
+ const gte = requireGte();
1038
+ const lt = requireLt();
1039
+ const lte = requireLte();
1040
+
1041
+ const cmp = (a, op, b, loose) => {
1042
+ switch (op) {
1043
+ case '===':
1044
+ if (typeof a === 'object') {
1045
+ a = a.version;
1046
+ }
1047
+ if (typeof b === 'object') {
1048
+ b = b.version;
1049
+ }
1050
+ return a === b
1051
+
1052
+ case '!==':
1053
+ if (typeof a === 'object') {
1054
+ a = a.version;
1055
+ }
1056
+ if (typeof b === 'object') {
1057
+ b = b.version;
1058
+ }
1059
+ return a !== b
1060
+
1061
+ case '':
1062
+ case '=':
1063
+ case '==':
1064
+ return eq(a, b, loose)
1065
+
1066
+ case '!=':
1067
+ return neq(a, b, loose)
1068
+
1069
+ case '>':
1070
+ return gt(a, b, loose)
1071
+
1072
+ case '>=':
1073
+ return gte(a, b, loose)
1074
+
1075
+ case '<':
1076
+ return lt(a, b, loose)
1077
+
1078
+ case '<=':
1079
+ return lte(a, b, loose)
1080
+
1081
+ default:
1082
+ throw new TypeError(`Invalid operator: ${op}`)
1083
+ }
1084
+ };
1085
+ cmp_1 = cmp;
1086
+ return cmp_1;
1087
+ }
1088
+
1089
+ var coerce_1;
1090
+ var hasRequiredCoerce;
1091
+
1092
+ function requireCoerce () {
1093
+ if (hasRequiredCoerce) return coerce_1;
1094
+ hasRequiredCoerce = 1;
1095
+ const SemVer = requireSemver$1();
1096
+ const parse = requireParse();
1097
+ const { safeRe: re, t } = requireRe();
1098
+
1099
+ const coerce = (version, options) => {
1100
+ if (version instanceof SemVer) {
1101
+ return version
1102
+ }
1103
+
1104
+ if (typeof version === 'number') {
1105
+ version = String(version);
1106
+ }
1107
+
1108
+ if (typeof version !== 'string') {
1109
+ return null
1110
+ }
1111
+
1112
+ options = options || {};
1113
+
1114
+ let match = null;
1115
+ if (!options.rtl) {
1116
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
1117
+ } else {
1118
+ // Find the right-most coercible string that does not share
1119
+ // a terminus with a more left-ward coercible string.
1120
+ // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
1121
+ // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
1122
+ //
1123
+ // Walk through the string checking with a /g regexp
1124
+ // Manually set the index so as to pick up overlapping matches.
1125
+ // Stop when we get a match that ends at the string end, since no
1126
+ // coercible string can be more right-ward without the same terminus.
1127
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
1128
+ let next;
1129
+ while ((next = coerceRtlRegex.exec(version)) &&
1130
+ (!match || match.index + match[0].length !== version.length)
1131
+ ) {
1132
+ if (!match ||
1133
+ next.index + next[0].length !== match.index + match[0].length) {
1134
+ match = next;
1135
+ }
1136
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
1137
+ }
1138
+ // leave it in a clean state
1139
+ coerceRtlRegex.lastIndex = -1;
1140
+ }
1141
+
1142
+ if (match === null) {
1143
+ return null
1144
+ }
1145
+
1146
+ const major = match[2];
1147
+ const minor = match[3] || '0';
1148
+ const patch = match[4] || '0';
1149
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '';
1150
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : '';
1151
+
1152
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
1153
+ };
1154
+ coerce_1 = coerce;
1155
+ return coerce_1;
1156
+ }
1157
+
1158
+ var lrucache;
1159
+ var hasRequiredLrucache;
1160
+
1161
+ function requireLrucache () {
1162
+ if (hasRequiredLrucache) return lrucache;
1163
+ hasRequiredLrucache = 1;
1164
+ class LRUCache {
1165
+ constructor () {
1166
+ this.max = 1000;
1167
+ this.map = new Map();
1168
+ }
1169
+
1170
+ get (key) {
1171
+ const value = this.map.get(key);
1172
+ if (value === undefined) {
1173
+ return undefined
1174
+ } else {
1175
+ // Remove the key from the map and add it to the end
1176
+ this.map.delete(key);
1177
+ this.map.set(key, value);
1178
+ return value
1179
+ }
1180
+ }
1181
+
1182
+ delete (key) {
1183
+ return this.map.delete(key)
1184
+ }
1185
+
1186
+ set (key, value) {
1187
+ const deleted = this.delete(key);
1188
+
1189
+ if (!deleted && value !== undefined) {
1190
+ // If cache is full, delete the least recently used item
1191
+ if (this.map.size >= this.max) {
1192
+ const firstKey = this.map.keys().next().value;
1193
+ this.delete(firstKey);
1194
+ }
1195
+
1196
+ this.map.set(key, value);
1197
+ }
1198
+
1199
+ return this
1200
+ }
1201
+ }
1202
+
1203
+ lrucache = LRUCache;
1204
+ return lrucache;
1205
+ }
1206
+
1207
+ var range;
1208
+ var hasRequiredRange;
1209
+
1210
+ function requireRange () {
1211
+ if (hasRequiredRange) return range;
1212
+ hasRequiredRange = 1;
1213
+ const SPACE_CHARACTERS = /\s+/g;
1214
+
1215
+ // hoisted class for cyclic dependency
1216
+ class Range {
1217
+ constructor (range, options) {
1218
+ options = parseOptions(options);
1219
+
1220
+ if (range instanceof Range) {
1221
+ if (
1222
+ range.loose === !!options.loose &&
1223
+ range.includePrerelease === !!options.includePrerelease
1224
+ ) {
1225
+ return range
1226
+ } else {
1227
+ return new Range(range.raw, options)
1228
+ }
1229
+ }
1230
+
1231
+ if (range instanceof Comparator) {
1232
+ // just put it in the set and return
1233
+ this.raw = range.value;
1234
+ this.set = [[range]];
1235
+ this.formatted = undefined;
1236
+ return this
1237
+ }
1238
+
1239
+ this.options = options;
1240
+ this.loose = !!options.loose;
1241
+ this.includePrerelease = !!options.includePrerelease;
1242
+
1243
+ // First reduce all whitespace as much as possible so we do not have to rely
1244
+ // on potentially slow regexes like \s*. This is then stored and used for
1245
+ // future error messages as well.
1246
+ this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
1247
+
1248
+ // First, split on ||
1249
+ this.set = this.raw
1250
+ .split('||')
1251
+ // map the range to a 2d array of comparators
1252
+ .map(r => this.parseRange(r.trim()))
1253
+ // throw out any comparator lists that are empty
1254
+ // this generally means that it was not a valid range, which is allowed
1255
+ // in loose mode, but will still throw if the WHOLE range is invalid.
1256
+ .filter(c => c.length);
1257
+
1258
+ if (!this.set.length) {
1259
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
1260
+ }
1261
+
1262
+ // if we have any that are not the null set, throw out null sets.
1263
+ if (this.set.length > 1) {
1264
+ // keep the first one, in case they're all null sets
1265
+ const first = this.set[0];
1266
+ this.set = this.set.filter(c => !isNullSet(c[0]));
1267
+ if (this.set.length === 0) {
1268
+ this.set = [first];
1269
+ } else if (this.set.length > 1) {
1270
+ // if we have any that are *, then the range is just *
1271
+ for (const c of this.set) {
1272
+ if (c.length === 1 && isAny(c[0])) {
1273
+ this.set = [c];
1274
+ break
1275
+ }
1276
+ }
1277
+ }
1278
+ }
1279
+
1280
+ this.formatted = undefined;
1281
+ }
1282
+
1283
+ get range () {
1284
+ if (this.formatted === undefined) {
1285
+ this.formatted = '';
1286
+ for (let i = 0; i < this.set.length; i++) {
1287
+ if (i > 0) {
1288
+ this.formatted += '||';
1289
+ }
1290
+ const comps = this.set[i];
1291
+ for (let k = 0; k < comps.length; k++) {
1292
+ if (k > 0) {
1293
+ this.formatted += ' ';
1294
+ }
1295
+ this.formatted += comps[k].toString().trim();
1296
+ }
1297
+ }
1298
+ }
1299
+ return this.formatted
1300
+ }
1301
+
1302
+ format () {
1303
+ return this.range
1304
+ }
1305
+
1306
+ toString () {
1307
+ return this.range
1308
+ }
1309
+
1310
+ parseRange (range) {
1311
+ // memoize range parsing for performance.
1312
+ // this is a very hot path, and fully deterministic.
1313
+ const memoOpts =
1314
+ (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
1315
+ (this.options.loose && FLAG_LOOSE);
1316
+ const memoKey = memoOpts + ':' + range;
1317
+ const cached = cache.get(memoKey);
1318
+ if (cached) {
1319
+ return cached
1320
+ }
1321
+
1322
+ const loose = this.options.loose;
1323
+ // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
1324
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1325
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1326
+ debug('hyphen replace', range);
1327
+
1328
+ // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
1329
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1330
+ debug('comparator trim', range);
1331
+
1332
+ // `~ 1.2.3` => `~1.2.3`
1333
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1334
+ debug('tilde trim', range);
1335
+
1336
+ // `^ 1.2.3` => `^1.2.3`
1337
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1338
+ debug('caret trim', range);
1339
+
1340
+ // At this point, the range is completely trimmed and
1341
+ // ready to be split into comparators.
1342
+
1343
+ let rangeList = range
1344
+ .split(' ')
1345
+ .map(comp => parseComparator(comp, this.options))
1346
+ .join(' ')
1347
+ .split(/\s+/)
1348
+ // >=0.0.0 is equivalent to *
1349
+ .map(comp => replaceGTE0(comp, this.options));
1350
+
1351
+ if (loose) {
1352
+ // in loose mode, throw out any that are not valid comparators
1353
+ rangeList = rangeList.filter(comp => {
1354
+ debug('loose invalid filter', comp, this.options);
1355
+ return !!comp.match(re[t.COMPARATORLOOSE])
1356
+ });
1357
+ }
1358
+ debug('range list', rangeList);
1359
+
1360
+ // if any comparators are the null set, then replace with JUST null set
1361
+ // if more than one comparator, remove any * comparators
1362
+ // also, don't include the same comparator more than once
1363
+ const rangeMap = new Map();
1364
+ const comparators = rangeList.map(comp => new Comparator(comp, this.options));
1365
+ for (const comp of comparators) {
1366
+ if (isNullSet(comp)) {
1367
+ return [comp]
1368
+ }
1369
+ rangeMap.set(comp.value, comp);
1370
+ }
1371
+ if (rangeMap.size > 1 && rangeMap.has('')) {
1372
+ rangeMap.delete('');
1373
+ }
1374
+
1375
+ const result = [...rangeMap.values()];
1376
+ cache.set(memoKey, result);
1377
+ return result
1378
+ }
1379
+
1380
+ intersects (range, options) {
1381
+ if (!(range instanceof Range)) {
1382
+ throw new TypeError('a Range is required')
1383
+ }
1384
+
1385
+ return this.set.some((thisComparators) => {
1386
+ return (
1387
+ isSatisfiable(thisComparators, options) &&
1388
+ range.set.some((rangeComparators) => {
1389
+ return (
1390
+ isSatisfiable(rangeComparators, options) &&
1391
+ thisComparators.every((thisComparator) => {
1392
+ return rangeComparators.every((rangeComparator) => {
1393
+ return thisComparator.intersects(rangeComparator, options)
1394
+ })
1395
+ })
1396
+ )
1397
+ })
1398
+ )
1399
+ })
1400
+ }
1401
+
1402
+ // if ANY of the sets match ALL of its comparators, then pass
1403
+ test (version) {
1404
+ if (!version) {
1405
+ return false
1406
+ }
1407
+
1408
+ if (typeof version === 'string') {
1409
+ try {
1410
+ version = new SemVer(version, this.options);
1411
+ } catch (er) {
1412
+ return false
1413
+ }
1414
+ }
1415
+
1416
+ for (let i = 0; i < this.set.length; i++) {
1417
+ if (testSet(this.set[i], version, this.options)) {
1418
+ return true
1419
+ }
1420
+ }
1421
+ return false
1422
+ }
1423
+ }
1424
+
1425
+ range = Range;
1426
+
1427
+ const LRU = requireLrucache();
1428
+ const cache = new LRU();
1429
+
1430
+ const parseOptions = requireParseOptions();
1431
+ const Comparator = requireComparator();
1432
+ const debug = requireDebug();
1433
+ const SemVer = requireSemver$1();
1434
+ const {
1435
+ safeRe: re,
1436
+ t,
1437
+ comparatorTrimReplace,
1438
+ tildeTrimReplace,
1439
+ caretTrimReplace,
1440
+ } = requireRe();
1441
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
1442
+
1443
+ const isNullSet = c => c.value === '<0.0.0-0';
1444
+ const isAny = c => c.value === '';
1445
+
1446
+ // take a set of comparators and determine whether there
1447
+ // exists a version which can satisfy it
1448
+ const isSatisfiable = (comparators, options) => {
1449
+ let result = true;
1450
+ const remainingComparators = comparators.slice();
1451
+ let testComparator = remainingComparators.pop();
1452
+
1453
+ while (result && remainingComparators.length) {
1454
+ result = remainingComparators.every((otherComparator) => {
1455
+ return testComparator.intersects(otherComparator, options)
1456
+ });
1457
+
1458
+ testComparator = remainingComparators.pop();
1459
+ }
1460
+
1461
+ return result
1462
+ };
1463
+
1464
+ // comprised of xranges, tildes, stars, and gtlt's at this point.
1465
+ // already replaced the hyphen ranges
1466
+ // turn into a set of JUST comparators.
1467
+ const parseComparator = (comp, options) => {
1468
+ debug('comp', comp, options);
1469
+ comp = replaceCarets(comp, options);
1470
+ debug('caret', comp);
1471
+ comp = replaceTildes(comp, options);
1472
+ debug('tildes', comp);
1473
+ comp = replaceXRanges(comp, options);
1474
+ debug('xrange', comp);
1475
+ comp = replaceStars(comp, options);
1476
+ debug('stars', comp);
1477
+ return comp
1478
+ };
1479
+
1480
+ const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
1481
+
1482
+ // ~, ~> --> * (any, kinda silly)
1483
+ // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
1484
+ // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
1485
+ // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
1486
+ // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
1487
+ // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
1488
+ // ~0.0.1 --> >=0.0.1 <0.1.0-0
1489
+ const replaceTildes = (comp, options) => {
1490
+ return comp
1491
+ .trim()
1492
+ .split(/\s+/)
1493
+ .map((c) => replaceTilde(c, options))
1494
+ .join(' ')
1495
+ };
1496
+
1497
+ const replaceTilde = (comp, options) => {
1498
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1499
+ return comp.replace(r, (_, M, m, p, pr) => {
1500
+ debug('tilde', comp, _, M, m, p, pr);
1501
+ let ret;
1502
+
1503
+ if (isX(M)) {
1504
+ ret = '';
1505
+ } else if (isX(m)) {
1506
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1507
+ } else if (isX(p)) {
1508
+ // ~1.2 == >=1.2.0 <1.3.0-0
1509
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1510
+ } else if (pr) {
1511
+ debug('replaceTilde pr', pr);
1512
+ ret = `>=${M}.${m}.${p}-${pr
1513
+ } <${M}.${+m + 1}.0-0`;
1514
+ } else {
1515
+ // ~1.2.3 == >=1.2.3 <1.3.0-0
1516
+ ret = `>=${M}.${m}.${p
1517
+ } <${M}.${+m + 1}.0-0`;
1518
+ }
1519
+
1520
+ debug('tilde return', ret);
1521
+ return ret
1522
+ })
1523
+ };
1524
+
1525
+ // ^ --> * (any, kinda silly)
1526
+ // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
1527
+ // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
1528
+ // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
1529
+ // ^1.2.3 --> >=1.2.3 <2.0.0-0
1530
+ // ^1.2.0 --> >=1.2.0 <2.0.0-0
1531
+ // ^0.0.1 --> >=0.0.1 <0.0.2-0
1532
+ // ^0.1.0 --> >=0.1.0 <0.2.0-0
1533
+ const replaceCarets = (comp, options) => {
1534
+ return comp
1535
+ .trim()
1536
+ .split(/\s+/)
1537
+ .map((c) => replaceCaret(c, options))
1538
+ .join(' ')
1539
+ };
1540
+
1541
+ const replaceCaret = (comp, options) => {
1542
+ debug('caret', comp, options);
1543
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1544
+ const z = options.includePrerelease ? '-0' : '';
1545
+ return comp.replace(r, (_, M, m, p, pr) => {
1546
+ debug('caret', comp, _, M, m, p, pr);
1547
+ let ret;
1548
+
1549
+ if (isX(M)) {
1550
+ ret = '';
1551
+ } else if (isX(m)) {
1552
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1553
+ } else if (isX(p)) {
1554
+ if (M === '0') {
1555
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1556
+ } else {
1557
+ ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1558
+ }
1559
+ } else if (pr) {
1560
+ debug('replaceCaret pr', pr);
1561
+ if (M === '0') {
1562
+ if (m === '0') {
1563
+ ret = `>=${M}.${m}.${p}-${pr
1564
+ } <${M}.${m}.${+p + 1}-0`;
1565
+ } else {
1566
+ ret = `>=${M}.${m}.${p}-${pr
1567
+ } <${M}.${+m + 1}.0-0`;
1568
+ }
1569
+ } else {
1570
+ ret = `>=${M}.${m}.${p}-${pr
1571
+ } <${+M + 1}.0.0-0`;
1572
+ }
1573
+ } else {
1574
+ debug('no pr');
1575
+ if (M === '0') {
1576
+ if (m === '0') {
1577
+ ret = `>=${M}.${m}.${p
1578
+ }${z} <${M}.${m}.${+p + 1}-0`;
1579
+ } else {
1580
+ ret = `>=${M}.${m}.${p
1581
+ }${z} <${M}.${+m + 1}.0-0`;
1582
+ }
1583
+ } else {
1584
+ ret = `>=${M}.${m}.${p
1585
+ } <${+M + 1}.0.0-0`;
1586
+ }
1587
+ }
1588
+
1589
+ debug('caret return', ret);
1590
+ return ret
1591
+ })
1592
+ };
1593
+
1594
+ const replaceXRanges = (comp, options) => {
1595
+ debug('replaceXRanges', comp, options);
1596
+ return comp
1597
+ .split(/\s+/)
1598
+ .map((c) => replaceXRange(c, options))
1599
+ .join(' ')
1600
+ };
1601
+
1602
+ const replaceXRange = (comp, options) => {
1603
+ comp = comp.trim();
1604
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1605
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1606
+ debug('xRange', comp, ret, gtlt, M, m, p, pr);
1607
+ const xM = isX(M);
1608
+ const xm = xM || isX(m);
1609
+ const xp = xm || isX(p);
1610
+ const anyX = xp;
1611
+
1612
+ if (gtlt === '=' && anyX) {
1613
+ gtlt = '';
1614
+ }
1615
+
1616
+ // if we're including prereleases in the match, then we need
1617
+ // to fix this to -0, the lowest possible prerelease value
1618
+ pr = options.includePrerelease ? '-0' : '';
1619
+
1620
+ if (xM) {
1621
+ if (gtlt === '>' || gtlt === '<') {
1622
+ // nothing is allowed
1623
+ ret = '<0.0.0-0';
1624
+ } else {
1625
+ // nothing is forbidden
1626
+ ret = '*';
1627
+ }
1628
+ } else if (gtlt && anyX) {
1629
+ // we know patch is an x, because we have any x at all.
1630
+ // replace X with 0
1631
+ if (xm) {
1632
+ m = 0;
1633
+ }
1634
+ p = 0;
1635
+
1636
+ if (gtlt === '>') {
1637
+ // >1 => >=2.0.0
1638
+ // >1.2 => >=1.3.0
1639
+ gtlt = '>=';
1640
+ if (xm) {
1641
+ M = +M + 1;
1642
+ m = 0;
1643
+ p = 0;
1644
+ } else {
1645
+ m = +m + 1;
1646
+ p = 0;
1647
+ }
1648
+ } else if (gtlt === '<=') {
1649
+ // <=0.7.x is actually <0.8.0, since any 0.7.x should
1650
+ // pass. Similarly, <=7.x is actually <8.0.0, etc.
1651
+ gtlt = '<';
1652
+ if (xm) {
1653
+ M = +M + 1;
1654
+ } else {
1655
+ m = +m + 1;
1656
+ }
1657
+ }
1658
+
1659
+ if (gtlt === '<') {
1660
+ pr = '-0';
1661
+ }
1662
+
1663
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
1664
+ } else if (xm) {
1665
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1666
+ } else if (xp) {
1667
+ ret = `>=${M}.${m}.0${pr
1668
+ } <${M}.${+m + 1}.0-0`;
1669
+ }
1670
+
1671
+ debug('xRange return', ret);
1672
+
1673
+ return ret
1674
+ })
1675
+ };
1676
+
1677
+ // Because * is AND-ed with everything else in the comparator,
1678
+ // and '' means "any version", just remove the *s entirely.
1679
+ const replaceStars = (comp, options) => {
1680
+ debug('replaceStars', comp, options);
1681
+ // Looseness is ignored here. star is always as loose as it gets!
1682
+ return comp
1683
+ .trim()
1684
+ .replace(re[t.STAR], '')
1685
+ };
1686
+
1687
+ const replaceGTE0 = (comp, options) => {
1688
+ debug('replaceGTE0', comp, options);
1689
+ return comp
1690
+ .trim()
1691
+ .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
1692
+ };
1693
+
1694
+ // This function is passed to string.replace(re[t.HYPHENRANGE])
1695
+ // M, m, patch, prerelease, build
1696
+ // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
1697
+ // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
1698
+ // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
1699
+ // TODO build?
1700
+ const hyphenReplace = incPr => ($0,
1701
+ from, fM, fm, fp, fpr, fb,
1702
+ to, tM, tm, tp, tpr) => {
1703
+ if (isX(fM)) {
1704
+ from = '';
1705
+ } else if (isX(fm)) {
1706
+ from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
1707
+ } else if (isX(fp)) {
1708
+ from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
1709
+ } else if (fpr) {
1710
+ from = `>=${from}`;
1711
+ } else {
1712
+ from = `>=${from}${incPr ? '-0' : ''}`;
1713
+ }
1714
+
1715
+ if (isX(tM)) {
1716
+ to = '';
1717
+ } else if (isX(tm)) {
1718
+ to = `<${+tM + 1}.0.0-0`;
1719
+ } else if (isX(tp)) {
1720
+ to = `<${tM}.${+tm + 1}.0-0`;
1721
+ } else if (tpr) {
1722
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
1723
+ } else if (incPr) {
1724
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
1725
+ } else {
1726
+ to = `<=${to}`;
1727
+ }
1728
+
1729
+ return `${from} ${to}`.trim()
1730
+ };
1731
+
1732
+ const testSet = (set, version, options) => {
1733
+ for (let i = 0; i < set.length; i++) {
1734
+ if (!set[i].test(version)) {
1735
+ return false
1736
+ }
1737
+ }
1738
+
1739
+ if (version.prerelease.length && !options.includePrerelease) {
1740
+ // Find the set of versions that are allowed to have prereleases
1741
+ // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
1742
+ // That should allow `1.2.3-pr.2` to pass.
1743
+ // However, `1.2.4-alpha.notready` should NOT be allowed,
1744
+ // even though it's within the range set by the comparators.
1745
+ for (let i = 0; i < set.length; i++) {
1746
+ debug(set[i].semver);
1747
+ if (set[i].semver === Comparator.ANY) {
1748
+ continue
1749
+ }
1750
+
1751
+ if (set[i].semver.prerelease.length > 0) {
1752
+ const allowed = set[i].semver;
1753
+ if (allowed.major === version.major &&
1754
+ allowed.minor === version.minor &&
1755
+ allowed.patch === version.patch) {
1756
+ return true
1757
+ }
1758
+ }
1759
+ }
1760
+
1761
+ // Version has a -pre, but it's not one of the ones we like.
1762
+ return false
1763
+ }
1764
+
1765
+ return true
1766
+ };
1767
+ return range;
1768
+ }
1769
+
1770
+ var comparator;
1771
+ var hasRequiredComparator;
1772
+
1773
+ function requireComparator () {
1774
+ if (hasRequiredComparator) return comparator;
1775
+ hasRequiredComparator = 1;
1776
+ const ANY = Symbol('SemVer ANY');
1777
+ // hoisted class for cyclic dependency
1778
+ class Comparator {
1779
+ static get ANY () {
1780
+ return ANY
1781
+ }
1782
+
1783
+ constructor (comp, options) {
1784
+ options = parseOptions(options);
1785
+
1786
+ if (comp instanceof Comparator) {
1787
+ if (comp.loose === !!options.loose) {
1788
+ return comp
1789
+ } else {
1790
+ comp = comp.value;
1791
+ }
1792
+ }
1793
+
1794
+ comp = comp.trim().split(/\s+/).join(' ');
1795
+ debug('comparator', comp, options);
1796
+ this.options = options;
1797
+ this.loose = !!options.loose;
1798
+ this.parse(comp);
1799
+
1800
+ if (this.semver === ANY) {
1801
+ this.value = '';
1802
+ } else {
1803
+ this.value = this.operator + this.semver.version;
1804
+ }
1805
+
1806
+ debug('comp', this);
1807
+ }
1808
+
1809
+ parse (comp) {
1810
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1811
+ const m = comp.match(r);
1812
+
1813
+ if (!m) {
1814
+ throw new TypeError(`Invalid comparator: ${comp}`)
1815
+ }
1816
+
1817
+ this.operator = m[1] !== undefined ? m[1] : '';
1818
+ if (this.operator === '=') {
1819
+ this.operator = '';
1820
+ }
1821
+
1822
+ // if it literally is just '>' or '' then allow anything.
1823
+ if (!m[2]) {
1824
+ this.semver = ANY;
1825
+ } else {
1826
+ this.semver = new SemVer(m[2], this.options.loose);
1827
+ }
1828
+ }
1829
+
1830
+ toString () {
1831
+ return this.value
1832
+ }
1833
+
1834
+ test (version) {
1835
+ debug('Comparator.test', version, this.options.loose);
1836
+
1837
+ if (this.semver === ANY || version === ANY) {
1838
+ return true
1839
+ }
1840
+
1841
+ if (typeof version === 'string') {
1842
+ try {
1843
+ version = new SemVer(version, this.options);
1844
+ } catch (er) {
1845
+ return false
1846
+ }
1847
+ }
1848
+
1849
+ return cmp(version, this.operator, this.semver, this.options)
1850
+ }
1851
+
1852
+ intersects (comp, options) {
1853
+ if (!(comp instanceof Comparator)) {
1854
+ throw new TypeError('a Comparator is required')
1855
+ }
1856
+
1857
+ if (this.operator === '') {
1858
+ if (this.value === '') {
1859
+ return true
1860
+ }
1861
+ return new Range(comp.value, options).test(this.value)
1862
+ } else if (comp.operator === '') {
1863
+ if (comp.value === '') {
1864
+ return true
1865
+ }
1866
+ return new Range(this.value, options).test(comp.semver)
1867
+ }
1868
+
1869
+ options = parseOptions(options);
1870
+
1871
+ // Special cases where nothing can possibly be lower
1872
+ if (options.includePrerelease &&
1873
+ (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
1874
+ return false
1875
+ }
1876
+ if (!options.includePrerelease &&
1877
+ (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
1878
+ return false
1879
+ }
1880
+
1881
+ // Same direction increasing (> or >=)
1882
+ if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
1883
+ return true
1884
+ }
1885
+ // Same direction decreasing (< or <=)
1886
+ if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
1887
+ return true
1888
+ }
1889
+ // same SemVer and both sides are inclusive (<= or >=)
1890
+ if (
1891
+ (this.semver.version === comp.semver.version) &&
1892
+ this.operator.includes('=') && comp.operator.includes('=')) {
1893
+ return true
1894
+ }
1895
+ // opposite directions less than
1896
+ if (cmp(this.semver, '<', comp.semver, options) &&
1897
+ this.operator.startsWith('>') && comp.operator.startsWith('<')) {
1898
+ return true
1899
+ }
1900
+ // opposite directions greater than
1901
+ if (cmp(this.semver, '>', comp.semver, options) &&
1902
+ this.operator.startsWith('<') && comp.operator.startsWith('>')) {
1903
+ return true
1904
+ }
1905
+ return false
1906
+ }
1907
+ }
1908
+
1909
+ comparator = Comparator;
1910
+
1911
+ const parseOptions = requireParseOptions();
1912
+ const { safeRe: re, t } = requireRe();
1913
+ const cmp = requireCmp();
1914
+ const debug = requireDebug();
1915
+ const SemVer = requireSemver$1();
1916
+ const Range = requireRange();
1917
+ return comparator;
1918
+ }
1919
+
1920
+ var satisfies_1;
1921
+ var hasRequiredSatisfies;
1922
+
1923
+ function requireSatisfies () {
1924
+ if (hasRequiredSatisfies) return satisfies_1;
1925
+ hasRequiredSatisfies = 1;
1926
+ const Range = requireRange();
1927
+ const satisfies = (version, range, options) => {
1928
+ try {
1929
+ range = new Range(range, options);
1930
+ } catch (er) {
1931
+ return false
1932
+ }
1933
+ return range.test(version)
1934
+ };
1935
+ satisfies_1 = satisfies;
1936
+ return satisfies_1;
1937
+ }
1938
+
1939
+ var toComparators_1;
1940
+ var hasRequiredToComparators;
1941
+
1942
+ function requireToComparators () {
1943
+ if (hasRequiredToComparators) return toComparators_1;
1944
+ hasRequiredToComparators = 1;
1945
+ const Range = requireRange();
1946
+
1947
+ // Mostly just for testing and legacy API reasons
1948
+ const toComparators = (range, options) =>
1949
+ new Range(range, options).set
1950
+ .map(comp => comp.map(c => c.value).join(' ').trim().split(' '));
1951
+
1952
+ toComparators_1 = toComparators;
1953
+ return toComparators_1;
1954
+ }
1955
+
1956
+ var maxSatisfying_1;
1957
+ var hasRequiredMaxSatisfying;
1958
+
1959
+ function requireMaxSatisfying () {
1960
+ if (hasRequiredMaxSatisfying) return maxSatisfying_1;
1961
+ hasRequiredMaxSatisfying = 1;
1962
+ const SemVer = requireSemver$1();
1963
+ const Range = requireRange();
1964
+
1965
+ const maxSatisfying = (versions, range, options) => {
1966
+ let max = null;
1967
+ let maxSV = null;
1968
+ let rangeObj = null;
1969
+ try {
1970
+ rangeObj = new Range(range, options);
1971
+ } catch (er) {
1972
+ return null
1973
+ }
1974
+ versions.forEach((v) => {
1975
+ if (rangeObj.test(v)) {
1976
+ // satisfies(v, range, options)
1977
+ if (!max || maxSV.compare(v) === -1) {
1978
+ // compare(max, v, true)
1979
+ max = v;
1980
+ maxSV = new SemVer(max, options);
1981
+ }
1982
+ }
1983
+ });
1984
+ return max
1985
+ };
1986
+ maxSatisfying_1 = maxSatisfying;
1987
+ return maxSatisfying_1;
1988
+ }
1989
+
1990
+ var minSatisfying_1;
1991
+ var hasRequiredMinSatisfying;
1992
+
1993
+ function requireMinSatisfying () {
1994
+ if (hasRequiredMinSatisfying) return minSatisfying_1;
1995
+ hasRequiredMinSatisfying = 1;
1996
+ const SemVer = requireSemver$1();
1997
+ const Range = requireRange();
1998
+ const minSatisfying = (versions, range, options) => {
1999
+ let min = null;
2000
+ let minSV = null;
2001
+ let rangeObj = null;
2002
+ try {
2003
+ rangeObj = new Range(range, options);
2004
+ } catch (er) {
2005
+ return null
2006
+ }
2007
+ versions.forEach((v) => {
2008
+ if (rangeObj.test(v)) {
2009
+ // satisfies(v, range, options)
2010
+ if (!min || minSV.compare(v) === 1) {
2011
+ // compare(min, v, true)
2012
+ min = v;
2013
+ minSV = new SemVer(min, options);
2014
+ }
2015
+ }
2016
+ });
2017
+ return min
2018
+ };
2019
+ minSatisfying_1 = minSatisfying;
2020
+ return minSatisfying_1;
2021
+ }
2022
+
2023
+ var minVersion_1;
2024
+ var hasRequiredMinVersion;
2025
+
2026
+ function requireMinVersion () {
2027
+ if (hasRequiredMinVersion) return minVersion_1;
2028
+ hasRequiredMinVersion = 1;
2029
+ const SemVer = requireSemver$1();
2030
+ const Range = requireRange();
2031
+ const gt = requireGt();
2032
+
2033
+ const minVersion = (range, loose) => {
2034
+ range = new Range(range, loose);
2035
+
2036
+ let minver = new SemVer('0.0.0');
2037
+ if (range.test(minver)) {
2038
+ return minver
2039
+ }
2040
+
2041
+ minver = new SemVer('0.0.0-0');
2042
+ if (range.test(minver)) {
2043
+ return minver
2044
+ }
2045
+
2046
+ minver = null;
2047
+ for (let i = 0; i < range.set.length; ++i) {
2048
+ const comparators = range.set[i];
2049
+
2050
+ let setMin = null;
2051
+ comparators.forEach((comparator) => {
2052
+ // Clone to avoid manipulating the comparator's semver object.
2053
+ const compver = new SemVer(comparator.semver.version);
2054
+ switch (comparator.operator) {
2055
+ case '>':
2056
+ if (compver.prerelease.length === 0) {
2057
+ compver.patch++;
2058
+ } else {
2059
+ compver.prerelease.push(0);
2060
+ }
2061
+ compver.raw = compver.format();
2062
+ /* fallthrough */
2063
+ case '':
2064
+ case '>=':
2065
+ if (!setMin || gt(compver, setMin)) {
2066
+ setMin = compver;
2067
+ }
2068
+ break
2069
+ case '<':
2070
+ case '<=':
2071
+ /* Ignore maximum versions */
2072
+ break
2073
+ /* istanbul ignore next */
2074
+ default:
2075
+ throw new Error(`Unexpected operation: ${comparator.operator}`)
2076
+ }
2077
+ });
2078
+ if (setMin && (!minver || gt(minver, setMin))) {
2079
+ minver = setMin;
2080
+ }
2081
+ }
2082
+
2083
+ if (minver && range.test(minver)) {
2084
+ return minver
2085
+ }
2086
+
2087
+ return null
2088
+ };
2089
+ minVersion_1 = minVersion;
2090
+ return minVersion_1;
2091
+ }
2092
+
2093
+ var valid;
2094
+ var hasRequiredValid;
2095
+
2096
+ function requireValid () {
2097
+ if (hasRequiredValid) return valid;
2098
+ hasRequiredValid = 1;
2099
+ const Range = requireRange();
2100
+ const validRange = (range, options) => {
2101
+ try {
2102
+ // Return '*' instead of '' so that truthiness works.
2103
+ // This will throw if it's invalid anyway
2104
+ return new Range(range, options).range || '*'
2105
+ } catch (er) {
2106
+ return null
2107
+ }
2108
+ };
2109
+ valid = validRange;
2110
+ return valid;
2111
+ }
2112
+
2113
+ var outside_1;
2114
+ var hasRequiredOutside;
2115
+
2116
+ function requireOutside () {
2117
+ if (hasRequiredOutside) return outside_1;
2118
+ hasRequiredOutside = 1;
2119
+ const SemVer = requireSemver$1();
2120
+ const Comparator = requireComparator();
2121
+ const { ANY } = Comparator;
2122
+ const Range = requireRange();
2123
+ const satisfies = requireSatisfies();
2124
+ const gt = requireGt();
2125
+ const lt = requireLt();
2126
+ const lte = requireLte();
2127
+ const gte = requireGte();
2128
+
2129
+ const outside = (version, range, hilo, options) => {
2130
+ version = new SemVer(version, options);
2131
+ range = new Range(range, options);
2132
+
2133
+ let gtfn, ltefn, ltfn, comp, ecomp;
2134
+ switch (hilo) {
2135
+ case '>':
2136
+ gtfn = gt;
2137
+ ltefn = lte;
2138
+ ltfn = lt;
2139
+ comp = '>';
2140
+ ecomp = '>=';
2141
+ break
2142
+ case '<':
2143
+ gtfn = lt;
2144
+ ltefn = gte;
2145
+ ltfn = gt;
2146
+ comp = '<';
2147
+ ecomp = '<=';
2148
+ break
2149
+ default:
2150
+ throw new TypeError('Must provide a hilo val of "<" or ">"')
2151
+ }
2152
+
2153
+ // If it satisfies the range it is not outside
2154
+ if (satisfies(version, range, options)) {
2155
+ return false
2156
+ }
2157
+
2158
+ // From now on, variable terms are as if we're in "gtr" mode.
2159
+ // but note that everything is flipped for the "ltr" function.
2160
+
2161
+ for (let i = 0; i < range.set.length; ++i) {
2162
+ const comparators = range.set[i];
2163
+
2164
+ let high = null;
2165
+ let low = null;
2166
+
2167
+ comparators.forEach((comparator) => {
2168
+ if (comparator.semver === ANY) {
2169
+ comparator = new Comparator('>=0.0.0');
2170
+ }
2171
+ high = high || comparator;
2172
+ low = low || comparator;
2173
+ if (gtfn(comparator.semver, high.semver, options)) {
2174
+ high = comparator;
2175
+ } else if (ltfn(comparator.semver, low.semver, options)) {
2176
+ low = comparator;
2177
+ }
2178
+ });
2179
+
2180
+ // If the edge version comparator has a operator then our version
2181
+ // isn't outside it
2182
+ if (high.operator === comp || high.operator === ecomp) {
2183
+ return false
2184
+ }
2185
+
2186
+ // If the lowest version comparator has an operator and our version
2187
+ // is less than it then it isn't higher than the range
2188
+ if ((!low.operator || low.operator === comp) &&
2189
+ ltefn(version, low.semver)) {
2190
+ return false
2191
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
2192
+ return false
2193
+ }
2194
+ }
2195
+ return true
2196
+ };
2197
+
2198
+ outside_1 = outside;
2199
+ return outside_1;
2200
+ }
2201
+
2202
+ var gtr_1;
2203
+ var hasRequiredGtr;
2204
+
2205
+ function requireGtr () {
2206
+ if (hasRequiredGtr) return gtr_1;
2207
+ hasRequiredGtr = 1;
2208
+ // Determine if version is greater than all the versions possible in the range.
2209
+ const outside = requireOutside();
2210
+ const gtr = (version, range, options) => outside(version, range, '>', options);
2211
+ gtr_1 = gtr;
2212
+ return gtr_1;
2213
+ }
2214
+
2215
+ var ltr_1;
2216
+ var hasRequiredLtr;
2217
+
2218
+ function requireLtr () {
2219
+ if (hasRequiredLtr) return ltr_1;
2220
+ hasRequiredLtr = 1;
2221
+ const outside = requireOutside();
2222
+ // Determine if version is less than all the versions possible in the range
2223
+ const ltr = (version, range, options) => outside(version, range, '<', options);
2224
+ ltr_1 = ltr;
2225
+ return ltr_1;
2226
+ }
2227
+
2228
+ var intersects_1;
2229
+ var hasRequiredIntersects;
2230
+
2231
+ function requireIntersects () {
2232
+ if (hasRequiredIntersects) return intersects_1;
2233
+ hasRequiredIntersects = 1;
2234
+ const Range = requireRange();
2235
+ const intersects = (r1, r2, options) => {
2236
+ r1 = new Range(r1, options);
2237
+ r2 = new Range(r2, options);
2238
+ return r1.intersects(r2, options)
2239
+ };
2240
+ intersects_1 = intersects;
2241
+ return intersects_1;
2242
+ }
2243
+
2244
+ var simplify;
2245
+ var hasRequiredSimplify;
2246
+
2247
+ function requireSimplify () {
2248
+ if (hasRequiredSimplify) return simplify;
2249
+ hasRequiredSimplify = 1;
2250
+ // given a set of versions and a range, create a "simplified" range
2251
+ // that includes the same versions that the original range does
2252
+ // If the original range is shorter than the simplified one, return that.
2253
+ const satisfies = requireSatisfies();
2254
+ const compare = requireCompare();
2255
+ simplify = (versions, range, options) => {
2256
+ const set = [];
2257
+ let first = null;
2258
+ let prev = null;
2259
+ const v = versions.sort((a, b) => compare(a, b, options));
2260
+ for (const version of v) {
2261
+ const included = satisfies(version, range, options);
2262
+ if (included) {
2263
+ prev = version;
2264
+ if (!first) {
2265
+ first = version;
2266
+ }
2267
+ } else {
2268
+ if (prev) {
2269
+ set.push([first, prev]);
2270
+ }
2271
+ prev = null;
2272
+ first = null;
2273
+ }
2274
+ }
2275
+ if (first) {
2276
+ set.push([first, null]);
2277
+ }
2278
+
2279
+ const ranges = [];
2280
+ for (const [min, max] of set) {
2281
+ if (min === max) {
2282
+ ranges.push(min);
2283
+ } else if (!max && min === v[0]) {
2284
+ ranges.push('*');
2285
+ } else if (!max) {
2286
+ ranges.push(`>=${min}`);
2287
+ } else if (min === v[0]) {
2288
+ ranges.push(`<=${max}`);
2289
+ } else {
2290
+ ranges.push(`${min} - ${max}`);
2291
+ }
2292
+ }
2293
+ const simplified = ranges.join(' || ');
2294
+ const original = typeof range.raw === 'string' ? range.raw : String(range);
2295
+ return simplified.length < original.length ? simplified : range
2296
+ };
2297
+ return simplify;
2298
+ }
2299
+
2300
+ var subset_1;
2301
+ var hasRequiredSubset;
2302
+
2303
+ function requireSubset () {
2304
+ if (hasRequiredSubset) return subset_1;
2305
+ hasRequiredSubset = 1;
2306
+ const Range = requireRange();
2307
+ const Comparator = requireComparator();
2308
+ const { ANY } = Comparator;
2309
+ const satisfies = requireSatisfies();
2310
+ const compare = requireCompare();
2311
+
2312
+ // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
2313
+ // - Every simple range `r1, r2, ...` is a null set, OR
2314
+ // - Every simple range `r1, r2, ...` which is not a null set is a subset of
2315
+ // some `R1, R2, ...`
2316
+ //
2317
+ // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
2318
+ // - If c is only the ANY comparator
2319
+ // - If C is only the ANY comparator, return true
2320
+ // - Else if in prerelease mode, return false
2321
+ // - else replace c with `[>=0.0.0]`
2322
+ // - If C is only the ANY comparator
2323
+ // - if in prerelease mode, return true
2324
+ // - else replace C with `[>=0.0.0]`
2325
+ // - Let EQ be the set of = comparators in c
2326
+ // - If EQ is more than one, return true (null set)
2327
+ // - Let GT be the highest > or >= comparator in c
2328
+ // - Let LT be the lowest < or <= comparator in c
2329
+ // - If GT and LT, and GT.semver > LT.semver, return true (null set)
2330
+ // - If any C is a = range, and GT or LT are set, return false
2331
+ // - If EQ
2332
+ // - If GT, and EQ does not satisfy GT, return true (null set)
2333
+ // - If LT, and EQ does not satisfy LT, return true (null set)
2334
+ // - If EQ satisfies every C, return true
2335
+ // - Else return false
2336
+ // - If GT
2337
+ // - If GT.semver is lower than any > or >= comp in C, return false
2338
+ // - If GT is >=, and GT.semver does not satisfy every C, return false
2339
+ // - If GT.semver has a prerelease, and not in prerelease mode
2340
+ // - If no C has a prerelease and the GT.semver tuple, return false
2341
+ // - If LT
2342
+ // - If LT.semver is greater than any < or <= comp in C, return false
2343
+ // - If LT is <=, and LT.semver does not satisfy every C, return false
2344
+ // - If GT.semver has a prerelease, and not in prerelease mode
2345
+ // - If no C has a prerelease and the LT.semver tuple, return false
2346
+ // - Else return true
2347
+
2348
+ const subset = (sub, dom, options = {}) => {
2349
+ if (sub === dom) {
2350
+ return true
2351
+ }
2352
+
2353
+ sub = new Range(sub, options);
2354
+ dom = new Range(dom, options);
2355
+ let sawNonNull = false;
2356
+
2357
+ OUTER: for (const simpleSub of sub.set) {
2358
+ for (const simpleDom of dom.set) {
2359
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
2360
+ sawNonNull = sawNonNull || isSub !== null;
2361
+ if (isSub) {
2362
+ continue OUTER
2363
+ }
2364
+ }
2365
+ // the null set is a subset of everything, but null simple ranges in
2366
+ // a complex range should be ignored. so if we saw a non-null range,
2367
+ // then we know this isn't a subset, but if EVERY simple range was null,
2368
+ // then it is a subset.
2369
+ if (sawNonNull) {
2370
+ return false
2371
+ }
2372
+ }
2373
+ return true
2374
+ };
2375
+
2376
+ const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')];
2377
+ const minimumVersion = [new Comparator('>=0.0.0')];
2378
+
2379
+ const simpleSubset = (sub, dom, options) => {
2380
+ if (sub === dom) {
2381
+ return true
2382
+ }
2383
+
2384
+ if (sub.length === 1 && sub[0].semver === ANY) {
2385
+ if (dom.length === 1 && dom[0].semver === ANY) {
2386
+ return true
2387
+ } else if (options.includePrerelease) {
2388
+ sub = minimumVersionWithPreRelease;
2389
+ } else {
2390
+ sub = minimumVersion;
2391
+ }
2392
+ }
2393
+
2394
+ if (dom.length === 1 && dom[0].semver === ANY) {
2395
+ if (options.includePrerelease) {
2396
+ return true
2397
+ } else {
2398
+ dom = minimumVersion;
2399
+ }
2400
+ }
2401
+
2402
+ const eqSet = new Set();
2403
+ let gt, lt;
2404
+ for (const c of sub) {
2405
+ if (c.operator === '>' || c.operator === '>=') {
2406
+ gt = higherGT(gt, c, options);
2407
+ } else if (c.operator === '<' || c.operator === '<=') {
2408
+ lt = lowerLT(lt, c, options);
2409
+ } else {
2410
+ eqSet.add(c.semver);
2411
+ }
2412
+ }
2413
+
2414
+ if (eqSet.size > 1) {
2415
+ return null
2416
+ }
2417
+
2418
+ let gtltComp;
2419
+ if (gt && lt) {
2420
+ gtltComp = compare(gt.semver, lt.semver, options);
2421
+ if (gtltComp > 0) {
2422
+ return null
2423
+ } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
2424
+ return null
2425
+ }
2426
+ }
2427
+
2428
+ // will iterate one or zero times
2429
+ for (const eq of eqSet) {
2430
+ if (gt && !satisfies(eq, String(gt), options)) {
2431
+ return null
2432
+ }
2433
+
2434
+ if (lt && !satisfies(eq, String(lt), options)) {
2435
+ return null
2436
+ }
2437
+
2438
+ for (const c of dom) {
2439
+ if (!satisfies(eq, String(c), options)) {
2440
+ return false
2441
+ }
2442
+ }
2443
+
2444
+ return true
2445
+ }
2446
+
2447
+ let higher, lower;
2448
+ let hasDomLT, hasDomGT;
2449
+ // if the subset has a prerelease, we need a comparator in the superset
2450
+ // with the same tuple and a prerelease, or it's not a subset
2451
+ let needDomLTPre = lt &&
2452
+ !options.includePrerelease &&
2453
+ lt.semver.prerelease.length ? lt.semver : false;
2454
+ let needDomGTPre = gt &&
2455
+ !options.includePrerelease &&
2456
+ gt.semver.prerelease.length ? gt.semver : false;
2457
+ // exception: <1.2.3-0 is the same as <1.2.3
2458
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
2459
+ lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
2460
+ needDomLTPre = false;
2461
+ }
2462
+
2463
+ for (const c of dom) {
2464
+ hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';
2465
+ hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';
2466
+ if (gt) {
2467
+ if (needDomGTPre) {
2468
+ if (c.semver.prerelease && c.semver.prerelease.length &&
2469
+ c.semver.major === needDomGTPre.major &&
2470
+ c.semver.minor === needDomGTPre.minor &&
2471
+ c.semver.patch === needDomGTPre.patch) {
2472
+ needDomGTPre = false;
2473
+ }
2474
+ }
2475
+ if (c.operator === '>' || c.operator === '>=') {
2476
+ higher = higherGT(gt, c, options);
2477
+ if (higher === c && higher !== gt) {
2478
+ return false
2479
+ }
2480
+ } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
2481
+ return false
2482
+ }
2483
+ }
2484
+ if (lt) {
2485
+ if (needDomLTPre) {
2486
+ if (c.semver.prerelease && c.semver.prerelease.length &&
2487
+ c.semver.major === needDomLTPre.major &&
2488
+ c.semver.minor === needDomLTPre.minor &&
2489
+ c.semver.patch === needDomLTPre.patch) {
2490
+ needDomLTPre = false;
2491
+ }
2492
+ }
2493
+ if (c.operator === '<' || c.operator === '<=') {
2494
+ lower = lowerLT(lt, c, options);
2495
+ if (lower === c && lower !== lt) {
2496
+ return false
2497
+ }
2498
+ } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
2499
+ return false
2500
+ }
2501
+ }
2502
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
2503
+ return false
2504
+ }
2505
+ }
2506
+
2507
+ // if there was a < or >, and nothing in the dom, then must be false
2508
+ // UNLESS it was limited by another range in the other direction.
2509
+ // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
2510
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
2511
+ return false
2512
+ }
2513
+
2514
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
2515
+ return false
2516
+ }
2517
+
2518
+ // we needed a prerelease range in a specific tuple, but didn't get one
2519
+ // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
2520
+ // because it includes prereleases in the 1.2.3 tuple
2521
+ if (needDomGTPre || needDomLTPre) {
2522
+ return false
2523
+ }
2524
+
2525
+ return true
2526
+ };
2527
+
2528
+ // >=1.2.3 is lower than >1.2.3
2529
+ const higherGT = (a, b, options) => {
2530
+ if (!a) {
2531
+ return b
2532
+ }
2533
+ const comp = compare(a.semver, b.semver, options);
2534
+ return comp > 0 ? a
2535
+ : comp < 0 ? b
2536
+ : b.operator === '>' && a.operator === '>=' ? b
2537
+ : a
2538
+ };
2539
+
2540
+ // <=1.2.3 is higher than <1.2.3
2541
+ const lowerLT = (a, b, options) => {
2542
+ if (!a) {
2543
+ return b
2544
+ }
2545
+ const comp = compare(a.semver, b.semver, options);
2546
+ return comp < 0 ? a
2547
+ : comp > 0 ? b
2548
+ : b.operator === '<' && a.operator === '<=' ? b
2549
+ : a
2550
+ };
2551
+
2552
+ subset_1 = subset;
2553
+ return subset_1;
2554
+ }
2555
+
2556
+ var semver;
2557
+ var hasRequiredSemver;
2558
+
2559
+ function requireSemver () {
2560
+ if (hasRequiredSemver) return semver;
2561
+ hasRequiredSemver = 1;
2562
+ // just pre-load all the stuff that index.js lazily exports
2563
+ const internalRe = requireRe();
2564
+ const constants = requireConstants();
2565
+ const SemVer = requireSemver$1();
2566
+ const identifiers = requireIdentifiers();
2567
+ const parse = requireParse();
2568
+ const valid = requireValid$1();
2569
+ const clean = requireClean();
2570
+ const inc = requireInc();
2571
+ const diff = requireDiff();
2572
+ const major = requireMajor();
2573
+ const minor = requireMinor();
2574
+ const patch = requirePatch();
2575
+ const prerelease = requirePrerelease();
2576
+ const compare = requireCompare();
2577
+ const rcompare = requireRcompare();
2578
+ const compareLoose = requireCompareLoose();
2579
+ const compareBuild = requireCompareBuild();
2580
+ const sort = requireSort();
2581
+ const rsort = requireRsort();
2582
+ const gt = requireGt();
2583
+ const lt = requireLt();
2584
+ const eq = requireEq();
2585
+ const neq = requireNeq();
2586
+ const gte = requireGte();
2587
+ const lte = requireLte();
2588
+ const cmp = requireCmp();
2589
+ const coerce = requireCoerce();
2590
+ const Comparator = requireComparator();
2591
+ const Range = requireRange();
2592
+ const satisfies = requireSatisfies();
2593
+ const toComparators = requireToComparators();
2594
+ const maxSatisfying = requireMaxSatisfying();
2595
+ const minSatisfying = requireMinSatisfying();
2596
+ const minVersion = requireMinVersion();
2597
+ const validRange = requireValid();
2598
+ const outside = requireOutside();
2599
+ const gtr = requireGtr();
2600
+ const ltr = requireLtr();
2601
+ const intersects = requireIntersects();
2602
+ const simplifyRange = requireSimplify();
2603
+ const subset = requireSubset();
2604
+ semver = {
2605
+ parse,
2606
+ valid,
2607
+ clean,
2608
+ inc,
2609
+ diff,
2610
+ major,
2611
+ minor,
2612
+ patch,
2613
+ prerelease,
2614
+ compare,
2615
+ rcompare,
2616
+ compareLoose,
2617
+ compareBuild,
2618
+ sort,
2619
+ rsort,
2620
+ gt,
2621
+ lt,
2622
+ eq,
2623
+ neq,
2624
+ gte,
2625
+ lte,
2626
+ cmp,
2627
+ coerce,
2628
+ Comparator,
2629
+ Range,
2630
+ satisfies,
2631
+ toComparators,
2632
+ maxSatisfying,
2633
+ minSatisfying,
2634
+ minVersion,
2635
+ validRange,
2636
+ outside,
2637
+ gtr,
2638
+ ltr,
2639
+ intersects,
2640
+ simplifyRange,
2641
+ subset,
2642
+ SemVer,
2643
+ re: internalRe.re,
2644
+ src: internalRe.src,
2645
+ tokens: internalRe.t,
2646
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
2647
+ RELEASE_TYPES: constants.RELEASE_TYPES,
2648
+ compareIdentifiers: identifiers.compareIdentifiers,
2649
+ rcompareIdentifiers: identifiers.rcompareIdentifiers,
2650
+ };
2651
+ return semver;
2652
+ }
2653
+
2654
+ export { requireSubset as a, requireSemver as r };