[GH-ISSUE #871] Add a way to include all prerelease versions in a range #1428

Open
opened 2026-04-16 10:50:21 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @acarl005 on GitHub (Sep 3, 2022).
Original GitHub issue: https://github.com/semver/semver/issues/871

Currently, prerelease versions can only be opted-in to for specific patch versions, e.g. the range ^3.0.0-0 will allow 3.0.0-beta.1, but not 3.1.0-beta.1. I think this is the optimal behavior for what most users expect. However, there are some use cases for allowing prereleases for everything in the range. For example, see this discussion. In this case, vite-node wraps vite and it lists vite in its dependencies. However, @sveltejs/kit also depended upon vite, but it needed a prerelease beta version. The result is that @sveltejs/kit and vite-node ended up with separate, incompatible versions, breaking my project. I ended up having to use overrides in my package.json to work around it.

It would be nice if there was a way for vite-node to specify a looser range that allows all prerelease versions.

Maybe it could be something like ^^3.0.0-0?

Originally created by @acarl005 on GitHub (Sep 3, 2022). Original GitHub issue: https://github.com/semver/semver/issues/871 Currently, prerelease versions can only be opted-in to for specific patch versions, e.g. the range `^3.0.0-0` will allow `3.0.0-beta.1`, but not `3.1.0-beta.1`. I think this is the optimal behavior for what most users expect. However, there are some use cases for allowing prereleases for everything in the range. For example, see [this discussion](https://github.com/vitest-dev/vitest/issues/1960). In this case, vite-node wraps vite and it lists vite in its dependencies. However, @sveltejs/kit also depended upon vite, but it needed a prerelease beta version. The result is that @sveltejs/kit and vite-node ended up with separate, incompatible versions, breaking my project. I ended up having to use [`overrides`](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides) in my `package.json` to work around it. It would be nice if there was a way for vite-node to specify a looser range that allows all prerelease versions. Maybe it could be something like `^^3.0.0-0`?
Author
Owner

@ljharb commented on GitHub (Sep 3, 2022):

Can’t it do ^3.0.0-0 || ^3.1.0-0 etc, as needed?

<!-- gh-comment-id:1236204974 --> @ljharb commented on GitHub (Sep 3, 2022): Can’t it do `^3.0.0-0 || ^3.1.0-0` etc, as needed?
Author
Owner

@acarl005 commented on GitHub (Sep 3, 2022):

Yes, that is possible. However, it means that the maintainers of vite-node need to add a version with every minor release of vite, which is burdensome.

<!-- gh-comment-id:1236206540 --> @acarl005 commented on GitHub (Sep 3, 2022): Yes, that is possible. However, it means that the maintainers of vite-node need to add a version with every minor release of vite, which is burdensome.
Author
Owner

@ljharb commented on GitHub (Sep 4, 2022):

True, but that’s far less burdensome than updating the entire node ecosystem to support a new range operator.

<!-- gh-comment-id:1236226219 --> @ljharb commented on GitHub (Sep 4, 2022): True, but that’s far less burdensome than updating the entire node ecosystem to support a new range operator.
Author
Owner

@jwdonahue commented on GitHub (Sep 16, 2022):

This seems like a discussion for the node issues site. SemVer, does not currently define range specs, though that is a WIP, but it's primarily meant to document the most common factors between a small set of existing tools that each have their own range spec semantics.

<!-- gh-comment-id:1248915592 --> @jwdonahue commented on GitHub (Sep 16, 2022): This seems like a discussion for the [node issues site](https://github.com/nodejs/node/issues). SemVer, does not currently define range specs, though that is a [WIP](https://github.com/semver/semver/tree/isaacs/ranges), but it's primarily meant to document the most common factors between a small set of existing tools that each have their own range spec semantics.
Author
Owner

@ljharb commented on GitHub (Sep 16, 2022):

Oh, my mistake, I thought this issue was filed on npm/semver. This spec doesn't have ranges at all, so I totally agree it's entirely off topic.

<!-- gh-comment-id:1248927681 --> @ljharb commented on GitHub (Sep 16, 2022): Oh, my mistake, I thought this issue was filed on npm/semver. This spec doesn't have ranges at all, so I totally agree it's entirely off topic.
Author
Owner

@sabrican3532 commented on GitHub (Oct 15, 2022):

@segiddins

<!-- gh-comment-id:1279786820 --> @sabrican3532 commented on GitHub (Oct 15, 2022): @segiddins
Author
Owner

@anafebacus commented on GitHub (Oct 16, 2022):

Tank u

<!-- gh-comment-id:1280067105 --> @anafebacus commented on GitHub (Oct 16, 2022): Tank u
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#1428