Releases: babel/babel
v6.5.1
v6.5.0
6.5.0 (2016-02-07)
Happy Superbowl Sunday! There's many contributors (17 + core) this release!
A traversal per preset (Experimental)
This is an experimental feature that will almost certainly change. You should use this option in specific cases while we figure out a better way to do this.
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.
{
passPerPreset: true,
presets: [
{
plugins: ['plugin-1']
},
'preset-2',
{
plugins: ['plugin-2']
}
]
}
// this will create 3 traversals
Thanks to @DmitrySoshnikov, 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).
More Speeeeeeed
@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!).
New Feature
babel-core
- #3168 Use the
babelrc
option inbabel-register
. (@CrocoDillon)
- #3168 Use the
babel-core
- #3281
passPerPreset
option in.babelrc
: iftrue
, babel will create a new traversal for each preset. (@DmitrySoshnikov)
- #3281
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
- #3304 Allow passing in
babylon
options intobabel-template
. (issue T7046) (@jamestalmage)
- #3304 Allow passing in
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
.
Bug Fix
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
- #3297 Fixes the wrong
this
for nested arrow functions. (Issue T2765#72428) (@horpto)
- #3297 Fixes the wrong
// nested arrow functions
class A {
async method() {
() => {
() => this; // `this` in nested arrow function was incorrect
}
}
}
babel-template
- #3314 Only strip node info if no
node.loc
. Fixes an issue with sourcemap generation for SystemJS withbabel-template
. (Issue T6903) (@guybedford)
- #3314 Only strip node info if no
babel-traverse
- #3300 Fix an issue with transpiling generator functions with default arguments. (Issue T2776) (@gzzhanghao)
// 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
- #3312 Fix async functions not being hoisted. (Issue T6882) (@erikdesjardins)
foo();
async function foo() {} // this should be hoisted above foo();
babel-generator
// nested for loop
for (function(){for(;;);} && (a in b);;);
babylon
- #3305 Fix: Arrow functions with trailing comma + return type parsing error. (Issue T7052) (@jviereck)
const X = (
props: SomeType,
): ReturnType => (
3
);
Documentation
- #3321 Docs: add information on writing tests in babylon. (@hzoo)
- #3308 Update compiler-environment-support.md. (@sappharx)
- #3293 ast/spec: update
Decorator
property. (@hzoo) - #3295 ast/spec: add
BindExpression
. (@hzoo) - #3287 Correct use of possessive case. (@nettofarah)
- #3301 ast/spec: add
Literal
andPattern
interfaces, updateIdentifier
interface. (@jmm)
Internal
- #3317
make publish
: addmake 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
- #3299 Add a test to ensure that we do not break mutli-byte handling. (@robcolburn)
babel-cli
babel-types
babel-types
Polish
babel-generator
- #3283 Improve generator performance. (Issue T6884) (@gzzhanghao)
v6.4.6
v5.8.35
This release includes some new Flow syntax that has already been added to 6.x. Thank you @samwgoldman!
- New Feature
- Add
export interface
Flow syntax. - Add
declare type
anddeclare interface
Flow syntax. - Add support for Flow mixins.
- Add support for Flow
this
type. - Add support for Flow
null
literal type.
- Add
v6.4.5
6.4.5 (2016-01-19)
- 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!- This fixes:
var _templateObject = (0, _taggedTemplateLiteral3.default)(["foo"], ["foo"]); // this should come after _taggedTemplateLiteral 2 and 3 var _taggedTemplateLiteral2 = require("babel-runtime/helpers/taggedTemplateLiteral"); var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2); tag(_templateObject);
-
babel-types
,babel-plugin-transform-es2015-modules-commonjs
,babel-generator
: #3183 Fix various source map issues. (T6851). Thanks for your work @kpdecker! Committed asde51bf5
-
babel-helper-remap-async-to-generator
: #3257 Fix issue with usingthis
inside an arrow function (T2765). Thanks @horpto!- This fixes:
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!- This fixes a specific issue with the react preset since it includes
syntax-flow
andtransform-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.
- This fixes a specific issue with the react preset since it includes
-
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!- This fixes:
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 toasyncToGenerator
helper. -
babel-plugin-transform-es2015-modules-commonjs
: #3282 Fixes an issue with usingdefault
as a specifier in an export.- This fixes an issue with:
export {default as foo} from "foo";
-
- Documentation
- Internal
babel-plugin-transform-es2015-parameters
: #3263 Test coverage.babel-core
: #3268 Add a test for (T2892).- #3275 Temporarily change flow types to fix lint.
- #3277 Fixup Makefile
.bin
references. Thanks @charliesome! - #3278 Use local bin references instead of implied global in Makefile.
babylon
: #3284 Add some more flow types. Thanks @bmeck!
- Polish
babel-plugin-transform-es2015-parameters
: #3264 Simplify code, add comments.
v6.4.4
v6.4.3
6.4.3 (2016-01-13)
- Bug Fix
babel-plugin-transform-es2015-typeof-symbol
: #3250 The typeof transform should always use the globalSymbol
.babel-plugin-transform-es2015-modules-amd
: #3252 Stop leaking directivesbabel-pluginn-transform-es2015-unicode-regex
: #3259 Use onlyregexpu-core
instead of all ofregexpu
babel-generator
: Fix minified labeledStatement printingbabel-plugin-transform-regenerator
: #3162 Make sure babel helper picks upregeneratorRuntime
- Polish
- Documentation
babel-generator-options
: #3251 Document babel-generator options
v6.4.2
6.4.2 (2016-01-06)
- Bug Fix
babylon
: #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 forarguments.length
optimization.babel-generator
: #3247 Parenthesize await/yield expression inBinaryExpression
(Ref #3229).
v6.4.1
v6.4.0
6.4.0 (2016-01-06)
Thanks to @samwgoldman for all the new flow support!
- New Feature
babylon
,babel-types
,babel-generator
: #3202 Add support forthis
flow type.babylon
,babel-types
,babel-generator
: #3236 Add support forexport interface
flow syntax.babylon
,babel-types
,babel-generator
,babel-plugin-transform-flow-strip-types
,babel-plugin-transform-flow-comments
: #3230 Add support fordeclare type
anddeclare 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 toSystem.register
. Thanks @guybedford!
- Bug Fix
babel-types
: #3195 AllowJSXText
node inJSXElement
children property and removeStringLiteral
.babel-plugin-transform-es2015-parameters
: #3214 Bugfix forarguments.length
optimization having the wrong length. Thanks @fabiomcosta!babylon
: #3220 Don't parse parenthesized string as aDirective
.babel-helpers
: #3218 Defer to the built-intypeof
if support for Symbols exists. Thanks @jdalton!babel-generator
: #3213 Fix various parentheses bugs.babel-plugin-transform-react-display-name
: #3216 More relaxeddisplayName
inference.babel-helper-function-name
: #3215 Set function names fromAssignmentExpression
. Thanks @spicyj!babel-generator
: #3210 Use a print stack to determine in parenthesis needs to be added.babel-plugin-transform-runtime
: #3235 Ensureopts.polyfill = false
behaves correctly for all visitors. Thanks @guybedford!babel-plugin-transform-runtime
: Ensureregenerator
option doesn't cancel out core-js polyfill.babel-generator
: #3229 Check for parentheses forAwaitExpressions
and fix over-parentheses inYieldExpressions
.
- Spec Compliancy
babylon
: #3225 throw parse error if class properties do not have a semicolon.
- Breaking Change
babel-plugin-external-helpers
: #3205 Renamed frombabel-plugin-external-helpers-2
due to someone taking the npm name beforehand.
- Documentation
- Internal
- #3233 Update LICENSE end date to 2016. Thanks @maclover7!
babylon
: #3204 Prevent users from patching by building it.babel-types
: #3217 AddBinary
alias toAssignmentExpression
.