diff options
Diffstat (limited to 'ext/node/lib.rs')
-rw-r--r-- | ext/node/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/node/lib.rs b/ext/node/lib.rs index 7a43fc4d4..cb395ad9a 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -83,7 +83,16 @@ pub trait NpmResolver: std::fmt::Debug + MaybeSend + MaybeSync { fn in_npm_package(&self, specifier: &ModuleSpecifier) -> bool; - fn in_npm_package_at_path(&self, path: &Path) -> bool { + fn in_npm_package_at_dir_path(&self, path: &Path) -> bool { + let specifier = + match ModuleSpecifier::from_directory_path(path.to_path_buf().clean()) { + Ok(p) => p, + Err(_) => return false, + }; + self.in_npm_package(&specifier) + } + + fn in_npm_package_at_file_path(&self, path: &Path) -> bool { let specifier = match ModuleSpecifier::from_file_path(path.to_path_buf().clean()) { Ok(p) => p, |