Skip to content

Commit

Permalink
Add args
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Mar 15, 2024
1 parent ce768ba commit 4dfd6a1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ pub enum CaData {
)]
pub struct UnstableConfig {
pub legacy_flag_enabled: bool, // --unstable
pub bare_node_builtins: bool, // --unstable-bare-node-builts
pub bare_node_builtins: bool,
pub byonm: bool,
pub node_detect_module: bool,
pub sloppy_imports: bool,
pub features: Vec<String>, // --unstabe-kv --unstable-cron
}
Expand Down Expand Up @@ -927,6 +928,8 @@ pub fn flags_from_vec(args: Vec<String>) -> clap::error::Result<Flags> {
flags.unstable_config.bare_node_builtins =
matches.get_flag("unstable-bare-node-builtins");
flags.unstable_config.byonm = matches.get_flag("unstable-byonm");
flags.unstable_config.node_detect_module =
matches.get_flag("unstable-node-detect-module");
flags.unstable_config.sloppy_imports =
matches.get_flag("unstable-sloppy-imports");

Expand Down Expand Up @@ -1054,6 +1057,15 @@ fn clap_root() -> Command {
.action(ArgAction::SetTrue)
.global(true),
)
.arg(
Arg::new("unstable-node-detect-module")
.long("unstable-node-detect-module")
.help("Enable detection of improperly defined ES modules in a node_modules folder")
.env("DENO_UNSTABLE_NODE_DETECT_MODULE")
.value_parser(FalseyValueParser::new())
.action(ArgAction::SetTrue)
.global(true),
)
.arg(
Arg::new("unstable-sloppy-imports")
.long("unstable-sloppy-imports")
Expand Down
9 changes: 9 additions & 0 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,15 @@ impl CliOptions {
.unwrap_or(false)
}

pub fn unstable_node_detect_module(&self) -> bool {
self.flags.unstable_config.node_detect_module
|| self
.maybe_config_file()
.as_ref()
.map(|c| c.has_unstable("node-detect-module"))
.unwrap_or(false)
}

pub fn unstable_sloppy_imports(&self) -> bool {
self.flags.unstable_config.sloppy_imports
|| self
Expand Down

0 comments on commit 4dfd6a1

Please sign in to comment.