From d20c9e75d1540b1a27e721d0cf66d29ba6a2c3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 22 Jan 2024 18:37:28 +0100 Subject: refactor: add "UnstableConfig" struct to cli/args/flags.rs (#21993) This commit adds "UnstableConfig" struct which centralizes handling of all "--unstable-*" flags. Closes https://github.com/denoland/deno/issues/21920 --- cli/args/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cli/args/mod.rs') diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 1fdd2f503..c6bc712f8 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1409,12 +1409,12 @@ impl CliOptions { &self.flags.unsafely_ignore_certificate_errors } - pub fn unstable(&self) -> bool { - self.flags.unstable + pub fn legacy_unstable_flag(&self) -> bool { + self.flags.unstable_config.legacy_flag_enabled } pub fn unstable_bare_node_builtins(&self) -> bool { - self.flags.unstable_bare_node_builtins + self.flags.unstable_config.bare_node_builtins || self .maybe_config_file() .as_ref() @@ -1423,7 +1423,7 @@ impl CliOptions { } pub fn unstable_byonm(&self) -> bool { - self.flags.unstable_byonm + self.flags.unstable_config.byonm || NPM_PROCESS_STATE .as_ref() .map(|s| matches!(s.kind, NpmProcessStateKind::Byonm)) @@ -1436,7 +1436,7 @@ impl CliOptions { } pub fn unstable_sloppy_imports(&self) -> bool { - self.flags.unstable_sloppy_imports + self.flags.unstable_config.sloppy_imports || self .maybe_config_file() .as_ref() @@ -1451,7 +1451,7 @@ impl CliOptions { .map(|c| c.json.unstable.clone()) .unwrap_or_default(); - from_config_file.extend_from_slice(&self.flags.unstable_features); + from_config_file.extend_from_slice(&self.flags.unstable_config.features); from_config_file } -- cgit v1.2.3