Babel
  • Docs
  • Setup
  • Try it out
  • Videos
  • Blog
  • Donate
  • Team
  • GitHub

โ€บAll Blog Posts

All Blog Posts

  • 7.13.0 Released: Records and Tuples, granular compiler assumptions, and top-level targets
  • 7.12.0 Released: TypeScript 4.1, strings as import/export names, and class static blocks
  • 7.11.0 Released: ECMAScript 2021 support in preset-env, TypeScript 4.0 support, printing config and the future of `babel-eslint`
  • The State of babel-eslint
  • 7.10.0 Released: Class Fields in preset-env, '#private in' checks and better React tree-shaking
  • 7.9.0 Released: Smaller preset-env output, Typescript 3.8 support and a new JSX transform
  • 7.8.0 Released: ECMAScript 2020, .mjs configuration files and @babel/cli improvements
  • Babel's Funding Plans
  • 7.7.0 Released: Error recovery and TypeScript 3.7
  • 7.6.0 Released: Private static accessors and V8 intrinsic syntax
  • 7.5.0 Released: dynamic import and F# pipelines
  • The Babel Podcast
  • 7.4.0 Released: core-js 3, static private methods and partial application
  • 7.3.0 Released: Named capturing groups, private instance accessors and smart pipelines
  • 7.2.0 Released: Private Instance Methods
  • TC39 Standards Track Decorators in Babel
  • 7.1.0 Released: Decorators, Private Static Fields
  • Babel 7 Released
  • Removing Babel's Stage Presets
  • What's Happening With the Pipeline (|>) Proposal?
  • Announcing Babel's New Partnership with trivago!
  • On Consuming (and Publishing) ES2015+ Packages
  • Nearing the 7.0 Release
  • Babel Turns Three
  • Planning for 7.0
  • Zero-config code transformation with babel-plugin-macros
  • Contributing to Babel: Three Lessons to Remember
  • Personal Experiences at Babel #1 โ€” A PR with Unusually High Number of Reviews
  • Babel and Summer of Code 2017
  • Upgrade to Babel 7 (moved)
  • Upgrade to Babel 7 for Tool Authors (WIP)
  • 6.23.0 Released
  • The State of Babel
  • 6.19.0 Released
  • 6.18.0 Released
  • 6.16.0 Released
  • Babili (babel-minify)
  • 6.14.0 Released
  • Babel Doctor
  • Setting up Babel 6
  • 6.0.0 Released
  • React on ES6+
  • Function Bind Syntax
  • 5.0.0 Released
  • Babel <3 React
  • Not Born to Die
  • 2to3
  • 6to5 + esnext

6.19.0 Released

November 16, 2016

Henry Zhu

object-rest-spread works standalone and a few new plugin options APIs were added!

v6.19.0 Summary (2016-11-16)

๐Ÿš€ New Feature

#4755 Make object-rest-spread work as an independent plugin. (@hzoo)

This rewrite fixes a long standing issue where the object-rest-spread plugin was depending on 2 other plugins to compile RestProperty properly.

This fix important given the assumption that plugins should be independent and is vital for the use of babel-preset-env since new environments support destructuring natively.

In

const { a, ...b } = c;

Out

const { a } = c; // remove the `...b`
const b = _objectWithoutProperties(c, ["a"]); // use the helper

It's interesting to see all the places where you can destructure!

RestProperty

function a({ b, ...c }) {} // Parameters
const { a, ...b } = c; // VariableDeclaration
export var { a, ...b } = c; // ExportNamedDeclaration
try {} catch ({a, ...b}) {} // CatchClause
({a, ...b} = c); // AssignmentExpression
for ({a, ...b} of []) {} // ForXStatement

SpreadProperty

var a = { ...b, ...c } // ObjectExpression

#4544 Add the spec option to "transform-class-properties". (@motiz88)

Class properties will use Object.defineProperty instead of a simple this.x = y. Static fields are will use value: undefined even if they are not initialized.

Usage

{
  "plugins": [
    ["transform-class-properties", {
      "spec": true
    }]
  ]
}

In

class Foo {
  static bar;
  baz = 'guy';
}

Out

var Foo = function Foo() {
  _classCallCheck(this, Foo);
  this.baz = 'guy';
};

Out w/ "spec": true

var Foo = function Foo() {
  babelHelpers.classCallCheck(this, Foo);
  _initialiseProps.call(this);
};

Object.defineProperty(Foo, "bar", {
  enumerable: true,
  writable: true,
  value: undefined
});

var _initialiseProps = function () {
  Object.defineProperty(this, "bar", {
    enumerable: true,
    writable: true,
    value: foo
  });
};

#4836 Add path utilities path.isAncestor and path.isDescendant. (@boopathi)

We've added 2 similar "ancestry" path methods to path.findParent:

Usage

let programPath, numberPath;
traverse(ast, {
  Program(path) { programPath = path; },
  NumberPath(path) { numberPath = path; },
});

programPath.isAncestor(numberPath); // true
numberPath.isDescendant(programPath); // true

#4835 Add clearCache and clearPath as separate APIs under traverse. (@boopathi)

Usage

traverse.clearCache(); // clears both path's and scope cache
traverse.clearCache.clearPath();
traverse.clearCache.clearScope();

#4827 Add jsonCompatibleStrings option to babel-generator. (@kangax)

Usage

{
  "generatorOpts": {
    "jsonCompatibleStrings": true // defaults to false
  }
}

Set to true for the generator to use jsesc with "json": true. This will make it print "\u00A9" vs. "ยฉ";


#3547 Added flowCommaSeparator to babel-generator. (@sampepose)

Usage

{
  "generatorOpts": {
    "flowCommaSeparator": true // defaults to false
  }
}

Currently there are 2 supported syntaxes (, and ;) in Flow Object Types. The use of commas is in line with the more popular style and matches how objects are defined in JavaScript, making it a bit more natural to write.

var a: { param1: number; param2: string }
var a: { param1: number, param2: string }

#3553 Add t.isNodesEquivalent. (@hzoo)

Usage

assert(t.isNodesEquivalent(parse("1 + 1"), parse("1+1")) === true);

#4789 Support stage-2 import() as contextual import in transform-es2015-modules-systemjs. (@guybedford)

You'll want to add the stage-2 preset or explicitly include babel-plugin-syntax-dynamic-import (not enabled by default).

export function lazyLoadOperation () {
  return import('./x')
  .then(function (x) {
    x.y();
  });
}

๐Ÿ› Bug Fixes

#4830 Will print the shorter of the NumericLiterals if using the minified option. (@shinew)

Input

5e1;
5e4;

Output

50;
5e4;

#4832 Fix transform-es2015-modules-systemjs to ensure consistent modules iteration. (@guybedford)

import "2"; // should be imported first
import "1"; // second

#4813 Fix binding kind of destructured variables relating to transform-react-constant-elements (@STRML)

Fixes an issue with destructuring parameters being hoisted incorrectly.

Input

function render({ text }) {
  return () => (<Component text={text} />);
}

Output

function render(_ref) {
  let text = _ref.text;
  var _ref2 = <Component text={text} />;
  return () => _ref2;
}

๐ŸŒ Committers: 10

  • Boopathi Rajaa (boopathi)
  • Guy Bedford (guybedford)
  • Henry Zhu (hzoo)
  • Juriy Zaytsev (kangax)
  • Moti Zilberman (motiz88)
  • Sam Pepose (sampepose)
  • Samuel Reed (STRML)
  • Scott Stern (sstern6)
  • Shine Wang (shinew)
  • lion (lion-man44)

Check out Github for the whole changelog!

Recent Posts
  • v6.19.0 Summary (2016-11-16)
  • ๐Ÿš€ New Feature
  • ๐Ÿ› Bug Fixes
  • ๐ŸŒ Committers: 10
Babel
Docs
Learn ES2015
Community
VideosUser ShowcaseStack OverflowSlack ChannelTwitter
More
BlogGitHub OrgGitHub RepoWebsite RepoOld 6.x SiteOld 5.x Site