Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-07-25 04:51:29 +0400
committerisaacs <i@izs.me>2014-07-25 04:52:02 +0400
commitea547e29f1245e516fc67641875841c10f04e1ee (patch)
treed4ee0d8a6c49f20ce4a402f17bd4e350136c1a7b /node_modules/semver/semver.js
parent33ccd13d161ff185d9c9c545013e0775f86c13ac (diff)
Bump semver to version 3
This makes the '^' operator stricter for 0.x.y versions, even if 'x' is not 0. As a direct result, several *other* deps had to be updated, because they either depended on semver 2.x, or because the new stricter rules meant that they (or their deps) were no longer valid. The update to 'read-installed', in particular, causes a test failure. That update must be rolled back, or the test made to pass, prior to a stable npm 2.0.0 release going out.
Diffstat (limited to 'node_modules/semver/semver.js')
-rw-r--r--node_modules/semver/semver.js44
1 files changed, 20 insertions, 24 deletions
diff --git a/node_modules/semver/semver.js b/node_modules/semver/semver.js
index a7385b41c..2939331c8 100644
--- a/node_modules/semver/semver.js
+++ b/node_modules/semver/semver.js
@@ -366,6 +366,10 @@ SemVer.prototype.inc = function(release) {
this.inc('pre');
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');
break;
@@ -558,6 +562,9 @@ Comparator.prototype.parse = function(comp) {
throw new TypeError('Invalid comparator: ' + comp);
this.operator = m[1];
+ if (this.operator === '=')
+ this.operator = '';
+
// if it literally is just '>' or '' then allow anything.
if (!m[2])
this.semver = ANY;
@@ -763,6 +770,11 @@ function replaceCaret(comp, loose) {
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 = '';
@@ -773,30 +785,14 @@ function replaceCaret(comp, loose) {
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0';
else
ret = '>=' + M + '.' + m + '.0-0 <' + (+M + 1) + '.0.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;
- else
- ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + M + '.' + (+m + 1) + '.0-0';
- } else
- ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + (+M + 1) + '.0.0-0';
- } else {
- if (M === '0') {
- if (m === '0')
- ret = '=' + M + '.' + m + '.' + p;
- else
- ret = '>=' + M + '.' + m + '.' + p + '-0' +
- ' <' + M + '.' + (+m + 1) + '.0-0';
- } else
- ret = '>=' + M + '.' + m + '.' + p + '-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';
debug('caret return', ret);
return ret;