The SWC compiler for Deno.
Usage example code
import { parse, print } from "https://x.nest.land/swc@0.0.6/mod.ts";
const code = `const x: string = "Hello, Deno SWC!"`;
const ast = parse(code, {
target: "es2019",
syntax: "typescript",
comments: false,
});
const regeneratedCode = print(ast, {
minify: true,
module: {
type: "commonjs",
},
}).code;
// {
// type: "Module",
// span: { start: 0, end: 36, ctxt: 0 },
// body: [
// {
// type: "VariableDeclaration",
// span: [Object],
// kind: "const",
// declare: false,
// declarations: [Array]
// }
// ],
// interpreter: null
// }
// console.log(code);
// console.log(ast);
console.log(regeneratedCode);
// interface H{h:string;}const x:string=`Hello, ${"Hello"} Deno SWC!`;switch(x){case "value":console.log(x);break;default:break}
deno_swc is licensed under the MIT license. Please see the LICENSE file.