summaryrefslogtreecommitdiff
path: root/cli/proc_state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/proc_state.rs')
-rw-r--r--cli/proc_state.rs44
1 files changed, 2 insertions, 42 deletions
diff --git a/cli/proc_state.rs b/cli/proc_state.rs
index 7d29cd89f..dc0072c4a 100644
--- a/cli/proc_state.rs
+++ b/cli/proc_state.rs
@@ -9,8 +9,6 @@ use crate::cache::EmitCache;
use crate::cache::FastInsecureHasher;
use crate::cache::ParsedSourceCache;
use crate::cache::TypeCheckCache;
-use crate::compat;
-use crate::compat::NodeEsmResolver;
use crate::deno_dir;
use crate::emit::emit_parsed_source;
use crate::emit::TsConfigType;
@@ -186,9 +184,6 @@ impl ProcState {
// FIXME(bartlomieju): `NodeEsmResolver` is not aware of JSX resolver
// created below
- let node_resolver = NodeEsmResolver::new(
- maybe_import_map.clone().map(ImportMapResolver::new),
- );
let maybe_import_map_resolver =
maybe_import_map.clone().map(ImportMapResolver::new);
let maybe_jsx_resolver = cli_options
@@ -196,9 +191,7 @@ impl ProcState {
.map(|cfg| JsxResolver::new(cfg, maybe_import_map_resolver.clone()));
let maybe_resolver: Option<
Arc<dyn deno_graph::source::Resolver + Send + Sync>,
- > = if cli_options.compat() {
- Some(Arc::new(node_resolver))
- } else if let Some(jsx_resolver) = maybe_jsx_resolver {
+ > = if let Some(jsx_resolver) = maybe_jsx_resolver {
// the JSX resolver offloads to the import map if present, otherwise uses
// the default Deno explicit import resolution.
Some(Arc::new(jsx_resolver))
@@ -286,7 +279,7 @@ impl ProcState {
// One might argue that this is a code smell, and I would agree. However
// due to flux in "Node compatibility" it's not clear where it should be
// decided what `ModuleKind` is decided for root specifier.
- let roots = roots
+ let roots: Vec<(deno_core::url::Url, deno_graph::ModuleKind)> = roots
.into_iter()
.map(|r| {
if let Some(resolver) = &maybe_resolver {
@@ -306,13 +299,6 @@ impl ProcState {
// TODO(bartlomieju): this is very make-shift, is there an existing API
// that we could include it like with "maybe_imports"?
- let roots = if self.options.compat() {
- let mut r = vec![(compat::GLOBAL_URL.clone(), ModuleKind::Esm)];
- r.extend(roots);
- r
- } else {
- roots
- };
if !reload_on_watch {
let graph_data = self.graph_data.read();
if self.options.type_check_mode() == TypeCheckMode::None
@@ -389,32 +375,6 @@ impl ProcState {
)
.await;
- let needs_cjs_esm_translation = graph
- .modules()
- .iter()
- .any(|m| m.kind == ModuleKind::CommonJs);
-
- if needs_cjs_esm_translation {
- for module in graph.modules() {
- // TODO(bartlomieju): this is overly simplistic heuristic, once we are
- // in compat mode, all files ending with plain `.js` extension are
- // considered CommonJs modules. Which leads to situation where valid
- // ESM modules with `.js` extension might undergo translation (it won't
- // work in this situation).
- if module.kind == ModuleKind::CommonJs {
- let translated_source = compat::translate_cjs_to_esm(
- &self.file_fetcher,
- &module.specifier,
- module.maybe_source.as_ref().unwrap().to_string(),
- module.media_type,
- )?;
- let mut graph_data = self.graph_data.write();
- graph_data
- .add_cjs_esm_translation(&module.specifier, translated_source);
- }
- }
- }
-
// If there was a locker, validate the integrity of all the modules in the
// locker.
graph_lock_or_exit(&graph);