npm babel-plugin-transform-es2015-modules-commonjs 6.6.0
v6.6.0

latest releases: 6.26.2, 7.0.0-beta.3, 7.0.0-beta.2...
8 years ago

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

Don't miss a new babel-plugin-transform-es2015-modules-commonjs release

NewReleases is sending notifications on new releases.