diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-08-28 14:17:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-28 14:17:47 -0400 |
commit | b708a13eb02510925b5fd964fe933b4896093185 (patch) | |
tree | e20a84f95680439a3eb665245fc7ede27bf4be02 /cli/lsp/jsr.rs | |
parent | 7dd861aa36974d5afa9633078b51c4c7f17cf181 (diff) |
feat: improve lockfile v4 to store normalized version constraints and be more terse (#25247)
Stores normalized version constraints in the lockfile, which will
improve reproducibility and will fix a bug with duplicate specifiers
ending up in the lockfile. Also, gets rid of some duplicate data in the
specifiers area of the lockfile.
Diffstat (limited to 'cli/lsp/jsr.rs')
-rw-r--r-- | cli/lsp/jsr.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/cli/lsp/jsr.rs b/cli/lsp/jsr.rs index c0a82383d..6c591637c 100644 --- a/cli/lsp/jsr.rs +++ b/cli/lsp/jsr.rs @@ -92,20 +92,23 @@ impl JsrCacheResolver { } } if let Some(lockfile) = config_data.and_then(|d| d.lockfile.as_ref()) { - for (req_url, nv_url) in &lockfile.lock().content.packages.specifiers { - let Some(req) = req_url.strip_prefix("jsr:") else { - continue; - }; - let Some(nv) = nv_url.strip_prefix("jsr:") else { - continue; - }; - let Ok(req) = PackageReq::from_str(req) else { - continue; + for (dep_req, version) in &lockfile.lock().content.packages.specifiers { + let req = match dep_req.kind { + deno_semver::package::PackageKind::Jsr => &dep_req.req, + deno_semver::package::PackageKind::Npm => { + continue; + } }; - let Ok(nv) = PackageNv::from_str(nv) else { + let Ok(version) = Version::parse_standard(version) else { continue; }; - nv_by_req.insert(req, Some(nv)); + nv_by_req.insert( + req.clone(), + Some(PackageNv { + name: req.name.clone(), + version, + }), + ); } } Self { |