@nebula.js/stardust 6.0.0-alpha.0 → 6.0.0-alpha.2

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/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v6.0.0-alpha.0
2
+ * @nebula.js/stardust v6.0.0-alpha.2
3
3
  * Copyright (c) 2025 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -7736,8 +7736,8 @@ var compat = function compat(element) {
7736
7736
  return;
7737
7737
  }
7738
7738
 
7739
- var value = element.value;
7740
- var parent = element.parent;
7739
+ var value = element.value,
7740
+ parent = element.parent;
7741
7741
  var isImplicitRule = element.column === parent.column && element.line === parent.line;
7742
7742
 
7743
7743
  while (parent.type !== 'rule') {
@@ -7997,7 +7997,11 @@ var prefixer = function prefixer(element, index, children, callback) {
7997
7997
 
7998
7998
  var defaultStylisPlugins = [prefixer];
7999
7999
 
8000
- var createCache = function createCache(options) {
8000
+ var createCache = function
8001
+ /*: EmotionCache */
8002
+ createCache(options
8003
+ /*: Options */
8004
+ ) {
8001
8005
  var key = options.key;
8002
8006
 
8003
8007
  if (key === 'css') {
@@ -8006,7 +8010,9 @@ var createCache = function createCache(options) {
8006
8010
  // note this very very intentionally targets all style elements regardless of the key to ensure
8007
8011
  // that creating a cache works inside of render of a React component
8008
8012
 
8009
- Array.prototype.forEach.call(ssrStyles, function (node) {
8013
+ Array.prototype.forEach.call(ssrStyles, function (node
8014
+ /*: HTMLStyleElement */
8015
+ ) {
8010
8016
  // we want to only move elements which have a space in the data-emotion attribute value
8011
8017
  // because that indicates that it is an Emotion 11 server-side rendered style elements
8012
8018
  // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
@@ -8028,13 +8034,17 @@ var createCache = function createCache(options) {
8028
8034
 
8029
8035
  var inserted = {};
8030
8036
  var container;
8037
+ /* : Node */
8038
+
8031
8039
  var nodesToHydrate = [];
8032
8040
 
8033
8041
  {
8034
8042
  container = options.container || document.head;
8035
8043
  Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
8036
8044
  // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
8037
- document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
8045
+ document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node
8046
+ /*: HTMLStyleElement */
8047
+ ) {
8038
8048
  var attrib = node.getAttribute("data-emotion").split(' ');
8039
8049
 
8040
8050
  for (var i = 1; i < attrib.length; i++) {
@@ -8046,6 +8056,13 @@ var createCache = function createCache(options) {
8046
8056
  }
8047
8057
 
8048
8058
  var _insert;
8059
+ /*: (
8060
+ selector: string,
8061
+ serialized: SerializedStyles,
8062
+ sheet: StyleSheet,
8063
+ shouldCache: boolean
8064
+ ) => string | void */
8065
+
8049
8066
 
8050
8067
  var omnipresentPlugins = [compat, removeLabel];
8051
8068
 
@@ -8060,7 +8077,17 @@ var createCache = function createCache(options) {
8060
8077
  return serialize(compile(styles), serializer);
8061
8078
  };
8062
8079
 
8063
- _insert = function insert(selector, serialized, sheet, shouldCache) {
8080
+ _insert = function
8081
+ /*: void */
8082
+ insert(selector
8083
+ /*: string */
8084
+ , serialized
8085
+ /*: SerializedStyles */
8086
+ , sheet
8087
+ /*: StyleSheet */
8088
+ , shouldCache
8089
+ /*: boolean */
8090
+ ) {
8064
8091
  currentSheet = sheet;
8065
8092
 
8066
8093
  stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
@@ -8071,7 +8098,9 @@ var createCache = function createCache(options) {
8071
8098
  };
8072
8099
  }
8073
8100
 
8074
- var cache = {
8101
+ var cache
8102
+ /*: EmotionCache */
8103
+ = {
8075
8104
  key: key,
8076
8105
  sheet: new StyleSheet({
8077
8106
  key: key,
@@ -12012,7 +12041,7 @@ function create$3(definition) {
12012
12041
  return cache$1[key];
12013
12042
  }
12014
12043
 
12015
- const NEBULA_VERSION_HASH = "c3a7";
12044
+ const NEBULA_VERSION_HASH = "3efc";
12016
12045
  ClassNameGenerator.configure(componentName => {
12017
12046
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
12018
12047
  });
@@ -12256,7 +12285,7 @@ function boot(_ref2) {
12256
12285
  const appRef = React__default.createRef();
12257
12286
  const element = document.createElement('div');
12258
12287
  element.style.display = 'none';
12259
- element.setAttribute('data-nebulajs-version', "6.0.0-alpha.0");
12288
+ element.setAttribute('data-nebulajs-version', "6.0.0-alpha.2");
12260
12289
  element.setAttribute('data-app-id', app.id);
12261
12290
  document.body.appendChild(element);
12262
12291
  if (context) {
@@ -30667,1625 +30696,1357 @@ async function getObject(_ref, halo, store) {
30667
30696
 
30668
30697
  var lrucache;
30669
30698
  var hasRequiredLrucache;
30670
-
30671
- function requireLrucache () {
30672
- if (hasRequiredLrucache) return lrucache;
30673
- hasRequiredLrucache = 1;
30674
-
30675
- class LRUCache {
30676
- constructor () {
30677
- this.max = 1000;
30678
- this.map = new Map();
30679
- }
30680
-
30681
- get (key) {
30682
- const value = this.map.get(key);
30683
- if (value === undefined) {
30684
- return undefined
30685
- } else {
30686
- // Remove the key from the map and add it to the end
30687
- this.map.delete(key);
30688
- this.map.set(key, value);
30689
- return value
30690
- }
30691
- }
30692
-
30693
- delete (key) {
30694
- return this.map.delete(key)
30695
- }
30696
-
30697
- set (key, value) {
30698
- const deleted = this.delete(key);
30699
-
30700
- if (!deleted && value !== undefined) {
30701
- // If cache is full, delete the least recently used item
30702
- if (this.map.size >= this.max) {
30703
- const firstKey = this.map.keys().next().value;
30704
- this.delete(firstKey);
30705
- }
30706
-
30707
- this.map.set(key, value);
30708
- }
30709
-
30710
- return this
30711
- }
30712
- }
30713
-
30714
- lrucache = LRUCache;
30715
- return lrucache;
30699
+ function requireLrucache() {
30700
+ if (hasRequiredLrucache) return lrucache;
30701
+ hasRequiredLrucache = 1;
30702
+ class LRUCache {
30703
+ constructor() {
30704
+ this.max = 1000;
30705
+ this.map = new Map();
30706
+ }
30707
+ get(key) {
30708
+ const value = this.map.get(key);
30709
+ if (value === undefined) {
30710
+ return undefined;
30711
+ } else {
30712
+ // Remove the key from the map and add it to the end
30713
+ this.map.delete(key);
30714
+ this.map.set(key, value);
30715
+ return value;
30716
+ }
30717
+ }
30718
+ delete(key) {
30719
+ return this.map.delete(key);
30720
+ }
30721
+ set(key, value) {
30722
+ const deleted = this.delete(key);
30723
+ if (!deleted && value !== undefined) {
30724
+ // If cache is full, delete the least recently used item
30725
+ if (this.map.size >= this.max) {
30726
+ const firstKey = this.map.keys().next().value;
30727
+ this.delete(firstKey);
30728
+ }
30729
+ this.map.set(key, value);
30730
+ }
30731
+ return this;
30732
+ }
30733
+ }
30734
+ lrucache = LRUCache;
30735
+ return lrucache;
30716
30736
  }
30717
30737
 
30718
30738
  var parseOptions_1;
30719
30739
  var hasRequiredParseOptions;
30740
+ function requireParseOptions() {
30741
+ if (hasRequiredParseOptions) return parseOptions_1;
30742
+ hasRequiredParseOptions = 1;
30720
30743
 
30721
- function requireParseOptions () {
30722
- if (hasRequiredParseOptions) return parseOptions_1;
30723
- hasRequiredParseOptions = 1;
30724
-
30725
- // parse out just the options we care about
30726
- const looseOption = Object.freeze({ loose: true });
30727
- const emptyOpts = Object.freeze({ });
30728
- const parseOptions = options => {
30729
- if (!options) {
30730
- return emptyOpts
30731
- }
30732
-
30733
- if (typeof options !== 'object') {
30734
- return looseOption
30735
- }
30736
-
30737
- return options
30738
- };
30739
- parseOptions_1 = parseOptions;
30740
- return parseOptions_1;
30744
+ // parse out just the options we care about
30745
+ const looseOption = Object.freeze({
30746
+ loose: true
30747
+ });
30748
+ const emptyOpts = Object.freeze({});
30749
+ const parseOptions = options => {
30750
+ if (!options) {
30751
+ return emptyOpts;
30752
+ }
30753
+ if (typeof options !== 'object') {
30754
+ return looseOption;
30755
+ }
30756
+ return options;
30757
+ };
30758
+ parseOptions_1 = parseOptions;
30759
+ return parseOptions_1;
30741
30760
  }
30742
30761
 
30743
30762
  var re = {exports: {}};
30744
30763
 
30745
30764
  var constants;
30746
30765
  var hasRequiredConstants;
30747
-
30748
- function requireConstants () {
30749
- if (hasRequiredConstants) return constants;
30750
- hasRequiredConstants = 1;
30751
-
30752
- // Note: this is the semver.org version of the spec that it implements
30753
- // Not necessarily the package version of this code.
30754
- const SEMVER_SPEC_VERSION = '2.0.0';
30755
-
30756
- const MAX_LENGTH = 256;
30757
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
30758
- /* istanbul ignore next */ 9007199254740991;
30759
-
30760
- // Max safe segment length for coercion.
30761
- const MAX_SAFE_COMPONENT_LENGTH = 16;
30762
-
30763
- // Max safe length for a build identifier. The max length minus 6 characters for
30764
- // the shortest version with a build 0.0.0+BUILD.
30765
- const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
30766
-
30767
- const RELEASE_TYPES = [
30768
- 'major',
30769
- 'premajor',
30770
- 'minor',
30771
- 'preminor',
30772
- 'patch',
30773
- 'prepatch',
30774
- 'prerelease',
30775
- ];
30776
-
30777
- constants = {
30778
- MAX_LENGTH,
30779
- MAX_SAFE_COMPONENT_LENGTH,
30780
- MAX_SAFE_BUILD_LENGTH,
30781
- MAX_SAFE_INTEGER,
30782
- RELEASE_TYPES,
30783
- SEMVER_SPEC_VERSION,
30784
- FLAG_INCLUDE_PRERELEASE: 0b001,
30785
- FLAG_LOOSE: 0b010,
30786
- };
30787
- return constants;
30766
+ function requireConstants() {
30767
+ if (hasRequiredConstants) return constants;
30768
+ hasRequiredConstants = 1;
30769
+
30770
+ // Note: this is the semver.org version of the spec that it implements
30771
+ // Not necessarily the package version of this code.
30772
+ const SEMVER_SPEC_VERSION = '2.0.0';
30773
+ const MAX_LENGTH = 256;
30774
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
30775
+
30776
+ // Max safe segment length for coercion.
30777
+ const MAX_SAFE_COMPONENT_LENGTH = 16;
30778
+
30779
+ // Max safe length for a build identifier. The max length minus 6 characters for
30780
+ // the shortest version with a build 0.0.0+BUILD.
30781
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
30782
+ const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
30783
+ constants = {
30784
+ MAX_LENGTH,
30785
+ MAX_SAFE_COMPONENT_LENGTH,
30786
+ MAX_SAFE_BUILD_LENGTH,
30787
+ MAX_SAFE_INTEGER,
30788
+ RELEASE_TYPES,
30789
+ SEMVER_SPEC_VERSION,
30790
+ FLAG_INCLUDE_PRERELEASE: 0b001,
30791
+ FLAG_LOOSE: 0b010
30792
+ };
30793
+ return constants;
30788
30794
  }
30789
30795
 
30790
30796
  var debug_1;
30791
30797
  var hasRequiredDebug;
30792
-
30793
- function requireDebug () {
30794
- if (hasRequiredDebug) return debug_1;
30795
- hasRequiredDebug = 1;
30796
-
30797
- const debug = (
30798
- typeof process === 'object' &&
30799
- process.env &&
30800
- process.env.NODE_DEBUG &&
30801
- /\bsemver\b/i.test(process.env.NODE_DEBUG)
30802
- ) ? (...args) => console.error('SEMVER', ...args)
30803
- : () => {};
30804
-
30805
- debug_1 = debug;
30806
- return debug_1;
30798
+ function requireDebug() {
30799
+ if (hasRequiredDebug) return debug_1;
30800
+ hasRequiredDebug = 1;
30801
+ const debug = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function () {
30802
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30803
+ args[_key] = arguments[_key];
30804
+ }
30805
+ return console.error('SEMVER', ...args);
30806
+ } : () => {};
30807
+ debug_1 = debug;
30808
+ return debug_1;
30807
30809
  }
30808
30810
 
30809
30811
  var hasRequiredRe;
30812
+ function requireRe() {
30813
+ if (hasRequiredRe) return re.exports;
30814
+ hasRequiredRe = 1;
30815
+ (function (module, exports) {
30810
30816
 
30811
- function requireRe () {
30812
- if (hasRequiredRe) return re.exports;
30813
- hasRequiredRe = 1;
30814
- (function (module, exports) {
30815
-
30816
- const {
30817
- MAX_SAFE_COMPONENT_LENGTH,
30818
- MAX_SAFE_BUILD_LENGTH,
30819
- MAX_LENGTH,
30820
- } = requireConstants();
30821
- const debug = requireDebug();
30822
- exports = module.exports = {};
30823
-
30824
- // The actual regexps go on exports.re
30825
- const re = exports.re = [];
30826
- const safeRe = exports.safeRe = [];
30827
- const src = exports.src = [];
30828
- const safeSrc = exports.safeSrc = [];
30829
- const t = exports.t = {};
30830
- let R = 0;
30831
-
30832
- const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
30833
-
30834
- // Replace some greedy regex tokens to prevent regex dos issues. These regex are
30835
- // used internally via the safeRe object since all inputs in this library get
30836
- // normalized first to trim and collapse all extra whitespace. The original
30837
- // regexes are exported for userland consumption and lower level usage. A
30838
- // future breaking change could export the safer regex only with a note that
30839
- // all input should have extra whitespace removed.
30840
- const safeRegexReplacements = [
30841
- ['\\s', 1],
30842
- ['\\d', MAX_LENGTH],
30843
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
30844
- ];
30845
-
30846
- const makeSafeRegex = (value) => {
30847
- for (const [token, max] of safeRegexReplacements) {
30848
- value = value
30849
- .split(`${token}*`).join(`${token}{0,${max}}`)
30850
- .split(`${token}+`).join(`${token}{1,${max}}`);
30851
- }
30852
- return value
30853
- };
30854
-
30855
- const createToken = (name, value, isGlobal) => {
30856
- const safe = makeSafeRegex(value);
30857
- const index = R++;
30858
- debug(name, index, value);
30859
- t[name] = index;
30860
- src[index] = value;
30861
- safeSrc[index] = safe;
30862
- re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
30863
- safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
30864
- };
30865
-
30866
- // The following Regular Expressions can be used for tokenizing,
30867
- // validating, and parsing SemVer version strings.
30868
-
30869
- // ## Numeric Identifier
30870
- // A single `0`, or a non-zero digit followed by zero or more digits.
30871
-
30872
- createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
30873
- createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
30874
-
30875
- // ## Non-numeric Identifier
30876
- // Zero or more digits, followed by a letter or hyphen, and then zero or
30877
- // more letters, digits, or hyphens.
30878
-
30879
- createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
30880
-
30881
- // ## Main Version
30882
- // Three dot-separated numeric identifiers.
30883
-
30884
- createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
30885
- `(${src[t.NUMERICIDENTIFIER]})\\.` +
30886
- `(${src[t.NUMERICIDENTIFIER]})`);
30887
-
30888
- createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
30889
- `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
30890
- `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
30891
-
30892
- // ## Pre-release Version Identifier
30893
- // A numeric identifier, or a non-numeric identifier.
30894
- // Non-numberic identifiers include numberic identifiers but can be longer.
30895
- // Therefore non-numberic identifiers must go first.
30896
-
30897
- createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
30898
- }|${src[t.NUMERICIDENTIFIER]})`);
30899
-
30900
- createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
30901
- }|${src[t.NUMERICIDENTIFIERLOOSE]})`);
30902
-
30903
- // ## Pre-release Version
30904
- // Hyphen, followed by one or more dot-separated pre-release version
30905
- // identifiers.
30906
-
30907
- createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
30908
- }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
30909
-
30910
- createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
30911
- }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
30912
-
30913
- // ## Build Metadata Identifier
30914
- // Any combination of digits, letters, or hyphens.
30915
-
30916
- createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
30917
-
30918
- // ## Build Metadata
30919
- // Plus sign, followed by one or more period-separated build metadata
30920
- // identifiers.
30817
+ const {
30818
+ MAX_SAFE_COMPONENT_LENGTH,
30819
+ MAX_SAFE_BUILD_LENGTH,
30820
+ MAX_LENGTH
30821
+ } = requireConstants();
30822
+ const debug = requireDebug();
30823
+ exports = module.exports = {};
30824
+
30825
+ // The actual regexps go on exports.re
30826
+ const re = exports.re = [];
30827
+ const safeRe = exports.safeRe = [];
30828
+ const src = exports.src = [];
30829
+ const safeSrc = exports.safeSrc = [];
30830
+ const t = exports.t = {};
30831
+ let R = 0;
30832
+ const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
30833
+
30834
+ // Replace some greedy regex tokens to prevent regex dos issues. These regex are
30835
+ // used internally via the safeRe object since all inputs in this library get
30836
+ // normalized first to trim and collapse all extra whitespace. The original
30837
+ // regexes are exported for userland consumption and lower level usage. A
30838
+ // future breaking change could export the safer regex only with a note that
30839
+ // all input should have extra whitespace removed.
30840
+ const safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];
30841
+ const makeSafeRegex = value => {
30842
+ for (const [token, max] of safeRegexReplacements) {
30843
+ value = value.split("".concat(token, "*")).join("".concat(token, "{0,").concat(max, "}")).split("".concat(token, "+")).join("".concat(token, "{1,").concat(max, "}"));
30844
+ }
30845
+ return value;
30846
+ };
30847
+ const createToken = (name, value, isGlobal) => {
30848
+ const safe = makeSafeRegex(value);
30849
+ const index = R++;
30850
+ debug(name, index, value);
30851
+ t[name] = index;
30852
+ src[index] = value;
30853
+ safeSrc[index] = safe;
30854
+ re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
30855
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
30856
+ };
30921
30857
 
30922
- createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
30923
- }(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
30924
-
30925
- // ## Full Version String
30926
- // A main version, followed optionally by a pre-release version and
30927
- // build metadata.
30928
-
30929
- // Note that the only major, minor, patch, and pre-release sections of
30930
- // the version string are capturing groups. The build metadata is not a
30931
- // capturing group, because it should not ever be used in version
30932
- // comparison.
30933
-
30934
- createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
30935
- }${src[t.PRERELEASE]}?${
30936
- src[t.BUILD]}?`);
30937
-
30938
- createToken('FULL', `^${src[t.FULLPLAIN]}$`);
30939
-
30940
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
30941
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
30942
- // common in the npm registry.
30943
- createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
30944
- }${src[t.PRERELEASELOOSE]}?${
30945
- src[t.BUILD]}?`);
30946
-
30947
- createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
30948
-
30949
- createToken('GTLT', '((?:<|>)?=?)');
30950
-
30951
- // Something like "2.*" or "1.2.x".
30952
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
30953
- // Only the first item is strictly required.
30954
- createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
30955
- createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
30956
-
30957
- createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
30958
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
30959
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
30960
- `(?:${src[t.PRERELEASE]})?${
30961
- src[t.BUILD]}?` +
30962
- `)?)?`);
30963
-
30964
- createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
30965
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
30966
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
30967
- `(?:${src[t.PRERELEASELOOSE]})?${
30968
- src[t.BUILD]}?` +
30969
- `)?)?`);
30970
-
30971
- createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
30972
- createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
30973
-
30974
- // Coercion.
30975
- // Extract anything that could conceivably be a part of a valid semver
30976
- createToken('COERCEPLAIN', `${'(^|[^\\d])' +
30977
- '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
30978
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
30979
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
30980
- createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
30981
- createToken('COERCEFULL', src[t.COERCEPLAIN] +
30982
- `(?:${src[t.PRERELEASE]})?` +
30983
- `(?:${src[t.BUILD]})?` +
30984
- `(?:$|[^\\d])`);
30985
- createToken('COERCERTL', src[t.COERCE], true);
30986
- createToken('COERCERTLFULL', src[t.COERCEFULL], true);
30987
-
30988
- // Tilde ranges.
30989
- // Meaning is "reasonably at or greater than"
30990
- createToken('LONETILDE', '(?:~>?)');
30991
-
30992
- createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
30993
- exports.tildeTrimReplace = '$1~';
30994
-
30995
- createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
30996
- createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
30997
-
30998
- // Caret ranges.
30999
- // Meaning is "at least and backwards compatible with"
31000
- createToken('LONECARET', '(?:\\^)');
31001
-
31002
- createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
31003
- exports.caretTrimReplace = '$1^';
31004
-
31005
- createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
31006
- createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
31007
-
31008
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
31009
- createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
31010
- createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
31011
-
31012
- // An expression to strip any whitespace between the gtlt and the thing
31013
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
31014
- createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
31015
- }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
31016
- exports.comparatorTrimReplace = '$1$2$3';
31017
-
31018
- // Something like `1.2.3 - 1.2.4`
31019
- // Note that these all use the loose form, because they'll be
31020
- // checked against either the strict or loose comparator form
31021
- // later.
31022
- createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
31023
- `\\s+-\\s+` +
31024
- `(${src[t.XRANGEPLAIN]})` +
31025
- `\\s*$`);
31026
-
31027
- createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
31028
- `\\s+-\\s+` +
31029
- `(${src[t.XRANGEPLAINLOOSE]})` +
31030
- `\\s*$`);
31031
-
31032
- // Star ranges basically just allow anything at all.
31033
- createToken('STAR', '(<|>)?=?\\s*\\*');
31034
- // >=0.0.0 is like a star
31035
- createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
31036
- createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
31037
- } (re, re.exports));
31038
- return re.exports;
30858
+ // The following Regular Expressions can be used for tokenizing,
30859
+ // validating, and parsing SemVer version strings.
30860
+
30861
+ // ## Numeric Identifier
30862
+ // A single `0`, or a non-zero digit followed by zero or more digits.
30863
+
30864
+ createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
30865
+ createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
30866
+
30867
+ // ## Non-numeric Identifier
30868
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
30869
+ // more letters, digits, or hyphens.
30870
+
30871
+ createToken('NONNUMERICIDENTIFIER', "\\d*[a-zA-Z-]".concat(LETTERDASHNUMBER, "*"));
30872
+
30873
+ // ## Main Version
30874
+ // Three dot-separated numeric identifiers.
30875
+
30876
+ createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")"));
30877
+ createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")"));
30878
+
30879
+ // ## Pre-release Version Identifier
30880
+ // A numeric identifier, or a non-numeric identifier.
30881
+ // Non-numberic identifiers include numberic identifiers but can be longer.
30882
+ // Therefore non-numberic identifiers must go first.
30883
+
30884
+ createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NONNUMERICIDENTIFIER], "|").concat(src[t.NUMERICIDENTIFIER], ")"));
30885
+ createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NONNUMERICIDENTIFIER], "|").concat(src[t.NUMERICIDENTIFIERLOOSE], ")"));
30886
+
30887
+ // ## Pre-release Version
30888
+ // Hyphen, followed by one or more dot-separated pre-release version
30889
+ // identifiers.
30890
+
30891
+ createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))"));
30892
+ createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))"));
30893
+
30894
+ // ## Build Metadata Identifier
30895
+ // Any combination of digits, letters, or hyphens.
30896
+
30897
+ createToken('BUILDIDENTIFIER', "".concat(LETTERDASHNUMBER, "+"));
30898
+
30899
+ // ## Build Metadata
30900
+ // Plus sign, followed by one or more period-separated build metadata
30901
+ // identifiers.
30902
+
30903
+ createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))"));
30904
+
30905
+ // ## Full Version String
30906
+ // A main version, followed optionally by a pre-release version and
30907
+ // build metadata.
30908
+
30909
+ // Note that the only major, minor, patch, and pre-release sections of
30910
+ // the version string are capturing groups. The build metadata is not a
30911
+ // capturing group, because it should not ever be used in version
30912
+ // comparison.
30913
+
30914
+ createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?"));
30915
+ createToken('FULL', "^".concat(src[t.FULLPLAIN], "$"));
30916
+
30917
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
30918
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
30919
+ // common in the npm registry.
30920
+ createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?"));
30921
+ createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$"));
30922
+ createToken('GTLT', '((?:<|>)?=?)');
30923
+
30924
+ // Something like "2.*" or "1.2.x".
30925
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
30926
+ // Only the first item is strictly required.
30927
+ createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*"));
30928
+ createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*"));
30929
+ createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?");
30930
+ createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?");
30931
+ createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$"));
30932
+ createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$"));
30933
+
30934
+ // Coercion.
30935
+ // Extract anything that could conceivably be a part of a valid semver
30936
+ createToken('COERCEPLAIN', "".concat('(^|[^\\d])' + '(\\d{1,').concat(MAX_SAFE_COMPONENT_LENGTH, "})") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?"));
30937
+ createToken('COERCE', "".concat(src[t.COERCEPLAIN], "(?:$|[^\\d])"));
30938
+ createToken('COERCEFULL', src[t.COERCEPLAIN] + "(?:".concat(src[t.PRERELEASE], ")?") + "(?:".concat(src[t.BUILD], ")?") + "(?:$|[^\\d])");
30939
+ createToken('COERCERTL', src[t.COERCE], true);
30940
+ createToken('COERCERTLFULL', src[t.COERCEFULL], true);
30941
+
30942
+ // Tilde ranges.
30943
+ // Meaning is "reasonably at or greater than"
30944
+ createToken('LONETILDE', '(?:~>?)');
30945
+ createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true);
30946
+ exports.tildeTrimReplace = '$1~';
30947
+ createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$"));
30948
+ createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$"));
30949
+
30950
+ // Caret ranges.
30951
+ // Meaning is "at least and backwards compatible with"
30952
+ createToken('LONECARET', '(?:\\^)');
30953
+ createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true);
30954
+ exports.caretTrimReplace = '$1^';
30955
+ createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$"));
30956
+ createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$"));
30957
+
30958
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
30959
+ createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$"));
30960
+ createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$"));
30961
+
30962
+ // An expression to strip any whitespace between the gtlt and the thing
30963
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
30964
+ createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true);
30965
+ exports.comparatorTrimReplace = '$1$2$3';
30966
+
30967
+ // Something like `1.2.3 - 1.2.4`
30968
+ // Note that these all use the loose form, because they'll be
30969
+ // checked against either the strict or loose comparator form
30970
+ // later.
30971
+ createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$");
30972
+ createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$");
30973
+
30974
+ // Star ranges basically just allow anything at all.
30975
+ createToken('STAR', '(<|>)?=?\\s*\\*');
30976
+ // >=0.0.0 is like a star
30977
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
30978
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
30979
+ })(re, re.exports);
30980
+ return re.exports;
31039
30981
  }
31040
30982
 
31041
30983
  var identifiers;
31042
30984
  var hasRequiredIdentifiers;
31043
-
31044
- function requireIdentifiers () {
31045
- if (hasRequiredIdentifiers) return identifiers;
31046
- hasRequiredIdentifiers = 1;
31047
-
31048
- const numeric = /^[0-9]+$/;
31049
- const compareIdentifiers = (a, b) => {
31050
- const anum = numeric.test(a);
31051
- const bnum = numeric.test(b);
31052
-
31053
- if (anum && bnum) {
31054
- a = +a;
31055
- b = +b;
31056
- }
31057
-
31058
- return a === b ? 0
31059
- : (anum && !bnum) ? -1
31060
- : (bnum && !anum) ? 1
31061
- : a < b ? -1
31062
- : 1
31063
- };
31064
-
31065
- const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
31066
-
31067
- identifiers = {
31068
- compareIdentifiers,
31069
- rcompareIdentifiers,
31070
- };
31071
- return identifiers;
30985
+ function requireIdentifiers() {
30986
+ if (hasRequiredIdentifiers) return identifiers;
30987
+ hasRequiredIdentifiers = 1;
30988
+ const numeric = /^[0-9]+$/;
30989
+ const compareIdentifiers = (a, b) => {
30990
+ const anum = numeric.test(a);
30991
+ const bnum = numeric.test(b);
30992
+ if (anum && bnum) {
30993
+ a = +a;
30994
+ b = +b;
30995
+ }
30996
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
30997
+ };
30998
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
30999
+ identifiers = {
31000
+ compareIdentifiers,
31001
+ rcompareIdentifiers
31002
+ };
31003
+ return identifiers;
31072
31004
  }
31073
31005
 
31074
31006
  var semver;
31075
31007
  var hasRequiredSemver;
31008
+ function requireSemver() {
31009
+ if (hasRequiredSemver) return semver;
31010
+ hasRequiredSemver = 1;
31011
+ const debug = requireDebug();
31012
+ const {
31013
+ MAX_LENGTH,
31014
+ MAX_SAFE_INTEGER
31015
+ } = requireConstants();
31016
+ const {
31017
+ safeRe: re,
31018
+ t
31019
+ } = requireRe();
31020
+ const parseOptions = requireParseOptions();
31021
+ const {
31022
+ compareIdentifiers
31023
+ } = requireIdentifiers();
31024
+ class SemVer {
31025
+ constructor(version, options) {
31026
+ options = parseOptions(options);
31027
+ if (version instanceof SemVer) {
31028
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
31029
+ return version;
31030
+ } else {
31031
+ version = version.version;
31032
+ }
31033
+ } else if (typeof version !== 'string') {
31034
+ throw new TypeError("Invalid version. Must be a string. Got type \"".concat(typeof version, "\"."));
31035
+ }
31036
+ if (version.length > MAX_LENGTH) {
31037
+ throw new TypeError("version is longer than ".concat(MAX_LENGTH, " characters"));
31038
+ }
31039
+ debug('SemVer', version, options);
31040
+ this.options = options;
31041
+ this.loose = !!options.loose;
31042
+ // this isn't actually relevant for versions, but keep it so that we
31043
+ // don't run into trouble passing this.options around.
31044
+ this.includePrerelease = !!options.includePrerelease;
31045
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
31046
+ if (!m) {
31047
+ throw new TypeError("Invalid Version: ".concat(version));
31048
+ }
31049
+ this.raw = version;
31076
31050
 
31077
- function requireSemver () {
31078
- if (hasRequiredSemver) return semver;
31079
- hasRequiredSemver = 1;
31080
-
31081
- const debug = requireDebug();
31082
- const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
31083
- const { safeRe: re, t } = requireRe();
31084
-
31085
- const parseOptions = requireParseOptions();
31086
- const { compareIdentifiers } = requireIdentifiers();
31087
- class SemVer {
31088
- constructor (version, options) {
31089
- options = parseOptions(options);
31090
-
31091
- if (version instanceof SemVer) {
31092
- if (version.loose === !!options.loose &&
31093
- version.includePrerelease === !!options.includePrerelease) {
31094
- return version
31095
- } else {
31096
- version = version.version;
31097
- }
31098
- } else if (typeof version !== 'string') {
31099
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
31100
- }
31101
-
31102
- if (version.length > MAX_LENGTH) {
31103
- throw new TypeError(
31104
- `version is longer than ${MAX_LENGTH} characters`
31105
- )
31106
- }
31107
-
31108
- debug('SemVer', version, options);
31109
- this.options = options;
31110
- this.loose = !!options.loose;
31111
- // this isn't actually relevant for versions, but keep it so that we
31112
- // don't run into trouble passing this.options around.
31113
- this.includePrerelease = !!options.includePrerelease;
31114
-
31115
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
31116
-
31117
- if (!m) {
31118
- throw new TypeError(`Invalid Version: ${version}`)
31119
- }
31120
-
31121
- this.raw = version;
31122
-
31123
- // these are actually numbers
31124
- this.major = +m[1];
31125
- this.minor = +m[2];
31126
- this.patch = +m[3];
31127
-
31128
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
31129
- throw new TypeError('Invalid major version')
31130
- }
31131
-
31132
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
31133
- throw new TypeError('Invalid minor version')
31134
- }
31135
-
31136
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
31137
- throw new TypeError('Invalid patch version')
31138
- }
31139
-
31140
- // numberify any prerelease numeric ids
31141
- if (!m[4]) {
31142
- this.prerelease = [];
31143
- } else {
31144
- this.prerelease = m[4].split('.').map((id) => {
31145
- if (/^[0-9]+$/.test(id)) {
31146
- const num = +id;
31147
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
31148
- return num
31149
- }
31150
- }
31151
- return id
31152
- });
31153
- }
31154
-
31155
- this.build = m[5] ? m[5].split('.') : [];
31156
- this.format();
31157
- }
31158
-
31159
- format () {
31160
- this.version = `${this.major}.${this.minor}.${this.patch}`;
31161
- if (this.prerelease.length) {
31162
- this.version += `-${this.prerelease.join('.')}`;
31163
- }
31164
- return this.version
31165
- }
31166
-
31167
- toString () {
31168
- return this.version
31169
- }
31170
-
31171
- compare (other) {
31172
- debug('SemVer.compare', this.version, this.options, other);
31173
- if (!(other instanceof SemVer)) {
31174
- if (typeof other === 'string' && other === this.version) {
31175
- return 0
31176
- }
31177
- other = new SemVer(other, this.options);
31178
- }
31179
-
31180
- if (other.version === this.version) {
31181
- return 0
31182
- }
31183
-
31184
- return this.compareMain(other) || this.comparePre(other)
31185
- }
31186
-
31187
- compareMain (other) {
31188
- if (!(other instanceof SemVer)) {
31189
- other = new SemVer(other, this.options);
31190
- }
31191
-
31192
- return (
31193
- compareIdentifiers(this.major, other.major) ||
31194
- compareIdentifiers(this.minor, other.minor) ||
31195
- compareIdentifiers(this.patch, other.patch)
31196
- )
31197
- }
31198
-
31199
- comparePre (other) {
31200
- if (!(other instanceof SemVer)) {
31201
- other = new SemVer(other, this.options);
31202
- }
31203
-
31204
- // NOT having a prerelease is > having one
31205
- if (this.prerelease.length && !other.prerelease.length) {
31206
- return -1
31207
- } else if (!this.prerelease.length && other.prerelease.length) {
31208
- return 1
31209
- } else if (!this.prerelease.length && !other.prerelease.length) {
31210
- return 0
31211
- }
31212
-
31213
- let i = 0;
31214
- do {
31215
- const a = this.prerelease[i];
31216
- const b = other.prerelease[i];
31217
- debug('prerelease compare', i, a, b);
31218
- if (a === undefined && b === undefined) {
31219
- return 0
31220
- } else if (b === undefined) {
31221
- return 1
31222
- } else if (a === undefined) {
31223
- return -1
31224
- } else if (a === b) {
31225
- continue
31226
- } else {
31227
- return compareIdentifiers(a, b)
31228
- }
31229
- } while (++i)
31230
- }
31231
-
31232
- compareBuild (other) {
31233
- if (!(other instanceof SemVer)) {
31234
- other = new SemVer(other, this.options);
31235
- }
31236
-
31237
- let i = 0;
31238
- do {
31239
- const a = this.build[i];
31240
- const b = other.build[i];
31241
- debug('build compare', i, a, b);
31242
- if (a === undefined && b === undefined) {
31243
- return 0
31244
- } else if (b === undefined) {
31245
- return 1
31246
- } else if (a === undefined) {
31247
- return -1
31248
- } else if (a === b) {
31249
- continue
31250
- } else {
31251
- return compareIdentifiers(a, b)
31252
- }
31253
- } while (++i)
31254
- }
31255
-
31256
- // preminor will bump the version up to the next minor release, and immediately
31257
- // down to pre-release. premajor and prepatch work the same way.
31258
- inc (release, identifier, identifierBase) {
31259
- if (release.startsWith('pre')) {
31260
- if (!identifier && identifierBase === false) {
31261
- throw new Error('invalid increment argument: identifier is empty')
31262
- }
31263
- // Avoid an invalid semver results
31264
- if (identifier) {
31265
- const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
31266
- if (!match || match[1] !== identifier) {
31267
- throw new Error(`invalid identifier: ${identifier}`)
31268
- }
31269
- }
31270
- }
31051
+ // these are actually numbers
31052
+ this.major = +m[1];
31053
+ this.minor = +m[2];
31054
+ this.patch = +m[3];
31055
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
31056
+ throw new TypeError('Invalid major version');
31057
+ }
31058
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
31059
+ throw new TypeError('Invalid minor version');
31060
+ }
31061
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
31062
+ throw new TypeError('Invalid patch version');
31063
+ }
31271
31064
 
31272
- switch (release) {
31273
- case 'premajor':
31274
- this.prerelease.length = 0;
31275
- this.patch = 0;
31276
- this.minor = 0;
31277
- this.major++;
31278
- this.inc('pre', identifier, identifierBase);
31279
- break
31280
- case 'preminor':
31281
- this.prerelease.length = 0;
31282
- this.patch = 0;
31283
- this.minor++;
31284
- this.inc('pre', identifier, identifierBase);
31285
- break
31286
- case 'prepatch':
31287
- // If this is already a prerelease, it will bump to the next version
31288
- // drop any prereleases that might already exist, since they are not
31289
- // relevant at this point.
31290
- this.prerelease.length = 0;
31291
- this.inc('patch', identifier, identifierBase);
31292
- this.inc('pre', identifier, identifierBase);
31293
- break
31294
- // If the input is a non-prerelease version, this acts the same as
31295
- // prepatch.
31296
- case 'prerelease':
31297
- if (this.prerelease.length === 0) {
31298
- this.inc('patch', identifier, identifierBase);
31299
- }
31300
- this.inc('pre', identifier, identifierBase);
31301
- break
31302
- case 'release':
31303
- if (this.prerelease.length === 0) {
31304
- throw new Error(`version ${this.raw} is not a prerelease`)
31305
- }
31306
- this.prerelease.length = 0;
31307
- break
31308
-
31309
- case 'major':
31310
- // If this is a pre-major version, bump up to the same major version.
31311
- // Otherwise increment major.
31312
- // 1.0.0-5 bumps to 1.0.0
31313
- // 1.1.0 bumps to 2.0.0
31314
- if (
31315
- this.minor !== 0 ||
31316
- this.patch !== 0 ||
31317
- this.prerelease.length === 0
31318
- ) {
31319
- this.major++;
31320
- }
31321
- this.minor = 0;
31322
- this.patch = 0;
31323
- this.prerelease = [];
31324
- break
31325
- case 'minor':
31326
- // If this is a pre-minor version, bump up to the same minor version.
31327
- // Otherwise increment minor.
31328
- // 1.2.0-5 bumps to 1.2.0
31329
- // 1.2.1 bumps to 1.3.0
31330
- if (this.patch !== 0 || this.prerelease.length === 0) {
31331
- this.minor++;
31332
- }
31333
- this.patch = 0;
31334
- this.prerelease = [];
31335
- break
31336
- case 'patch':
31337
- // If this is not a pre-release version, it will increment the patch.
31338
- // If it is a pre-release it will bump up to the same patch version.
31339
- // 1.2.0-5 patches to 1.2.0
31340
- // 1.2.0 patches to 1.2.1
31341
- if (this.prerelease.length === 0) {
31342
- this.patch++;
31343
- }
31344
- this.prerelease = [];
31345
- break
31346
- // This probably shouldn't be used publicly.
31347
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
31348
- case 'pre': {
31349
- const base = Number(identifierBase) ? 1 : 0;
31350
-
31351
- if (this.prerelease.length === 0) {
31352
- this.prerelease = [base];
31353
- } else {
31354
- let i = this.prerelease.length;
31355
- while (--i >= 0) {
31356
- if (typeof this.prerelease[i] === 'number') {
31357
- this.prerelease[i]++;
31358
- i = -2;
31359
- }
31360
- }
31361
- if (i === -1) {
31362
- // didn't increment anything
31363
- if (identifier === this.prerelease.join('.') && identifierBase === false) {
31364
- throw new Error('invalid increment argument: identifier already exists')
31365
- }
31366
- this.prerelease.push(base);
31367
- }
31368
- }
31369
- if (identifier) {
31370
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
31371
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
31372
- let prerelease = [identifier, base];
31373
- if (identifierBase === false) {
31374
- prerelease = [identifier];
31375
- }
31376
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
31377
- if (isNaN(this.prerelease[1])) {
31378
- this.prerelease = prerelease;
31379
- }
31380
- } else {
31381
- this.prerelease = prerelease;
31382
- }
31383
- }
31384
- break
31385
- }
31386
- default:
31387
- throw new Error(`invalid increment argument: ${release}`)
31388
- }
31389
- this.raw = this.format();
31390
- if (this.build.length) {
31391
- this.raw += `+${this.build.join('.')}`;
31392
- }
31393
- return this
31394
- }
31395
- }
31065
+ // numberify any prerelease numeric ids
31066
+ if (!m[4]) {
31067
+ this.prerelease = [];
31068
+ } else {
31069
+ this.prerelease = m[4].split('.').map(id => {
31070
+ if (/^[0-9]+$/.test(id)) {
31071
+ const num = +id;
31072
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
31073
+ return num;
31074
+ }
31075
+ }
31076
+ return id;
31077
+ });
31078
+ }
31079
+ this.build = m[5] ? m[5].split('.') : [];
31080
+ this.format();
31081
+ }
31082
+ format() {
31083
+ this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
31084
+ if (this.prerelease.length) {
31085
+ this.version += "-".concat(this.prerelease.join('.'));
31086
+ }
31087
+ return this.version;
31088
+ }
31089
+ toString() {
31090
+ return this.version;
31091
+ }
31092
+ compare(other) {
31093
+ debug('SemVer.compare', this.version, this.options, other);
31094
+ if (!(other instanceof SemVer)) {
31095
+ if (typeof other === 'string' && other === this.version) {
31096
+ return 0;
31097
+ }
31098
+ other = new SemVer(other, this.options);
31099
+ }
31100
+ if (other.version === this.version) {
31101
+ return 0;
31102
+ }
31103
+ return this.compareMain(other) || this.comparePre(other);
31104
+ }
31105
+ compareMain(other) {
31106
+ if (!(other instanceof SemVer)) {
31107
+ other = new SemVer(other, this.options);
31108
+ }
31109
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
31110
+ }
31111
+ comparePre(other) {
31112
+ if (!(other instanceof SemVer)) {
31113
+ other = new SemVer(other, this.options);
31114
+ }
31115
+
31116
+ // NOT having a prerelease is > having one
31117
+ if (this.prerelease.length && !other.prerelease.length) {
31118
+ return -1;
31119
+ } else if (!this.prerelease.length && other.prerelease.length) {
31120
+ return 1;
31121
+ } else if (!this.prerelease.length && !other.prerelease.length) {
31122
+ return 0;
31123
+ }
31124
+ let i = 0;
31125
+ do {
31126
+ const a = this.prerelease[i];
31127
+ const b = other.prerelease[i];
31128
+ debug('prerelease compare', i, a, b);
31129
+ if (a === undefined && b === undefined) {
31130
+ return 0;
31131
+ } else if (b === undefined) {
31132
+ return 1;
31133
+ } else if (a === undefined) {
31134
+ return -1;
31135
+ } else if (a === b) {
31136
+ continue;
31137
+ } else {
31138
+ return compareIdentifiers(a, b);
31139
+ }
31140
+ } while (++i);
31141
+ }
31142
+ compareBuild(other) {
31143
+ if (!(other instanceof SemVer)) {
31144
+ other = new SemVer(other, this.options);
31145
+ }
31146
+ let i = 0;
31147
+ do {
31148
+ const a = this.build[i];
31149
+ const b = other.build[i];
31150
+ debug('build compare', i, a, b);
31151
+ if (a === undefined && b === undefined) {
31152
+ return 0;
31153
+ } else if (b === undefined) {
31154
+ return 1;
31155
+ } else if (a === undefined) {
31156
+ return -1;
31157
+ } else if (a === b) {
31158
+ continue;
31159
+ } else {
31160
+ return compareIdentifiers(a, b);
31161
+ }
31162
+ } while (++i);
31163
+ }
31396
31164
 
31397
- semver = SemVer;
31398
- return semver;
31165
+ // preminor will bump the version up to the next minor release, and immediately
31166
+ // down to pre-release. premajor and prepatch work the same way.
31167
+ inc(release, identifier, identifierBase) {
31168
+ if (release.startsWith('pre')) {
31169
+ if (!identifier && identifierBase === false) {
31170
+ throw new Error('invalid increment argument: identifier is empty');
31171
+ }
31172
+ // Avoid an invalid semver results
31173
+ if (identifier) {
31174
+ const match = "-".concat(identifier).match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
31175
+ if (!match || match[1] !== identifier) {
31176
+ throw new Error("invalid identifier: ".concat(identifier));
31177
+ }
31178
+ }
31179
+ }
31180
+ switch (release) {
31181
+ case 'premajor':
31182
+ this.prerelease.length = 0;
31183
+ this.patch = 0;
31184
+ this.minor = 0;
31185
+ this.major++;
31186
+ this.inc('pre', identifier, identifierBase);
31187
+ break;
31188
+ case 'preminor':
31189
+ this.prerelease.length = 0;
31190
+ this.patch = 0;
31191
+ this.minor++;
31192
+ this.inc('pre', identifier, identifierBase);
31193
+ break;
31194
+ case 'prepatch':
31195
+ // If this is already a prerelease, it will bump to the next version
31196
+ // drop any prereleases that might already exist, since they are not
31197
+ // relevant at this point.
31198
+ this.prerelease.length = 0;
31199
+ this.inc('patch', identifier, identifierBase);
31200
+ this.inc('pre', identifier, identifierBase);
31201
+ break;
31202
+ // If the input is a non-prerelease version, this acts the same as
31203
+ // prepatch.
31204
+ case 'prerelease':
31205
+ if (this.prerelease.length === 0) {
31206
+ this.inc('patch', identifier, identifierBase);
31207
+ }
31208
+ this.inc('pre', identifier, identifierBase);
31209
+ break;
31210
+ case 'release':
31211
+ if (this.prerelease.length === 0) {
31212
+ throw new Error("version ".concat(this.raw, " is not a prerelease"));
31213
+ }
31214
+ this.prerelease.length = 0;
31215
+ break;
31216
+ case 'major':
31217
+ // If this is a pre-major version, bump up to the same major version.
31218
+ // Otherwise increment major.
31219
+ // 1.0.0-5 bumps to 1.0.0
31220
+ // 1.1.0 bumps to 2.0.0
31221
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
31222
+ this.major++;
31223
+ }
31224
+ this.minor = 0;
31225
+ this.patch = 0;
31226
+ this.prerelease = [];
31227
+ break;
31228
+ case 'minor':
31229
+ // If this is a pre-minor version, bump up to the same minor version.
31230
+ // Otherwise increment minor.
31231
+ // 1.2.0-5 bumps to 1.2.0
31232
+ // 1.2.1 bumps to 1.3.0
31233
+ if (this.patch !== 0 || this.prerelease.length === 0) {
31234
+ this.minor++;
31235
+ }
31236
+ this.patch = 0;
31237
+ this.prerelease = [];
31238
+ break;
31239
+ case 'patch':
31240
+ // If this is not a pre-release version, it will increment the patch.
31241
+ // If it is a pre-release it will bump up to the same patch version.
31242
+ // 1.2.0-5 patches to 1.2.0
31243
+ // 1.2.0 patches to 1.2.1
31244
+ if (this.prerelease.length === 0) {
31245
+ this.patch++;
31246
+ }
31247
+ this.prerelease = [];
31248
+ break;
31249
+ // This probably shouldn't be used publicly.
31250
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
31251
+ case 'pre':
31252
+ {
31253
+ const base = Number(identifierBase) ? 1 : 0;
31254
+ if (this.prerelease.length === 0) {
31255
+ this.prerelease = [base];
31256
+ } else {
31257
+ let i = this.prerelease.length;
31258
+ while (--i >= 0) {
31259
+ if (typeof this.prerelease[i] === 'number') {
31260
+ this.prerelease[i]++;
31261
+ i = -2;
31262
+ }
31263
+ }
31264
+ if (i === -1) {
31265
+ // didn't increment anything
31266
+ if (identifier === this.prerelease.join('.') && identifierBase === false) {
31267
+ throw new Error('invalid increment argument: identifier already exists');
31268
+ }
31269
+ this.prerelease.push(base);
31270
+ }
31271
+ }
31272
+ if (identifier) {
31273
+ // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
31274
+ // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
31275
+ let prerelease = [identifier, base];
31276
+ if (identifierBase === false) {
31277
+ prerelease = [identifier];
31278
+ }
31279
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
31280
+ if (isNaN(this.prerelease[1])) {
31281
+ this.prerelease = prerelease;
31282
+ }
31283
+ } else {
31284
+ this.prerelease = prerelease;
31285
+ }
31286
+ }
31287
+ break;
31288
+ }
31289
+ default:
31290
+ throw new Error("invalid increment argument: ".concat(release));
31291
+ }
31292
+ this.raw = this.format();
31293
+ if (this.build.length) {
31294
+ this.raw += "+".concat(this.build.join('.'));
31295
+ }
31296
+ return this;
31297
+ }
31298
+ }
31299
+ semver = SemVer;
31300
+ return semver;
31399
31301
  }
31400
31302
 
31401
31303
  var compare_1;
31402
31304
  var hasRequiredCompare;
31403
-
31404
- function requireCompare () {
31405
- if (hasRequiredCompare) return compare_1;
31406
- hasRequiredCompare = 1;
31407
-
31408
- const SemVer = requireSemver();
31409
- const compare = (a, b, loose) =>
31410
- new SemVer(a, loose).compare(new SemVer(b, loose));
31411
-
31412
- compare_1 = compare;
31413
- return compare_1;
31305
+ function requireCompare() {
31306
+ if (hasRequiredCompare) return compare_1;
31307
+ hasRequiredCompare = 1;
31308
+ const SemVer = requireSemver();
31309
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
31310
+ compare_1 = compare;
31311
+ return compare_1;
31414
31312
  }
31415
31313
 
31416
31314
  var eq_1;
31417
31315
  var hasRequiredEq;
31418
-
31419
- function requireEq () {
31420
- if (hasRequiredEq) return eq_1;
31421
- hasRequiredEq = 1;
31422
-
31423
- const compare = requireCompare();
31424
- const eq = (a, b, loose) => compare(a, b, loose) === 0;
31425
- eq_1 = eq;
31426
- return eq_1;
31316
+ function requireEq() {
31317
+ if (hasRequiredEq) return eq_1;
31318
+ hasRequiredEq = 1;
31319
+ const compare = requireCompare();
31320
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
31321
+ eq_1 = eq;
31322
+ return eq_1;
31427
31323
  }
31428
31324
 
31429
31325
  var neq_1;
31430
31326
  var hasRequiredNeq;
31431
-
31432
- function requireNeq () {
31433
- if (hasRequiredNeq) return neq_1;
31434
- hasRequiredNeq = 1;
31435
-
31436
- const compare = requireCompare();
31437
- const neq = (a, b, loose) => compare(a, b, loose) !== 0;
31438
- neq_1 = neq;
31439
- return neq_1;
31327
+ function requireNeq() {
31328
+ if (hasRequiredNeq) return neq_1;
31329
+ hasRequiredNeq = 1;
31330
+ const compare = requireCompare();
31331
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
31332
+ neq_1 = neq;
31333
+ return neq_1;
31440
31334
  }
31441
31335
 
31442
31336
  var gt_1;
31443
31337
  var hasRequiredGt;
31444
-
31445
- function requireGt () {
31446
- if (hasRequiredGt) return gt_1;
31447
- hasRequiredGt = 1;
31448
-
31449
- const compare = requireCompare();
31450
- const gt = (a, b, loose) => compare(a, b, loose) > 0;
31451
- gt_1 = gt;
31452
- return gt_1;
31338
+ function requireGt() {
31339
+ if (hasRequiredGt) return gt_1;
31340
+ hasRequiredGt = 1;
31341
+ const compare = requireCompare();
31342
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
31343
+ gt_1 = gt;
31344
+ return gt_1;
31453
31345
  }
31454
31346
 
31455
31347
  var gte_1;
31456
31348
  var hasRequiredGte;
31457
-
31458
- function requireGte () {
31459
- if (hasRequiredGte) return gte_1;
31460
- hasRequiredGte = 1;
31461
-
31462
- const compare = requireCompare();
31463
- const gte = (a, b, loose) => compare(a, b, loose) >= 0;
31464
- gte_1 = gte;
31465
- return gte_1;
31349
+ function requireGte() {
31350
+ if (hasRequiredGte) return gte_1;
31351
+ hasRequiredGte = 1;
31352
+ const compare = requireCompare();
31353
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
31354
+ gte_1 = gte;
31355
+ return gte_1;
31466
31356
  }
31467
31357
 
31468
31358
  var lt_1;
31469
31359
  var hasRequiredLt;
31470
-
31471
- function requireLt () {
31472
- if (hasRequiredLt) return lt_1;
31473
- hasRequiredLt = 1;
31474
-
31475
- const compare = requireCompare();
31476
- const lt = (a, b, loose) => compare(a, b, loose) < 0;
31477
- lt_1 = lt;
31478
- return lt_1;
31360
+ function requireLt() {
31361
+ if (hasRequiredLt) return lt_1;
31362
+ hasRequiredLt = 1;
31363
+ const compare = requireCompare();
31364
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
31365
+ lt_1 = lt;
31366
+ return lt_1;
31479
31367
  }
31480
31368
 
31481
31369
  var lte_1;
31482
31370
  var hasRequiredLte;
31483
-
31484
- function requireLte () {
31485
- if (hasRequiredLte) return lte_1;
31486
- hasRequiredLte = 1;
31487
-
31488
- const compare = requireCompare();
31489
- const lte = (a, b, loose) => compare(a, b, loose) <= 0;
31490
- lte_1 = lte;
31491
- return lte_1;
31371
+ function requireLte() {
31372
+ if (hasRequiredLte) return lte_1;
31373
+ hasRequiredLte = 1;
31374
+ const compare = requireCompare();
31375
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
31376
+ lte_1 = lte;
31377
+ return lte_1;
31492
31378
  }
31493
31379
 
31494
31380
  var cmp_1;
31495
31381
  var hasRequiredCmp;
31496
-
31497
- function requireCmp () {
31498
- if (hasRequiredCmp) return cmp_1;
31499
- hasRequiredCmp = 1;
31500
-
31501
- const eq = requireEq();
31502
- const neq = requireNeq();
31503
- const gt = requireGt();
31504
- const gte = requireGte();
31505
- const lt = requireLt();
31506
- const lte = requireLte();
31507
-
31508
- const cmp = (a, op, b, loose) => {
31509
- switch (op) {
31510
- case '===':
31511
- if (typeof a === 'object') {
31512
- a = a.version;
31513
- }
31514
- if (typeof b === 'object') {
31515
- b = b.version;
31516
- }
31517
- return a === b
31518
-
31519
- case '!==':
31520
- if (typeof a === 'object') {
31521
- a = a.version;
31522
- }
31523
- if (typeof b === 'object') {
31524
- b = b.version;
31525
- }
31526
- return a !== b
31527
-
31528
- case '':
31529
- case '=':
31530
- case '==':
31531
- return eq(a, b, loose)
31532
-
31533
- case '!=':
31534
- return neq(a, b, loose)
31535
-
31536
- case '>':
31537
- return gt(a, b, loose)
31538
-
31539
- case '>=':
31540
- return gte(a, b, loose)
31541
-
31542
- case '<':
31543
- return lt(a, b, loose)
31544
-
31545
- case '<=':
31546
- return lte(a, b, loose)
31547
-
31548
- default:
31549
- throw new TypeError(`Invalid operator: ${op}`)
31550
- }
31551
- };
31552
- cmp_1 = cmp;
31553
- return cmp_1;
31554
- }
31382
+ function requireCmp() {
31383
+ if (hasRequiredCmp) return cmp_1;
31384
+ hasRequiredCmp = 1;
31385
+ const eq = requireEq();
31386
+ const neq = requireNeq();
31387
+ const gt = requireGt();
31388
+ const gte = requireGte();
31389
+ const lt = requireLt();
31390
+ const lte = requireLte();
31391
+ const cmp = (a, op, b, loose) => {
31392
+ switch (op) {
31393
+ case '===':
31394
+ if (typeof a === 'object') {
31395
+ a = a.version;
31396
+ }
31397
+ if (typeof b === 'object') {
31398
+ b = b.version;
31399
+ }
31400
+ return a === b;
31401
+ case '!==':
31402
+ if (typeof a === 'object') {
31403
+ a = a.version;
31404
+ }
31405
+ if (typeof b === 'object') {
31406
+ b = b.version;
31407
+ }
31408
+ return a !== b;
31409
+ case '':
31410
+ case '=':
31411
+ case '==':
31412
+ return eq(a, b, loose);
31413
+ case '!=':
31414
+ return neq(a, b, loose);
31415
+ case '>':
31416
+ return gt(a, b, loose);
31417
+ case '>=':
31418
+ return gte(a, b, loose);
31419
+ case '<':
31420
+ return lt(a, b, loose);
31421
+ case '<=':
31422
+ return lte(a, b, loose);
31423
+ default:
31424
+ throw new TypeError("Invalid operator: ".concat(op));
31425
+ }
31426
+ };
31427
+ cmp_1 = cmp;
31428
+ return cmp_1;
31429
+ }
31555
31430
 
31556
31431
  var comparator;
31557
31432
  var hasRequiredComparator;
31433
+ function requireComparator() {
31434
+ if (hasRequiredComparator) return comparator;
31435
+ hasRequiredComparator = 1;
31436
+ const ANY = Symbol('SemVer ANY');
31437
+ // hoisted class for cyclic dependency
31438
+ class Comparator {
31439
+ static get ANY() {
31440
+ return ANY;
31441
+ }
31442
+ constructor(comp, options) {
31443
+ options = parseOptions(options);
31444
+ if (comp instanceof Comparator) {
31445
+ if (comp.loose === !!options.loose) {
31446
+ return comp;
31447
+ } else {
31448
+ comp = comp.value;
31449
+ }
31450
+ }
31451
+ comp = comp.trim().split(/\s+/).join(' ');
31452
+ debug('comparator', comp, options);
31453
+ this.options = options;
31454
+ this.loose = !!options.loose;
31455
+ this.parse(comp);
31456
+ if (this.semver === ANY) {
31457
+ this.value = '';
31458
+ } else {
31459
+ this.value = this.operator + this.semver.version;
31460
+ }
31461
+ debug('comp', this);
31462
+ }
31463
+ parse(comp) {
31464
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
31465
+ const m = comp.match(r);
31466
+ if (!m) {
31467
+ throw new TypeError("Invalid comparator: ".concat(comp));
31468
+ }
31469
+ this.operator = m[1] !== undefined ? m[1] : '';
31470
+ if (this.operator === '=') {
31471
+ this.operator = '';
31472
+ }
31558
31473
 
31559
- function requireComparator () {
31560
- if (hasRequiredComparator) return comparator;
31561
- hasRequiredComparator = 1;
31562
-
31563
- const ANY = Symbol('SemVer ANY');
31564
- // hoisted class for cyclic dependency
31565
- class Comparator {
31566
- static get ANY () {
31567
- return ANY
31568
- }
31569
-
31570
- constructor (comp, options) {
31571
- options = parseOptions(options);
31572
-
31573
- if (comp instanceof Comparator) {
31574
- if (comp.loose === !!options.loose) {
31575
- return comp
31576
- } else {
31577
- comp = comp.value;
31578
- }
31579
- }
31580
-
31581
- comp = comp.trim().split(/\s+/).join(' ');
31582
- debug('comparator', comp, options);
31583
- this.options = options;
31584
- this.loose = !!options.loose;
31585
- this.parse(comp);
31586
-
31587
- if (this.semver === ANY) {
31588
- this.value = '';
31589
- } else {
31590
- this.value = this.operator + this.semver.version;
31591
- }
31592
-
31593
- debug('comp', this);
31594
- }
31595
-
31596
- parse (comp) {
31597
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
31598
- const m = comp.match(r);
31599
-
31600
- if (!m) {
31601
- throw new TypeError(`Invalid comparator: ${comp}`)
31602
- }
31603
-
31604
- this.operator = m[1] !== undefined ? m[1] : '';
31605
- if (this.operator === '=') {
31606
- this.operator = '';
31607
- }
31608
-
31609
- // if it literally is just '>' or '' then allow anything.
31610
- if (!m[2]) {
31611
- this.semver = ANY;
31612
- } else {
31613
- this.semver = new SemVer(m[2], this.options.loose);
31614
- }
31615
- }
31616
-
31617
- toString () {
31618
- return this.value
31619
- }
31620
-
31621
- test (version) {
31622
- debug('Comparator.test', version, this.options.loose);
31623
-
31624
- if (this.semver === ANY || version === ANY) {
31625
- return true
31626
- }
31627
-
31628
- if (typeof version === 'string') {
31629
- try {
31630
- version = new SemVer(version, this.options);
31631
- } catch (er) {
31632
- return false
31633
- }
31634
- }
31635
-
31636
- return cmp(version, this.operator, this.semver, this.options)
31637
- }
31638
-
31639
- intersects (comp, options) {
31640
- if (!(comp instanceof Comparator)) {
31641
- throw new TypeError('a Comparator is required')
31642
- }
31643
-
31644
- if (this.operator === '') {
31645
- if (this.value === '') {
31646
- return true
31647
- }
31648
- return new Range(comp.value, options).test(this.value)
31649
- } else if (comp.operator === '') {
31650
- if (comp.value === '') {
31651
- return true
31652
- }
31653
- return new Range(this.value, options).test(comp.semver)
31654
- }
31655
-
31656
- options = parseOptions(options);
31657
-
31658
- // Special cases where nothing can possibly be lower
31659
- if (options.includePrerelease &&
31660
- (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
31661
- return false
31662
- }
31663
- if (!options.includePrerelease &&
31664
- (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
31665
- return false
31666
- }
31667
-
31668
- // Same direction increasing (> or >=)
31669
- if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
31670
- return true
31671
- }
31672
- // Same direction decreasing (< or <=)
31673
- if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
31674
- return true
31675
- }
31676
- // same SemVer and both sides are inclusive (<= or >=)
31677
- if (
31678
- (this.semver.version === comp.semver.version) &&
31679
- this.operator.includes('=') && comp.operator.includes('=')) {
31680
- return true
31681
- }
31682
- // opposite directions less than
31683
- if (cmp(this.semver, '<', comp.semver, options) &&
31684
- this.operator.startsWith('>') && comp.operator.startsWith('<')) {
31685
- return true
31686
- }
31687
- // opposite directions greater than
31688
- if (cmp(this.semver, '>', comp.semver, options) &&
31689
- this.operator.startsWith('<') && comp.operator.startsWith('>')) {
31690
- return true
31691
- }
31692
- return false
31693
- }
31694
- }
31474
+ // if it literally is just '>' or '' then allow anything.
31475
+ if (!m[2]) {
31476
+ this.semver = ANY;
31477
+ } else {
31478
+ this.semver = new SemVer(m[2], this.options.loose);
31479
+ }
31480
+ }
31481
+ toString() {
31482
+ return this.value;
31483
+ }
31484
+ test(version) {
31485
+ debug('Comparator.test', version, this.options.loose);
31486
+ if (this.semver === ANY || version === ANY) {
31487
+ return true;
31488
+ }
31489
+ if (typeof version === 'string') {
31490
+ try {
31491
+ version = new SemVer(version, this.options);
31492
+ } catch (er) {
31493
+ return false;
31494
+ }
31495
+ }
31496
+ return cmp(version, this.operator, this.semver, this.options);
31497
+ }
31498
+ intersects(comp, options) {
31499
+ if (!(comp instanceof Comparator)) {
31500
+ throw new TypeError('a Comparator is required');
31501
+ }
31502
+ if (this.operator === '') {
31503
+ if (this.value === '') {
31504
+ return true;
31505
+ }
31506
+ return new Range(comp.value, options).test(this.value);
31507
+ } else if (comp.operator === '') {
31508
+ if (comp.value === '') {
31509
+ return true;
31510
+ }
31511
+ return new Range(this.value, options).test(comp.semver);
31512
+ }
31513
+ options = parseOptions(options);
31695
31514
 
31696
- comparator = Comparator;
31515
+ // Special cases where nothing can possibly be lower
31516
+ if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
31517
+ return false;
31518
+ }
31519
+ if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
31520
+ return false;
31521
+ }
31697
31522
 
31698
- const parseOptions = requireParseOptions();
31699
- const { safeRe: re, t } = requireRe();
31700
- const cmp = requireCmp();
31701
- const debug = requireDebug();
31702
- const SemVer = requireSemver();
31703
- const Range = requireRange();
31704
- return comparator;
31523
+ // Same direction increasing (> or >=)
31524
+ if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
31525
+ return true;
31526
+ }
31527
+ // Same direction decreasing (< or <=)
31528
+ if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
31529
+ return true;
31530
+ }
31531
+ // same SemVer and both sides are inclusive (<= or >=)
31532
+ if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {
31533
+ return true;
31534
+ }
31535
+ // opposite directions less than
31536
+ if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {
31537
+ return true;
31538
+ }
31539
+ // opposite directions greater than
31540
+ if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {
31541
+ return true;
31542
+ }
31543
+ return false;
31544
+ }
31545
+ }
31546
+ comparator = Comparator;
31547
+ const parseOptions = requireParseOptions();
31548
+ const {
31549
+ safeRe: re,
31550
+ t
31551
+ } = requireRe();
31552
+ const cmp = requireCmp();
31553
+ const debug = requireDebug();
31554
+ const SemVer = requireSemver();
31555
+ const Range = requireRange();
31556
+ return comparator;
31705
31557
  }
31706
31558
 
31707
31559
  var range;
31708
31560
  var hasRequiredRange;
31561
+ function requireRange() {
31562
+ if (hasRequiredRange) return range;
31563
+ hasRequiredRange = 1;
31564
+ const SPACE_CHARACTERS = /\s+/g;
31565
+
31566
+ // hoisted class for cyclic dependency
31567
+ class Range {
31568
+ constructor(range, options) {
31569
+ options = parseOptions(options);
31570
+ if (range instanceof Range) {
31571
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
31572
+ return range;
31573
+ } else {
31574
+ return new Range(range.raw, options);
31575
+ }
31576
+ }
31577
+ if (range instanceof Comparator) {
31578
+ // just put it in the set and return
31579
+ this.raw = range.value;
31580
+ this.set = [[range]];
31581
+ this.formatted = undefined;
31582
+ return this;
31583
+ }
31584
+ this.options = options;
31585
+ this.loose = !!options.loose;
31586
+ this.includePrerelease = !!options.includePrerelease;
31587
+
31588
+ // First reduce all whitespace as much as possible so we do not have to rely
31589
+ // on potentially slow regexes like \s*. This is then stored and used for
31590
+ // future error messages as well.
31591
+ this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
31592
+
31593
+ // First, split on ||
31594
+ this.set = this.raw.split('||')
31595
+ // map the range to a 2d array of comparators
31596
+ .map(r => this.parseRange(r.trim()))
31597
+ // throw out any comparator lists that are empty
31598
+ // this generally means that it was not a valid range, which is allowed
31599
+ // in loose mode, but will still throw if the WHOLE range is invalid.
31600
+ .filter(c => c.length);
31601
+ if (!this.set.length) {
31602
+ throw new TypeError("Invalid SemVer Range: ".concat(this.raw));
31603
+ }
31604
+
31605
+ // if we have any that are not the null set, throw out null sets.
31606
+ if (this.set.length > 1) {
31607
+ // keep the first one, in case they're all null sets
31608
+ const first = this.set[0];
31609
+ this.set = this.set.filter(c => !isNullSet(c[0]));
31610
+ if (this.set.length === 0) {
31611
+ this.set = [first];
31612
+ } else if (this.set.length > 1) {
31613
+ // if we have any that are *, then the range is just *
31614
+ for (const c of this.set) {
31615
+ if (c.length === 1 && isAny(c[0])) {
31616
+ this.set = [c];
31617
+ break;
31618
+ }
31619
+ }
31620
+ }
31621
+ }
31622
+ this.formatted = undefined;
31623
+ }
31624
+ get range() {
31625
+ if (this.formatted === undefined) {
31626
+ this.formatted = '';
31627
+ for (let i = 0; i < this.set.length; i++) {
31628
+ if (i > 0) {
31629
+ this.formatted += '||';
31630
+ }
31631
+ const comps = this.set[i];
31632
+ for (let k = 0; k < comps.length; k++) {
31633
+ if (k > 0) {
31634
+ this.formatted += ' ';
31635
+ }
31636
+ this.formatted += comps[k].toString().trim();
31637
+ }
31638
+ }
31639
+ }
31640
+ return this.formatted;
31641
+ }
31642
+ format() {
31643
+ return this.range;
31644
+ }
31645
+ toString() {
31646
+ return this.range;
31647
+ }
31648
+ parseRange(range) {
31649
+ // memoize range parsing for performance.
31650
+ // this is a very hot path, and fully deterministic.
31651
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
31652
+ const memoKey = memoOpts + ':' + range;
31653
+ const cached = cache.get(memoKey);
31654
+ if (cached) {
31655
+ return cached;
31656
+ }
31657
+ const loose = this.options.loose;
31658
+ // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
31659
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
31660
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
31661
+ debug('hyphen replace', range);
31662
+
31663
+ // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
31664
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
31665
+ debug('comparator trim', range);
31666
+
31667
+ // `~ 1.2.3` => `~1.2.3`
31668
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
31669
+ debug('tilde trim', range);
31670
+
31671
+ // `^ 1.2.3` => `^1.2.3`
31672
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
31673
+ debug('caret trim', range);
31674
+
31675
+ // At this point, the range is completely trimmed and
31676
+ // ready to be split into comparators.
31677
+
31678
+ let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/)
31679
+ // >=0.0.0 is equivalent to *
31680
+ .map(comp => replaceGTE0(comp, this.options));
31681
+ if (loose) {
31682
+ // in loose mode, throw out any that are not valid comparators
31683
+ rangeList = rangeList.filter(comp => {
31684
+ debug('loose invalid filter', comp, this.options);
31685
+ return !!comp.match(re[t.COMPARATORLOOSE]);
31686
+ });
31687
+ }
31688
+ debug('range list', rangeList);
31709
31689
 
31710
- function requireRange () {
31711
- if (hasRequiredRange) return range;
31712
- hasRequiredRange = 1;
31713
-
31714
- const SPACE_CHARACTERS = /\s+/g;
31715
-
31716
- // hoisted class for cyclic dependency
31717
- class Range {
31718
- constructor (range, options) {
31719
- options = parseOptions(options);
31720
-
31721
- if (range instanceof Range) {
31722
- if (
31723
- range.loose === !!options.loose &&
31724
- range.includePrerelease === !!options.includePrerelease
31725
- ) {
31726
- return range
31727
- } else {
31728
- return new Range(range.raw, options)
31729
- }
31730
- }
31731
-
31732
- if (range instanceof Comparator) {
31733
- // just put it in the set and return
31734
- this.raw = range.value;
31735
- this.set = [[range]];
31736
- this.formatted = undefined;
31737
- return this
31738
- }
31739
-
31740
- this.options = options;
31741
- this.loose = !!options.loose;
31742
- this.includePrerelease = !!options.includePrerelease;
31743
-
31744
- // First reduce all whitespace as much as possible so we do not have to rely
31745
- // on potentially slow regexes like \s*. This is then stored and used for
31746
- // future error messages as well.
31747
- this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
31748
-
31749
- // First, split on ||
31750
- this.set = this.raw
31751
- .split('||')
31752
- // map the range to a 2d array of comparators
31753
- .map(r => this.parseRange(r.trim()))
31754
- // throw out any comparator lists that are empty
31755
- // this generally means that it was not a valid range, which is allowed
31756
- // in loose mode, but will still throw if the WHOLE range is invalid.
31757
- .filter(c => c.length);
31758
-
31759
- if (!this.set.length) {
31760
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
31761
- }
31762
-
31763
- // if we have any that are not the null set, throw out null sets.
31764
- if (this.set.length > 1) {
31765
- // keep the first one, in case they're all null sets
31766
- const first = this.set[0];
31767
- this.set = this.set.filter(c => !isNullSet(c[0]));
31768
- if (this.set.length === 0) {
31769
- this.set = [first];
31770
- } else if (this.set.length > 1) {
31771
- // if we have any that are *, then the range is just *
31772
- for (const c of this.set) {
31773
- if (c.length === 1 && isAny(c[0])) {
31774
- this.set = [c];
31775
- break
31776
- }
31777
- }
31778
- }
31779
- }
31780
-
31781
- this.formatted = undefined;
31782
- }
31783
-
31784
- get range () {
31785
- if (this.formatted === undefined) {
31786
- this.formatted = '';
31787
- for (let i = 0; i < this.set.length; i++) {
31788
- if (i > 0) {
31789
- this.formatted += '||';
31790
- }
31791
- const comps = this.set[i];
31792
- for (let k = 0; k < comps.length; k++) {
31793
- if (k > 0) {
31794
- this.formatted += ' ';
31795
- }
31796
- this.formatted += comps[k].toString().trim();
31797
- }
31798
- }
31799
- }
31800
- return this.formatted
31801
- }
31802
-
31803
- format () {
31804
- return this.range
31805
- }
31806
-
31807
- toString () {
31808
- return this.range
31809
- }
31810
-
31811
- parseRange (range) {
31812
- // memoize range parsing for performance.
31813
- // this is a very hot path, and fully deterministic.
31814
- const memoOpts =
31815
- (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
31816
- (this.options.loose && FLAG_LOOSE);
31817
- const memoKey = memoOpts + ':' + range;
31818
- const cached = cache.get(memoKey);
31819
- if (cached) {
31820
- return cached
31821
- }
31822
-
31823
- const loose = this.options.loose;
31824
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
31825
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
31826
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
31827
- debug('hyphen replace', range);
31828
-
31829
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
31830
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
31831
- debug('comparator trim', range);
31832
-
31833
- // `~ 1.2.3` => `~1.2.3`
31834
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
31835
- debug('tilde trim', range);
31836
-
31837
- // `^ 1.2.3` => `^1.2.3`
31838
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
31839
- debug('caret trim', range);
31840
-
31841
- // At this point, the range is completely trimmed and
31842
- // ready to be split into comparators.
31843
-
31844
- let rangeList = range
31845
- .split(' ')
31846
- .map(comp => parseComparator(comp, this.options))
31847
- .join(' ')
31848
- .split(/\s+/)
31849
- // >=0.0.0 is equivalent to *
31850
- .map(comp => replaceGTE0(comp, this.options));
31851
-
31852
- if (loose) {
31853
- // in loose mode, throw out any that are not valid comparators
31854
- rangeList = rangeList.filter(comp => {
31855
- debug('loose invalid filter', comp, this.options);
31856
- return !!comp.match(re[t.COMPARATORLOOSE])
31857
- });
31858
- }
31859
- debug('range list', rangeList);
31860
-
31861
- // if any comparators are the null set, then replace with JUST null set
31862
- // if more than one comparator, remove any * comparators
31863
- // also, don't include the same comparator more than once
31864
- const rangeMap = new Map();
31865
- const comparators = rangeList.map(comp => new Comparator(comp, this.options));
31866
- for (const comp of comparators) {
31867
- if (isNullSet(comp)) {
31868
- return [comp]
31869
- }
31870
- rangeMap.set(comp.value, comp);
31871
- }
31872
- if (rangeMap.size > 1 && rangeMap.has('')) {
31873
- rangeMap.delete('');
31874
- }
31875
-
31876
- const result = [...rangeMap.values()];
31877
- cache.set(memoKey, result);
31878
- return result
31879
- }
31880
-
31881
- intersects (range, options) {
31882
- if (!(range instanceof Range)) {
31883
- throw new TypeError('a Range is required')
31884
- }
31885
-
31886
- return this.set.some((thisComparators) => {
31887
- return (
31888
- isSatisfiable(thisComparators, options) &&
31889
- range.set.some((rangeComparators) => {
31890
- return (
31891
- isSatisfiable(rangeComparators, options) &&
31892
- thisComparators.every((thisComparator) => {
31893
- return rangeComparators.every((rangeComparator) => {
31894
- return thisComparator.intersects(rangeComparator, options)
31895
- })
31896
- })
31897
- )
31898
- })
31899
- )
31900
- })
31901
- }
31902
-
31903
- // if ANY of the sets match ALL of its comparators, then pass
31904
- test (version) {
31905
- if (!version) {
31906
- return false
31907
- }
31908
-
31909
- if (typeof version === 'string') {
31910
- try {
31911
- version = new SemVer(version, this.options);
31912
- } catch (er) {
31913
- return false
31914
- }
31915
- }
31916
-
31917
- for (let i = 0; i < this.set.length; i++) {
31918
- if (testSet(this.set[i], version, this.options)) {
31919
- return true
31920
- }
31921
- }
31922
- return false
31923
- }
31924
- }
31925
-
31926
- range = Range;
31927
-
31928
- const LRU = requireLrucache();
31929
- const cache = new LRU();
31930
-
31931
- const parseOptions = requireParseOptions();
31932
- const Comparator = requireComparator();
31933
- const debug = requireDebug();
31934
- const SemVer = requireSemver();
31935
- const {
31936
- safeRe: re,
31937
- t,
31938
- comparatorTrimReplace,
31939
- tildeTrimReplace,
31940
- caretTrimReplace,
31941
- } = requireRe();
31942
- const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
31943
-
31944
- const isNullSet = c => c.value === '<0.0.0-0';
31945
- const isAny = c => c.value === '';
31946
-
31947
- // take a set of comparators and determine whether there
31948
- // exists a version which can satisfy it
31949
- const isSatisfiable = (comparators, options) => {
31950
- let result = true;
31951
- const remainingComparators = comparators.slice();
31952
- let testComparator = remainingComparators.pop();
31953
-
31954
- while (result && remainingComparators.length) {
31955
- result = remainingComparators.every((otherComparator) => {
31956
- return testComparator.intersects(otherComparator, options)
31957
- });
31958
-
31959
- testComparator = remainingComparators.pop();
31960
- }
31961
-
31962
- return result
31963
- };
31964
-
31965
- // comprised of xranges, tildes, stars, and gtlt's at this point.
31966
- // already replaced the hyphen ranges
31967
- // turn into a set of JUST comparators.
31968
- const parseComparator = (comp, options) => {
31969
- debug('comp', comp, options);
31970
- comp = replaceCarets(comp, options);
31971
- debug('caret', comp);
31972
- comp = replaceTildes(comp, options);
31973
- debug('tildes', comp);
31974
- comp = replaceXRanges(comp, options);
31975
- debug('xrange', comp);
31976
- comp = replaceStars(comp, options);
31977
- debug('stars', comp);
31978
- return comp
31979
- };
31980
-
31981
- const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
31982
-
31983
- // ~, ~> --> * (any, kinda silly)
31984
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
31985
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
31986
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
31987
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
31988
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
31989
- // ~0.0.1 --> >=0.0.1 <0.1.0-0
31990
- const replaceTildes = (comp, options) => {
31991
- return comp
31992
- .trim()
31993
- .split(/\s+/)
31994
- .map((c) => replaceTilde(c, options))
31995
- .join(' ')
31996
- };
31997
-
31998
- const replaceTilde = (comp, options) => {
31999
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
32000
- return comp.replace(r, (_, M, m, p, pr) => {
32001
- debug('tilde', comp, _, M, m, p, pr);
32002
- let ret;
32003
-
32004
- if (isX(M)) {
32005
- ret = '';
32006
- } else if (isX(m)) {
32007
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
32008
- } else if (isX(p)) {
32009
- // ~1.2 == >=1.2.0 <1.3.0-0
32010
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
32011
- } else if (pr) {
32012
- debug('replaceTilde pr', pr);
32013
- ret = `>=${M}.${m}.${p}-${pr
32014
- } <${M}.${+m + 1}.0-0`;
32015
- } else {
32016
- // ~1.2.3 == >=1.2.3 <1.3.0-0
32017
- ret = `>=${M}.${m}.${p
32018
- } <${M}.${+m + 1}.0-0`;
32019
- }
32020
-
32021
- debug('tilde return', ret);
32022
- return ret
32023
- })
32024
- };
32025
-
32026
- // ^ --> * (any, kinda silly)
32027
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
32028
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
32029
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
32030
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
32031
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
32032
- // ^0.0.1 --> >=0.0.1 <0.0.2-0
32033
- // ^0.1.0 --> >=0.1.0 <0.2.0-0
32034
- const replaceCarets = (comp, options) => {
32035
- return comp
32036
- .trim()
32037
- .split(/\s+/)
32038
- .map((c) => replaceCaret(c, options))
32039
- .join(' ')
32040
- };
32041
-
32042
- const replaceCaret = (comp, options) => {
32043
- debug('caret', comp, options);
32044
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
32045
- const z = options.includePrerelease ? '-0' : '';
32046
- return comp.replace(r, (_, M, m, p, pr) => {
32047
- debug('caret', comp, _, M, m, p, pr);
32048
- let ret;
32049
-
32050
- if (isX(M)) {
32051
- ret = '';
32052
- } else if (isX(m)) {
32053
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
32054
- } else if (isX(p)) {
32055
- if (M === '0') {
32056
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
32057
- } else {
32058
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
32059
- }
32060
- } else if (pr) {
32061
- debug('replaceCaret pr', pr);
32062
- if (M === '0') {
32063
- if (m === '0') {
32064
- ret = `>=${M}.${m}.${p}-${pr
32065
- } <${M}.${m}.${+p + 1}-0`;
32066
- } else {
32067
- ret = `>=${M}.${m}.${p}-${pr
32068
- } <${M}.${+m + 1}.0-0`;
32069
- }
32070
- } else {
32071
- ret = `>=${M}.${m}.${p}-${pr
32072
- } <${+M + 1}.0.0-0`;
32073
- }
32074
- } else {
32075
- debug('no pr');
32076
- if (M === '0') {
32077
- if (m === '0') {
32078
- ret = `>=${M}.${m}.${p
32079
- }${z} <${M}.${m}.${+p + 1}-0`;
32080
- } else {
32081
- ret = `>=${M}.${m}.${p
32082
- }${z} <${M}.${+m + 1}.0-0`;
32083
- }
32084
- } else {
32085
- ret = `>=${M}.${m}.${p
32086
- } <${+M + 1}.0.0-0`;
32087
- }
32088
- }
32089
-
32090
- debug('caret return', ret);
32091
- return ret
32092
- })
32093
- };
32094
-
32095
- const replaceXRanges = (comp, options) => {
32096
- debug('replaceXRanges', comp, options);
32097
- return comp
32098
- .split(/\s+/)
32099
- .map((c) => replaceXRange(c, options))
32100
- .join(' ')
32101
- };
32102
-
32103
- const replaceXRange = (comp, options) => {
32104
- comp = comp.trim();
32105
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
32106
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
32107
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
32108
- const xM = isX(M);
32109
- const xm = xM || isX(m);
32110
- const xp = xm || isX(p);
32111
- const anyX = xp;
32112
-
32113
- if (gtlt === '=' && anyX) {
32114
- gtlt = '';
32115
- }
32116
-
32117
- // if we're including prereleases in the match, then we need
32118
- // to fix this to -0, the lowest possible prerelease value
32119
- pr = options.includePrerelease ? '-0' : '';
32120
-
32121
- if (xM) {
32122
- if (gtlt === '>' || gtlt === '<') {
32123
- // nothing is allowed
32124
- ret = '<0.0.0-0';
32125
- } else {
32126
- // nothing is forbidden
32127
- ret = '*';
32128
- }
32129
- } else if (gtlt && anyX) {
32130
- // we know patch is an x, because we have any x at all.
32131
- // replace X with 0
32132
- if (xm) {
32133
- m = 0;
32134
- }
32135
- p = 0;
32136
-
32137
- if (gtlt === '>') {
32138
- // >1 => >=2.0.0
32139
- // >1.2 => >=1.3.0
32140
- gtlt = '>=';
32141
- if (xm) {
32142
- M = +M + 1;
32143
- m = 0;
32144
- p = 0;
32145
- } else {
32146
- m = +m + 1;
32147
- p = 0;
32148
- }
32149
- } else if (gtlt === '<=') {
32150
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
32151
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
32152
- gtlt = '<';
32153
- if (xm) {
32154
- M = +M + 1;
32155
- } else {
32156
- m = +m + 1;
32157
- }
32158
- }
32159
-
32160
- if (gtlt === '<') {
32161
- pr = '-0';
32162
- }
32163
-
32164
- ret = `${gtlt + M}.${m}.${p}${pr}`;
32165
- } else if (xm) {
32166
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
32167
- } else if (xp) {
32168
- ret = `>=${M}.${m}.0${pr
32169
- } <${M}.${+m + 1}.0-0`;
32170
- }
32171
-
32172
- debug('xRange return', ret);
32173
-
32174
- return ret
32175
- })
32176
- };
32177
-
32178
- // Because * is AND-ed with everything else in the comparator,
32179
- // and '' means "any version", just remove the *s entirely.
32180
- const replaceStars = (comp, options) => {
32181
- debug('replaceStars', comp, options);
32182
- // Looseness is ignored here. star is always as loose as it gets!
32183
- return comp
32184
- .trim()
32185
- .replace(re[t.STAR], '')
32186
- };
32187
-
32188
- const replaceGTE0 = (comp, options) => {
32189
- debug('replaceGTE0', comp, options);
32190
- return comp
32191
- .trim()
32192
- .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
32193
- };
32194
-
32195
- // This function is passed to string.replace(re[t.HYPHENRANGE])
32196
- // M, m, patch, prerelease, build
32197
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
32198
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
32199
- // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
32200
- // TODO build?
32201
- const hyphenReplace = incPr => ($0,
32202
- from, fM, fm, fp, fpr, fb,
32203
- to, tM, tm, tp, tpr) => {
32204
- if (isX(fM)) {
32205
- from = '';
32206
- } else if (isX(fm)) {
32207
- from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
32208
- } else if (isX(fp)) {
32209
- from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
32210
- } else if (fpr) {
32211
- from = `>=${from}`;
32212
- } else {
32213
- from = `>=${from}${incPr ? '-0' : ''}`;
32214
- }
32215
-
32216
- if (isX(tM)) {
32217
- to = '';
32218
- } else if (isX(tm)) {
32219
- to = `<${+tM + 1}.0.0-0`;
32220
- } else if (isX(tp)) {
32221
- to = `<${tM}.${+tm + 1}.0-0`;
32222
- } else if (tpr) {
32223
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
32224
- } else if (incPr) {
32225
- to = `<${tM}.${tm}.${+tp + 1}-0`;
32226
- } else {
32227
- to = `<=${to}`;
32228
- }
31690
+ // if any comparators are the null set, then replace with JUST null set
31691
+ // if more than one comparator, remove any * comparators
31692
+ // also, don't include the same comparator more than once
31693
+ const rangeMap = new Map();
31694
+ const comparators = rangeList.map(comp => new Comparator(comp, this.options));
31695
+ for (const comp of comparators) {
31696
+ if (isNullSet(comp)) {
31697
+ return [comp];
31698
+ }
31699
+ rangeMap.set(comp.value, comp);
31700
+ }
31701
+ if (rangeMap.size > 1 && rangeMap.has('')) {
31702
+ rangeMap.delete('');
31703
+ }
31704
+ const result = [...rangeMap.values()];
31705
+ cache.set(memoKey, result);
31706
+ return result;
31707
+ }
31708
+ intersects(range, options) {
31709
+ if (!(range instanceof Range)) {
31710
+ throw new TypeError('a Range is required');
31711
+ }
31712
+ return this.set.some(thisComparators => {
31713
+ return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {
31714
+ return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {
31715
+ return rangeComparators.every(rangeComparator => {
31716
+ return thisComparator.intersects(rangeComparator, options);
31717
+ });
31718
+ });
31719
+ });
31720
+ });
31721
+ }
32229
31722
 
32230
- return `${from} ${to}`.trim()
32231
- };
31723
+ // if ANY of the sets match ALL of its comparators, then pass
31724
+ test(version) {
31725
+ if (!version) {
31726
+ return false;
31727
+ }
31728
+ if (typeof version === 'string') {
31729
+ try {
31730
+ version = new SemVer(version, this.options);
31731
+ } catch (er) {
31732
+ return false;
31733
+ }
31734
+ }
31735
+ for (let i = 0; i < this.set.length; i++) {
31736
+ if (testSet(this.set[i], version, this.options)) {
31737
+ return true;
31738
+ }
31739
+ }
31740
+ return false;
31741
+ }
31742
+ }
31743
+ range = Range;
31744
+ const LRU = requireLrucache();
31745
+ const cache = new LRU();
31746
+ const parseOptions = requireParseOptions();
31747
+ const Comparator = requireComparator();
31748
+ const debug = requireDebug();
31749
+ const SemVer = requireSemver();
31750
+ const {
31751
+ safeRe: re,
31752
+ t,
31753
+ comparatorTrimReplace,
31754
+ tildeTrimReplace,
31755
+ caretTrimReplace
31756
+ } = requireRe();
31757
+ const {
31758
+ FLAG_INCLUDE_PRERELEASE,
31759
+ FLAG_LOOSE
31760
+ } = requireConstants();
31761
+ const isNullSet = c => c.value === '<0.0.0-0';
31762
+ const isAny = c => c.value === '';
31763
+
31764
+ // take a set of comparators and determine whether there
31765
+ // exists a version which can satisfy it
31766
+ const isSatisfiable = (comparators, options) => {
31767
+ let result = true;
31768
+ const remainingComparators = comparators.slice();
31769
+ let testComparator = remainingComparators.pop();
31770
+ while (result && remainingComparators.length) {
31771
+ result = remainingComparators.every(otherComparator => {
31772
+ return testComparator.intersects(otherComparator, options);
31773
+ });
31774
+ testComparator = remainingComparators.pop();
31775
+ }
31776
+ return result;
31777
+ };
32232
31778
 
32233
- const testSet = (set, version, options) => {
32234
- for (let i = 0; i < set.length; i++) {
32235
- if (!set[i].test(version)) {
32236
- return false
32237
- }
32238
- }
31779
+ // comprised of xranges, tildes, stars, and gtlt's at this point.
31780
+ // already replaced the hyphen ranges
31781
+ // turn into a set of JUST comparators.
31782
+ const parseComparator = (comp, options) => {
31783
+ debug('comp', comp, options);
31784
+ comp = replaceCarets(comp, options);
31785
+ debug('caret', comp);
31786
+ comp = replaceTildes(comp, options);
31787
+ debug('tildes', comp);
31788
+ comp = replaceXRanges(comp, options);
31789
+ debug('xrange', comp);
31790
+ comp = replaceStars(comp, options);
31791
+ debug('stars', comp);
31792
+ return comp;
31793
+ };
31794
+ const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
31795
+
31796
+ // ~, ~> --> * (any, kinda silly)
31797
+ // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
31798
+ // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
31799
+ // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
31800
+ // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
31801
+ // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
31802
+ // ~0.0.1 --> >=0.0.1 <0.1.0-0
31803
+ const replaceTildes = (comp, options) => {
31804
+ return comp.trim().split(/\s+/).map(c => replaceTilde(c, options)).join(' ');
31805
+ };
31806
+ const replaceTilde = (comp, options) => {
31807
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
31808
+ return comp.replace(r, (_, M, m, p, pr) => {
31809
+ debug('tilde', comp, _, M, m, p, pr);
31810
+ let ret;
31811
+ if (isX(M)) {
31812
+ ret = '';
31813
+ } else if (isX(m)) {
31814
+ ret = ">=".concat(M, ".0.0 <").concat(+M + 1, ".0.0-0");
31815
+ } else if (isX(p)) {
31816
+ // ~1.2 == >=1.2.0 <1.3.0-0
31817
+ ret = ">=".concat(M, ".").concat(m, ".0 <").concat(M, ".").concat(+m + 1, ".0-0");
31818
+ } else if (pr) {
31819
+ debug('replaceTilde pr', pr);
31820
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
31821
+ } else {
31822
+ // ~1.2.3 == >=1.2.3 <1.3.0-0
31823
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(M, ".").concat(+m + 1, ".0-0");
31824
+ }
31825
+ debug('tilde return', ret);
31826
+ return ret;
31827
+ });
31828
+ };
32239
31829
 
32240
- if (version.prerelease.length && !options.includePrerelease) {
32241
- // Find the set of versions that are allowed to have prereleases
32242
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
32243
- // That should allow `1.2.3-pr.2` to pass.
32244
- // However, `1.2.4-alpha.notready` should NOT be allowed,
32245
- // even though it's within the range set by the comparators.
32246
- for (let i = 0; i < set.length; i++) {
32247
- debug(set[i].semver);
32248
- if (set[i].semver === Comparator.ANY) {
32249
- continue
32250
- }
31830
+ // ^ --> * (any, kinda silly)
31831
+ // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
31832
+ // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
31833
+ // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
31834
+ // ^1.2.3 --> >=1.2.3 <2.0.0-0
31835
+ // ^1.2.0 --> >=1.2.0 <2.0.0-0
31836
+ // ^0.0.1 --> >=0.0.1 <0.0.2-0
31837
+ // ^0.1.0 --> >=0.1.0 <0.2.0-0
31838
+ const replaceCarets = (comp, options) => {
31839
+ return comp.trim().split(/\s+/).map(c => replaceCaret(c, options)).join(' ');
31840
+ };
31841
+ const replaceCaret = (comp, options) => {
31842
+ debug('caret', comp, options);
31843
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
31844
+ const z = options.includePrerelease ? '-0' : '';
31845
+ return comp.replace(r, (_, M, m, p, pr) => {
31846
+ debug('caret', comp, _, M, m, p, pr);
31847
+ let ret;
31848
+ if (isX(M)) {
31849
+ ret = '';
31850
+ } else if (isX(m)) {
31851
+ ret = ">=".concat(M, ".0.0").concat(z, " <").concat(+M + 1, ".0.0-0");
31852
+ } else if (isX(p)) {
31853
+ if (M === '0') {
31854
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
31855
+ } else {
31856
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(+M + 1, ".0.0-0");
31857
+ }
31858
+ } else if (pr) {
31859
+ debug('replaceCaret pr', pr);
31860
+ if (M === '0') {
31861
+ if (m === '0') {
31862
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
31863
+ } else {
31864
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
31865
+ }
31866
+ } else {
31867
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(+M + 1, ".0.0-0");
31868
+ }
31869
+ } else {
31870
+ debug('no pr');
31871
+ if (M === '0') {
31872
+ if (m === '0') {
31873
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
31874
+ } else {
31875
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
31876
+ }
31877
+ } else {
31878
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(+M + 1, ".0.0-0");
31879
+ }
31880
+ }
31881
+ debug('caret return', ret);
31882
+ return ret;
31883
+ });
31884
+ };
31885
+ const replaceXRanges = (comp, options) => {
31886
+ debug('replaceXRanges', comp, options);
31887
+ return comp.split(/\s+/).map(c => replaceXRange(c, options)).join(' ');
31888
+ };
31889
+ const replaceXRange = (comp, options) => {
31890
+ comp = comp.trim();
31891
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
31892
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
31893
+ debug('xRange', comp, ret, gtlt, M, m, p, pr);
31894
+ const xM = isX(M);
31895
+ const xm = xM || isX(m);
31896
+ const xp = xm || isX(p);
31897
+ const anyX = xp;
31898
+ if (gtlt === '=' && anyX) {
31899
+ gtlt = '';
31900
+ }
31901
+
31902
+ // if we're including prereleases in the match, then we need
31903
+ // to fix this to -0, the lowest possible prerelease value
31904
+ pr = options.includePrerelease ? '-0' : '';
31905
+ if (xM) {
31906
+ if (gtlt === '>' || gtlt === '<') {
31907
+ // nothing is allowed
31908
+ ret = '<0.0.0-0';
31909
+ } else {
31910
+ // nothing is forbidden
31911
+ ret = '*';
31912
+ }
31913
+ } else if (gtlt && anyX) {
31914
+ // we know patch is an x, because we have any x at all.
31915
+ // replace X with 0
31916
+ if (xm) {
31917
+ m = 0;
31918
+ }
31919
+ p = 0;
31920
+ if (gtlt === '>') {
31921
+ // >1 => >=2.0.0
31922
+ // >1.2 => >=1.3.0
31923
+ gtlt = '>=';
31924
+ if (xm) {
31925
+ M = +M + 1;
31926
+ m = 0;
31927
+ p = 0;
31928
+ } else {
31929
+ m = +m + 1;
31930
+ p = 0;
31931
+ }
31932
+ } else if (gtlt === '<=') {
31933
+ // <=0.7.x is actually <0.8.0, since any 0.7.x should
31934
+ // pass. Similarly, <=7.x is actually <8.0.0, etc.
31935
+ gtlt = '<';
31936
+ if (xm) {
31937
+ M = +M + 1;
31938
+ } else {
31939
+ m = +m + 1;
31940
+ }
31941
+ }
31942
+ if (gtlt === '<') {
31943
+ pr = '-0';
31944
+ }
31945
+ ret = "".concat(gtlt + M, ".").concat(m, ".").concat(p).concat(pr);
31946
+ } else if (xm) {
31947
+ ret = ">=".concat(M, ".0.0").concat(pr, " <").concat(+M + 1, ".0.0-0");
31948
+ } else if (xp) {
31949
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
31950
+ }
31951
+ debug('xRange return', ret);
31952
+ return ret;
31953
+ });
31954
+ };
32251
31955
 
32252
- if (set[i].semver.prerelease.length > 0) {
32253
- const allowed = set[i].semver;
32254
- if (allowed.major === version.major &&
32255
- allowed.minor === version.minor &&
32256
- allowed.patch === version.patch) {
32257
- return true
32258
- }
32259
- }
32260
- }
31956
+ // Because * is AND-ed with everything else in the comparator,
31957
+ // and '' means "any version", just remove the *s entirely.
31958
+ const replaceStars = (comp, options) => {
31959
+ debug('replaceStars', comp, options);
31960
+ // Looseness is ignored here. star is always as loose as it gets!
31961
+ return comp.trim().replace(re[t.STAR], '');
31962
+ };
31963
+ const replaceGTE0 = (comp, options) => {
31964
+ debug('replaceGTE0', comp, options);
31965
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');
31966
+ };
32261
31967
 
32262
- // Version has a -pre, but it's not one of the ones we like.
32263
- return false
32264
- }
31968
+ // This function is passed to string.replace(re[t.HYPHENRANGE])
31969
+ // M, m, patch, prerelease, build
31970
+ // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
31971
+ // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
31972
+ // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
31973
+ // TODO build?
31974
+ const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
31975
+ if (isX(fM)) {
31976
+ from = '';
31977
+ } else if (isX(fm)) {
31978
+ from = ">=".concat(fM, ".0.0").concat(incPr ? '-0' : '');
31979
+ } else if (isX(fp)) {
31980
+ from = ">=".concat(fM, ".").concat(fm, ".0").concat(incPr ? '-0' : '');
31981
+ } else if (fpr) {
31982
+ from = ">=".concat(from);
31983
+ } else {
31984
+ from = ">=".concat(from).concat(incPr ? '-0' : '');
31985
+ }
31986
+ if (isX(tM)) {
31987
+ to = '';
31988
+ } else if (isX(tm)) {
31989
+ to = "<".concat(+tM + 1, ".0.0-0");
31990
+ } else if (isX(tp)) {
31991
+ to = "<".concat(tM, ".").concat(+tm + 1, ".0-0");
31992
+ } else if (tpr) {
31993
+ to = "<=".concat(tM, ".").concat(tm, ".").concat(tp, "-").concat(tpr);
31994
+ } else if (incPr) {
31995
+ to = "<".concat(tM, ".").concat(tm, ".").concat(+tp + 1, "-0");
31996
+ } else {
31997
+ to = "<=".concat(to);
31998
+ }
31999
+ return "".concat(from, " ").concat(to).trim();
32000
+ };
32001
+ const testSet = (set, version, options) => {
32002
+ for (let i = 0; i < set.length; i++) {
32003
+ if (!set[i].test(version)) {
32004
+ return false;
32005
+ }
32006
+ }
32007
+ if (version.prerelease.length && !options.includePrerelease) {
32008
+ // Find the set of versions that are allowed to have prereleases
32009
+ // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
32010
+ // That should allow `1.2.3-pr.2` to pass.
32011
+ // However, `1.2.4-alpha.notready` should NOT be allowed,
32012
+ // even though it's within the range set by the comparators.
32013
+ for (let i = 0; i < set.length; i++) {
32014
+ debug(set[i].semver);
32015
+ if (set[i].semver === Comparator.ANY) {
32016
+ continue;
32017
+ }
32018
+ if (set[i].semver.prerelease.length > 0) {
32019
+ const allowed = set[i].semver;
32020
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
32021
+ return true;
32022
+ }
32023
+ }
32024
+ }
32265
32025
 
32266
- return true
32267
- };
32268
- return range;
32026
+ // Version has a -pre, but it's not one of the ones we like.
32027
+ return false;
32028
+ }
32029
+ return true;
32030
+ };
32031
+ return range;
32269
32032
  }
32270
32033
 
32271
32034
  var satisfies_1;
32272
32035
  var hasRequiredSatisfies;
32273
-
32274
- function requireSatisfies () {
32275
- if (hasRequiredSatisfies) return satisfies_1;
32276
- hasRequiredSatisfies = 1;
32277
-
32278
- const Range = requireRange();
32279
- const satisfies = (version, range, options) => {
32280
- try {
32281
- range = new Range(range, options);
32282
- } catch (er) {
32283
- return false
32284
- }
32285
- return range.test(version)
32286
- };
32287
- satisfies_1 = satisfies;
32288
- return satisfies_1;
32036
+ function requireSatisfies() {
32037
+ if (hasRequiredSatisfies) return satisfies_1;
32038
+ hasRequiredSatisfies = 1;
32039
+ const Range = requireRange();
32040
+ const satisfies = (version, range, options) => {
32041
+ try {
32042
+ range = new Range(range, options);
32043
+ } catch (er) {
32044
+ return false;
32045
+ }
32046
+ return range.test(version);
32047
+ };
32048
+ satisfies_1 = satisfies;
32049
+ return satisfies_1;
32289
32050
  }
32290
32051
 
32291
32052
  var satisfiesExports = requireSatisfies();