From ff785bc35aa650152643ffc65a2195e2b27f845b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 26 Sep 2020 16:33:25 +0200 Subject: refactor: use JsRuntime to implement TSC (#7691) This commits removes "CompilerWorker" in favor of using "JsRuntime". "cli/ops/compiler.rs" has been removed in favor of inline registration of ops in "cli/tsc.rs" --- cli/ops/compiler.rs | 32 -------------------------------- cli/ops/mod.rs | 1 - cli/ops/runtime_compiler.rs | 7 +------ 3 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 cli/ops/compiler.rs (limited to 'cli/ops') diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs deleted file mode 100644 index faf5fff32..000000000 --- a/cli/ops/compiler.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -use deno_core::serde_json::json; -use std::sync::Arc; -use std::sync::Mutex; - -pub fn init( - rt: &mut deno_core::JsRuntime, - response: Arc>>, -) { - let custom_assets = std::collections::HashMap::new(); - // TODO(ry) use None. - // TODO(bartlomieju): is this op even required? - rt.register_op( - "op_fetch_asset", - crate::op_fetch_asset::op_fetch_asset(custom_assets), - ); - - super::reg_json_sync( - rt, - "op_compiler_respond", - move |_state, args, _bufs| { - let mut response_slot = response.lock().unwrap(); - let replaced_value = response_slot.replace(args.to_string()); - assert!( - replaced_value.is_none(), - "op_compiler_respond found unexpected existing compiler output", - ); - Ok(json!({})) - }, - ); -} diff --git a/cli/ops/mod.rs b/cli/ops/mod.rs index ddc648be6..cbaa932aa 100644 --- a/cli/ops/mod.rs +++ b/cli/ops/mod.rs @@ -3,7 +3,6 @@ mod dispatch_minimal; pub use dispatch_minimal::MinimalOp; -pub mod compiler; pub mod errors; pub mod fetch; pub mod fs; diff --git a/cli/ops/runtime_compiler.rs b/cli/ops/runtime_compiler.rs index b51cda95b..91e638033 100644 --- a/cli/ops/runtime_compiler.rs +++ b/cli/ops/runtime_compiler.rs @@ -80,12 +80,7 @@ async fn op_transpile( cli_state.check_unstable("Deno.transpile"); let args: TranspileArgs = serde_json::from_value(args)?; let global_state = cli_state.clone(); - let permissions = { - let state = state.borrow(); - state.borrow::().clone() - }; let result = - runtime_transpile(&global_state, permissions, &args.sources, &args.options) - .await?; + runtime_transpile(global_state, &args.sources, &args.options).await?; Ok(result) } -- cgit v1.2.3