summaryrefslogtreecommitdiff
path: root/cli/resolver.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/resolver.rs')
-rw-r--r--cli/resolver.rs30
1 files changed, 18 insertions, 12 deletions
diff --git a/cli/resolver.rs b/cli/resolver.rs
index e1a2145d3..8043e1ede 100644
--- a/cli/resolver.rs
+++ b/cli/resolver.rs
@@ -41,6 +41,7 @@ use std::sync::Arc;
use crate::args::package_json::PackageJsonDeps;
use crate::args::JsxImportSourceConfig;
use crate::args::PackageJsonDepsProvider;
+use crate::args::DENO_DISABLE_PEDANTIC_NODE_WARNINGS;
use crate::colors;
use crate::node::CliNodeCodeTranslator;
use crate::npm::ByonmCliNpmResolver;
@@ -725,17 +726,20 @@ fn sloppy_imports_resolve(
};
// show a warning when this happens in order to drive
// the user towards correcting these specifiers
- log::warn!(
- "{} Sloppy module resolution {}\n at {}",
- crate::colors::yellow("Warning"),
- crate::colors::gray(format!("(hint: {})", hint_message)).to_string(),
- if referrer_range.end == deno_graph::Position::zeroed() {
- // not worth showing the range in this case
- crate::colors::cyan(referrer_range.specifier.as_str()).to_string()
- } else {
- format_range_with_colors(referrer_range)
- },
- );
+ if !*DENO_DISABLE_PEDANTIC_NODE_WARNINGS {
+ log::warn!(
+ "{} Sloppy module resolution {}\n at {}",
+ crate::colors::yellow("Warning"),
+ crate::colors::gray(format!("(hint: {})", hint_message)).to_string(),
+ if referrer_range.end == deno_graph::Position::zeroed() {
+ // not worth showing the range in this case
+ crate::colors::cyan(referrer_range.specifier.as_str()).to_string()
+ } else {
+ format_range_with_colors(referrer_range)
+ },
+ );
+ }
+
resolution.into_specifier().into_owned()
}
@@ -788,7 +792,9 @@ impl NpmResolver for CliGraphResolver {
} = range;
let line = start.line + 1;
let column = start.character + 1;
- log::warn!("Warning: Resolving \"{module_name}\" as \"node:{module_name}\" at {specifier}:{line}:{column}. If you want to use a built-in Node module, add a \"node:\" prefix.")
+ if !*DENO_DISABLE_PEDANTIC_NODE_WARNINGS {
+ log::warn!("Warning: Resolving \"{module_name}\" as \"node:{module_name}\" at {specifier}:{line}:{column}. If you want to use a built-in Node module, add a \"node:\" prefix.")
+ }
}
fn load_and_cache_npm_package_info(