forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ext/node): add NodeEnv::Fs associated type (denoland#18484)
This commit adds associated type to "NodeEnv" trait, called "Fs". The "Fs" type has a trait bound on "NodeFs", which specifies APIs required for all ops and resolution APIs to function. A "RealFs" implementation of "NodeFs" is exported from the "deno_node" crate, that provides a default implementation for the trait. All code in "deno_node" extension was changed to use the "NodeFs" trait to handle file system operations, instead of relying on APIs from the standard library.
- Loading branch information
1 parent
89bbbd1
commit 913e287
Showing
9 changed files
with
150 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
disallowed-methods = [ | ||
{ path = "std::env::current_dir", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::path::Path::exists", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::canonicalize", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::copy", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::create_dir", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::create_dir_all", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::hard_link", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::metadata", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::read", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::read_dir", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::read_link", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::read_to_string", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::remove_dir", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::remove_dir_all", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::remove_file", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::rename", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::set_permissions", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::symlink_metadata", reason = "File system operations should be done using NodeFs trait" }, | ||
{ path = "std::fs::write", reason = "File system operations should be done using NodeFs trait" }, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.