diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-09-03 17:00:57 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-03 17:00:57 +1000 |
commit | 5f08d634f73fab21c17cc02f3f3bf8e8b531eee8 (patch) | |
tree | e105697d4ecb23cad491a04af878bc44edfa66a1 /cli/util/fs.rs | |
parent | 2533d68cabb5a38be891a9807c452ca802401d46 (diff) |
BREAKING: remove `deno vendor` (#25343)
Diffstat (limited to 'cli/util/fs.rs')
-rw-r--r-- | cli/util/fs.rs | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/cli/util/fs.rs b/cli/util/fs.rs index 145f9c83b..d723d24e1 100644 --- a/cli/util/fs.rs +++ b/cli/util/fs.rs @@ -1,6 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use std::env::current_dir; use std::fs::OpenOptions; use std::io::Error; use std::io::ErrorKind; @@ -18,7 +17,6 @@ use deno_config::glob::WalkEntry; use deno_core::anyhow::anyhow; use deno_core::anyhow::Context; use deno_core::error::AnyError; -pub use deno_core::normalize_path; use deno_core::unsync::spawn_blocking; use deno_core::ModuleSpecifier; use deno_runtime::deno_fs::FileSystem; @@ -255,18 +253,6 @@ fn canonicalize_path_maybe_not_exists_with_custom_fn( } } -pub fn resolve_from_cwd(path: &Path) -> Result<PathBuf, AnyError> { - let resolved_path = if path.is_absolute() { - path.to_owned() - } else { - let cwd = - current_dir().context("Failed to get current working directory")?; - cwd.join(path) - }; - - Ok(normalize_path(resolved_path)) -} - /// Collects module specifiers that satisfy the given predicate as a file path, by recursively walking `include`. /// Specifiers that start with http and https are left intact. /// Note: This ignores all .git and node_modules folders. @@ -715,6 +701,7 @@ pub fn specifier_from_file_path( mod tests { use super::*; use deno_core::futures; + use deno_core::normalize_path; use deno_core::parking_lot::Mutex; use pretty_assertions::assert_eq; use test_util::PathRef; @@ -722,24 +709,6 @@ mod tests { use tokio::sync::Notify; #[test] - fn resolve_from_cwd_child() { - let cwd = current_dir().unwrap(); - assert_eq!(resolve_from_cwd(Path::new("a")).unwrap(), cwd.join("a")); - } - - #[test] - fn resolve_from_cwd_dot() { - let cwd = current_dir().unwrap(); - assert_eq!(resolve_from_cwd(Path::new(".")).unwrap(), cwd); - } - - #[test] - fn resolve_from_cwd_parent() { - let cwd = current_dir().unwrap(); - assert_eq!(resolve_from_cwd(Path::new("a/..")).unwrap(), cwd); - } - - #[test] fn test_normalize_path() { assert_eq!(normalize_path(Path::new("a/../b")), PathBuf::from("b")); assert_eq!(normalize_path(Path::new("a/./b/")), PathBuf::from("a/b/")); @@ -757,14 +726,6 @@ mod tests { } #[test] - fn resolve_from_cwd_absolute() { - let expected = Path::new("a"); - let cwd = current_dir().unwrap(); - let absolute_expected = cwd.join(expected); - assert_eq!(resolve_from_cwd(expected).unwrap(), absolute_expected); - } - - #[test] fn test_collect_specifiers() { fn create_files(dir_path: &PathRef, files: &[&str]) { dir_path.create_dir_all(); |