summaryrefslogtreecommitdiff
path: root/cli/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/node.rs')
-rw-r--r--cli/node.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/cli/node.rs b/cli/node.rs
index 8235745a9..bc39cdbde 100644
--- a/cli/node.rs
+++ b/cli/node.rs
@@ -7,8 +7,6 @@ use deno_ast::MediaType;
use deno_ast::ModuleSpecifier;
use deno_core::error::AnyError;
use deno_graph::ParsedSourceStore;
-use deno_path_util::url_from_file_path;
-use deno_path_util::url_to_file_path;
use deno_runtime::deno_fs;
use deno_runtime::deno_node::DenoFsNodeResolverEnv;
use node_resolver::analyze::CjsAnalysis as ExtNodeCjsAnalysis;
@@ -22,7 +20,6 @@ use crate::cache::CacheDBHash;
use crate::cache::NodeAnalysisCache;
use crate::cache::ParsedSourceCache;
use crate::resolver::CjsTracker;
-use crate::util::fs::canonicalize_path_maybe_not_exists_with_fs;
pub type CliNodeCodeTranslator =
NodeCodeTranslator<CliCjsCodeAnalyzer, DenoFsNodeResolverEnv>;
@@ -37,13 +34,9 @@ pub fn resolve_specifier_into_node_modules(
specifier: &ModuleSpecifier,
fs: &dyn deno_fs::FileSystem,
) -> ModuleSpecifier {
- url_to_file_path(specifier)
- .ok()
- // this path might not exist at the time the graph is being created
- // because the node_modules folder might not yet exist
- .and_then(|path| canonicalize_path_maybe_not_exists_with_fs(&path, fs).ok())
- .and_then(|path| url_from_file_path(&path).ok())
- .unwrap_or_else(|| specifier.clone())
+ node_resolver::resolve_specifier_into_node_modules(specifier, &|path| {
+ fs.realpath_sync(path).map_err(|err| err.into_io_error())
+ })
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]