semver 7.8.2 → 7.8.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/classes/range.js +11 -2
- package/package.json +2 -2
package/classes/range.js
CHANGED
|
@@ -277,6 +277,11 @@ const parseComparator = (comp, options) => {
|
|
|
277
277
|
|
|
278
278
|
const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
|
|
279
279
|
|
|
280
|
+
const invalidXRangeOrder = (M, m, p) => (
|
|
281
|
+
(isX(M) && !isX(m)) ||
|
|
282
|
+
(isX(m) && p && !isX(p))
|
|
283
|
+
)
|
|
284
|
+
|
|
280
285
|
// ~, ~> --> * (any, kinda silly)
|
|
281
286
|
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
|
|
282
287
|
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
|
|
@@ -373,10 +378,10 @@ const replaceCaret = (comp, options) => {
|
|
|
373
378
|
if (M === '0') {
|
|
374
379
|
if (m === '0') {
|
|
375
380
|
ret = `>=${M}.${m}.${p
|
|
376
|
-
}
|
|
381
|
+
} <${M}.${m}.${+p + 1}-0`
|
|
377
382
|
} else {
|
|
378
383
|
ret = `>=${M}.${m}.${p
|
|
379
|
-
}
|
|
384
|
+
} <${M}.${+m + 1}.0-0`
|
|
380
385
|
}
|
|
381
386
|
} else {
|
|
382
387
|
ret = `>=${M}.${m}.${p
|
|
@@ -402,6 +407,10 @@ const replaceXRange = (comp, options) => {
|
|
|
402
407
|
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
|
403
408
|
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
404
409
|
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
|
410
|
+
if (invalidXRangeOrder(M, m, p)) {
|
|
411
|
+
return comp
|
|
412
|
+
}
|
|
413
|
+
|
|
405
414
|
const xM = isX(M)
|
|
406
415
|
const xm = xM || isX(m)
|
|
407
416
|
const xp = xm || isX(p)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semver",
|
|
3
|
-
"version": "7.8.
|
|
3
|
+
"version": "7.8.4",
|
|
4
4
|
"description": "The semantic version parser used by npm.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@npmcli/eslint-config": "^
|
|
17
|
+
"@npmcli/eslint-config": "^7.0.0",
|
|
18
18
|
"@npmcli/template-oss": "5.0.0",
|
|
19
19
|
"benchmark": "^2.1.4",
|
|
20
20
|
"tap": "^16.0.0"
|