summaryrefslogtreecommitdiff
path: root/cli/npm
diff options
context:
space:
mode:
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),
)?;
}
}