@vltpkg/semver 1.5.0 → 1.6.1

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.
Files changed (2) hide show
  1. package/dist/comparator.js +23 -4
  2. package/package.json +4 -4
@@ -391,12 +391,31 @@ export class Comparator {
391
391
  this.tuples.push(['>=', new Version(comp, M, m, p, pr, build)], ['<', new Version(comp, M, m + 1, 0, '0', build)]);
392
392
  }
393
393
  #parseCaret(comp) {
394
- const min = this.#xInclusiveMin(comp);
395
- if (isAny(min)) {
396
- this.tuples.push(min);
394
+ const parsed = this.#parseX(comp);
395
+ if (isXMajor(parsed)) {
396
+ this.tuples.push(this.#getComparatorAny());
397
+ return;
398
+ }
399
+ const z = this.includePrerelease ? '0' : undefined;
400
+ // An X-range caret is bound by its leftmost given part, whatever
401
+ // its value: ^0 and ^0.x are >=0.0.0 <1.0.0-0, ^0.0 and ^0.0.x are
402
+ // >=0.0.0 <0.1.0-0. Filling the missing parts with 0 first would
403
+ // make them look like ^0.0.0, the exact version 0.0.0.
404
+ if (isXMinor(parsed)) {
405
+ const [M] = parsed;
406
+ this.tuples.push(['>=', new Version(comp, M, 0, 0, z, undefined)], ['<', new Version(comp, M + 1, 0, 0, '0', undefined)]);
397
407
  return;
398
408
  }
399
- const minv = min[1];
409
+ if (isXPatch(parsed)) {
410
+ const [M, m] = parsed;
411
+ this.tuples.push(['>=', new Version(comp, M, m, 0, z, undefined)], M !== 0 ?
412
+ ['<', new Version(comp, M + 1, 0, 0, '0', undefined)]
413
+ : ['<', new Version(comp, 0, m + 1, 0, '0', undefined)]);
414
+ return;
415
+ }
416
+ const [M, m, p, pr = z, build] = parsed;
417
+ const minv = new Version(comp, M, m, p, pr, build);
418
+ const min = ['>=', minv];
400
419
  if (minv.major !== 0) {
401
420
  this.tuples.push(min, [
402
421
  '<',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/semver",
3
3
  "description": "The semantic version parser used by vlt",
4
- "version": "1.5.0",
4
+ "version": "1.6.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -13,9 +13,9 @@
13
13
  "url": "http://vlt.sh"
14
14
  },
15
15
  "dependencies": {
16
- "@vltpkg/error-cause": "1.5.0",
17
- "@vltpkg/fast-split": "1.5.0",
18
- "@vltpkg/types": "1.5.0"
16
+ "@vltpkg/error-cause": "1.6.1",
17
+ "@vltpkg/fast-split": "1.6.1",
18
+ "@vltpkg/types": "1.6.1"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@eslint/js": "^9.39.1",