diff options
Diffstat (limited to 'cli/tools/vendor')
-rw-r--r-- | cli/tools/vendor/mappings.rs | 4 | ||||
-rw-r--r-- | cli/tools/vendor/mod.rs | 20 | ||||
-rw-r--r-- | cli/tools/vendor/specifiers.rs | 15 |
3 files changed, 17 insertions, 22 deletions
diff --git a/cli/tools/vendor/mappings.rs b/cli/tools/vendor/mappings.rs index 543536128..d1152b12b 100644 --- a/cli/tools/vendor/mappings.rs +++ b/cli/tools/vendor/mappings.rs @@ -13,8 +13,8 @@ use deno_graph::ModuleGraph; use deno_graph::Position; use deno_graph::Resolved; -use crate::fs_util::path_with_stem_suffix; -use crate::fs_util::relative_specifier; +use crate::util::path::path_with_stem_suffix; +use crate::util::path::relative_specifier; use super::specifiers::dir_name_for_root; use super::specifiers::get_unique_path; diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs index 3fd381b21..a1057d838 100644 --- a/cli/tools/vendor/mod.rs +++ b/cli/tools/vendor/mod.rs @@ -15,11 +15,12 @@ use crate::args::CliOptions; use crate::args::Flags; 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; use crate::proc_state::ProcState; use crate::tools::fmt::format_json; +use crate::util::fs::canonicalize_path; +use crate::util::fs::resolve_from_cwd; +use crate::util::path::relative_specifier; +use crate::util::path::specifier_to_file_path; mod analyze; mod build; @@ -38,7 +39,7 @@ pub async fn vendor( Some(output_path) => output_path.to_owned(), None => PathBuf::from("vendor/"), }; - let output_dir = fs_util::resolve_from_cwd(&raw_output_dir)?; + let output_dir = resolve_from_cwd(&raw_output_dir)?; validate_output_dir(&output_dir, &vendor_flags)?; validate_options(&mut cli_options, &output_dir)?; let ps = ProcState::from_options(Arc::new(cli_options)).await?; @@ -110,18 +111,17 @@ fn validate_options( if let Some(import_map_path) = options .resolve_import_map_specifier()? .and_then(|p| specifier_to_file_path(&p).ok()) - .and_then(|p| fs_util::canonicalize_path(&p).ok()) + .and_then(|p| canonicalize_path(&p).ok()) { // make the output directory in order to canonicalize it for the check below std::fs::create_dir_all(output_dir)?; - let output_dir = - fs_util::canonicalize_path(output_dir).with_context(|| { - format!("Failed to canonicalize: {}", output_dir.display()) - })?; + let output_dir = canonicalize_path(output_dir).with_context(|| { + format!("Failed to canonicalize: {}", output_dir.display()) + })?; if import_map_path.starts_with(&output_dir) { // canonicalize to make the test for this pass on the CI - let cwd = fs_util::canonicalize_path(&std::env::current_dir()?)?; + let cwd = canonicalize_path(&std::env::current_dir()?)?; // We don't allow using the output directory to help generate the // new state because this may lead to cryptic error messages. log::warn!( diff --git a/cli/tools/vendor/specifiers.rs b/cli/tools/vendor/specifiers.rs index 5d4f98278..9d513cc92 100644 --- a/cli/tools/vendor/specifiers.rs +++ b/cli/tools/vendor/specifiers.rs @@ -8,8 +8,9 @@ use deno_ast::ModuleSpecifier; use deno_core::anyhow::anyhow; use deno_core::error::AnyError; -use crate::fs_util; -use crate::fs_util::path_with_stem_suffix; +use crate::util::path::is_banned_path_char; +use crate::util::path::path_with_stem_suffix; +use crate::util::path::root_url_to_safe_local_dirname; /// Partitions the provided specifiers by the non-path and non-query parts of a specifier. pub fn partition_by_root_specifiers<'a>( @@ -30,7 +31,7 @@ pub fn partition_by_root_specifiers<'a>( /// Gets the directory name to use for the provided root. pub fn dir_name_for_root(root: &ModuleSpecifier) -> PathBuf { - fs_util::root_url_to_safe_local_dirname(root) + root_url_to_safe_local_dirname(root) } /// Gets a unique file path given the provided file path @@ -74,13 +75,7 @@ pub fn is_remote_specifier_text(text: &str) -> bool { pub fn sanitize_filepath(text: &str) -> String { text .chars() - .map(|c| { - if fs_util::is_banned_path_char(c) { - '_' - } else { - c - } - }) + .map(|c| if is_banned_path_char(c) { '_' } else { c }) .collect() } |