summaryrefslogtreecommitdiff
path: root/cli/npm
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-09-09 16:19:29 -0400
committerGitHub <noreply@github.com>2024-09-09 20:19:29 +0000
commit72f025c74320ffd6df9758ac53c74db68e0a3e10 (patch)
treeb7c72a6055cbd13bedcc0132af0c1f96342858ea /cli/npm
parent1e0ac609b57b9efdafd54de4cb56f98c507c032f (diff)
fix: remove recently added deno.json node_modules aliasing (#25542)
This was initially added in #25399 in order to make transitioning over from package.json to deno.json more easy, but it causes some problems that are shown in the issue and it also means that the output of `deno install` would have different resolution than `npm install`. Overall, I think it's too much complexity to be smarter about this and it's probably best to not do it. If someone needs an aliased folder then they should keep using a package.json Closes #25538
Diffstat (limited to 'cli/npm')
-rw-r--r--cli/npm/managed/resolvers/local.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/cli/npm/managed/resolvers/local.rs b/cli/npm/managed/resolvers/local.rs
index d0fd523e2..472bf2a47 100644
--- a/cli/npm/managed/resolvers/local.rs
+++ b/cli/npm/managed/resolvers/local.rs
@@ -642,13 +642,16 @@ async fn sync_resolution_with_fs(
} else {
continue; // skip, package not found
};
- let alias_clashes = remote.req.name != remote.alias
- && newest_packages_by_name.contains_key(&remote.alias);
+ let Some(remote_alias) = &remote.alias else {
+ continue;
+ };
+ let alias_clashes = remote.req.name != *remote_alias
+ && newest_packages_by_name.contains_key(remote_alias);
let install_in_child = {
// we'll install in the child if the alias is taken by another package, or
// if there's already a package with the same name but different version
// linked into the root
- match found_names.entry(&remote.alias) {
+ match found_names.entry(remote_alias) {
Entry::Occupied(nv) => {
alias_clashes
|| remote.req.name != nv.get().name // alias to a different package (in case of duplicate aliases)
@@ -679,7 +682,7 @@ async fn sync_resolution_with_fs(
existing_child_node_modules_dirs.insert(dest_node_modules.clone());
}
let mut dest_path = dest_node_modules;
- dest_path.push(&remote.alias);
+ dest_path.push(remote_alias);
symlink_package_dir(&local_registry_package_path, &dest_path)?;
} else {
@@ -689,7 +692,7 @@ async fn sync_resolution_with_fs(
{
symlink_package_dir(
&local_registry_package_path,
- &join_package_name(root_node_modules_dir_path, &remote.alias),
+ &join_package_name(root_node_modules_dir_path, remote_alias),
)?;
}
}
@@ -774,9 +777,12 @@ async fn sync_resolution_with_fs(
// install correctly for a workspace (potentially in sub directories),
// but this is good enough for a first pass
for workspace in npm_install_deps_provider.workspace_pkgs() {
+ let Some(workspace_alias) = &workspace.alias else {
+ continue;
+ };
symlink_package_dir(
&workspace.target_dir,
- &root_node_modules_dir_path.join(&workspace.alias),
+ &root_node_modules_dir_path.join(workspace_alias),
)?;
}
}