mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
refactor: create args
folder (#14982)
This commit is contained in:
parent
34eaad4155
commit
ed7a321994
27 changed files with 144 additions and 138 deletions
|
@ -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;
|
|
@ -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);
|
||||
}
|
||||
}
|
9
cli/args/mod.rs
Normal file
9
cli/args/mod.rs
Normal file
|
@ -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::*;
|
21
cli/emit.rs
21
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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()),
|
||||
|
|
|
@ -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;
|
||||
|
|
66
cli/main.rs
66
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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
4
cli/tools/vendor/mod.rs
vendored
4
cli/tools/vendor/mod.rs
vendored
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue