diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-10-26 09:55:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 13:55:26 +0000 |
commit | 678ac5757b8283a2bb7bd0158f3c5273ea1e7eec (patch) | |
tree | 3a79b16ecc17267a9abdbbfe51891e8bf182f00c /cli/main.rs | |
parent | a0d10efbb1acffe203c42a4f6133ba5af0dcef18 (diff) |
fix(compile): show an error when using npm specifiers (#16430)
Closes #16427
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/main.rs b/cli/main.rs index 1fb942963..e9fbeba5b 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -76,6 +76,7 @@ use crate::tools::check; use args::CliOptions; use deno_ast::MediaType; +use deno_core::anyhow::bail; use deno_core::error::generic_error; use deno_core::error::AnyError; use deno_core::error::JsError; @@ -256,6 +257,21 @@ async fn compile_command( graph.valid().unwrap(); + // at the moment, we don't support npm specifiers in deno_compile, so show an error + let first_npm_specifier = graph + .specifiers() + .values() + .filter_map(|r| match r { + Ok((specifier, kind, _)) if *kind == deno_graph::ModuleKind::External => { + Some(specifier.clone()) + } + _ => None, + }) + .next(); + if let Some(npm_specifier) = first_npm_specifier { + bail!("npm specifiers have not yet been implemented for deno compile (https://github.com/denoland/deno/issues/15960). Found: {}", npm_specifier) + } + let parser = ps.parsed_source_cache.as_capturing_parser(); let eszip = eszip::EszipV2::from_graph(graph, &parser, Default::default())?; |