diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000..fbbbb71463
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "vendor/traceur"]
+ path = vendor/traceur
+ url = https://github.com/google/traceur-compiler
+[submodule "vendor/regenerator"]
+ path = vendor/regenerator
+ url = https://github.com/facebook/regenerator
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b3e4254a3e..dfd5d7723b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,63 @@
# Changelog
-Gaps between patch versions are faulty/broken releases.
+> **Tags:**
+> - [New Feature]
+> - [Bug Fix]
+> - [Spec Compliancy]
+> - [Breaking Change]
+> - [Documentation]
+> - [Internal]
+> - [Polish]
+
+_Note: Gaps between patch versions are faulty/broken releases._
+
+## 2.6.3
+
+ * **Bug Fix**
+ * Fix 2.6.0 regression caused by faulty export default from a source handling.
+
+## 2.6.2
+
+ * **Bug Fix**
+ * Fix rest parameter keys when on functions with params.
+
+## 2.6.1
+
+ * **Bug Fix**
+ * Fix rest parameter arguments key.
+
+## 2.6.0
+
+ * **Bug Fix**
+ * Better handling of number literal property keys.
+ * Handle `NewExpression` paren insertion edegcases better.
+ * **Internal**
+ * Fix incorrect AST node `identifier("this")`.
+ * Better `toIdentifier` method that handles reserved words.
+ * Upgrade `acorn-6to5`.
+ * Fix exponentiation operator precedence.
+ * Fix line terminators after async contextual keywords.
+ * Add semicolons as class elements inside of a class body.
+ * Upgrade to `core-js` 4.0.0.
+ * Upgrade to `regenerator` 0.8.3.
+ * Fix non-loop labeled statements.
+ * **New Feature**
+ * Basic destructuring defaults
+ * Add `.es` to list of supported extensions.
+ * Add optional `typeofSymbol` transformer.
+ * Use a `for` loop for rest parameters instead of `Array.prototype.slice`.
+ * **Polish**
+ * Move `"use strict";` to inside module bodies instead of at the top of the file.
+ * Better handling of dynamic imports.
+ * **Spec Compliancy**
+ * Class inheritance now has a `function` or `null` type check.
+ * Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
+
+## 2.5.0
+
+ * Remove `noDuplicateProperties` transformer.
+ * Better generated UIDs based on nodes.
+ * Default parameters now use `arguments[i]`, conditionals and variable declarations instead of using long-form if statements.
## 2.4.10
diff --git a/Makefile b/Makefile
index 797d3f41a6..b5101bbd91 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,23 @@ MOCHA_CMD = node_modules/mocha/bin/_mocha
export NODE_ENV = test
-.PHONY: clean test test-cov test-clean lint test-travis test-spec test-browser publish bench build
+.PHONY: clean test test-cov test-clean lint test-travis test-spec test-browser publish bench build bootstrap
+
+build:
+ mkdir -p dist
+
+ node bin/cache-templates
+
+ node $(BROWSERIFY_CMD) -e lib/6to5/polyfill.js >dist/polyfill.js
+ node $(UGLIFY_CMD) dist/polyfill.js >dist/polyfill.min.js
+
+ node $(BROWSERIFY_CMD) lib/6to5/browser.js -s to5 >dist/6to5.js
+ node $(UGLIFY_CMD) dist/6to5.js >dist/6to5.min.js
+
+ node bin/6to5-runtime >dist/runtime.js
+ node $(UGLIFY_CMD) dist/runtime.js >dist/runtime.min.js
+
+ rm -rf templates.json
clean:
rm -rf coverage templates.json test/tmp dist
@@ -45,22 +61,6 @@ test-browser:
test -n "`which open`" && open test/browser.html
-build:
- mkdir -p dist
-
- node bin/cache-templates
-
- node $(BROWSERIFY_CMD) -e lib/6to5/polyfill.js >dist/polyfill.js
- node $(UGLIFY_CMD) dist/polyfill.js >dist/polyfill.min.js
-
- node $(BROWSERIFY_CMD) lib/6to5/browser.js -s to5 >dist/6to5.js
- node $(UGLIFY_CMD) dist/6to5.js >dist/6to5.min.js
-
- node bin/6to5-runtime >dist/runtime.js
- node $(UGLIFY_CMD) dist/runtime.js >dist/runtime.min.js
-
- rm -rf templates.json
-
publish:
git pull --rebase
@@ -81,3 +81,8 @@ publish:
git push --follow-tags
rm -rf templates.json browser.js runtime.js browser-polyfill.js
+
+bootstrap:
+ npm install
+ git submodule update --init
+ cd vendor/regenerator; npm install
diff --git a/NOTES.md b/NOTES.md
new file mode 100644
index 0000000000..11962b3ca5
--- /dev/null
+++ b/NOTES.md
@@ -0,0 +1,8 @@
+# Notes
+
+ * Wildcard exports/imports wont normalise if `export default` is a non-object.
+
+## 3.0.0 breaking changes
+
+ * Remove `allowImportExportEverywhere` option from acorn.
+ * Remove this shorthand from playground.
diff --git a/doc/browser.md b/doc/browser.md
deleted file mode 100644
index 408ddd77d0..0000000000
--- a/doc/browser.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# Browser
-
-A browser version of 6to5 is available from `browser.js` inside the 6to5
-directory in an npm release.
-
-## Scripts
-
-While it's not recommended for serious use, when the browser version is included
-all scripts with the type `text/ecmascript-6` and `text/6to5` are automatically
-compiled and ran.
-
-For example:
-
-```html
-
-
-```
-
-## Build
-
-You can build a browser version of the compiler by running the following in the
-6to5 directory:
-
-```sh
-$ make build
-```
-
-This will output the files `dist/6to5.js` and `dist/6to5.min.js`.
-
-## Test
-
-To test 6to5 in your browser run:
-
-```sh
-$ make test-browser
-```
-
-And open `test/browser.html` in your browser if it doesn't open automatically.
-
-## API
-
-### to5.transform(code, [opts])
-
-See [options](usage.md#options) for additional documentation.
-
-```javascript
-to5.transform("class Test {}").code;
-```
-
-### to5.run(code, [opts])
-
-See [options](usage.md#options) for additional documentation.
-
-```javascript
-to5.run("class Test {}");
-```
diff --git a/doc/caveats.md b/doc/caveats.md
deleted file mode 100644
index 4e953bd9d1..0000000000
--- a/doc/caveats.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# Caveats
-
-In order for certain features to work they require certain polyfills. You can
-satisfy **all** 6to5 feature requirements by using the included
-[polyfill](polyfill.md).
-
-You may alternatively selectively include what you need:
-
-| Feature | Requirements |
-| --------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
-| Abstract References | [experimental](experimental.md), `Symbol` |
-| Array destructuring | `Array.from` |
-| Async functions, Generators | [experimental](experimental.md), [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js) |
-| Comprehensions | [experimental](experimental.md), `Array.from` |
-| For Of | `Symbol`, `prototype[Symbol.iterator]` |
-| Modules | `Object.assign`* |
-| Object spread/rest | [experimental](experimental.md), `Object.assign` |
-| Spread | `Array.from` |
-
-*Only required for exporting a non-function `default` with additional `export`s.
-
-## ES5
-
-Since 6to5 assumes that your code will be ran in an ES5 environment it uses ES5
-functions. So if you're using an environment that has limited or no support for
-ES5 such as lower versions of IE then using the
-[es5-shim](https://github.com/es-shims/es5-shim) along with the
-[6to5 polyfill](polyfill.md) will add support for these methods.
-
-## Internet Explorer
-
-### Classes (10 and below)
-
-If you're inheriting from a class then static properties are inherited from it
-via [\_\_proto\_\_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto),
-this is widely supported but you may run into problems with much older browsers.
-
-**NOTE:** `__proto__` is not supported in IE <= 10 so static properties
-**will not** be inherited. A possible workaround is to use `super();`:
-
-```javascript
-class Foo {
- static foo() {
-
- }
-}
-
-class Bar extends Foo {
- static foo() {
- super();
- }
-}
-```
-
-## Getters/setters (8 and below)
-
-In IE8 `Object.defineProperty` can only be used on DOM objects. This is
-unfortunate as it's required to set getters and setters. Due to this if
-you plan on supporting IE8 or below then the user of getters and setters
-isn't recommended.
-
-**Reference**: [MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#Internet_Explorer_8_specific_notes).
diff --git a/doc/differences.md b/doc/differences.md
deleted file mode 100644
index ff27c62378..0000000000
--- a/doc/differences.md
+++ /dev/null
@@ -1,137 +0,0 @@
-# Differences
-
-There are three main points that separate 6to5 from all other transpilers.
-
-### Readable code
-
-The fundamental concept behind 6to5 is that the generated code must be close as
-possible to the original, retaining all the same formatting and readability.
-
-Many other transpilers are just concerned with making the code work while 6to5
-is concerned with making sure it works **and** is readable at the same time.
-
-For example, given the following array comprehension:
-
-```javascript
-var seattlers = [for (c of customers) if (c.city == "Seattle") { name: c.name, age: c.age }];
-```
-
-is generated to the following with 6to5:
-
-```javascript
-var seattlers = Array.from(customers).filter(function (c) {
- return c.city == "Seattle";
-}).map(function (c) {
- return {
- name: c.name,
- age: c.age
- };
-});
-```
-
-The following is what Traceur generates:
-
-```javascript
-var seattlers = (function() {
- var c;
- var $__20 = 0,
- $__21 = [];
- for (var $__22 = customers[$traceurRuntime.toProperty(Symbol.iterator)](),
- $__23; !($__23 = $__22.next()).done; ) {
- c = $__23.value;
- if (c.city == "Seattle")
- $traceurRuntime.setProperty($__21, $__20++, {
- name: c.name,
- age: c.age
- });
- }
- return $__21;
-}());
-```
-
-As you can tell, it's not very pretty. Instead of mapping directly to a
-runtime, like other transpilers, 6to5 maps directly to the equivalent ES5.
-
-Sometimes there are little inline functions that 6to5 needs. These are
-placed at the top of your file much like coffee-script does. If these
-bother you then you can use the [optional runtime](optional-runtime.md).
-We promise that these inline functions will never be significant and will
-always be used as little as possible.
-
-### Static analysis
-
-6to5 uses a lot of static analysis to simplify code as much as possible.
-Not many other transpilers do this, and those that do don't do it nearly
-as much as 6to5. This process is pretty intensive but it leads to higher
-quality code.
-
-### Spec compliancy
-
-6to5 prides itself on
-[spec compliancy](https://kangax.github.io/compat-table/es6/). We have
-excellent support for edgecases, something that many other transpilers
-suffer from, including Traceur. When you use 6to5 you can be confident
-that when you turn it off and use your code in a full ES6 environment
-**it'll just work**.
-
-## Comparison to other transpilers
-
-### Features
-
-| | 6to5 | Traceur | es6-transpiler | esnext | es6now | jstransform |
-| ---------------------------- | ---- | ------- | -------------- | ------ | ------ | ----------- |
-| Source maps | ✓ | ✓ | ✓ | ✓ | | ✓ |
-| No compiler global pollution | ✓ | | ✓ | ✓ | | ✓ |
-| Optional runtime | ✓ | | ✓ | | | ✓ |
-| Browser compiler | ✓ | ✓ | | ✓ | | |
-
-### Language Support
-
-| | 6to5 | Traceur | es6-transpiler | esnext | es6now | jstransform |
-| ---------------------------- | ---- | ------- | -------------- | ------ | ------ | ----------- |
-| Abstract references | ✓ | | | | | |
-| Array comprehension | ✓ | ✓ | ✓ | | | |
-| Arrow functions | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| Async functions | ✓ | ✓ | | ✓ | | |
-| Async generator functions | ✓ | ✓ | | | | |
-| Classes | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| Computed property names | ✓ | ✓ | ✓ | ✓ | ✓ | |
-| Constants | ✓ | ✓ | ✓ | | | |
-| Default parameters | ✓ | ✓ | ✓ | ✓ | ✓ | |
-| Destructuring | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| Exponentiation operator | ✓ | ✓ | | | | |
-| Flow types | ✓ | | | | | ✓ |
-| For-of | ✓ | ✓ | ✓ | ✓ | ✓ | |
-| Generators | ✓ | ✓ | | ✓ | | |
-| Generator comprehension | ✓ | ✓ | | | | |
-| JSX | ✓ | | | | | |
-| Let scoping | ✓ | ✓ | ✓ | | | |
-| Modules | ✓ | ✓ | | | ✓ | |
-| Object rest/spread | ✓ | | | | | ✓ |
-| Property method assignment | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| Property name shorthand | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| Rest parameters | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| React | ✓ | | | | | |
-| Spread | ✓ | ✓ | ✓ | ✓ | ✓ | |
-| Template literals | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| Unicode regex | ✓ | ✓ | ✓ | | | |
-
-### [Traceur](https://github.com/google/traceur-compiler)
-
-Traceur requires quite a bulky runtime (~75KB) and produces quite verbose code.
-While this can be trimmed down by selectively building the runtime, it's an
-unnecessary step when a large runtime can be eliminated entirely.
-
-### [es6now](https://github.com/zenparsing/es6now)
-
-es6now doesn't output sourcemaps. This is cited as a positive as line-to-line
-mapping is the goal. This however obviously doesn't retain column mapping
-resulting in the output code not being very pleasant.
-
-### [es6-transpiler](https://github.com/termi/es6-transpiler)
-
-The es6-transpiler compiler requires shims to operate which pollutes the global
-scope resulting in possible collisions.
-
-es6-transpiler maps line-by-line, just like es6now, this results in the same
-issues such as lack of column information and unpleasant code output.
diff --git a/doc/experimental.md b/doc/experimental.md
deleted file mode 100644
index 3546d0cb82..0000000000
--- a/doc/experimental.md
+++ /dev/null
@@ -1,8 +0,0 @@
-## Experimental
-
-6to5 also has experimental support for ES7 proposals. You can enable this with
-the `experimental: true` option when using the [Node API](#node) or
-`--experimental` when using the [CLI](#cli).
-
-**WARNING:** These proposals are subject to change so use with
-**extreme caution**.
diff --git a/doc/features.md b/doc/features.md
deleted file mode 100644
index a5c55fda81..0000000000
--- a/doc/features.md
+++ /dev/null
@@ -1,283 +0,0 @@
-# Features
-
-## Abstract references ([experimental](experimental.md)) ([spec](https://github.com/zenparsing/es-abstract-refs))
-
-```javascript
-foo::bar;
-foo::bar = baz;
-delete foo::bar;
-```
-
-## Array comprehensions ([experimental](experimental.md))
-
-```javascript
-var results = [for (c of customers) if (c.city == "Seattle") { name: c.name, age: c.age }]
-```
-
-## Arrow functions
-
-```javascript
-// Expression bodies
-var odds = evens.map(v => v + 1);
-var nums = evens.map((v, i) => v + i);
-
-// Statement bodies
-nums.forEach(v => {
- if (v % 5 === 0)
- fives.push(v);
-});
-
-// Lexical this
-var bob = {
- _name: "Bob",
- _friends: [],
- printFriends() {
- this._friends.forEach(f => {
- console.log(this._name + " knows " + f);
- });
- }
-};
-```
-
-## Async functions ([experimental](experimental.md)) ([spec](https://github.com/lukehoban/ecmascript-asyncawait))
-
-```javascript
-async function chainAnimationsAsync(elem, animations) {
- for (var anim of animations) {
- await anim(elem);
- }
-}
-```
-
-## Async generator functions ([experimental](experimental.md)) ([spec](https://github.com/jhusain/asyncgenerator))
-
-```javascript
-
-```
-
-## Classes
-
-```javascript
-class SkinnedMesh extends THREE.Mesh {
- constructor(geometry, materials) {
- super(geometry, materials);
-
- this.idMatrix = SkinnedMesh.defaultMatrix();
- this.bones = [];
- this.boneMatrices = [];
- //...
- }
-
- update(camera) {
- //...
- super.update();
- }
-
- static defaultMatrix() {
- return new THREE.Matrix4();
- }
-}
-```
-
-## Computed property names
-
-```javascript
-var foo = "foo";
-var bar = "bar";
-var obj = {
- ["foo" + bar]: "heh",
- ["bar" + foo]: "noo",
- foo: "foo",
- bar: "bar"
-};
-```
-
-## Constants
-
-```javascript
-const MULTIPLIER = 5;
-console.log(2 * MULTIPLIER);
-
-MULTIPLIER = 6; // error
-var MULTIPLIER; // error
-```
-
-## Default parameters
-
-```javascript
-function f(x, y = 12) {
- // y is 12 if not passed (or passed as undefined)
- return x + y;
-}
-f(3) == 15
-```
-
-## Destructuring
-
-```javascript
-// list matching
-var [a, , b] = [1,2,3];
-
-// object matching
-var { op: a, lhs: { op: b }, rhs: c } = getASTNode();
-
-// object matching shorthand
-// binds `op`, `lhs` and `rhs` in scope
-var { op, lhs, rhs } = getASTNode();
-
-// Can be used in parameter position
-function g({ name: x }) {
- console.log(x);
-}
-g({ name: 5 });
-
-// Fail-soft destructuring
-var [a] = [];
-a === undefined;
-```
-
-## Exponentiation operator ([experimental](experimental.md)) ([spec](https://github.com/rwaldron/exponentiation-operator))
-
-```javascript
-var a = 2;
-a **= 2;
-
-var squared = 2 ** 2;
-```
-
-## For-of
-
-```javascript
-for (var i of [1, 2, 3]) {
- console.log(i * i);
-}
-```
-
-## Generators
-
-```javascript
-function* fibonacci() {
- var pre = 0, cur = 1;
- for (;;) {
- var temp = pre;
- pre = cur;
- cur += temp;
- yield cur;
- }
-}
-
-for (var n of fibonacci()) {
- // truncate the sequence at 1000
- if (n > 1000) break;
- console.log(n);
-}
-```
-
-## Generator comprehensions ([experimental](experimental.md))
-
-```javascript
-var nums = [1, 2, 3, 4, 5, 6];
-var multiples = (for (i of nums) if (i % 2) i * i);
-assert.equal(multiples.next().value, 1);
-assert.equal(multiples.next().value, 9);
-assert.equal(multiples.next().value, 25);
-```
-
-## Let scoping
-
-```javascript
-for (let i in arr) {
- let v = arr[i];
-}
-```
-
-## Modules
-
-```javascript
-import "foo";
-import foo from "foo";
-import * as foo from "foo";
-import {bar} from "foo";
-import {foo as bar} from "foo";
-
-export { test };
-export var test = 5;
-export function test() {}
-
-export default test;
-```
-
-## Numeric literals
-
-```javascript
-0b111110111 === 503; // true
-0o767 === 503; // true
-```
-
-## Object spread/rest ([experimental](experimental.md)) ([spec](https://github.com/sebmarkbage/ecmascript-rest-spread))
-
-```javascript
-var n = { x, y, ...z };
-var { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
-```
-
-## Property method assignment
-
-```javascript
-var obj = {
- foo() {
- return "foobar";
- },
-
- get bar() {
- return this._bar;
- },
-
- set bar(val) {
- this._bar = val;
- }
-};
-```
-
-## Property name shorthand
-
-```javascript
-function f(x, y) {
- return { x, y };
-}
-```
-
-## Rest parameters
-
-```javascript
-function f(x, ...y) {
- // y is an Array
- return x * y.length;
-}
-f(3, "hello", true) == 6
-```
-
-## Spread
-
-```javascript
-function f(x, y, z) {
- return x + y + z;
-}
-// Pass each elem of array as argument
-f(...[1,2,3]) == 6
-```
-
-## Template literals
-
-```javascript
-var x = 5;
-var y = 10;
-console.log(`${x} + ${y} = ${x + y}`); // "5 + 10 = 15"
-```
-## Unicode regex
-
-```javascript
-var string = 'foo💩bar';
-var match = string.match(/foo(.)bar/u);
-console.log(match[1]);
-```
diff --git a/doc/index.md b/doc/index.md
index d37e7d8eaf..160f97e74d 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -1,62 +1 @@
-**6to5** turns ES6+ code into vanilla ES5, so you can use next generation features **today.**
-
- - **Readable** - formatting is retained if possible so your generated code is as similar as possible.
- - **Extensible** - with a large range of [plugins](plugins.md) and **browser support**.
- - **Lossless** - **source map support** so you can debug your compiled code with ease.
- - **Compact** - maps directly to the equivalent ES5 with **no runtime**[\*](caveats.md).
-
-## Installation
-
-It's as easy as:
-
- $ npm install -g 6to5
-
-## Usage
-
-Once you've installed 6to5, there are multiple paths you can take depending on
-how you want to use it.
-
-6to5 will simply compile your ES6+ script to ES5 if you pass it as an argument
-to the command-line tool `6to5`:
-
-```sh
-$ 6to5 script.js
-```
-
-If you have a file written using ES6+ and you just want to run it, `6to5-node`
-has you covered:
-
-```sh
-$ 6to5-node script.js
-```
-
-And it doesn't end here! To see all the ways you can use 6to5, check out the
-[Usage](http://6to5.github.io/usage.html) page.
-
-## [Features](features.md)
-
- - [Abstract references](features.md#abstract-references) ([experimental](experimental.md))
- - [Array comprehension](features.md#array-comprehension) ([experimental](experimental.md))
- - [Async functions](features.md#async-functions) ([experimental](experimental.md))
- - [Async generator functions](features.md#async-generator-functions) ([experimental](experimental.md))
- - [Arrow functions](features.md#arrow-functions)
- - [Classes](features.md#classes)
- - [Computed property names](features.md#computed-property-names)
- - [Constants](features.md#constants)
- - [Default parameters](features.md#default-parameters)
- - [Destructuring](features.md#destructuring)
- - [Exponentiation operator](features.md#exponentiation-operator) ([experimental](experimental.md))
- - [For-of](features.md#for-of)
- - [Generators](features.md#generators)
- - [Generator comprehension](features.md#generator-comprehension) ([experimental](experimental.md))
- - [Let scoping](features.md#let-scoping)
- - [Modules](features.md#modules)
- - [Numeric literals](features.md#numeric-literals)
- - [Object rest/spread](features.md#object-rest-spread) ([experimental](experimental.md))
- - [Property method assignment](features.md#property-method-assignment)
- - [Property name shorthand](features.md#property-name-shorthand)
- - [React/JSX](react.md)
- - [Rest parameters](features.md#rest-parameters)
- - [Spread](features.md#spread)
- - [Template literals](features.md#template-literals)
- - [Unicode regex](features.md#unicode-regex)
+See [6to5.github.io/docs](https://github.com/6to5/6to5.github.io/tree/master/docs).
diff --git a/doc/modules.md b/doc/modules.md
deleted file mode 100644
index f58c68416f..0000000000
--- a/doc/modules.md
+++ /dev/null
@@ -1,257 +0,0 @@
-# Modules
-
-## Usage
-
-### CLI
-
-```sh
-$ 6to5 --modules common script.js
-```
-
-### Node
-
-```javascript
-var to5 = require("6to5");
-to5.transform('import "foo";', { modules: "common" });
-```
-
-## Formats
-
- * [AMD](#amd)
- * [Common (Default)](#common-default)
- * [Ignore](#ignore)
- * [System](#system)
- * [UMD](#umd)
-
-### Common
-
-```sh
-$ 6to5 --modules common
-```
-
-**In**
-
-```javascript
-export default test;
-
-export {test};
-export var test = 5;
-
-import "foo";
-
-import foo from "foo";
-import * as foo from "foo";
-
-import {bar} from "foo";
-import {foo as bar} from "foo";
-```
-
-**Out**
-
-```javascript
-"use strict";
-
-var _interopRequire = function (obj) {
- return obj && (obj["default"] || obj);
-};
-
-exports = module.exports = test;
-
-exports.test = test;
-var test = exports.test = 5;
-
-require("foo");
-
-var foo = _interopRequire(require("foo"));
-
-var foo = require("foo");
-
-var bar = require("foo").bar;
-var bar = require("foo").foo;
-```
-
-### AMD
-
-```sh
-$ 6to5 --modules amd
-```
-
-**In**
-
-```javascript
-import foo from "foo";
-
-export function bar() {
- return foo("foobar");
-}
-```
-
-**Out**
-
-```javascript
-define(["exports", "foo"], function (exports, _foo) {
- "use strict";
-
- var _interopRequire = function (obj) {
- return obj && (obj["default"] || obj);
- };
-
- exports.bar = bar;
- var foo = _interopRequire(_foo);
-
- function bar() {
- return foo("foobar");
- }
-});
-```
-
-You can optionally specify to include the module id (using the `--amd-module-id` argument):
-
-```javascript
-define("filename", ["exports", "foo"], function (exports, _foo) {})
-```
-
-### UMD
-
-```sh
-$ 6to5 --modules umd
-```
-
-**In**
-
-```javascript
-import foo from "foo";
-
-export function bar() {
- return foo("foobar");
-}
-```
-
-**Out**
-
-```javascript
-(function (factory) {
- if (typeof define === "function" && define.amd) {
- define(["exports", "foo"], factory);
- } else if (typeof exports !== "undefined") {
- factory(exports, require("foo"));
- }
-})(function (exports, _foo) {
- "use strict";
-
- var _interopRequire = function (obj) {
- return obj && (obj["default"] || obj);
- };
-
- exports.bar = bar;
- var foo = _interopRequire(_foo);
-
- function bar() {
- return foo("foobar");
- }
-});
-```
-
-### Ignore
-
-```sh
-$ 6to5 --modules ignore
-```
-
-**In**
-
-```javascript
-import foo from "foo";
-
-export function bar() {
- return foo("foobar");
-}
-```
-
-**Out**
-
-```javascript
-function bar() {
- return foo("foobar");
-}
-```
-
-### System
-
-```sh
-$ 6to5 --modules system
-```
-
-**In**
-
-```javascript
-import foo from "foo";
-
-export function bar() {
- return foo("foobar");
-}
-```
-
-**Out**
-
-```javascript
-System.register("bar", ["foo"], function (_export) {
- "use strict";
-
- var __moduleName = "bar";
-
- var foo;
- function bar() {
- return foo("foobar");
- }
- return {
- setters: [function (m) {
- foo = m.default;
- }],
- execute: function () {
- _export("bar", bar);
- }
- };
-});
-```
-
-## Custom
-
-You can alternatively specify module names instead of one of the built-in types.
-
-```sh
-$ 6to5 --modules custom-module-formatter
-```
-
-**node_modules/custom-module-formatter/index.js**
-
-```javascript
-module.exports = ModuleFormatter;
-
-function ModuleFormatter() {
-
-}
-
-ModuleFormatter.prototype.transform = function (ast) {
- // this is ran after all transformers have had their turn at modifying the ast
- // feel free to modify this however
-};
-
-ModuleFormatter.prototype.importDeclaration = function (node, nodes) {
- // node is an ImportDeclaration
-};
-
-ModuleFormatter.prototype.importSpecifier = function (specifier, node, nodes) {
- // specifier is an ImportSpecifier
- // node is an ImportDeclaration
-};
-
-ModuleFormatter.prototype.exportDeclaration = function (node, nodes) {
- // node is an ExportDeclaration
-};
-
-ModuleFormatter.prototype.exportSpecifier = function (specifier, node, nodes) {
- // specifier is an ExportSpecifier
- // node is an ExportDeclaration
-};
-```
diff --git a/doc/optional-runtime.md b/doc/optional-runtime.md
deleted file mode 100644
index ee00e657b9..0000000000
--- a/doc/optional-runtime.md
+++ /dev/null
@@ -1,57 +0,0 @@
-# Optional runtime
-
-6to5 has a few helper functions that'll be placed at the top of the generated
-code if needed so it's not inlined multiple times throughout that file. This may
-become an issue if you have multiple files, especially when you're sending them
-to the browser. gzip alleviates most of this concern but it's still not ideal.
-
-You can tell 6to5 to not place any declarations at the top of your files and
-instead just point them to a reference contained within the runtime.
-
-Simply use the following option if you're using the [Node API](usage.md#node):
-
-```javascript
-{
- runtime: true
-}
-```
-
-or the following flag if you're using the [CLI](usage.md#cli):
-
-```ssh
-$ 6to5 --runtime
-```
-
-Then just include the runtime before your generated code.
-
-## Getting the runtime
-
-You can get the runtime via either:
-
-```sh
-$ 6to5-runtime
-```
-
-or
-
-```javascript
-require("6to5").runtime();
-```
-
-or from an npm release in `runtime.js` from the 6to5 directory.
-
-## Customising namespace
-
-You can also customise the runtime namespace by passing an optional namespace
-argument:
-
-```javascript
-require("6to5").runtime("myCustomNamespace");
-```
-
-```sh
-$ 6to5-runtime myCustomNamespace
-```
-
-See [Options - runtime](usage.md#options) for documentation on changing the
-reference in generated code.
diff --git a/doc/playground.md b/doc/playground.md
deleted file mode 100644
index 985bc5409d..0000000000
--- a/doc/playground.md
+++ /dev/null
@@ -1,140 +0,0 @@
-# Playground
-
-Playground is a proving ground for **possible** ES7 proposals.
-
-**NOTE: These features are in no way endorsed by Ecma International and are not a part of ES6. They might become a part of ECMAScript in the future.**
-
-## Usage
-
- $ 6to5 --playground
-
-```javascript
-to5.transform("code", { playground: true });
-```
-
-**NOTE:** Enabling `playground` also enables [experimental support](experimental.md).
-
-## Features
-
- * [Memoization operator](#memoization-operator)
- * [Method binding](#method-binding)
- * [Method binding function shorthand](#method-binding-function-shorthand)
- * [Object getter memoization](#object-getter-memoization)
- * [This shorthand](#this-shorthand)
-
-### Memoization assignment operator
-
-The memoization assignment operator allows you to lazily set an object property.
-It checks whether there's a property defined on the object and if there isn't then
-the right hand value is set.
-
-This means that `obj.x` in the following `var x = { x: undefined }; obj.x ?= 2;`
-will still be `undefined` because it's already been defined on the object.
-
-```javascript
-var obj = {};
-obj.x ?= 2;
-obj.x; // 2
-
-obj = { x: 1 };
-obj.x ?= 2;
-obj.x; // 1
-
-obj = { x: undefined }
-obj.x ?= 2;
-obj.x; // undefined
-```
-
-```javascript
-var obj = {};
-obj.x ?= 2;
-```
-
-equivalent to
-
-```javascript
-var obj = {};
-if (!Object.prototype.hasOwnProperty.call(obj, "x")) obj.x = 2;
-```
-
-### Method binding
-
-```javascript
-var fn = obj#method;
-var fn = obj#method("foob");
-```
-
-equivalent to
-
-```javascript
-var fn = obj.method.bind(obj);
-var fn = obj.method.bind(obj, "foob");
-```
-
-### Method binding function shorthand
-
-```javascript
-["foo", "bar"].map(#toUpperCase); // ["FOO", "BAR"]
-[1.1234, 23.53245, 3].map(#toFixed(2)); // ["1.12", "23.53", "3.00"]
-```
-
-equivalent to
-
-```javascript
-["foo", "bar"].map(function (val) { return val.toUpperCase(); });
-[1.1234, 23.53245, 3].map(function (val) { return val.toFixed(2); });
-```
-
-### Object getter memoization
-
-```javascript
-var foo = {
- memo bar() {
- return complex();
- }
-};
-
-class Foo {
- memo bar() {
- return complex();
- }
-}
-```
-
-equivalent to
-
-```javascript
-var foo = {
- get bar() {
- return Object.defineProperty(this, "bar", {
- value: complex(),
- enumerable: true,
- configurable: true,
- writable: true
- }).bar;
- }
-};
-
-class Foo {
- get bar() {
- return Object.defineProperty(this, "bar", {
- value: complex(),
- enumerable: true,
- configurable: true,
- writable: true
- }).bar;
- }
-}
-```
-
-### This shorthand
-
-```javascript
-@foo
-```
-
-equivalent to
-
-```javascirpt
-this.foo
-```
diff --git a/doc/plugins.md b/doc/plugins.md
deleted file mode 100644
index 3785d31575..0000000000
--- a/doc/plugins.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Plugins
-
-## Build systems
-
- - [Broccoli](https://github.com/6to5/broccoli-6to5-transpiler)
- - [Browserify](https://github.com/6to5/6to5ify)
- - [Brunch](https://github.com/6to5/6to5-brunch)
- - [Duo](https://github.com/6to5/duo6to5)
- - [Gobble](https://github.com/6to5/gobble-6to5)
- - [Gulp](https://github.com/6to5/gulp-6to5)
- - [Grunt](https://github.com/6to5/grunt-6to5)
- - [Sprockets](https://github.com/josh/sprockets-es6) or via [Browserify](https://github.com/6to5/6to5-rails)
- - [webpack](https://github.com/6to5/6to5-loader)
-
-## Integrations
-
- - [Isparta](https://github.com/douglasduteil/isparta) - Code coverage with `karma` and `instanbul` using 6to5
- - [JSXHint](https://github.com/STRML/JSXHint) - A wrapper around JSHint to allow linting of JSX files
-
-## Bridges
-
- - [Ruby](https://github.com/6to5/6to5-ruby)
-
-## Testing
-
- - [Jest](https://github.com/6to5/6to5-jest)
- - [Karma](https://github.com/6to5/karma-6to5-preprocessor)
- - [Mocha](https://github.com/6to5/6to5-mocha)
-
-## Misc
-
- - [Connect](https://github.com/6to5/6to5-connect)
- - [Jade](https://github.com/6to5/jade-6to5)
diff --git a/doc/polyfill.md b/doc/polyfill.md
deleted file mode 100644
index a97e334fb7..0000000000
--- a/doc/polyfill.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# Polyfill
-
-6to5 includes a polyfill that includes a custom
-[regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js) and
-[core.js](https://github.com/zloirock/core-js).
-
-This will emulate a full ES6 environment. This polyfill is automatically loaded
-when using [6to5-node](usage.md#node) and [6to5/register](usage.md#register-hook).
-
-## Usage
-
-### Node/Browserify
-
-You need to include the polyfill require at the top the **entry point** to your
-application.
-
-```javascript
-require("6to5/polyfill");
-```
-
-Fortunately, this is automatically loaded when using:
-
-```javascript
-require("6to5/register");
-```
-
-### Browser
-
-Available from the `browser-polyfill.js` file within the 6to5 directory of an
-npm release. This needs to be included **before** all your compiled 6to5 code.
-You can either prepend it to your compiled code or include it in a `