Comparing version 2.2.1 to 2.3.0
{ | ||
"name": "semver", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "The semantic version parser used by npm.", | ||
@@ -5,0 +5,0 @@ "main": "semver.js", |
@@ -37,3 +37,3 @@ semver(1) -- The semantic versioner for npm | ||
A "version" is described by the v2.0.0 specification found at | ||
A "version" is described by the `v2.0.0` specification found at | ||
<http://semver.org/>. | ||
@@ -47,5 +47,6 @@ | ||
* `1.2.3` A specific version. When nothing else will do. Note that | ||
build metadata is still ignored, so `1.2.3+build2012` will satisfy | ||
this 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. | ||
@@ -61,7 +62,7 @@ * `<1.2.3` Less than a specific version. If there is no prerelease | ||
* `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 | ||
* `~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 | ||
* `^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 | ||
@@ -71,13 +72,20 @@ prerelease) will be supported up to, but not including, the next | ||
while `1.2.2` and `2.0.0-beta` will not. | ||
* `^0.1.3` := `>=0.1.3-0 <0.2.0-0` "Compatible with 0.1.3". 0.x.x versions are | ||
* `^0.1.3` := `>=0.1.3-0 <0.2.0-0` "Compatible with `0.1.3`". `0.x.x` versions are | ||
special: the first non-zero component indicates potentially breaking changes, | ||
meaning the caret operator matches any version with the same first non-zero | ||
component starting at the specified version. | ||
* `^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` := `>=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" | ||
* `^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 `*`. | ||
@@ -97,24 +105,32 @@ | ||
* valid(v): Return the parsed version, or null if it's not valid. | ||
* inc(v, release): Return the version incremented by the release type | ||
(major, minor, patch, or prerelease), or null if it's not valid. | ||
* `valid(v)`: Return the parsed version, or null if it's not valid. | ||
* `inc(v, release)`: Return the version incremented by the release | ||
type (`major`, `premajor`, `minor`, `preminor`, `patch`, | ||
`prepatch`, or `prerelease`), or null if it's not valid | ||
* `premajor` in one call will bump the version up to the next major | ||
version and down to a prerelease of that major version. | ||
`preminor`, and `prepatch` work the same way. | ||
* If called from a non-prerelease version, the `prerelease` will work the | ||
same as `prepatch`. It increments the patch version, then makes a | ||
prerelease. If the input version is already a prerelease it simply | ||
increments it. | ||
### Comparison | ||
* gt(v1, v2): `v1 > v2` | ||
* gte(v1, v2): `v1 >= v2` | ||
* lt(v1, v2): `v1 < v2` | ||
* lte(v1, v2): `v1 <= v2` | ||
* eq(v1, v2): `v1 == v2` This is true if they're logically equivalent, | ||
* `gt(v1, v2)`: `v1 > v2` | ||
* `gte(v1, v2)`: `v1 >= v2` | ||
* `lt(v1, v2)`: `v1 < v2` | ||
* `lte(v1, v2)`: `v1 <= v2` | ||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, | ||
even if they're not the exact same string. You already know how to | ||
compare strings. | ||
* neq(v1, v2): `v1 != v2` The opposite of eq. | ||
* cmp(v1, comparator, v2): Pass in a comparison string, and it'll call | ||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. | ||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call | ||
the corresponding function above. `"==="` and `"!=="` do simple | ||
string comparison, but are included for completeness. Throws if an | ||
invalid comparison string is provided. | ||
* compare(v1, v2): Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if | ||
v2 is greater. Sorts in ascending order if passed to Array.sort(). | ||
* rcompare(v1, v2): The reverse of compare. Sorts an array of versions | ||
in descending order when passed to Array.sort(). | ||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if | ||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`. | ||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions | ||
in descending order when passed to `Array.sort()`. | ||
@@ -124,12 +140,12 @@ | ||
* validRange(range): Return the valid range or null if it's not valid | ||
* satisfies(version, range): Return true if the version satisfies the | ||
* `validRange(range)`: Return the valid range or null if it's not valid | ||
* `satisfies(version, range)`: Return true if the version satisfies the | ||
range. | ||
* maxSatisfying(versions, range): Return the highest version in the list | ||
that satisfies the range, or null if none of them do. | ||
* gtr(version, range): Return true if version is greater than all the | ||
* `maxSatisfying(versions, range)`: Return the highest version in the list | ||
that satisfies the range, or `null` if none of them do. | ||
* `gtr(version, range)`: Return `true` if version is greater than all the | ||
versions possible in the range. | ||
* ltr(version, range): Return true if version is less than all the | ||
* `ltr(version, range)`: Return `true` if version is less than all the | ||
versions possible in the range. | ||
* outside(version, range, hilo): Return true if the version is outside | ||
* `outside(version, range, hilo)`: Return true if the version is outside | ||
the bounds of the range in either the high or low direction. The | ||
@@ -143,4 +159,4 @@ `hilo` argument must be either the string `'>'` or `'<'`. (This is | ||
until `2.0.0`, so the version `1.2.10` would not be greater than the | ||
range (because 2.0.1 satisfies, which is higher), nor less than the | ||
range (since 1.2.8 satisfies, which is lower), and it also does not | ||
range (because `2.0.1` satisfies, which is higher), nor less than the | ||
range (since `1.2.8` satisfies, which is lower), and it also does not | ||
satisfy the range. | ||
@@ -147,0 +163,0 @@ |
@@ -251,2 +251,4 @@ ;(function(exports) { | ||
version = version.version; | ||
} else if (typeof version !== 'string') { | ||
throw new TypeError('Invalid Version: ' + version); | ||
} | ||
@@ -324,3 +326,3 @@ | ||
return 1; | ||
else if (!this.prerelease.lenth && !other.prerelease.length) | ||
else if (!this.prerelease.length && !other.prerelease.length) | ||
return 0; | ||
@@ -346,4 +348,25 @@ | ||
// 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) { | ||
switch (release) { | ||
case 'premajor': | ||
this.inc('major'); | ||
this.inc('pre'); | ||
break; | ||
case 'preminor': | ||
this.inc('minor'); | ||
this.inc('pre'); | ||
break; | ||
case 'prepatch': | ||
this.inc('patch'); | ||
this.inc('pre'); | ||
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'); | ||
break; | ||
case 'major': | ||
@@ -354,8 +377,17 @@ this.major++; | ||
this.minor++; | ||
this.patch = -1; | ||
this.patch = 0; | ||
this.prerelease = []; | ||
break; | ||
case 'patch': | ||
this.patch++; | ||
// If this is not a pre-release version, it will increment the patch. | ||
// If it is a pre-release it will bump up to the same patch version. | ||
// 1.2.0-5 patches to 1.2.0 | ||
// 1.2.0 patches to 1.2.1 | ||
if (this.prerelease.length === 0) | ||
this.patch++; | ||
this.prerelease = []; | ||
break; | ||
case 'prerelease': | ||
// This probably shouldn't be used publically. | ||
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. | ||
case 'pre': | ||
if (this.prerelease.length === 0) | ||
@@ -362,0 +394,0 @@ this.prerelease = [0]; |
@@ -261,2 +261,4 @@ // export the class if we are in a Node-like system. | ||
version = version.version; | ||
} else if (typeof version !== 'string') { | ||
throw new TypeError('Invalid Version: ' + version); | ||
} | ||
@@ -334,3 +336,3 @@ | ||
return 1; | ||
else if (!this.prerelease.lenth && !other.prerelease.length) | ||
else if (!this.prerelease.length && !other.prerelease.length) | ||
return 0; | ||
@@ -356,4 +358,25 @@ | ||
// 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) { | ||
switch (release) { | ||
case 'premajor': | ||
this.inc('major'); | ||
this.inc('pre'); | ||
break; | ||
case 'preminor': | ||
this.inc('minor'); | ||
this.inc('pre'); | ||
break; | ||
case 'prepatch': | ||
this.inc('patch'); | ||
this.inc('pre'); | ||
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'); | ||
break; | ||
case 'major': | ||
@@ -364,8 +387,17 @@ this.major++; | ||
this.minor++; | ||
this.patch = -1; | ||
this.patch = 0; | ||
this.prerelease = []; | ||
break; | ||
case 'patch': | ||
this.patch++; | ||
// If this is not a pre-release version, it will increment the patch. | ||
// If it is a pre-release it will bump up to the same patch version. | ||
// 1.2.0-5 patches to 1.2.0 | ||
// 1.2.0 patches to 1.2.1 | ||
if (this.prerelease.length === 0) | ||
this.patch++; | ||
this.prerelease = []; | ||
break; | ||
case 'prerelease': | ||
// This probably shouldn't be used publically. | ||
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. | ||
case 'pre': | ||
if (this.prerelease.length === 0) | ||
@@ -372,0 +404,0 @@ this.prerelease = [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 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 d=n++;t[d]="^"+w+"$";var y=n++;t[y]="((?:<|>)?=?)";var $=n++;t[$]=t[s]+"|x|X|\\*";var j=n++;t[j]=t[i]+"|x|X|\\*";var b=n++;t[b]="[v=\\s]*("+t[j]+")"+"(?:\\.("+t[j]+")"+"(?:\\.("+t[j]+")"+"(?:("+t[c]+")"+")?)?)?";var E=n++;t[E]="[v=\\s]*("+t[$]+")"+"(?:\\.("+t[$]+")"+"(?:\\.("+t[$]+")"+"(?:("+t[p]+")"+")?)?)?";var k=n++;t[k]="^"+t[y]+"\\s*"+t[b]+"$";var x=n++;t[x]="^"+t[y]+"\\s*"+t[E]+"$";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[b]+"$";var A=n++;t[A]="^"+t[R]+t[E]+"$";var C=n++;t[C]="(?:\\^)";var T=n++;t[T]="(\\s*)"+t[C]+"\\s+";r[T]=new RegExp(t[T],"g");var M="$1^";var z=n++;t[z]="^"+t[C]+t[b]+"$";var P=n++;t[P]="^"+t[C]+t[E]+"$";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[b]+")";r[L]=new RegExp(t[L],"g");var X="$1$2$3";var _=n++;t[_]="^\\s*("+t[b]+")"+"\\s+-\\s+"+"("+t[b]+")"+"\\s*$";var N=n++;t[N]="^\\s*("+t[E]+")"+"\\s+-\\s+"+"("+t[E]+")"+"\\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,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}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.lenth&&!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"major":this.major++;this.minor=-1;case"minor":this.minor++;this.patch=-1;case"patch":this.patch++;this.prerelease=[];break;case"prerelease":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"===":i=e===t;break;case"!==":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(!n[2])this.semver=cr;else{this.semver=new H(n[2],this.loose);if(this.operator==="<"&&!this.semver.prerelease.length){this.semver.prerelease=["0"];this.semver.format()}}};lr.prototype.inspect=function(){return'<SemVer Comparator "'+this+'">'};lr.prototype.toString=function(){return this.value};lr.prototype.test=function(e){return this.semver===cr?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,Er);e=e.replace(r[L],X);e=e.replace(r[S],V);e=e.replace(r[T],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=dr(e,r);e=gr(e,r);e=$r(e,r);e=br(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[A]: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(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(i){if(i.charAt(0)!=="-")i="-"+i;if(r==="0"){if(t==="0")s="="+r+"."+t+"."+n+i;else s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+i+" <"+(+r+1)+".0.0-0"}else{if(r==="0"){if(t==="0")s="="+r+"."+t+"."+n;else s=">="+r+"."+t+"."+n+"-0"+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+"-0"+" <"+(+r+1)+".0.0-0"}return s})}function $r(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[k];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+"-0"}else if(o){e="*"}else if(a){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 br(e,t){return e.trim().replace(r[O],"")}function Er(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-0";else if(mr(i))r=">="+t+"."+n+".0-0";else r=">="+r;if(mr(f))a="";else if(mr(u))a="<"+(+f+1)+".0.0-0";else if(mr(l))a="<"+f+"."+(+u+1)+".0-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;for(var r=0;r<this.set.length;r++){if(kr(this.set[r],e))return true}return false};function kr(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 Ar(e,r,"<",t)}e.gtr=Ir;function Ir(e,r,t){return Ar(e,r,">",t)}e.outside=Ar;function Ar(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={}); | ||
(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,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.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(!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(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(i){if(i.charAt(0)!=="-")i="-"+i;if(r==="0"){if(t==="0")s="="+r+"."+t+"."+n+i;else s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+i+" <"+(+r+1)+".0.0-0"}else{if(r==="0"){if(t==="0")s="="+r+"."+t+"."+n;else s=">="+r+"."+t+"."+n+"-0"+" <"+r+"."+(+t+1)+".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={}); |
@@ -305,4 +305,11 @@ var tap = require('tap'); | ||
['1.2.3', 'fake', null], | ||
['1.2.0-0', 'patch', '1.2.0'], | ||
['fake', 'major', null], | ||
['1.2.3', 'prerelease', '1.2.3-0'], | ||
['1.2.3-4', 'major', '2.0.0'], | ||
['1.2.3-4', 'minor', '1.3.0'], | ||
['1.2.3-4', 'patch', '1.2.3'], | ||
['1.2.3-alpha.0.beta', 'major', '2.0.0'], | ||
['1.2.3-alpha.0.beta', 'minor', '1.3.0'], | ||
['1.2.3-alpha.0.beta', 'patch', '1.2.3'], | ||
['1.2.4', 'prerelease', '1.2.5-0'], | ||
['1.2.3-0', 'prerelease', '1.2.3-1'], | ||
@@ -323,3 +330,9 @@ ['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1'], | ||
['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta'], | ||
['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'] | ||
['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'], | ||
['1.2.0', 'preminor', '1.3.0-0'], | ||
['1.2.0', 'premajor', '2.0.0-0'], | ||
['1.2.0', 'preminor', '1.3.0-0'], | ||
['1.2.0', 'premajor', '2.0.0-0'] | ||
].forEach(function(v) { | ||
@@ -505,2 +518,17 @@ var pre = v[0]; | ||
test('\ninvalid version numbers', function(t) { | ||
['1.2.3.4', | ||
'NOT VALID', | ||
1.2, | ||
null, | ||
'Infinity.NaN.Infinity' | ||
].forEach(function(v) { | ||
t.throws(function() { | ||
new SemVer(v); | ||
}, {name:'TypeError', message:'Invalid Version: ' + v}); | ||
}); | ||
t.end(); | ||
}); | ||
test('\nstrict vs loose version numbers', function(t) { | ||
@@ -507,0 +535,0 @@ [['=1.2.3', '1.2.3'], |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
120738
2694
159
0