mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-03 23:09:17 -05:00
semver@4.1.0
This commit is contained in:
parent
2b99b23eec
commit
40baedaa78
17 changed files with 722 additions and 351 deletions
6
node_modules/semver/Makefile
generated
vendored
6
node_modules/semver/Makefile
generated
vendored
|
@ -8,12 +8,12 @@ all: $(files)
|
|||
clean:
|
||||
rm -f $(files)
|
||||
|
||||
semver.browser.js: head.js semver.js foot.js
|
||||
( cat head.js; \
|
||||
semver.browser.js: head.js.txt semver.js foot.js.txt
|
||||
( cat head.js.txt; \
|
||||
cat semver.js | \
|
||||
egrep -v '^ *\/\* nomin \*\/' | \
|
||||
perl -pi -e 's/debug\([^\)]+\)//g'; \
|
||||
cat foot.js ) > semver.browser.js
|
||||
cat foot.js.txt ) > semver.browser.js
|
||||
|
||||
semver.min.js: semver.browser.js
|
||||
uglifyjs -m <semver.browser.js >semver.min.js
|
||||
|
|
203
node_modules/semver/README.md
generated
vendored
203
node_modules/semver/README.md
generated
vendored
|
@ -41,53 +41,170 @@ A leading `"="` or `"v"` character is stripped off and ignored.
|
|||
|
||||
## Ranges
|
||||
|
||||
The following range styles are supported:
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
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` 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.
|
||||
* `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
|
||||
|
||||
|
|
10
node_modules/semver/bin/semver
generated
vendored
10
node_modules/semver/bin/semver
generated
vendored
|
@ -12,6 +12,7 @@ var argv = process.argv.slice(2)
|
|||
, inc = null
|
||||
, version = require("../package.json").version
|
||||
, loose = false
|
||||
, identifier = undefined
|
||||
, semver = require("../semver")
|
||||
, reverse = false
|
||||
|
||||
|
@ -47,6 +48,9 @@ function main () {
|
|||
break
|
||||
}
|
||||
break
|
||||
case "--preid":
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case "-r": case "--range":
|
||||
range.push(argv.shift())
|
||||
break
|
||||
|
@ -88,7 +92,7 @@ function success () {
|
|||
}).map(function (v) {
|
||||
return semver.clean(v, loose)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, loose) : v
|
||||
return inc ? semver.inc(v, inc, loose, identifier) : v
|
||||
}).forEach(function (v,i,_) { console.log(v) })
|
||||
}
|
||||
|
||||
|
@ -111,6 +115,10 @@ function help () {
|
|||
," prepatch, or prerelease. Default level is 'patch'."
|
||||
," Only one version may be specified."
|
||||
,""
|
||||
,"--preid <identifier>"
|
||||
," Identifier to be used to prefix premajor, preminor,"
|
||||
," prepatch or prerelease version increments."
|
||||
,""
|
||||
,"-l --loose"
|
||||
," Interpret versions and ranges loosely"
|
||||
,""
|
||||
|
|
0
node_modules/semver/foot.js → node_modules/semver/foot.js.txt
generated
vendored
0
node_modules/semver/foot.js → node_modules/semver/foot.js.txt
generated
vendored
0
node_modules/semver/head.js → node_modules/semver/head.js.txt
generated
vendored
0
node_modules/semver/head.js → node_modules/semver/head.js.txt
generated
vendored
24
node_modules/semver/package.json
generated
vendored
24
node_modules/semver/package.json
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "semver",
|
||||
"version": "3.0.1",
|
||||
"version": "4.1.0",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "semver.js",
|
||||
"browser": "semver.browser.js",
|
||||
|
@ -21,15 +21,16 @@
|
|||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
"gitHead": "4b24aeb54dd23560f53b0df01e64e5f229e6172f",
|
||||
"gitHead": "f8db569b9fd00788d14064aaf81854ed81e1337a",
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-semver/issues"
|
||||
},
|
||||
"homepage": "https://github.com/isaacs/node-semver",
|
||||
"_id": "semver@3.0.1",
|
||||
"_shasum": "720ac012515a252f91fb0dd2e99a56a70d6cf078",
|
||||
"_from": "semver@>=2.2.1 <4.0.0-0",
|
||||
"_npmVersion": "2.0.0-alpha-5",
|
||||
"_id": "semver@4.1.0",
|
||||
"_shasum": "bc80a9ff68532814362cc3cfda3c7b75ed9c321c",
|
||||
"_from": "semver@>=2.2.1 <5.0.0-0",
|
||||
"_npmVersion": "2.1.3",
|
||||
"_nodeVersion": "0.10.31",
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
|
@ -38,13 +39,16 @@
|
|||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
{
|
||||
"name": "othiym23",
|
||||
"email": "ogd@aoaioxxysz.net"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "720ac012515a252f91fb0dd2e99a56a70d6cf078",
|
||||
"tarball": "http://registry.npmjs.org/semver/-/semver-3.0.1.tgz"
|
||||
"shasum": "bc80a9ff68532814362cc3cfda3c7b75ed9c321c",
|
||||
"tarball": "http://registry.npmjs.org/semver/-/semver-4.1.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-3.0.1.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-4.1.0.tgz"
|
||||
}
|
||||
|
|
263
node_modules/semver/semver.browser.js
generated
vendored
263
node_modules/semver/semver.browser.js
generated
vendored
|
@ -128,18 +128,18 @@ var XRANGEPLAIN = R++;
|
|||
src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:(' + src[PRERELEASE] + ')' +
|
||||
')?)?)?';
|
||||
'(?:' + src[PRERELEASE] + ')?' +
|
||||
src[BUILD] + '?' +
|
||||
')?)?';
|
||||
|
||||
var XRANGEPLAINLOOSE = R++;
|
||||
src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + 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++;
|
||||
src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
|
||||
var XRANGELOOSE = R++;
|
||||
|
@ -236,7 +236,7 @@ function valid(version, loose) {
|
|||
|
||||
exports.clean = clean;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -345,36 +345,55 @@ SemVer.prototype.comparePre = function(other) {
|
|||
|
||||
// preminor will bump the version up to the next minor release, and immediately
|
||||
// down to pre-release. premajor and prepatch work the same way.
|
||||
SemVer.prototype.inc = function(release) {
|
||||
SemVer.prototype.inc = function(release, identifier) {
|
||||
switch (release) {
|
||||
case 'premajor':
|
||||
this.inc('major');
|
||||
this.inc('pre');
|
||||
this.prerelease.length = 0;
|
||||
this.patch = 0;
|
||||
this.minor = 0;
|
||||
this.major++;
|
||||
this.inc('pre', identifier);
|
||||
break;
|
||||
case 'preminor':
|
||||
this.inc('minor');
|
||||
this.inc('pre');
|
||||
this.prerelease.length = 0;
|
||||
this.patch = 0;
|
||||
this.minor++;
|
||||
this.inc('pre', identifier);
|
||||
break;
|
||||
case 'prepatch':
|
||||
// If this is already a prerelease, it will bump to the next version
|
||||
// drop any prereleases that might already exist, since they are not
|
||||
// relevant at this point.
|
||||
this.prerelease.length = 0;
|
||||
this.inc('patch');
|
||||
this.inc('pre');
|
||||
this.inc('patch', identifier);
|
||||
this.inc('pre', identifier);
|
||||
break;
|
||||
// If the input is a non-prerelease version, this acts the same as
|
||||
// prepatch.
|
||||
case 'prerelease':
|
||||
if (this.prerelease.length === 0)
|
||||
this.inc('patch');
|
||||
this.inc('pre');
|
||||
this.inc('patch', identifier);
|
||||
this.inc('pre', identifier);
|
||||
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;
|
||||
this.prerelease = [];
|
||||
break;
|
||||
|
@ -387,7 +406,7 @@ SemVer.prototype.inc = function(release) {
|
|||
this.patch++;
|
||||
this.prerelease = [];
|
||||
break;
|
||||
// This probably shouldn't be used publically.
|
||||
// This probably shouldn't be used publicly.
|
||||
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
||||
case 'pre':
|
||||
if (this.prerelease.length === 0)
|
||||
|
@ -403,6 +422,15 @@ SemVer.prototype.inc = function(release) {
|
|||
if (i === -1) // didn't increment anything
|
||||
this.prerelease.push(0);
|
||||
}
|
||||
if (identifier) {
|
||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||
if (this.prerelease[0] === identifier) {
|
||||
if (isNaN(this.prerelease[1]))
|
||||
this.prerelease = [identifier, 0];
|
||||
} else
|
||||
this.prerelease = [identifier, 0];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -413,9 +441,14 @@ SemVer.prototype.inc = function(release) {
|
|||
};
|
||||
|
||||
exports.inc = inc;
|
||||
function inc(version, release, loose) {
|
||||
function inc(version, release, loose, identifier) {
|
||||
if (typeof(loose) === 'string') {
|
||||
identifier = loose;
|
||||
loose = undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(version, loose).inc(release).version;
|
||||
return new SemVer(version, loose).inc(release, identifier).version;
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
|
@ -508,8 +541,16 @@ exports.cmp = cmp;
|
|||
function cmp(a, op, b, loose) {
|
||||
var ret;
|
||||
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;
|
||||
case '!=': ret = neq(a, b, loose); break;
|
||||
case '>': ret = gt(a, b, loose); break;
|
||||
|
@ -541,6 +582,8 @@ function Comparator(comp, loose) {
|
|||
this.value = '';
|
||||
else
|
||||
this.value = this.operator + this.semver.version;
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
var ANY = {};
|
||||
|
@ -558,21 +601,8 @@ Comparator.prototype.parse = function(comp) {
|
|||
// if it literally is just '>' or '' then allow anything.
|
||||
if (!m[2])
|
||||
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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Comparator.prototype.inspect = function() {
|
||||
|
@ -585,8 +615,14 @@ Comparator.prototype.toString = function() {
|
|||
|
||||
Comparator.prototype.test = function(version) {
|
||||
;
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -723,20 +759,20 @@ function replaceTilde(comp, loose) {
|
|||
if (isX(M))
|
||||
ret = '';
|
||||
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) {
|
||||
;
|
||||
if (pr.charAt(0) !== '-')
|
||||
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';
|
||||
|
||||
;
|
||||
return ret;
|
||||
|
@ -756,33 +792,48 @@ function replaceCarets(comp, loose) {
|
|||
}
|
||||
|
||||
function replaceCaret(comp, loose) {
|
||||
;
|
||||
var r = loose ? re[CARETLOOSE] : re[CARET];
|
||||
return comp.replace(r, function(_, M, m, p, pr) {
|
||||
;
|
||||
var ret;
|
||||
if (pr) {
|
||||
if (pr.charAt(0) !== '-')
|
||||
pr = '-' + pr;
|
||||
} else
|
||||
pr = '';
|
||||
|
||||
if (isX(M))
|
||||
ret = '';
|
||||
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';
|
||||
}
|
||||
|
||||
;
|
||||
return ret;
|
||||
|
@ -809,23 +860,27 @@ function replaceXRange(comp, loose) {
|
|||
if (gtlt === '=' && anyX)
|
||||
gtlt = '';
|
||||
|
||||
if (gtlt && anyX) {
|
||||
// replace X with 0, and then append the -0 min-prerelease
|
||||
if (xM)
|
||||
M = 0;
|
||||
if (xM) {
|
||||
if (gtlt === '>' || gtlt === '<') {
|
||||
// nothing is allowed
|
||||
ret = '<0.0.0';
|
||||
} else {
|
||||
// nothing is forbidden
|
||||
ret = '*';
|
||||
}
|
||||
} else if (gtlt && anyX) {
|
||||
// replace X with 0
|
||||
if (xm)
|
||||
m = 0;
|
||||
if (xp)
|
||||
p = 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 = '>=';
|
||||
if (xM) {
|
||||
// no change
|
||||
} else if (xm) {
|
||||
if (xm) {
|
||||
M = +M + 1;
|
||||
m = 0;
|
||||
p = 0;
|
||||
|
@ -833,20 +888,21 @@ function replaceXRange(comp, loose) {
|
|||
m = +m + 1;
|
||||
p = 0;
|
||||
}
|
||||
} else if (gtlt === '<=') {
|
||||
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
||||
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
||||
gtlt = '<'
|
||||
if (xm)
|
||||
M = +M + 1
|
||||
else
|
||||
m = +m + 1
|
||||
}
|
||||
|
||||
|
||||
ret = gtlt + M + '.' + m + '.' + p + '-0';
|
||||
} else if (xM) {
|
||||
// allow any
|
||||
ret = '*';
|
||||
ret = gtlt + M + '.' + m + '.' + p;
|
||||
} 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';
|
||||
}
|
||||
|
||||
;
|
||||
|
@ -865,9 +921,9 @@ function replaceStars(comp, loose) {
|
|||
|
||||
// This function is passed to string.replace(re[HYPHENRANGE])
|
||||
// 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,
|
||||
from, fM, fm, fp, fpr, fb,
|
||||
to, tM, tm, tp, tpr, tb) {
|
||||
|
@ -875,18 +931,18 @@ function hyphenReplace($0,
|
|||
if (isX(fM))
|
||||
from = '';
|
||||
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
|
||||
from = '>=' + from;
|
||||
|
||||
if (isX(tM))
|
||||
to = '';
|
||||
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)
|
||||
to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
|
||||
else
|
||||
|
@ -900,6 +956,10 @@ function hyphenReplace($0,
|
|||
Range.prototype.test = function(version) {
|
||||
if (!version)
|
||||
return false;
|
||||
|
||||
if (typeof version === 'string')
|
||||
version = new SemVer(version, this.loose);
|
||||
|
||||
for (var i = 0; i < this.set.length; i++) {
|
||||
if (testSet(this.set[i], version))
|
||||
return true;
|
||||
|
@ -912,6 +972,31 @@ function testSet(set, version) {
|
|||
if (!set[i].test(version))
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
BIN
node_modules/semver/semver.browser.js.gz
generated
vendored
BIN
node_modules/semver/semver.browser.js.gz
generated
vendored
Binary file not shown.
263
node_modules/semver/semver.js
generated
vendored
263
node_modules/semver/semver.js
generated
vendored
|
@ -138,18 +138,18 @@ var XRANGEPLAIN = R++;
|
|||
src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:(' + src[PRERELEASE] + ')' +
|
||||
')?)?)?';
|
||||
'(?:' + src[PRERELEASE] + ')?' +
|
||||
src[BUILD] + '?' +
|
||||
')?)?';
|
||||
|
||||
var XRANGEPLAINLOOSE = R++;
|
||||
src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + 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++;
|
||||
src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
|
||||
var XRANGELOOSE = R++;
|
||||
|
@ -246,7 +246,7 @@ function valid(version, loose) {
|
|||
|
||||
exports.clean = clean;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -355,36 +355,55 @@ SemVer.prototype.comparePre = function(other) {
|
|||
|
||||
// preminor will bump the version up to the next minor release, and immediately
|
||||
// down to pre-release. premajor and prepatch work the same way.
|
||||
SemVer.prototype.inc = function(release) {
|
||||
SemVer.prototype.inc = function(release, identifier) {
|
||||
switch (release) {
|
||||
case 'premajor':
|
||||
this.inc('major');
|
||||
this.inc('pre');
|
||||
this.prerelease.length = 0;
|
||||
this.patch = 0;
|
||||
this.minor = 0;
|
||||
this.major++;
|
||||
this.inc('pre', identifier);
|
||||
break;
|
||||
case 'preminor':
|
||||
this.inc('minor');
|
||||
this.inc('pre');
|
||||
this.prerelease.length = 0;
|
||||
this.patch = 0;
|
||||
this.minor++;
|
||||
this.inc('pre', identifier);
|
||||
break;
|
||||
case 'prepatch':
|
||||
// If this is already a prerelease, it will bump to the next version
|
||||
// drop any prereleases that might already exist, since they are not
|
||||
// relevant at this point.
|
||||
this.prerelease.length = 0;
|
||||
this.inc('patch');
|
||||
this.inc('pre');
|
||||
this.inc('patch', identifier);
|
||||
this.inc('pre', identifier);
|
||||
break;
|
||||
// If the input is a non-prerelease version, this acts the same as
|
||||
// prepatch.
|
||||
case 'prerelease':
|
||||
if (this.prerelease.length === 0)
|
||||
this.inc('patch');
|
||||
this.inc('pre');
|
||||
this.inc('patch', identifier);
|
||||
this.inc('pre', identifier);
|
||||
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;
|
||||
this.prerelease = [];
|
||||
break;
|
||||
|
@ -397,7 +416,7 @@ SemVer.prototype.inc = function(release) {
|
|||
this.patch++;
|
||||
this.prerelease = [];
|
||||
break;
|
||||
// This probably shouldn't be used publically.
|
||||
// This probably shouldn't be used publicly.
|
||||
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
||||
case 'pre':
|
||||
if (this.prerelease.length === 0)
|
||||
|
@ -413,6 +432,15 @@ SemVer.prototype.inc = function(release) {
|
|||
if (i === -1) // didn't increment anything
|
||||
this.prerelease.push(0);
|
||||
}
|
||||
if (identifier) {
|
||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||
if (this.prerelease[0] === identifier) {
|
||||
if (isNaN(this.prerelease[1]))
|
||||
this.prerelease = [identifier, 0];
|
||||
} else
|
||||
this.prerelease = [identifier, 0];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -423,9 +451,14 @@ SemVer.prototype.inc = function(release) {
|
|||
};
|
||||
|
||||
exports.inc = inc;
|
||||
function inc(version, release, loose) {
|
||||
function inc(version, release, loose, identifier) {
|
||||
if (typeof(loose) === 'string') {
|
||||
identifier = loose;
|
||||
loose = undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(version, loose).inc(release).version;
|
||||
return new SemVer(version, loose).inc(release, identifier).version;
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
|
@ -518,8 +551,16 @@ exports.cmp = cmp;
|
|||
function cmp(a, op, b, loose) {
|
||||
var ret;
|
||||
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;
|
||||
case '!=': ret = neq(a, b, loose); break;
|
||||
case '>': ret = gt(a, b, loose); break;
|
||||
|
@ -551,6 +592,8 @@ function Comparator(comp, loose) {
|
|||
this.value = '';
|
||||
else
|
||||
this.value = this.operator + this.semver.version;
|
||||
|
||||
debug('comp', this);
|
||||
}
|
||||
|
||||
var ANY = {};
|
||||
|
@ -568,21 +611,8 @@ Comparator.prototype.parse = function(comp) {
|
|||
// if it literally is just '>' or '' then allow anything.
|
||||
if (!m[2])
|
||||
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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Comparator.prototype.inspect = function() {
|
||||
|
@ -595,8 +625,14 @@ Comparator.prototype.toString = function() {
|
|||
|
||||
Comparator.prototype.test = function(version) {
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -733,20 +769,20 @@ function replaceTilde(comp, loose) {
|
|||
if (isX(M))
|
||||
ret = '';
|
||||
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) {
|
||||
debug('replaceTilde pr', pr);
|
||||
if (pr.charAt(0) !== '-')
|
||||
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';
|
||||
|
||||
debug('tilde return', ret);
|
||||
return ret;
|
||||
|
@ -766,33 +802,48 @@ function replaceCarets(comp, loose) {
|
|||
}
|
||||
|
||||
function replaceCaret(comp, loose) {
|
||||
debug('caret', comp, loose);
|
||||
var r = loose ? re[CARETLOOSE] : re[CARET];
|
||||
return comp.replace(r, function(_, M, m, p, pr) {
|
||||
debug('caret', comp, _, M, m, p, pr);
|
||||
var ret;
|
||||
if (pr) {
|
||||
if (pr.charAt(0) !== '-')
|
||||
pr = '-' + pr;
|
||||
} else
|
||||
pr = '';
|
||||
|
||||
if (isX(M))
|
||||
ret = '';
|
||||
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';
|
||||
}
|
||||
|
||||
debug('caret return', ret);
|
||||
return ret;
|
||||
|
@ -819,23 +870,27 @@ function replaceXRange(comp, loose) {
|
|||
if (gtlt === '=' && anyX)
|
||||
gtlt = '';
|
||||
|
||||
if (gtlt && anyX) {
|
||||
// replace X with 0, and then append the -0 min-prerelease
|
||||
if (xM)
|
||||
M = 0;
|
||||
if (xM) {
|
||||
if (gtlt === '>' || gtlt === '<') {
|
||||
// nothing is allowed
|
||||
ret = '<0.0.0';
|
||||
} else {
|
||||
// nothing is forbidden
|
||||
ret = '*';
|
||||
}
|
||||
} else if (gtlt && anyX) {
|
||||
// replace X with 0
|
||||
if (xm)
|
||||
m = 0;
|
||||
if (xp)
|
||||
p = 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 = '>=';
|
||||
if (xM) {
|
||||
// no change
|
||||
} else if (xm) {
|
||||
if (xm) {
|
||||
M = +M + 1;
|
||||
m = 0;
|
||||
p = 0;
|
||||
|
@ -843,20 +898,21 @@ function replaceXRange(comp, loose) {
|
|||
m = +m + 1;
|
||||
p = 0;
|
||||
}
|
||||
} else if (gtlt === '<=') {
|
||||
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
||||
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
||||
gtlt = '<'
|
||||
if (xm)
|
||||
M = +M + 1
|
||||
else
|
||||
m = +m + 1
|
||||
}
|
||||
|
||||
|
||||
ret = gtlt + M + '.' + m + '.' + p + '-0';
|
||||
} else if (xM) {
|
||||
// allow any
|
||||
ret = '*';
|
||||
ret = gtlt + M + '.' + m + '.' + p;
|
||||
} 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';
|
||||
}
|
||||
|
||||
debug('xRange return', ret);
|
||||
|
@ -875,9 +931,9 @@ function replaceStars(comp, loose) {
|
|||
|
||||
// This function is passed to string.replace(re[HYPHENRANGE])
|
||||
// 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,
|
||||
from, fM, fm, fp, fpr, fb,
|
||||
to, tM, tm, tp, tpr, tb) {
|
||||
|
@ -885,18 +941,18 @@ function hyphenReplace($0,
|
|||
if (isX(fM))
|
||||
from = '';
|
||||
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
|
||||
from = '>=' + from;
|
||||
|
||||
if (isX(tM))
|
||||
to = '';
|
||||
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)
|
||||
to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
|
||||
else
|
||||
|
@ -910,6 +966,10 @@ function hyphenReplace($0,
|
|||
Range.prototype.test = function(version) {
|
||||
if (!version)
|
||||
return false;
|
||||
|
||||
if (typeof version === 'string')
|
||||
version = new SemVer(version, this.loose);
|
||||
|
||||
for (var i = 0; i < this.set.length; i++) {
|
||||
if (testSet(this.set[i], version))
|
||||
return true;
|
||||
|
@ -922,6 +982,31 @@ function testSet(set, version) {
|
|||
if (!set[i].test(version))
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
2
node_modules/semver/semver.min.js
generated
vendored
2
node_modules/semver/semver.min.js
generated
vendored
File diff suppressed because one or more lines are too long
BIN
node_modules/semver/semver.min.js.gz
generated
vendored
BIN
node_modules/semver/semver.min.js.gz
generated
vendored
Binary file not shown.
6
node_modules/semver/test/clean.js
generated
vendored
6
node_modules/semver/test/clean.js
generated
vendored
|
@ -14,7 +14,11 @@ test('\nclean tests', function(t) {
|
|||
[' =v1.2.3 ', '1.2.3'],
|
||||
['v1.2.3', '1.2.3'],
|
||||
[' v1.2.3 ', '1.2.3'],
|
||||
['\t1.2.3', '1.2.3']
|
||||
['\t1.2.3', '1.2.3'],
|
||||
['>1.2.3', null],
|
||||
['~1.2.3', null],
|
||||
['<=1.2.3', null],
|
||||
['1.2.x', null]
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
|
|
4
node_modules/semver/test/gtr.js
generated
vendored
4
node_modules/semver/test/gtr.js
generated
vendored
|
@ -39,7 +39,7 @@ test('\ngtr tests', function(t) {
|
|||
['~v0.5.4-pre', '0.6.1-pre'],
|
||||
['=0.7.x', '0.8.0'],
|
||||
['=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'],
|
||||
['1.0.0 - 2.0.0', '2.2.3'],
|
||||
['1.0.0', '1.0.1'],
|
||||
|
@ -66,7 +66,7 @@ test('\ngtr tests', function(t) {
|
|||
['<1', '1.0.0beta', true],
|
||||
['< 1', '1.0.0beta', true],
|
||||
['=0.7.x', '0.8.2'],
|
||||
['<=0.7.x', '0.7.2']
|
||||
['<0.7.x', '0.7.2']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
|
|
269
node_modules/semver/test/index.js
generated
vendored
269
node_modules/semver/test/index.js
generated
vendored
|
@ -132,6 +132,15 @@ test('\nrange tests', function(t) {
|
|||
// [range, version]
|
||||
// version should be included by range
|
||||
[['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'],
|
||||
['>=*', '0.2.4'],
|
||||
['', '1.0.0'],
|
||||
|
@ -189,13 +198,11 @@ test('\nrange tests', function(t) {
|
|||
['>= 1', '1.0.0'],
|
||||
['<1.2', '1.1.1'],
|
||||
['< 1.2', '1.1.1'],
|
||||
['1', '1.0.0beta', true],
|
||||
['~v0.5.4-pre', '0.5.5'],
|
||||
['~v0.5.4-pre', '0.5.4'],
|
||||
['=0.7.x', '0.7.2'],
|
||||
['<=0.7.x', '0.7.2'],
|
||||
['>=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'],
|
||||
['~1.2.1 >=1.2.3', '1.2.3'],
|
||||
['~1.2.1 =1.2.3', '1.2.3'],
|
||||
|
@ -207,17 +214,15 @@ test('\nrange tests', function(t) {
|
|||
['1.2.3 >=1.2.1', '1.2.3'],
|
||||
['>=1.2.3 >=1.2.1', '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'],
|
||||
['^0.1', '0.1.2'],
|
||||
['^1.2', '1.4.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) {
|
||||
var range = v[0];
|
||||
var ver = v[1];
|
||||
|
@ -231,6 +236,20 @@ test('\nnegative range tests', function(t) {
|
|||
// [range, version]
|
||||
// version should not be included by range
|
||||
[['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'],
|
||||
['>=1.0.0', '0.0.0'],
|
||||
['>=1.0.0', '0.0.1'],
|
||||
|
@ -270,11 +289,9 @@ test('\nnegative range tests', function(t) {
|
|||
['>=1.2', '1.1.1'],
|
||||
['1', '2.0.0beta', true],
|
||||
['~v0.5.4-beta', '0.5.4-alpha'],
|
||||
['<1', '1.0.0beta', true],
|
||||
['< 1', '1.0.0beta', true],
|
||||
['=0.7.x', '0.8.2'],
|
||||
['>=0.7.x', '0.6.2'],
|
||||
['<=0.7.x', '0.7.2'],
|
||||
['<0.7.x', '0.7.2'],
|
||||
['<1.2.3', '1.2.3-beta'],
|
||||
['=1.2.3', '1.2.3-beta'],
|
||||
['>1.2', '1.2.8'],
|
||||
|
@ -296,8 +313,8 @@ test('\nnegative range tests', function(t) {
|
|||
});
|
||||
|
||||
test('\nincrement versions test', function(t) {
|
||||
// [version, inc, result]
|
||||
// inc(version, inc) -> result
|
||||
// [version, inc, result, identifier]
|
||||
// inc(version, inc) -> result
|
||||
[['1.2.3', 'major', '2.0.0'],
|
||||
['1.2.3', 'minor', '1.3.0'],
|
||||
['1.2.3', 'patch', '1.2.4'],
|
||||
|
@ -332,18 +349,63 @@ test('\nincrement versions test', function(t) {
|
|||
['1.2.0', 'prepatch', '1.2.1-0'],
|
||||
['1.2.0-1', 'prepatch', '1.2.1-0'],
|
||||
['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'],
|
||||
|
||||
['1.2.3', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3', 'patch', '1.2.4', false, 'dev'],
|
||||
['1.2.3tag', 'major', '2.0.0', true, 'dev'],
|
||||
['1.2.3-tag', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3', 'fake', null, false, 'dev'],
|
||||
['1.2.0-0', 'patch', '1.2.0', false, 'dev'],
|
||||
['fake', 'major', null, false, 'dev'],
|
||||
['1.2.3-4', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3-4', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3-4', 'patch', '1.2.3', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'patch', '1.2.3', false, 'dev'],
|
||||
['1.2.4', 'prerelease', '1.2.5-dev.0', false, 'dev'],
|
||||
['1.2.3-0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1', false, 'alpha'],
|
||||
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3', false, 'alpha'],
|
||||
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta', false, 'alpha'],
|
||||
['1.2.0', 'prepatch', '1.2.1-dev.0', 'dev'],
|
||||
['1.2.0-1', 'prepatch', '1.2.1-dev.0', 'dev'],
|
||||
['1.2.0', 'preminor', '1.3.0-dev.0', 'dev'],
|
||||
['1.2.3-1', 'preminor', '1.3.0-dev.0', 'dev'],
|
||||
['1.2.0', 'premajor', '2.0.0-dev.0', 'dev'],
|
||||
['1.2.3-1', 'premajor', '2.0.0-dev.0', 'dev'],
|
||||
['1.2.0-1', 'minor', '1.2.0', 'dev'],
|
||||
['1.0.0-1', 'major', '1.0.0', 'dev'],
|
||||
['1.2.3-dev.bar', 'prerelease', '1.2.3-dev.0', false, 'dev']
|
||||
|
||||
].forEach(function(v) {
|
||||
var pre = v[0];
|
||||
var what = v[1];
|
||||
var wanted = v[2];
|
||||
var loose = v[3];
|
||||
var found = inc(pre, what, loose);
|
||||
t.equal(found, wanted, 'inc(' + pre + ', ' + what + ') === ' + wanted);
|
||||
var id = v[4];
|
||||
var found = inc(pre, what, loose, id);
|
||||
var cmd = 'inc(' + pre + ', ' + what + ', ' + id + ')';
|
||||
t.equal(found, wanted, cmd + ' === ' + wanted);
|
||||
});
|
||||
|
||||
t.end();
|
||||
|
@ -355,18 +417,18 @@ test('\nvalid range test', function(t) {
|
|||
// translate ranges into their canonical form
|
||||
[['1.0.0 - 2.0.0', '>=1.0.0 <=2.0.0'],
|
||||
['1.0.0', '1.0.0'],
|
||||
['>=*', '>=0.0.0-0'],
|
||||
['>=*', '*'],
|
||||
['', '*'],
|
||||
['*', '*'],
|
||||
['*', '*'],
|
||||
['>=1.0.0', '>=1.0.0'],
|
||||
['>1.0.0', '>1.0.0'],
|
||||
['<=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'],
|
||||
['>= 1.0.0', '>=1.0.0'],
|
||||
['>= 1.0.0', '>=1.0.0'],
|
||||
|
@ -375,56 +437,56 @@ test('\nvalid range test', function(t) {
|
|||
['<= 2.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'],
|
||||
['>=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) {
|
||||
var pre = v[0];
|
||||
var wanted = v[1];
|
||||
|
@ -442,7 +504,7 @@ test('\ncomparators test', function(t) {
|
|||
// turn range into a set of individual comparators
|
||||
[['1.0.0 - 2.0.0', [['>=1.0.0', '<=2.0.0']]],
|
||||
['1.0.0', [['1.0.0']]],
|
||||
['>=*', [['>=0.0.0-0']]],
|
||||
['>=*', [['']]],
|
||||
['', [['']]],
|
||||
['*', [['']]],
|
||||
['*', [['']]],
|
||||
|
@ -452,11 +514,11 @@ test('\ncomparators test', function(t) {
|
|||
['>1.0.0', [['>1.0.0']]],
|
||||
['>1.0.0', [['>1.0.0']]],
|
||||
['<=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']]],
|
||||
['>= 1.0.0', [['>=1.0.0']]],
|
||||
['>= 1.0.0', [['>=1.0.0']]],
|
||||
|
@ -465,47 +527,50 @@ test('\ncomparators test', function(t) {
|
|||
['<= 2.0.0', [['<=2.0.0']]],
|
||||
['<= 2.0.0', [['<=2.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']]],
|
||||
['>*', [['<0.0.0']]],
|
||||
['<*', [['<0.0.0']]]
|
||||
].forEach(function(v) {
|
||||
var pre = v[0];
|
||||
var wanted = v[1];
|
||||
|
@ -559,7 +624,7 @@ test('\nstrict vs loose version numbers', function(t) {
|
|||
|
||||
test('\nstrict vs loose ranges', function(t) {
|
||||
[['>=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) {
|
||||
var loose = v[0];
|
||||
var comps = v[1];
|
||||
|
|
14
node_modules/semver/test/ltr.js
generated
vendored
14
node_modules/semver/test/ltr.js
generated
vendored
|
@ -66,6 +66,10 @@ test('\nltr tests', function(t) {
|
|||
['>1', '1.0.0beta', true],
|
||||
['> 1', '1.0.0beta', true],
|
||||
['=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']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
|
@ -145,24 +149,26 @@ test('\nnegative ltr tests', function(t) {
|
|||
['>= 1', '1.0.0'],
|
||||
['<1.2', '1.1.1'],
|
||||
['< 1.2', '1.1.1'],
|
||||
['1', '1.0.0beta', true],
|
||||
['~v0.5.4-pre', '0.5.5'],
|
||||
['~v0.5.4-pre', '0.5.4'],
|
||||
['=0.7.x', '0.7.2'],
|
||||
['>=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'],
|
||||
['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'],
|
||||
['>=0.2.3 <=0.2.4', '0.2.4'],
|
||||
['1.0.0 - 2.0.0', '2.0.0'],
|
||||
['^1', '1.0.0-0'],
|
||||
['^3.0.0', '4.0.0'],
|
||||
['^1.0.0 || ~2.0.1', '2.0.0'],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true],
|
||||
['^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']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
|
|
4
node_modules/semver/test/no-module.js
generated
vendored
4
node_modules/semver/test/no-module.js
generated
vendored
|
@ -4,9 +4,9 @@ var test = tap.test;
|
|||
test('no module system', function(t) {
|
||||
var fs = require('fs');
|
||||
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');
|
||||
|
||||
// just some basic poking to see if it did some stuff
|
||||
|
|
|
@ -31,10 +31,7 @@ dependencies:
|
|||
request: '>=2.31.0 <3.0.0-0'
|
||||
async: '>=0.9.0 <1.0.0-0'
|
||||
es6-shim: '0.21.x'
|
||||
|
||||
# 2.x and 3.x have the same interface
|
||||
semver: '>=2.2.1 <4.0.0-0'
|
||||
|
||||
semver: '>=2.2.1 <5.0.0-0'
|
||||
minimatch: '>=0.2.14 <2.0.0-0'
|
||||
bunyan: '>=0.22.1 <2.0.0-0'
|
||||
handlebars: '1.x'
|
||||
|
|
Loading…
Add table
Reference in a new issue