Skip to content

Commit

Permalink
fix(install): cache jsr deps from all workspace config files (#26779)
Browse files Browse the repository at this point in the history
Fixes #26772.

I wasn't aware that the `imports()` method only returned the workspace
root imports
  • Loading branch information
nathanwhit authored Nov 8, 2024
1 parent b482a50 commit d4f1bd3
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cli/tools/registry/pm/cache_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"tempDir": true,
"steps": [
{
"args": "install",
"output": "install.out"
}
]
}
6 changes: 6 additions & 0 deletions tests/specs/install/installs_all_workspace_imports/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"workspace": ["packages/foo", "packages/bar"],
"imports": {
"@denotest/subtract": "jsr:@denotest/subtract@^1.0.0"
}
}
10 changes: 10 additions & 0 deletions tests/specs/install/installs_all_workspace_imports/install.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[UNORDERED_START]
Download http://localhost:4260/@denotest%2fesm-basic
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
Download http://127.0.0.1:4250/@denotest/subtract/meta.json
Download http://127.0.0.1:4250/@denotest/add/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]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@denotest/esm-basic": "npm:@denotest/esm-basic@^1.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@denotest/add": "jsr:@denotest/add@^1.0.0"
}
}

0 comments on commit d4f1bd3

Please sign in to comment.