Skip to content

Commit

Permalink
Updated the version matching logic to handle pre-release tags appropr…
Browse files Browse the repository at this point in the history
…iately, preventing panics related to the usage of `matches` with a tag.

fix denoland#25861
  • Loading branch information
yazan-abdalrahman committed Sep 25, 2024
1 parent 37cedef commit a9d6b5f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cli/npm/managed/resolvers/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,17 @@ async fn sync_resolution_with_fs(
Entry::Occupied(nv) => {
alias_clashes
|| remote.req.name != nv.get().name // alias to a different package (in case of duplicate aliases)
|| !remote.req.version_req.matches(&nv.get().version) // incompatible version
|| {
let version_str = nv.get().version.to_string();
// Check for pre-release tag
if version_str.contains('-') {
// Handle pre-release versions differently, if needed
log::warn!("{} Version '{}' for alias '{}' is a pre-release version.", colors::yellow("Warning"), version_str, remote_alias);
false // or however you want to handle it
} else {
!remote.req.version_req.matches(&nv.get().version) // compatible version
}
}
}
Entry::Vacant(entry) => {
entry.insert(&remote_pkg.id.nv);
Expand Down

0 comments on commit a9d6b5f

Please sign in to comment.