swc/README.md
강동윤 1d0c78de6c
More works (#66)
ecma_transforms:
 - implement es2015::instanceof
 - implement es2015::typeof_symbol
 - implement inline_globals pass

ecma_parser:
 - `PResult<T>` is now `Result<T, ()>` and `Err(())` means that an error is emitted.
 - add docs
2018-11-18 14:00:07 +09:00

2.2 KiB

spdy web compiler

Build Status codecov


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 --cfg parallel_queries' cargo install --git https://github.com/swc-project/swc.git

Features

Transforms

New generation javascript to old-days javascript.

  • es3

    • member-expression-literals
    • property-literals
    • reserved-words
  • es5

    • property-mutators
  • 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

    • exponentiation-operator
  • es2017

    • async-to-generator
  • es2018

    • 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));

Contributing

See CONTRIBUTING.md. You may also find the architecture documentation useful (ARCHITECTURE.md).

License

swc is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.