semver 5.7.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +11 -12
- package/package.json +1 -1
- package/semver.js +30 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# changes log
|
|
2
2
|
|
|
3
|
+
## 6.0
|
|
4
|
+
|
|
5
|
+
* Fix `intersects` logic.
|
|
6
|
+
|
|
7
|
+
This is technically a bug fix, but since it is also a change to behavior
|
|
8
|
+
that may require users updating their code, it is marked as a major
|
|
9
|
+
version increment.
|
|
10
|
+
|
|
3
11
|
## 5.7
|
|
4
12
|
|
|
5
13
|
* Add `minVersion` method
|
package/README.md
CHANGED
|
@@ -398,15 +398,14 @@ range, use the `satisfies(version, range)` function.
|
|
|
398
398
|
|
|
399
399
|
* `coerce(version)`: Coerces a string to semver if possible
|
|
400
400
|
|
|
401
|
-
This aims to provide a very forgiving translation of a non-semver
|
|
402
|
-
semver. It looks for the first digit in a string, and
|
|
403
|
-
remaining characters which satisfy at least a partial semver
|
|
404
|
-
`1.2`, `1.2.3`) up to the max permitted length (256 characters).
|
|
405
|
-
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).
|
|
406
|
-
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
|
401
|
+
This aims to provide a very forgiving translation of a non-semver
|
|
402
|
+
string to semver. It looks for the first digit in a string, and
|
|
403
|
+
consumes all remaining characters which satisfy at least a partial semver
|
|
404
|
+
(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters).
|
|
405
|
+
Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).
|
|
406
|
+
All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`).
|
|
407
|
+
Only text which lacks digits will fail coercion (`version one` is not valid).
|
|
408
|
+
The maximum length for any semver component considered for coercion is 16 characters;
|
|
409
|
+
longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`).
|
|
410
|
+
The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`;
|
|
411
|
+
higher value components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
package/package.json
CHANGED
package/semver.js
CHANGED
|
@@ -934,16 +934,40 @@ Range.prototype.intersects = function (range, options) {
|
|
|
934
934
|
}
|
|
935
935
|
|
|
936
936
|
return this.set.some(function (thisComparators) {
|
|
937
|
-
return
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
937
|
+
return (
|
|
938
|
+
isSatisfiable(thisComparators, options) &&
|
|
939
|
+
range.set.some(function (rangeComparators) {
|
|
940
|
+
return (
|
|
941
|
+
isSatisfiable(rangeComparators, options) &&
|
|
942
|
+
thisComparators.every(function (thisComparator) {
|
|
943
|
+
return rangeComparators.every(function (rangeComparator) {
|
|
944
|
+
return thisComparator.intersects(rangeComparator, options)
|
|
945
|
+
})
|
|
946
|
+
})
|
|
947
|
+
)
|
|
942
948
|
})
|
|
943
|
-
|
|
949
|
+
)
|
|
944
950
|
})
|
|
945
951
|
}
|
|
946
952
|
|
|
953
|
+
// take a set of comparators and determine whether there
|
|
954
|
+
// exists a version which can satisfy it
|
|
955
|
+
function isSatisfiable (comparators, options) {
|
|
956
|
+
var result = true
|
|
957
|
+
var remainingComparators = comparators.slice()
|
|
958
|
+
var testComparator = remainingComparators.pop()
|
|
959
|
+
|
|
960
|
+
while (result && remainingComparators.length) {
|
|
961
|
+
result = remainingComparators.every(function (otherComparator) {
|
|
962
|
+
return testComparator.intersects(otherComparator, options)
|
|
963
|
+
})
|
|
964
|
+
|
|
965
|
+
testComparator = remainingComparators.pop()
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
return result
|
|
969
|
+
}
|
|
970
|
+
|
|
947
971
|
// Mostly just for testing and legacy API reasons
|
|
948
972
|
exports.toComparators = toComparators
|
|
949
973
|
function toComparators (range, options) {
|