From 8db853514caae431a0ce91360d854c1b7f3c405f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 11 Mar 2023 11:43:45 -0500 Subject: fix(check): regression where config "types" entries caused type checking errors (#18124) Closes #18117 Closes #18121 (this is just over 10ms faster in a directory one up from the root folder) cc @nayeemrmn --- cli/tsc/mod.rs | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) (limited to 'cli/tsc/mod.rs') diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 188bc0533..fb9eeba0d 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -352,7 +352,6 @@ pub struct Request { pub debug: bool, pub graph: Arc, pub hash_data: Vec>, - pub maybe_config_specifier: Option, pub maybe_npm_resolver: Option, pub maybe_tsbuildinfo: Option, /// A vector of strings that represent the root/entry point modules for the @@ -374,7 +373,6 @@ pub struct Response { struct State { hash_data: Vec>, graph: Arc, - maybe_config_specifier: Option, maybe_tsbuildinfo: Option, maybe_response: Option, maybe_npm_resolver: Option, @@ -386,7 +384,6 @@ impl State { pub fn new( graph: Arc, hash_data: Vec>, - maybe_config_specifier: Option, maybe_npm_resolver: Option, maybe_tsbuildinfo: Option, root_map: HashMap, @@ -395,7 +392,6 @@ impl State { State { hash_data, graph, - maybe_config_specifier, maybe_npm_resolver, maybe_tsbuildinfo, maybe_response: None, @@ -406,8 +402,7 @@ impl State { } fn normalize_specifier(specifier: &str) -> Result { - resolve_url_or_path(&specifier.replace(".d.ts.d.ts", ".d.ts")) - .map_err(|err| err.into()) + resolve_url_or_path(specifier).map_err(|err| err.into()) } #[derive(Debug, Deserialize)] @@ -429,17 +424,6 @@ fn op_create_hash(s: &mut OpState, args: Value) -> Result { Ok(json!({ "hash": hash })) } -#[op] -fn op_cwd(s: &mut OpState) -> Result { - let state = s.borrow_mut::(); - if let Some(config_specifier) = &state.maybe_config_specifier { - let cwd = config_specifier.join("./")?; - Ok(cwd.to_string()) - } else { - Ok("cache:///".to_string()) - } -} - #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] struct EmitArgs { @@ -465,27 +449,6 @@ fn op_emit(state: &mut OpState, args: EmitArgs) -> bool { true } -#[derive(Debug, Deserialize)] -struct ExistsArgs { - /// The fully qualified specifier that should be loaded. - specifier: String, -} - -#[op] -fn op_exists(state: &mut OpState, args: ExistsArgs) -> bool { - let state = state.borrow_mut::(); - let graph = &state.graph; - if let Ok(specifier) = normalize_specifier(&args.specifier) { - if specifier.scheme() == "asset" || specifier.scheme() == "data" { - true - } else { - graph.get(&specifier).is_some() - } - } else { - false - } -} - #[derive(Debug, Deserialize)] struct LoadArgs { /// The fully qualified specifier that should be loaded. @@ -866,7 +829,6 @@ pub fn exec(request: Request) -> Result { state.put(State::new( request.graph.clone(), request.hash_data.clone(), - request.maybe_config_specifier.clone(), request.maybe_npm_resolver.clone(), request.maybe_tsbuildinfo.clone(), root_map.clone(), @@ -912,10 +874,8 @@ pub fn exec(request: Request) -> Result { fn get_tsc_ops() -> Vec { vec![ - op_cwd::decl(), op_create_hash::decl(), op_emit::decl(), - op_exists::decl(), op_is_node_file::decl(), op_load::decl(), op_resolve::decl(), @@ -982,7 +942,6 @@ mod tests { Arc::new(graph), hash_data, None, - None, maybe_tsbuildinfo, HashMap::new(), HashMap::new(), @@ -1024,7 +983,6 @@ mod tests { debug: false, graph: Arc::new(graph), hash_data, - maybe_config_specifier: None, maybe_npm_resolver: None, maybe_tsbuildinfo: None, root_names: vec![(specifier.clone(), MediaType::TypeScript)], -- cgit v1.2.3