Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Releases: babel/babylon

v6.14.1

18 Nov 00:12
Compare
Choose a tag to compare

6.14.1 (2016-11-17)

πŸ› Bug Fix

Allow "plugins": ["*"] (#229) (Daniel Tschinder)

{
  "plugins": ["*"] // jsx, flow, functionBind, etc
}

Will include all parser plugins instead of specifying each one individually. Useful for tools like babel-eslint, jscodeshift, and ast-explorer.

v6.14.0

16 Nov 15:34
Compare
Choose a tag to compare

6.14.0 (2016-11-16)

πŸ‘“ Spec Compliancy

Throw error for reserved words enum and await (#195) (Kai Cataldo)

11.6.2.2 Future Reserved Words

Babylon will throw for more reserved words such as enum or await (in strict mode).

class enum {} // throws
class await {} // throws in strict mode (module)

Optional names for function types and object type indexers (#197) (Gabe Levi)

So where you used to have to write

type A = (x: string, y: boolean) => number;
type B = (z: string) => number;
type C = { [key: string]: number };

you can now write (with flow 0.34.0)

type A = (string, boolean) => number;
type B = string => number;
type C = { [string]: number };

Parse flow nested array type annotations like number[][] (#219) (Bernhard HΓ€ussner)

Supports these form now of specifying array types:

var a: number[][][][];
var b: string[][];

πŸ› Bug Fix

Correctly eat semicolon at the end of DelcareModuleExports (#223) (Daniel Tschinder)

declare module "foo" { declare module.exports: number } 
declare module "foo" { declare module.exports: number; }  // also allowed now

🏠 Internal

  • Count Babel tests towards Babylon code coverage (#182) (Moti Zilberman)
  • Fix strange line endings (#214) (Thomas Grainger)
  • Add node 7 (Daniel Tschinder)
  • chore(package): update flow-bin to version 0.34.0 (#204) (Greenkeeper)

v6.13.1

26 Oct 16:12
Compare
Choose a tag to compare

v6.13.1 (2016-10-26)

πŸ’… Polish

  • Use rollup for bundling to speed up startup time (#190) (@drewml)
const babylon = require('babylon');
const ast = babylon.parse('var foo = "lol";');

With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph.

Without bundling
image

With bundling
image

  • add clean command skip ci (Henry Zhu)
  • add ForAwaitStatement (async generator already added) skip ci (Henry Zhu)

v6.13.0

21 Oct 14:41
Compare
Choose a tag to compare

v6.13.0 (2016-10-21)

πŸ‘“ Spec Compliancy

Property variance type annotations for Flow plugin (#161) (Sam Goldman)

See https://flowtype.org/docs/variance.html for more information

type T = { +p: T };
interface T { -p: T };
declare class T { +[k:K]: V };
class T { -[k:K]: V };
class C2 { +p: T = e };

Raise error on duplicate definition of __proto__ (#183) (Moti Zilberman)

({ __proto__: 1, __proto__: 2 }) // Throws an error now

πŸ› Bug Fix

Flow: Allow class properties to be named static (#184) (Moti Zilberman)

declare class A {
  static: T;
}

Allow "async" as identifier for object literal property shorthand (#187) (Andrew Levine)

var foo = { async, bar };

πŸ’… Polish

Fix flowtype and add inType to state (#189) (Daniel Tschinder)

This improves the performance slightly (because of hidden classes)

🏠 Internal

Fix .gitattributes line ending setting (#191) (Moti Zilberman)

Increase test coverage (#175) (Moti Zilberman)

Re-add missing .eslintignore for IDEs (Daniel Tschinder)

Error on missing expected.json fixture in CI (#188) (Moti Zilberman)

Add .gitattributes and .editorconfig for LF line endings (#179) (Moti Zilberman)

Fixes two tests that are failing after the merge of #172 (#177) (Moti Zilberman)

v6.12.0

14 Oct 20:17
Compare
Choose a tag to compare

v6.12.0 (2016-10-14)

πŸ‘“ Spec Compliancy

Implement import() syntax (#163) (Jordan Gensler)

Dynamic Import

This repository contains a proposal for adding a "function-like" import() module loading syntactic form to JavaScript

import(`./section-modules/${link.dataset.entryModule}.js`)
.then(module => {
  module.loadPageInto(main);
})

Add EmptyTypeAnnotation (#171) (Sam Goldman)

EmptyTypeAnnotation

Just wasn't covered before.

type T = empty;

πŸ› Bug Fix

Fix crash when exporting with destructuring and sparse array (#170) (Jeroen Engels)

// was failing due to sparse array
export const { foo: [ ,, qux7 ] } = bar;

Allow keyword in Flow object declaration property names with type parameters (#146) (Dan Harper)

declare class X {
  foobar<T>(): void;
  static foobar<T>(): void;
}

Allow keyword in object/class property names with Flow type parameters (#145) (Dan Harper)

class Foo {
  delete<T>(item: T): T {
    return item;
  }
}

Allow typeAnnotations for yield expressions (#174)) (Daniel Tschinder)

function *foo() {
  const x = (yield 5: any);
}

πŸ’… Polish

Annotate more errors with expected token (#172)) (Moti Zilberman)

// Unexpected token, expected ; (1:6)
{ set 1 }

🏠 Internal

Remove kcheck (#173)) (Daniel Tschinder)

Also run flow, linting, babel tests on seperate instances (add back node 0.10)

v6.11.6

14 Oct 19:51
Compare
Choose a tag to compare

v6.11.6 (2016-10-12)

πŸ› Bug Fix/Regression

Fix crash when exporting with destructuring and sparse array (#170) (Jeroen Engels)

// was failing with `Cannot read property 'type' of null` because of null identifiers
export const { foo: [ ,, qux7 ] } = bar;

v6.11.5

12 Oct 15:55
Compare
Choose a tag to compare

v6.11.5 (2016-10-12)

πŸ‘“ Spec Compliancy

Fix: Check for duplicate named exports in exported destructuring assignments (#144) (Kai Cataldo)

// `foo` has already been exported. Exported identifiers must be unique. (2:20)
export function foo() {};
export const { a: [{foo}] } = bar;

Fix: Check for duplicate named exports in exported rest elements/properties (#164) (Kai Cataldo)

// `foo` has already been exported. Exported identifiers must be unique. (2:22)
export const foo = 1;
export const [bar, ...foo] = baz;

πŸ› Bug Fix

Fix: Allow identifier async for default param in arrow expression (#165) (Kai Cataldo)

// this is ok now
const test = ({async = true}) => {};

πŸ’… Polish

Babylon will now print out the token it's expecting if there's a SyntaxError (#150) (Daniel Tschinder)

# So in the case of a missing ending curly (`}`)
Module build failed: SyntaxError: Unexpected token, expected } (30:0)
  28 |   }
  29 |
> 30 |
     | ^

v6.11.4

02 Oct 00:09
Compare
Choose a tag to compare
  • Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu)

v6.11.3

01 Oct 20:46
Compare
Choose a tag to compare

v6.11.3 (2016-10-01)

πŸ‘“ Spec Compliancy

Add static errors for object rest (#149) (@danez)

https://github.com/sebmarkbage/ecmascript-rest-spread

Object rest copies the rest of properties from the right hand side obj starting from the left to right.

let { x, y, ...z } =  { x: 1, y: 2, z: 3 };
// x = 1
// y = 2
// z = { z: 3 }

New Syntax Errors:

SyntaxError: The rest element has to be the last element when destructuring (1:10)

> 1 | let { ...x, y, z } = { x: 1, y: 2, z: 3 };
    |           ^
# Previous behavior:
# x = { x: 1, y: 2, z: 3 }
# y = 2
# z = 3

Before, this was just a more verbose way of shallow copying obj since it doesn't actually do what you think.

SyntaxError: Cannot have multiple rest elements when destructuring (1:13)

> 1 | let { x, ...y, ...z } = { x: 1, y: 2, z: 3 };
    |              ^
# Previous behavior:
# x = 1
# y = { y: 2, z: 3 }
# z = { y: 2, z: 3 }

Before y and z would just be the same value anyway so there is no reason to need to have both.

SyntaxError: A trailing comma is not permitted after the rest element (1:16)

let { x, y, ...z, } = obj;

The rationale for this is that the use case for trailing comma is that you can add something at the end without affecting the line above. Since a RestProperty always has to be the last property it doesn't make sense.


get / set are valid property names in default assignment (#142) (@jezell)

// valid
function something({ set = null, get = null }) {}

v6.11.2

23 Sep 04:47
Compare
Choose a tag to compare

Bug Fix

  • #139 Don't do the duplicate check if not an identifier (#140) @hzoo
// regression with duplicate export check
SyntaxError: ./typography.js: `undefined` has already been exported. Exported identifiers must be unique. (22:13)
  20 | 
  21 | export const { rhythm } = typography;
> 22 | export const { TypographyStyle } = typography

Bail out for now, and make a change to account for destructuring in the next release.