summaryrefslogtreecommitdiff
path: root/cli/tsc/mod.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-03-11 11:43:45 -0500
committerGitHub <noreply@github.com>2023-03-11 11:43:45 -0500
commit8db853514caae431a0ce91360d854c1b7f3c405f (patch)
tree4173976ce6c836b715af22c9aeb9f336debb8544 /cli/tsc/mod.rs
parente4430400ced48529730a8752c547b613a23c76ce (diff)
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
Diffstat (limited to 'cli/tsc/mod.rs')
-rw-r--r--cli/tsc/mod.rs44
1 files changed, 1 insertions, 43 deletions
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<ModuleGraph>,
pub hash_data: Vec<Vec<u8>>,
- pub maybe_config_specifier: Option<ModuleSpecifier>,
pub maybe_npm_resolver: Option<NpmPackageResolver>,
pub maybe_tsbuildinfo: Option<String>,
/// 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<Vec<u8>>,
graph: Arc<ModuleGraph>,
- maybe_config_specifier: Option<ModuleSpecifier>,
maybe_tsbuildinfo: Option<String>,
maybe_response: Option<RespondArgs>,
maybe_npm_resolver: Option<NpmPackageResolver>,
@@ -386,7 +384,6 @@ impl State {
pub fn new(
graph: Arc<ModuleGraph>,
hash_data: Vec<Vec<u8>>,
- maybe_config_specifier: Option<ModuleSpecifier>,
maybe_npm_resolver: Option<NpmPackageResolver>,
maybe_tsbuildinfo: Option<String>,
root_map: HashMap<String, ModuleSpecifier>,
@@ -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<ModuleSpecifier, AnyError> {
- 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<Value, AnyError> {
Ok(json!({ "hash": hash }))
}
-#[op]
-fn op_cwd(s: &mut OpState) -> Result<String, AnyError> {
- let state = s.borrow_mut::<State>();
- 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 {
@@ -466,27 +450,6 @@ fn op_emit(state: &mut OpState, args: EmitArgs) -> bool {
}
#[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::<State>();
- 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.
specifier: String,
@@ -866,7 +829,6 @@ pub fn exec(request: Request) -> Result<Response, AnyError> {
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<Response, AnyError> {
fn get_tsc_ops() -> Vec<deno_core::OpDecl> {
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)],