mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 21:54:36 +03:00
Rust-based platform for the Web
babelcompilerecmascriptecmascript-parserjavascriptparserruststarred-repostarred-swc-project-reposwctypescripttypescript-compilertypescript-parser
63ee25f0c5
- do not reexport swc crates - Add benchmark for parser 135ns/op on my macbook pro - remove unused script - Update README.md - Make features section complete |
||
---|---|---|
.cargo | ||
.vscode | ||
atoms | ||
common | ||
ecmascript | ||
libswc | ||
macros | ||
scripts | ||
src/bin | ||
testing | ||
.gitignore | ||
.gitmodules | ||
.rustfmt.toml | ||
.travis.yml | ||
bors.toml | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md | ||
rust-toolchain |
spdy web compiler
Make the web (development) faster.
swc is rust port of babel and closure compiler.
Installation
Requires nightly version of rust.
RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo install --git https://github.com/swc-project/swc.git
Features
Transforms
New generation javascript to old-days javascript.
-
es3
- member expression literals
- peroperty literals
- reserved words
-
es2015
- arrow-functions
- block-scoped-functions
- block-scoping
- classes
- computed-properties
- destructuring
- duplicate-keys
- for-of
- function-name
- instanceof
- literals
- new-target
- object-super
- parameters
- shorthand-properties
- spread
- sticky regex (
y
flag) - template-literals
- typeof-symbol
- unicode-regex
-
es2016
- operator
**
- operator
-
es2017
- async-to-generator
-
es2018
- parser
- async-generator-functions
- dotall-regex
- object-rest-spread
- optional-catch-binding
- unicode-property-regex
Usage
test.js
:
8 + 8;
use(8 + 8, 8 ** 8);
Example
swc jsc test.js
Output
8 + 8;
use(8 + 8, Math.pow(8, 8));
Example
swc jsc --optimize test.js
Output
use(8 + 8, Math.pow(8, 8));