Tags:
- :boom: [Breaking Change]
- :eyeglasses: [Spec Compliancy]
- :rocket: [New Feature]
- :bug: [Bug Fix]
- :memo: [Documentation]
- :house: [Internal]
- :nail_care: [Polish]
Note: Gaps between patch versions are faulty, broken or test releases.
See CHANGELOG - 6to5 for the pre-4.0.0 version changelog. See Babylon's CHANGELOG for the Babylon pre-7.0.0-beta.29 version changelog.
Backports for some folks (also other's when we accidently merged PRs from both 6.x/master) Lesson learned: just use
master
and backport on another branch.
babel-core
, babel-generator
, babel-plugin-transform-flow-comments
, babel-plugin-transform-flow-strip-types
, babel-traverse
, babel-types
babel-cli
babel-plugin-transform-es2015-modules-commonjs
babel-types
babel-plugin-transform-class-properties
babel-plugin-transform-runtime
babel-plugin-transform-regenerator
babel-generator
, babel-plugin-transform-es2015-arrow-functions
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-spread
, babel-plugin-transform-runtime
, babel-register
babel-traverse
Just backporting a few things.
babel-plugin-transform-react-display-name
babel-generator
, babel-plugin-transform-flow-strip-types
, babel-types
A quick release for 2 features:
noInterop
option for our es2015-modules
transform to remove the interopRequireDefault
and interopRequireWildcard
helpers.Input
import foo from "foo";
foo;
Regular Output
var _foo = require("foo");
var _foo2 = _interopRequireDefault(_foo);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_foo2.default;
Output with option noInterop
"use strict";
var _foo = require("foo");
(0, _foo.default)();
This also helps ember-cli migrate to Babel 6.
dirname
to the preset constructor which presets can use to resolve things relative to files.Example usage of fileContext.dirname
in a preset
module.exports = function preset (context, options, fileContext) {
if (/resolve-addons-relative-to-file$/.test(fileContext.dirname)) {
return {
plugins: ['plugin-here'],
};
}
return {};
};
This will help out with reusing a
browserslist
file for babel-preset-env and for plugins like https://github.com/tleunen/babel-plugin-module-resolver.
babel-plugin-transform-es2015-modules-amd
, babel-plugin-transform-es2015-modules-commonjs
babel-core
dirname
as extra metadata to preset constructor. (@izaakschroeder)babel-generator
babel-generator
, babel-plugin-transform-object-rest-spread
babel-cli
babel-traverse
Regression: Revert https://github.com/babel/babel/pull/5306 since it made a backwards-incompatible change.
babel-plugin-transform-react-constant-elements
babel-preset-flow
, babel-preset-react
babel-traverse
babel-plugin-transform-es2015-block-scoping
babel-core
, babel-traverse
babel-plugin-transform-es2015-for-of
babel-plugin-transform-react-constant-elements
, babel-traverse
babel-plugin-transform-do-expressions
, babel-traverse
babel-register
babel-traverse
babel-plugin-transform-runtime
babel
babel-generator
babel-plugin-transform-es2015-modules-commonjs
babel-*
babel-plugin-transform-es2015-spread
babel-plugin-transform-flow-strip-types
babel-plugin-transform-regenerator
babel-plugin-transform-es2015-arrow-functions
babel-core
babel-core
, babel-traverse
babel-generator
babel-types
babel-*
babel-cli
babel-node
throwing errors when passed non-"-" args #5162.babel-traverse
babel-traverse
via #5019 for transform-react-constant-elements.A quick update since it's been over a month already: adds support for shorthand import syntax in Flow + some fixes!
We'll be merging in our current 7.0 PRs on a 7.0 branch soon and I'l be making some more issues (most should be beginner-friendly).
To follow our progress check out our 7.0 milestone, the wiki and upcoming announcements on twitter!
We support stripping out and generating the new shorthand import syntax in Flow (parser support was added in babylon@6.15.0.
import {
someValue,
type someType,
typeof someOtherValue,
} from "blah";
babel-generator
, babel-types
babel-plugin-transform-flow-strip-types
, babel-traverse
babel-core
babel-plugin-transform-object-rest-spread
const { x, ...y } = foo();
Old Behavior
const { x } = foo();
const y = _objectWithoutProperties(foo(), ["x"]);
New/Expected Behavior
const _ref = foo(); // should only be called once
const { x } = _ref;
const y = _objectWithoutProperties(_ref, ["x"]);
babel-cli
babel-plugin-transform-object-rest-spread
Accounts for default values in object rest params
function fn({a = 1, ...b} = {}) {
return {a, b};
}
babel-plugin-transform-es2015-destructuring
const assign = ([...arr], index, value) => {
arr[index] = value
return arr
}
const arr = [1, 2, 3]
assign(arr, 1, 42)
console.log(arr) // [1, 2, 3]
babel-plugin-transform-es2015-function-name
Input
export const x = ({ x }) => x;
export const y = function () {};
Output
export const x = ({ x }) => x;
export const y = function y() {};
babel-types
babel-cli
babel-traverse
babel-generator
, babel-plugin-transform-exponentiation-operator
babel-core
babel-plugin-syntax-class-constructor-call
babel-plugin-transform-es2015-duplicate-keys
, babel-plugin-transform-es2015-parameters
babel-plugin-transform-es2015-computed-properties
, babel-plugin-transform-es2015-for-of
babel-plugin-transform-class-properties
babel-plugin-transform-es2015-classes
, babel-plugin-transform-function-bind
babel-helpers
babel-preset-react
babel-plugin-check-es2015-constants
, babel-plugin-transform-es2015-modules-umd
, babel-plugin-transform-es2015-typeof-symbol
, babel-register
babel-core
babel-*
babel-helper-transform-fixture-test-runner
babel-cli
, babel-core
, babel-generator
, babel-helper-define-map
, babel-register
, babel-runtime
, babel-types
babel-cli
, babel-generator
, babel-helper-fixtures
, babel-helper-transform-fixture-test-runner
, babel-preset-es2015
, babel-runtime
, babel-traverse
babel-code-frame
babel-plugin-transform-react-jsx
babel-plugin-transform-decorators
babel-plugin-transform-es2015-computed-properties
babel-cli
babel-helper-builder-react-jsx
, babel-plugin-transform-react-jsx
babel-generator
babel-generator
: Expose raw mappings. (@davidaurelio)Exposes raw mappings when source map generation is enabled. To avoid the cost of source map generation for consumers of the raw mappings only, .map
is changed to a getter that generates the source map lazily on first access.
Raw mappings can be useful for post-processing source maps more efficiently by avoiding one decoding/encoding cycle of the b64 vlq mappings. This will be used in the React Native packager.
let generator = require("babel-generator");
let generated = generator(ast, { sourceMaps: true }, sources);
// generated.rawMappings
[
{
name: undefined,
generated: { line: 1, column: 0 },
source: "inline",
original: { line: 1, column: 0 }
},
...
]
babel-generator
, babel-plugin-transform-flow-comments
, babel-plugin-transform-flow-strip-types
Works with generator, transform-flow-comments, flow-strip-types.
function foo(numVal: number = 2) {}
babel-generator
, babel-plugin-transform-es2015-modules-amd
, babel-plugin-transform-es2015-modules-umd
let blockStatement = t.blockStatement(
[],
[t.directive(t.directiveLiteral("use strict"))]
);
babel-generator
, babel-helper-builder-react-jsx
, babel-plugin-transform-react-jsx
, babel-types
JSXSpreadChildren
but throw in JSX transform plugin. (@jridgewell)Will still error with Spread children are not supported.
<div>{...this.props.children}</div>;
babel-plugin-transform-es2015-block-scoping
, babel-plugin-transform-react-constant-elements
, babel-traverse
When multiple declarators are present in a declaration, we want to insert the constant element inside the declaration rather than placing it before because it may rely on a declarator inside that same declaration.
function render() {
const bar = "bar", renderFoo = () => <foo bar={bar} baz={baz} />, baz = "baz";
return renderFoo();
}
When block scoped variables caused the block to be wrapped in a closure, the variable bindings remained in parent function scope, which caused the JSX element to be hoisted out of the closure.
function render(flag) {
if (flag) {
let bar = "bar";
[].map(() => bar);
return <foo bar={bar} />;
}
return null;
}
babel-plugin-transform-es2015-parameters
Was erroring if the rest parameter shared the same name as a default identifier for a param, needed to be deopt'd.
const a = 1;
function rest(b = a, ...a) {
assert.equal(b, 1);
}
rest(undefined, 2)
babel-plugin-transform-es2015-for-of
, babel-traverse
myLabel: //woops
for (let a of b) {
continue myLabel;
}
babel-plugin-transform-runtime
babel-plugin-transform-es2015-unicode-regex
babel-helper-transform-fixture-test-runner
, babel-plugin-syntax-trailing-function-commas
Allows running require()
in exec.js tests like for babel/babel-preset-env#95
babel-plugin-transform-async-to-generator
Issue: https://github.com/babel/babel/issues/4972 again. Fixed by reverting part of the original PR in babel/babel#4883.
Issue: https://github.com/babel/babel/issues/4972
The way that babel/babel#4883 changed visiting SpreadProperty (which didn't need to modified) caused an infinite loop. Added path.stop
which ended up not fixing it correctly.
If you missed it, please check out our latest blog post: The State of Babel. Talks about where we can possibly move forward as a project and how you can help!
babel-code-frame
for facebookincubator/create-react-app#1101babel-generator
for webpack/webpack#3413You'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: wrote 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 previous work in facebook/regenerator#222). We're also moving the implementation of Regenerator back into the original repository since Ben is the creator/maintainer.
Returns Array<Path>
rather than Array<Node>
.
path.getBindingIdentifierPaths()
path.getOuterBindingIdentifierPaths()
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();
}
});
Forcibly syntax highlight the code as JavaScript (for non-terminals); overrides
highlightCode
. For facebookincubator/create-react-app#1101
Usage
const result = codeFrame(rawLines, lineNumber, colNumber, {
forceColor: true
});
babel-plugin-transform-es2015-block-scoping
In
try {
foo();
} catch (x) {
function harmless(x) {
return x;
}
}
Correct Out
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
// 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
babel-generator
support for Import
. (@TheLarkInn)Relevant for webpack 2 support of
Import
. Just allows Babel to print it correctly.
import("module.js");
babel-plugin-transform-object-rest-spread
function a5({a3, b2: { ba1, ...ba2 }, ...c3}) {}
// 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
babel-types
babel-types
t.clone
and t.deepClone
(@NTillmann)babel-generator
ObjectTypeProperty
. (@existentialism)Various Packages
babel-plugin-transform-regenerator
babel-traverse
generateDeclaredUidIdentifier
helper function. (@jridgewell)babel-polyfill
babel-runtime
babel-plugin-syntax-trailing-function-commas
test
to babel-plugin-syntax-trailing-function-commas
.npmignore
(@wtgtybhertgeghgtwtg)babel-helper-fixtures
babel-core
, babel-traverse
babel-generator
babel-plugin-transform-object-rest-spread
This rewrite fixes a long standing issue where the object-rest-spread plugin was depending on 2 other plugins to compile RestProperty
. This is important given the assumption that plugins should be independent and is vital for the use of babel-preset-env since new environments support destructuring natively.
RestProperty
js
function a({ b, ...c }) {}
js
const { a, ...b } = c;
js
export var { a, ...b } = c;
js
try {} catch ({a, ...b}) {}
js
({a, ...b} = c);
js
for ({a, ...b} of []) {}
SpreadProperty
[x] ObjectExpression
var a = { ...b, ...c }
babel-plugin-transform-class-properties
Usage
{
"plugins": [
["transform-class-properties", {
"spec": true
}]
]
}
Object.defineProperty
In
class Foo {
static bar;
}
Out
var Foo = function Foo() {
babelHelpers.classCallCheck(this, Foo);
};
Object.defineProperty(Foo, "bar", {
enumerable: true,
writable: true,
value: undefined
});
We've added 2 similar "ancestry" path methods to path.findParent
:
path.isAncestor
/path.isDescenant
Usage:
let programPath, numberPath;
traverse(ast, {
Program(path) { programPath = path; },
NumberPath(path) { numberPath = path; },
});
programPath.isAncestor(numberPath); // true
numberPath.isDescendant(programPath); // true
Usage:
traverse.clearCache(); // clears both path's and scope cache
traverse.clearCache.clearPath();
traverse.clearCache.clearScope();
Usage:
{
"generatorOpts": {
"jsonCompatibleStrings": true // defaults to false
}
}
Set to true for the generator to use jsesc
with "json": true
. This will make it print "\u00A9"
vs. "©"
;
flowUsesCommas
option for object types. (@sampepose)Usage:
{
"generatorOpts": {
"flowCommaSeparator": true // defaults to false
}
}
Currently there are 2 supported syntaxes (,
and ;
) in Flow Object Types. The use of commas is in line with the more popular style and matches how objects are defined in Javascript, making it a bit more natural to write.
var a: { param1: number; param2: string }
var a: { param1: number, param2: string }
t.isNodesEquivalent
Usage:
assert(t.isNodesEquivalent(parse("1 + 1"), parse("1+1")) === true);
babel-plugin-transform-es2015-modules-systemjs
import()
as contextual import in system module format. (@guybedford)Support stage-2 import()
in systemjs.
It does not compile by default; you'll want to add the stage-2 preset or explicitly include babel-plugin-syntax-dynamic-import
.
export function lazyLoadOperation () {
return import('./x')
.then(function (x) {
x.y();
});
}
Will print the shorter of the NumericLiteral
s if using the minified
option.
Input
5e1;
5e4;
Output
50;
5e4;
babel-plugin-transform-es2015-modules-systemjs
Fixes inconsistent modules iteration for numeric imports
import "2"; // should be imported first
import "1"; // second
babel-plugin-transform-es2015-destructuring
, babel-plugin-transform-react-constant-elements
Fixes an issue with destructuring parameters being hoisted incorrectly.
Input
function render({ text }) {
return () => (<Component text={text} />);
}
Output
function render(_ref) {
let text = _ref.text;
var _ref2 = <Component text={text} />;
return () => _ref2;
}
babel-plugin-transform-async-to-generator
Weird publishing issue with v6.18.1, same release.
The error message was actually invalid!
Invalid:
{ "presets": [{ "option": "value" }] }
Valid:
{
"presets": [
["presetName", { "option": "value" }] // the preset should be wrapped in `[ ]`
]
}
babel-helper-fixtures
, babel-helper-transform-fixture-test-runner
babel-plugin-transform-async-to-generator
Weird publishing issue with v6.18.1, re-released as v6.18.2.
babel-generator
, babel-plugin-transform-flow-strip-types
Check out the blog post and flow docs for more info:
type T = { +p: T };
interface T { -p: T };
declare class T { +[k:K]: V };
class T { -[k:K]: V };
class C2 { +p: T = e };
// in
{['a' + 'b']: 10 * 20, 'z': [1, 2, 3]}
// out
{ab: 200, z: [1, 2, 3]}
babel-plugin-syntax-dynamic-import
, babel-preset-stage-2
Parser support was added in https://github.com/babel/babylon/releases/tag/v6.12.0.
Just the plugin to enable it in babel.
// install
$ npm install babel-plugin-syntax-dynamic-import --save-dev
or use the new parserOpts
// .babelrc
{
"parserOpts": {
"plugins": ['dynamicImport']
}
}
babel-helper-builder-react-jsx
, babel-plugin-transform-react-jsx
useBuiltIns
option to helper-builder-react-jsx. (@existentialism)Previously we added a useBuiltIns
for object-rest-spread so that it use the native/built in version if you use a polyfill or have it supported natively.
This change just uses the same option from the plugin to be applied with spread inside of jsx.
// in
var div = <Component {...props} foo="bar" />
// out
var div = React.createElement(Component, Object.assign({}, props, { foo: "bar" }));
babel-generator
, babel-traverse
, babel-types
EmptyTypeAnnotation
. (@samwgoldman)EmptyTypeAnnotation
Added in flow here and in babylon here.
function f<T>(x: empty): T {
return x;
}
f(); // nothing to pass...
babel-traverse
Track LabeledStatement
separately (not part of bindings).
Will give examples of code that was fixed below
babel-plugin-transform-react-inline-elements
, babel-traverse
// issue with imported components that were JSXMemberExpression
import { form } from "./export";
function ParentComponent() {
return <form.TestComponent />;
}
babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-react-inline-elements
import { Modal } from "react-bootstrap";
export default CustomModal = () => <Modal.Header>foobar</Modal.Header>;
if ( true ) {
loop: for (let ch of []) {}
}
class A {
prop1 = () => this;
static prop2 = () => this;
prop3 = () => arguments;
}
babel-helper-remap-async-to-generator
, babel-plugin-transform-async-generator-functions
// in
class C {
async *g() { await 1; }
}
// out
class C {
g() { // was incorrectly outputting the method with a generator still `*g(){`
return _asyncGenerator.wrap(function* () {
yield _asyncGenerator.await(1);
})();
}
}
babel-plugin-check-es2015-constants
, babel-plugin-transform-es2015-destructuring
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-parameters
// was wrapping variables in an IIFE incorrectly
for ( let i = 0, { length } = list; i < length; i++ ) {
console.log( i + ': ' + list[i] )
}
babel-plugin-transform-es2015-parameters
// was producing invalid code
class Ref {
static nextId = 0
constructor(id = ++Ref.nextId, n = id) {
this.id = n
}
}
assert.equal(1, new Ref().id)
assert.equal(2, new Ref().id)
function first(...values) {
let index = 0;
return values[index++]; // ++ was happening twice
}
console.log(first(1, 2));
babel-plugin-transform-es2015-block-scoping
let x = 10;
if (1)
{
ca: let x = 20;
}
babel-helper-explode-assignable-expression
, babel-plugin-transform-exponentiation-operator
a[`${b++}`] **= 1;
babel-plugin-transform-es2015-shorthand-properties
, babel-plugin-transform-flow-comments
, babel-plugin-transform-flow-strip-types
foo = {
bar() {
return super.baz **= 12;
}
}
// @flow
var obj = {
method(a: string): number {
return 5 + 5;
}
};
babel-helper-define-map
, babel-plugin-transform-es2015-classes
, babel-plugin-transform-flow-comments
, babel-plugin-transform-flow-strip-types
// @flow
class C {
m(x: number): string {
return 'a';
}
}
babel-plugin-check-es2015-constants
, babel-plugin-transform-es2015-destructuring
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-parameters
// in
const [a, b] = [1, 2];
// out
var a = 1,
b = 2;
babel-plugin-transform-es2015-parameters
// was outputting an extra `index++ + 0`
function first(...values) {
var index = 0;
return values[index++];
}
babel-generator
boolean
instead of bool
for the BooleanTypeAnnotation
AST node. (@existentialism)var a: Promise<boolean>[];
// instead of
var a: Promise<bool>[];
babel-core
We've had a few reports of users not wrapping a preset in
[]
when passing in options so we added an extra error message for this.
ReferenceError: [BABEL] /test.js: Unknown option: base.loose2. Check out http://babeljs.io/docs/usage/options/ for more information about options.
A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:
Invalid:
`{ presets: [{option: value}] }`
Valid:
`{ presets: ["pluginName", {option: value}] }`
For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.
So that our MIT License shows up.
babel-cli
It's a one-time use tool (helpful after the initial release when upgrading from v5 to v6) that doesn't need to be a part of babel-cli
. We'll publish it as a standalone package it someone asks for it.
babel-traverse
, babel-types
babel-cli
, babel-core
, babel-helper-fixtures
, babel-register
babel-helper-transform-fixture-test-runner
babel-cli
, babel-code-frame
, babel-core
, babel-generator
, babel-helper-transform-fixture-test-runner
, babel-preset-es2015
, babel-template
, babel-traverse
babel-cli
, babel-code-frame
, babel-core
, babel-generator
, babel-plugin-transform-es2015-modules-commonjs
, babel-preset-es2015
, babel-template
, babel-traverse
babel-cli
, babel-core
babel-cli
, babel-core
, babel-plugin-transform-es2015-modules-systemjs
, babel-preset-es2015
babel-register
babel-cli
babel-core
babel-generator
babel-traverse
https://github.com/tc39/proposals/commit/96f8d79dac33575e24f6ac3ec2082efe75d519ba
Specification repo: https://github.com/tc39/proposal-async-iteration
Asynchronous Iteration was already added in 6.16.0 under stage-2 but it was moved to stage-3 at the latest TC-39 meeting.
// async generator syntax
async function* agf() {}
// for-await statement
async function f() {
for await (let x of y) {
g(x);
}
}
To use it as a standalone plugin:
{
"plugins": ["transform-async-generator-functions"]
}
With the stage-3 preset (or below):
{
"presets": ["stage-3"]
}
Similarly, object-rest-spread is now also at stage-3.
https://twitter.com/sebmarkbage/status/781564713750573056 https://github.com/tc39/proposals/commit/142ac3ce7f3f56989800260f029b76afe4a02e57
// Rest properties
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
console.log(x); // 1
console.log(y); // 2
console.log(z); // { a: 3, b: 4 }
// Spread properties
let n = { x, y, ...z };
console.log(n); // { x: 1, y: 2, a: 3, b: 4 }
To use it as a standalone plugin:
{
"plugins": ["transform-object-rest-spread"]
}
With the stage-3 preset (or below):
{
"presets": ["stage-3"]
}
References:
Adds a retainFunctionParens
to babel-generator
. This option will retain the parentheses around an IIFE.
// parens are stripped without the option
__d('x', (function () {}));
babel-core
babel-generator
babel-plugin-transform-es2015-parameters
babel-plugin-transform-flow-comments
First PR!
Babel 6.16: Happy 2nd Birthday 🎂!
babel-core
, babel-generator
, babel-helper-remap-async-to-generator
, babel-helpers
, babel-plugin-transform-async-generator-functions
, babel-types
, babel-preset-stage-2
, ...
This change implements the async iteration proposal, currently at stage 2 (and pushing to stage 3 at the current TC-39 meeting). It includes the following features:
async function* g() { }
) to wrapped generator functions, similar to the current async-to-generator transform.
```jsasync function* agf() { this; await 1; yield 2; return 3; }
- Transforms `for-await` statements into for loops containing yield expressions.
```js
async function f() {
for await (let x of y) {
g(x);
}
}
Example Usage
async function* genAnswers() {
var stream = [ Promise.resolve(4), Promise.resolve(9), Promise.resolve(12) ];
var total = 0;
for await (let val of stream) {
total += await val;
yield total;
}
}
function forEach(ai, fn) {
return ai.next().then(function (r) {
if (!r.done) {
fn(r);
return forEach(ai, fn);
}
});
}
var output = 0;
return forEach(genAnswers(), function(val) { output += val.value })
.then(function () {
assert.equal(output, 42);
});
babel-core
, babel-generator
, babel-plugin-transform-class-properties
, babel-template
, babel-traverse
, babel-types
Parser support was added in babylon@6.11.0 with babel/babylon#121
// Example
class Foo {
[x]
['y']
}
class Bar {
[p]
[m] () {}
}
Parser support was added in babylon@6.10.0 with babel/babylon#104
// Example
var a : {| x: number, y: string |} = { x: 0, y: 'foo' };
Babel will now also take the options: parserOpts
and generatorOps
(as objects).
parserOpts
will pass all properties down to the default babylon
parser. You can also pass a parser
option to substitute for a different parser.
This will allow passing down any of babylon's
options:
{
"parserOpts": {
"allowImportExportEverywhere": true,
"allowReturnOutsideFunction": true,
"sourceType": "module",
"plugins": ["flow"]
}
}
Another use case (the main reason for doing this), is to be able to use recast with Babel.
{
"parserOpts": {
"parser": "recast"
},
"generatorOpts": {
"generator": "recast"
}
}
{
presets: ["@org/babel-preset-name"], // actual package
presets: ["@org/name"] // shorthand name
}
useBuiltIns
- Do not use Babel's helper's and just transform to use the built-in method (Disabled by default).
{
"plugins": [
["transform-object-rest-spread", { "useBuiltIns": true }]
]
}
// source
z = { x, ...y };
// compiled
z = Object.assign({ x }, y);
babel-code-frame
is a standalone package that we use in Babel when reporting errors.
Now there is an option to specify the number of lines above and below the error
1 | class Foo {
> 2 | constructor()
| ^
3 | }
babel-core
, babel-preset-es2015
, babel-preset-es2016
, babel-preset-es2017
, babel-preset-latest
, babel-preset-react
, babel-preset-stage-0
, babel-preset-stage-1
, babel-preset-stage-2
, babel-preset-stage-3
We previously made presets with commonjs exports
module.exports = {
plugins: [
require("babel-plugin-syntax-trailing-function-commas")
]
};
Now you can use export default as well
import transformExponentiationOperator from "babel-plugin-transform-exponentiation-operator";
export default {
plugins: [
transformExponentiationOperator
]
};
babel-helpers
, babel-plugin-transform-es2015-typeof-symbol
typeof Symbol.prototype
. (@brainlock)// `typeof Symbol.prototype` should be 'object'
typeof Symbol.prototype === 'object'
babel-cli
Fix an issue with defaults not being overidden. This was causing options like comments: false
not to work correctly.
babel-plugin-transform-es2015-function-name
, babel-traverse
// wasn't exporting correctly before
export default ({ onClick }) => {
return <div onClick={() => onClick()}></div>;
}
babel-plugin-transform-es2015-modules-commonjs
export default class {};
// wasn't correctly transforming to
exports["default"] = class {}
// with the es3-tranforms
babel-plugin-transform-flow-strip-types
, babel-types
// <X> wasn't stripped out
const find = <X> (f: (x:X) => X, xs: Array<X>): ?X => (
xs.reduce(((b, x) => b ? b : f(x) ? x : null), null)
)
babel-generator
, babel-plugin-transform-flow-comments
babel-register
babel-core
babel-traverse
babel-plugin-transform-es2015-destructuring
We noticed that we can not make this optimizations if there are function calls or member expressions on the right hand side of the assignment since the function call or the member expression (which might be a getter with side-effect) could potentially change the variables we are assigning to.
[x, y] = [a(), obj.x];
// was tranforming to
x = a();
y = obj.x;
// now transforms to
var _ref = [a(), obj.x];
x = _ref[0];
y = _ref[1];
babel-types
babel-code-frame
Before
After
babel-core
babel-helper-replace-supers
thisReference
argument to getSuperProperty
. (@eventualbuddha)babel-generator
babel-core
, babel-plugin-transform-es2015-arrow-functions
, babel-plugin-transform-es2015-destructuring
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-parameters
babel-core
, babel-helpers
Cleanup tests, remove various unused dependencies, do not run CI with only readme changes.
babel-plugin-transform-es2015-modules-amd
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-modules-umd
babel-generator
, babel-plugin-transform-es2015-modules-amd
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-modules-systemjs
, babel-plugin-transform-es2015-modules-umd
, babel-plugin-transform-flow-strip-types
babel-plugin-transform-es2015-function-name
babel-plugin-transform-es2015-parameters
, babel-traverse
babel-polyfill
babel-preset-es2015
babel-plugin-transform-regenerator
babel-code-frame
babel-helper-transform-fixture-test-runner
First PRs!
#3612 The main change is an option to transform-runtime
for a custom path which will be used in create-react-app. Also some bug fixes.
{
"plugins": ["transform-runtime", {
"moduleName": "my-custom-babel-runtime"
}]
}
#3689 Adds a preserveComments
option to babel-template
.
It's @ben-eb, @d4rkr00t, and @ryb73 first PRs!
babel-plugin-transform-runtime
babel-template
, babel-traverse
, babel-types
babel-plugin-transform-es2015-block-scoping
babel-types
babel-traverse
babel-helper-builder-binary-assignment-operator-visitor
, babel-plugin-transform-es2015-classes
babel-traverse
, babel-types
Lots of stuff in this release!
es2017
: it includes the 2 previous stage-3 plugins: async/await (via transform-async-to-generator) and trailing commas in functions. (thanks to @bettiolo for the npm package)npm install babel-preset-es2017 --save-dev
// .babelrc
{ "presets": ["es2017"] }
latest
that transforms ES2015+ (currently ES2015, ES2016, ES2017). You can also pass options down to the es2015
preset.We also will be working on getting a target/env (autoprefixer) preset soon.
npm install babel-preset-latest --save-dev
// .babelrc
{ "presets": ["latest"] }
// with options
{ "presets": [
["latest", {
"es2015": {
"modules": false
}
}]
] }
spec
option for the es2015
preset since the arrow function/template string plugins support this option.
spec
for arrow functions uses.bind(this)
, instead of renaming, to makethis
available inside the transformed function. It also adds a runtime check to make sure they are not instantiated (since they transform into bound regular functions).spec
for template literals wraps all expressions inString
rather than simple string concatenation.
// .babelrc
{
"presets": [
["es2015", { "spec": true }]
]
}
#3659 @kittens added an optional wrapPluginVisitorMethod
callback to transform to allow for performance tracking/introspection of plugins. More docs will be added on the website soon.
#3658 sourcemaps will also now have a names
field for identifiers to allow debuggers to do re-aliasing of mangled identifiers.
#3518 For spec compilancy, we now will throw on a file with multiple export default.
loose
mode.ignore
config option in .babelrc
.transform-class-properties
.babel-core
It's also a lot folk's first PR (or first code PR)!
babel-preset-es2015
babel-preset-latest
babel-preset-latest
. (@hzoo)babel-preset-latest
. (@sotayamashita)babel-preset-es2017
babel-core
, babel-traverse
babel-cli
, babel-core
, babel-generator
, babel-plugin-transform-regenerator
, babel-template
, babel-traverse
babel-generator
, babel-types
babel-plugin-transform-es2015-modules-amd
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-modules-umd
babel-core
, babel-helper-replace-supers
, babel-plugin-transform-class-properties
, babel-plugin-transform-es2015-classes
, babel-plugin-transform-es2015-function-name
, babel-plugin-transform-es2015-object-super
, babel-plugin-transform-es2015-parameters
babel-cli
babel-plugin-transform-es2015-modules-systemjs
babel-generator
babel-register
babel-plugin-transform-es2015-block-scoping
babel-traverse
babel-plugin-transform-flow-strip-types
babel-preset-es2015
, babel-preset-latest
babel-preset-es2015
Hi again, just fixing up logic from the backwards-compatibility fix which broke options in presets. Also added more tests and will update Babel to use the new preset options after this release.
babel-core
, babel-preset-es2015
We had a regression in our new babel-preset-es2015@6.13.0 that made it unexpectedly backward-incompatible. This release introduces a new alternative plugin-options approach that is uglier but supports backward-compatiblity. Ideally new plugins would use the new module.exports = function(babel, options){ }
approach and simple skip supporting babel-core@<6.13.x
.
babel-core
, babel-preset-es2015
Since the last release we've created https://github.com/babel/notes to track discussions on our slack and high level features/changes that could be added - definetely check it out if you're interested in Babel's development!
Some small but very important additions in this release:
Initially, presets were supposed to be one-off sets of plugins that didn't have any configuration. If you wanted to do something different you would make your own presets. There are > 600 presets on npm now. We want to give users more flexibility in certain cases: like when you want to pass the same option to multiple presets or to remove a default plugin.
loose
and modules
options for babel-preset-es2015
(#3331, #3627)This has been rather annoying. Having to install babel-preset-es2015-loose-native-modules
seems rather crazy when it could be an option.
With #3627, you can pass 2 options in:
loose
- Enable "loose" transformations for any plugins in this preset that allow them (Disabled by default).modules
- Enable transformation of ES6 module syntax to another module type (Enabled by default to "commonjs"
).
Can be false
to not transform modules, or one of ["amd", "umd", "systemjs", "commonjs"]
// for loose and native modules
{
presets: [
["es2015", { "loose": true, "modules": false }]
]
}
babel-preset-stage-2
babel-preset-es2017
, babel-preset-latest
(still deciding the name), supporting codemods, and more!babel-core
, babel-preset-es2015
babel-preset-stage-1
, babel-preset-stage-2
babel-plugin-transform-class-properties
to stage 2. (@kripod)babel-traverse
path.evaluate
treats repeated identifiers as undefined. (@erikdesjardins)babel-plugin-transform-decorators
babel-types
babel-plugin-syntax-async-functions
, babel-plugin-syntax-async-generators
, babel-plugin-syntax-class-constructor-call
, babel-plugin-syntax-class-properties
, babel-plugin-syntax-decorators
, babel-plugin-syntax-do-expressions
, babel-plugin-syntax-exponentiation-operator
, babel-plugin-syntax-export-extensions
, babel-plugin-syntax-flow
, babel-plugin-syntax-function-bind
, babel-plugin-syntax-function-sent
, babel-plugin-syntax-jsx
, babel-plugin-syntax-object-rest-spread
, babel-plugin-syntax-trailing-function-commas
babel-plugin-transform-inline-environment-variables
, babel-plugin-transform-member-expression-literals
, babel-plugin-transform-merge-sibling-variables
, babel-plugin-transform-minify-booleans
, babel-plugin-transform-node-env-inline
, babel-plugin-transform-property-literals
, babel-plugin-transform-remove-console
, babel-plugin-transform-remove-debugger
, babel-plugin-transform-simplify-comparison-operators
, babel-plugin-transform-undefined-to-void
helpers: false
option to transform-runtime
to not bundle in babel helpers.exactGlobals
option to modules-umd
modules-systemjs
react-constant-elements
(@kittens is back!)babel-plugin-transform-react-constant-elements
, babel-traverse
babel-plugin-transform-es2015-modules-systemjs
babel-plugin-transform-runtime
babel-plugin-transform-es2015-modules-umd
babel-register
babel-plugin-transform-es2015-modules-systemjs
Thanks to Rob Eisenberg (EisenbergEffect), Keyan Zhang (keyanzhang), Rolf Timmermans (rolftimmermans), Thomas Grainger (graingert),
we have few fixes: fix babel-register
file paths on error, infer class name for classes with class properties, fix export *
to account for previously compiled modules.
babel-plugin-transform-es2015-modules-amd
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-modules-systemjs
, babel-plugin-transform-es2015-modules-umd
babel-register
babel-plugin-transform-class-properties
In this release among other things are some more optimizations for babel-generator (#3584, #3580) as well as refactors.
@jamestalmage did some awesome clean for OptionsManager and some tests which may help future improvements to babel-register
performance.
babel-plugin-transform-remove-console
, babel-plugin-transform-remove-debugger
, babel-traverse
babel-plugin-transform-regenerator
babel-cli
babel-core
babel-generator
, babel-plugin-transform-es2015-modules-commonjs
babel-plugin-transform-es2015-parameters
babel-generator
The main fix is @loganfsmyth's changes of some parts in babel-generator in #3565 to fix issues with exponential code generation times in certain cases.
Items: the size of the array being generated Time: The time in ms to generate the code Length: The number of characters in the output code
Items | Old Time | New Time | Length |
---|---|---|---|
2 | 9 | 7 | 239 |
4 | 2 | 5 | 465 |
8 | 6 | 5 | 917 |
16 | 6 | 6 | 1840 |
32 | 15 | 11 | 3696 |
64 | 25 | 3 | 7408 |
128 | 93 | 13 | 14917 |
256 | 380 | 18 | 30149 |
512 | 1399 | 45 | 60613 |
1024 | 5301 | 63 | 121614 |
2048 | 20676 | 117 | 246542 |
babel-plugin-transform-es2015-parameters
babel-generator
babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-strict-mode
babel-preset-es2016
babel-generator
babel-types
Update docs + scripts @ForbesLindesayes2016
preset which includes the exponentiation operator (thanks for (@ysmood) for giving us the npm package).trailing-function-commas
plugin has been moved from stage-2
preset to stage-3
preset.babel-plugin-transform-react-jsx-self
has been added to the react
preset in development
mode. There is a new dev warning being added in react and this plugin adds the __self={this}
JSX attribute to all JSX elements.babel-plugin-es2015-unicode-regex
has it's regexpu-core
dependency updated to 2.x
.babel-preset-es2016
es2016
preset. (@chicoxyzzy)babel-preset-stage-2
, babel-preset-stage-3
trailing-function-commas
to stage 3. (@jacobrask)babel-plugin-transform-react-jsx-self
, babel-preset-react
babel-plugin-transform-es2015-unicode-regex
regexpu-core@2.0.0
for ES2016 compliance. (@mathiasbynens)babel-plugin-transform-react-jsx-self
babel-generator
babel-code-frame
babel-traverse
babel-core
2.x
to 3.x
for minimatch
to avoid a deprecation warning (@theJian)babel-plugin-transform-es2015-modules-commonjs
@loganfsmyth made some awesome optimizations and better whitespace handling for babel-generator
again (~10-15% performance improvement)!
Also a small fix for babel/babel-eslint#321
babel-generator
--skip-initial-build
(@lxe)babel-cli
: Add a new option --skip-initial-build
(#3489) (@lxe)
Do not compile files before watching
$ babel src -d dest --watch --skip-initial-build
babel-plugin-transform-es2015-block-scoping
: Create a new lexical environment inside switch statement blocks for identifier bindings (#3490, T7324) (@jayphelps)let foo = false;
switch (true) {
default:
let foo = true;
}
alert(foo); // should be false
babel-types
, babel-generator
: Support changes in flow parsing in babylonAdd support for a TypeParameter
node.
type A<T = string> = T;
class A<S = number, T: ?string = string> {};
Fixup missing dependency.
babel-runtime
: Fix an issue with getting Cannot find module 'regenerator-runtime'
because it was set as a devDependency instead of a dependency.Just 2 fixes this release!
this
correctly when using async arrow function class properties without a super class).react-constant-elements
plugin to help optimize react more (the plugin wasn't applying to JSX with text).Also, thanks to @mucsi96 for catching the extraneous code coverage comments we were leaving when publishing!
We are removing/deprecating
babel-regenerator-runtime
in favor of depending on the originalregenerator-runtime
since the differences are resolved. Thanks to (@benjamn) for the suggestion to maintain it (and for originally creating it!).
babel-core
The fix correctly set this: var _this;
-> var _this = this;
// input
class MyClass {
myAsyncMethod = async () => {
console.log(this);
}
}
// output
class MyClass {
constructor() {
var _this = this; // _this wasn't being set to `this`
this.myAsyncMethod = babelHelpers.asyncToGenerator(function* () {
console.log(_this);
});
}
}
babel-plugin-transform-react-constant-elements
, babel-types
JSX with text in it was not being hoisted as other constant elements.
// input
var Foo = React.createClass({
render() {
return <div>Text</div>; // text wasn't considered constant
}
});
// output
var _ref = <div>Text</div>;
var Foo = React.createClass({
render() {
return _ref;
}
});
#3513 Make sure the env is production when publishing. (@hzoo)
babel-regenerator-runtime
babel-core
babel-polyfill
, babel-regenerator-runtime
, babel-runtime
core-js
from 2.1.0
to 2.4.0
. Check the releases for more info.systemGlobal
option in the systemjs transform.["transform-es2015-modules-systemjs", {
// outputs scoped_system.register(...)
"systemGlobal": "scoped_system" // defaults to System.register
}]
class-properties
and react-jsx-source
plugins.babel-types
babel-plugin-transform-runtime
, babel-polyfill
, babel-register
, babel-runtime
babel-plugin-transform-es2015-modules-systemjs
systemGlobal
option to allow changing the System
in System.register
to be systemGlobal
. Also move use strict
wrapping. (@guybedford)babel-plugin-transform-react-jsx-source
babel-plugin-transform-class-properties
babel-traverse
babel-plugin-transform-es2015-parameters
ClassProperty
for rest param deopt check, fixes T7311. (@jayphelps)Upgrade to lodash 4.
babel-traverse
babel-helper-fixtures
babel-generator
babel-cli
, babel-core
, babel-generator
, babel-helper-builder-react-jsx
, babel-helper-define-map
, babel-helper-fixtures
, babel-helper-regex
, babel-helper-transform-fixture-test-runner
, babel-plugin-transform-es2015-block-scoping
, babel-plugin-transform-es2015-function-name
, babel-plugin-transform-proto-to-assign
, babel-preset-es2015
, babel-register
, babel-runtime
, babel-template
, babel-traverse
, babel-types
Thanks to amasad, dlwalsh, forivall, frantic, graingert, guybedford, jayphelps, jhen0409, loganfsmyth, shuhei, zloirock!
Babel is now compiled with Babel 6!
TLDR: This fixes the npm deduping issues regarding babel-runtime 5 and 6.
Example:
└─┬ babel-plugin-transform-exponentiation-operator@6.5.0
├─┬ babel-helper-builder-binary-assignment-operator-visitor@6.6.5
│ ├─┬ babel-helper-explode-assignable-expression@6.6.5
│ │ └── babel-runtime@5.8.38
│ └── babel-runtime@5.8.38
├─┬ babel-plugin-syntax-exponentiation-operator@6.5.0
│ └── babel-runtime@5.8.38
└── babel-runtime@5.8.38
Now it should be more like:
└─┬ babel-runtime@6.8.0
└─┬ babel-plugin-transform-exponentiation-operator@6.8.0
├─┬ babel-helper-builder-binary-assignment-operator-visitor@6.8.0
│ ├─┬ babel-helper-explode-assignable-expression@6.8.0
├─┬ babel-plugin-syntax-exponentiation-operator@6.8.0
Related issues: T7252, T7275, T6689, sindresorhus/ava#660, vuejs/vue-loader#96, etc.
for
loop. (@mattkrick)babel-code-frame
babel-core
this
references in constructor
after super()
(@loganfsmyth)babel-generator
babel-plugin-transform-es2015-modules-commonjs
babel-generator
, babel-types
babel-traverse
babel-traverse
babel-core
/babel-cli
babel-helper-builder-react-jsx
babel-generator
babel-plugin-transform-runtime
babel-traverse
babel-traverse
This bug was causing issues internally because the context system relies on the queues being balanced when deciding what nodes need to be re-processed and which do not. When it becomes imbalanced, nodes can be forgotten or skipped, causing issues like https://phabricator.babeljs.io/T7199 which broke ES6 modules on IE8 with the ES3 transforms.
This bug was causing scoping issues in some cases if a node was moved to a new location that was not nested inside a new scope. When this case was hit, the old cached scope would be used, causing issues like https://phabricator.babeljs.io/T7194, https://phabricator.babeljs.io/T6934, and https://phabricator.babeljs.io/T6728.
babel-runtime
babel-plugin-transform-react-jsx
babel-traverse
.babelrc
file. (@callumlocke)babel-core
babel-code-frame
line-numbers
dependency which was broken due to the unexpected unpublishing of its dependency left-pad@0.0.3
.babel-traverse
Flow fix, mention babylon move
We are treating static type information as part of the runtime scope information. So a Flow type declaration was being considered a binding on the scope. This was specifically problematic when we thinking that we're overwriting a binding:
The following code:
declare class foo {}
const foo = 1;
Will result in the error: "foo" is read-only
Since removing support for flow-based bindings would be a breaking change, in this release I'm adding a warning whenever someone tries to use Flow types as bindings.
babel-code-frame
, babel-generator
, babel-messages
, babel-plugin-undeclared-variables-check
, babel-polyfill
, babel-register
, babel-traverse
, babel-types
babylon
babel-plugin-transform-es2015-block-scoping
The following code:
let foo = () => {
foo = () => { };
};
foo();
Was generating:
var foo = function foo() {
foo = function foo() {};
};
foo();
Notice how the function name foo
was is shadowing the upper scope variable. This was fixed and the generated code now is:
var _foo = function foo() {
_foo = function foo() {};
};
_foo();
Notable changes:
Move cache into a clearable WeakMap, adds traverse.clearCache
and traverse.copyCache
. This doubles as a bug fix because previously reusable AST Nodes would carry their cache with them even if they're used across multiple files and transform passes.
babel-generator
, babel-plugin-transform-flow-comments
, babel-plugin-transform-flow-strip-types
, babylon
// examples
class C<+T,-U> {}
function f<+T,-U>() {}
type T<+T,-U> = {}
This syntax allows you to specify whether a type variable can appear in
a covariant or contravariant position, and is super useful for, say,
Promise
. @samwgoldman can tell you more 😄.
More docs on this in the babel-generator
README
Make sure all existing let/const bindings are removed and replaced with vars after the block-scoping plugin is run.
This fixes: SyntaxError: src/foo.js: "baz" is read-only (This is an error on an internal node. Probably an internal error. Location has been estimated.)
async function foo() {
async function bar() {
const baz = {}; // was creating a read-only error
}
}
babel-core
, babel-traverse
, babel-helper-remap-async-to-generator
, babel-helper-replace-supers
, babel-plugin-transform-async-to-generator
, babel-plugin-transform-async-to-module-method
Should fix the majority of issues dealing with async functions and use of parameters, this
, and arguments
.
// fixes
class Test {
static async method2() {
setTimeout(async (arg) => {
console.log(this); // was showing undefined with arg
});
}
async method2() {
setTimeout(async (arg) => {
console.log(this); // was showing undefined with arg
});
}
}
babel-helper-remap-async-to-generator
, babel-plugin-transform-async-to-generator
, babel-plugin-transform-async-to-module-method
The problem is that the name bar
of FunctionExpression
is only visible inside that function, not in foo
or ref
.
// input
var foo = async function bar() {
console.log(bar);
};
// before
var foo = function () {
var ref = babelHelpers.asyncToGenerator(function* () {
console.log(bar);
});
return function bar() {
return ref.apply(this, arguments);
};
}();
// now
var foo = function () {
var ref = babelHelpers.asyncToGenerator(function* () {
console.log(bar);
});
function bar() {
return ref.apply(this, arguments);
}
return bar
}();
babel-plugin-transform-es2015-parameters
Many fixes to rest params: function asdf(...rest) { ... }
babel-template
babel-plugin-transform-es2015-modules-commonjs
babel-plugin-transform-es2015-modules-commonjs
amasad, divmain, hzoo, jmm, keijokapp, loganfsmyth, samwgoldman
And.. some more bug fixes!
babel-plugin-transform-es2015-computed-properties
// lead to `ReferenceError: b is not defined` at runtime
var obj = {
["a"]: 5,
set b(x) { console.log('set b', x); }
};
obj.b = 55;
babel-plugin-transform-object-rest-spread
, babel-types
import props from 'props';
console.log(props);
(function(){
const { ...props } = this.props;
console.log(props); // props was referencing the imported props rather than in object spread
})();
babel-plugin-transform-es2015-block-scoping
Scope binding info wasn't updated after converting const/let/block bindings to var which could lead to errors with other transforms.
babel-core
, babel-plugin-transform-es2015-block-scoping
, babel-plugin-transform-es2015-classes
babel-plugin-transform-es2015-modules-amd
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-modules-umd
AgentME, amasad, benjamn, hzoo, loganfsmyth
Some more fixes!
babel-plugin-transform-es2015-duplicate-keys
// sample code that was erroring
const obj = {
set a (a) {
values.a = a;
},
get a () {
return values.a;
}
};
babel-core
// .babelrc
{
"plugins": ["./myPluginDir/somePlugin.js"]
}
Babel will now resolve the plugin above relative to the directory that contains the .babelrc file rather than the process.cwd()
.
A lot of packages
Since users were getting error reports since Babel's codebase wasn't typechecking correctly. (Ref T7114) - Will be adding it back into the codebase itself soon.
babel-plugin-transform-es2015-modules-commonjs
, babel-traverse
// example code
`export * from './a'`
babel-plugin-transform-es2015-modules-commonjs
, babel-traverse
// example code
export var bar = (gen, ctx = null) => {}
babel-runtime
, babel-polyfill
: Fix publishing issue (wasn't updated from before).Whoo a :frog: leap day release!
We finally fixed both T2817, T6863 where using both transform-es3-member-expression-literals
and transform-es2015-modules-commonjs
!
exports.default = {};
// was not to transformed to
exports["default"] = {};
You should be able to remove es3ify
(a useful workaround for this issue). Thanks everyone for your patience, and much thanks to @loganfsmyth for the fix!
# before
ReferenceError: [BABEL] unknown: Unknown option: base.stage
# now
ReferenceError: [BABEL] unknown: Using removed Babel 5 option: base.stage
- Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets
# another example
ReferenceError: [BABEL] unknown: Using removed Babel 5 option: base.externalHelpers
- Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/
# before
babel Plugin is not a function
# now
The object-assign Babel 5 plugin is being run with Babel 6.
core-js
was updated to ^2.1.0
.babel-plugin-transform-es2015-duplicate-keys
babel-plugin-transform-es2015-duplicate-keys
, babel-preset-es2015
babel-plugin-transform-es2015-duplicate-keys
is a new plugin that is included in the es2015 preset. It was added since ES5 doesn't allow duplicate properties (it is valid in ES2015 strict mode however).
It will compile objects with duplicate keys to computed properties, which can be compiled with the transform-es2015-computed-properties
plugin.
Example:
// .babelrc
{ "plugins": ["transform-es2015-duplicate-keys"] }
// Input
var x = { a: 5, "a": 6 };
// Output
var x = { a: 5, ["a"]: 6 };
globals
option for transform-es2015-modules-umd
babel-plugin-transform-es2015-modules-umd
// Adds a new plugin option to let you override the names of globals
// .babelrc
{
"plugins": [
["transform-es2015-modules-umd", {
"globals": {
"es6-promise": "Promise"
}
}]
]
}
babel-plugin-transform-es2015-modules-commonjs
, babel-traverse
babylon
babel-generator
babel-plugin-transform-es2015-parameters
// .babelrc
{ plugins: ["transform-es2015-parameters"] }
// Fixes an internal error with the code:
function x (...items) {
items[0] = 0;
}
babel-helper-remap-async-to-generator
, babel-plugin-transform-es2015-parameters
// .babelrc
{
"plugins": ["external-helpers", "transform-es2015-parameters", "transform-async-to-generator"]
}
// Fixes an issue with using incorrect `arguments`
var x = async (...rest) => {
if (noNeedToWork) return 0;
return rest;
};
babel-plugin-transform-regenerator
, babel-traverse
Fixes the _regeneratorRuntime is not defined
error when using transform-runtime
/transform-regenerator
(this happened when using polyfillable code in core-js
.
babylon
babel-plugin-transform-es2015-block-scoping
babel-generator
// input
void (() => {});
// correct output
void (() => {});
// wrong
void () => {};
babel-generator
// input
(0xFFFF).toString()
// correct output
0xFFFF.toString()
// wrong
0xFFFF..toString()
babel-plugin-transform-regenerator
babel-plugin-transform-object-set-prototype-of-to-assign
babel-cli
babel-plugin-transform-runtime
, babel-polyfill
, babel-register
, babel-runtime
babel-core
, babel-traverse
babel-core
babel-core
We have 15 committers this release!
Thanks to: AgentME, clayreimann, erikdesjardins, forivall, gzzhanghao, hzoo, jmm, jridgewell, kittens, loganfsmyth, samwgoldman, schmod, siroky, tiemevanveen, zloirock
Changes to note:
babel-register
.babel-plugin-transform-class-properties
, babylon
babel-core
, babel-register
babel-plugin-transform-es2015-spread
super
method calls. (@eetulatja) // input
super.method(...args);
// wrong output
super.method.apply(super, babelHelpers.toConsumableArray(args));
// new fixed output
super.method.apply(this, babelHelpers.toConsumableArray(args));
babel-plugin-transform-function-bind
, babel-types
BindExpression
callee for reference - fixes T6984. (@loganfsmyth)babel-register
babel-plugin-transform-async-to-module-method
, babel-plugin-transform-es2015-arrow-functions
, babel-plugin-transform-es2015-classes
, babel-plugin-transform-es2015-computed-properties
, babel-plugin-transform-es2015-for-of
, babel-plugin-transform-es2015-modules-commonjs
, babel-plugin-transform-es2015-spread
, babel-plugin-transform-es2015-template-literals
, babel-plugin-transform-react-jsx
, babel-plugin-transform-regenerator
, babel-plugin-transform-runtime
, babel-plugin-transform-strict-mode
babel
babel
package.. (@loganfsmyth)babylon
stable
NodeJS to latest 4.x.x & 5.x.x. (@ntwb)bc2f84f371
Fix options being ignored in babel-register
.ExportSpecifier
node validator validating imported
instead of exported
.Happy Superbowl Sunday! There's many contributors (17 + core) this release!
This is an experimental feature that will most likely change. Depending on usage/feedback, we will switch the way this is used to instead define a explicit preset-level config flag (rather than the global one below). This will give more control over how you want to use this option.
@DmitrySoshnikov added a new option you can put in your .babelrc
!
{
passPerPreset: true,
presets: [
{
plugins: ['plugin-1']
},
'preset-2',
{
plugins: ['plugin-2']
}
]
}
// this will create 3 traversals
passPerPreset: true
will modify how babel traverses through plugins. Instead of a single traversal in which all plugins/presets are merged together, each preset will get their own traversal.
This allows users to have a specific order to how presets/plugins are applied and can help avoid potential collisions between plugins (and probably some known issues).
@gzzhanghao made some awesome changes to improve our code generator's performance (babel-generator
). The original issue is here.
Based on his test (on parsing jquery.js
), performance improved ~3x.
===== origin/master (ms) =====
babylon 265
babel generator 2238 <-- old
acorn 107
escodegen 355
esprima 95
escodegen 322
===== Optimized (ms) =====
babylon 296
babel generator 662 <-- new
acorn 113
escodegen 355
esprima 106
escodegen 317
A big change had to do with keeping this.last
as an instance variable in the buffer instead of this.buf[this.buf.length -1]
.
You can read more about his changes here. Hoping to see more PR's like this!
We will try to setup some perf tests soon to track these stats for the future (or you can help!).
babel-core
babelrc
option in babel-register
. (@CrocoDillon)babel-core
passPerPreset
option in .babelrc
: if true
, babel will create a new traversal for each preset. (@DmitrySoshnikov)babel-helper-transform-fixture-test-runner
, babel-plugin-transform-react-jsx-source
This plugin (useful for tooling) will turn
// this/file.js
<sometag />
into
var _jsxFileName = "this/file.js"; // the output will be an absolute path
var x = <sometag __source={{
fileName: _jsxFileName,
lineNumber: 1
}} />;
babel-template
babylon
options into babel-template
. (issue T7046) (@jamestalmage)babel-core
// analyse not analyze :D
// usage
babel.analyse("foobar;", {}, {
Program: function (path) {
path.mark("category", "foobar");
}
}).marked[0].message // outputs "foobar"
// allows for either `|` or `&`
type union =
| {type: "A"}
| {type: "B"}
;
This was added in flow in
7fb56ee9d8
.
Code samples below each bullet
babel-helper-define-map
, babel-helper-function-name
, babel-plugin-transform-es2015-classes
// When the same name as a method in a class is used
class Foo {
constructor(val) {
this._val = val;
}
foo2() {
return foo2(this._val); // was erroring since foo2 is used
}
}
babel-helper-remap-async-to-generator
, babel-plugin-transform-async-to-generator
this
for nested arrow functions. (Issue T2765#72428) (@horpto)// nested arrow functions
class A {
async method() {
() => {
() => this; // `this` in nested arrow function was incorrect
}
}
}
babel-template
node.loc
. Fixes an issue with sourcemap generation for SystemJS with babel-template
. (Issue T6903) (@guybedford)babel-traverse
// a generator with a default argument
export class Test {
*memberGenerator(arg = 0) {
console.log(arg);
}
start() {
this.memberGenerator(1).next();
}
}
babel-generator
var fn = () => ({}).key;
babel-helper-remap-async-to-generator
, babel-plugin-transform-es2015-modules-commonjs
foo();
async function foo() {} // this should be hoisted above foo();
babel-generator
// nested for loop
for (function(){for(;;);} && (a in b);;);
babylon
const X = (
props: SomeType,
): ReturnType => (
3
);
Decorator
property. (@hzoo)BindExpression
. (@hzoo)Literal
and Pattern
interfaces, update Identifier
interface. (@jmm)make
publish
: add make build
in case it wasn't run. (@hzoo)babel-generator
babel-core
, babel-generator
, babel-traverse
, babel-types
,babylon
babel-core
babel-plugin-transform-async-to-generator
babel-generator
babel-cli
babel-types
babel-types
babel-generator
babel-helper-remap-async-to-generator
: #3288 Async arrow functions should compile to regular functions because they reference arguments
.Bug Fix
babel-plugin-transform-es2015-modules-commonjs
: #3118 Fix bad import hoisting interaction (copy _blockHoist
values) regarding import statements. (T6738). Thanks @benjamn for your patience for this one!tag(_templateObject);
* `babel-types`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-generator`: [#3183](https://github.com/babel/babel/pull/3183) Fix various source map issues. ([T6851](https://phabricator.babeljs.io/T6851)). Thanks for your work @kpdecker! Committed as [`de51bf5`](https://github.com/babel/babel/commit/de51bf5486bd038455d3d450ff34aa86111c3b91)
* `babel-helper-remap-async-to-generator`: [#3257](https://github.com/babel/babel/pull/3257) Fix issue with using `this` inside an arrow function ([T2765](https://phabricator.babeljs.io/T2765)). Thanks @horpto!
- This fixes:
```js
class A {
async method() {
() => this; // this `this` wasn't being transpiled correctly
}
}
babylon
: #3272 Dedupe parser opts from passsed in multiple times. (T3084). Thanks @AgentME!syntax-flow
and transform-flow-strip-types
which caused an issue with the flow types not to be stripped and the general case of other people are including the flow syntax option in their own plugins.babel-helper-define-map
, babel-traverse
, babel-plugin-transform-es2015-classes
: #3274 Prevent method names in classes from being locally bound to the transformed function body. (T6712). Thanks @willheslam for helping to debug and coming up with alternative solutions for this issue!js
SyntaxError: index.js: "foo" is read-only (This is an error on an internal node. Probably an internal error. Location has been estimated.)
1 | class Component {
2 | foo() {
3 | const foo = obj;
4 | }
5 | }
6 |
babel-helpers
: #3276 Add missing return statements to asyncToGenerator
helper.babel-plugin-transform-es2015-modules-commonjs
: #3282 Fixes an issue with using default
as a specifier in an export.js
export {default as foo} from "foo";
Documentation
Internal
babel-plugin-transform-es2015-parameters
: #3263 Test coverage.babel-core
: #3268 Add a test for (T2892)..bin
references. Thanks @charliesome!babylon
: #3284 Add some more flow types. Thanks @bmeck!Polish
babel-plugin-transform-es2015-parameters
: #3264 Simplify code, add comments.babel-plugin-transform-regenerator
: Publishing issue (T2892).Bug Fix
babel-plugin-transform-es2015-typeof-symbol
: #3250 The typeof transform should always use the global Symbol
.babel-plugin-transform-es2015-modules-amd
: #3252 Stop leaking directivesbabel-pluginn-transform-es2015-unicode-regex
: #3259 Use only regexpu-core
instead of all of regexpu
babel-generator
: Fix minified labeledStatement printingbabel-plugin-transform-regenerator
: #3162 Make sure babel helper picks up regeneratorRuntime
Polish
Documentation
babel-generator-options
: #3251 Document babel-generator optionsbabylon
: #3244 fix error location for class properties with a missing semicolon (Ref #3225).babel-plugin-transform-es2015-parameters
: #3246 Support expressions in rest arg access for arguments.length
optimization.babel-generator
: #3247 Parenthesize await/yield expression in BinaryExpression
(Ref #3229).Thanks to @samwgoldman for all the new flow support!
New Feature
babylon
, babel-types
, babel-generator
: #3202 Add support for this
flow type.babylon
, babel-types
, babel-generator
: #3236 Add support for export interface
flow syntax.babylon
, babel-types
, babel-generator
, babel-plugin-transform-flow-strip-types
, babel-plugin-transform-flow-comments
: #3230 Add support for declare type
and declare interface
flow syntax.babylon
, babel-types
, babel-generator
, babel-plugin-transform-flow-strip-types
, babel-plugin-transform-flow-comments
: #3203 Add support for flow mixins.babel-cli
: #3221: Handle --nolazy
flag.babel-plugin-transform-es2015-modules-systemjs
: #3166 Add __moduleName
support to System.register
. Thanks @guybedford!Bug Fix
babel-plugin-transform-es2015-parameters
: #3214 Bugfix for arguments.length
optimization having the wrong length. Thanks @fabiomcosta!babylon
: #3220 Don't parse parenthesized string as a Directive
.babel-helpers
: #3218 Defer to the built-in typeof
if support for Symbols exists. Thanks @jdalton!babel-generator
: #3213 Fix various parentheses bugs.babel-plugin-transform-react-display-name
: #3216 More relaxed displayName
inference.babel-helper-function-name
: #3215 Set function names from AssignmentExpression
. Thanks @spicyj!babel-generator
: #3210 Use a print stack to determine in parenthesis needs to be added.babel-plugin-transform-runtime
: #3235 Ensure opts.polyfill = false
behaves correctly for all visitors. Thanks @guybedford!babel-plugin-transform-runtime
: Ensure regenerator
option doesn't cancel out core-js polyfill.babel-generator
: #3229 Check for parentheses for AwaitExpressions
and fix over-parentheses in YieldExpressions
.Breaking Change (Accidental)
Documentation
Internal
babel-plugin-external-helpers
: #3205 Renamed from babel-plugin-external-helpers-2
due to someone taking the npm name beforehand.babylon
: #3204 Prevent users from patching by building it.babel-types
: #3217 Add Binary
alias to AssignmentExpression
.Bug Fix
Spec Compliancy
Internal
Bug Fix
Internal
babel-plugin-transform-es2015-parameters
: #3165 Optimize arguments
accessSkipped 6.3.22.
Flow Comments
plugin from babel-plugin-flow-comments
to babel-plugin-transform-flow-comments
for naming consistency.Bug Fix
babel-generator
: #3173 Fix unhandled new-precedence edge cases regarding parentheses (fixes T6829).babel-generator
: #3180 Handle nested IfStatement
with an `alternate.babel-generator
: #3182 Parenthesize ArrowFunctionExpression
when part of a LogicalExpression
or BinaryExpression
(fixes T6836).babel-traverse
: #3171 Fix infinite recursion bug with introspection
method.transform-es2015-function-name
: #3176 Stop transforming ObjectMethod
(MethodDefinition
) to a FunctionExpression
since the transform-es2015-shorthand-properties
plugin already does it.transform-es2015-parameters
: #3143 Optimizations for RestElement
such as using arguments.length
(fixes T6774).Documentation
babel-core
: #3177 Clarify description of comments
file config.Internal
New Feature
babel-plugin-flow-comments
: #3157 Move babel-plugin-flow-comments
to the babel repo and update for babel 6.Bug Fix
babel-runtime
: #3142 Add a custom transform for babel-runtime
builds to avoid circular dependencies (Fixes the babel-runtime/helpers/typeof
issue).babel-traverse
: #3161 Only rename the *outer function bindings on name conflict.babel-generator
: #3167 Use the left most node from the right to check if we need spaces in BinaryExpressions
.Bug Fix
Polish
Bug Fix
babel-types
: #3153 DoWhileStatement should take node type Statement
as body.New Feature
babel-generator
: #3152 Add a new minified format option to do possibly dangerous byte saving.Internal
babel-traverse
: #3151 Support ObjectProperty in Scope.isPure
Polish
babel-cli
: #3150 Do not prefer global when installing babel-cliBug Fix
babel-traverse
:parent
and parentPath
for new a NodePath
(fixes an issue with export * from './a'
and es2015-modules-commonjs
).babel-generator
:""
in compact
mode for consistency (gzip). Will be changed in a new mode (a supserset of compact
) in a later patch.compact
mode.throw
statements with SequenceExpression
.Internal
babel-traverse
:UnaryExpression
in isPure
check.babel-generator
:()
from a NewExpressions
when possible (new x()
-> new x
).babel-helper-function-name
:babel-traverse
:babel-plugin-transform-es2015-destructuring
:babel-plugin-transform-es2015-classes
:async
and generator
properties when converting a ClassMethod
.Testing lerna - A tool for managing JavaScript projects with multiple packages.
babylon
, babel-types
, babel-generator
:NullLiteralTypeAnnotation
(null
literal type) in flow.babel-core
:babel-register
:.babelrc
a second time.babel-traverse
:BlockStatement
(fixes a babel-plugin-transform-class-properties
issue).babel-plugin-transform-class-properties
:babel-plugin-transform-es2015-classes
:return super()
in class constructor causing a super() hasn't been called
error.babel-plugin-transform-inline-environment-variables
:replaceWith
.babel-plugin-transform-regenerator
:Identifier
(fixes an issue with exporting a generator as a default).babel-generator
:(a+(+b*2))
should be -> a+ +b*2
Bug Fix
literal
to use stringLiteral
in babel-types.babel-template
crashing in IE due to unpopulated error stack.transform-class-properties
Polish
ObjectMember
abstract type to AST for ObjectProperty
and ObjectMethod
.asyncToGenerator
helper template.dirname
to unknown plugin resolution error.function.sent
.invariant
depenency version.package.json
babel
reading.id
.id
.Expression
alias to TypeCastExpression
.children
prop pushing to after props to ensure correct order in the react inline elements plugin.buildExternalHelpers
script ignoring non-underscored helpers.babel-plugin-transform-es2015-computed-properties
.__esModule
work for all plugins no matter how they're imported/specified.enter
/exit
visitor method.babel-runtime
version mismatch in babel-doctor
.defaultProps
helper when there are no props in the react inline elements plugin.runtime
plugin core-js
definitions.babel-plugin-transform-react-display-name
to the react
preset.babel/register
into a separate babel-register
package.react-jsx-source
plugin and add it to the react
preset.allowTopLevelThis
option to babel-plugin-transform-es2015-modules-commonjs
.NodePath#has
to ensure safeness when making comparisons.updateContext
of name
tokens in the parser to fix parsing of JSX and regexs with ASI.Symbol.hasInstance
transform out of babel-plugin-es2015-symbols
to babel-plugin-es2015-instanceof
as it has nothing to do with symbols.babel-browser
package with the browser build.babel-doctor
.babel/register
cache when it gets too big to be serialised.babel-doctor
when we get to the root.babel-doctor
CLI.t.getOuterBindingIdentifiers
to completely ignore function expressions as they cause no outer bindings to be set.auxiliaryComment
option.RegexLiteral
node to RegExpLiteral
.NumberLiteral
node to NumericLiteral
.ForStatement
optional.Symbol
existence check to typeof
helper.babel-template
.runtime
plugin helper generation.await
s converted to yield
s in the async to generator helper.arguments
.babel-plugin-transform-class-constructor-call
package.babel
complain package.babel-transform-regenerator
as we may have multiple packages interacting.babel-plugin-transform-es2015-modules-commonjs
to babel-preset-es2015
.loose
option in favor of plugin options.optional
, whitelist
and blacklist
options since plugins are now explicitly defined.Plugin
instance..call(state, path, state)
rather than .call(path, node, parent, scope, state)
.MethodDefinition
node type has been renamed to ClassMethod
and it's FunctionExpression
value
property has been coerced into the main method node.Property
node type has been renamed to ObjectProperty
.Property
node type with the boolean flag method
has been renamed to ObjectMethod
and it's FunctionExpression
value
property has been coerced into the main method node.Literal
node type has been unoverloaded and split into BooleanLiteral
, RegExpLiteral
, NumericLiteral
, StringLiteral
and NullLiteral
.SpreadProperty
(from object-rest-spread
) node type has been split into RestProperty
(for ObjectPattern
) and SpreadProperty
(for ObjectExpression
)module.exports
export interop for CommonJS module formatter.externalHelpers
option has been moved into the plugin babel-plugin-external-helpers-2
.enter
/exit
catch-all handlers in plugins.typeof-react-element
helper.define
method to avoid webpack assuming those files are AMD.optimisation.react.inlineElements
transformer to React 0.14 output. Thanks @spicyj!File
.export default
function
/class
token when parsing export default before converting to a declaration to avoid turning expressions into declarations.operator
property from AssignmentPattern
nodes.es7.asyncFunctions
and es7.objectRestSpread
to stage 2.The CHANGELOG was broken for these releases. Git tags were not pushed in the correct order and are therefore incorrect. It's recommended you NOT use any versions within this range.
es6.spec.modules
transformer.export *
should not export default
.--copy-files
flag.json5
for parsing .babelrc
files and JSON
for package.json
.0.8.35
.initialiser
to undefined
.typeof
cases in es6.spec.symbols
transformer.moduleRoot
etc.rawValue
for JSX inner text.BreakStatement
to be much more stable and cleaner.Object.setPrototypeOf
and fallback to __proto__
in inherits
helper.Issues with publish process.
@flow
being completely removed from output rather than just the specific directive.compact
mode causing large amounts of whitespace.compact
mode.replaceWithSourceString
method.shouldPrintComment
option to control comment output..babelignore
file to be consistent with other tools..babelrc
configs to be specified via package.json
.compact: true
option.import typeof
.babylon
.CodeGenerator.findCommonStringDelimiter
causing a stack overflow.recast
version to avoid pulling in a newer version.util.shouldIgnore
.this
assignment when referencing this inside an arrow function pre-bare super in derived class constructors.ForInStatement
init
variables in system
module formatter.PathHoister
: Don't hoist to the same function as their original paths function parent.PathHoister
: Push each violation paths ancestry to the breakOnScopePaths collection to avoid constant hoisting to nested paths.fix tail call recursion on functions with less arguments than parameters.super.*
before super()
in derived class constructors.** Internal
es6.parameters.rest
and es6.parameters.default
transformers. See commit c0fd4c1f9e0b18231f585c4fa793e4cb0e01aed1 for more info.null
when using computed properties.ForXStatement
left
var
s when inserting a block scoping IIFE.void
type annotations were being parsed as keywords causing the tokeniser to lose track of context.0.8.31
.ParenthesizedExpression
node type.babel
CLI when passing multiple matching patterns.Program
root node with another node not of type Program
.JSXMemberExpression
to t.isReferenced
.validation.undeclaredVariableCheck
transformer up.BindingIdentifier
virtual type.regenerator
.js-tokens
.resolve-rc
.alias-keys.json
causing errors in strict mode.$ babel --help
not showing optional transformers as such.auxiliaryCommentBefore
and auxiliaryCommentAfter
options.let
binding collision in loop head not properly replacing AssignmentExpression
s.file.opts
not being set before file.log.deprecate
was called causing a ReferenceError
as it was checking for a property on it.shouldIgnore
check.auxiliaryComment
option when attempting Istanbul interop in babel/register
.node
ClassProperty
instead of path
in the es6.classes
transformer.NodePath#isPure
on Property
nodes.babel/register
.ClassProperty
nodes always in the Flow
transformer. This is fine now since class properties aren't supported in any engine that supports classes but the es7.classProperties
transformer will need to be updated in the future to desugar to ES6 classes instead of relying on the es6.classes
transformer from being ran.SwitchStatement
s.minification.removeDebugger
to remove DebuggerStatement
s rather than ExpressionStatement
s with an identifier of debugger
.ForInStatement
and ForOfStatement
for constant violations.id
as a reference when naming methods to avoid collisions.displayName
property when attempting to add it for React.createClass
.ExportDefaultSpecifier
check from t.isDefaultSpecifier
.JSXIdentifier
HTML tag identifiers to be references.minification.deadCodeElimination
transformer to remove all statements after completion statements.minification.deadCodeElimination
transformer to not inline single used bindings that exist in different scopes.babel/register
, add the auxiliary comment "istanbul ignore text"
to get more accurate coverage.--nolazy
argument to babel-node
.cluster
forking.minification.inlineExpressions
transformer to minification.constantFolding
.node_modules
when using babel/register
.regenerator
.JSXAttribute
names
to be valid ReferencedIdentifier
s.spec.functionName
transformer incorrectly attempting to rename a binding that doesn't exist as it's a global.JSXIdentifier
as a valid ReferencedIdentifier
visitor virtual type.CallExpression
_prettyCall
when the retainLines
option is enabled.es6.tailCall
transformer failing on calls that exceed the max parameters of the function.for
loop would turn them into ExpressionStatement
s.class
id
to avoid breaking named classes when using compact
mode.sourceMapName
option to sourceMapTarget
. Thanks @getify!Function
s.\
babel-plugin-${name}`plugin names **before** just checking the
name`. Thanks @jquense!module
being incorrectly rewritten when used as in an export declaration.minification.deadCodeElimination
where a new binding instance was being created for local class bindings instead of just inheriting the parent one.compact
and retainLines
mode where a left paren was already printed before catching up.ignore
and only
patterns are now very liberal. The pattern can now exist anywhere in the path.slash
dependency. Thanks @browncolyn!shouldIgnore
algorithm to work how you'd expect rather than being a hacky piece of shit. It now crawls the entire path, checking each section of it against the input ignore/only patterns. This means that the pattern foo
will ignore the paths foo/bar.js
, bar/foo
etc.env
option. Especially handy when using the .babelrc
.babel.transform
ignores them when using $ babel
.VariableDeclaration
instead of VariableDeclarator
.$ babel
.PathHoister
to ignore global references and to not deopt on reassignments to referenced bindings, instead it tries to hoist to the highest scope.regenerator
transformer. Thanks @benjamn!minification.deadCodeElimination
transformer incorrectly trying to inline import declarations.minification.inlineExpression
transformer getting into an infinite loop.es6.blockScoping
transformer.Speeeeeeed
es7.trailingCommas
transformer.es6.blockScoping
transformer not properly ignoring break
in SwitchCase
.--harmony_generators
flag to $ babel-node
.utility
transformers to minification
.Super
node type to ast-types
patch.minification.deadCodeElimination
transformer.extensions
arguments when using the Babel CLI.nameMethod.property
when inferring the function name for class methods.initializer
property.retainLines
option to CLI.retainLines
option not being taken into consideration when doing multiple variable declaration declarators generation.ExportDeclaration
s being incorrectly removed when using the utility.deadCodeElimination
transformer.utility
transformers.esquery
support.getModuleName
option to getModuleId
, doh.replaceWithSourceString
. Thanks @pangratz!getModuleName
option. Thanks @jayphelps!_blockHoist
transformer incorrectly sorting nodes on shitty environments that aren't spec compliant in their key order.parse
API method reference to an undeclared import.utility.deadCodeElimination
transformer up to avoid race conditions.replaceWithSourceString
path API.es3.propertyLiterals
and es3.memberExpressionLiterals
transformers to minfication.propertyLiterals
and es3.memberExpressionLiterals
.Pipeline
as TransformerPipeline
instead.parse
API not adding all the correct pipeline transformers.transform.pipeline
.util.arrayify
to take arbitrary types and coerce it into an array.node/register
that caused node_modules
to not be ignored.:
which caused full paths on Windows to fail as they include :
after the drive letter.initializer
s with their target instead of their descriptor.ignore
and only
not properly working on Windows path separators. Thanks @stagas!resolveRc
running on files twice causing issues. Thanks @lukescott!isReferenced
checks. Thanks @monsanto!babel/register
only
and ignore
options. Thanks @Mark-Simulacrum!$ babel
as some shells such as Windows don't explode them. Thanks @jden!_ref
that we needed to create in specific scopes were done at the very end via the _declarations
transformer. Now, they're done and added to the scope right when they're needed. This gets rid of the crappy _declarations
property on scope nodes and fixes the crappy regenerator bug where it was creating a new BlockStatement
so the declarations were being lost.check
function for every single node in the AST is ridiculously expensive. 300,000 nodes timesed by ~30 transformers meant that it took tens of seconds to perform while it's quicker to just do the unnecessary traversal. Seems obvious in hindsight.jscript
transformer that turns named function expressions into function declarations to get around JScript's horribly broken function expression semantics. Thanks @kondi!@@hasInstance
support to objects when using the es6.spec.symbols
transformer.retainLines
option that retains the line (but not the columns!) of the input code.defineProperty
helper.resolveModuleSource
not being ran on ExportAllDeclaration
s..babelrc
being resolved multiple times when using the require hook.externalHelpers
option being incorrectly listed as type string
.core-js
to 0.9.0
.initializer
pattern.SwitchStatement
s to be Scopable
.bluebirdCoroutines
calling interopRequireWildcard
before it's defined.do...while
code generation.super
use before this
on super
exit rather than entrance.makePredicate
from acorn in favor of an indexOf
.undefined
values not being correctly writable.module
argument inclusion.acorn
.parse
node API.runtime
built-in catchall not properly checking for local variables.core-js
version.Reflect
methods to runtime transformer.core-js
runtime definitions.getIterator
and isIterable
to babel-runtime
build script.arguments
and eval
valid function names when doing function name inferrence.AwaitExpression
as a unary instead of an assignment.test
declaration to utility.deadCodeElimination
transformer.regenerator
to the latest and use my branch with the hope of eventually switching to vanilla regenerator.init
s with statements.apply
this
and arguments
if necessary.runtime
transformer.for...of
loops not properly inheriting their original loop..babelrc
JSON.moduleId
for UMD global name if available.module
variable shadowing the amd
/common
module
variable.toString
wrapper. Thanks @alawatthe!this
before super
for derived constructors on functions.--ignore
and --only
support to the CLI.HOMEPATH
environment variable from home resolution in babel/register
cache.Object.prototype
.var
.core-js
.util.list
.breakConfig
in resolveRc
.resolveRc
.breakConfig
option to prevent Babel from erroring when hitting that option.es3.runtime
, optimisation.react.inlineElements
and optimisation.react.constantElements
transformers.optional
instead of only via stage
.export { foo as default };
to be the same as export default foo;
.nonStandard
option that can be set to false
to remove parser support for JSX and Flow.jsxPragma
option..babelrc
on absolute paths.options
in browser API.SIGINT
.resolveModuleSource
on dynamic imports.param
to list of duplicate declaration kinds.returnUsedHelpers
to metadataUsedHelpers
.Promise
.this
when doing expression memoisation.playground.methodBinding
.regexpu
.playground.methodBinding
and playground.objectGetterMemoization
.inputSourceMap
option. Thanks @Rich-Harris!inputSourceMap
to be set to false
to skip the source map inference.break
colliding with the parent switch case.acorn-babel
.types
API exposure.stack
on an error is unconfigurable.esModule
module declarations to the top of the file to handle circular dependencies better.break
s to call the iterator return.Number
from the list of valid runtime
constructors.spec.typeofSymbol
transformer has been renamed to es6.symbols
."both"
option for sourceMap
.break
s within cases inside for...of
.alternate
to list of STATEMENT_OR_BLOCK
keys.t.isReferenced
.inputSourceMap
option.babel
and babel-runtime
versions.babel-node
eval.utility.deadCodeElimination
transformer.es6.blockScopingTDZ
transformer duplicating binding nodes.useStrict
transformer has been renamed to strict
.ForOfStatement
not proplery inheriting labels.utility.inlineEnvironmentVariables
and utility.inlineExpression
transformers.arguments
being incorrectly aliased in arrow function rest parameter optimisation.flow
transformer.util
for plugins.for...of
now outputs in a lengthy try...catch
this is to ensure spec compliancy in regards to iterator returns and abrupt completions. See google/traceur-compiler#1773 and babel/babel/#838 for more information.arguments
reference. Thanks @neVERberleRfellerER!$ babel
no longer exits on syntax errors.browserify
.source-map
.babel/register
.returnUsedHelpers
option and add whitelist to buildHelpers
.acorn-babel
.Babel now compiles itself!
.babelrc
support.bin/babel
behaviour to ignore non-compilable files and add a --copy-files
flag to revert to the old behaviour.MemberExpression
as a valid left
of ForOfStatement
.@jsx React.DOM
pragma as it conflicts with the custom jsx constructo method detection.@jsx
pragma.chalk
.core-js
.acorn-babel
.for...of
iterator break returns being duplicated.return
on the iterator if it exists.selfContained
transformer to runtime
.moduleId
option for specifying a custom module id./*** @jsx NAMESPACE **/
comments are now honored by the react
transformer.getModuleName
option.format
options and move the format.compact
option to format
.commonStandard
module formatter and make it the default behaviour of all the strict module formatters.__esModule
in loose mode.eval();
usage and enable strict mode for parsing.BABEL_CACHE_PATH
and BABEL_DISABLE_CACHE
environment variables.