1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-14 16:33:45 -05:00
denoland-deno/cli/js/ops/runtime_compiler.ts

38 lines
875 B
TypeScript
Raw Normal View History

// 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;
sources?: Record<string, string>;
options?: string;
bundle: boolean;
}
interface CompileResponse {
diagnostics: DiagnosticItem[];
output?: string;
emitMap?: Record<string, Record<string, string>>;
}
export function compile(request: CompileRequest): Promise<CompileResponse> {
return sendAsync("op_compile", request);
}
interface TranspileRequest {
sources: Record<string, string>;
options?: string;
}
export interface TranspileOnlyResult {
source: string;
map?: string;
}
export function transpile(
request: TranspileRequest
): Promise<Record<string, TranspileOnlyResult>> {
return sendAsync("op_transpile", request);
}