From f0ec4fe1b89215ce9e62ebf47d8907dd6336f35e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 7 Mar 2024 13:59:57 +0000 Subject: fix(publish): silence warnings for sloppy imports and node builtins with env var (#22760) An undocumented "DENO_DISABLE_PEDANTIC_NODE_WARNINGS" env var can be used to silence warnings for sloppy imports and node builtins without `node:` prefix. --- cli/graph_util.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cli/graph_util.rs') diff --git a/cli/graph_util.rs b/cli/graph_util.rs index f1aa44328..b84cb3bb6 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -4,6 +4,7 @@ use crate::args::jsr_url; use crate::args::CliOptions; use crate::args::Lockfile; use crate::args::TsTypeLib; +use crate::args::DENO_DISABLE_PEDANTIC_NODE_WARNINGS; use crate::cache; use crate::cache::GlobalHttpCache; use crate::cache::ModuleInfoCache; @@ -681,9 +682,11 @@ pub fn enhanced_resolution_error_message(error: &ResolutionError) -> String { let mut message = format!("{error}"); if let Some(specifier) = get_resolution_error_bare_node_specifier(error) { - message.push_str(&format!( + if !*DENO_DISABLE_PEDANTIC_NODE_WARNINGS { + message.push_str(&format!( "\nIf you want to use a built-in Node module, add a \"node:\" prefix (ex. \"node:{specifier}\")." )); + } } message -- cgit v1.2.3