/deno_swc

The SWC compiler for Deno.

Primary LanguageTypeScriptMIT LicenseMIT


deno_swc logo

deno_swc

The SWC compiler for Deno.

e2e-test dev-ci

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}

Copyright

deno_swc is licensed under the MIT license. Please see the LICENSE file.