Comparing version 3.0.1 to 4.0.0
{ | ||
"name": "semver", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "The semantic version parser used by npm.", | ||
@@ -5,0 +5,0 @@ "main": "semver.js", |
203
README.md
@@ -44,50 +44,167 @@ semver(1) -- The semantic versioner for npm | ||
The following range styles are supported: | ||
A `version range` is a set of `comparators` which specify versions | ||
that satisfy the range. | ||
* `1.2.3` A specific version. When nothing else will do. Must be a full | ||
version number, with major, minor, and patch versions specified. | ||
Note that build metadata is still ignored, so `1.2.3+build2012` will | ||
satisfy this range. | ||
* `>1.2.3` Greater than a specific version. | ||
* `<1.2.3` Less than a specific version. If there is no prerelease | ||
tag on the version range, then no prerelease version will be allowed | ||
either, even though these are technically "less than". | ||
* `>=1.2.3` Greater than or equal to. Note that prerelease versions | ||
are NOT equal to their "normal" equivalents, so `1.2.3-beta` will | ||
not satisfy this range, but `2.3.0-beta` will. | ||
* `<=1.2.3` Less than or equal to. In this case, prerelease versions | ||
ARE allowed, so `1.2.3-beta` would satisfy. | ||
A `comparator` is composed of an `operator` and a `version`. The set | ||
of primitive `operators` is: | ||
* `<` Less than | ||
* `<=` Less than or equal to | ||
* `>` Greater than | ||
* `>=` Greater than or equal to | ||
* `=` Equal. If no operator is specified, then equality is assumed, | ||
so this operator is optional, but MAY be included. | ||
For example, the comparator `>=1.2.7` would match the versions | ||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` | ||
or `1.1.0`. | ||
Comparators can be joined by whitespace to form a `comparator set`, | ||
which is satisfied by the **intersection** of all of the comparators | ||
it includes. | ||
A range is composed of one or more comparator sets, joined by `||`. A | ||
version matches a range if and only if every comparator in at least | ||
one of the `||`-separated comparator sets is satisfied by the version. | ||
For example, the range `>=1.2.7 <1.3.0` would match the versions | ||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, | ||
or `1.1.0`. | ||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, | ||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. | ||
### Prerelease Tags | ||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then | ||
it will only be allowed to satisfy comparator sets if at least one | ||
comparator with the same `[major, minor, patch]` tuple also has a | ||
prerelease tag. | ||
For example, the range `>1.2.3-alpha.3` would be allowed to match the | ||
version `1.2.3-alpha.7`, but it would *not* be satisfied by | ||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater | ||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version | ||
range only accepts prerelease tags on the `1.2.3` version. The | ||
version `3.4.5` *would* satisfy the range, because it does not have a | ||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. | ||
The purpose for this behavior is twofold. First, prerelease versions | ||
frequently are updated very quickly, and contain many breaking changes | ||
that are (by the author's design) not yet fit for public consumption. | ||
Therefore, by default, they are excluded from range matching | ||
semantics. | ||
Second, a user who has opted into using a prerelease version has | ||
clearly indicated the intent to use *that specific* set of | ||
alpha/beta/rc versions. By including a prerelease tag in the range, | ||
the user is indicating that they are aware of the risk. However, it | ||
is still not appropriate to assume that they have opted into taking a | ||
similar risk on the *next* set of prerelease versions. | ||
### Advanced Range Syntax | ||
Advanced range syntax desugars to primitive comparators in | ||
deterministic ways. | ||
Advanced ranges may be combined in the same way as primitive | ||
comparators using white space or `||`. | ||
#### Hyphen Ranges `X.Y.Z - A.B.C` | ||
Specifies an inclusive set. | ||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` | ||
* `~1.2.3` := `>=1.2.3-0 <1.3.0-0` "Reasonably close to `1.2.3`". When | ||
using tilde operators, prerelease versions are supported as well, | ||
but a prerelease of the next significant digit will NOT be | ||
satisfactory, so `1.3.0-beta` will not satisfy `~1.2.3`. | ||
* `^1.2.3` := `>=1.2.3-0 <2.0.0-0` "Compatible with `1.2.3`". When | ||
using caret operators, anything from the specified version (including | ||
prerelease) will be supported up to, but not including, the next | ||
major version (or its prereleases). `1.5.1` will satisfy `^1.2.3`, | ||
while `1.2.2` and `2.0.0-beta` will not. | ||
* `^0.1.3` := `0.1.3` "Compatible with `0.1.3`". `0.x.x` versions are | ||
special: since the semver spec specifies that `0.x.x` versions make | ||
no stability guarantees, only the version specified is considered | ||
valid. | ||
* `^0.0.2` := `0.0.2` "Only the version `0.0.2` is considered compatible" | ||
* `~1.2` := `>=1.2.0-0 <1.3.0-0` "Any version starting with `1.2`" | ||
* `^1.2` := `>=1.2.0-0 <2.0.0-0` "Any version compatible with `1.2`" | ||
* `1.2.x` := `>=1.2.0-0 <1.3.0-0` "Any version starting with `1.2`" | ||
* `1.2.*` Same as `1.2.x`. | ||
* `1.2` Same as `1.2.x`. | ||
* `~1` := `>=1.0.0-0 <2.0.0-0` "Any version starting with `1`" | ||
* `^1` := `>=1.0.0-0 <2.0.0-0` "Any version compatible with `1`" | ||
* `1.x` := `>=1.0.0-0 <2.0.0-0` "Any version starting with `1`" | ||
* `1.*` Same as `1.x`. | ||
* `1` Same as `1.x`. | ||
* `*` Any version whatsoever. | ||
* `x` Same as `*`. | ||
* `""` (just an empty string) Same as `*`. | ||
If a partial version is provided as the first version in the inclusive | ||
range, then the missing pieces are replaced with zeroes. | ||
Ranges can be joined with either a space (which implies "and") or a | ||
`||` (which implies "or"). | ||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` | ||
If a partial version is provided as the second version in the | ||
inclusive range, then all versions that start with the supplied parts | ||
of the tuple are accepted, but nothing that would be greater than the | ||
provided tuple parts. | ||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` | ||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0` | ||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` | ||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the | ||
numeric values in the `[major, minor, patch]` tuple. | ||
* `*` := `>=0.0.0` (Any version satisfies) | ||
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) | ||
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) | ||
A partial version range is treated as an X-Range, so the special | ||
character is in fact optional. | ||
* `` (empty string) := `*` := `>=0.0.0` | ||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0` | ||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` | ||
#### Tilde Ranges `~1.2.3` `~1.2` `~1` | ||
Allows patch-level changes if a minor version is specified on the | ||
comparator. Allows minor-level changes if not. | ||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` | ||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) | ||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) | ||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` | ||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) | ||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) | ||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in | ||
the `1.2.3` version will be allowed, if they are greater than or | ||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but | ||
`1.2.4-beta.2` would not, because it is a prerelease of a | ||
different `[major, minor, patch]` tuple. | ||
Note: this is the same as the `~>` operator in rubygems. | ||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` | ||
Allows changes that do not modify the left-most non-zero digit in the | ||
`[major, minor, patch]` tuple. In other words, this allows patch and | ||
minor updates for versions `1.0.0` and above, patch updates for | ||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. | ||
Many authors treat a `0.x` version as if the `x` were the major | ||
"breaking-change" indicator. | ||
Caret ranges are ideal when an author may make breaking changes | ||
between `0.2.4` and `0.3.0` releases, which is a common practice. | ||
However, it presumes that there will *not* be breaking changes between | ||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be | ||
additive (but non-breaking), according to commonly observed practices. | ||
* `^1.2.3` := `>=1.2.3 <2.0.0` | ||
* `^0.2.3` := `>=0.2.3 <0.3.0` | ||
* `^0.0.3` := `>=0.0.3 <0.0.4` | ||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in | ||
the `1.2.3` version will be allowed, if they are greater than or | ||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but | ||
`1.2.4-beta.2` would not, because it is a prerelease of a | ||
different `[major, minor, patch]` tuple. | ||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the | ||
`0.0.3` version *only* will be allowed, if they are greater than or | ||
equal to `beta`. So, `0.0.3-pr.2` would be allowed. | ||
When parsing caret ranges, a missing `patch` value desugars to the | ||
number `0`, but will allow flexibility within that value, even if the | ||
major and minor versions are both `0`. | ||
* `^1.2.x` := `>=1.2.0 <2.0.0` | ||
* `^0.0.x` := `>=0.0.0 <0.1.0` | ||
* `^0.0` := `>=0.0.0 <0.1.0` | ||
A missing `minor` and `patch` values will desugar to zero, but also | ||
allow flexibility within those values, even if the major version is | ||
zero. | ||
* `^1.x` := `>=1.0.0 <2.0.0` | ||
* `^0.x` := `>=0.0.0 <1.0.0` | ||
## Functions | ||
@@ -94,0 +211,0 @@ |
@@ -131,4 +131,5 @@ ;(function(exports) { | ||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + | ||
'(?:(' + src[PRERELEASE] + ')' + | ||
')?)?)?'; | ||
'(?:' + src[PRERELEASE] + ')?' + | ||
src[BUILD] + '?' + | ||
')?)?'; | ||
@@ -139,7 +140,6 @@ var XRANGEPLAINLOOSE = R++; | ||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + | ||
'(?:(' + src[PRERELEASELOOSE] + ')' + | ||
')?)?)?'; | ||
'(?:' + src[PRERELEASELOOSE] + ')?' + | ||
src[BUILD] + '?' + | ||
')?)?'; | ||
// >=2.x, for example, means >=2.0.0-0 | ||
// <1.x would be the same as "<1.0.0-0", though. | ||
var XRANGE = R++; | ||
@@ -241,3 +241,3 @@ src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; | ||
function clean(version, loose) { | ||
var s = parse(version.trim().replace(/^[=v]+/, ""), loose); | ||
var s = parse(version.trim().replace(/^[=v]+/, ''), loose); | ||
return s ? s.version : null; | ||
@@ -354,7 +354,12 @@ } | ||
case 'premajor': | ||
this.inc('major'); | ||
this.prerelease.length = 0; | ||
this.patch = 0; | ||
this.minor = 0; | ||
this.major++; | ||
this.inc('pre'); | ||
break; | ||
case 'preminor': | ||
this.inc('minor'); | ||
this.prerelease.length = 0; | ||
this.patch = 0; | ||
this.minor++; | ||
this.inc('pre'); | ||
@@ -377,7 +382,21 @@ break; | ||
break; | ||
case 'major': | ||
this.major++; | ||
this.minor = -1; | ||
// If this is a pre-major version, bump up to the same major version. | ||
// Otherwise increment major. | ||
// 1.0.0-5 bumps to 1.0.0 | ||
// 1.1.0 bumps to 2.0.0 | ||
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) | ||
this.major++; | ||
this.minor = 0; | ||
this.patch = 0; | ||
this.prerelease = []; | ||
break; | ||
case 'minor': | ||
this.minor++; | ||
// If this is a pre-minor version, bump up to the same minor version. | ||
// Otherwise increment minor. | ||
// 1.2.0-5 bumps to 1.2.0 | ||
// 1.2.1 bumps to 1.3.0 | ||
if (this.patch !== 0 || this.prerelease.length === 0) | ||
this.minor++; | ||
this.patch = 0; | ||
@@ -395,4 +414,4 @@ this.prerelease = []; | ||
break; | ||
// This probably shouldn't be used publically. | ||
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. | ||
// This probably shouldn't be used publicly. | ||
// 1.0.0 "pre" would become 1.0.0 which is the wrong direction. | ||
case 'pre': | ||
@@ -517,4 +536,12 @@ if (this.prerelease.length === 0) | ||
switch (op) { | ||
case '===': ret = a === b; break; | ||
case '!==': ret = a !== b; break; | ||
case '===': | ||
if (typeof a === 'object') a = a.version; | ||
if (typeof b === 'object') b = b.version; | ||
ret = a === b; | ||
break; | ||
case '!==': | ||
if (typeof a === 'object') a = a.version; | ||
if (typeof b === 'object') b = b.version; | ||
ret = a !== b; | ||
break; | ||
case '': case '=': case '==': ret = eq(a, b, loose); break; | ||
@@ -551,2 +578,4 @@ case '!=': ret = neq(a, b, loose); break; | ||
this.value = this.operator + this.semver.version; | ||
; | ||
} | ||
@@ -569,17 +598,4 @@ | ||
this.semver = ANY; | ||
else { | ||
else | ||
this.semver = new SemVer(m[2], this.loose); | ||
// <1.2.3-rc DOES allow 1.2.3-beta (has prerelease) | ||
// >=1.2.3 DOES NOT allow 1.2.3-beta | ||
// <=1.2.3 DOES allow 1.2.3-beta | ||
// However, <1.2.3 does NOT allow 1.2.3-beta, | ||
// even though `1.2.3-beta < 1.2.3` | ||
// The assumption is that the 1.2.3 version has something you | ||
// *don't* want, so we push the prerelease down to the minimum. | ||
if (this.operator === '<' && !this.semver.prerelease.length) { | ||
this.semver.prerelease = ['0']; | ||
this.semver.format(); | ||
} | ||
} | ||
}; | ||
@@ -597,4 +613,10 @@ | ||
; | ||
return (this.semver === ANY) ? true : | ||
cmp(version, this.operator, this.semver, this.loose); | ||
if (this.semver === ANY) | ||
return true; | ||
if (typeof version === 'string') | ||
version = new SemVer(version, this.loose); | ||
return cmp(version, this.operator, this.semver, this.loose); | ||
}; | ||
@@ -736,6 +758,6 @@ | ||
else if (isX(m)) | ||
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; | ||
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; | ||
else if (isX(p)) | ||
// ~1.2 == >=1.2.0- <1.3.0- | ||
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; | ||
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; | ||
else if (pr) { | ||
@@ -746,7 +768,7 @@ ; | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + M + '.' + (+m + 1) + '.0-0'; | ||
' <' + M + '.' + (+m + 1) + '.0'; | ||
} else | ||
// ~1.2.3 == >=1.2.3-0 <1.3.0-0 | ||
ret = '>=' + M + '.' + m + '.' + p + '-0' + | ||
' <' + M + '.' + (+m + 1) + '.0-0'; | ||
// ~1.2.3 == >=1.2.3 <1.3.0 | ||
ret = '>=' + M + '.' + m + '.' + p + | ||
' <' + M + '.' + (+m + 1) + '.0'; | ||
@@ -771,2 +793,3 @@ ; | ||
function replaceCaret(comp, loose) { | ||
; | ||
var r = loose ? re[CARETLOOSE] : re[CARET]; | ||
@@ -776,7 +799,2 @@ return comp.replace(r, function(_, M, m, p, pr) { | ||
var ret; | ||
if (pr) { | ||
if (pr.charAt(0) !== '-') | ||
pr = '-' + pr; | ||
} else | ||
pr = ''; | ||
@@ -786,16 +804,35 @@ if (isX(M)) | ||
else if (isX(m)) | ||
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; | ||
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; | ||
else if (isX(p)) { | ||
if (M === '0') | ||
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; | ||
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; | ||
else | ||
ret = '>=' + M + '.' + m + '.0-0 <' + (+M + 1) + '.0.0-0'; | ||
} else if (M === '0') | ||
ret = '=' + M + '.' + m + '.' + p + pr; | ||
else if (pr) | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + (+M + 1) + '.0.0-0'; | ||
else | ||
ret = '>=' + M + '.' + m + '.' + p + '-0' + | ||
' <' + (+M + 1) + '.0.0-0'; | ||
ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; | ||
} else if (pr) { | ||
; | ||
if (pr.charAt(0) !== '-') | ||
pr = '-' + pr; | ||
if (M === '0') { | ||
if (m === '0') | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + M + '.' + m + '.' + (+p + 1); | ||
else | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + M + '.' + (+m + 1) + '.0'; | ||
} else | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + (+M + 1) + '.0.0'; | ||
} else { | ||
; | ||
if (M === '0') { | ||
if (m === '0') | ||
ret = '>=' + M + '.' + m + '.' + p + | ||
' <' + M + '.' + m + '.' + (+p + 1); | ||
else | ||
ret = '>=' + M + '.' + m + '.' + p + | ||
' <' + M + '.' + (+m + 1) + '.0'; | ||
} else | ||
ret = '>=' + M + '.' + m + '.' + p + | ||
' <' + (+M + 1) + '.0.0'; | ||
} | ||
@@ -828,3 +865,3 @@ ; | ||
if (gtlt && anyX) { | ||
// replace X with 0, and then append the -0 min-prerelease | ||
// replace X with 0 | ||
if (xM) | ||
@@ -838,5 +875,5 @@ M = 0; | ||
if (gtlt === '>') { | ||
// >1 => >=2.0.0-0 | ||
// >1.2 => >=1.3.0-0 | ||
// >1.2.3 => >= 1.2.4-0 | ||
// >1 => >=2.0.0 | ||
// >1.2 => >=1.3.0 | ||
// >1.2.3 => >= 1.2.4 | ||
gtlt = '>='; | ||
@@ -856,3 +893,3 @@ if (xM) { | ||
ret = gtlt + M + '.' + m + '.' + p + '-0'; | ||
ret = gtlt + M + '.' + m + '.' + p; | ||
} else if (xM) { | ||
@@ -862,8 +899,5 @@ // allow any | ||
} else if (xm) { | ||
// append '-0' onto the version, otherwise | ||
// '1.x.x' matches '2.0.0-beta', since the tag | ||
// *lowers* the version value | ||
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; | ||
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; | ||
} else if (xp) { | ||
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; | ||
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; | ||
} | ||
@@ -887,5 +921,5 @@ | ||
// M, m, patch, prerelease, build | ||
// 1.2 - 3.4.5 => >=1.2.0-0 <=3.4.5 | ||
// 1.2.3 - 3.4 => >=1.2.0-0 <3.5.0-0 Any 3.4.x will do | ||
// 1.2 - 3.4 => >=1.2.0-0 <3.5.0-0 | ||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 | ||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do | ||
// 1.2 - 3.4 => >=1.2.0 <3.5.0 | ||
function hyphenReplace($0, | ||
@@ -898,5 +932,5 @@ from, fM, fm, fp, fpr, fb, | ||
else if (isX(fm)) | ||
from = '>=' + fM + '.0.0-0'; | ||
from = '>=' + fM + '.0.0'; | ||
else if (isX(fp)) | ||
from = '>=' + fM + '.' + fm + '.0-0'; | ||
from = '>=' + fM + '.' + fm + '.0'; | ||
else | ||
@@ -908,5 +942,5 @@ from = '>=' + from; | ||
else if (isX(tm)) | ||
to = '<' + (+tM + 1) + '.0.0-0'; | ||
to = '<' + (+tM + 1) + '.0.0'; | ||
else if (isX(tp)) | ||
to = '<' + tM + '.' + (+tm + 1) + '.0-0'; | ||
to = '<' + tM + '.' + (+tm + 1) + '.0'; | ||
else if (tpr) | ||
@@ -925,2 +959,6 @@ to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; | ||
return false; | ||
if (typeof version === 'string') | ||
version = new SemVer(version, this.loose); | ||
for (var i = 0; i < this.set.length; i++) { | ||
@@ -938,2 +976,27 @@ if (testSet(this.set[i], version)) | ||
} | ||
if (version.prerelease.length) { | ||
// Find the set of versions that are allowed to have prereleases | ||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 | ||
// That should allow `1.2.3-pr.2` to pass. | ||
// However, `1.2.4-alpha.notready` should NOT be allowed, | ||
// even though it's within the range set by the comparators. | ||
for (var i = 0; i < set.length; i++) { | ||
; | ||
if (set[i].semver === ANY) | ||
return true; | ||
if (set[i].semver.prerelease.length > 0) { | ||
var allowed = set[i].semver; | ||
if (allowed.major === version.major && | ||
allowed.minor === version.minor && | ||
allowed.patch === version.patch) | ||
return true; | ||
} | ||
} | ||
// Version has a -pre, but it's not one of the ones we like. | ||
return false; | ||
} | ||
return true; | ||
@@ -940,0 +1003,0 @@ } |
205
semver.js
@@ -141,4 +141,5 @@ // export the class if we are in a Node-like system. | ||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + | ||
'(?:(' + src[PRERELEASE] + ')' + | ||
')?)?)?'; | ||
'(?:' + src[PRERELEASE] + ')?' + | ||
src[BUILD] + '?' + | ||
')?)?'; | ||
@@ -149,7 +150,6 @@ var XRANGEPLAINLOOSE = R++; | ||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + | ||
'(?:(' + src[PRERELEASELOOSE] + ')' + | ||
')?)?)?'; | ||
'(?:' + src[PRERELEASELOOSE] + ')?' + | ||
src[BUILD] + '?' + | ||
')?)?'; | ||
// >=2.x, for example, means >=2.0.0-0 | ||
// <1.x would be the same as "<1.0.0-0", though. | ||
var XRANGE = R++; | ||
@@ -251,3 +251,3 @@ src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; | ||
function clean(version, loose) { | ||
var s = parse(version.trim().replace(/^[=v]+/, ""), loose); | ||
var s = parse(version.trim().replace(/^[=v]+/, ''), loose); | ||
return s ? s.version : null; | ||
@@ -364,7 +364,12 @@ } | ||
case 'premajor': | ||
this.inc('major'); | ||
this.prerelease.length = 0; | ||
this.patch = 0; | ||
this.minor = 0; | ||
this.major++; | ||
this.inc('pre'); | ||
break; | ||
case 'preminor': | ||
this.inc('minor'); | ||
this.prerelease.length = 0; | ||
this.patch = 0; | ||
this.minor++; | ||
this.inc('pre'); | ||
@@ -387,7 +392,21 @@ break; | ||
break; | ||
case 'major': | ||
this.major++; | ||
this.minor = -1; | ||
// If this is a pre-major version, bump up to the same major version. | ||
// Otherwise increment major. | ||
// 1.0.0-5 bumps to 1.0.0 | ||
// 1.1.0 bumps to 2.0.0 | ||
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) | ||
this.major++; | ||
this.minor = 0; | ||
this.patch = 0; | ||
this.prerelease = []; | ||
break; | ||
case 'minor': | ||
this.minor++; | ||
// If this is a pre-minor version, bump up to the same minor version. | ||
// Otherwise increment minor. | ||
// 1.2.0-5 bumps to 1.2.0 | ||
// 1.2.1 bumps to 1.3.0 | ||
if (this.patch !== 0 || this.prerelease.length === 0) | ||
this.minor++; | ||
this.patch = 0; | ||
@@ -405,4 +424,4 @@ this.prerelease = []; | ||
break; | ||
// This probably shouldn't be used publically. | ||
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. | ||
// This probably shouldn't be used publicly. | ||
// 1.0.0 "pre" would become 1.0.0 which is the wrong direction. | ||
case 'pre': | ||
@@ -527,4 +546,12 @@ if (this.prerelease.length === 0) | ||
switch (op) { | ||
case '===': ret = a === b; break; | ||
case '!==': ret = a !== b; break; | ||
case '===': | ||
if (typeof a === 'object') a = a.version; | ||
if (typeof b === 'object') b = b.version; | ||
ret = a === b; | ||
break; | ||
case '!==': | ||
if (typeof a === 'object') a = a.version; | ||
if (typeof b === 'object') b = b.version; | ||
ret = a !== b; | ||
break; | ||
case '': case '=': case '==': ret = eq(a, b, loose); break; | ||
@@ -561,2 +588,4 @@ case '!=': ret = neq(a, b, loose); break; | ||
this.value = this.operator + this.semver.version; | ||
debug('comp', this); | ||
} | ||
@@ -579,17 +608,4 @@ | ||
this.semver = ANY; | ||
else { | ||
else | ||
this.semver = new SemVer(m[2], this.loose); | ||
// <1.2.3-rc DOES allow 1.2.3-beta (has prerelease) | ||
// >=1.2.3 DOES NOT allow 1.2.3-beta | ||
// <=1.2.3 DOES allow 1.2.3-beta | ||
// However, <1.2.3 does NOT allow 1.2.3-beta, | ||
// even though `1.2.3-beta < 1.2.3` | ||
// The assumption is that the 1.2.3 version has something you | ||
// *don't* want, so we push the prerelease down to the minimum. | ||
if (this.operator === '<' && !this.semver.prerelease.length) { | ||
this.semver.prerelease = ['0']; | ||
this.semver.format(); | ||
} | ||
} | ||
}; | ||
@@ -607,4 +623,10 @@ | ||
debug('Comparator.test', version, this.loose); | ||
return (this.semver === ANY) ? true : | ||
cmp(version, this.operator, this.semver, this.loose); | ||
if (this.semver === ANY) | ||
return true; | ||
if (typeof version === 'string') | ||
version = new SemVer(version, this.loose); | ||
return cmp(version, this.operator, this.semver, this.loose); | ||
}; | ||
@@ -746,6 +768,6 @@ | ||
else if (isX(m)) | ||
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; | ||
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; | ||
else if (isX(p)) | ||
// ~1.2 == >=1.2.0- <1.3.0- | ||
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; | ||
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; | ||
else if (pr) { | ||
@@ -756,7 +778,7 @@ debug('replaceTilde pr', pr); | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + M + '.' + (+m + 1) + '.0-0'; | ||
' <' + M + '.' + (+m + 1) + '.0'; | ||
} else | ||
// ~1.2.3 == >=1.2.3-0 <1.3.0-0 | ||
ret = '>=' + M + '.' + m + '.' + p + '-0' + | ||
' <' + M + '.' + (+m + 1) + '.0-0'; | ||
// ~1.2.3 == >=1.2.3 <1.3.0 | ||
ret = '>=' + M + '.' + m + '.' + p + | ||
' <' + M + '.' + (+m + 1) + '.0'; | ||
@@ -781,2 +803,3 @@ debug('tilde return', ret); | ||
function replaceCaret(comp, loose) { | ||
debug('caret', comp, loose); | ||
var r = loose ? re[CARETLOOSE] : re[CARET]; | ||
@@ -786,7 +809,2 @@ return comp.replace(r, function(_, M, m, p, pr) { | ||
var ret; | ||
if (pr) { | ||
if (pr.charAt(0) !== '-') | ||
pr = '-' + pr; | ||
} else | ||
pr = ''; | ||
@@ -796,16 +814,35 @@ if (isX(M)) | ||
else if (isX(m)) | ||
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; | ||
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; | ||
else if (isX(p)) { | ||
if (M === '0') | ||
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; | ||
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; | ||
else | ||
ret = '>=' + M + '.' + m + '.0-0 <' + (+M + 1) + '.0.0-0'; | ||
} else if (M === '0') | ||
ret = '=' + M + '.' + m + '.' + p + pr; | ||
else if (pr) | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + (+M + 1) + '.0.0-0'; | ||
else | ||
ret = '>=' + M + '.' + m + '.' + p + '-0' + | ||
' <' + (+M + 1) + '.0.0-0'; | ||
ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; | ||
} else if (pr) { | ||
debug('replaceCaret pr', pr); | ||
if (pr.charAt(0) !== '-') | ||
pr = '-' + pr; | ||
if (M === '0') { | ||
if (m === '0') | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + M + '.' + m + '.' + (+p + 1); | ||
else | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + M + '.' + (+m + 1) + '.0'; | ||
} else | ||
ret = '>=' + M + '.' + m + '.' + p + pr + | ||
' <' + (+M + 1) + '.0.0'; | ||
} else { | ||
debug('no pr'); | ||
if (M === '0') { | ||
if (m === '0') | ||
ret = '>=' + M + '.' + m + '.' + p + | ||
' <' + M + '.' + m + '.' + (+p + 1); | ||
else | ||
ret = '>=' + M + '.' + m + '.' + p + | ||
' <' + M + '.' + (+m + 1) + '.0'; | ||
} else | ||
ret = '>=' + M + '.' + m + '.' + p + | ||
' <' + (+M + 1) + '.0.0'; | ||
} | ||
@@ -838,3 +875,3 @@ debug('caret return', ret); | ||
if (gtlt && anyX) { | ||
// replace X with 0, and then append the -0 min-prerelease | ||
// replace X with 0 | ||
if (xM) | ||
@@ -848,5 +885,5 @@ M = 0; | ||
if (gtlt === '>') { | ||
// >1 => >=2.0.0-0 | ||
// >1.2 => >=1.3.0-0 | ||
// >1.2.3 => >= 1.2.4-0 | ||
// >1 => >=2.0.0 | ||
// >1.2 => >=1.3.0 | ||
// >1.2.3 => >= 1.2.4 | ||
gtlt = '>='; | ||
@@ -866,3 +903,3 @@ if (xM) { | ||
ret = gtlt + M + '.' + m + '.' + p + '-0'; | ||
ret = gtlt + M + '.' + m + '.' + p; | ||
} else if (xM) { | ||
@@ -872,8 +909,5 @@ // allow any | ||
} else if (xm) { | ||
// append '-0' onto the version, otherwise | ||
// '1.x.x' matches '2.0.0-beta', since the tag | ||
// *lowers* the version value | ||
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; | ||
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; | ||
} else if (xp) { | ||
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; | ||
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; | ||
} | ||
@@ -897,5 +931,5 @@ | ||
// M, m, patch, prerelease, build | ||
// 1.2 - 3.4.5 => >=1.2.0-0 <=3.4.5 | ||
// 1.2.3 - 3.4 => >=1.2.0-0 <3.5.0-0 Any 3.4.x will do | ||
// 1.2 - 3.4 => >=1.2.0-0 <3.5.0-0 | ||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 | ||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do | ||
// 1.2 - 3.4 => >=1.2.0 <3.5.0 | ||
function hyphenReplace($0, | ||
@@ -908,5 +942,5 @@ from, fM, fm, fp, fpr, fb, | ||
else if (isX(fm)) | ||
from = '>=' + fM + '.0.0-0'; | ||
from = '>=' + fM + '.0.0'; | ||
else if (isX(fp)) | ||
from = '>=' + fM + '.' + fm + '.0-0'; | ||
from = '>=' + fM + '.' + fm + '.0'; | ||
else | ||
@@ -918,5 +952,5 @@ from = '>=' + from; | ||
else if (isX(tm)) | ||
to = '<' + (+tM + 1) + '.0.0-0'; | ||
to = '<' + (+tM + 1) + '.0.0'; | ||
else if (isX(tp)) | ||
to = '<' + tM + '.' + (+tm + 1) + '.0-0'; | ||
to = '<' + tM + '.' + (+tm + 1) + '.0'; | ||
else if (tpr) | ||
@@ -935,2 +969,6 @@ to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; | ||
return false; | ||
if (typeof version === 'string') | ||
version = new SemVer(version, this.loose); | ||
for (var i = 0; i < this.set.length; i++) { | ||
@@ -948,2 +986,27 @@ if (testSet(this.set[i], version)) | ||
} | ||
if (version.prerelease.length) { | ||
// Find the set of versions that are allowed to have prereleases | ||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 | ||
// That should allow `1.2.3-pr.2` to pass. | ||
// However, `1.2.4-alpha.notready` should NOT be allowed, | ||
// even though it's within the range set by the comparators. | ||
for (var i = 0; i < set.length; i++) { | ||
debug(set[i].semver); | ||
if (set[i].semver === ANY) | ||
return true; | ||
if (set[i].semver.prerelease.length > 0) { | ||
var allowed = set[i].semver; | ||
if (allowed.major === version.major && | ||
allowed.minor === version.minor && | ||
allowed.patch === version.patch) | ||
return true; | ||
} | ||
} | ||
// Version has a -pre, but it's not one of the ones we like. | ||
return false; | ||
} | ||
return true; | ||
@@ -950,0 +1013,0 @@ } |
@@ -1,1 +0,1 @@ | ||
(function(e){if(typeof module==="object"&&module.exports===e)e=module.exports=H;e.SEMVER_SPEC_VERSION="2.0.0";var r=e.re=[];var t=e.src=[];var n=0;var i=n++;t[i]="0|[1-9]\\d*";var s=n++;t[s]="[0-9]+";var a=n++;t[a]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var o=n++;t[o]="("+t[i]+")\\."+"("+t[i]+")\\."+"("+t[i]+")";var f=n++;t[f]="("+t[s]+")\\."+"("+t[s]+")\\."+"("+t[s]+")";var u=n++;t[u]="(?:"+t[i]+"|"+t[a]+")";var c=n++;t[c]="(?:"+t[s]+"|"+t[a]+")";var l=n++;t[l]="(?:-("+t[u]+"(?:\\."+t[u]+")*))";var p=n++;t[p]="(?:-?("+t[c]+"(?:\\."+t[c]+")*))";var h=n++;t[h]="[0-9A-Za-z-]+";var v=n++;t[v]="(?:\\+("+t[h]+"(?:\\."+t[h]+")*))";var m=n++;var g="v?"+t[o]+t[l]+"?"+t[v]+"?";t[m]="^"+g+"$";var w="[v=\\s]*"+t[f]+t[p]+"?"+t[v]+"?";var d=n++;t[d]="^"+w+"$";var y=n++;t[y]="((?:<|>)?=?)";var b=n++;t[b]=t[s]+"|x|X|\\*";var $=n++;t[$]=t[i]+"|x|X|\\*";var j=n++;t[j]="[v=\\s]*("+t[$]+")"+"(?:\\.("+t[$]+")"+"(?:\\.("+t[$]+")"+"(?:("+t[l]+")"+")?)?)?";var k=n++;t[k]="[v=\\s]*("+t[b]+")"+"(?:\\.("+t[b]+")"+"(?:\\.("+t[b]+")"+"(?:("+t[p]+")"+")?)?)?";var E=n++;t[E]="^"+t[y]+"\\s*"+t[j]+"$";var x=n++;t[x]="^"+t[y]+"\\s*"+t[k]+"$";var R=n++;t[R]="(?:~>?)";var S=n++;t[S]="(\\s*)"+t[R]+"\\s+";r[S]=new RegExp(t[S],"g");var V="$1~";var I=n++;t[I]="^"+t[R]+t[j]+"$";var T=n++;t[T]="^"+t[R]+t[k]+"$";var A=n++;t[A]="(?:\\^)";var C=n++;t[C]="(\\s*)"+t[A]+"\\s+";r[C]=new RegExp(t[C],"g");var M="$1^";var z=n++;t[z]="^"+t[A]+t[j]+"$";var P=n++;t[P]="^"+t[A]+t[k]+"$";var Z=n++;t[Z]="^"+t[y]+"\\s*("+w+")$|^$";var q=n++;t[q]="^"+t[y]+"\\s*("+g+")$|^$";var L=n++;t[L]="(\\s*)"+t[y]+"\\s*("+w+"|"+t[j]+")";r[L]=new RegExp(t[L],"g");var X="$1$2$3";var _=n++;t[_]="^\\s*("+t[j]+")"+"\\s+-\\s+"+"("+t[j]+")"+"\\s*$";var N=n++;t[N]="^\\s*("+t[k]+")"+"\\s+-\\s+"+"("+t[k]+")"+"\\s*$";var O=n++;t[O]="(<|>)?=?\\s*\\*";for(var B=0;B<n;B++){if(!r[B])r[B]=new RegExp(t[B])}e.parse=D;function D(e,t){var n=t?r[d]:r[m];return n.test(e)?new H(e,t):null}e.valid=F;function F(e,r){var t=D(e,r);return t?t.version:null}e.clean=G;function G(e,r){var t=D(e.trim().replace(/^[=v]+/,""),r);return t?t.version:null}e.SemVer=H;function H(e,t){if(e instanceof H){if(e.loose===t)return e;else e=e.version}else if(typeof e!=="string"){throw new TypeError("Invalid Version: "+e)}if(!(this instanceof H))return new H(e,t);this.loose=t;var n=e.trim().match(t?r[d]:r[m]);if(!n)throw new TypeError("Invalid Version: "+e);this.raw=e;this.major=+n[1];this.minor=+n[2];this.patch=+n[3];if(!n[4])this.prerelease=[];else this.prerelease=n[4].split(".").map(function(e){return/^[0-9]+$/.test(e)?+e:e});this.build=n[5]?n[5].split("."):[];this.format()}H.prototype.format=function(){this.version=this.major+"."+this.minor+"."+this.patch;if(this.prerelease.length)this.version+="-"+this.prerelease.join(".");return this.version};H.prototype.inspect=function(){return'<SemVer "'+this+'">'};H.prototype.toString=function(){return this.version};H.prototype.compare=function(e){if(!(e instanceof H))e=new H(e,this.loose);return this.compareMain(e)||this.comparePre(e)};H.prototype.compareMain=function(e){if(!(e instanceof H))e=new H(e,this.loose);return Q(this.major,e.major)||Q(this.minor,e.minor)||Q(this.patch,e.patch)};H.prototype.comparePre=function(e){if(!(e instanceof H))e=new H(e,this.loose);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r];var n=e.prerelease[r];if(t===undefined&&n===undefined)return 0;else if(n===undefined)return 1;else if(t===undefined)return-1;else if(t===n)continue;else return Q(t,n)}while(++r)};H.prototype.inc=function(e){switch(e){case"premajor":this.inc("major");this.inc("pre");break;case"preminor":this.inc("minor");this.inc("pre");break;case"prepatch":this.prerelease.length=0;this.inc("patch");this.inc("pre");break;case"prerelease":if(this.prerelease.length===0)this.inc("patch");this.inc("pre");break;case"major":this.major++;this.minor=-1;case"minor":this.minor++;this.patch=0;this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{var r=this.prerelease.length;while(--r>=0){if(typeof this.prerelease[r]==="number"){this.prerelease[r]++;r=-2}}if(r===-1)this.prerelease.push(0)}break;default:throw new Error("invalid increment argument: "+e)}this.format();return this};e.inc=J;function J(e,r,t){try{return new H(e,t).inc(r).version}catch(n){return null}}e.compareIdentifiers=Q;var K=/^[0-9]+$/;function Q(e,r){var t=K.test(e);var n=K.test(r);if(t&&n){e=+e;r=+r}return t&&!n?-1:n&&!t?1:e<r?-1:e>r?1:0}e.rcompareIdentifiers=U;function U(e,r){return Q(r,e)}e.compare=W;function W(e,r,t){return new H(e,t).compare(r)}e.compareLoose=Y;function Y(e,r){return W(e,r,true)}e.rcompare=er;function er(e,r,t){return W(r,e,t)}e.sort=rr;function rr(r,t){return r.sort(function(r,n){return e.compare(r,n,t)})}e.rsort=tr;function tr(r,t){return r.sort(function(r,n){return e.rcompare(r,n,t)})}e.gt=nr;function nr(e,r,t){return W(e,r,t)>0}e.lt=ir;function ir(e,r,t){return W(e,r,t)<0}e.eq=sr;function sr(e,r,t){return W(e,r,t)===0}e.neq=ar;function ar(e,r,t){return W(e,r,t)!==0}e.gte=or;function or(e,r,t){return W(e,r,t)>=0}e.lte=fr;function fr(e,r,t){return W(e,r,t)<=0}e.cmp=ur;function ur(e,r,t,n){var i;switch(r){case"===":i=e===t;break;case"!==":i=e!==t;break;case"":case"=":case"==":i=sr(e,t,n);break;case"!=":i=ar(e,t,n);break;case">":i=nr(e,t,n);break;case">=":i=or(e,t,n);break;case"<":i=ir(e,t,n);break;case"<=":i=fr(e,t,n);break;default:throw new TypeError("Invalid operator: "+r)}return i}e.Comparator=cr;function cr(e,r){if(e instanceof cr){if(e.loose===r)return e;else e=e.value}if(!(this instanceof cr))return new cr(e,r);this.loose=r;this.parse(e);if(this.semver===lr)this.value="";else this.value=this.operator+this.semver.version}var lr={};cr.prototype.parse=function(e){var t=this.loose?r[Z]:r[q];var n=e.match(t);if(!n)throw new TypeError("Invalid comparator: "+e);this.operator=n[1];if(this.operator==="=")this.operator="";if(!n[2])this.semver=lr;else{this.semver=new H(n[2],this.loose);if(this.operator==="<"&&!this.semver.prerelease.length){this.semver.prerelease=["0"];this.semver.format()}}};cr.prototype.inspect=function(){return'<SemVer Comparator "'+this+'">'};cr.prototype.toString=function(){return this.value};cr.prototype.test=function(e){return this.semver===lr?true:ur(e,this.operator,this.semver,this.loose)};e.Range=pr;function pr(e,r){if(e instanceof pr&&e.loose===r)return e;if(!(this instanceof pr))return new pr(e,r);this.loose=r;this.raw=e;this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+e)}this.format()}pr.prototype.inspect=function(){return'<SemVer Range "'+this.range+'">'};pr.prototype.format=function(){this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim();return this.range};pr.prototype.toString=function(){return this.range};pr.prototype.parseRange=function(e){var t=this.loose;e=e.trim();var n=t?r[N]:r[_];e=e.replace(n,kr);e=e.replace(r[L],X);e=e.replace(r[S],V);e=e.replace(r[C],M);e=e.split(/\s+/).join(" ");var i=t?r[Z]:r[q];var s=e.split(" ").map(function(e){return vr(e,t)}).join(" ").split(/\s+/);if(this.loose){s=s.filter(function(e){return!!e.match(i)})}s=s.map(function(e){return new cr(e,t)});return s};e.toComparators=hr;function hr(e,r){return new pr(e,r).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function vr(e,r){e=dr(e,r);e=gr(e,r);e=br(e,r);e=jr(e,r);return e}function mr(e){return!e||e.toLowerCase()==="x"||e==="*"}function gr(e,r){return e.trim().split(/\s+/).map(function(e){return wr(e,r)}).join(" ")}function wr(e,t){var n=t?r[T]:r[I];return e.replace(n,function(e,r,t,n,i){var s;if(mr(r))s="";else if(mr(t))s=">="+r+".0.0-0 <"+(+r+1)+".0.0-0";else if(mr(n))s=">="+r+"."+t+".0-0 <"+r+"."+(+t+1)+".0-0";else if(i){if(i.charAt(0)!=="-")i="-"+i;s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+"-0"+" <"+r+"."+(+t+1)+".0-0";return s})}function dr(e,r){return e.trim().split(/\s+/).map(function(e){return yr(e,r)}).join(" ")}function yr(e,t){var n=t?r[P]:r[z];return e.replace(n,function(e,r,t,n,i){var s;if(i){if(i.charAt(0)!=="-")i="-"+i}else i="";if(mr(r))s="";else if(mr(t))s=">="+r+".0.0-0 <"+(+r+1)+".0.0-0";else if(mr(n)){if(r==="0")s=">="+r+"."+t+".0-0 <"+r+"."+(+t+1)+".0-0";else s=">="+r+"."+t+".0-0 <"+(+r+1)+".0.0-0"}else if(r==="0")s="="+r+"."+t+"."+n+i;else if(i)s=">="+r+"."+t+"."+n+i+" <"+(+r+1)+".0.0-0";else s=">="+r+"."+t+"."+n+"-0"+" <"+(+r+1)+".0.0-0";return s})}function br(e,r){return e.split(/\s+/).map(function(e){return $r(e,r)}).join(" ")}function $r(e,t){e=e.trim();var n=t?r[x]:r[E];return e.replace(n,function(e,r,t,n,i,s){var a=mr(t);var o=a||mr(n);var f=o||mr(i);var u=f;if(r==="="&&u)r="";if(r&&u){if(a)t=0;if(o)n=0;if(f)i=0;if(r===">"){r=">=";if(a){}else if(o){t=+t+1;n=0;i=0}else if(f){n=+n+1;i=0}}e=r+t+"."+n+"."+i+"-0"}else if(a){e="*"}else if(o){e=">="+t+".0.0-0 <"+(+t+1)+".0.0-0"}else if(f){e=">="+t+"."+n+".0-0 <"+t+"."+(+n+1)+".0-0"}return e})}function jr(e,t){return e.trim().replace(r[O],"")}function kr(e,r,t,n,i,s,a,o,f,u,c,l,p){if(mr(t))r="";else if(mr(n))r=">="+t+".0.0-0";else if(mr(i))r=">="+t+"."+n+".0-0";else r=">="+r;if(mr(f))o="";else if(mr(u))o="<"+(+f+1)+".0.0-0";else if(mr(c))o="<"+f+"."+(+u+1)+".0-0";else if(l)o="<="+f+"."+u+"."+c+"-"+l;else o="<="+o;return(r+" "+o).trim()}pr.prototype.test=function(e){if(!e)return false;for(var r=0;r<this.set.length;r++){if(Er(this.set[r],e))return true}return false};function Er(e,r){for(var t=0;t<e.length;t++){if(!e[t].test(r))return false}return true}e.satisfies=xr;function xr(e,r,t){try{r=new pr(r,t)}catch(n){return false}return r.test(e)}e.maxSatisfying=Rr;function Rr(e,r,t){return e.filter(function(e){return xr(e,r,t)}).sort(function(e,r){return er(e,r,t)})[0]||null}e.validRange=Sr;function Sr(e,r){try{return new pr(e,r).range||"*"}catch(t){return null}}e.ltr=Vr;function Vr(e,r,t){return Tr(e,r,"<",t)}e.gtr=Ir;function Ir(e,r,t){return Tr(e,r,">",t)}e.outside=Tr;function Tr(e,r,t,n){e=new H(e,n);r=new pr(r,n);var i,s,a,o,f;switch(t){case">":i=nr;s=fr;a=ir;o=">";f=">=";break;case"<":i=ir;s=or;a=nr;o="<";f="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(xr(e,r,n)){return false}for(var u=0;u<r.set.length;++u){var c=r.set[u];var l=null;var p=null;c.forEach(function(e){l=l||e;p=p||e;if(i(e.semver,l.semver,n)){l=e}else if(a(e.semver,p.semver,n)){p=e}});if(l.operator===o||l.operator===f){return false}if((!p.operator||p.operator===o)&&s(e,p.semver)){return false}else if(p.operator===f&&a(e,p.semver)){return false}}return true}if(typeof define==="function"&&define.amd)define(e)})(typeof exports==="object"?exports:typeof define==="function"&&define.amd?{}:semver={}); | ||
(function(e){if(typeof module==="object"&&module.exports===e)e=module.exports=H;e.SEMVER_SPEC_VERSION="2.0.0";var r=e.re=[];var t=e.src=[];var n=0;var i=n++;t[i]="0|[1-9]\\d*";var s=n++;t[s]="[0-9]+";var o=n++;t[o]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var a=n++;t[a]="("+t[i]+")\\."+"("+t[i]+")\\."+"("+t[i]+")";var f=n++;t[f]="("+t[s]+")\\."+"("+t[s]+")\\."+"("+t[s]+")";var u=n++;t[u]="(?:"+t[i]+"|"+t[o]+")";var l=n++;t[l]="(?:"+t[s]+"|"+t[o]+")";var c=n++;t[c]="(?:-("+t[u]+"(?:\\."+t[u]+")*))";var p=n++;t[p]="(?:-?("+t[l]+"(?:\\."+t[l]+")*))";var h=n++;t[h]="[0-9A-Za-z-]+";var v=n++;t[v]="(?:\\+("+t[h]+"(?:\\."+t[h]+")*))";var m=n++;var g="v?"+t[a]+t[c]+"?"+t[v]+"?";t[m]="^"+g+"$";var w="[v=\\s]*"+t[f]+t[p]+"?"+t[v]+"?";var y=n++;t[y]="^"+w+"$";var d=n++;t[d]="((?:<|>)?=?)";var b=n++;t[b]=t[s]+"|x|X|\\*";var j=n++;t[j]=t[i]+"|x|X|\\*";var $=n++;t[$]="[v=\\s]*("+t[j]+")"+"(?:\\.("+t[j]+")"+"(?:\\.("+t[j]+")"+"(?:"+t[c]+")?"+t[v]+"?"+")?)?";var k=n++;t[k]="[v=\\s]*("+t[b]+")"+"(?:\\.("+t[b]+")"+"(?:\\.("+t[b]+")"+"(?:"+t[p]+")?"+t[v]+"?"+")?)?";var E=n++;t[E]="^"+t[d]+"\\s*"+t[$]+"$";var x=n++;t[x]="^"+t[d]+"\\s*"+t[k]+"$";var R=n++;t[R]="(?:~>?)";var S=n++;t[S]="(\\s*)"+t[R]+"\\s+";r[S]=new RegExp(t[S],"g");var V="$1~";var I=n++;t[I]="^"+t[R]+t[$]+"$";var T=n++;t[T]="^"+t[R]+t[k]+"$";var A=n++;t[A]="(?:\\^)";var C=n++;t[C]="(\\s*)"+t[A]+"\\s+";r[C]=new RegExp(t[C],"g");var M="$1^";var z=n++;t[z]="^"+t[A]+t[$]+"$";var P=n++;t[P]="^"+t[A]+t[k]+"$";var Z=n++;t[Z]="^"+t[d]+"\\s*("+w+")$|^$";var q=n++;t[q]="^"+t[d]+"\\s*("+g+")$|^$";var L=n++;t[L]="(\\s*)"+t[d]+"\\s*("+w+"|"+t[$]+")";r[L]=new RegExp(t[L],"g");var X="$1$2$3";var _=n++;t[_]="^\\s*("+t[$]+")"+"\\s+-\\s+"+"("+t[$]+")"+"\\s*$";var N=n++;t[N]="^\\s*("+t[k]+")"+"\\s+-\\s+"+"("+t[k]+")"+"\\s*$";var O=n++;t[O]="(<|>)?=?\\s*\\*";for(var B=0;B<n;B++){if(!r[B])r[B]=new RegExp(t[B])}e.parse=D;function D(e,t){var n=t?r[y]:r[m];return n.test(e)?new H(e,t):null}e.valid=F;function F(e,r){var t=D(e,r);return t?t.version:null}e.clean=G;function G(e,r){var t=D(e.trim().replace(/^[=v]+/,""),r);return t?t.version:null}e.SemVer=H;function H(e,t){if(e instanceof H){if(e.loose===t)return e;else e=e.version}else if(typeof e!=="string"){throw new TypeError("Invalid Version: "+e)}if(!(this instanceof H))return new H(e,t);this.loose=t;var n=e.trim().match(t?r[y]:r[m]);if(!n)throw new TypeError("Invalid Version: "+e);this.raw=e;this.major=+n[1];this.minor=+n[2];this.patch=+n[3];if(!n[4])this.prerelease=[];else this.prerelease=n[4].split(".").map(function(e){return/^[0-9]+$/.test(e)?+e:e});this.build=n[5]?n[5].split("."):[];this.format()}H.prototype.format=function(){this.version=this.major+"."+this.minor+"."+this.patch;if(this.prerelease.length)this.version+="-"+this.prerelease.join(".");return this.version};H.prototype.inspect=function(){return'<SemVer "'+this+'">'};H.prototype.toString=function(){return this.version};H.prototype.compare=function(e){if(!(e instanceof H))e=new H(e,this.loose);return this.compareMain(e)||this.comparePre(e)};H.prototype.compareMain=function(e){if(!(e instanceof H))e=new H(e,this.loose);return Q(this.major,e.major)||Q(this.minor,e.minor)||Q(this.patch,e.patch)};H.prototype.comparePre=function(e){if(!(e instanceof H))e=new H(e,this.loose);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r];var n=e.prerelease[r];if(t===undefined&&n===undefined)return 0;else if(n===undefined)return 1;else if(t===undefined)return-1;else if(t===n)continue;else return Q(t,n)}while(++r)};H.prototype.inc=function(e){switch(e){case"premajor":this.prerelease.length=0;this.patch=0;this.minor=0;this.major++;this.inc("pre");break;case"preminor":this.prerelease.length=0;this.patch=0;this.minor++;this.inc("pre");break;case"prepatch":this.prerelease.length=0;this.inc("patch");this.inc("pre");break;case"prerelease":if(this.prerelease.length===0)this.inc("patch");this.inc("pre");break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0;this.patch=0;this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0;this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{var r=this.prerelease.length;while(--r>=0){if(typeof this.prerelease[r]==="number"){this.prerelease[r]++;r=-2}}if(r===-1)this.prerelease.push(0)}break;default:throw new Error("invalid increment argument: "+e)}this.format();return this};e.inc=J;function J(e,r,t){try{return new H(e,t).inc(r).version}catch(n){return null}}e.compareIdentifiers=Q;var K=/^[0-9]+$/;function Q(e,r){var t=K.test(e);var n=K.test(r);if(t&&n){e=+e;r=+r}return t&&!n?-1:n&&!t?1:e<r?-1:e>r?1:0}e.rcompareIdentifiers=U;function U(e,r){return Q(r,e)}e.compare=W;function W(e,r,t){return new H(e,t).compare(r)}e.compareLoose=Y;function Y(e,r){return W(e,r,true)}e.rcompare=er;function er(e,r,t){return W(r,e,t)}e.sort=rr;function rr(r,t){return r.sort(function(r,n){return e.compare(r,n,t)})}e.rsort=tr;function tr(r,t){return r.sort(function(r,n){return e.rcompare(r,n,t)})}e.gt=nr;function nr(e,r,t){return W(e,r,t)>0}e.lt=ir;function ir(e,r,t){return W(e,r,t)<0}e.eq=sr;function sr(e,r,t){return W(e,r,t)===0}e.neq=or;function or(e,r,t){return W(e,r,t)!==0}e.gte=ar;function ar(e,r,t){return W(e,r,t)>=0}e.lte=fr;function fr(e,r,t){return W(e,r,t)<=0}e.cmp=ur;function ur(e,r,t,n){var i;switch(r){case"===":if(typeof e==="object")e=e.version;if(typeof t==="object")t=t.version;i=e===t;break;case"!==":if(typeof e==="object")e=e.version;if(typeof t==="object")t=t.version;i=e!==t;break;case"":case"=":case"==":i=sr(e,t,n);break;case"!=":i=or(e,t,n);break;case">":i=nr(e,t,n);break;case">=":i=ar(e,t,n);break;case"<":i=ir(e,t,n);break;case"<=":i=fr(e,t,n);break;default:throw new TypeError("Invalid operator: "+r)}return i}e.Comparator=lr;function lr(e,r){if(e instanceof lr){if(e.loose===r)return e;else e=e.value}if(!(this instanceof lr))return new lr(e,r);this.loose=r;this.parse(e);if(this.semver===cr)this.value="";else this.value=this.operator+this.semver.version}var cr={};lr.prototype.parse=function(e){var t=this.loose?r[Z]:r[q];var n=e.match(t);if(!n)throw new TypeError("Invalid comparator: "+e);this.operator=n[1];if(this.operator==="=")this.operator="";if(!n[2])this.semver=cr;else this.semver=new H(n[2],this.loose)};lr.prototype.inspect=function(){return'<SemVer Comparator "'+this+'">'};lr.prototype.toString=function(){return this.value};lr.prototype.test=function(e){if(this.semver===cr)return true;if(typeof e==="string")e=new H(e,this.loose);return ur(e,this.operator,this.semver,this.loose)};e.Range=pr;function pr(e,r){if(e instanceof pr&&e.loose===r)return e;if(!(this instanceof pr))return new pr(e,r);this.loose=r;this.raw=e;this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+e)}this.format()}pr.prototype.inspect=function(){return'<SemVer Range "'+this.range+'">'};pr.prototype.format=function(){this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim();return this.range};pr.prototype.toString=function(){return this.range};pr.prototype.parseRange=function(e){var t=this.loose;e=e.trim();var n=t?r[N]:r[_];e=e.replace(n,kr);e=e.replace(r[L],X);e=e.replace(r[S],V);e=e.replace(r[C],M);e=e.split(/\s+/).join(" ");var i=t?r[Z]:r[q];var s=e.split(" ").map(function(e){return vr(e,t)}).join(" ").split(/\s+/);if(this.loose){s=s.filter(function(e){return!!e.match(i)})}s=s.map(function(e){return new lr(e,t)});return s};e.toComparators=hr;function hr(e,r){return new pr(e,r).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function vr(e,r){e=yr(e,r);e=gr(e,r);e=br(e,r);e=$r(e,r);return e}function mr(e){return!e||e.toLowerCase()==="x"||e==="*"}function gr(e,r){return e.trim().split(/\s+/).map(function(e){return wr(e,r)}).join(" ")}function wr(e,t){var n=t?r[T]:r[I];return e.replace(n,function(e,r,t,n,i){var s;if(mr(r))s="";else if(mr(t))s=">="+r+".0.0 <"+(+r+1)+".0.0";else if(mr(n))s=">="+r+"."+t+".0 <"+r+"."+(+t+1)+".0";else if(i){if(i.charAt(0)!=="-")i="-"+i;s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+" <"+r+"."+(+t+1)+".0";return s})}function yr(e,r){return e.trim().split(/\s+/).map(function(e){return dr(e,r)}).join(" ")}function dr(e,t){var n=t?r[P]:r[z];return e.replace(n,function(e,r,t,n,i){var s;if(mr(r))s="";else if(mr(t))s=">="+r+".0.0 <"+(+r+1)+".0.0";else if(mr(n)){if(r==="0")s=">="+r+"."+t+".0 <"+r+"."+(+t+1)+".0";else s=">="+r+"."+t+".0 <"+(+r+1)+".0.0"}else if(i){if(i.charAt(0)!=="-")i="-"+i;if(r==="0"){if(t==="0")s=">="+r+"."+t+"."+n+i+" <"+r+"."+t+"."+(+n+1);else s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+i+" <"+(+r+1)+".0.0"}else{if(r==="0"){if(t==="0")s=">="+r+"."+t+"."+n+" <"+r+"."+t+"."+(+n+1);else s=">="+r+"."+t+"."+n+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+" <"+(+r+1)+".0.0"}return s})}function br(e,r){return e.split(/\s+/).map(function(e){return jr(e,r)}).join(" ")}function jr(e,t){e=e.trim();var n=t?r[x]:r[E];return e.replace(n,function(e,r,t,n,i,s){var o=mr(t);var a=o||mr(n);var f=a||mr(i);var u=f;if(r==="="&&u)r="";if(r&&u){if(o)t=0;if(a)n=0;if(f)i=0;if(r===">"){r=">=";if(o){}else if(a){t=+t+1;n=0;i=0}else if(f){n=+n+1;i=0}}e=r+t+"."+n+"."+i}else if(o){e="*"}else if(a){e=">="+t+".0.0 <"+(+t+1)+".0.0"}else if(f){e=">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0"}return e})}function $r(e,t){return e.trim().replace(r[O],"")}function kr(e,r,t,n,i,s,o,a,f,u,l,c,p){if(mr(t))r="";else if(mr(n))r=">="+t+".0.0";else if(mr(i))r=">="+t+"."+n+".0";else r=">="+r;if(mr(f))a="";else if(mr(u))a="<"+(+f+1)+".0.0";else if(mr(l))a="<"+f+"."+(+u+1)+".0";else if(c)a="<="+f+"."+u+"."+l+"-"+c;else a="<="+a;return(r+" "+a).trim()}pr.prototype.test=function(e){if(!e)return false;if(typeof e==="string")e=new H(e,this.loose);for(var r=0;r<this.set.length;r++){if(Er(this.set[r],e))return true}return false};function Er(e,r){for(var t=0;t<e.length;t++){if(!e[t].test(r))return false}if(r.prerelease.length){for(var t=0;t<e.length;t++){if(e[t].semver===cr)return true;if(e[t].semver.prerelease.length>0){var n=e[t].semver;if(n.major===r.major&&n.minor===r.minor&&n.patch===r.patch)return true}}return false}return true}e.satisfies=xr;function xr(e,r,t){try{r=new pr(r,t)}catch(n){return false}return r.test(e)}e.maxSatisfying=Rr;function Rr(e,r,t){return e.filter(function(e){return xr(e,r,t)}).sort(function(e,r){return er(e,r,t)})[0]||null}e.validRange=Sr;function Sr(e,r){try{return new pr(e,r).range||"*"}catch(t){return null}}e.ltr=Vr;function Vr(e,r,t){return Tr(e,r,"<",t)}e.gtr=Ir;function Ir(e,r,t){return Tr(e,r,">",t)}e.outside=Tr;function Tr(e,r,t,n){e=new H(e,n);r=new pr(r,n);var i,s,o,a,f;switch(t){case">":i=nr;s=fr;o=ir;a=">";f=">=";break;case"<":i=ir;s=ar;o=nr;a="<";f="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(xr(e,r,n)){return false}for(var u=0;u<r.set.length;++u){var l=r.set[u];var c=null;var p=null;l.forEach(function(e){c=c||e;p=p||e;if(i(e.semver,c.semver,n)){c=e}else if(o(e.semver,p.semver,n)){p=e}});if(c.operator===a||c.operator===f){return false}if((!p.operator||p.operator===a)&&s(e,p.semver)){return false}else if(p.operator===f&&o(e,p.semver)){return false}}return true}if(typeof define==="function"&&define.amd)define(e)})(typeof exports==="object"?exports:typeof define==="function"&&define.amd?{}:semver={}); |
@@ -42,3 +42,3 @@ var tap = require('tap'); | ||
['=0.7.x', '0.8.0-asdf'], | ||
['<=0.7.x', '0.7.0'], | ||
['<0.7.x', '0.7.0'], | ||
['~1.2.2', '1.3.0'], | ||
@@ -45,0 +45,0 @@ ['1.0.0 - 2.0.0', '2.2.3'], |
@@ -135,2 +135,11 @@ 'use strict'; | ||
[['1.0.0 - 2.0.0', '1.2.3'], | ||
['^1.2.3+build', '1.2.3'], | ||
['^1.2.3+build', '1.3.0'], | ||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3'], | ||
['1.2.3pre+asdf - 2.4.3-pre+asdf', '1.2.3', true], | ||
['1.2.3-pre+asdf - 2.4.3pre+asdf', '1.2.3', true], | ||
['1.2.3pre+asdf - 2.4.3pre+asdf', '1.2.3', true], | ||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3-pre.2'], | ||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '2.4.3-alpha'], | ||
['1.2.3+asdf - 2.4.3+asdf', '1.2.3'], | ||
['1.0.0', '1.0.0'], | ||
@@ -193,3 +202,2 @@ ['>=*', '0.2.4'], | ||
['< 1.2', '1.1.1'], | ||
['1', '1.0.0beta', true], | ||
['~v0.5.4-pre', '0.5.5'], | ||
@@ -199,4 +207,2 @@ ['~v0.5.4-pre', '0.5.4'], | ||
['>=0.7.x', '0.7.2'], | ||
['=0.7.x', '0.7.0-asdf'], | ||
['>=0.7.x', '0.7.0-asdf'], | ||
['<=0.7.x', '0.6.2'], | ||
@@ -213,7 +219,4 @@ ['~1.2.1 >=1.2.3', '1.2.3'], | ||
['>=1.2.1 >=1.2.3', '1.2.3'], | ||
['<=1.2.3', '1.2.3-beta'], | ||
['>1.2', '1.3.0-beta'], | ||
['>=1.2', '1.2.8'], | ||
['^1.2.3', '1.8.1'], | ||
['^1.2.3', '1.2.3-beta'], | ||
['^0.1.2', '0.1.2'], | ||
@@ -223,4 +226,5 @@ ['^0.1', '0.1.2'], | ||
['^1.2 ^1', '1.4.2'], | ||
['^1.2', '1.2.0-pre'], | ||
['^1.2.3', '1.2.3-pre'] | ||
['^1.2.3-alpha', '1.2.3-pre'], | ||
['^1.2.0-alpha', '1.2.0-pre'], | ||
['^0.0.1-alpha', '0.0.1-beta'] | ||
].forEach(function(v) { | ||
@@ -239,2 +243,16 @@ var range = v[0]; | ||
[['1.0.0 - 2.0.0', '2.2.3'], | ||
['1.2.3+asdf - 2.4.3+asdf', '1.2.3-pre.2'], | ||
['1.2.3+asdf - 2.4.3+asdf', '2.4.3-alpha'], | ||
['^1.2.3+build', '2.0.0'], | ||
['^1.2.3+build', '1.2.0'], | ||
['^1.2.3', '1.2.3-pre'], | ||
['^1.2', '1.2.0-pre'], | ||
['>1.2', '1.3.0-beta'], | ||
['<=1.2.3', '1.2.3-beta'], | ||
['^1.2.3', '1.2.3-beta'], | ||
['=0.7.x', '0.7.0-asdf'], | ||
['>=0.7.x', '0.7.0-asdf'], | ||
['1', '1.0.0beta', true], | ||
['<1', '1.0.0beta', true], | ||
['< 1', '1.0.0beta', true], | ||
['1.0.0', '1.0.1'], | ||
@@ -279,4 +297,2 @@ ['>=1.0.0', '0.0.0'], | ||
['~v0.5.4-beta', '0.5.4-alpha'], | ||
['<1', '1.0.0beta', true], | ||
['< 1', '1.0.0beta', true], | ||
['=0.7.x', '0.8.2'], | ||
@@ -342,7 +358,7 @@ ['>=0.7.x', '0.6.2'], | ||
['1.2.0', 'preminor', '1.3.0-0'], | ||
['1.2.0-1', 'preminor', '1.3.0-0'], | ||
['1.2.3-1', 'preminor', '1.3.0-0'], | ||
['1.2.0', 'premajor', '2.0.0-0'], | ||
['1.2.0-1', 'premajor', '2.0.0-0'] | ||
['1.2.3-1', 'premajor', '2.0.0-0'], | ||
['1.2.0-1', 'minor', '1.2.0'], | ||
['1.0.0-1', 'major', '1.0.0'] | ||
].forEach(function(v) { | ||
@@ -366,3 +382,3 @@ var pre = v[0]; | ||
['1.0.0', '1.0.0'], | ||
['>=*', '>=0.0.0-0'], | ||
['>=*', '>=0.0.0'], | ||
['', '*'], | ||
@@ -374,7 +390,7 @@ ['*', '*'], | ||
['<=2.0.0', '<=2.0.0'], | ||
['1', '>=1.0.0-0 <2.0.0-0'], | ||
['1', '>=1.0.0 <2.0.0'], | ||
['<=2.0.0', '<=2.0.0'], | ||
['<=2.0.0', '<=2.0.0'], | ||
['<2.0.0', '<2.0.0-0'], | ||
['<2.0.0', '<2.0.0-0'], | ||
['<2.0.0', '<2.0.0'], | ||
['<2.0.0', '<2.0.0'], | ||
['>= 1.0.0', '>=1.0.0'], | ||
@@ -388,52 +404,52 @@ ['>= 1.0.0', '>=1.0.0'], | ||
['<= 2.0.0', '<=2.0.0'], | ||
['< 2.0.0', '<2.0.0-0'], | ||
['< 2.0.0', '<2.0.0-0'], | ||
['< 2.0.0', '<2.0.0'], | ||
['< 2.0.0', '<2.0.0'], | ||
['>=0.1.97', '>=0.1.97'], | ||
['>=0.1.97', '>=0.1.97'], | ||
['0.1.20 || 1.2.4', '0.1.20||1.2.4'], | ||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'], | ||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'], | ||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'], | ||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], | ||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], | ||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], | ||
['||', '||'], | ||
['2.x.x', '>=2.0.0-0 <3.0.0-0'], | ||
['1.2.x', '>=1.2.0-0 <1.3.0-0'], | ||
['1.2.x || 2.x', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'], | ||
['1.2.x || 2.x', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'], | ||
['2.x.x', '>=2.0.0 <3.0.0'], | ||
['1.2.x', '>=1.2.0 <1.3.0'], | ||
['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], | ||
['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], | ||
['x', '*'], | ||
['2.*.*', '>=2.0.0-0 <3.0.0-0'], | ||
['1.2.*', '>=1.2.0-0 <1.3.0-0'], | ||
['1.2.* || 2.*', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'], | ||
['2.*.*', '>=2.0.0 <3.0.0'], | ||
['1.2.*', '>=1.2.0 <1.3.0'], | ||
['1.2.* || 2.*', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], | ||
['*', '*'], | ||
['2', '>=2.0.0-0 <3.0.0-0'], | ||
['2.3', '>=2.3.0-0 <2.4.0-0'], | ||
['~2.4', '>=2.4.0-0 <2.5.0-0'], | ||
['~2.4', '>=2.4.0-0 <2.5.0-0'], | ||
['~>3.2.1', '>=3.2.1-0 <3.3.0-0'], | ||
['~1', '>=1.0.0-0 <2.0.0-0'], | ||
['~>1', '>=1.0.0-0 <2.0.0-0'], | ||
['~> 1', '>=1.0.0-0 <2.0.0-0'], | ||
['~1.0', '>=1.0.0-0 <1.1.0-0'], | ||
['~ 1.0', '>=1.0.0-0 <1.1.0-0'], | ||
['^0', '>=0.0.0-0 <1.0.0-0'], | ||
['^ 1', '>=1.0.0-0 <2.0.0-0'], | ||
['^0.1', '>=0.1.0-0 <0.2.0-0'], | ||
['^1.0', '>=1.0.0-0 <2.0.0-0'], | ||
['^1.2', '>=1.2.0-0 <2.0.0-0'], | ||
['^0.0.1', '0.0.1'], | ||
['^0.0.1-beta', '0.0.1-beta'], | ||
['^0.1.2', '0.1.2'], | ||
['^1.2.3', '>=1.2.3-0 <2.0.0-0'], | ||
['^1.2.3-beta.4', '>=1.2.3-beta.4 <2.0.0-0'], | ||
['<1', '<1.0.0-0'], | ||
['< 1', '<1.0.0-0'], | ||
['>=1', '>=1.0.0-0'], | ||
['>= 1', '>=1.0.0-0'], | ||
['<1.2', '<1.2.0-0'], | ||
['< 1.2', '<1.2.0-0'], | ||
['1', '>=1.0.0-0 <2.0.0-0'], | ||
['2', '>=2.0.0 <3.0.0'], | ||
['2.3', '>=2.3.0 <2.4.0'], | ||
['~2.4', '>=2.4.0 <2.5.0'], | ||
['~2.4', '>=2.4.0 <2.5.0'], | ||
['~>3.2.1', '>=3.2.1 <3.3.0'], | ||
['~1', '>=1.0.0 <2.0.0'], | ||
['~>1', '>=1.0.0 <2.0.0'], | ||
['~> 1', '>=1.0.0 <2.0.0'], | ||
['~1.0', '>=1.0.0 <1.1.0'], | ||
['~ 1.0', '>=1.0.0 <1.1.0'], | ||
['^0', '>=0.0.0 <1.0.0'], | ||
['^ 1', '>=1.0.0 <2.0.0'], | ||
['^0.1', '>=0.1.0 <0.2.0'], | ||
['^1.0', '>=1.0.0 <2.0.0'], | ||
['^1.2', '>=1.2.0 <2.0.0'], | ||
['^0.0.1', '>=0.0.1 <0.0.2'], | ||
['^0.0.1-beta', '>=0.0.1-beta <0.0.2'], | ||
['^0.1.2', '>=0.1.2 <0.2.0'], | ||
['^1.2.3', '>=1.2.3 <2.0.0'], | ||
['^1.2.3-beta.4', '>=1.2.3-beta.4 <2.0.0'], | ||
['<1', '<1.0.0'], | ||
['< 1', '<1.0.0'], | ||
['>=1', '>=1.0.0'], | ||
['>= 1', '>=1.0.0'], | ||
['<1.2', '<1.2.0'], | ||
['< 1.2', '<1.2.0'], | ||
['1', '>=1.0.0 <2.0.0'], | ||
['>01.02.03', '>1.2.3', true], | ||
['>01.02.03', null], | ||
['~1.2.3beta', '>=1.2.3-beta <1.3.0-0', true], | ||
['~1.2.3beta', '>=1.2.3-beta <1.3.0', true], | ||
['~1.2.3beta', null], | ||
['^ 1.2 ^ 1', '>=1.2.0-0 <2.0.0-0 >=1.0.0-0 <2.0.0-0'] | ||
['^ 1.2 ^ 1', '>=1.2.0 <2.0.0 >=1.0.0 <2.0.0'] | ||
].forEach(function(v) { | ||
@@ -456,3 +472,3 @@ var pre = v[0]; | ||
['1.0.0', [['1.0.0']]], | ||
['>=*', [['>=0.0.0-0']]], | ||
['>=*', [['>=0.0.0']]], | ||
['', [['']]], | ||
@@ -467,7 +483,7 @@ ['*', [['']]], | ||
['<=2.0.0', [['<=2.0.0']]], | ||
['1', [['>=1.0.0-0', '<2.0.0-0']]], | ||
['1', [['>=1.0.0', '<2.0.0']]], | ||
['<=2.0.0', [['<=2.0.0']]], | ||
['<=2.0.0', [['<=2.0.0']]], | ||
['<2.0.0', [['<2.0.0-0']]], | ||
['<2.0.0', [['<2.0.0-0']]], | ||
['<2.0.0', [['<2.0.0']]], | ||
['<2.0.0', [['<2.0.0']]], | ||
['>= 1.0.0', [['>=1.0.0']]], | ||
@@ -481,43 +497,44 @@ ['>= 1.0.0', [['>=1.0.0']]], | ||
['<= 2.0.0', [['<=2.0.0']]], | ||
['< 2.0.0', [['<2.0.0-0']]], | ||
['<\t2.0.0', [['<2.0.0-0']]], | ||
['< 2.0.0', [['<2.0.0']]], | ||
['<\t2.0.0', [['<2.0.0']]], | ||
['>=0.1.97', [['>=0.1.97']]], | ||
['>=0.1.97', [['>=0.1.97']]], | ||
['0.1.20 || 1.2.4', [['0.1.20'], ['1.2.4']]], | ||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]], | ||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]], | ||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]], | ||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], | ||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], | ||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], | ||
['||', [[''], ['']]], | ||
['2.x.x', [['>=2.0.0-0', '<3.0.0-0']]], | ||
['1.2.x', [['>=1.2.0-0', '<1.3.0-0']]], | ||
['1.2.x || 2.x', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]], | ||
['1.2.x || 2.x', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]], | ||
['2.x.x', [['>=2.0.0', '<3.0.0']]], | ||
['1.2.x', [['>=1.2.0', '<1.3.0']]], | ||
['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], | ||
['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], | ||
['x', [['']]], | ||
['2.*.*', [['>=2.0.0-0', '<3.0.0-0']]], | ||
['1.2.*', [['>=1.2.0-0', '<1.3.0-0']]], | ||
['1.2.* || 2.*', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]], | ||
['1.2.* || 2.*', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]], | ||
['2.*.*', [['>=2.0.0', '<3.0.0']]], | ||
['1.2.*', [['>=1.2.0', '<1.3.0']]], | ||
['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], | ||
['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], | ||
['*', [['']]], | ||
['2', [['>=2.0.0-0', '<3.0.0-0']]], | ||
['2.3', [['>=2.3.0-0', '<2.4.0-0']]], | ||
['~2.4', [['>=2.4.0-0', '<2.5.0-0']]], | ||
['~2.4', [['>=2.4.0-0', '<2.5.0-0']]], | ||
['~>3.2.1', [['>=3.2.1-0', '<3.3.0-0']]], | ||
['~1', [['>=1.0.0-0', '<2.0.0-0']]], | ||
['~>1', [['>=1.0.0-0', '<2.0.0-0']]], | ||
['~> 1', [['>=1.0.0-0', '<2.0.0-0']]], | ||
['~1.0', [['>=1.0.0-0', '<1.1.0-0']]], | ||
['~ 1.0', [['>=1.0.0-0', '<1.1.0-0']]], | ||
['~ 1.0.3', [['>=1.0.3-0', '<1.1.0-0']]], | ||
['~> 1.0.3', [['>=1.0.3-0', '<1.1.0-0']]], | ||
['<1', [['<1.0.0-0']]], | ||
['< 1', [['<1.0.0-0']]], | ||
['>=1', [['>=1.0.0-0']]], | ||
['>= 1', [['>=1.0.0-0']]], | ||
['<1.2', [['<1.2.0-0']]], | ||
['< 1.2', [['<1.2.0-0']]], | ||
['1', [['>=1.0.0-0', '<2.0.0-0']]], | ||
['1 2', [['>=1.0.0-0', '<2.0.0-0', '>=2.0.0-0', '<3.0.0-0']]], | ||
['1.2 - 3.4.5', [['>=1.2.0-0', '<=3.4.5']]], | ||
['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0-0']]] | ||
['2', [['>=2.0.0', '<3.0.0']]], | ||
['2.3', [['>=2.3.0', '<2.4.0']]], | ||
['~2.4', [['>=2.4.0', '<2.5.0']]], | ||
['~2.4', [['>=2.4.0', '<2.5.0']]], | ||
['~>3.2.1', [['>=3.2.1', '<3.3.0']]], | ||
['~1', [['>=1.0.0', '<2.0.0']]], | ||
['~>1', [['>=1.0.0', '<2.0.0']]], | ||
['~> 1', [['>=1.0.0', '<2.0.0']]], | ||
['~1.0', [['>=1.0.0', '<1.1.0']]], | ||
['~ 1.0', [['>=1.0.0', '<1.1.0']]], | ||
['~ 1.0.3', [['>=1.0.3', '<1.1.0']]], | ||
['~> 1.0.3', [['>=1.0.3', '<1.1.0']]], | ||
['<1', [['<1.0.0']]], | ||
['< 1', [['<1.0.0']]], | ||
['>=1', [['>=1.0.0']]], | ||
['>= 1', [['>=1.0.0']]], | ||
['<1.2', [['<1.2.0']]], | ||
['< 1.2', [['<1.2.0']]], | ||
['1', [['>=1.0.0', '<2.0.0']]], | ||
['1 2', [['>=1.0.0', '<2.0.0', '>=2.0.0', '<3.0.0']]], | ||
['1.2 - 3.4.5', [['>=1.2.0', '<=3.4.5']]], | ||
['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0']]], | ||
['1.2.3 - 3', [['>=1.2.3', '<4.0.0']]] | ||
].forEach(function(v) { | ||
@@ -576,3 +593,3 @@ var pre = v[0]; | ||
[['>=01.02.03', '>=1.2.3'], | ||
['~1.02.03beta', '>=1.2.3-beta <1.3.0-0'] | ||
['~1.02.03beta', '>=1.2.3-beta <1.3.0'] | ||
].forEach(function(v) { | ||
@@ -579,0 +596,0 @@ var loose = v[0]; |
@@ -69,2 +69,6 @@ var tap = require('tap'); | ||
['=0.7.x', '0.6.2'], | ||
['=0.7.x', '0.7.0-asdf'], | ||
['^1', '1.0.0-0'], | ||
['>=0.7.x', '0.7.0-asdf'], | ||
['1', '1.0.0beta', true], | ||
['>=0.7.x', '0.6.2'] | ||
@@ -149,3 +153,2 @@ ].forEach(function(tuple) { | ||
['< 1.2', '1.1.1'], | ||
['1', '1.0.0beta', true], | ||
['~v0.5.4-pre', '0.5.5'], | ||
@@ -155,4 +158,2 @@ ['~v0.5.4-pre', '0.5.4'], | ||
['>=0.7.x', '0.7.2'], | ||
['=0.7.x', '0.7.0-asdf'], | ||
['>=0.7.x', '0.7.0-asdf'], | ||
['<=0.7.x', '0.6.2'], | ||
@@ -162,3 +163,2 @@ ['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'], | ||
['1.0.0 - 2.0.0', '2.0.0'], | ||
['^1', '1.0.0-0'], | ||
['^3.0.0', '4.0.0'], | ||
@@ -170,2 +170,8 @@ ['^1.0.0 || ~2.0.1', '2.0.0'], | ||
['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'], | ||
['^1.0.0alpha', '1.0.0beta', true], | ||
['~1.0.0alpha', '1.0.0beta', true], | ||
['^1.0.0-alpha', '1.0.0beta', true], | ||
['~1.0.0-alpha', '1.0.0beta', true], | ||
['^1.0.0-alpha', '1.0.0-beta'], | ||
['~1.0.0-alpha', '1.0.0-beta'], | ||
['=0.1.0', '1.0.0'] | ||
@@ -172,0 +178,0 @@ ].forEach(function(tuple) { |
@@ -7,5 +7,5 @@ var tap = require('tap'); | ||
var vm = require('vm'); | ||
var head = fs.readFileSync(require.resolve('../head.js'), 'utf8'); | ||
var head = fs.readFileSync(require.resolve('../head.js.txt'), 'utf8'); | ||
var src = fs.readFileSync(require.resolve('../'), 'utf8'); | ||
var foot = fs.readFileSync(require.resolve('../foot.js'), 'utf8'); | ||
var foot = fs.readFileSync(require.resolve('../foot.js.txt'), 'utf8'); | ||
vm.runInThisContext(head + src + foot, 'semver.js'); | ||
@@ -12,0 +12,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130489
2837
276