web-extend-plugin-vue2 0.2.0 → 0.2.1

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