refactor: add RootConfig (#14985)

This commit is contained in:
David Sherret 2022-06-28 16:45:55 -04:00 committed by GitHub
parent 5b7bcefa11
commit 01adbb1efb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 917 additions and 819 deletions

View file

@ -1,8 +1,9 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use crate::colors;
use crate::emit::TypeLib;
use crate::emit::TsTypeLib;
use crate::errors::get_error_class_name;
use deno_core::error::custom_error;
use deno_core::error::AnyError;
use deno_core::ModuleSpecifier;
@ -43,7 +44,7 @@ pub enum ModuleEntry {
ts_check: bool,
/// A set of type libs that the module has passed a type check with this
/// session. This would consist of window, worker or both.
checked_libs: HashSet<TypeLib>,
checked_libs: HashSet<TsTypeLib>,
maybe_types: Option<Resolved>,
},
Configuration {
@ -385,7 +386,7 @@ impl GraphData {
pub fn set_type_checked(
&mut self,
roots: &[(ModuleSpecifier, ModuleKind)],
lib: &TypeLib,
lib: TsTypeLib,
) {
let specifiers: Vec<ModuleSpecifier> =
match self.walk(roots, true, true, true) {
@ -396,7 +397,7 @@ impl GraphData {
if let ModuleEntry::Module { checked_libs, .. } =
self.modules.get_mut(&specifier).unwrap()
{
checked_libs.insert(lib.clone());
checked_libs.insert(lib);
}
}
}
@ -405,7 +406,7 @@ impl GraphData {
pub fn is_type_checked(
&self,
roots: &[(ModuleSpecifier, ModuleKind)],
lib: &TypeLib,
lib: &TsTypeLib,
) -> bool {
roots.iter().all(|(r, _)| {
let found = self.follow_redirect(r);