From cf5a39a36127e8df70ac34b9895771fb41d474a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 5 May 2020 18:23:15 +0200 Subject: refactor(ts): remove op_cache (#5071) This PR removes op_cache and refactors how Deno interacts with TS compiler. Ultimate goal is to completely sandbox TS compiler worker; it should operate on simple request -> response basis. With this commit TS compiler no longer caches compiled sources as they are generated but rather collects all sources and sends them back to Rust when compilation is done. Additionally "Diagnostic" and its children got refactored to use "Deserialize" trait instead of manually implementing JSON deserialization. --- cli/ops/compiler.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'cli/ops/compiler.rs') diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs index c66b56d43..d93a0edf4 100644 --- a/cli/ops/compiler.rs +++ b/cli/ops/compiler.rs @@ -13,7 +13,6 @@ use deno_core::ZeroCopyBuf; use futures::future::FutureExt; pub fn init(i: &mut CoreIsolate, s: &State) { - i.register_op("op_cache", s.stateful_json_op(op_cache)); i.register_op("op_resolve_modules", s.stateful_json_op(op_resolve_modules)); i.register_op( "op_fetch_source_files", @@ -26,35 +25,6 @@ pub fn init(i: &mut CoreIsolate, s: &State) { ); } -#[derive(Deserialize)] -#[serde(rename_all = "camelCase")] -struct CacheArgs { - module_id: String, - contents: String, - extension: String, -} - -fn op_cache( - state: &State, - args: Value, - _zero_copy: Option, -) -> Result { - let args: CacheArgs = serde_json::from_value(args)?; - - let module_specifier = ModuleSpecifier::resolve_url(&args.module_id) - .expect("Should be valid module specifier"); - - let state_ = &state.borrow().global_state; - let ts_compiler = state_.ts_compiler.clone(); - ts_compiler.cache_compiler_output( - &module_specifier, - &args.extension, - &args.contents, - )?; - - Ok(JsonOp::Sync(json!({}))) -} - #[derive(Deserialize, Debug)] struct SpecifiersReferrerArgs { specifiers: Vec, -- cgit v1.2.3