Skip to content

Commit

Permalink
Merge branch 'master' into modules-commonjs-spec
Browse files Browse the repository at this point in the history
* master:
  make installing runtime/transform-runtime clearer [skip ci] (babel#4991)
  Add example to es2015-unicode-regex [skip ci] (babel#4983)
  v6.20.3
  Calculate the correct arity for async functions with destructuring - fixes babel#4977 (babel#4978)
  v6.20.2
  fix object spread (babel#4976)
  fix clean lib
  update readme [skip ci]
  v6.20.1
  Fix nested object spread (babel#4974)
  v6.20.0
  v6.20.0 changelog [skip ci] (babel#4971)
  Raise limit on code size before compacting (babel#4965)
  Use regenerator-transform to implement babel-plugin-transform-regenerator (babel#4881)
  Add getBindingIdentifierPaths/getOuterBindingIdentifierPaths (babel#4876)
  Hoist generateDeclaredUidIdentifier helper function (babel#4934)
  • Loading branch information
Diogo Franco (Kovensky) committed Dec 12, 2016
2 parents e233d40 + 0ed97ce commit 27474f6
Show file tree
Hide file tree
Showing 43 changed files with 462 additions and 5,111 deletions.
184 changes: 184 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,191 @@
_Note: Gaps between patch versions are faulty, broken or test releases._

See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.

## v6.20.0 (2016-12-08)

> If you missed it, please check out our latest blog post: [The State of Babel](http://babeljs.io/blog/2016/12/07/the-state-of-babel). Talks about where we can possibly move forward as a project and how you can help!

- Maybe fix that crazy babel-generator deopt message you've all probably seen!
- Change to `babel-code-frame` for [facebookincubator/create-react-app#1101](https://github.com/facebookincubator/create-react-app/issues/1101)
- Change to `babel-generator` for [webpack/webpack#3413](https://github.com/webpack/webpack/pull/3413)
- Move implementation of Regenerator back to the original repo.

---

You've probably seen this more than a few times and had no idea what it meant...

```
[BABEL] Note: The code generator has deoptimised the styling of "app.js" as it exceeds the max of "100KB".
```

Generating code used to get really slow as file size increased. We've mostly fixed that, but we still automatically fall back to compact output on large files. We're going to bump the limit to 500KB and if there aren't issues just remove it.

---

[Ben Newman, @benjamn](https://github.com/benjamn): wrote [Regenerator](https://github.com/facebook/regenerator) while at Facebook. It used a bunch of other libraries such as `ast-types` but has now been rewritten as a standalone **Babel plugin** (also thanks to [Sebastian's](https://github.com/kittens) previous work in [facebook/regenerator#222](https://github.com/facebook/regenerator/pull/222)). We're also moving the implementation of Regenerator back into the original repository since Ben is the creator/maintainer.

#### :rocket: New Feature
* `babel-traverse`
* [#4876](https://github.com/babel/babel/pull/4876) Add `getBindingIdentifierPaths`/`getOuterBindingIdentifierPaths`. ([@boopathi](https://github.com/boopathi))

Returns `Array<Path>` rather than `Array<Node>`.

- `path.getBindingIdentifierPaths()`
- `path.getOuterBindingIdentifierPaths()`

```js
traverse(parse(`
var a = 1, {b} = c, [d] = e, function f() {};
`), {
VariableDeclaration(path) {
let nodes = path.getBindingIdentifiers(); // a, d, b
let paths = path.getBindingIdentifierPaths();
},
FunctionDeclaration(path) {
let outerNodes = path.getOuterBindingIdentifiers(); // f
let outerPaths = path.getOuterBindingIdentifierPaths();
}
});
```

* `babel-code-frame`
* [#4913](https://github.com/babel/babel/pull/4913) Add `forceColor` option to `babel-code-frame`. ([@Timer](https://github.com/Timer))

> Forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`. For [facebookincubator/create-react-app#1101](https://github.com/facebookincubator/create-react-app/issues/1101)

Usage

```js
const result = codeFrame(rawLines, lineNumber, colNumber, {
forceColor: true
});
```

#### :bug: Bug Fix
* `babel-plugin-transform-es2015-block-scoping`
* [#4880](https://github.com/babel/babel/pull/4880) Add (and fix) failing test of function parameter bindings in a catch block. ([@benjamn](https://github.com/benjamn))

**In**

```js
try {
foo();
} catch (x) {
function harmless(x) {
return x;
}
}
```

**Correct Out**

```js
try {
foo();
} catch (x) {
var harmless = function (x) {
return x;
};
}
```

* `babel-helper-remap-async-to-generator`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`
* [#4901](https://github.com/babel/babel/pull/4901) Only base async fn arity on non-default/non-rest params - Closes [#4891](https://github.com/babel/babel/issues/4891). ([@loganfsmyth](https://github.com/loganfsmyth))

```js
// both length's should be 0
const foo = (...args) => { }
console.log(foo.length) // 0
const asyncFoo = async (...args) => { }
console.log(asyncFoo.length) // 0
```

* `babel-generator`, `babel-types`
* [#4945](https://github.com/babel/babel/pull/4945) Add `babel-generator` support for `Import`. ([@TheLarkInn](https://github.com/TheLarkInn))

> Relevant for webpack 2 support of `Import`. Just allows Babel to print it correctly.

```js
import("module.js");
```

* `babel-plugin-transform-object-rest-spread`
* [#4883](https://github.com/babel/babel/pull/4883) Fix for object-rest with parameters destructuring nested rest. ([@christophehurpeau](https://github.com/christophehurpeau))

```js
function a5({a3, b2: { ba1, ...ba2 }, ...c3}) {}
```

* `babel-traverse`
* [#4875](https://github.com/babel/babel/pull/4875) Fix `path.evaluate` for references before declarations. ([@boopathi](https://github.com/boopathi))

```js
// should deopt if ids are referenced before the bindings
var a = b + 2; var b = 2 + 2;
```

* `babel-core`, `babel-generator`, `babel-helper-transform-fixture-test-runner`, `babel-plugin-transform-object-rest-spread`
* [#4858](https://github.com/babel/babel/pull/4858) Fix bug + Generate test fixtures if no expected.js. ([@hzoo](https://github.com/hzoo))
* `babel-types`
* [#4853](https://github.com/babel/babel/pull/4853) Preserve null in `babel-types` `t.clone` and `t.deepClone` ([@NTillmann](https://github.com/NTillmann))

#### :nail_care: Polish
* `babel-generator`
* [#4862](https://github.com/babel/babel/pull/4862) Fix identation with empty leading `ObjectTypeProperty`. ([@existentialism](https://github.com/existentialism))

#### :memo: Documentation
* `Various Packages`
* [#4938](https://github.com/babel/babel/pull/4938) Update babel-core documentation. ([@xtuc](https://github.com/xtuc))
* [#4939](https://github.com/babel/babel/pull/4939) Add example to transform-react-display-name docs. ([@existentialism](https://github.com/existentialism))
* [#4931](https://github.com/babel/babel/pull/4931) Update plugins READMEs from babel.github.io [skip ci]. ([@raspo](https://github.com/raspo))
* [#4926](https://github.com/babel/babel/pull/4926) Update transform-es2015 READMEs from babel.github.io [skip ci]. ([@existentialism](https://github.com/existentialism))
* [#4930](https://github.com/babel/babel/pull/4930) Update transform-object-rest-spread's README from babel.github.io [skip ci]. ([@lukyth](https://github.com/lukyth))
* [#4929](https://github.com/babel/babel/pull/4929) Update transform-object-assign's README from babel.github.io [skip ci]. ([@lukyth](https://github.com/lukyth))
* [#4928](https://github.com/babel/babel/pull/4928) mention [skip ci] in PR template. ([@hzoo](https://github.com/hzoo))
* [#4925](https://github.com/babel/babel/pull/4925) Tweak example in transform-jsx-source README [skip ci]. ([@existentialism](https://github.com/existentialism))
* [#4919](https://github.com/babel/babel/pull/4919) Update async READMEs from babel.github.io [skip-ci]. ([@existentialism](https://github.com/existentialism))
* [#4917](https://github.com/babel/babel/pull/4917) Fix some React transform README issues [skip-ci]. ([@existentialism](https://github.com/existentialism))
* [#4903](https://github.com/babel/babel/pull/4903) Update React transform READMEs from babel.github.io [skip ci]. ([@existentialism](https://github.com/existentialism))
* [#4884](https://github.com/babel/babel/pull/4884) Readme updates from babel.github.io [skip ci]. ([@hzoo](https://github.com/hzoo))

#### :house: Internal
* `babel-plugin-transform-regenerator`
* [#4881](https://github.com/babel/babel/pull/4881) Use `regenerator-transform` to implement `babel-plugin-transform-regenerator`. ([@benjamn](https://github.com/benjamn))
* `babel-traverse`
* [#4934](https://github.com/babel/babel/pull/4934) Hoist `generateDeclaredUidIdentifier` helper function. ([@jridgewell](https://github.com/jridgewell))
* `babel-polyfill`
* [#4966](https://github.com/babel/babel/pull/4966) update `regenerator-runtime` in `babel-polyfill`. ([@zloirock](https://github.com/zloirock))
* `babel-runtime`
* [#4877](https://github.com/babel/babel/pull/4877) Upgrade `regenerator-runtime` to version 0.10.0. ([@benjamn](https://github.com/benjamn))
* `babel-plugin-syntax-trailing-function-commas`
* [#4936](https://github.com/babel/babel/pull/4936) Add `test` to `babel-plugin-syntax-trailing-function-commas` `.npmignore` ([@wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg))
* `babel-helper-fixtures`
* [#4907](https://github.com/babel/babel/pull/4907) Remove `shouldIgnore` check. ([@danez](https://github.com/danez))
* `babel-core`, `babel-traverse`
* [#4897](https://github.com/babel/babel/pull/4897) Fix eslint. ([@danez](https://github.com/danez))
* `babel-generator`
* [#4965](https://github.com/babel/babel/pull/4965) Raise limit on code size before compacting ([@existentialism](https://github.com/existentialism))

#### Committers: 17
- Ben Newman ([benjamn](https://github.com/benjamn))
- Benjamin E. Coe ([bcoe](https://github.com/bcoe))
- Boopathi Rajaa ([boopathi](https://github.com/boopathi))
- Brian Ng ([existentialism](https://github.com/existentialism))
- Christophe Hurpeau ([christophehurpeau](https://github.com/christophehurpeau))
- Daniel Tschinder ([danez](https://github.com/danez))
- Denis Pushkarev ([zloirock](https://github.com/zloirock))
- Henry Zhu ([hzoo](https://github.com/hzoo))
- Joe Haddad ([Timer](https://github.com/Timer))
- Justin Ridgewell ([jridgewell](https://github.com/jridgewell))
- Kanitkorn Sujautra ([lukyth](https://github.com/lukyth))
- Logan Smyth ([loganfsmyth](https://github.com/loganfsmyth))
- Nikolai Tillmann ([NTillmann](https://github.com/NTillmann))
- Sean Larkin ([TheLarkInn](https://github.com/TheLarkInn))
- Sven SAULEAU ([xtuc](https://github.com/xtuc))
- Tommaso ([raspo](https://github.com/raspo))
- [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg)

## v6.19.0 (2016-11-16)

#### :rocket: New Feature
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ build-dist: build
node scripts/generate-babel-types-docs.js

watch: clean
rm -rf packages/*/lib
./node_modules/.bin/gulp watch

lint:
Expand All @@ -27,7 +28,6 @@ fix:
./node_modules/.bin/eslint packages/ --format=codeframe --fix

clean: test-clean
rm -rf packages/*/lib
rm -rf packages/babel-polyfill/browser*
rm -rf packages/babel-polyfill/dist
rm -rf coverage
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.0.0-beta.23",
"version": "6.19.0",
"version": "6.20.3",
"changelog": {
"repo": "babel/babel",
"labels": {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-code-frame/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-code-frame",
"version": "6.16.0",
"version": "6.20.0",
"description": "Generate errors that contain a code frame that point to source locations.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Following is a table of the options you can use:
| `code` | `true` | Enable code generation |
| `no-babelrc` | [CLI flag](http://babeljs.io/docs/usage/cli/#ignoring-babelrc) | Specify whether or not to use .babelrc and .babelignore files. Only available when using the CLI. |
| `ast` | `true` | Include the AST in the returned object |
| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >100KB. |
| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB. |
| `minified` | `false` | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) |
| `comments` | `true` | Output comments in generated output. |
| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used. |
Expand Down
18 changes: 9 additions & 9 deletions packages/babel-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-core",
"version": "6.18.2",
"version": "6.20.0",
"description": "Babel compiler core.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
Expand All @@ -24,15 +24,15 @@
"test": "make test"
},
"dependencies": {
"babel-code-frame": "^6.16.0",
"babel-generator": "^6.18.0",
"babel-code-frame": "^6.20.0",
"babel-generator": "^6.20.0",
"babel-helpers": "^6.16.0",
"babel-messages": "^6.8.0",
"babel-template": "^6.16.0",
"babel-runtime": "^6.9.1",
"babel-runtime": "^6.20.0",
"babel-register": "^6.18.0",
"babel-traverse": "^6.18.0",
"babel-types": "^6.18.0",
"babel-traverse": "^6.20.0",
"babel-types": "^6.20.0",
"babylon": "^6.11.0",
"convert-source-map": "^1.1.0",
"debug": "^2.1.1",
Expand All @@ -45,8 +45,8 @@
"source-map": "^0.5.0"
},
"devDependencies": {
"babel-helper-fixtures": "^6.18.2",
"babel-helper-transform-fixture-test-runner": "^6.18.2",
"babel-polyfill": "^6.16.0"
"babel-helper-fixtures": "^6.20.0",
"babel-helper-transform-fixture-test-runner": "^6.20.0",
"babel-polyfill": "^6.20.0"
}
}
8 changes: 4 additions & 4 deletions packages/babel-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-generator",
"version": "6.19.0",
"version": "6.20.0",
"description": "Turns an AST into code.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
Expand All @@ -12,15 +12,15 @@
],
"dependencies": {
"babel-messages": "^6.8.0",
"babel-runtime": "^6.9.0",
"babel-types": "^6.19.0",
"babel-runtime": "^6.20.0",
"babel-types": "^6.20.0",
"detect-indent": "^4.0.0",
"jsesc": "^1.3.0",
"lodash": "^4.2.0",
"source-map": "^0.5.0"
},
"devDependencies": {
"babel-helper-fixtures": "^6.18.0",
"babel-helper-fixtures": "^6.20.0",
"babylon": "^6.11.0"
}
}
6 changes: 3 additions & 3 deletions packages/babel-generator/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Generator extends Printer {
* Normalize generator options, setting defaults.
*
* - Detects code indentation.
* - If `opts.compact = "auto"` and the code is over 100KB, `compact` will be set to `true`.
* - If `opts.compact = "auto"` and the code is over 500KB, `compact` will be set to `true`.
*/

function normalizeOptions(code, opts, tokens): Format {
Expand Down Expand Up @@ -78,10 +78,10 @@ function normalizeOptions(code, opts, tokens): Format {
}

if (format.compact === "auto") {
format.compact = code.length > 100000; // 100KB
format.compact = code.length > 500000; // 500KB

if (format.compact) {
console.error("[BABEL] " + messages.get("codeGeneratorDeopt", opts.filename, "100KB"));
console.error("[BABEL] " + messages.get("codeGeneratorDeopt", opts.filename, "500KB"));
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/babel-helper-fixtures/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "babel-helper-fixtures",
"version": "6.18.2",
"version": "6.20.0",
"description": "Helper function to support fixtures",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"license": "MIT",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-fixtures",
"main": "lib/index.js",
"dependencies": {
"babel-runtime": "^6.9.0",
"babel-runtime": "^6.20.0",
"lodash": "^4.2.0",
"try-resolve": "^1.0.0"
}
Expand Down
8 changes: 4 additions & 4 deletions packages/babel-helper-remap-async-to-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "babel-helper-remap-async-to-generator",
"version": "6.18.0",
"version": "6.20.3",
"description": "Helper function to remap async functions to generators",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"babel-runtime": "^6.0.0",
"babel-runtime": "^6.20.0",
"babel-template": "^6.16.0",
"babel-types": "^6.18.0",
"babel-traverse": "^6.18.0",
"babel-types": "^6.20.0",
"babel-traverse": "^6.20.0",
"babel-helper-function-name": "^6.18.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function plainFunction(path: NodePath, callId: Object) {
REF: path.scope.generateUidIdentifier("ref"),
FUNCTION: built,
PARAMS: node.params.reduce((acc, param) => {
acc.done = acc.done || !t.isIdentifier(param);
acc.done = acc.done || t.isAssignmentPattern(param) || t.isRestElement(param);

if (!acc.done) {
acc.params.push(path.scope.generateUidIdentifier("x"));
Expand Down
12 changes: 6 additions & 6 deletions packages/babel-helper-transform-fixture-test-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "babel-helper-transform-fixture-test-runner",
"version": "6.18.2",
"version": "6.20.0",
"description": "Transform test runner for babel-helper-fixtures module",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-transform-fixture-test-runner",
"main": "lib/index.js",
"dependencies": {
"babel-runtime": "^6.9.0",
"babel-core": "^6.18.2",
"babel-polyfill": "^6.16.0",
"babel-helper-fixtures": "^6.18.2",
"babel-runtime": "^6.20.0",
"babel-core": "^6.20.0",
"babel-polyfill": "^6.20.0",
"babel-helper-fixtures": "^6.20.0",
"source-map": "^0.5.0",
"babel-code-frame": "^6.16.0",
"babel-code-frame": "^6.20.0",
"chai": "^3.0.0",
"lodash": "^4.2.0"
}
Expand Down
Loading

0 comments on commit 27474f6

Please sign in to comment.