summaryrefslogtreecommitdiff
path: root/ext/fs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-07-23 17:34:46 -0400
committerGitHub <noreply@github.com>2024-07-23 17:34:46 -0400
commit6055629ee7f48a4e887392ccac13788aa4008249 (patch)
tree453a06a5926a19814902ade6259ddc3631a1b181 /ext/fs
parentf0df54fc70ec1781a3ffec232fefc38cabf39c37 (diff)
refactor: update to use deno_package_json (#24688)
This is in preparation for extracting out node resolution code from ext/node (which is something I'm going to do gradually over time). Uses https://github.com/denoland/deno_package_json
Diffstat (limited to 'ext/fs')
-rw-r--r--ext/fs/Cargo.toml3
-rw-r--r--ext/fs/interface.rs58
-rw-r--r--ext/fs/lib.rs1
3 files changed, 1 insertions, 61 deletions
diff --git a/ext/fs/Cargo.toml b/ext/fs/Cargo.toml
index b5634a3a3..ad8d9683d 100644
--- a/ext/fs/Cargo.toml
+++ b/ext/fs/Cargo.toml
@@ -14,12 +14,11 @@ description = "Ops for interacting with the file system"
path = "lib.rs"
[features]
-sync_fs = ["deno_config/sync"]
+sync_fs = []
[dependencies]
async-trait.workspace = true
base32.workspace = true
-deno_config = { workspace = true, default-features = false }
deno_core.workspace = true
deno_io.workspace = true
deno_permissions.workspace = true
diff --git a/ext/fs/interface.rs b/ext/fs/interface.rs
index 09e16aff1..af4beb248 100644
--- a/ext/fs/interface.rs
+++ b/ext/fs/interface.rs
@@ -337,64 +337,6 @@ pub trait FileSystem: std::fmt::Debug + MaybeSend + MaybeSync {
}
}
-pub struct DenoConfigFsAdapter<'a>(&'a dyn FileSystem);
-
-impl<'a> DenoConfigFsAdapter<'a> {
- pub fn new(fs: &'a dyn FileSystem) -> Self {
- Self(fs)
- }
-}
-
-impl<'a> deno_config::fs::DenoConfigFs for DenoConfigFsAdapter<'a> {
- fn read_to_string_lossy(
- &self,
- path: &Path,
- ) -> Result<String, std::io::Error> {
- self
- .0
- .read_text_file_lossy_sync(path, None)
- .map_err(|err| err.into_io_error())
- }
-
- fn stat_sync(
- &self,
- path: &Path,
- ) -> Result<deno_config::fs::FsMetadata, std::io::Error> {
- self
- .0
- .stat_sync(path)
- .map(|stat| deno_config::fs::FsMetadata {
- is_file: stat.is_file,
- is_directory: stat.is_directory,
- is_symlink: stat.is_symlink,
- })
- .map_err(|err| err.into_io_error())
- }
-
- fn read_dir(
- &self,
- path: &Path,
- ) -> Result<Vec<deno_config::fs::FsDirEntry>, std::io::Error> {
- self
- .0
- .read_dir_sync(path)
- .map_err(|err| err.into_io_error())
- .map(|entries| {
- entries
- .into_iter()
- .map(|e| deno_config::fs::FsDirEntry {
- path: path.join(e.name),
- metadata: deno_config::fs::FsMetadata {
- is_file: e.is_file,
- is_directory: e.is_directory,
- is_symlink: e.is_symlink,
- },
- })
- .collect()
- })
- }
-}
-
// Like String::from_utf8_lossy but operates on owned values
#[inline(always)]
fn string_from_utf8_lossy(buf: Vec<u8>) -> String {
diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs
index a60408f9b..2dce04b32 100644
--- a/ext/fs/lib.rs
+++ b/ext/fs/lib.rs
@@ -9,7 +9,6 @@ pub mod sync;
pub use crate::in_memory_fs::InMemoryFs;
pub use crate::interface::AccessCheckCb;
pub use crate::interface::AccessCheckFn;
-pub use crate::interface::DenoConfigFsAdapter;
pub use crate::interface::FileSystem;
pub use crate::interface::FileSystemRc;
pub use crate::interface::FsDirEntry;