You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
skybldev 48481825b3 initial commit, pretty much done 10 months ago
..
.github/workflows initial commit, pretty much done 10 months ago
assets initial commit, pretty much done 10 months ago
examples initial commit, pretty much done 10 months ago
lib initial commit, pretty much done 10 months ago
swc_wasm initial commit, pretty much done 10 months ago
tests initial commit, pretty much done 10 months ago
.gitignore initial commit, pretty much done 10 months ago
.rustfmt.toml initial commit, pretty much done 10 months ago
Cargo.lock initial commit, pretty much done 10 months ago
Cargo.toml initial commit, pretty much done 10 months ago
LICENSE initial commit, pretty much done 10 months ago
README.md initial commit, pretty much done 10 months ago
compress.ts initial commit, pretty much done 10 months ago
deno.jsonc initial commit, pretty much done 10 months ago
mod.ts initial commit, pretty much done 10 months ago
version.ts initial commit, pretty much done 10 months ago

README.md


deno_swc logo

deno_swc

The SWC compiler for Deno.

ci

Usage

parse()

import { parse, print } from "https://deno.land/x/swc@0.2.1/mod.ts";

const code = `const x: string = "Hello, Deno SWC!"`;

const ast = parse(code, {
  target: "es2019",
  syntax: "typescript",
  comments: false,
});

// {
//   type: "Module",
//   span: { start: 0, end: 36, ctxt: 0 },
//   body: [
//     {
//       type: "VariableDeclaration",
//       span: [Object],
//       kind: "const",
//       declare: false,
//       declarations: [Array]
//     }
//   ],
//   interpreter: null
// }

print()

const { code } = print(ast, {
  minify: true,
  module: {
    type: "commonjs",
  },
});

// const x = "Hello, Deno SWC!"

...and transform()

const { code } = transform("const x: number = 2;", {
  jsc: {
    target: "es2016",
    parser: {
      syntax: "typescript",
    },
  },
});

// const x = 2;

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