diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-10-21 11:20:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-21 15:20:18 +0000 |
commit | bcfe279fba865763c87f9cd8d5a2d0b2cbf451be (patch) | |
tree | 68e4d1bc52e261df50279f9ecea14795d1c46f6c /cli/tools | |
parent | 0e1a71fec6fff5fe62d7e6b2bfffb7ab877d7b71 (diff) |
feat(unstable/npm): initial type checking of npm specifiers (#16332)
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/check.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cli/tools/check.rs b/cli/tools/check.rs index bb0b873f4..88c05e130 100644 --- a/cli/tools/check.rs +++ b/cli/tools/check.rs @@ -18,6 +18,7 @@ use crate::cache::TypeCheckCache; use crate::diagnostics::Diagnostics; use crate::graph_util::GraphData; use crate::graph_util::ModuleEntry; +use crate::npm::NpmPackageResolver; use crate::tsc; use crate::tsc::Stats; use crate::version; @@ -57,6 +58,7 @@ pub fn check( roots: &[(ModuleSpecifier, ModuleKind)], graph_data: Arc<RwLock<GraphData>>, cache: &TypeCheckCache, + npm_resolver: NpmPackageResolver, options: CheckOptions, ) -> Result<CheckResult, AnyError> { let check_js = options.ts_config.get_check_js(); @@ -106,6 +108,7 @@ pub fn check( graph_data, hash_data, maybe_config_specifier: options.maybe_config_specifier, + maybe_npm_resolver: Some(npm_resolver.clone()), maybe_tsbuildinfo, root_names, })?; @@ -114,6 +117,9 @@ pub fn check( response.diagnostics.filter(|d| { if let Some(file_name) = &d.file_name { !file_name.starts_with("http") + && ModuleSpecifier::parse(file_name) + .map(|specifier| !npm_resolver.in_npm_package(&specifier)) + .unwrap_or(true) } else { true } |