From 28aa489de9cd4f995ec2fc02e2c9d224e89f4c01 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 10 May 2023 20:06:59 -0400 Subject: feat(compile): unstable npm and node specifier support (#19005) This is the initial support for npm and node specifiers in `deno compile`. The npm packages are included in the binary and read from it via a virtual file system. This also supports the `--node-modules-dir` flag, dependencies specified in a package.json, and npm binary commands (ex. `deno compile --unstable npm:cowsay`) Closes #16632 --- ext/io/fs.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ext/io/fs.rs') diff --git a/ext/io/fs.rs b/ext/io/fs.rs index a333e1dd5..e335324f5 100644 --- a/ext/io/fs.rs +++ b/ext/io/fs.rs @@ -15,6 +15,7 @@ use deno_core::OpState; use deno_core::ResourceId; use tokio::task::JoinError; +#[derive(Debug)] pub enum FsError { Io(io::Error), FileBusy, @@ -29,6 +30,14 @@ impl FsError { Self::NotSupported => io::ErrorKind::Other, } } + + pub fn into_io_error(self) -> io::Error { + match self { + FsError::Io(err) => err, + FsError::FileBusy => io::Error::new(self.kind(), "file busy"), + FsError::NotSupported => io::Error::new(self.kind(), "not supported"), + } + } } impl From for FsError { -- cgit v1.2.3