diff options
Diffstat (limited to 'cli/args')
-rw-r--r-- | cli/args/flags.rs | 13 | ||||
-rw-r--r-- | cli/args/mod.rs | 13 |
2 files changed, 24 insertions, 2 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 9bd3a62d4..1acef2058 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -455,6 +455,7 @@ pub struct Flags { pub unstable: bool, pub unstable_bare_node_builtins: bool, pub unstable_byonm: bool, + pub unstable_sloppy_imports: bool, pub unstable_workspaces: bool, pub unstable_features: Vec<String>, pub unsafely_ignore_certificate_errors: Option<Vec<String>>, @@ -862,6 +863,7 @@ pub fn flags_from_vec(args: Vec<String>) -> clap::error::Result<Flags> { flags.unstable_bare_node_builtins = matches.get_flag("unstable-bare-node-builtins"); flags.unstable_byonm = matches.get_flag("unstable-byonm"); + flags.unstable_sloppy_imports = matches.get_flag("unstable-sloppy-imports"); flags.unstable_workspaces = matches.get_flag("unstable-workspaces"); if matches.get_flag("quiet") { @@ -982,6 +984,17 @@ fn clap_root() -> Command { .global(true), ) .arg( + Arg::new("unstable-sloppy-imports") + .long("unstable-sloppy-imports") + .help( + "Enable unstable resolving of specifiers by extension probing, .js to .ts, and directory probing.", + ) + .env("DENO_UNSTABLE_SLOPPY_IMPORTS") + .value_parser(FalseyValueParser::new()) + .action(ArgAction::SetTrue) + .global(true), + ) + .arg( Arg::new("unstable-workspaces") .long("unstable-workspaces") .help("Enable unstable 'workspaces' feature") diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 3e61b50bd..033b30d97 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1342,7 +1342,7 @@ impl CliOptions { || self .maybe_config_file() .as_ref() - .map(|c| c.json.unstable.contains(&"bare-node-builtins".to_string())) + .map(|c| c.has_unstable("bare-node-builtins")) .unwrap_or(false) } @@ -1355,7 +1355,16 @@ impl CliOptions { || self .maybe_config_file() .as_ref() - .map(|c| c.json.unstable.iter().any(|c| c == "byonm")) + .map(|c| c.has_unstable("byonm")) + .unwrap_or(false) + } + + pub fn unstable_sloppy_imports(&self) -> bool { + self.flags.unstable_sloppy_imports + || self + .maybe_config_file() + .as_ref() + .map(|c| c.has_unstable("sloppy-imports")) .unwrap_or(false) } |