Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/rad/src/tasks/build-buds/deb/3p.ts>emit

general purpose build tool. statically typed, batteries included. command, function, and make-style tasks supported. improved npm scripts for deno.
Go to Latest
namespace emit
import { emit } from "https://deno.land/x/rad@v6.10.0/src/tasks/build-buds/deb/3p.ts";

APIs to transpile and bundle JavaScript and TypeScript under Deno and Deno.

It is a user loadable module which provides an alternative to the removed unstable Deno.emit() API.

Example - Transpiling

import { emit } from "https://deno.land/x/emit/mod.ts";

const url = new URL("./testdata/mod.ts", import.meta.url);
const result = await emit(url.href);

const { code } = result;
console.log(code.includes("export default function hello()"));

Example - Bundling

import { bundle } from "https://deno.land/x/emit/mod.ts";
const result = await bundle(
  "https://deno.land/std@0.140.0/examples/chat/server.ts",
);

const { code } = result;
console.log(code);

Functions

Generate a single file JavaScript bundle of the root module and its dependencies.

Transpile TypeScript (or JavaScript) into JavaScript, returning a promise which resolves with a map of the emitted files.

Interfaces

The output of the bundle function.

Options which can be set when using the emit function.