GeezerVison is showing github.com — Comparing v7.7.4...v7.8.1 · npm/node-semver
Permalink
base repository:
npm/node-semver
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
Uh oh!
There was an error while loading. Please reload this page.
base:
v7.7.4
head repository:
npm/node-semver
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
Uh oh!
There was an error while loading. Please reload this page.
compare:
v7.8.1
-
11
commits
-
26
files changed
-
10
contributors
Commits on Feb 24, 2026
-
docs: fix BNF grammar to distinguish prerelease from build identifiers (
#846)
## Summary
The BNF grammar in `README.md` and `range.bnf` incorrectly defined `pre`
and `build` as identical rules (`parts`), but they have different
requirements per the [SemVer 2.0.0
specification](https://semver.org/#spec-item-9):
- **Prerelease identifiers**: Numeric parts must not have leading zeros
- **Build metadata**: Allows any alphanumeric string including leading
zeros
### Current behavior (correctly implemented, but BNF was wrong)
```js
semver.valid('1.2.3-00') // null (invalid - prerelease numeric with leading zero)
semver.valid('1.2.3+00') // '1.2.3' (valid - build metadata allows any alphanumeric)
semver.valid('1.2.3-0') // '1.2.3-0' (valid - single zero is fine)
```
### Changes
Updates the BNF grammar to distinguish between:
- `prepart` - uses `nr` (no leading zeros) or `alphanumid` (alphanumeric
identifier)
- `buildid` - any alphanumeric string including leading zeros
Also adds an explanatory note after the BNF block to clarify the
distinction.
Fixes #665
## Test plan
- [x] Verified the implementation behavior matches the updated BNF
- [x] Confirmed alignment with [SemVer 2.0.0 spec item
9](https://semver.org/#spec-item-9)
Co-authored-by: Claude Opus 4.6 <[email protected]>
Configuration menu
Browse the repository at this point in the history
Commits on Mar 20, 2026
-
Configuration menu
Browse the repository at this point in the history
Commits on Apr 16, 2026
-
Configuration menu
Browse the repository at this point in the history
Commits on May 7, 2026
-
feat: Add truncate function (#855)
<!-- What / Why -->
This PR adds a `truncate` function to allow for portions of a version
string "below" a certain level to be dropped.
<!-- Describe the request in detail. What it does and why it's being
changed. -->
The `truncate` function, as implemented in this first pass at a PR,
returns a new valid version string. The function:
1. Always removes `build` information
2. Removes pre-release information, unless a pre-release type is passed
as the `truncation`
3. Zeroes out "lower" components of the semantic version (e.g. if the
`truncation` performed is `major`, both `minor` and `patch` are zeroed)
An alternative I considered was returning strings without the valid
version guarantee; for example, `truncate('1.2.3', 'minor') === '1.2')`
instead of `1.2.0`. This is not what was specified by @isaacs in #48,
however, and seemed to be out of place for the rest of the library.
As a result, I also considered naming the function differently. One
option I considered was `floor`, which seemed conceptually correct for
`major`, `minor`, and `patch`. For `truncation = 'pre*'` however, this
did not feel right, as `truncate('1.2.3-rc1+build', 'prerelease') ===
'1.2.3-rc1'`, but since a) build metadata [_"...MUST be ignored when
determining version precedence..."_](https://semver.org/#spec-item-10),
and b) there could be a `1.2.3-rc0` that is closer to the "floor", the
name didn't seem right for that use case.
Lastly, I considered disallowing the `pre*` versions for the
`truncation` argument, and only allowing `major`, `minor`, and `patch`.
This, paired with the `floor` naming, was the most attractive
alternative to me.
## References
Related to #48
---------
Co-authored-by: Michael Smith <[email protected]>
Configuration menu
Browse the repository at this point in the history
-
Configuration menu
Browse the repository at this point in the history
Commits on May 8, 2026
-
Configuration menu
Browse the repository at this point in the history
-
Configuration menu
Browse the repository at this point in the history
-
2
Configuration menu
Browse the repository at this point in the history
Commits on May 21, 2026
-
fix: handle prerelease bounds in subset (#867)
## Summary
- Fix `subset()` so prerelease lower and upper bounds are checked
against individual comparators without reapplying full range prerelease
gating.
- Add coverage for `^10.2.0-beta.2` being a subset of `^10.2.0-beta.1`.
## Tests
- `npx tap test/ranges/subset.js`
- `npm test`
- `git diff --check`
Fixes #757
Co-authored-by: Puneet Dixit <[email protected]>
Configuration menu
Browse the repository at this point in the history
-
Configuration menu
Browse the repository at this point in the history
-
Configuration menu
Browse the repository at this point in the history
Loading
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v7.7.4...v7.8.1
Uh oh!
There was an error while loading. Please reload this page.
|