summaryrefslogtreecommitdiff
path: root/cli/compat/esm_resolver.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2021-11-24 16:55:10 +0100
committerGitHub <noreply@github.com>2021-11-24 16:55:10 +0100
commit1117d2db3965fc44f174be3fd029293b7e2b952e (patch)
tree3a50bffc376d1d86cfa09e726e500560f9f3c67c /cli/compat/esm_resolver.rs
parent1a51f2392db731fe0c1aa0ccd00da6769d254e66 (diff)
compat: support compat mode in REPL (#12882)
This commit introduces "ProcState::maybe_resolver" field, which stores a single instance of resolver for the whole lifetime of the process, instead of creating these resolvers for each creation of module graph. As a result, this resolver can be used in fallback case where graph is not constructed (REPL, loading modules using "require") unifying resolution logic.
Diffstat (limited to 'cli/compat/esm_resolver.rs')
-rw-r--r--cli/compat/esm_resolver.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/cli/compat/esm_resolver.rs b/cli/compat/esm_resolver.rs
index 980e44b32..5787c9e48 100644
--- a/cli/compat/esm_resolver.rs
+++ b/cli/compat/esm_resolver.rs
@@ -24,10 +24,6 @@ impl NodeEsmResolver {
maybe_import_map_resolver,
}
}
-
- pub fn as_resolver(&self) -> &dyn Resolver {
- self
- }
}
impl Resolver for NodeEsmResolver {
@@ -232,12 +228,12 @@ fn finalize_resolution(
};
if is_dir {
return Err(errors::err_unsupported_dir_import(
- &path.display().to_string(),
- &to_file_path_string(base),
+ resolved.as_str(),
+ base.as_str(),
));
} else if !is_file {
return Err(errors::err_module_not_found(
- &path.display().to_string(),
+ resolved.as_str(),
base.as_str(),
"module",
));