diff options
author | isaacs <i@izs.me> | 2013-02-06 19:44:50 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-02-06 19:44:50 +0400 |
commit | 9820f9e451d524a5a12d12af4f953d585a809268 (patch) | |
tree | 1ae8927cc747e223c33b8bdbac8c960e8b7017c6 /node_modules | |
parent | 8ce058818fe3159caf2e13c19f19bf8243ba3b48 (diff) |
semver@1.1.3
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/semver/package.json | 6 | ||||
-rw-r--r-- | node_modules/semver/semver.js | 3 | ||||
-rw-r--r-- | node_modules/semver/test.js | 27 |
3 files changed, 31 insertions, 5 deletions
diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json index 7056071e2..1f4ec58ed 100644 --- a/node_modules/semver/package.json +++ b/node_modules/semver/package.json @@ -1,6 +1,6 @@ { "name": "semver", - "version": "1.1.2", + "version": "1.1.3", "description": "The semantic version parser used by npm.", "main": "semver.js", "scripts": { @@ -22,6 +22,6 @@ }, "readme": "semver(1) -- The semantic versioner for npm\n===========================================\n\n## Usage\n\n $ npm install semver\n\n semver.valid('1.2.3') // '1.2.3'\n semver.valid('a.b.c') // null\n semver.clean(' =v1.2.3 ') // '1.2.3'\n semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true\n semver.gt('1.2.3', '9.8.7') // false\n semver.lt('1.2.3', '9.8.7') // true\n\nAs a command-line utility:\n\n $ semver -h\n\n Usage: semver -v <version> [-r <range>]\n Test if version(s) satisfy the supplied range(s),\n and sort them.\n\n Multiple versions or ranges may be supplied.\n\n Program exits successfully if any valid version satisfies\n all supplied ranges, and prints all satisfying versions.\n\n If no versions are valid, or ranges are not satisfied,\n then exits failure.\n\n Versions are printed in ascending order, so supplying\n multiple versions to the utility will just sort them.\n\n## Versions\n\nA version is the following things, in this order:\n\n* a number (Major)\n* a period\n* a number (minor)\n* a period\n* a number (patch)\n* OPTIONAL: a hyphen, followed by a number (build)\n* OPTIONAL: a collection of pretty much any non-whitespace characters\n (tag)\n\nA leading `\"=\"` or `\"v\"` character is stripped off and ignored.\n\n## Comparisons\n\nThe ordering of versions is done using the following algorithm, given\ntwo versions and asked to find the greater of the two:\n\n* If the majors are numerically different, then take the one\n with a bigger major number. `2.3.4 > 1.3.4`\n* If the minors are numerically different, then take the one\n with the bigger minor number. `2.3.4 > 2.2.4`\n* If the patches are numerically different, then take the one with the\n bigger patch number. `2.3.4 > 2.3.3`\n* If only one of them has a build number, then take the one with the\n build number. `2.3.4-0 > 2.3.4`\n* If they both have build numbers, and the build numbers are numerically\n different, then take the one with the bigger build number.\n `2.3.4-10 > 2.3.4-9`\n* If only one of them has a tag, then take the one without the tag.\n `2.3.4 > 2.3.4-beta`\n* If they both have tags, then take the one with the lexicographically\n larger tag. `2.3.4-beta > 2.3.4-alpha`\n* At this point, they're equal.\n\n## Ranges\n\nThe following range styles are supported:\n\n* `>1.2.3` Greater than a specific version.\n* `<1.2.3` Less than\n* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`\n* `~1.2.3` := `>=1.2.3 <1.3.0`\n* `~1.2` := `>=1.2.0 <1.3.0`\n* `~1` := `>=1.0.0 <2.0.0`\n* `1.2.x` := `>=1.2.0 <1.3.0`\n* `1.x` := `>=1.0.0 <2.0.0`\n\nRanges can be joined with either a space (which implies \"and\") or a\n`||` (which implies \"or\").\n\n## Functions\n\n* valid(v): Return the parsed version, or null if it's not valid.\n* inc(v, release): Return the version incremented by the release type\n (major, minor, patch, or build), or null if it's not valid.\n\n### Comparison\n\n* gt(v1, v2): `v1 > v2`\n* gte(v1, v2): `v1 >= v2`\n* lt(v1, v2): `v1 < v2`\n* lte(v1, v2): `v1 <= v2`\n* eq(v1, v2): `v1 == v2` This is true if they're logically equivalent,\n even if they're not the exact same string. You already know how to\n compare strings.\n* neq(v1, v2): `v1 != v2` The opposite of eq.\n* cmp(v1, comparator, v2): Pass in a comparison string, and it'll call\n the corresponding function above. `\"===\"` and `\"!==\"` do simple\n string comparison, but are included for completeness. Throws if an\n invalid comparison string is provided.\n* compare(v1, v2): Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if\n v2 is greater. Sorts in ascending order if passed to Array.sort().\n* rcompare(v1, v2): The reverse of compare. Sorts an array of versions\n in descending order when passed to Array.sort().\n\n\n### Ranges\n\n* validRange(range): Return the valid range or null if it's not valid\n* satisfies(version, range): Return true if the version satisfies the\n range.\n* maxSatisfying(versions, range): Return the highest version in the list\n that satisfies the range, or null if none of them do.\n", "readmeFilename": "README.md", - "_id": "semver@1.1.2", - "_from": "semver@latest" + "_id": "semver@1.1.3", + "_from": "semver@~1.1.2" } diff --git a/node_modules/semver/semver.js b/node_modules/semver/semver.js index 3702a7b5d..01fb1c1fd 100644 --- a/node_modules/semver/semver.js +++ b/node_modules/semver/semver.js @@ -84,7 +84,7 @@ function validPackage (version) { // ">1.0.2 <2.0.0" like 1.0.3 - 1.9999.9999 var starExpression = /(<|>)?=?\s*\*/g , starReplace = "" - , compTrimExpression = new RegExp("((<|>)?=?)\\s*(" + , compTrimExpression = new RegExp("((<|>)?=|<|>)\\s*(" +semver+"|"+xRangePlain+")", "g") , compTrimReplace = "$1$3" @@ -149,7 +149,6 @@ function replaceXRange (version) { } else if (!p || p === "*" || p.toLowerCase() === "x") { ret = ">="+M+"."+m+".0- <"+M+"."+(+m+1)+".0-" } - //console.error("parseXRange", [].slice.call(arguments), ret) return ret }) } diff --git a/node_modules/semver/test.js b/node_modules/semver/test.js index 1d8114074..bc3952c95 100644 --- a/node_modules/semver/test.js +++ b/node_modules/semver/test.js @@ -17,6 +17,8 @@ var tap = require("tap") tap.plan(8) test("\ncomparison tests", function (t) { +// [version1, version2] +// version1 should be greater than version2 ; [ ["0.0.0", "0.0.0foo"] , ["0.0.1", "0.0.0"] , ["1.0.0", "0.9.9"] @@ -61,6 +63,8 @@ test("\ncomparison tests", function (t) { }) test("\nequality tests", function (t) { +// [version1, version2] +// version1 should be equivalent to version2 ; [ ["1.2.3", "v1.2.3"] , ["1.2.3", "=1.2.3"] , ["1.2.3", "v 1.2.3"] @@ -112,6 +116,8 @@ test("\nequality tests", function (t) { test("\nrange tests", function (t) { +// [range, version] +// version should be included by range ; [ ["1.0.0 - 2.0.0", "1.2.3"] , ["1.0.0", "1.0.0"] , [">=*", "0.2.4"] @@ -177,6 +183,16 @@ test("\nrange tests", function (t) { , ["=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"] + , ["~1.2.1 1.2.3", "1.2.3"] + , ['~1.2.1 >=1.2.3 1.2.3', '1.2.3'] + , ['~1.2.1 1.2.3 >=1.2.3', '1.2.3'] + , ['~1.2.1 1.2.3', '1.2.3'] + , ['>=1.2.1 1.2.3', '1.2.3'] + , ['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'] ].forEach(function (v) { t.ok(satisfies(v[1], v[0]), v[0]+" satisfied by "+v[1]) }) @@ -184,6 +200,8 @@ test("\nrange tests", function (t) { }) 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.0.0", "1.0.1"] , [">=1.0.0", "0.0.0"] @@ -236,6 +254,8 @@ test("\nnegative range tests", function (t) { }) test("\nincrement versions test", function (t) { +// [version, inc, result] +// 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" ] @@ -257,6 +277,7 @@ test("\nincrement versions test", function (t) { }) test("\nreplace stars test", function (t) { +// replace stars with "" ; [ [ "", "" ] , [ "*", "" ] , [ "> *", "" ] @@ -271,6 +292,9 @@ test("\nreplace stars test", function (t) { }) test("\nvalid range test", function (t) { +// [range, result] +// validRange(range) -> result +// translate ranges into their canonical form ; [ ["1.0.0 - 2.0.0", ">=1.0.0 <=2.0.0"] , ["1.0.0", "1.0.0"] , [">=*", ""] @@ -337,6 +361,8 @@ test("\nvalid range test", function (t) { }) test("\ncomparators test", function (t) { +// [range, comparators] +// 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-"]] ] @@ -398,6 +424,7 @@ test("\ncomparators test", function (t) { , ["<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-"]] ] ].forEach(function (v) { t.equivalent(toComparators(v[0]), v[1], "toComparators("+v[0]+") === "+JSON.stringify(v[1])) }) |