diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-11-08 14:17:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-08 14:17:24 -0500 |
commit | cbb3f854332c348bb253e1284f7dcd7287bdf28d (patch) | |
tree | 93e2db9439bd745d48118a931bdc8bea61b81af5 /cli/lsp/language_server.rs | |
parent | 2c72e8d5f45f12948310c1f0e1e2ed4f1d80fb51 (diff) |
feat(unstable/npm): support peer dependencies (#16561)
This adds support for peer dependencies in npm packages.
1. If not found higher in the tree (ancestor and ancestor siblings),
peer dependencies are resolved like a dependency similar to npm 7.
2. Optional peer dependencies are only resolved if found higher in the
tree.
3. This creates "copy packages" or duplicates of a package when a
package has different resolution due to peer dependency resolution—see
https://pnpm.io/how-peers-are-resolved. Unlike pnpm though, duplicates
of packages will have `_1`, `_2`, etc. added to the end of the package
version in the directory in order to minimize the chance of hitting the
max file path limit on Windows. This is done for both the local
"node_modules" directory and also the global npm cache. The files are
hard linked in this case to reduce hard drive space.
This is a first pass and the code is definitely more inefficient than it
could be.
Closes #15823
Diffstat (limited to 'cli/lsp/language_server.rs')
-rw-r--r-- | cli/lsp/language_server.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 3a0906636..aa4e98b1d 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -71,7 +71,7 @@ use crate::fs_util; use crate::graph_util::graph_valid; use crate::npm::NpmCache; use crate::npm::NpmPackageResolver; -use crate::npm::NpmRegistryApi; +use crate::npm::RealNpmRegistryApi; use crate::proc_state::import_map_from_text; use crate::proc_state::ProcState; use crate::progress_bar::ProgressBar; @@ -258,7 +258,7 @@ impl Inner { ts_server.clone(), ); let assets = Assets::new(ts_server.clone()); - let registry_url = NpmRegistryApi::default_url(); + let registry_url = RealNpmRegistryApi::default_url(); // Use an "only" cache setting in order to make the // user do an explicit "cache" command and prevent // the cache from being filled with lots of packages while @@ -270,7 +270,7 @@ impl Inner { cache_setting.clone(), progress_bar.clone(), ); - let api = NpmRegistryApi::new( + let api = RealNpmRegistryApi::new( registry_url, npm_cache.clone(), cache_setting, |