mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
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
This commit is contained in:
parent
1e0ac609b5
commit
72f025c743
13 changed files with 24 additions and 88 deletions
|
@ -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),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue