npm babel-types 6.20.0
v6.20.0

latest releases: 7.0.0-beta.3, 7.0.0-beta.2, 7.0.0-beta.1...
7 years ago

v6.20.0 (2016-12-08)

If you missed it, please check out our latest blog post: The State of Babel. It talks about where we can possibly move forward as a project and how you can help!

Also just wanted to reiterate that Babel is a community-lead project that is run by volunteers - many of us came into the project to learn about JavaScript rather than because we knew it already. Let's work together to make it sustainable!


You've probably seen this more than a few times and had no idea what it meant...

[BABEL] Note: The code generator has deoptimised the styling of "app.js" as it exceeds the max of "100KB".

Generating code used to get really slow as file size increased. We've mostly fixed that, but we still automatically fall back to compact output on large files. We're going to bump the limit to 500KB and if there aren't issues just remove it.


Ben Newman, @benjamn: wrote Regenerator while at Facebook. It used a bunch of other libraries such as ast-types but has now been rewritten as a standalone Babel plugin (also thanks to Sebastian's previous work in facebook/regenerator#222). We're also moving the implementation of Regenerator back into the original repository since Ben is the creator/maintainer.

🚀 New Feature

  • babel-traverse
    • #4876 Add getBindingIdentifierPaths/getOuterBindingIdentifierPaths. (@boopathi)

Returns Array<Path> rather than Array<Node>.

  • path.getBindingIdentifierPaths()
  • path.getOuterBindingIdentifierPaths()
traverse(parse(`
  var a = 1, {b} = c, [d] = e, function f() {};
`), {
  VariableDeclaration(path) {
    let nodes = path.getBindingIdentifiers(); // a, d, b
    let paths = path.getBindingIdentifierPaths();
  },
  FunctionDeclaration(path) {
    let outerNodes = path.getOuterBindingIdentifiers(); // f
    let outerPaths = path.getOuterBindingIdentifierPaths();
  }
});
  • babel-code-frame
    • #4913 Add forceColor option to babel-code-frame. (@Timer)

Forcibly syntax highlight the code as JavaScript (for non-terminals); overrides highlightCode. For facebookincubator/create-react-app#1101

Usage

const result = codeFrame(rawLines, lineNumber, colNumber, {
  forceColor: true
});

🐛 Bug Fix

  • babel-plugin-transform-es2015-block-scoping
    • #4880 Add (and fix) failing test of function parameter bindings in a catch block. (@benjamn)

In

try {
  foo();
} catch (x) {
  function harmless(x) {
    return x;
  }
}

Correct Out

try {
  foo();
} catch (x) {
  var harmless = function (x) {
    return x;
  };
}
  • babel-helper-remap-async-to-generator, babel-plugin-transform-async-generator-functions, babel-plugin-transform-async-to-generator
// both length's should be 0
const foo = (...args) => { }
console.log(foo.length)  // 0
const asyncFoo = async (...args) => { }
console.log(asyncFoo.length)  // 0
  • babel-generator, babel-types

Relevant for webpack 2 support of Import. Just allows Babel to print it correctly.

import("module.js");
  • babel-plugin-transform-object-rest-spread
function a5({a3, b2: { ba1, ...ba2 }, ...c3}) {}
  • babel-traverse
    • #4875 Fix path.evaluate for references before declarations. (@boopathi)
// should deopt if ids are referenced before the bindings
var a = b + 2; var b = 2 + 2;
  • babel-core, babel-generator, babel-helper-transform-fixture-test-runner, babel-plugin-transform-object-rest-spread
    • #4858 Fix bug + Generate test fixtures if no expected.js. (@hzoo)
  • babel-types

💅 Polish

📝 Documentation

🏠 Internal

  • babel-plugin-transform-regenerator
    • #4881 Use regenerator-transform to implement babel-plugin-transform-regenerator. (@benjamn)
  • babel-traverse
  • babel-polyfill
  • babel-runtime
    • #4877 Upgrade regenerator-runtime to version 0.10.0. (@benjamn)
  • babel-plugin-syntax-trailing-function-commas
  • babel-helper-fixtures
  • babel-core, babel-traverse
  • babel-generator

Committers: 17

Don't miss a new babel-types release

NewReleases is sending notifications on new releases.