Skip to content

Releases: babel/babel

v6.5.1

08 Feb 02:30
Compare
Choose a tag to compare

6.5.1 (2016-02-08) Daddy does a release.

  • Bug Fix
    • bc2f84f Fix options being ignored in babel-register.
    • #3329 Fix ExportSpecifier node validator validating imported instead of exported.
  • Polish
    • #3333 Improve the error messaging for using the wrong CLI script.

v6.5.0

07 Feb 03:05
Compare
Choose a tag to compare

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
  • babel-core
    • #3281 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
    • #3285 Hoist the current file name (an absolute path) for transform-react-jsx-source . (@frantic)

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
  • babel-core
    • #3313 Add babel.analyze - an api sugar for getting back metadata from babel. (@kittens)
// analyse not analyze :D
// usage
babel.analyse("foobar;", {}, {
  Program: function (path) {
    path.mark("category", "foobar");
  }
}).marked[0].message // outputs "foobar"
  • babylon
    • #3319 Add support for leading pipes in Flow type alias RHS syntax (@jeffmo)
// 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
    • #3298 Set NOT_LOCAL_BINDING symbol on all inferred function names. (issue T7010, regression of #3274) (@amasad)
// 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
// 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 with babel-template. (Issue T6903) (@guybedford)
  • 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
    • #3311 Consider arrow functions when parenthesizing object expressions. (Issue T7047) (@amasad)
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
    • #3324 Parenthesize the in in a for-loop init, even in the case when it is nested. (@zjmiller)
// nested for loop
for (function(){for(;;);} && (a in b);;);
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 and Pattern interfaces, update Identifier interface. (@jmm)

Internal

  • #3317 make publish: add make build in case it wasn't run. (@hzoo)
  • babel-generator
  • babel-core, babel-generator, babel-traverse, babel-types,babylon
    • #3186 Add more flow types, update flow, eslint, babel-eslint, only run flow on node 5. (@hzoo)
  • 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
    • #3307 Make the chokidar dependency optional. (@josh)
  • babel-types
    • #3294 WithStatements can have statements as bodies. (@amasad)
  • babel-types

Polish

v6.4.6

20 Jan 12:22
Compare
Choose a tag to compare

6.4.6 (2016-01-20)

  • Bug Fix
    • babel-helper-remap-async-to-generator: #3288 Async arrow functions should compile to regular functions because they reference arguments.

v5.8.35

20 Jan 22:11
Compare
Choose a tag to compare

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 and declare interface Flow syntax.
    • Add support for Flow mixins.
    • Add support for Flow this type.
    • Add support for Flow null literal type.

v6.4.5

19 Jan 23:05
Compare
Choose a tag to compare

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 as de51bf5

    • babel-helper-remap-async-to-generator: #3257 Fix issue with using this 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 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!

      • 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 to asyncToGenerator helper.

    • babel-plugin-transform-es2015-modules-commonjs: #3282 Fixes an issue with using default 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

14 Jan 22:17
Compare
Choose a tag to compare

6.4.4 (2016-01-14)

  • babel-plugin-transform-regenerator: Publishing issue (T2892).

v6.4.3

14 Jan 14:03
Compare
Choose a tag to compare

6.4.3 (2016-01-13)

  • 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 directives
    • babel-pluginn-transform-es2015-unicode-regex: #3259 Use only regexpu-core instead of all of regexpu
    • babel-generator: Fix minified labeledStatement printing
    • babel-plugin-transform-regenerator: #3162 Make sure babel helper picks up regeneratorRuntime
  • Polish
    • babel-types: #3261 Add ArrayExpression.elements.default
    • babel-register: #3232 Make sure the cache file's directory exists
  • Documentation
    • babel-generator-options: #3251 Document babel-generator options

v6.4.2

07 Jan 02:53
Compare
Choose a tag to compare

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 for arguments.length optimization.
    • babel-generator: #3247 Parenthesize await/yield expression in BinaryExpression (Ref #3229).

v6.4.1

07 Jan 01:02
Compare
Choose a tag to compare

6.4.1 (2016-01-06)

  • Bug Fix
    • babel-types: #3245 Temporarily revert adding the Binary alias #3217 and tests.

v6.4.0

06 Jan 20:54
Compare
Choose a tag to compare

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 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-types: #3195 Allow JSXText node in JSXElement children property and remove StringLiteral.
    • 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.
  • Spec Compliancy
    • babylon: #3225 throw parse error if class properties do not have a semicolon.
  • Breaking Change
    • babel-plugin-external-helpers: #3205 Renamed from babel-plugin-external-helpers-2 due to someone taking the npm name beforehand.
  • Documentation
    • babel-generator: #3240 Fix small in babel-generator README sample code. Thanks @athaeryn!
  • Internal
    • #3233 Update LICENSE end date to 2016. Thanks @maclover7!
    • babylon: #3204 Prevent users from patching by building it.
    • babel-types: #3217 Add Binary alias to AssignmentExpression.