diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-05-05 18:23:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 18:23:15 +0200 |
commit | cf5a39a36127e8df70ac34b9895771fb41d474a6 (patch) | |
tree | eb980f37b328902445ed5141b9c3c8a999ef84f7 /cli/js/ops/runtime_compiler.ts | |
parent | e574437922db0693e7be7a5df7c474f306e55f7b (diff) |
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.
Diffstat (limited to 'cli/js/ops/runtime_compiler.ts')
-rw-r--r-- | cli/js/ops/runtime_compiler.ts | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/cli/js/ops/runtime_compiler.ts b/cli/js/ops/runtime_compiler.ts index b46670ace..5a89983ee 100644 --- a/cli/js/ops/runtime_compiler.ts +++ b/cli/js/ops/runtime_compiler.ts @@ -1,6 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { sendAsync } from "./dispatch_json.ts"; +import { DiagnosticItem } from "../diagnostics.ts"; interface CompileRequest { rootName: string; @@ -9,7 +10,13 @@ interface CompileRequest { bundle: boolean; } -export function compile(request: CompileRequest): Promise<string> { +interface CompileResponse { + diagnostics: DiagnosticItem[]; + output?: string; + emitMap?: Record<string, Record<string, string>>; +} + +export function compile(request: CompileRequest): Promise<CompileResponse> { return sendAsync("op_compile", request); } @@ -18,6 +25,13 @@ interface TranspileRequest { options?: string; } -export function transpile(request: TranspileRequest): Promise<string> { +export interface TranspileOnlyResult { + source: string; + map?: string; +} + +export function transpile( + request: TranspileRequest +): Promise<Record<string, TranspileOnlyResult>> { return sendAsync("op_transpile", request); } |