Releases: babel/babel
v6.7.4
Bug Fix
babel-traverse
-
#3419: Keep the context stack balanced to ensure that contexts are properly popped off. (@loganfsmyth)
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.
-
#3420: Invalidate the scope cache when nodes are moved. (@loganfsmyth)
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
Misc
babel-traverse
- #3432: Fix a spelling mistake in an error message. (@simeonwillbanks)
Internal
- #3400: Fix an issue that could cause a local clone of Babel to error out if the github repo was in a location with a parent
.babelrc
file. (@callumlocke) - #3431: Fix an issue that was causing the local-development watcher to occasionally rebuild with the incorrect file content. (@loganfsmyth)
- #3436: Update our linting utility version. (@hzoo)
- #3437: Remove an unused dependency. (@hzoo)
babel-core
v6.7.2
6.7.2 (2016-03-10)
Flow fix, mention babylon move
Bug Fix
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.
Internal
babel-code-frame
,babel-generator
,babel-messages
,babel-plugin-undeclared-variables-check
,babel-polyfill
,babel-register
,babel-traverse
,babel-types
babylon
- #3413 move babylon to https://github.com/babel/babylon. (@kittens)
v6.7.1
6.7.1 (2016-03-09)
Bug Fix
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();
v6.7.0
6.7.0 (2016-03-08)
Notable changes:
- Various async function fixes (const read-only error, wrong this, etc)
- Proper sourcemaps for import/export statements
- Moved internal Babel cache out of the AST
New Feature
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
- #3385 Add support for Flow def-site variance syntax. (@samwgoldman)
// 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
Bug Fix
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
- #3405 Fix shadow function processing for async functions (@loganfsmyth)
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
- #3381 Fix named async FunctionExpression scoping issue.. (@keijokapp)
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
- #3409 Fix source map generation for import and export statement.
Internal
babel-plugin-transform-es2015-modules-commonjs
Commiters: 6
amasad, divmain, hzoo, jmm, keijokapp, loganfsmyth, samwgoldman
v6.6.5
6.6.5 (2016-03-04)
And.. some more bug fixes!
Bug Fix
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
- #3395 Recognize object rest properties as binding identifiers - Fixes T7178. (@loganfsmyth)
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.
Internal
- #3398 Revert "Remove flow". (@amasad)
- #3397 Make sure lib is clean before publishing. (@hzoo)
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
Commiters: 5
AgentME, amasad, benjamn, hzoo, loganfsmyth
v6.6.4
6.6.4 (2016-03-02)
Some more fixes!
Bug Fix
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()
.
Internal
A lot of packages
- #3392 Remove flow. (@samwgoldman)
Users were getting error reports with flow when running on Babel's codebase. (Ref T7114) - Will be adding it back into the codebase itself soon.
v6.6.3
6.6.3 (2016-03-01)
Bug Fix
babel-plugin-transform-es2015-modules-commonjs
,babel-traverse
- #3387 Fix regression with T7165 - let is not being transpiled when using export all (block-scoping transform wasn't run) (@loganfsmyth)
// example code
`export * from './a'`
v6.6.2
v6.6.1
v6.6.0
6.6.0 (2016-02-29) "core-js 2, better error feedback"
Whoo a 馃惛 leap day release!
exports.default fix
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!
More helpful error messages
- If you are using a .babelrc with babel 5 options that were removed (there is a specific message for each one)
# 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/
- If you are trying to use a babel 5 plugin
# before
babel Plugin is not a function
# now
The object-assign Babel 5 plugin is being run with Babel 6.
core-js
core-js
was updated to^2.1.0
.
New Feature
New plugin 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 };
New globals
option for transform-es2015-modules-umd
babel-plugin-transform-es2015-modules-umd
- #3366 [UMD] Fixed T6832. (@clayreimann)
// Adds a new plugin option to let you override the names of globals
// .babelrc
{
"plugins": [
["transform-es2015-modules-umd", {
"globals": {
"es6-promise": "Promise"
}
}]
]
}
Bug Fix
babel-plugin-transform-es2015-modules-commonjs
,babel-traverse
- #3368 Fix the module plugin to properly requeue so the ES3 transforms can work. (@loganfsmyth)
babylon
- #3355 Clean up babylon bundle to allow it to be re-bundled - Fixes T6930. (@loganfsmyth)
babel-generator
- #3358 Fix generator with empty token list and force a newline for line comments in concise mode. (@gzzhanghao)
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
- #3336 Fixes T3077 (incorrect _arguments for async arrow functions with rest params). (@erikdesjardins)
// .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
- #3359 Queue regeneratorRuntime so it is transformed before Program#exit. (@loganfsmyth)
Fixes the _regeneratorRuntime is not defined
error when using transform-runtime
/transform-regenerator
(this happened when using polyfillable code in core-js
.
babylon
- #3356 Properly fail to parse >== and <== - Fixes T2921. (@loganfsmyth)
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()
Documentation
babel-plugin-transform-regenerator
babel-plugin-transform-object-set-prototype-of-to-assign
- #3369 fix babel-plugin-transform-proto-to-assign readme url. (@tiemevanveen)
babel-cli
Internal
- #3378 Remove Flow annotations and pragmas. (@samwgoldman)
- #3361 Switch to kcheck*, fix some lint rules. (@kittens)
babel-plugin-transform-runtime
,babel-polyfill
,babel-register
,babel-runtime
Polish
babel-core
,babel-traverse
- #3365 Replace arrow expression body with block statement. (@jridgewell)
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