Skip to content

Releases: babel/babel

v6.7.4

23 Mar 03:50
Compare
Choose a tag to compare

Bug Fix

  • babel-traverse
  • babel-runtime
  • babel-plugin-transform-react-jsx
    • #3430: Stop the JSX transform from using an AST node in two places. (@amasad)

Misc

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

10 Mar 22:48
Compare
Choose a tag to compare

6.7.2 (2016-03-10)

Flow fix, mention babylon move

Bug Fix

  • babel-traverse
    • #3414: Warn on Flow-based bindings and don't count as a const violation. (@amasad)

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

v6.7.1

09 Mar 22:10
Compare
Choose a tag to compare

6.7.1 (2016-03-09)

Bug Fix

  • babel-plugin-transform-es2015-block-scoping
    • #3411 Fixes T7197: Move bindings without losing any information.

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

09 Mar 01:05
Compare
Choose a tag to compare

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

  • babel-traverse

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 馃槃.

  • babel-generator, babylon
    • #3323 Source-map support for multiple input source files. (@divmain)

More docs on this in the babel-generator README

Bug Fix

  • babel-traverse

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
    • #3409 Fix source map generation for import and export statement.

Internal

  • babel-plugin-transform-es2015-modules-commonjs
    • #3383 Test for regression with exporting an arrow function with a default param. (@hzoo)

Commiters: 6

amasad, divmain, hzoo, jmm, keijokapp, loganfsmyth, samwgoldman

v6.6.5

04 Mar 23:20
Compare
Choose a tag to compare

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
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
    • #3389 Update scope binding info after transforming block-scoped bindings. (@amasad)

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
    • #3399 use flow instead of flow-comments. (@hzoo)
  • 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

02 Mar 21:53
Compare
Choose a tag to compare

6.6.4 (2016-03-02)

Some more fixes!

Bug Fix

  • babel-plugin-transform-es2015-duplicate-keys
    • #3388 Partial T7173 Fix: Prevent accessors being seen as duplicates of each other. (@AgentME)
// sample code that was erroring
const obj = {
  set a (a) {
    values.a = a;   
  },
  get a () {
    return values.a;
  }
};
  • babel-core
    • #3350 Make Babel actually resolve plugins relative to where they were specified (via .babelrc).. (@skevy)
// .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

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

01 Mar 16:45
Compare
Choose a tag to compare

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

01 Mar 14:12
Compare
Choose a tag to compare

6.6.2 (2016-03-01)

Bug Fix

  • babel-plugin-transform-es2015-modules-commonjs, babel-traverse
// example code
export var bar = (gen, ctx = null) => {}

v6.6.1

01 Mar 00:29
Compare
Choose a tag to compare

6.6.1 (2016-02-29)

Bug Fix

  • babel-runtime, babel-polyfill: Fix publishing issue (wasn't updated from before).

v6.6.0

29 Feb 21:18
Compare
Choose a tag to compare

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
// 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
  • 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
    • #3249 Assignment to rest param element triggers error T6932. (@jmm)
// .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
    • #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
  • babel-plugin-transform-es2015-block-scoping
    • #3346 Rename scope bindings during block scope transform. (@schmod)
  • babel-generator
    • #3380 Fix: Add parens for unary arrow function. (@hzoo)
// input
void (() => {});
// correct output
void (() => {});
// wrong
void () => {};
  • babel-generator
    • #3379 Fix: invalid codegen for non decimal numeric literals in MemberExpression. (@hzoo)
// input
(0xFFFF).toString()
// correct output
0xFFFF.toString()
// wrong
0xFFFF..toString()

Documentation

  • babel-plugin-transform-regenerator
    • #3370 Adds repository field to babel-plugin-transform-regenerator. (@siroky)
  • babel-plugin-transform-object-set-prototype-of-to-assign
  • 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
  • babel-core
    • #3362 Show a better error when trying to use a babel 5 plugin. (@hzoo)
  • babel-core
    • #3377 Give specific error messages for babel 5 options that were removed in babel 6. (@hzoo)

We have 15 committers this release!

Thanks to: AgentME, clayreimann, erikdesjardins, forivall, gzzhanghao, hzoo, jmm, jridgewell, kittens, loganfsmyth, samwgoldman, schmod, siroky, tiemevanveen, zloirock