From b6a3f8f722db89bc136e91da598f581c5838d38e Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Sun, 28 May 2023 19:44:41 +0100 Subject: refactor(core): remove ext: modules from the module map (#19040) Rather than disallowing `ext:` resolution, clear the module map after initializing extensions so extension modules are anonymized. This operation is explicitly called in `deno_runtime`. Re-inject `node:` specifiers into the module map after doing this. Fixes #17717. --- cli/lsp/diagnostics.rs | 2 +- cli/lsp/documents.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cli/lsp') diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs index a5e9d7bf8..6af6c92b3 100644 --- a/cli/lsp/diagnostics.rs +++ b/cli/lsp/diagnostics.rs @@ -1023,7 +1023,7 @@ fn diagnose_resolution( } } else if let Some(module_name) = specifier.as_str().strip_prefix("node:") { - if deno_node::resolve_builtin_node_module(module_name).is_err() { + if !deno_node::is_builtin_node_module(module_name) { diagnostics .push(DenoDiagnostic::InvalidNodeSpecifier(specifier.clone())); } else if let Some(npm_resolver) = &snapshot.maybe_npm_resolver { diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index 4bfb9342a..d088e01c0 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -1090,7 +1090,7 @@ impl Documents { } } if let Some(module_name) = specifier.strip_prefix("node:") { - if deno_node::resolve_builtin_node_module(module_name).is_ok() { + if deno_node::is_builtin_node_module(module_name) { // return itself for node: specifiers because during type checking // we resolve to the ambient modules in the @types/node package // rather than deno_std/node -- cgit v1.2.3