diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-06-27 16:54:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 16:54:09 -0400 |
commit | e1c90963fbbf6571ae1b66971b83159681928ec3 (patch) | |
tree | 4bbf86a50776a512e966a9efba3cef044b00152d /cli | |
parent | 681bb49d0df0865a6564741544869a57aab56bb1 (diff) |
refactor: create `args` folder (#14982)
Diffstat (limited to 'cli')
-rw-r--r-- | cli/args/config_file.rs (renamed from cli/config_file.rs) | 4 | ||||
-rw-r--r-- | cli/args/flags.rs (renamed from cli/flags.rs) | 11 | ||||
-rw-r--r-- | cli/args/flags_allow_net.rs (renamed from cli/flags_allow_net.rs) | 0 | ||||
-rw-r--r-- | cli/args/mod.rs | 9 | ||||
-rw-r--r-- | cli/emit.rs | 21 | ||||
-rw-r--r-- | cli/lsp/analysis.rs | 2 | ||||
-rw-r--r-- | cli/lsp/cache.rs | 4 | ||||
-rw-r--r-- | cli/lsp/diagnostics.rs | 2 | ||||
-rw-r--r-- | cli/lsp/documents.rs | 2 | ||||
-rw-r--r-- | cli/lsp/language_server.rs | 11 | ||||
-rw-r--r-- | cli/lsp/testing/execution.rs | 8 | ||||
-rw-r--r-- | cli/lsp/tsc.rs | 2 | ||||
-rw-r--r-- | cli/main.rs | 66 | ||||
-rw-r--r-- | cli/proc_state.rs | 66 | ||||
-rw-r--r-- | cli/standalone.rs | 2 | ||||
-rw-r--r-- | cli/tools/bench.rs | 6 | ||||
-rw-r--r-- | cli/tools/coverage/mod.rs | 4 | ||||
-rw-r--r-- | cli/tools/doc.rs | 4 | ||||
-rw-r--r-- | cli/tools/fmt.rs | 10 | ||||
-rw-r--r-- | cli/tools/installer.rs | 10 | ||||
-rw-r--r-- | cli/tools/lint.rs | 6 | ||||
-rw-r--r-- | cli/tools/standalone.rs | 10 | ||||
-rw-r--r-- | cli/tools/task.rs | 6 | ||||
-rw-r--r-- | cli/tools/test.rs | 6 | ||||
-rw-r--r-- | cli/tools/upgrade.rs | 2 | ||||
-rw-r--r-- | cli/tools/vendor/mod.rs | 4 | ||||
-rw-r--r-- | cli/tsc.rs | 4 |
27 files changed, 144 insertions, 138 deletions
diff --git a/cli/config_file.rs b/cli/args/config_file.rs index 4b2596ba2..bed155d32 100644 --- a/cli/config_file.rs +++ b/cli/args/config_file.rs @@ -1,7 +1,7 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -use crate::flags::ConfigFlag; -use crate::flags::Flags; +use crate::args::ConfigFlag; +use crate::args::Flags; use crate::fs_util::canonicalize_path; use crate::fs_util::specifier_parent; use crate::fs_util::specifier_to_file_path; diff --git a/cli/flags.rs b/cli/args/flags.rs index 383d78a99..c61e9ab21 100644 --- a/cli/flags.rs +++ b/cli/args/flags.rs @@ -20,6 +20,8 @@ use std::num::NonZeroUsize; use std::path::PathBuf; use std::str::FromStr; +use super::flags_allow_net; + static LONG_VERSION: Lazy<String> = Lazy::new(|| { format!( "{} ({}, {})\nv8 {}\ntypescript {}", @@ -1746,7 +1748,7 @@ fn permission_args(app: Command) -> Command { .use_value_delimiter(true) .require_equals(true) .help("Allow network access") - .validator(crate::flags_allow_net::validator), + .validator(flags_allow_net::validator), ) .arg(unsafely_ignore_certificate_errors_arg()) .arg( @@ -2126,7 +2128,7 @@ fn unsafely_ignore_certificate_errors_arg<'a>() -> Arg<'a> { .require_equals(true) .value_name("HOSTNAMES") .help("DANGER: Disables verification of TLS certificates") - .validator(crate::flags_allow_net::validator) + .validator(flags_allow_net::validator) } fn bench_parse(flags: &mut Flags, matches: &clap::ArgMatches) { @@ -2773,7 +2775,7 @@ fn permission_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) { if let Some(net_wl) = matches.values_of("allow-net") { let net_allowlist: Vec<String> = - crate::flags_allow_net::parse(net_wl.map(ToString::to_string).collect()) + flags_allow_net::parse(net_wl.map(ToString::to_string).collect()) .unwrap(); flags.allow_net = Some(net_allowlist); } @@ -2831,8 +2833,7 @@ fn unsafely_ignore_certificate_errors_parse( ) { if let Some(ic_wl) = matches.values_of("unsafely-ignore-certificate-errors") { let ic_allowlist: Vec<String> = - crate::flags_allow_net::parse(ic_wl.map(ToString::to_string).collect()) - .unwrap(); + flags_allow_net::parse(ic_wl.map(ToString::to_string).collect()).unwrap(); flags.unsafely_ignore_certificate_errors = Some(ic_allowlist); } } diff --git a/cli/flags_allow_net.rs b/cli/args/flags_allow_net.rs index 613ce04fe..613ce04fe 100644 --- a/cli/flags_allow_net.rs +++ b/cli/args/flags_allow_net.rs diff --git a/cli/args/mod.rs b/cli/args/mod.rs new file mode 100644 index 000000000..375a53122 --- /dev/null +++ b/cli/args/mod.rs @@ -0,0 +1,9 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +pub mod config_file; +pub mod flags; + +mod flags_allow_net; + +pub use config_file::*; +pub use flags::*; diff --git a/cli/emit.rs b/cli/emit.rs index 10089bc8a..8246e1720 100644 --- a/cli/emit.rs +++ b/cli/emit.rs @@ -4,15 +4,15 @@ //! populate a cache, emit files, and transform a graph into the structures for //! loading into an isolate. +use crate::args::ConfigFile; +use crate::args::EmitConfigOptions; +use crate::args::IgnoredCompilerOptions; +use crate::args::TsConfig; +use crate::args::TypeCheckMode; use crate::cache::CacheType; use crate::cache::Cacher; use crate::colors; -use crate::config_file; -use crate::config_file::ConfigFile; -use crate::config_file::IgnoredCompilerOptions; -use crate::config_file::TsConfig; use crate::diagnostics::Diagnostics; -use crate::flags; use crate::graph_util::GraphData; use crate::graph_util::ModuleEntry; use crate::tsc; @@ -372,7 +372,7 @@ pub fn is_emittable( pub struct CheckOptions { /// The check flag from the option which can effect the filtering of /// diagnostics in the emit result. - pub type_check_mode: flags::TypeCheckMode, + pub type_check_mode: TypeCheckMode, /// Set the debug flag on the TypeScript type checker. pub debug: bool, /// If true, any files emitted will be cached, even if there are diagnostics @@ -463,7 +463,7 @@ pub fn check_and_maybe_emit( root_names, })?; - let diagnostics = if options.type_check_mode == flags::TypeCheckMode::Local { + let diagnostics = if options.type_check_mode == TypeCheckMode::Local { response.diagnostics.filter(|d| { if let Some(file_name) = &d.file_name { !file_name.starts_with("http") @@ -772,10 +772,9 @@ impl Hook for BundleHook { } } -impl From<config_file::TsConfig> for deno_ast::EmitOptions { - fn from(config: config_file::TsConfig) -> Self { - let options: config_file::EmitConfigOptions = - serde_json::from_value(config.0).unwrap(); +impl From<TsConfig> for deno_ast::EmitOptions { + fn from(config: TsConfig) -> Self { + let options: EmitConfigOptions = serde_json::from_value(config.0).unwrap(); let imports_not_used_as_values = match options.imports_not_used_as_values.as_str() { "preserve" => deno_ast::ImportsNotUsedAsValues::Preserve, diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs index 8e9b4ccaa..250886283 100644 --- a/cli/lsp/analysis.rs +++ b/cli/lsp/analysis.rs @@ -5,7 +5,7 @@ use super::documents::Documents; use super::language_server; use super::tsc; -use crate::config_file::LintConfig; +use crate::args::LintConfig; use crate::tools::lint::create_linter; use crate::tools::lint::get_configured_rules; diff --git a/cli/lsp/cache.rs b/cli/lsp/cache.rs index 249177a64..0f7608278 100644 --- a/cli/lsp/cache.rs +++ b/cli/lsp/cache.rs @@ -1,8 +1,8 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::ConfigFile; +use crate::args::Flags; use crate::cache::FetchCacher; -use crate::config_file::ConfigFile; -use crate::flags::Flags; use crate::graph_util::graph_valid; use crate::http_cache; use crate::proc_state::ProcState; diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs index fe3b5ee45..52ba1ba96 100644 --- a/cli/lsp/diagnostics.rs +++ b/cli/lsp/diagnostics.rs @@ -13,7 +13,7 @@ use super::performance::Performance; use super::tsc; use super::tsc::TsServer; -use crate::config_file::LintConfig; +use crate::args::LintConfig; use crate::diagnostics; use deno_ast::MediaType; diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index ec1e183ae..4cc0beb2a 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -5,7 +5,7 @@ use super::text::LineIndex; use super::tsc; use super::tsc::AssetDocument; -use crate::config_file::ConfigFile; +use crate::args::ConfigFile; use crate::file_fetcher::get_source_from_bytes; use crate::file_fetcher::map_content_type; use crate::file_fetcher::SUPPORTED_SCHEMES; diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 30a2ce253..4a703c719 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -54,10 +54,10 @@ use super::tsc::Assets; use super::tsc::AssetsSnapshot; use super::tsc::TsServer; use super::urls; -use crate::config_file::ConfigFile; -use crate::config_file::FmtConfig; -use crate::config_file::LintConfig; -use crate::config_file::TsConfig; +use crate::args::ConfigFile; +use crate::args::FmtConfig; +use crate::args::LintConfig; +use crate::args::TsConfig; use crate::deno_dir; use crate::file_fetcher::get_source_from_data_url; use crate::fs_util; @@ -364,8 +364,7 @@ impl Inner { if let Some(root_uri) = &self.config.root_uri { let root_path = fs_util::specifier_to_file_path(root_uri)?; let mut checked = std::collections::HashSet::new(); - let maybe_config = - crate::config_file::discover_from(&root_path, &mut checked)?; + let maybe_config = crate::args::discover_from(&root_path, &mut checked)?; Ok(maybe_config.map(|c| { lsp_log!(" Auto-resolved configuration file: \"{}\"", c.specifier); c diff --git a/cli/lsp/testing/execution.rs b/cli/lsp/testing/execution.rs index 03fdba63c..6b4e947a0 100644 --- a/cli/lsp/testing/execution.rs +++ b/cli/lsp/testing/execution.rs @@ -4,10 +4,11 @@ use super::definitions::TestDefinition; use super::definitions::TestDefinitions; use super::lsp_custom; +use crate::args::flags_from_vec; +use crate::args::DenoSubcommand; use crate::checksum; use crate::create_main_worker; use crate::emit; -use crate::flags; use crate::located_script_name; use crate::lsp::client::Client; use crate::lsp::client::TestingNotification; @@ -306,8 +307,7 @@ impl TestRun { ) -> Result<(), AnyError> { let args = self.get_args(); lsp_log!("Executing test run with arguments: {}", args.join(" ")); - let flags = - flags::flags_from_vec(args.into_iter().map(String::from).collect())?; + let flags = flags_from_vec(args.into_iter().map(String::from).collect())?; let ps = proc_state::ProcState::build(Arc::new(flags)).await?; let permissions = Permissions::from_options(&ps.flags.permissions_options()); @@ -327,7 +327,7 @@ impl TestRun { let sender = TestEventSender::new(sender); let (concurrent_jobs, fail_fast) = - if let flags::DenoSubcommand::Test(test_flags) = &ps.flags.subcommand { + if let DenoSubcommand::Test(test_flags) = &ps.flags.subcommand { ( test_flags.concurrent_jobs.into(), test_flags.fail_fast.map(|count| count.into()), diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index 76e428b2f..9988a0ac9 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -17,7 +17,7 @@ use super::text::LineIndex; use super::urls::LspUrlMap; use super::urls::INVALID_SPECIFIER; -use crate::config_file::TsConfig; +use crate::args::TsConfig; use crate::fs_util::specifier_to_file_path; use crate::tsc; use crate::tsc::ResolveArgs; diff --git a/cli/main.rs b/cli/main.rs index d9c4486f4..e74ed8518 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -1,11 +1,11 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +mod args; mod auth_tokens; mod cache; mod cdp; mod checksum; mod compat; -mod config_file; mod deno_dir; mod diagnostics; mod diff; @@ -15,8 +15,6 @@ mod emit; mod errors; mod file_fetcher; mod file_watcher; -mod flags; -mod flags_allow_net; mod fmt_errors; mod fs_util; mod graph_util; @@ -37,31 +35,33 @@ mod unix_util; mod version; mod windows_util; +use crate::args::flags_from_vec; +use crate::args::resolve_import_map_specifier; +use crate::args::BenchFlags; +use crate::args::BundleFlags; +use crate::args::CacheFlags; +use crate::args::CheckFlags; +use crate::args::CompileFlags; +use crate::args::CompletionsFlags; +use crate::args::CoverageFlags; +use crate::args::DenoSubcommand; +use crate::args::DocFlags; +use crate::args::EvalFlags; +use crate::args::Flags; +use crate::args::FmtFlags; +use crate::args::InfoFlags; +use crate::args::InstallFlags; +use crate::args::LintFlags; +use crate::args::ReplFlags; +use crate::args::RunFlags; +use crate::args::TaskFlags; +use crate::args::TestFlags; +use crate::args::TypeCheckMode; +use crate::args::UninstallFlags; +use crate::args::UpgradeFlags; +use crate::args::VendorFlags; use crate::file_fetcher::File; use crate::file_watcher::ResolutionResult; -use crate::flags::BenchFlags; -use crate::flags::BundleFlags; -use crate::flags::CacheFlags; -use crate::flags::CheckFlags; -use crate::flags::CompileFlags; -use crate::flags::CompletionsFlags; -use crate::flags::CoverageFlags; -use crate::flags::DenoSubcommand; -use crate::flags::DocFlags; -use crate::flags::EvalFlags; -use crate::flags::Flags; -use crate::flags::FmtFlags; -use crate::flags::InfoFlags; -use crate::flags::InstallFlags; -use crate::flags::LintFlags; -use crate::flags::ReplFlags; -use crate::flags::RunFlags; -use crate::flags::TaskFlags; -use crate::flags::TestFlags; -use crate::flags::TypeCheckMode; -use crate::flags::UninstallFlags; -use crate::flags::UpgradeFlags; -use crate::flags::VendorFlags; use crate::fmt_errors::format_js_error; use crate::graph_util::graph_lock_or_exit; use crate::graph_util::graph_valid; @@ -69,6 +69,7 @@ use crate::module_loader::CliModuleLoader; use crate::proc_state::ProcState; use crate::resolver::ImportMapResolver; use crate::resolver::JsxResolver; + use deno_ast::MediaType; use deno_core::error::generic_error; use deno_core::error::AnyError; @@ -797,12 +798,11 @@ async fn bundle_command( }) .collect(); - if let Ok(Some(import_map_path)) = - config_file::resolve_import_map_specifier( - ps.flags.import_map_path.as_deref(), - ps.maybe_config_file.as_ref(), - ) - .map(|ms| ms.and_then(|ref s| s.to_file_path().ok())) + if let Ok(Some(import_map_path)) = resolve_import_map_specifier( + ps.flags.import_map_path.as_deref(), + ps.maybe_config_file.as_ref(), + ) + .map(|ms| ms.and_then(|ref s| s.to_file_path().ok())) { paths_to_watch.push(import_map_path); } @@ -1418,7 +1418,7 @@ pub fn main() { // TODO(bartlomieju): doesn't handle exit code set by the runtime properly unwrap_or_exit(standalone_res); - let flags = match flags::flags_from_vec(args) { + let flags = match flags_from_vec(args) { Ok(flags) => flags, Err(err @ clap::Error { .. }) if err.kind() == clap::ErrorKind::DisplayHelp diff --git a/cli/proc_state.rs b/cli/proc_state.rs index e06c3f772..112307eb4 100644 --- a/cli/proc_state.rs +++ b/cli/proc_state.rs @@ -1,19 +1,20 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::resolve_import_map_specifier; +use crate::args::ConfigFile; +use crate::args::Flags; +use crate::args::MaybeImportsResult; +use crate::args::TypeCheckMode; use crate::cache; use crate::colors; use crate::compat; use crate::compat::NodeEsmResolver; -use crate::config_file; -use crate::config_file::ConfigFile; -use crate::config_file::MaybeImportsResult; use crate::deno_dir; use crate::emit; use crate::emit::EmitCache; use crate::file_fetcher::get_root_cert_store; use crate::file_fetcher::CacheSetting; use crate::file_fetcher::FileFetcher; -use crate::flags; use crate::graph_util::graph_lock_or_exit; use crate::graph_util::GraphData; use crate::graph_util::ModuleEntry; @@ -68,7 +69,7 @@ pub struct ProcState(Arc<Inner>); pub struct Inner { /// Flags parsed from `argv` contents. - pub flags: Arc<flags::Flags>, + pub flags: Arc<Flags>, pub dir: deno_dir::DenoDir, pub coverage_dir: Option<String>, pub file_fetcher: FileFetcher, @@ -94,12 +95,12 @@ impl Deref for ProcState { } impl ProcState { - pub async fn build(flags: Arc<flags::Flags>) -> Result<Self, AnyError> { + pub async fn build(flags: Arc<Flags>) -> Result<Self, AnyError> { Self::build_with_sender(flags, None).await } pub async fn build_for_file_watcher( - flags: Arc<flags::Flags>, + flags: Arc<Flags>, files_to_watch_sender: tokio::sync::mpsc::UnboundedSender<Vec<PathBuf>>, ) -> Result<Self, AnyError> { let ps = Self::build_with_sender( @@ -113,12 +114,11 @@ impl ProcState { files_to_watch_sender.send(watch_paths.clone()).unwrap(); } - if let Ok(Some(import_map_path)) = - config_file::resolve_import_map_specifier( - ps.flags.import_map_path.as_deref(), - ps.maybe_config_file.as_ref(), - ) - .map(|ms| ms.and_then(|ref s| s.to_file_path().ok())) + if let Ok(Some(import_map_path)) = resolve_import_map_specifier( + ps.flags.import_map_path.as_deref(), + ps.maybe_config_file.as_ref(), + ) + .map(|ms| ms.and_then(|ref s| s.to_file_path().ok())) { files_to_watch_sender.send(vec![import_map_path]).unwrap(); } @@ -127,7 +127,7 @@ impl ProcState { } async fn build_with_sender( - flags: Arc<flags::Flags>, + flags: Arc<Flags>, maybe_sender: Option<tokio::sync::mpsc::UnboundedSender<Vec<PathBuf>>>, ) -> Result<Self, AnyError> { let maybe_custom_root = flags @@ -188,13 +188,12 @@ impl ProcState { None }; - let maybe_config_file = crate::config_file::discover(&flags)?; + let maybe_config_file = crate::args::discover(&flags)?; - let maybe_import_map_specifier = - crate::config_file::resolve_import_map_specifier( - flags.import_map_path.as_deref(), - maybe_config_file.as_ref(), - )?; + let maybe_import_map_specifier = crate::args::resolve_import_map_specifier( + flags.import_map_path.as_deref(), + maybe_config_file.as_ref(), + )?; let maybe_import_map = if let Some(import_map_specifier) = maybe_import_map_specifier { @@ -349,12 +348,12 @@ impl ProcState { }; if !reload_on_watch { let graph_data = self.graph_data.read(); - if self.flags.type_check_mode == flags::TypeCheckMode::None + if self.flags.type_check_mode == TypeCheckMode::None || graph_data.is_type_checked(&roots, &lib) { if let Some(result) = graph_data.check( &roots, - self.flags.type_check_mode != flags::TypeCheckMode::None, + self.flags.type_check_mode != TypeCheckMode::None, false, ) { return result; @@ -471,21 +470,20 @@ impl ProcState { graph_data .check( &roots, - self.flags.type_check_mode != flags::TypeCheckMode::None, + self.flags.type_check_mode != TypeCheckMode::None, check_js, ) .unwrap()?; } - let config_type = - if self.flags.type_check_mode == flags::TypeCheckMode::None { - emit::ConfigType::Emit - } else { - emit::ConfigType::Check { - tsc_emit: true, - lib: lib.clone(), - } - }; + let config_type = if self.flags.type_check_mode == TypeCheckMode::None { + emit::ConfigType::Emit + } else { + emit::ConfigType::Check { + tsc_emit: true, + lib: lib.clone(), + } + }; let (ts_config, maybe_ignored_options) = emit::get_ts_config(config_type, self.maybe_config_file.as_ref(), None)?; @@ -494,7 +492,7 @@ impl ProcState { log::warn!("{}", ignored_options); } - if self.flags.type_check_mode == flags::TypeCheckMode::None { + if self.flags.type_check_mode == TypeCheckMode::None { let options = emit::EmitOptions { ts_config, reload: self.flags.reload, @@ -529,7 +527,7 @@ impl ProcState { log::debug!("{}", emit_result.stats); } - if self.flags.type_check_mode != flags::TypeCheckMode::None { + if self.flags.type_check_mode != TypeCheckMode::None { let mut graph_data = self.graph_data.write(); graph_data.set_type_checked(&roots, &lib); } diff --git a/cli/standalone.rs b/cli/standalone.rs index 1e8429db0..d66eb7694 100644 --- a/cli/standalone.rs +++ b/cli/standalone.rs @@ -1,8 +1,8 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::Flags; use crate::colors; use crate::file_fetcher::get_source_from_data_url; -use crate::flags::Flags; use crate::fmt_errors::format_js_error; use crate::ops; use crate::proc_state::ProcState; diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs index b51938d13..3c40b4e95 100644 --- a/cli/tools/bench.rs +++ b/cli/tools/bench.rs @@ -1,5 +1,8 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::BenchFlags; +use crate::args::Flags; +use crate::args::TypeCheckMode; use crate::cache; use crate::colors; use crate::compat; @@ -7,9 +10,6 @@ use crate::create_main_worker; use crate::emit; use crate::file_watcher; use crate::file_watcher::ResolutionResult; -use crate::flags::BenchFlags; -use crate::flags::Flags; -use crate::flags::TypeCheckMode; use crate::fs_util::collect_specifiers; use crate::fs_util::is_supported_bench_path; use crate::graph_util::contains_specifier; diff --git a/cli/tools/coverage/mod.rs b/cli/tools/coverage/mod.rs index d895f8a7e..efaf19922 100644 --- a/cli/tools/coverage/mod.rs +++ b/cli/tools/coverage/mod.rs @@ -1,8 +1,8 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::CoverageFlags; +use crate::args::Flags; use crate::colors; -use crate::flags::CoverageFlags; -use crate::flags::Flags; use crate::fs_util::collect_files; use crate::proc_state::ProcState; use crate::tools::fmt::format_json; diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs index a5826d1bc..684c3040e 100644 --- a/cli/tools/doc.rs +++ b/cli/tools/doc.rs @@ -1,9 +1,9 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::DocFlags; +use crate::args::Flags; use crate::colors; use crate::file_fetcher::File; -use crate::flags::DocFlags; -use crate::flags::Flags; use crate::get_types; use crate::proc_state::ProcState; use crate::write_json_to_stdout; diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index 7758f29f9..b2aa47373 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -7,16 +7,16 @@ //! the future it can be easily extended to provide //! the same functions as ops available in JS runtime. +use crate::args::Flags; +use crate::args::FmtConfig; +use crate::args::FmtFlags; +use crate::args::FmtOptionsConfig; +use crate::args::ProseWrap; use crate::colors; -use crate::config_file::FmtConfig; -use crate::config_file::FmtOptionsConfig; -use crate::config_file::ProseWrap; use crate::deno_dir::DenoDir; use crate::diff::diff; use crate::file_watcher; use crate::file_watcher::ResolutionResult; -use crate::flags::Flags; -use crate::flags::FmtFlags; use crate::fs_util::collect_files; use crate::fs_util::get_extension; use crate::fs_util::specifier_to_file_path; diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index 962f16ce3..df4b46332 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -1,9 +1,9 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -use crate::flags::ConfigFlag; -use crate::flags::Flags; -use crate::flags::InstallFlags; -use crate::flags::TypeCheckMode; +use crate::args::ConfigFlag; +use crate::args::Flags; +use crate::args::InstallFlags; +use crate::args::TypeCheckMode; use crate::fs_util::canonicalize_path; use deno_core::error::generic_error; use deno_core::error::AnyError; @@ -403,7 +403,7 @@ fn is_in_path(dir: &Path) -> bool { mod tests { use super::*; - use crate::flags::ConfigFlag; + use crate::args::ConfigFlag; use std::process::Command; use test_util::testdata_path; use test_util::TempDir; diff --git a/cli/tools/lint.rs b/cli/tools/lint.rs index f251dc647..60cda9f90 100644 --- a/cli/tools/lint.rs +++ b/cli/tools/lint.rs @@ -6,9 +6,9 @@ //! At the moment it is only consumed using CLI but in //! the future it can be easily extended to provide //! the same functions as ops available in JS runtime. -use crate::config_file::LintConfig; +use crate::args::LintConfig; +use crate::args::{Flags, LintFlags}; use crate::file_watcher::ResolutionResult; -use crate::flags::{Flags, LintFlags}; use crate::fmt_errors; use crate::fs_util::{collect_files, is_supported_ext, specifier_to_file_path}; use crate::proc_state::ProcState; @@ -590,7 +590,7 @@ mod test { use deno_lint::rules::get_recommended_rules; use super::*; - use crate::config_file::LintRulesConfig; + use crate::args::LintRulesConfig; #[test] fn recommended_rules_when_no_tags_in_config() { diff --git a/cli/tools/standalone.rs b/cli/tools/standalone.rs index e29545b2f..2561188ca 100644 --- a/cli/tools/standalone.rs +++ b/cli/tools/standalone.rs @@ -1,11 +1,11 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::CompileFlags; +use crate::args::DenoSubcommand; +use crate::args::Flags; +use crate::args::RunFlags; +use crate::args::TypeCheckMode; use crate::deno_dir::DenoDir; -use crate::flags::CompileFlags; -use crate::flags::DenoSubcommand; -use crate::flags::Flags; -use crate::flags::RunFlags; -use crate::flags::TypeCheckMode; use crate::fs_util; use crate::standalone::Metadata; use crate::standalone::MAGIC_TRAILER; diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 28dd0a853..1b6846e7c 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -1,9 +1,9 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::ConfigFile; +use crate::args::Flags; +use crate::args::TaskFlags; use crate::colors; -use crate::config_file::ConfigFile; -use crate::flags::Flags; -use crate::flags::TaskFlags; use crate::fs_util; use crate::proc_state::ProcState; use deno_core::anyhow::bail; diff --git a/cli/tools/test.rs b/cli/tools/test.rs index 94412a3ae..ac146fdbf 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -1,5 +1,8 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::Flags; +use crate::args::TestFlags; +use crate::args::TypeCheckMode; use crate::cache; use crate::colors; use crate::compat; @@ -9,9 +12,6 @@ use crate::emit; use crate::file_fetcher::File; use crate::file_watcher; use crate::file_watcher::ResolutionResult; -use crate::flags::Flags; -use crate::flags::TestFlags; -use crate::flags::TypeCheckMode; use crate::fmt_errors::format_js_error; use crate::fs_util::collect_specifiers; use crate::fs_util::is_supported_test_ext; diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index d72fb1b0a..db1383eb0 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -2,7 +2,7 @@ //! This module provides feature to upgrade deno executable -use crate::flags::UpgradeFlags; +use crate::args::UpgradeFlags; use deno_core::anyhow::bail; use deno_core::error::AnyError; use deno_core::futures::StreamExt; diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs index 69c759154..15b149e2e 100644 --- a/cli/tools/vendor/mod.rs +++ b/cli/tools/vendor/mod.rs @@ -11,8 +11,8 @@ use deno_core::resolve_url_or_path; use deno_runtime::permissions::Permissions; use log::warn; -use crate::config_file::FmtOptionsConfig; -use crate::flags::VendorFlags; +use crate::args::FmtOptionsConfig; +use crate::args::VendorFlags; use crate::fs_util; use crate::fs_util::relative_specifier; use crate::fs_util::specifier_to_file_path; diff --git a/cli/tsc.rs b/cli/tsc.rs index b293ea3b2..95fdd305a 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -1,6 +1,6 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -use crate::config_file::TsConfig; +use crate::args::TsConfig; use crate::diagnostics::Diagnostics; use crate::emit; use crate::graph_util::GraphData; @@ -699,7 +699,7 @@ pub fn exec(request: Request) -> Result<Response, AnyError> { #[cfg(test)] mod tests { use super::*; - use crate::config_file::TsConfig; + use crate::args::TsConfig; use crate::diagnostics::Diagnostic; use crate::diagnostics::DiagnosticCategory; use crate::emit::Stats; |