Skip to content

Behavior Change: Exclusive Major Version specifications should also exclude prereleases #107

@JustinGrote

Description

@JustinGrote

From a discussion with @Jaykul at PSSummit 2025

As of today, if you specify MyModule!['2.1.5',3.0.0') or MyModule!<3.0.0, it will still match 3.0.0-alpha1 because prereleases are technically lower version than non-prerelease versions. While this is explicit to the spec, it is not ergonomic, and most people who make this specification had the intention of "no breaking changes", and an update to a prerelease of a new major version often includes breaking changes.

This is only an issue if you specify prereleases, it works as intended without prereleases.

Proposed Behavior

If the version is a new major version increase, and all other version fields are "0", then exclude any major version prereleases from the matching.

MyModule!<3.0.0 would not include 3.0.0-alpha1
MyModule!<3.0.1 would include 3.0.0-alpha1
MyModule!<3.0.0-beta would include 3.0.0-alpha1 due to semver sorting rules, and would also include bata. We aren't going to get crazy with prereleases logic here.

A switch will be added, -StrictSemVer, to revert this behavior if needed.

I will not be revving the major version of modulefast as a breaking change as I doubt there is anyone reliant on this behavior, and the most typical workaround of MyModule<2.99.99 would not be impacted by this change.

There is a potential of a breaking change where someone specifies 'Module!<1.0' to indicate they only want 1.0 prereleases. After discussion, we couldn't come up with a good scenario why you would only want prereleases when the release was available, so we are considering this an unsupported edge case.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions