Sebastian McKenzie 7da12213fe Merge pull request #4 from sindresorhus/patch-1
readme - add grunt task
2014-10-07 08:00:52 +11:00
2014-10-02 09:55:08 +10:00
2014-10-06 20:51:43 +11:00
2014-09-28 23:39:22 +10:00
2014-09-28 23:39:22 +10:00
2014-09-29 01:34:08 +10:00
2014-09-28 23:39:22 +10:00
2014-10-02 09:55:25 +10:00
2014-09-30 16:13:21 +10:00
2014-09-28 23:39:22 +10:00
2014-10-05 12:32:31 +11:00
2014-10-06 20:51:58 +11:00
2014-10-06 12:43:17 +02:00
2014-10-02 09:53:28 +10:00

6to5

Travis Status Code Climate Score Coverage Dependency Status

6to5 turns ES6 code into vanilla ES5, so you can use ES6 features today.

  • Fast - no redundant code added so your compiled code is as fast as possible.
  • Extensible - with a large range of plugins.
  • Lossless - source map support so you can debug your compiled code with ease.
  • Compact - maps directly to the equivalent ES5 with no runtime.
  • Concise - does not pollute scope with unneccesary variables.

Installation

$ npm install -g 6to5

Plugins

Community

Features

To be implemented:

Usage

CLI

Compile the file script.js and output it to script-compiled.js.

$ 6to5 script.js -o script-compiled.js

Compile the entire src directory and output it to the lib directory.

$ 6to5 src -d lib

Compile the file script.js and output it to stdout.

$ 6to5 script.js

Node

Launch a repl.

$ 6to5-node

Evaluate code.

$ 6to5-node -e "class Test { }"

Compile and run test.js.

$ 6to5-node test

Node

var to5 = require("6to5");

to5.transform("code();");

to5.transformFileSync("filename.js");

to5.transformFile("filename.js", function (err, data) {

});
Options
to5.transform("code();", {
  // List of transformers to EXCLUDE
  // This is a camelised version of the name found in `features`
  // eg. "Arrow functions" is "arrowFunctions"
  blacklist: [],

  // List of transformers to ONLY use.
  // See `blacklist` for naming scheme.
  whitelist: [],

  // Append source map and comment to bottom of returned output.
  sourceMap: false,

  // Returns an object `{ code: "", map: {} }` instead of an appended string.
  sourceMapObject: false,

  // Filename for use in errors etc.
  filename: "unknown",

  // Format options
  // See https://github.com/Constellation/escodegen/wiki/API for options.
  format: {}
});

Require hook

All subsequent files required by node will be transformed into ES5 compatible code.

require("6to5/register");

Caveats

For-of

Iterator/Symbol polyfill required.

Classes

Cannot subclass built-ins such as Date, Array, DOM etc.

Comparison to Traceur

Performance

The future

Implement own parser and generator that preserves whitespace and automatically works out generation rules based on code input.

Description
No description provided
Readme 79 MiB
Languages
JavaScript 99.5%
Makefile 0.3%
HTML 0.1%