From 50724d014ad6923e228e488648d40ce6f00297e9 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:25:22 -0700 Subject: fix(install): don't attempt to cache specifiers that point to directories (#26369) Fixes https://github.com/denoland/deno/issues/26162 --- cli/tools/registry/pm/cache_deps.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cli/tools/registry/pm/cache_deps.rs') diff --git a/cli/tools/registry/pm/cache_deps.rs b/cli/tools/registry/pm/cache_deps.rs index c8258e600..b4cd1c253 100644 --- a/cli/tools/registry/pm/cache_deps.rs +++ b/cli/tools/registry/pm/cache_deps.rs @@ -75,6 +75,13 @@ pub async fn cache_top_level_deps( if entry.key.ends_with('/') && specifier.as_str().ends_with('/') { continue; } + if specifier.scheme() == "file" { + if let Ok(path) = specifier.to_file_path() { + if !path.is_file() { + continue; + } + } + } roots.push(specifier.clone()); } } -- cgit v1.2.3 From 6d587cbfc800a627efb32d377b260954ccd7a1ed Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:12:52 -0700 Subject: fix(install): cache all exports of JSR packages listed in `deno.json` (#26501) Fixes #26498. This was a sort of intentional decision originally, as I wanted to avoid caching extra files that may not be needed. It seems like that behavior is unintuitive, so I propose we cache all of the exports of listed jsr packages when you run a bare `deno install`. --- cli/tools/registry/pm/cache_deps.rs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'cli/tools/registry/pm/cache_deps.rs') diff --git a/cli/tools/registry/pm/cache_deps.rs b/cli/tools/registry/pm/cache_deps.rs index b4cd1c253..365622d11 100644 --- a/cli/tools/registry/pm/cache_deps.rs +++ b/cli/tools/registry/pm/cache_deps.rs @@ -89,10 +89,6 @@ pub async fn cache_top_level_deps( while let Some(info_future) = info_futures.next().await { if let Some((specifier, info)) = info_future { - if info.export(".").is_some() { - roots.push(specifier.clone()); - continue; - } let exports = info.exports(); for (k, _) in exports { if let Ok(spec) = specifier.join(k) { -- cgit v1.2.3 From 0060e74779e25eba4544ca540066f07a1c46d17b Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:46:48 -0700 Subject: fix(install): don't cache json exports of JSR packages (for now) (#26530) Temporary fix for #26509, so people don't get errors. --- cli/tools/registry/pm/cache_deps.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cli/tools/registry/pm/cache_deps.rs') diff --git a/cli/tools/registry/pm/cache_deps.rs b/cli/tools/registry/pm/cache_deps.rs index 365622d11..9883deb1d 100644 --- a/cli/tools/registry/pm/cache_deps.rs +++ b/cli/tools/registry/pm/cache_deps.rs @@ -90,8 +90,13 @@ pub async fn cache_top_level_deps( while let Some(info_future) = info_futures.next().await { if let Some((specifier, info)) = info_future { let exports = info.exports(); - for (k, _) in exports { + for (k, v) in exports { if let Ok(spec) = specifier.join(k) { + if v.ends_with(".json") { + // TODO(nathanwhit): this should work, there's a bug with + // json roots in deno_graph. skip it for now + continue; + } roots.push(spec); } } -- cgit v1.2.3 From ec968aa5aec068e92fb554fc7192d912bcddb82c Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:19:03 -0700 Subject: fix(install): cache json exports of JSR packages (#26552) Fixes https://github.com/denoland/deno/issues/26509. Ended up being a `deno_graph` bug causing the error to surface. This PR updates `deno_graph` to pick up the fix and reverts the temporary workaround that skipped JSON exports. --- cli/tools/registry/pm/cache_deps.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'cli/tools/registry/pm/cache_deps.rs') diff --git a/cli/tools/registry/pm/cache_deps.rs b/cli/tools/registry/pm/cache_deps.rs index 9883deb1d..365622d11 100644 --- a/cli/tools/registry/pm/cache_deps.rs +++ b/cli/tools/registry/pm/cache_deps.rs @@ -90,13 +90,8 @@ pub async fn cache_top_level_deps( while let Some(info_future) = info_futures.next().await { if let Some((specifier, info)) = info_future { let exports = info.exports(); - for (k, v) in exports { + for (k, _) in exports { if let Ok(spec) = specifier.join(k) { - if v.ends_with(".json") { - // TODO(nathanwhit): this should work, there's a bug with - // json roots in deno_graph. skip it for now - continue; - } roots.push(spec); } } -- cgit v1.2.3 From d4f1bd3dacf54c4625eef7828341b39286ead8cb Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Fri, 8 Nov 2024 12:45:30 -0800 Subject: fix(install): cache jsr deps from all workspace config files (#26779) Fixes #26772. I wasn't aware that the `imports()` method only returned the workspace root imports --- cli/tools/registry/pm/cache_deps.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cli/tools/registry/pm/cache_deps.rs') diff --git a/cli/tools/registry/pm/cache_deps.rs b/cli/tools/registry/pm/cache_deps.rs index 365622d11..d3c8da868 100644 --- a/cli/tools/registry/pm/cache_deps.rs +++ b/cli/tools/registry/pm/cache_deps.rs @@ -44,7 +44,11 @@ pub async fn cache_top_level_deps( let mut seen_reqs = std::collections::HashSet::new(); - for entry in import_map.imports().entries() { + for entry in import_map.imports().entries().chain( + import_map + .scopes() + .flat_map(|scope| scope.imports.entries()), + ) { let Some(specifier) = entry.value else { continue; }; -- cgit v1.2.3