diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-08-06 21:56:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-06 21:56:56 -0400 |
commit | b9b03869489213fa9b24d7416afe9e3e27c81ce7 (patch) | |
tree | 7727f2906b0864b1242c9d8030ca6416ee053409 /cli/lsp/config.rs | |
parent | 7b5bc87f296d39e531051e1c0bb6cafa3808ab92 (diff) |
feat(unstable): rename `deno_modules` to `vendor` (#20065)
Renames the unstable `deno_modules` directory and corresponding settings
to `vendor` after feedback. Also causes the vendoring of the
`node_modules` directory which can be disabled via
`--node-modules-dir=false` or `"nodeModulesDir": false`.
Diffstat (limited to 'cli/lsp/config.rs')
-rw-r--r-- | cli/lsp/config.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index b84f63edc..13bfdd75d 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -475,10 +475,8 @@ impl Config { .and_then(|p| p.maybe_node_modules_dir.as_ref()) } - pub fn maybe_deno_modules_dir_path(&self) -> Option<PathBuf> { - self - .maybe_config_file() - .and_then(|c| c.deno_modules_dir_path()) + pub fn maybe_vendor_dir_path(&self) -> Option<PathBuf> { + self.maybe_config_file().and_then(|c| c.vendor_dir_path()) } pub fn maybe_config_file(&self) -> Option<&ConfigFile> { @@ -816,7 +814,13 @@ fn resolve_node_modules_dir(config_file: &ConfigFile) -> Option<PathBuf> { // `nodeModulesDir: true` setting in the deno.json file. This is to // reduce the chance of modifying someone's node_modules directory // without them having asked us to do so. - if config_file.node_modules_dir() != Some(true) { + let explicitly_disabled = config_file.node_modules_dir_flag() == Some(false); + if explicitly_disabled { + return None; + } + let enabled = config_file.node_modules_dir_flag() == Some(true) + || config_file.vendor_dir_flag() == Some(true); + if !enabled { return None; } if config_file.specifier.scheme() != "file" { |