diff options
author | Luca Casonato <hello@lcas.dev> | 2023-04-12 15:13:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-12 15:13:32 +0200 |
commit | f90caa821c5a4acf28f7dec4071994ecf6f26e57 (patch) | |
tree | fa4af65399a16a9f2d17fa2b249f21be2c00b976 /runtime/build.rs | |
parent | 0e3f62d4446ae7b9a64dacf7befcaecede118222 (diff) |
refactor(ext/fs): abstract FS via FileSystem trait (#18599)
This commit abstracts out the specifics of the underlying system calls
FS operations behind a new `FileSystem` and `File` trait in the
`ext/fs` extension.
This allows other embedders to re-use ext/fs, but substituting in a
different FS backend.
This is likely not the final form of these traits. Eventually they will
be entirely `deno_core::Resource` agnostic, and will live in a seperate
crate.
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime/build.rs')
-rw-r--r-- | runtime/build.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/runtime/build.rs b/runtime/build.rs index eb8cc34a6..d47bee941 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -18,6 +18,7 @@ mod startup_snapshot { use deno_core::Extension; use deno_core::ExtensionFileSource; use deno_core::ModuleCode; + use deno_fs::StdFs; use std::path::Path; fn transpile_ts_for_snapshotting( @@ -164,6 +165,10 @@ mod startup_snapshot { unreachable!("snapshotting!") } + fn check_read_all(&mut self, _api_name: &str) -> Result<(), AnyError> { + unreachable!("snapshotting!") + } + fn check_read_blind( &mut self, _path: &Path, @@ -181,11 +186,16 @@ mod startup_snapshot { unreachable!("snapshotting!") } - fn check_read_all(&mut self, _api_name: &str) -> Result<(), AnyError> { + fn check_write_all(&mut self, _api_name: &str) -> Result<(), AnyError> { unreachable!("snapshotting!") } - fn check_write_all(&mut self, _api_name: &str) -> Result<(), AnyError> { + fn check_write_blind( + &mut self, + _path: &Path, + _display: &str, + _api_name: &str, + ) -> Result<(), AnyError> { unreachable!("snapshotting!") } } @@ -310,7 +320,7 @@ mod startup_snapshot { deno_napi::deno_napi::init_ops_and_esm::<Permissions>(), deno_http::deno_http::init_ops_and_esm(), deno_io::deno_io::init_ops_and_esm(Default::default()), - deno_fs::deno_fs::init_ops_and_esm::<Permissions>(false), + deno_fs::deno_fs::init_ops_and_esm::<_, Permissions>(false, StdFs), runtime::init_ops_and_esm(), // FIXME(bartlomieju): these extensions are specified last, because they // depend on `runtime`, even though it should be other way around |