Skip to content

Commit

Permalink
fix(install): cache all exports of JSR packages listed in deno.json (
Browse files Browse the repository at this point in the history
…#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`.
  • Loading branch information
nathanwhit authored Oct 24, 2024
1 parent 69e1d7a commit 6d587cb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 0 additions & 4 deletions cli/tools/registry/pm/cache_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions tests/specs/install/jsr_exports/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tempDir": true,
"steps": [
{ "args": "install", "output": "install.out" }
]
}
5 changes: 5 additions & 0 deletions tests/specs/install/jsr_exports/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@denotest/different-deps-per-export": "jsr:@denotest/different-deps-per-export@^1.0.0"
}
}
12 changes: 12 additions & 0 deletions tests/specs/install/jsr_exports/install.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[UNORDERED_START]
Download http://127.0.0.1:4250/@denotest/different-deps-per-export/meta.json
Download http://127.0.0.1:4250/@denotest/different-deps-per-export/1.0.0_meta.json
Download http://127.0.0.1:4250/@denotest/different-deps-per-export/1.0.0/add.ts
Download http://127.0.0.1:4250/@denotest/different-deps-per-export/1.0.0/subtract.ts
Download http://127.0.0.1:4250/@denotest/add/meta.json
Download http://127.0.0.1:4250/@denotest/subtract/meta.json
Download http://127.0.0.1:4250/@denotest/add/1.0.0_meta.json
Download http://127.0.0.1:4250/@denotest/subtract/1.0.0_meta.json
Download http://127.0.0.1:4250/@denotest/add/1.0.0/mod.ts
Download http://127.0.0.1:4250/@denotest/subtract/1.0.0/mod.ts
[UNORDERED_END]

0 comments on commit 6d587cb

Please sign in to comment.