summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-11-08 12:45:30 -0800
committerGitHub <noreply@github.com>2024-11-08 12:45:30 -0800
commitd4f1bd3dacf54c4625eef7828341b39286ead8cb (patch)
treeeab65372c77092af78bfca7b6865ed72575b0eb6
parentb482a50299ae4f636a186038460e54af65e2b627 (diff)
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
-rw-r--r--cli/tools/registry/pm/cache_deps.rs6
-rw-r--r--tests/specs/install/installs_all_workspace_imports/__test__.jsonc9
-rw-r--r--tests/specs/install/installs_all_workspace_imports/deno.json6
-rw-r--r--tests/specs/install/installs_all_workspace_imports/install.out10
-rw-r--r--tests/specs/install/installs_all_workspace_imports/packages/bar/deno.json5
-rw-r--r--tests/specs/install/installs_all_workspace_imports/packages/foo/deno.json5
6 files changed, 40 insertions, 1 deletions
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;
};
diff --git a/tests/specs/install/installs_all_workspace_imports/__test__.jsonc b/tests/specs/install/installs_all_workspace_imports/__test__.jsonc
new file mode 100644
index 000000000..254fe8b98
--- /dev/null
+++ b/tests/specs/install/installs_all_workspace_imports/__test__.jsonc
@@ -0,0 +1,9 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install",
+ "output": "install.out"
+ }
+ ]
+}
diff --git a/tests/specs/install/installs_all_workspace_imports/deno.json b/tests/specs/install/installs_all_workspace_imports/deno.json
new file mode 100644
index 000000000..ac77e26d9
--- /dev/null
+++ b/tests/specs/install/installs_all_workspace_imports/deno.json
@@ -0,0 +1,6 @@
+{
+ "workspace": ["packages/foo", "packages/bar"],
+ "imports": {
+ "@denotest/subtract": "jsr:@denotest/subtract@^1.0.0"
+ }
+}
diff --git a/tests/specs/install/installs_all_workspace_imports/install.out b/tests/specs/install/installs_all_workspace_imports/install.out
new file mode 100644
index 000000000..b02e6cc03
--- /dev/null
+++ b/tests/specs/install/installs_all_workspace_imports/install.out
@@ -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]
diff --git a/tests/specs/install/installs_all_workspace_imports/packages/bar/deno.json b/tests/specs/install/installs_all_workspace_imports/packages/bar/deno.json
new file mode 100644
index 000000000..0172071c3
--- /dev/null
+++ b/tests/specs/install/installs_all_workspace_imports/packages/bar/deno.json
@@ -0,0 +1,5 @@
+{
+ "imports": {
+ "@denotest/esm-basic": "npm:@denotest/esm-basic@^1.0.0"
+ }
+}
diff --git a/tests/specs/install/installs_all_workspace_imports/packages/foo/deno.json b/tests/specs/install/installs_all_workspace_imports/packages/foo/deno.json
new file mode 100644
index 000000000..38ca2d4b8
--- /dev/null
+++ b/tests/specs/install/installs_all_workspace_imports/packages/foo/deno.json
@@ -0,0 +1,5 @@
+{
+ "imports": {
+ "@denotest/add": "jsr:@denotest/add@^1.0.0"
+ }
+}