import { Deno } from "https://deno.land/x/deno@v1.0.0/cli/js/lib.deno.unstable.d.ts";
const { compile } = Deno;
UNSTABLE: new API, yet to be vetted.
Takes a root module name, and optionally a record set of sources. Resolves with a compiled set of modules and possibly diagnostics if the compiler encountered any issues. If just a root name is provided, the modules will be resolved as if the root module had been passed on the command line.
If sources are passed, all modules will be resolved out of this object, where the key is the module name and the value is the content. The extension of the module name will be used to determine the media type of the module.
const [ maybeDiagnostics1, output1 ] = await Deno.compile("foo.ts");
const [ maybeDiagnostics2, output2 ] = await Deno.compile("/foo.ts", {
"/foo.ts": `export * from "./bar.ts";`,
"/bar.ts": `export const bar = "bar";`
});
Parameters
The root name of the module which will be used as the
"starting point". If no sources
is specified, Deno will
resolve the module externally as if the rootName
had been
specified on the command line.
An optional key/value map of sources to be used when resolving modules, where the key is the module name, and the value is the source content. The extension of the key will determine the media type of the file when processing. If supplied, Deno will not attempt to resolve any modules externally.
An optional object of options to send to the compiler. This is a subset of ts.CompilerOptions which can be supported by Deno.