mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 00:29:09 -05:00
fix(jsr): exclude yanked versions from 'deno add' and completions (#23113)
This commit is contained in:
parent
bca0fe1cde
commit
d347e73f5a
3 changed files with 13 additions and 6 deletions
14
cli/jsr.rs
14
cli/jsr.rs
|
@ -207,14 +207,18 @@ impl JsrFetchResolver {
|
|||
let maybe_get_nv = || async {
|
||||
let name = req.name.clone();
|
||||
let package_info = self.package_info(&name).await?;
|
||||
// Find the first matching version of the package which is cached.
|
||||
let mut versions = package_info.versions.keys().collect::<Vec<_>>();
|
||||
versions.sort();
|
||||
// Find the first matching version of the package.
|
||||
let mut versions = package_info.versions.iter().collect::<Vec<_>>();
|
||||
versions.sort_by_key(|(v, _)| *v);
|
||||
let version = versions
|
||||
.into_iter()
|
||||
.rev()
|
||||
.find(|v| req.version_req.tag().is_none() && req.version_req.matches(v))
|
||||
.cloned()?;
|
||||
.find(|(v, i)| {
|
||||
!i.yanked
|
||||
&& req.version_req.tag().is_none()
|
||||
&& req.version_req.matches(v)
|
||||
})
|
||||
.map(|(v, _)| v.clone())?;
|
||||
Some(PackageNv { name, version })
|
||||
};
|
||||
let nv = maybe_get_nv().await;
|
||||
|
|
|
@ -119,7 +119,7 @@ impl NpmFetchResolver {
|
|||
let maybe_get_nv = || async {
|
||||
let name = req.name.clone();
|
||||
let package_info = self.package_info(&name).await?;
|
||||
// Find the first matching version of the package which is cached.
|
||||
// Find the first matching version of the package.
|
||||
let mut versions = package_info.versions.keys().collect::<Vec<_>>();
|
||||
versions.sort();
|
||||
let version = versions
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{
|
||||
"versions": {
|
||||
"2.0.0": {
|
||||
"yanked": true
|
||||
},
|
||||
"1.0.0": {},
|
||||
"0.2.0": {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue