Skip to content

fix: preserve prerelease alternatives alongside wildcard ranges - #907

Open
x0Lazarus wants to merge 1 commit into
npm:mainfrom
x0Lazarus:fix/wildcard-prerelease-union
Open

x0Lazarus wants to merge 1 commit into
npm:mainfrom
x0Lazarus:fix/wildcard-prerelease-union

Conversation

@x0Lazarus

Copy link
Copy Markdown

satisfies('1.2.3-alpha', '* || 1.2.3-alpha') currently returns false, even though the explicit 1.2.3-alpha alternative matches on its own. The range constructor reduces the whole expression to *, which excludes prereleases by default.

Keep one wildcard and the alternatives containing prerelease bounds, preserving their order. Alternatives without prerelease bounds can still be dropped. With includePrerelease: true, the wildcard already admits prereleases, so the expression still reduces to a wildcard.

The regression fixtures cover both alternative orders, repeated wildcards, multiple prerelease alternatives, bounded prerelease ranges, ordinary releases, and rejection of other prereleases. The matching and formatting regressions fail against the original code and pass with this change.

On Windows with Node 24.19.0, npm test --ignore-scripts passes with 100% statement, branch, function and line coverage. npm run lint --ignore-scripts and npm run postlint --ignore-scripts also pass. The full CI platform and Node-version matrix has not been run locally.

References

Fixes #906.

This follows the prerelease distinction described in the earlier discussion.

@x0Lazarus
x0Lazarus requested a review from a team as a code owner September 26, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] * || 1.2.3-alpha won't match 1.2.3-alpha (when includePrerelease = false)

1 participant