From 8ee14bd56ac350d65256bdb17cc1e7434ff5b27f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 12 Jul 2024 12:48:53 -0400 Subject: [PATCH] refactor: move importMap with imports/scopes diagnostic to deno_config (#24553) --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- cli/args/mod.rs | 8 +------- tests/specs/import_map/import_map_config/config.out | 3 ++- tests/specs/workspaces/non_fatal_diagnostics/lint.out | 4 ++-- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d814a4c31b..527566539c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1308,9 +1308,9 @@ dependencies = [ [[package]] name = "deno_config" -version = "0.21.3" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13ad624cb26f547980ca481b1805c4b29d81c7631e791fe1b63f3cc697722722" +checksum = "866d351087e70f8db42d04a773b9a96444d2653ef4bb0fb104fe562b819a57c9" dependencies = [ "anyhow", "deno_semver", diff --git a/Cargo.toml b/Cargo.toml index b6ea178a4c..2a9c2b9e40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,7 +101,7 @@ console_static_text = "=0.8.1" data-encoding = "2.3.3" data-url = "=0.3.0" deno_cache_dir = "=0.10.0" -deno_config = { version = "=0.21.3", default-features = false } +deno_config = { version = "=0.22.0", default-features = false } dlopen2 = "0.6.1" ecb = "=0.1.2" elliptic-curve = { version = "0.13.4", features = ["alloc", "arithmetic", "ecdh", "std", "pem"] } diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 60cc97e2d8..a1c8efc318 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -887,7 +887,7 @@ impl CliOptions { }; for diagnostic in workspace.diagnostics() { - log::warn!("{}", colors::yellow(diagnostic)); + log::warn!("{} {}", colors::yellow("Warning"), diagnostic); } let root_folder = workspace.root_folder().1; @@ -1789,12 +1789,6 @@ fn resolve_import_map_specifier( format!("Bad URL (\"{import_map_path}\") for import map.") })?; Ok(Some(specifier)) - } else if let Some(config_file) = &maybe_config_file { - // if the config file is an import map we prefer to use it, over `importMap` field - if config_file.is_an_import_map() && config_file.json.import_map.is_some() { - log::warn!("{} \"importMap\" setting is ignored when \"imports\" or \"scopes\" are specified in the config file.", colors::yellow("Warning")); - } - Ok(None) } else { Ok(None) } diff --git a/tests/specs/import_map/import_map_config/config.out b/tests/specs/import_map/import_map_config/config.out index 72df124a26..c363360ac9 100644 --- a/tests/specs/import_map/import_map_config/config.out +++ b/tests/specs/import_map/import_map_config/config.out @@ -1,4 +1,5 @@ -Warning "importMap" setting is ignored when "imports" or "scopes" are specified in the config file. +Warning "importMap" field is ignored when "imports" or "scopes" are specified in the config file. + at file:///[WILDLINE]/import_map_config/config.json Hello from remapped moment! Hello from remapped moment dir! Hello from remapped lodash! diff --git a/tests/specs/workspaces/non_fatal_diagnostics/lint.out b/tests/specs/workspaces/non_fatal_diagnostics/lint.out index f2fbd1822b..864dc47ac4 100644 --- a/tests/specs/workspaces/non_fatal_diagnostics/lint.out +++ b/tests/specs/workspaces/non_fatal_diagnostics/lint.out @@ -1,5 +1,5 @@ -The "compilerOptions" field can only be specified in the root workspace deno.json file. +Warning "compilerOptions" field can only be specified in the workspace root deno.json file. at file:///[WILDLINE]/sub/deno.json -The "lint.report" field can only be specified in the root workspace deno.json file. +Warning "lint.report" field can only be specified in the workspace root deno.json file. at file:///[WILDLINE]/sub/deno.json Checked 1 file