semver 7.7.2 → 7.7.4

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/README.md CHANGED
@@ -110,8 +110,9 @@ Options:
110
110
  -l --loose
111
111
  Interpret versions and ranges loosely
112
112
 
113
- -n <0|1>
114
- This is the base to be used for the prerelease identifier.
113
+ -n <0|1|false>
114
+ Base number for prerelease identifier (default: 0).
115
+ Use false to omit the number altogether.
115
116
 
116
117
  -p --include-prerelease
117
118
  Always include prerelease versions in range matching
package/bin/semver.js CHANGED
@@ -105,7 +105,7 @@ const main = () => {
105
105
  versions = versions.map((v) => {
106
106
  return coerce ? (semver.coerce(v, options) || { version: v }).version : v
107
107
  }).filter((v) => {
108
- return semver.valid(v)
108
+ return semver.valid(v, options)
109
109
  })
110
110
  if (!versions.length) {
111
111
  return fail()
package/classes/range.js CHANGED
@@ -255,6 +255,7 @@ const isSatisfiable = (comparators, options) => {
255
255
  // already replaced the hyphen ranges
256
256
  // turn into a set of JUST comparators.
257
257
  const parseComparator = (comp, options) => {
258
+ comp = comp.replace(re[t.BUILD], '')
258
259
  debug('comp', comp, options)
259
260
  comp = replaceCarets(comp, options)
260
261
  debug('caret', comp)
package/classes/semver.js CHANGED
@@ -111,11 +111,25 @@ class SemVer {
111
111
  other = new SemVer(other, this.options)
112
112
  }
113
113
 
114
- return (
115
- compareIdentifiers(this.major, other.major) ||
116
- compareIdentifiers(this.minor, other.minor) ||
117
- compareIdentifiers(this.patch, other.patch)
118
- )
114
+ if (this.major < other.major) {
115
+ return -1
116
+ }
117
+ if (this.major > other.major) {
118
+ return 1
119
+ }
120
+ if (this.minor < other.minor) {
121
+ return -1
122
+ }
123
+ if (this.minor > other.minor) {
124
+ return 1
125
+ }
126
+ if (this.patch < other.patch) {
127
+ return -1
128
+ }
129
+ if (this.patch > other.patch) {
130
+ return 1
131
+ }
132
+ return 0
119
133
  }
120
134
 
121
135
  comparePre (other) {
package/functions/diff.js CHANGED
@@ -53,7 +53,7 @@ const diff = (version1, version2) => {
53
53
  return prefix + 'patch'
54
54
  }
55
55
 
56
- // high and low are preleases
56
+ // high and low are prereleases
57
57
  return 'prerelease'
58
58
  }
59
59
 
@@ -2,6 +2,10 @@
2
2
 
3
3
  const numeric = /^[0-9]+$/
4
4
  const compareIdentifiers = (a, b) => {
5
+ if (typeof a === 'number' && typeof b === 'number') {
6
+ return a === b ? 0 : a < b ? -1 : 1
7
+ }
8
+
5
9
  const anum = numeric.test(a)
6
10
  const bnum = numeric.test(b)
7
11
 
package/internal/re.js CHANGED
@@ -78,8 +78,8 @@ createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
78
78
 
79
79
  // ## Pre-release Version Identifier
80
80
  // A numeric identifier, or a non-numeric identifier.
81
- // Non-numberic identifiers include numberic identifiers but can be longer.
82
- // Therefore non-numberic identifiers must go first.
81
+ // Non-numeric identifiers include numeric identifiers but can be longer.
82
+ // Therefore non-numeric identifiers must go first.
83
83
 
84
84
  createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
85
85
  }|${src[t.NUMERICIDENTIFIER]})`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semver",
3
- "version": "7.7.2",
3
+ "version": "7.7.4",
4
4
  "description": "The semantic version parser used by npm.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,8 +14,8 @@
14
14
  "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
15
15
  },
16
16
  "devDependencies": {
17
- "@npmcli/eslint-config": "^5.0.0",
18
- "@npmcli/template-oss": "4.24.3",
17
+ "@npmcli/eslint-config": "^6.0.0",
18
+ "@npmcli/template-oss": "4.29.0",
19
19
  "benchmark": "^2.1.4",
20
20
  "tap": "^16.0.0"
21
21
  },
@@ -52,7 +52,7 @@
52
52
  "author": "GitHub Inc.",
53
53
  "templateOSS": {
54
54
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
55
- "version": "4.24.3",
55
+ "version": "4.29.0",
56
56
  "engines": ">=10",
57
57
  "distPaths": [
58
58
  "classes/",
package/ranges/subset.js CHANGED
@@ -38,7 +38,7 @@ const compare = require('../functions/compare.js')
38
38
  // - If LT
39
39
  // - If LT.semver is greater than any < or <= comp in C, return false
40
40
  // - If LT is <=, and LT.semver does not satisfy every C, return false
41
- // - If GT.semver has a prerelease, and not in prerelease mode
41
+ // - If LT.semver has a prerelease, and not in prerelease mode
42
42
  // - If no C has a prerelease and the LT.semver tuple, return false
43
43
  // - Else return true
44
44