Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/littledivy/deno_swc
The SWC compiler for Deno.
https://github.com/littledivy/deno_swc
ast bundler deno hacktoberfest javascript parser rust spack swc typescript
Last synced: 12 days ago
JSON representation
The SWC compiler for Deno.
- Host: GitHub
- URL: https://github.com/littledivy/deno_swc
- Owner: littledivy
- License: mit
- Created: 2020-07-18T09:55:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T13:55:12.000Z (over 1 year ago)
- Last Synced: 2024-10-23T07:52:16.155Z (21 days ago)
- Topics: ast, bundler, deno, hacktoberfest, javascript, parser, rust, spack, swc, typescript
- Language: JavaScript
- Homepage:
- Size: 26.1 MB
- Stars: 114
- Watchers: 6
- Forks: 16
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
deno_swc
The SWC compiler for Deno.
![ci](https://github.com/littledivy/deno_swc/workflows/ci/badge.svg)
![](https://img.shields.io/github/v/release/littledivy/deno_swc?style=plastic)# Usage
`parse()`
```typescript
import { parse, print } from "https://deno.land/x/[email protected]/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()`
```typescript
const { code } = print(ast, {
minify: true,
module: {
type: "commonjs",
},
});// const x = "Hello, Deno SWC!"
```...and `transform()`
```typescript
const { code } = transform("const x: number = 2;", {
jsc: {
target: "es2016",
parser: {
syntax: "typescript",
},
},
});// const x = 2;
```## Copyright
deno_swc is licensed under the MIT license. Please see the [LICENSE](LICENSE)
file.