Skip to main content
function Deno.emit

UNSTABLE: new API, yet to be vetted.

Similar to the command line functionality of deno run or deno cache, Deno.emit() provides a way to provide Deno arbitrary JavaScript or TypeScript and have it return JavaScript based on the options and settings provided. The source code can either be provided or the modules can be fetched and resolved in line with the behavior of the command line.

Requires allow-read and/or allow-net if sources are not provided.


rootSpecifier: string | URL

The specifier that will be used as the entry point. If no sources are provided, then the specifier would be the same as if you typed it on the command line for deno run. If sources are provided, it should match one of the names of the sources.

options: EmitOptions

A set of options to be used with the emit.



The result of the emit. If diagnostics are found, they can be used with Deno.formatDiagnostics to construct a user friendly string, which has the same format as CLI diagnostics.