diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/args/flags.rs | 34 | ||||
-rw-r--r-- | cli/args/mod.rs | 5 | ||||
-rw-r--r-- | cli/lsp/config.rs | 30 | ||||
-rw-r--r-- | cli/lsp/language_server.rs | 5 |
4 files changed, 38 insertions, 36 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 3ac280869..050d55f4c 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -8244,8 +8244,12 @@ mod tests { #[test] fn install() { - let r = - flags_from_vec(svec!["deno", "install", "jsr:@std/http/file-server"]); + let r = flags_from_vec(svec![ + "deno", + "install", + "-g", + "jsr:@std/http/file-server" + ]); assert_eq!( r.unwrap(), Flags { @@ -8257,7 +8261,7 @@ mod tests { root: None, force: false, }), - global: false, + global: true, }), ..Flags::default() } @@ -8290,7 +8294,7 @@ mod tests { #[test] fn install_with_flags() { #[rustfmt::skip] - let r = flags_from_vec(svec!["deno", "install", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--cert", "example.crt", "--cached-only", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229", "--name", "file_server", "--root", "/foo", "--force", "--env=.example.env", "jsr:@std/http/file-server", "foo", "bar"]); + let r = flags_from_vec(svec!["deno", "install", "--global", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--cert", "example.crt", "--cached-only", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229", "--name", "file_server", "--root", "/foo", "--force", "--env=.example.env", "jsr:@std/http/file-server", "foo", "bar"]); assert_eq!( r.unwrap(), Flags { @@ -8302,7 +8306,7 @@ mod tests { root: Some("/foo".to_string()), force: true, }), - global: false, + global: true, }), import_map_path: Some("import_map.json".to_string()), no_remote: true, @@ -8682,25 +8686,7 @@ mod tests { watch: None, bare: true, }), - node_modules_dir: Some(true), - code_cache_enabled: true, - ..Flags::default() - } - ); - - let r = flags_from_vec(svec![ - "deno", - "run", - "--node-modules-dir=false", - "script.ts" - ]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Run(RunFlags::new_default( - "script.ts".to_string(), - )), - node_modules_dir: Some(false), + node_modules_dir: None, code_cache_enabled: true, ..Flags::default() } diff --git a/cli/args/mod.rs b/cli/args/mod.rs index a0888ca58..e339cb714 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -117,8 +117,8 @@ pub static DENO_DISABLE_PEDANTIC_NODE_WARNINGS: Lazy<bool> = Lazy::new(|| { .is_some() }); -pub static DENO_FUTURE: Lazy<bool> = - Lazy::new(|| std::env::var("DENO_FUTURE").ok().is_some()); +// TODO(2.0): remove this in a follow up. +pub static DENO_FUTURE: Lazy<bool> = Lazy::new(|| true); pub fn jsr_url() -> &'static Url { static JSR_URL: Lazy<Url> = Lazy::new(|| { @@ -1680,6 +1680,7 @@ impl CliOptions { } }); + // TODO(2.0): remove this conditional and enable these features in `99_main.js` by default. if *DENO_FUTURE { let future_features = [ deno_runtime::deno_ffi::UNSTABLE_FEATURE_NAME.to_string(), diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index ec2690506..4ac9b4d0a 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -1398,7 +1398,12 @@ impl ConfigData { || ( *DENO_FUTURE && member_dir.workspace.package_jsons().next().is_some() - && member_dir.workspace.node_modules_dir().is_none() + && member_dir + .workspace + .node_modules_mode() + .ok() + .flatten() + .is_none() // TODO(2.0): remove ); if byonm { @@ -1874,13 +1879,28 @@ fn resolve_node_modules_dir( // `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. - let explicitly_disabled = workspace.node_modules_dir() == Some(false); + let node_modules_mode = workspace.node_modules_mode().ok().flatten(); + let node_modules_dir_option = workspace.node_modules_dir(); + let explicitly_disabled = if *DENO_FUTURE { + node_modules_mode == Some(NodeModulesMode::GlobalAuto) + } else { + node_modules_dir_option == Some(false) + }; if explicitly_disabled { return None; } - let enabled = byonm - || workspace.node_modules_dir() == Some(true) - || workspace.vendor_dir_path().is_some(); + let enabled = if *DENO_FUTURE { + byonm + || node_modules_mode + .map(|m| m.uses_node_modules_dir()) + .unwrap_or(false) + || workspace.vendor_dir_path().is_some() + } else { + byonm + || workspace.node_modules_dir() == Some(true) + || workspace.vendor_dir_path().is_some() + }; + if !enabled { return None; } diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 37e1aa0be..05c54dfc6 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -3611,11 +3611,6 @@ impl Inner { .as_ref() .map(|url| url.to_string()) }), - node_modules_dir: Some( - config_data - .and_then(|d| d.node_modules_dir.as_ref()) - .is_some(), - ), // bit of a hack to force the lsp to cache the @types/node package type_check_mode: crate::args::TypeCheckMode::Local, ..Default::default() |