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: [PATCH] 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 +++++++ tests/specs/install/import_map_with_dir/__test__.jsonc | 9 +++++++++ tests/specs/install/import_map_with_dir/deno.json | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 tests/specs/install/import_map_with_dir/__test__.jsonc create mode 100644 tests/specs/install/import_map_with_dir/deno.json diff --git a/cli/tools/registry/pm/cache_deps.rs b/cli/tools/registry/pm/cache_deps.rs index c8258e6009..b4cd1c2532 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()); } } diff --git a/tests/specs/install/import_map_with_dir/__test__.jsonc b/tests/specs/install/import_map_with_dir/__test__.jsonc new file mode 100644 index 0000000000..cbbc7cc2e1 --- /dev/null +++ b/tests/specs/install/import_map_with_dir/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "" + } + ] +} diff --git a/tests/specs/install/import_map_with_dir/deno.json b/tests/specs/install/import_map_with_dir/deno.json new file mode 100644 index 0000000000..5c3224b071 --- /dev/null +++ b/tests/specs/install/import_map_with_dir/deno.json @@ -0,0 +1,5 @@ +{ + "imports": { + "@assets": "./src/assets/" + } +}