summaryrefslogtreecommitdiff
path: root/cli/npm/cache.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/npm/cache.rs')
-rw-r--r--cli/npm/cache.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/cli/npm/cache.rs b/cli/npm/cache.rs
index 5e2f06ef7..ad6ab9db2 100644
--- a/cli/npm/cache.rs
+++ b/cli/npm/cache.rs
@@ -14,11 +14,13 @@ use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex;
use deno_core::url::Url;
+use crate::args::CacheSetting;
use crate::cache::DenoDir;
-use crate::file_fetcher::CacheSetting;
-use crate::fs_util;
use crate::http_util::HttpClient;
-use crate::progress_bar::ProgressBar;
+use crate::util::fs::canonicalize_path;
+use crate::util::fs::hard_link_dir_recursive;
+use crate::util::path::root_url_to_safe_local_dirname;
+use crate::util::progress_bar::ProgressBar;
use super::registry::NpmPackageVersionDistInfo;
use super::semver::NpmVersion;
@@ -162,7 +164,7 @@ impl ReadonlyNpmCache {
std::fs::create_dir_all(root_dir)
.with_context(|| format!("Error creating {}", root_dir.display()))?;
}
- Ok(crate::fs_util::canonicalize_path(root_dir)?)
+ Ok(canonicalize_path(root_dir)?)
}
// this may fail on readonly file systems, so just ignore if so
@@ -227,7 +229,7 @@ impl ReadonlyNpmCache {
pub fn registry_folder(&self, registry_url: &Url) -> PathBuf {
self
.root_dir
- .join(fs_util::root_url_to_safe_local_dirname(registry_url))
+ .join(root_url_to_safe_local_dirname(registry_url))
}
pub fn resolve_package_folder_id_from_specifier(
@@ -252,7 +254,7 @@ impl ReadonlyNpmCache {
.root_dir_url
.join(&format!(
"{}/",
- fs_util::root_url_to_safe_local_dirname(registry_url)
+ root_url_to_safe_local_dirname(registry_url)
.to_string_lossy()
.replace('\\', "/")
))
@@ -457,12 +459,7 @@ impl NpmCache {
with_folder_sync_lock(
(id.name.as_str(), &id.version),
&package_folder,
- || {
- fs_util::hard_link_dir_recursive(
- &original_package_folder,
- &package_folder,
- )
- },
+ || hard_link_dir_recursive(&original_package_folder, &package_folder),
)?;
Ok(())
}