semver 7.8.4 → 7.8.5
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 +6 -2
- package/package.json +1 -1
package/classes/range.js
CHANGED
|
@@ -299,6 +299,10 @@ const replaceTildes = (comp, options) => {
|
|
|
299
299
|
|
|
300
300
|
const replaceTilde = (comp, options) => {
|
|
301
301
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
|
302
|
+
// if we're including prereleases in the match, then the lower bound is
|
|
303
|
+
// -0, the lowest possible prerelease value, just like x-ranges and carets.
|
|
304
|
+
// this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.
|
|
305
|
+
const z = options.includePrerelease ? '-0' : ''
|
|
302
306
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
303
307
|
debug('tilde', comp, _, M, m, p, pr)
|
|
304
308
|
let ret
|
|
@@ -306,10 +310,10 @@ const replaceTilde = (comp, options) => {
|
|
|
306
310
|
if (isX(M)) {
|
|
307
311
|
ret = ''
|
|
308
312
|
} else if (isX(m)) {
|
|
309
|
-
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
|
|
313
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
|
|
310
314
|
} else if (isX(p)) {
|
|
311
315
|
// ~1.2 == >=1.2.0 <1.3.0-0
|
|
312
|
-
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
|
|
316
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
|
|
313
317
|
} else if (pr) {
|
|
314
318
|
debug('replaceTilde pr', pr)
|
|
315
319
|
ret = `>=${M}.${m}.${p}-${pr
|