A workspace project whose version is not valid semver, such as `1` or
`1.0`, could not be matched by any `workspace:` specifier, even
`workspace:*`. The wildcard path asks semver for the highest version,
which skips anything that does not parse, and a plain range such as
`1` has no valid version to satisfy it.
The workspace range resolver in both CLIs now falls back to the
highest non-semver version for the wildcard tokens when no semver
version is present, and to an exact string match for any other range.
An identical version string is tried before semver matching.
v11 now picks a workspace version for a tag through the same resolver
as v12. The registry-shadow check skips a local version that is not
valid semver instead of throwing `Invalid Version`, unless
preferWorkspacePackages is set, in which case the workspace pick wins
in both CLIs. The NO_MATCHING_VERSION_INSIDE_WORKSPACE error now lists
semver versions first and non-semver ones after them, so v11 no longer
throws while building it.
A partial workspace version such as 1, 1.0 or 1.x is saved exactly,
with or without the workspace protocol, since ^1 would not match 1 on
the next install. Any other non-semver version keeps the ^ form and the
workspace protocol: written exactly it could mean a wildcard, a tag, an
alias or a different dependency source.
Closespnpm/pnpm#4567
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>