Projekt

Obecné

Profil

Stáhnout (33.7 KB) Statistiky
| Větev: | Revize:
1
# Changelog
2

    
3
> **Tags:**
4
> - :boom:       [Breaking Change]
5
> - :eyeglasses: [Spec Compliancy]
6
> - :rocket:     [New Feature]
7
> - :bug:        [Bug Fix]
8
> - :memo:       [Documentation]
9
> - :house:      [Internal]
10
> - :nail_care:  [Polish]
11

    
12
> Semver Policy: https://github.com/babel/babylon#semver
13

    
14
_Note: Gaps between patch versions are faulty, broken or test releases._
15

    
16
See the [Babel Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) for the pre-6.8.0 version Changelog.
17

    
18
## 6.17.4 (2017-06-18)
19

    
20
 * Fix comment attachment for call expressions (#575) (aardito2)
21
 * Correctly put typeParameters on FunctionExpression (#585) (Daniel Tschinder)
22

    
23
## 6.17.3 (2017-06-09)
24

    
25
 * Fix location info on FunctionTypeParam nodes (#565) (#571) (Michal Srb)
26
 * Fix stmt value being the raw value (#557) (#558) (Daniel Tschinder)
27

    
28
## 6.17.2 (2017-05-31)
29

    
30
 * Fixed disappearing comments following a trailing comma on the last property of an object literal or the last argument of a call expression (#478) (aardito2)
31
 * Fix #437: only prohibit 'export type from "module" ' when flow is enabled (#438) (Kevin Gibbons)
32
 * Fix handling of anonymous parameters in `flowParseObjectTypeMethodish`. (#526) (Max Schaefer)
33
 * Convert argument of SpreadElement correctly to assignable (#518) (Daniel Tschinder)
34

    
35
## 6.17.1 (2017-05-10)
36

    
37
 * Fix typo in flow spread operator error (Brian Ng)
38
 * Fixed invalid number literal parsing ([#473](https://github.com/babel/babylon/pull/473)) (Alex Kuzmenko)
39
 * Fix number parser ([#433](https://github.com/babel/babylon/pull/433)) (Alex Kuzmenko)
40
 * Ensure non pattern shorthand props are checked for reserved words ([#479](https://github.com/babel/babylon/pull/479)) (Brian Ng)
41
 * Remove jsx context when parsing arrow functions ([#475](https://github.com/babel/babylon/pull/475)) (Brian Ng)
42
 * Allow super in class properties ([#499](https://github.com/babel/babylon/pull/499)) (Brian Ng)
43
 * Allow flow class field to be named constructor ([#510](https://github.com/babel/babylon/pull/510)) (Brian Ng)
44

    
45
## 6.17.0 (2017-04-20)
46

    
47
 * Cherry-pick #418 to 6.x ([#476](https://github.com/babel/babylon/pull/476)) (Sebastian McKenzie)
48
 * Add support for invalid escapes in tagged templates ([#274](https://github.com/babel/babylon/pull/274)) (Kevin Gibbons)
49
 * Throw error if new.target is used outside of a function ([#402](https://github.com/babel/babylon/pull/402)) (Brian Ng)
50
 * Fix parsing of class properties ([#351](https://github.com/babel/babylon/pull/351)) (Kevin Gibbons)
51
 * Fix parsing yield with dynamicImport ([#383](https://github.com/babel/babylon/pull/383)) (Brian Ng)
52
 * Ensure consistent start args for parseParenItem ([#386](https://github.com/babel/babylon/pull/386)) (Brian Ng)
53

    
54
## 6.16.0 (2017-02-23)
55

    
56
### :rocket: New Feature
57

    
58
***ESTree*** compatibility as plugin ([#277](https://github.com/babel/babylon/pull/277)) (Daniel Tschinder)
59

    
60
We finally introduce a new compatibility layer for ESTree. To put babylon into ESTree-compatible mode the new plugin `estree` can be enabled. In this mode the parser will output an AST that is compliant to the specs of [ESTree](https://github.com/estree/estree/)
61

    
62
We highly recommend everyone who uses babylon outside of babel to use this plugin. This will make it much easier for users to switch between different ESTree-compatible parsers. We so far tested several projects with different parsers and exchanged their parser to babylon and in nearly all cases it worked out of the box. Some other estree-compatible parsers include `acorn`, `esprima`, `espree`, `flow-parser`, etc.
63

    
64
To enable `estree` mode simply add the plugin in the config:
65
```json
66
{
67
  "plugins": [ "estree" ]
68
}
69
```
70

    
71
If you want to migrate your project from non-ESTree mode to ESTree, have a look at our [Readme](https://github.com/babel/babylon/#output), where all deviations are mentioned.
72

    
73
Add a parseExpression public method ([#213](https://github.com/babel/babylon/pull/213)) (jeromew)
74

    
75
Babylon exports a new function to parse a single expression
76

    
77
```js
78
import { parseExpression } from 'babylon';
79

    
80
const ast = parseExpression('x || y && z', options);
81
```
82

    
83
The returned AST will only consist of the expression. The options are the same as for `parse()`
84

    
85
Add startLine option ([#346](https://github.com/babel/babylon/pull/346)) (Raphael Mu)
86

    
87
A new option was added to babylon allowing to change the intial linenumber for the first line which is usually `1`.
88
Changing this for example to `100` will make line `1` of the input source to be marked as line `100`, line `2` as `101`, line `3` as `102`, ...
89

    
90
Function predicate declaration ([#103](https://github.com/babel/babylon/pull/103)) (Panagiotis Vekris)
91

    
92
Added support for function predicates which flow introduced in version 0.33.0
93

    
94
```js
95
declare function is_number(x: mixed): boolean %checks(typeof x === "number");
96
```
97

    
98
Allow imports in declare module ([#315](https://github.com/babel/babylon/pull/315)) (Daniel Tschinder)
99

    
100
Added support for imports within module declarations which flow introduced in version 0.37.0
101

    
102
```js
103
declare module "C" {
104
  import type { DT } from "D";
105
  declare export type CT = { D: DT };
106
}
107
```
108

    
109
### :eyeglasses: Spec Compliancy
110

    
111
Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons)
112

    
113
This example now correctly throws an error when there is a semicolon after the decorator:
114

    
115
```js
116
class A {
117
@a;
118
foo(){}
119
}
120
```
121

    
122
Keywords are not allowed as local specifier ([#307](https://github.com/babel/babylon/pull/307)) (Daniel Tschinder)
123

    
124
Using keywords in imports is not allowed anymore:
125

    
126
```js
127
import { default } from "foo";
128
import { a as debugger } from "foo";
129
```
130

    
131
Do not allow overwritting of primitive types ([#314](https://github.com/babel/babylon/pull/314)) (Daniel Tschinder)
132

    
133
In flow it is now forbidden to overwrite the primitve types `"any"`, `"mixed"`, `"empty"`, `"bool"`, `"boolean"`, `"number"`, `"string"`, `"void"` and `"null"` with your own type declaration.
134

    
135
Disallow import type { type a } from … ([#305](https://github.com/babel/babylon/pull/305)) (Daniel Tschinder)
136

    
137
The following code now correctly throws an error
138

    
139
```js
140
import type { type a } from "foo";
141
```
142

    
143
Don't parse class properties without initializers when classProperties is disabled and Flow is enabled ([#300](https://github.com/babel/babylon/pull/300)) (Andrew Levine)
144

    
145
Ensure that you enable the `classProperties` plugin in order to enable correct parsing of class properties. Prior to this version it was possible to parse them by enabling the `flow` plugin but this was not intended the behaviour.
146

    
147
If you enable the flow plugin you can only define the type of the class properties, but not initialize them.
148

    
149
Fix export default async function to be FunctionDeclaration ([#324](https://github.com/babel/babylon/pull/324)) (Daniel Tschinder)
150

    
151
Parsing the following code now returns a `FunctionDeclaration` AST node instead of `FunctionExpression`.
152

    
153
```js
154
export default async function bar() {};
155
```
156

    
157
### :nail_care: Polish
158

    
159
Improve error message on attempt to destructure named import ([#288](https://github.com/babel/babylon/pull/288)) (Brian Ng)
160

    
161
### :bug: Bug Fix
162

    
163
Fix negative number literal typeannotations ([#366](https://github.com/babel/babylon/pull/366)) (Daniel Tschinder)
164

    
165
Ensure takeDecorators is called on exported class ([#358](https://github.com/babel/babylon/pull/358)) (Brian Ng)
166

    
167
ESTree: correctly change literals in all cases ([#368](https://github.com/babel/babylon/pull/368)) (Daniel Tschinder)
168

    
169
Correctly convert RestProperty to Assignable ([#339](https://github.com/babel/babylon/pull/339)) (Daniel Tschinder)
170

    
171
Fix #321 by allowing question marks in type params ([#338](https://github.com/babel/babylon/pull/338)) (Daniel Tschinder)
172

    
173
Fix #336 by correctly setting arrow-param ([#337](https://github.com/babel/babylon/pull/337)) (Daniel Tschinder)
174

    
175
Fix parse error when destructuring `set` with default value ([#317](https://github.com/babel/babylon/pull/317)) (Brian Ng)
176

    
177
Fix ObjectTypeCallProperty static ([#298](https://github.com/babel/babylon/pull/298)) (Dan Harper)
178

    
179

    
180
### :house: Internal
181

    
182
Fix generator-method-with-computed-name spec ([#360](https://github.com/babel/babylon/pull/360)) (Alex Rattray)
183

    
184
Fix flow type-parameter-declaration test with unintended semantic ([#361](https://github.com/babel/babylon/pull/361)) (Alex Rattray)
185

    
186
Cleanup and splitup parser functions ([#295](https://github.com/babel/babylon/pull/295)) (Daniel Tschinder)
187

    
188
chore(package): update flow-bin to version 0.38.0 ([#313](https://github.com/babel/babylon/pull/313)) (greenkeeper[bot])
189

    
190
Call inner function instead of 1:1 copy to plugin ([#294](https://github.com/babel/babylon/pull/294)) (Daniel Tschinder)
191

    
192
Update eslint-config-babel to the latest version 🚀 ([#299](https://github.com/babel/babylon/pull/299)) (greenkeeper[bot])
193

    
194
Update eslint-config-babel to the latest version 🚀 ([#293](https://github.com/babel/babylon/pull/293)) (greenkeeper[bot])
195

    
196
devDeps: remove eslint-plugin-babel ([#292](https://github.com/babel/babylon/pull/292)) (Kai Cataldo)
197

    
198
Correct indent eslint rule config ([#276](https://github.com/babel/babylon/pull/276)) (Daniel Tschinder)
199

    
200
Fail tests that have expected.json and throws-option ([#285](https://github.com/babel/babylon/pull/285)) (Daniel Tschinder)
201

    
202
### :memo: Documentation
203

    
204
Update contributing with more test info [skip ci] ([#355](https://github.com/babel/babylon/pull/355)) (Brian Ng)
205

    
206
Update API documentation ([#330](https://github.com/babel/babylon/pull/330)) (Timothy Gu)
207

    
208
Added keywords to package.json ([#323](https://github.com/babel/babylon/pull/323)) (Dmytro)
209

    
210
AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon/pull/318)) (Mathias Bynens)
211

    
212
## 6.15.0 (2017-01-10)
213

    
214
### :eyeglasses: Spec Compliancy
215

    
216
Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison)
217

    
218
This change implements flows new shorthand import syntax
219
and where previously you had to write this code:
220

    
221
```js
222
import {someValue} from "blah";
223
import type {someType} from "blah";
224
import typeof {someOtherValue} from "blah";
225
```
226

    
227
you can now write it like this:
228

    
229
```js
230
import {
231
  someValue,
232
  type someType,
233
  typeof someOtherValue,
234
} from "blah";
235
```
236

    
237
For more information look at [this](https://github.com/facebook/flow/pull/2890) pull request.
238

    
239
flow: allow leading pipes in all positions ([#256](https://github.com/babel/babylon/pull/256)) (Vladimir Kurchatkin)
240

    
241
This change now allows a leading pipe everywhere types can be used:
242
```js
243
var f = (x): | 1 | 2 => 1;
244
```
245

    
246
Throw error when exporting non-declaration ([#241](https://github.com/babel/babylon/pull/241)) (Kai Cataldo)
247

    
248
Previously babylon parsed the following exports, although they are not valid:
249
```js
250
export typeof foo;
251
export new Foo();
252
export function() {};
253
export for (;;);
254
export while(foo);
255
```
256

    
257
### :bug: Bug Fix
258

    
259
Don't set inType flag when parsing property names ([#266](https://github.com/babel/babylon/pull/266)) (Vladimir Kurchatkin)
260

    
261
This fixes parsing of this case:
262

    
263
```js
264
const map = {
265
  [age <= 17] : 'Too young'
266
};
267
```
268

    
269
Fix source location for JSXEmptyExpression nodes (fixes #248) ([#249](https://github.com/babel/babylon/pull/249)) (James Long)
270

    
271
The following case produced an invalid AST
272
```js
273
<div>{/* foo */}</div>
274
```
275

    
276
Use fromCodePoint to convert high value unicode entities ([#243](https://github.com/babel/babylon/pull/243)) (Ryan Duffy)
277

    
278
When high value unicode entities (e.g. 💩) were used in the input source code they are now correctly encoded in the resulting AST.
279

    
280
Rename folder to avoid Windows-illegal characters ([#281](https://github.com/babel/babylon/pull/281)) (Ryan Plant)
281

    
282
Allow this.state.clone() when parsing decorators ([#262](https://github.com/babel/babylon/pull/262)) (Alex Rattray)
283

    
284
### :house: Internal
285

    
286
User external-helpers ([#254](https://github.com/babel/babylon/pull/254)) (Daniel Tschinder)
287

    
288
Add watch script for dev ([#234](https://github.com/babel/babylon/pull/234)) (Kai Cataldo)
289

    
290
Freeze current plugins list for "*" option, and remove from README.md ([#245](https://github.com/babel/babylon/pull/245)) (Andrew Levine)
291

    
292
Prepare tests for multiple fixture runners. ([#240](https://github.com/babel/babylon/pull/240)) (Daniel Tschinder)
293

    
294
Add some test coverage for decorators stage-0 plugin ([#250](https://github.com/babel/babylon/pull/250)) (Andrew Levine)
295

    
296
Refactor tokenizer types file ([#263](https://github.com/babel/babylon/pull/263)) (Sven SAULEAU)
297

    
298
Update eslint-config-babel to the latest version 🚀 ([#273](https://github.com/babel/babylon/pull/273)) (greenkeeper[bot])
299

    
300
chore(package): update rollup to version 0.41.0 ([#272](https://github.com/babel/babylon/pull/272)) (greenkeeper[bot])
301

    
302
chore(package): update flow-bin to version 0.37.0 ([#255](https://github.com/babel/babylon/pull/255)) (greenkeeper[bot])
303

    
304
## 6.14.1 (2016-11-17)
305

    
306
### :bug: Bug Fix
307

    
308
Allow `"plugins": ["*"]` ([#229](https://github.com/babel/babylon/pull/229)) (Daniel Tschinder)
309

    
310
```js
311
{
312
  "plugins": ["*"]
313
}
314
```
315

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

    
318
## 6.14.0 (2016-11-16)
319

    
320
### :eyeglasses: Spec Compliancy
321

    
322
Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo)
323

    
324
[11.6.2.2 Future Reserved Words](http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words)
325

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

    
328
```
329
class enum {} // throws
330
class await {} // throws in strict mode (module)
331
```
332

    
333
Optional names for function types and object type indexers ([#197](https://github.com/babel/babylon/pull/197)) (Gabe Levi)
334

    
335
So where you used to have to write
336

    
337
```js
338
type A = (x: string, y: boolean) => number;
339
type B = (z: string) => number;
340
type C = { [key: string]: number };
341
```
342

    
343
you can now write (with flow 0.34.0)
344

    
345
```js
346
type A = (string, boolean) => number;
347
type B = string => number;
348
type C = { [string]: number };
349
```
350

    
351
Parse flow nested array type annotations like `number[][]` ([#219](https://github.com/babel/babylon/pull/219)) (Bernhard Häussner)
352

    
353
Supports these form now of specifying array types:
354

    
355
```js
356
var a: number[][][][];
357
var b: string[][];
358
```
359

    
360
### :bug: Bug Fix
361

    
362
Correctly eat semicolon at the end of `DelcareModuleExports` ([#223](https://github.com/babel/babylon/pull/223))  (Daniel Tschinder)
363

    
364
```
365
declare module "foo" { declare module.exports: number }
366
declare module "foo" { declare module.exports: number; }  // also allowed now
367
```
368

    
369
### :house: Internal
370

    
371
 * Count Babel tests towards Babylon code coverage ([#182](https://github.com/babel/babylon/pull/182)) (Moti Zilberman)
372
 * Fix strange line endings ([#214](https://github.com/babel/babylon/pull/214)) (Thomas Grainger)
373
 * Add node 7 (Daniel Tschinder)
374
 * chore(package): update flow-bin to version 0.34.0 ([#204](https://github.com/babel/babylon/pull/204)) (Greenkeeper)
375

    
376
## v6.13.1 (2016-10-26)
377

    
378
### :nail_care: Polish
379

    
380
- Use rollup for bundling to speed up startup time ([#190](https://github.com/babel/babylon/pull/190)) ([@drewml](https://github.com/DrewML))
381

    
382
```js
383
const babylon = require('babylon');
384
const ast = babylon.parse('var foo = "lol";');
385
```
386

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

    
389
**Without bundling**
390
![image](https://cloud.githubusercontent.com/assets/5233399/19420264/3133497e-93ad-11e6-9a6a-2da59c4f5c13.png)
391

    
392
**With bundling**
393
![image](https://cloud.githubusercontent.com/assets/5233399/19420267/388f556e-93ad-11e6-813e-7c5c396be322.png)
394

    
395
- add clean command [skip ci] ([#201](https://github.com/babel/babylon/pull/201)) (Henry Zhu)
396
- add ForAwaitStatement (async generator already added) [skip ci] ([#196](https://github.com/babel/babylon/pull/196)) (Henry Zhu)
397

    
398
## v6.13.0 (2016-10-21)
399

    
400
### :eyeglasses: Spec Compliancy
401

    
402
Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman)
403

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

    
406
```js
407
type T = { +p: T };
408
interface T { -p: T };
409
declare class T { +[k:K]: V };
410
class T { -[k:K]: V };
411
class C2 { +p: T = e };
412
```
413

    
414
Raise error on duplicate definition of __proto__ ([#183](https://github.com/babel/babylon/pull/183)) (Moti Zilberman)
415

    
416
```js
417
({ __proto__: 1, __proto__: 2 }) // Throws an error now
418
```
419

    
420
### :bug: Bug Fix
421

    
422
Flow: Allow class properties to be named `static` ([#184](https://github.com/babel/babylon/pull/184)) (Moti Zilberman)
423

    
424
```js
425
declare class A {
426
  static: T;
427
}
428
```
429

    
430
Allow "async" as identifier for object literal property shorthand ([#187](https://github.com/babel/babylon/pull/187)) (Andrew Levine)
431

    
432
```js
433
var foo = { async, bar };
434
```
435

    
436
### :nail_care: Polish
437

    
438
Fix flowtype and add inType to state ([#189](https://github.com/babel/babylon/pull/189)) (Daniel Tschinder)
439

    
440
> This improves the performance slightly (because of hidden classes)
441

    
442
### :house: Internal
443

    
444
Fix .gitattributes line ending setting ([#191](https://github.com/babel/babylon/pull/191)) (Moti Zilberman)
445

    
446
Increase test coverage ([#175](https://github.com/babel/babylon/pull/175) (Moti Zilberman)
447

    
448
Readd missin .eslinignore for IDEs (Daniel Tschinder)
449

    
450
Error on missing expected.json fixture in CI ([#188](https://github.com/babel/babylon/pull/188)) (Moti Zilberman)
451

    
452
Add .gitattributes and .editorconfig for LF line endings ([#179](https://github.com/babel/babylon/pull/179)) (Moti Zilberman)
453

    
454
Fixes two tests that are failing after the merge of #172 ([#177](https://github.com/babel/babylon/pull/177)) (Moti Zilberman)
455

    
456
## v6.12.0 (2016-10-14)
457

    
458
### :eyeglasses: Spec Compliancy
459

    
460
Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler)
461

    
462
#### Dynamic Import
463

    
464
- Proposal Repo: https://github.com/domenic/proposal-dynamic-import
465
- Championed by [@domenic](https://github.com/domenic)
466
- stage-2
467
- [sept-28 tc39 notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-09/sept-28.md#113a-import)
468

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

    
471
```js
472
import(`./section-modules/${link.dataset.entryModule}.js`)
473
.then(module => {
474
  module.loadPageInto(main);
475
})
476
```
477

    
478
Add EmptyTypeAnnotation ([#171](https://github.com/babel/babylon/pull/171)) (Sam Goldman)
479

    
480
#### EmptyTypeAnnotation
481

    
482
Just wasn't covered before.
483

    
484
```js
485
type T = empty;
486
```
487

    
488
### :bug: Bug Fix
489

    
490
Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels)
491

    
492
```js
493
// was failing due to sparse array
494
export const { foo: [ ,, qux7 ] } = bar;
495
```
496

    
497
Allow keyword in Flow object declaration property names with type parameters ([#146](https://github.com/babel/babylon/pull/146)) (Dan Harper)
498

    
499
```js
500
declare class X {
501
  foobar<T>(): void;
502
  static foobar<T>(): void;
503
}
504
```
505

    
506
Allow keyword in object/class property names with Flow type parameters ([#145](https://github.com/babel/babylon/pull/145)) (Dan Harper)
507

    
508
```js
509
class Foo {
510
  delete<T>(item: T): T {
511
    return item;
512
  }
513
}
514
```
515

    
516
Allow typeAnnotations for yield expressions ([#174](https://github.com/babel/babylon/pull/174))) (Daniel Tschinder)
517

    
518
```js
519
function *foo() {
520
  const x = (yield 5: any);
521
}
522
```
523

    
524
### :nail_care: Polish
525

    
526
Annotate more errors with expected token ([#172](https://github.com/babel/babylon/pull/172))) (Moti Zilberman)
527

    
528
```js
529
// Unexpected token, expected ; (1:6)
530
{ set 1 }
531
```
532

    
533
### :house: Internal
534

    
535
Remove kcheck ([#173](https://github.com/babel/babylon/pull/173)))  (Daniel Tschinder)
536

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

    
539
## v6.11.6 (2016-10-12)
540

    
541
### :bug: Bug Fix/Regression
542

    
543
Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels)
544

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

    
550
## v6.11.5 (2016-10-12)
551

    
552
### :eyeglasses: Spec Compliancy
553

    
554
Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo)
555

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

    
562
Fix: Check for duplicate named exports in exported rest elements/properties ([#164](https://github.com/babel/babylon/pull/164)) (Kai Cataldo)
563

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

    
570
### :bug: Bug Fix
571

    
572
Fix: Allow identifier `async` for default param in arrow expression ([#165](https://github.com/babel/babylon/pull/165)) (Kai Cataldo)
573

    
574
```js
575
// this is ok now
576
const test = ({async = true}) => {};
577
```
578

    
579
### :nail_care: Polish
580

    
581
Babylon will now print out the token it's expecting if there's a `SyntaxError` ([#150](https://github.com/babel/babylon/pull/150)) (Daniel Tschinder)
582

    
583
```bash
584
# So in the case of a missing ending curly (`}`)
585
Module build failed: SyntaxError: Unexpected token, expected } (30:0)
586
  28 |   }
587
  29 |
588
> 30 |
589
     | ^
590
```
591

    
592
## v6.11.4 (2016-10-03)
593

    
594
Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu)
595

    
596
## v6.11.3 (2016-10-01)
597

    
598
### :eyeglasses: Spec Compliancy
599

    
600
Add static errors for object rest (#149) ([@danez](https://github.com/danez))
601

    
602
> https://github.com/sebmarkbage/ecmascript-rest-spread
603

    
604
Object rest copies the *rest* of properties from the right hand side `obj` starting from the left to right.
605

    
606
```js
607
let { x, y, ...z } =  { x: 1, y: 2, z: 3 };
608
// x = 1
609
// y = 2
610
// z = { z: 3 }
611
```
612

    
613
#### New Syntax Errors:
614

    
615
**SyntaxError**: The rest element has to be the last element when destructuring (1:10)
616
```bash
617
> 1 | let { ...x, y, z } = { x: 1, y: 2, z: 3};
618
    |           ^
619
# Previous behavior:
620
# x = { x: 1, y: 2, z: 3 }
621
# y = 2
622
# z = 3
623
```
624

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

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

    
629
```bash
630
> 1 | let { x, ...y, ...z } = { x: 1, y: 2, z: 3};
631
    |              ^
632
# Previous behavior:
633
# x = 1
634
# y = { y: 2, z: 3 }
635
# z = { y: 2, z: 3 }
636
```
637

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

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

    
642
```js
643
let { x, y, ...z, } = obj;
644
```
645

    
646
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.
647

    
648
---
649

    
650
get / set are valid property names in default assignment (#142) ([@jezell](https://github.com/jezell))
651

    
652
```js
653
// valid
654
function something({ set = null, get = null }) {}
655
```
656

    
657
## v6.11.2 (2016-09-23)
658

    
659
### Bug Fix
660

    
661
- [#139](https://github.com/babel/babylon/issues/139) Don't do the duplicate check if not an identifier (#140) @hzoo
662

    
663
```js
664
// regression with duplicate export check
665
SyntaxError: ./typography.js: `undefined` has already been exported. Exported identifiers must be unique. (22:13)
666
  20 |
667
  21 | export const { rhythm } = typography;
668
> 22 | export const { TypographyStyle } = typography
669
```
670

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

    
673
## 6.11.1 (2016-09-22)
674

    
675
### Bug Fix
676
- [#137](https://github.com/babel/babylon/pull/137) - Fix a regression with duplicate exports - it was erroring on all keys in `Object.prototype`. @danez
677

    
678
```javascript
679
export toString from './toString';
680
```
681

    
682
```bash
683
`toString` has already been exported. Exported identifiers must be unique. (1:7)
684
> 1 | export toString from './toString';
685
    |        ^
686
  2 |
687
```
688

    
689
## 6.11.0 (2016-09-22)
690

    
691
### Spec Compliancy (will break CI)
692

    
693
- Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo
694

    
695
```js
696
// Only one default export allowed per module. (2:9)
697
export default function() {};
698
export { foo as default };
699

    
700
// Only one default export allowed per module. (2:0)
701
export default {};
702
export default function() {};
703

    
704
// `Foo` has already been exported. Exported identifiers must be unique. (2:0)
705
export { Foo };
706
export class Foo {};
707
```
708

    
709
### New Feature (Syntax)
710

    
711
- Add support for computed class property names ([#121](https://github.com/babel/babylon/pull/121)) @motiz88
712

    
713
```js
714
// AST
715
interface ClassProperty <: Node {
716
  type: "ClassProperty";
717
  key: Identifier;
718
  value: Expression;
719
  computed: boolean; // added
720
}
721
```
722

    
723
```js
724
// with "plugins": ["classProperties"]
725
class Foo {
726
  [x]
727
  ['y']
728
}
729

    
730
class Bar {
731
  [p]
732
  [m] () {}
733
}
734
 ```
735

    
736
### Bug Fix
737

    
738
- Fix `static` property falling through in the declare class Flow AST ([#135](https://github.com/babel/babylon/pull/135)) @danharper
739

    
740
```js
741
declare class X {
742
    a: number;
743
    static b: number; // static
744
    c: number; // this was being marked as static in the AST as well
745
}
746
```
747

    
748
### Polish
749

    
750
- Rephrase "assigning/binding to rvalue" errors to include context ([#119](https://github.com/babel/babylon/pull/119)) @motiz88
751

    
752
```js
753
// Used to error with:
754
// SyntaxError: Assigning to rvalue (1:0)
755

    
756
// Now:
757
// Invalid left-hand side in assignment expression (1:0)
758
3 = 4
759

    
760
// Invalid left-hand side in for-in statement (1:5)
761
for (+i in {});
762
```
763

    
764
### Internal
765

    
766
- Fix call to `this.parseMaybeAssign` with correct arguments ([#133](https://github.com/babel/babylon/pull/133)) @danez
767
- Add semver note to changelog ([#131](https://github.com/babel/babylon/pull/131)) @hzoo
768

    
769
## 6.10.0 (2016-09-19)
770

    
771
> We plan to include some spec compliancy bugs in patch versions. An example was the multiple default exports issue.
772

    
773
### Spec Compliancy
774

    
775
* Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu)
776

    
777
> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false. https://tc39.github.io/ecma262/2016/#sec-function-definitions-static-semantics-early-errors
778

    
779
More Context: [tc39-notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-07/july-29.md#611-the-scope-of-use-strict-with-respect-to-destructuring-in-parameter-lists)
780

    
781
For example:
782

    
783
```js
784
// this errors because it uses destructuring and default parameters
785
// in a function with a "use strict" directive
786
function a([ option1, option2 ] = []) {
787
  "use strict";
788
}
789
 ```
790

    
791
The solution would be to use a top level "use strict" or to remove the destructuring or default parameters when using a function + "use strict" or to.
792

    
793
### New Feature
794

    
795
* Exact object type annotations for Flow plugin ([#104](https://github.com/babel/babylon/pull/104)) (Basil Hosmer)
796

    
797
Added to flow in https://github.com/facebook/flow/commit/c710c40aa2a115435098d6c0dfeaadb023cd39b8
798

    
799
Looks like:
800

    
801
```js
802
var a : {| x: number, y: string |} = { x: 0, y: 'foo' };
803
```
804

    
805
### Bug Fixes
806

    
807
* Include `typeParameter` location in `ArrowFunctionExpression` ([#126](https://github.com/babel/babylon/pull/126)) (Daniel Tschinder)
808
* Error on invalid flow type annotation with default assignment ([#122](https://github.com/babel/babylon/pull/122)) (Dan Harper)
809
* Fix Flow return types on arrow functions ([#124](https://github.com/babel/babylon/pull/124)) (Dan Harper)
810

    
811
### Misc
812

    
813
* Add tests for export extensions ([#127](https://github.com/babel/babylon/pull/127)) (Daniel Tschinder)
814
* Fix Contributing guidelines [skip ci] (Daniel Tschinder)
815

    
816
## 6.9.2 (2016-09-09)
817

    
818
The only change is to remove the `babel-runtime` dependency by compiling with Babel's ES2015 loose mode. So using babylon standalone should be smaller.
819

    
820
## 6.9.1 (2016-08-23)
821

    
822
This release contains mainly small bugfixes but also updates babylons default mode to es2017. The features for `exponentiationOperator`, `asyncFunctions` and `trailingFunctionCommas` which previously needed to be activated via plugin are now enabled by default and the plugins are now no-ops.
823

    
824
### Bug Fixes
825

    
826
- Fix issues with default object params in async functions ([#96](https://github.com/babel/babylon/pull/96)) @danez
827
- Fix issues with flow-types and async function ([#95](https://github.com/babel/babylon/pull/95)) @danez
828
- Fix arrow functions with destructuring, types & default value ([#94](https://github.com/babel/babylon/pull/94)) @danharper
829
- Fix declare class with qualified type identifier ([#97](https://github.com/babel/babylon/pull/97)) @danez
830
- Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas plugins and enable them by default ([#98](https://github.com/babel/babylon/pull/98)) @danez
831

    
832
## 6.9.0 (2016-08-16)
833

    
834
### New syntax support
835

    
836
- Add JSX spread children ([#42](https://github.com/babel/babylon/pull/42)) @calebmer
837

    
838
(Be aware that React is not going to support this syntax)
839

    
840
```js
841
<div>
842
  {...todos.map(todo => <Todo key={todo.id} todo={todo}/>)}
843
</div>
844
```
845

    
846
- Add support for declare module.exports ([#72](https://github.com/babel/babylon/pull/72)) @danez
847

    
848
```js
849
declare module "foo" {
850
  declare module.exports: {}
851
}
852
```
853

    
854
### New Features
855

    
856
- If supplied, attach filename property to comment node loc. ([#80](https://github.com/babel/babylon/pull/80)) @divmain
857
- Add identifier name to node loc field ([#90](https://github.com/babel/babylon/pull/90)) @kittens
858

    
859
### Bug Fixes
860

    
861
- Fix exponential operator to behave according to spec ([#75](https://github.com/babel/babylon/pull/75)) @danez
862
- Fix lookahead to not add comments to arrays which are not cloned ([#76](https://github.com/babel/babylon/pull/76)) @danez
863
- Fix accidental fall-through in Flow type parsing. ([#82](https://github.com/babel/babylon/pull/82)) @xiemaisi
864
- Only allow declares inside declare module ([#73](https://github.com/babel/babylon/pull/73)) @danez
865
- Small fix for parsing type parameter declarations ([#83](https://github.com/babel/babylon/pull/83)) @gabelevi
866
- Fix arrow param locations with flow types ([#57](https://github.com/babel/babylon/pull/57)) @danez
867
- Fixes SyntaxError position with flow optional type ([#65](https://github.com/babel/babylon/pull/65)) @danez
868

    
869
### Internal
870

    
871
- Add codecoverage to tests @danez
872
- Fix tests to not save expected output if we expect the test to fail @danez
873
- Make a shallow clone of babel for testing @danez
874
- chore(package): update cross-env to version 2.0.0 ([#77](https://github.com/babel/babylon/pull/77)) @greenkeeperio-bot
875
- chore(package): update ava to version 0.16.0 ([#86](https://github.com/babel/babylon/pull/86)) @greenkeeperio-bot
876
- chore(package): update babel-plugin-istanbul to version 2.0.0 ([#89](https://github.com/babel/babylon/pull/89)) @greenkeeperio-bot
877
- chore(package): update nyc to version 8.0.0 ([#88](https://github.com/babel/babylon/pull/88)) @greenkeeperio-bot
878

    
879
## 6.8.4 (2016-07-06)
880

    
881
### Bug Fixes
882

    
883
- Fix the location of params, when flow and default value used ([#68](https://github.com/babel/babylon/pull/68)) @danez
884

    
885
## 6.8.3 (2016-07-02)
886

    
887
### Bug Fixes
888

    
889
- Fix performance regression introduced in 6.8.2 with conditionals ([#63](https://github.com/babel/babylon/pull/63)) @danez
890

    
891
## 6.8.2 (2016-06-24)
892

    
893
### Bug Fixes
894

    
895
- Fix parse error with yielding jsx elements in generators `function* it() { yield <a></a>; }` ([#31](https://github.com/babel/babylon/pull/31)) @eldereal
896
- When cloning nodes do not clone its comments ([#24](https://github.com/babel/babylon/pull/24)) @danez
897
- Fix parse errors when using arrow functions with an spread element and return type `(...props): void => {}` ([#10](https://github.com/babel/babylon/pull/10)) @danez
898
- Fix leading comments added from previous node ([#23](https://github.com/babel/babylon/pull/23)) @danez
899
- Fix parse errors with flow's optional arguments `(arg?) => {}` ([#19](https://github.com/babel/babylon/pull/19)) @danez
900
- Support negative numeric type literals @kittens
901
- Remove line terminator restriction after await keyword @kittens
902
- Remove grouped type arrow restriction as it seems flow no longer has it @kittens
903
- Fix parse error with generic methods that have the name `get` or `set` `class foo { get() {} }` ([#55](https://github.com/babel/babylon/pull/55)) @vkurchatkin
904
- Fix parse error with arrow functions that have flow type parameter declarations `<T>(x: T): T => x;` ([#54](https://github.com/babel/babylon/pull/54)) @gabelevi
905

    
906
### Documentation
907

    
908
- Document AST differences from ESTree ([#41](https://github.com/babel/babylon/pull/41)) @nene
909
- Move ast spec from babel/babel ([#46](https://github.com/babel/babylon/pull/46)) @hzoo
910

    
911
### Internal
912

    
913
- Enable skipped tests ([#16](https://github.com/babel/babylon/pull/16)) @danez
914
- Add script to test latest version of babylon with babel ([#21](https://github.com/babel/babylon/pull/21)) @danez
915
- Upgrade test runner ava @kittens
916
- Add missing generate-identifier-regex script @kittens
917
- Rename parser context types @kittens
918
- Add node v6 to travis testing @hzoo
919
- Update to Unicode v9 ([#45](https://github.com/babel/babylon/pull/45)) @mathiasbynens
920

    
921
## 6.8.1 (2016-06-06)
922

    
923
### New Feature
924

    
925
- Parse type parameter declarations with defaults like `type Foo<T = string> = T`
926

    
927
### Bug Fixes
928
- Type parameter declarations need 1 or more type parameters.
929
- The existential type `*` is not a valid type parameter.
930
- The existential type `*` is a primary type
931

    
932
### Spec Compliancy
933
- The param list for type parameter declarations now consists of `TypeParameter` nodes
934
- New `TypeParameter` AST Node (replaces using the `Identifier` node before)
935

    
936
```
937
interface TypeParameter <: Node {
938
  bound: TypeAnnotation;
939
  default: TypeAnnotation;
940
  name: string;
941
  variance: "plus" | "minus";
942
}
943
```
944

    
945
## 6.8.0 (2016-05-02)
946

    
947
#### New Feature
948

    
949
##### Parse Method Parameter Decorators ([#12](https://github.com/babel/babylon/pull/12))
950

    
951
> [Method Parameter Decorators](https://goo.gl/8MmCMG) is now a TC39 [stage 0 proposal](https://github.com/tc39/ecma262/blob/master/stage0.md).
952

    
953
Examples:
954

    
955
```js
956
class Foo {
957
  constructor(@foo() x, @bar({ a: 123 }) @baz() y) {}
958
}
959

    
960
export default function func(@foo() x, @bar({ a: 123 }) @baz() y) {}
961

    
962
var obj = {
963
  method(@foo() x, @bar({ a: 123 }) @baz() y) {}
964
};
965
```
966

    
967
##### Parse for-await statements (w/ `asyncGenerators` plugin) ([#17](https://github.com/babel/babylon/pull/17))
968

    
969
There is also a new node type, `ForAwaitStatement`.
970

    
971
> [Async generators and for-await](https://github.com/tc39/proposal-async-iteration) are now a [stage 2 proposal](https://github.com/tc39/ecma262#current-proposals).
972

    
973
Example:
974

    
975
```js
976
async function f() {
977
  for await (let x of y);
978
}
979
```
(1-1/4)