npm babel-plugin-transform-es2015-modules-commonjs 7.0.0-alpha.15
v7.0.0-alpha.15

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

v7.0.0-alpha.15 (2017-07-11)

Ignore alpha.13/14

Summary

This is a Stage 0 TC39 Proposal (subject to change/removal and your feedback!)

const obj = {
  foo: {
    bar: {
      baz: 42,
    },
  },
};

const baz = obj?.foo?.bar?.baz; // 42

const safe = obj?.qux?.baz; // undefined

// Optional chaining and normal chaining can be intermixed
obj?.foo.bar?.baz; // Only access `foo` if `obj` exists, and `baz` if
                   // `bar` exists
function Foo() {
  console.log(new.target);
}

Foo(); // => undefined
new Foo(); // => Foo
  • better for of optimization (if inferred array)
// these kinds of scenarios will compile to a regular for loop
const x = [];
for (const y of x) {}
const arr = Object.entries(x);
for (const y of arr) {}
  • loose mode for classes is a lot looser

Input

class A {}

Output (loose)

let A = function A() {}; // loose

Output (normal)

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var A = function A() {
  _classCallCheck(this, A);
};

💥 Breaking Change

  • babel-*
    • #5824 Hardcode to double quotes, indent to 2 spaces. (@hzoo)

This is just the babel-generator output, not a big deal.

🚀 New Feature

  • babel-traverse
  • babel-plugin-transform-new-target
  • babel-core, babel-generator, babel-plugin-syntax-optional-chaining, babel-plugin-transform-optional-chaining, babel-preset-stage-1, babel-template, babel-traverse, babel-types
  • babel-core, babel-plugin-transform-es2015-for-of
    • #4747 test for for-of optimization on arrays and add it for array type anno…. (@hzoo)
  • babel-helpers, babel-plugin-transform-es2015-classes, babel-plugin-transform-flow-comments, babel-plugin-transform-flow-strip-types
    • #4850 Remove ClassCallCheck, possibleConstructorReturn in loose mode. (@hzoo)
  • babel-generator, babel-plugin-transform-flow-strip-types, babel-types

🐛 Bug Fix

  • babel-helpers, babel-plugin-transform-class-properties, babel-plugin-transform-es2015-classes
    • #5885 Fix returning an object in a derived class constructor without super. (@jridgewell)
  • babel-helper-remap-async-to-generator, babel-plugin-transform-async-to-generator
  • babel-plugin-transform-es2015-modules-commonjs
  • babel-plugin-transform-es2015-classes
  • babel-cli
  • babel-types
  • babel-generator
  • babel-plugin-transform-numeric-separator
  • babel-plugin-transform-es2015-template-literals, babel-preset-es2015
  • babel-plugin-transform-es2015-parameters
  • babel-plugin-syntax-optional-chaining

💅 Polish

  • babel-plugin-transform-es2015-parameters
  • babel-helper-builder-react-jsx, babel-plugin-transform-es2015-spread, babel-traverse
  • babel-traverse, babel-types
  • babel-types

📝 Documentation

🏠 Internal

  • babel-polyfill
  • Other
  • babel-core, babel-generator
  • babel-*
  • babel-core, babel-generator, babel-traverse, babel-types
  • babel-*
  • babel-generator, babel-traverse
    • #5866 update babel-eslint, try out numeric separators. (@hzoo)
  • babel-generator
  • babel-cli
  • babel-core, babel-helper-transform-fixture-test-runner, babel-traverse
  • babel-core, babel-traverse

Committers: 18

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

NewReleases is sending notifications on new releases.