web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

979 lines
34 KiB

  1. # Changelog
  2. > **Tags:**
  3. > - :boom: [Breaking Change]
  4. > - :eyeglasses: [Spec Compliancy]
  5. > - :rocket: [New Feature]
  6. > - :bug: [Bug Fix]
  7. > - :memo: [Documentation]
  8. > - :house: [Internal]
  9. > - :nail_care: [Polish]
  10. > Semver Policy: https://github.com/babel/babylon#semver
  11. _Note: Gaps between patch versions are faulty, broken or test releases._
  12. See the [Babel Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) for the pre-6.8.0 version Changelog.
  13. ## 6.17.4 (2017-06-18)
  14. * Fix comment attachment for call expressions (#575) (aardito2)
  15. * Correctly put typeParameters on FunctionExpression (#585) (Daniel Tschinder)
  16. ## 6.17.3 (2017-06-09)
  17. * Fix location info on FunctionTypeParam nodes (#565) (#571) (Michal Srb)
  18. * Fix stmt value being the raw value (#557) (#558) (Daniel Tschinder)
  19. ## 6.17.2 (2017-05-31)
  20. * 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)
  21. * Fix #437: only prohibit 'export type from "module" ' when flow is enabled (#438) (Kevin Gibbons)
  22. * Fix handling of anonymous parameters in `flowParseObjectTypeMethodish`. (#526) (Max Schaefer)
  23. * Convert argument of SpreadElement correctly to assignable (#518) (Daniel Tschinder)
  24. ## 6.17.1 (2017-05-10)
  25. * Fix typo in flow spread operator error (Brian Ng)
  26. * Fixed invalid number literal parsing ([#473](https://github.com/babel/babylon/pull/473)) (Alex Kuzmenko)
  27. * Fix number parser ([#433](https://github.com/babel/babylon/pull/433)) (Alex Kuzmenko)
  28. * Ensure non pattern shorthand props are checked for reserved words ([#479](https://github.com/babel/babylon/pull/479)) (Brian Ng)
  29. * Remove jsx context when parsing arrow functions ([#475](https://github.com/babel/babylon/pull/475)) (Brian Ng)
  30. * Allow super in class properties ([#499](https://github.com/babel/babylon/pull/499)) (Brian Ng)
  31. * Allow flow class field to be named constructor ([#510](https://github.com/babel/babylon/pull/510)) (Brian Ng)
  32. ## 6.17.0 (2017-04-20)
  33. * Cherry-pick #418 to 6.x ([#476](https://github.com/babel/babylon/pull/476)) (Sebastian McKenzie)
  34. * Add support for invalid escapes in tagged templates ([#274](https://github.com/babel/babylon/pull/274)) (Kevin Gibbons)
  35. * Throw error if new.target is used outside of a function ([#402](https://github.com/babel/babylon/pull/402)) (Brian Ng)
  36. * Fix parsing of class properties ([#351](https://github.com/babel/babylon/pull/351)) (Kevin Gibbons)
  37. * Fix parsing yield with dynamicImport ([#383](https://github.com/babel/babylon/pull/383)) (Brian Ng)
  38. * Ensure consistent start args for parseParenItem ([#386](https://github.com/babel/babylon/pull/386)) (Brian Ng)
  39. ## 6.16.0 (2017-02-23)
  40. ### :rocket: New Feature
  41. ***ESTree*** compatibility as plugin ([#277](https://github.com/babel/babylon/pull/277)) (Daniel Tschinder)
  42. 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/)
  43. 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.
  44. To enable `estree` mode simply add the plugin in the config:
  45. ```json
  46. {
  47. "plugins": [ "estree" ]
  48. }
  49. ```
  50. 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.
  51. Add a parseExpression public method ([#213](https://github.com/babel/babylon/pull/213)) (jeromew)
  52. Babylon exports a new function to parse a single expression
  53. ```js
  54. import { parseExpression } from 'babylon';
  55. const ast = parseExpression('x || y && z', options);
  56. ```
  57. The returned AST will only consist of the expression. The options are the same as for `parse()`
  58. Add startLine option ([#346](https://github.com/babel/babylon/pull/346)) (Raphael Mu)
  59. A new option was added to babylon allowing to change the intial linenumber for the first line which is usually `1`.
  60. 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`, ...
  61. Function predicate declaration ([#103](https://github.com/babel/babylon/pull/103)) (Panagiotis Vekris)
  62. Added support for function predicates which flow introduced in version 0.33.0
  63. ```js
  64. declare function is_number(x: mixed): boolean %checks(typeof x === "number");
  65. ```
  66. Allow imports in declare module ([#315](https://github.com/babel/babylon/pull/315)) (Daniel Tschinder)
  67. Added support for imports within module declarations which flow introduced in version 0.37.0
  68. ```js
  69. declare module "C" {
  70. import type { DT } from "D";
  71. declare export type CT = { D: DT };
  72. }
  73. ```
  74. ### :eyeglasses: Spec Compliancy
  75. Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons)
  76. This example now correctly throws an error when there is a semicolon after the decorator:
  77. ```js
  78. class A {
  79. @a;
  80. foo(){}
  81. }
  82. ```
  83. Keywords are not allowed as local specifier ([#307](https://github.com/babel/babylon/pull/307)) (Daniel Tschinder)
  84. Using keywords in imports is not allowed anymore:
  85. ```js
  86. import { default } from "foo";
  87. import { a as debugger } from "foo";
  88. ```
  89. Do not allow overwritting of primitive types ([#314](https://github.com/babel/babylon/pull/314)) (Daniel Tschinder)
  90. 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.
  91. Disallow import type { type a } from … ([#305](https://github.com/babel/babylon/pull/305)) (Daniel Tschinder)
  92. The following code now correctly throws an error
  93. ```js
  94. import type { type a } from "foo";
  95. ```
  96. 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)
  97. 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.
  98. If you enable the flow plugin you can only define the type of the class properties, but not initialize them.
  99. Fix export default async function to be FunctionDeclaration ([#324](https://github.com/babel/babylon/pull/324)) (Daniel Tschinder)
  100. Parsing the following code now returns a `FunctionDeclaration` AST node instead of `FunctionExpression`.
  101. ```js
  102. export default async function bar() {};
  103. ```
  104. ### :nail_care: Polish
  105. Improve error message on attempt to destructure named import ([#288](https://github.com/babel/babylon/pull/288)) (Brian Ng)
  106. ### :bug: Bug Fix
  107. Fix negative number literal typeannotations ([#366](https://github.com/babel/babylon/pull/366)) (Daniel Tschinder)
  108. Ensure takeDecorators is called on exported class ([#358](https://github.com/babel/babylon/pull/358)) (Brian Ng)
  109. ESTree: correctly change literals in all cases ([#368](https://github.com/babel/babylon/pull/368)) (Daniel Tschinder)
  110. Correctly convert RestProperty to Assignable ([#339](https://github.com/babel/babylon/pull/339)) (Daniel Tschinder)
  111. Fix #321 by allowing question marks in type params ([#338](https://github.com/babel/babylon/pull/338)) (Daniel Tschinder)
  112. Fix #336 by correctly setting arrow-param ([#337](https://github.com/babel/babylon/pull/337)) (Daniel Tschinder)
  113. Fix parse error when destructuring `set` with default value ([#317](https://github.com/babel/babylon/pull/317)) (Brian Ng)
  114. Fix ObjectTypeCallProperty static ([#298](https://github.com/babel/babylon/pull/298)) (Dan Harper)
  115. ### :house: Internal
  116. Fix generator-method-with-computed-name spec ([#360](https://github.com/babel/babylon/pull/360)) (Alex Rattray)
  117. Fix flow type-parameter-declaration test with unintended semantic ([#361](https://github.com/babel/babylon/pull/361)) (Alex Rattray)
  118. Cleanup and splitup parser functions ([#295](https://github.com/babel/babylon/pull/295)) (Daniel Tschinder)
  119. chore(package): update flow-bin to version 0.38.0 ([#313](https://github.com/babel/babylon/pull/313)) (greenkeeper[bot])
  120. Call inner function instead of 1:1 copy to plugin ([#294](https://github.com/babel/babylon/pull/294)) (Daniel Tschinder)
  121. Update eslint-config-babel to the latest version 🚀 ([#299](https://github.com/babel/babylon/pull/299)) (greenkeeper[bot])
  122. Update eslint-config-babel to the latest version 🚀 ([#293](https://github.com/babel/babylon/pull/293)) (greenkeeper[bot])
  123. devDeps: remove eslint-plugin-babel ([#292](https://github.com/babel/babylon/pull/292)) (Kai Cataldo)
  124. Correct indent eslint rule config ([#276](https://github.com/babel/babylon/pull/276)) (Daniel Tschinder)
  125. Fail tests that have expected.json and throws-option ([#285](https://github.com/babel/babylon/pull/285)) (Daniel Tschinder)
  126. ### :memo: Documentation
  127. Update contributing with more test info [skip ci] ([#355](https://github.com/babel/babylon/pull/355)) (Brian Ng)
  128. Update API documentation ([#330](https://github.com/babel/babylon/pull/330)) (Timothy Gu)
  129. Added keywords to package.json ([#323](https://github.com/babel/babylon/pull/323)) (Dmytro)
  130. AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon/pull/318)) (Mathias Bynens)
  131. ## 6.15.0 (2017-01-10)
  132. ### :eyeglasses: Spec Compliancy
  133. Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison)
  134. This change implements flows new shorthand import syntax
  135. and where previously you had to write this code:
  136. ```js
  137. import {someValue} from "blah";
  138. import type {someType} from "blah";
  139. import typeof {someOtherValue} from "blah";
  140. ```
  141. you can now write it like this:
  142. ```js
  143. import {
  144. someValue,
  145. type someType,
  146. typeof someOtherValue,
  147. } from "blah";
  148. ```
  149. For more information look at [this](https://github.com/facebook/flow/pull/2890) pull request.
  150. flow: allow leading pipes in all positions ([#256](https://github.com/babel/babylon/pull/256)) (Vladimir Kurchatkin)
  151. This change now allows a leading pipe everywhere types can be used:
  152. ```js
  153. var f = (x): | 1 | 2 => 1;
  154. ```
  155. Throw error when exporting non-declaration ([#241](https://github.com/babel/babylon/pull/241)) (Kai Cataldo)
  156. Previously babylon parsed the following exports, although they are not valid:
  157. ```js
  158. export typeof foo;
  159. export new Foo();
  160. export function() {};
  161. export for (;;);
  162. export while(foo);
  163. ```
  164. ### :bug: Bug Fix
  165. Don't set inType flag when parsing property names ([#266](https://github.com/babel/babylon/pull/266)) (Vladimir Kurchatkin)
  166. This fixes parsing of this case:
  167. ```js
  168. const map = {
  169. [age <= 17] : 'Too young'
  170. };
  171. ```
  172. Fix source location for JSXEmptyExpression nodes (fixes #248) ([#249](https://github.com/babel/babylon/pull/249)) (James Long)
  173. The following case produced an invalid AST
  174. ```js
  175. <div>{/* foo */}</div>
  176. ```
  177. Use fromCodePoint to convert high value unicode entities ([#243](https://github.com/babel/babylon/pull/243)) (Ryan Duffy)
  178. When high value unicode entities (e.g. 💩) were used in the input source code they are now correctly encoded in the resulting AST.
  179. Rename folder to avoid Windows-illegal characters ([#281](https://github.com/babel/babylon/pull/281)) (Ryan Plant)
  180. Allow this.state.clone() when parsing decorators ([#262](https://github.com/babel/babylon/pull/262)) (Alex Rattray)
  181. ### :house: Internal
  182. User external-helpers ([#254](https://github.com/babel/babylon/pull/254)) (Daniel Tschinder)
  183. Add watch script for dev ([#234](https://github.com/babel/babylon/pull/234)) (Kai Cataldo)
  184. Freeze current plugins list for "*" option, and remove from README.md ([#245](https://github.com/babel/babylon/pull/245)) (Andrew Levine)
  185. Prepare tests for multiple fixture runners. ([#240](https://github.com/babel/babylon/pull/240)) (Daniel Tschinder)
  186. Add some test coverage for decorators stage-0 plugin ([#250](https://github.com/babel/babylon/pull/250)) (Andrew Levine)
  187. Refactor tokenizer types file ([#263](https://github.com/babel/babylon/pull/263)) (Sven SAULEAU)
  188. Update eslint-config-babel to the latest version 🚀 ([#273](https://github.com/babel/babylon/pull/273)) (greenkeeper[bot])
  189. chore(package): update rollup to version 0.41.0 ([#272](https://github.com/babel/babylon/pull/272)) (greenkeeper[bot])
  190. chore(package): update flow-bin to version 0.37.0 ([#255](https://github.com/babel/babylon/pull/255)) (greenkeeper[bot])
  191. ## 6.14.1 (2016-11-17)
  192. ### :bug: Bug Fix
  193. Allow `"plugins": ["*"]` ([#229](https://github.com/babel/babylon/pull/229)) (Daniel Tschinder)
  194. ```js
  195. {
  196. "plugins": ["*"]
  197. }
  198. ```
  199. Will include all parser plugins instead of specifying each one individually. Useful for tools like babel-eslint, jscodeshift, and ast-explorer.
  200. ## 6.14.0 (2016-11-16)
  201. ### :eyeglasses: Spec Compliancy
  202. Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo)
  203. [11.6.2.2 Future Reserved Words](http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words)
  204. Babylon will throw for more reserved words such as `enum` or `await` (in strict mode).
  205. ```
  206. class enum {} // throws
  207. class await {} // throws in strict mode (module)
  208. ```
  209. Optional names for function types and object type indexers ([#197](https://github.com/babel/babylon/pull/197)) (Gabe Levi)
  210. So where you used to have to write
  211. ```js
  212. type A = (x: string, y: boolean) => number;
  213. type B = (z: string) => number;
  214. type C = { [key: string]: number };
  215. ```
  216. you can now write (with flow 0.34.0)
  217. ```js
  218. type A = (string, boolean) => number;
  219. type B = string => number;
  220. type C = { [string]: number };
  221. ```
  222. Parse flow nested array type annotations like `number[][]` ([#219](https://github.com/babel/babylon/pull/219)) (Bernhard Häussner)
  223. Supports these form now of specifying array types:
  224. ```js
  225. var a: number[][][][];
  226. var b: string[][];
  227. ```
  228. ### :bug: Bug Fix
  229. Correctly eat semicolon at the end of `DelcareModuleExports` ([#223](https://github.com/babel/babylon/pull/223)) (Daniel Tschinder)
  230. ```
  231. declare module "foo" { declare module.exports: number }
  232. declare module "foo" { declare module.exports: number; } // also allowed now
  233. ```
  234. ### :house: Internal
  235. * Count Babel tests towards Babylon code coverage ([#182](https://github.com/babel/babylon/pull/182)) (Moti Zilberman)
  236. * Fix strange line endings ([#214](https://github.com/babel/babylon/pull/214)) (Thomas Grainger)
  237. * Add node 7 (Daniel Tschinder)
  238. * chore(package): update flow-bin to version 0.34.0 ([#204](https://github.com/babel/babylon/pull/204)) (Greenkeeper)
  239. ## v6.13.1 (2016-10-26)
  240. ### :nail_care: Polish
  241. - Use rollup for bundling to speed up startup time ([#190](https://github.com/babel/babylon/pull/190)) ([@drewml](https://github.com/DrewML))
  242. ```js
  243. const babylon = require('babylon');
  244. const ast = babylon.parse('var foo = "lol";');
  245. ```
  246. With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph.
  247. **Without bundling**
  248. ![image](https://cloud.githubusercontent.com/assets/5233399/19420264/3133497e-93ad-11e6-9a6a-2da59c4f5c13.png)
  249. **With bundling**
  250. ![image](https://cloud.githubusercontent.com/assets/5233399/19420267/388f556e-93ad-11e6-813e-7c5c396be322.png)
  251. - add clean command [skip ci] ([#201](https://github.com/babel/babylon/pull/201)) (Henry Zhu)
  252. - add ForAwaitStatement (async generator already added) [skip ci] ([#196](https://github.com/babel/babylon/pull/196)) (Henry Zhu)
  253. ## v6.13.0 (2016-10-21)
  254. ### :eyeglasses: Spec Compliancy
  255. Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman)
  256. > See https://flowtype.org/docs/variance.html for more information
  257. ```js
  258. type T = { +p: T };
  259. interface T { -p: T };
  260. declare class T { +[k:K]: V };
  261. class T { -[k:K]: V };
  262. class C2 { +p: T = e };
  263. ```
  264. Raise error on duplicate definition of __proto__ ([#183](https://github.com/babel/babylon/pull/183)) (Moti Zilberman)
  265. ```js
  266. ({ __proto__: 1, __proto__: 2 }) // Throws an error now
  267. ```
  268. ### :bug: Bug Fix
  269. Flow: Allow class properties to be named `static` ([#184](https://github.com/babel/babylon/pull/184)) (Moti Zilberman)
  270. ```js
  271. declare class A {
  272. static: T;
  273. }
  274. ```
  275. Allow "async" as identifier for object literal property shorthand ([#187](https://github.com/babel/babylon/pull/187)) (Andrew Levine)
  276. ```js
  277. var foo = { async, bar };
  278. ```
  279. ### :nail_care: Polish
  280. Fix flowtype and add inType to state ([#189](https://github.com/babel/babylon/pull/189)) (Daniel Tschinder)
  281. > This improves the performance slightly (because of hidden classes)
  282. ### :house: Internal
  283. Fix .gitattributes line ending setting ([#191](https://github.com/babel/babylon/pull/191)) (Moti Zilberman)
  284. Increase test coverage ([#175](https://github.com/babel/babylon/pull/175) (Moti Zilberman)
  285. Readd missin .eslinignore for IDEs (Daniel Tschinder)
  286. Error on missing expected.json fixture in CI ([#188](https://github.com/babel/babylon/pull/188)) (Moti Zilberman)
  287. Add .gitattributes and .editorconfig for LF line endings ([#179](https://github.com/babel/babylon/pull/179)) (Moti Zilberman)
  288. Fixes two tests that are failing after the merge of #172 ([#177](https://github.com/babel/babylon/pull/177)) (Moti Zilberman)
  289. ## v6.12.0 (2016-10-14)
  290. ### :eyeglasses: Spec Compliancy
  291. Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler)
  292. #### Dynamic Import
  293. - Proposal Repo: https://github.com/domenic/proposal-dynamic-import
  294. - Championed by [@domenic](https://github.com/domenic)
  295. - stage-2
  296. - [sept-28 tc39 notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-09/sept-28.md#113a-import)
  297. > This repository contains a proposal for adding a "function-like" import() module loading syntactic form to JavaScript
  298. ```js
  299. import(`./section-modules/${link.dataset.entryModule}.js`)
  300. .then(module => {
  301. module.loadPageInto(main);
  302. })
  303. ```
  304. Add EmptyTypeAnnotation ([#171](https://github.com/babel/babylon/pull/171)) (Sam Goldman)
  305. #### EmptyTypeAnnotation
  306. Just wasn't covered before.
  307. ```js
  308. type T = empty;
  309. ```
  310. ### :bug: Bug Fix
  311. Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels)
  312. ```js
  313. // was failing due to sparse array
  314. export const { foo: [ ,, qux7 ] } = bar;
  315. ```
  316. Allow keyword in Flow object declaration property names with type parameters ([#146](https://github.com/babel/babylon/pull/146)) (Dan Harper)
  317. ```js
  318. declare class X {
  319. foobar<T>(): void;
  320. static foobar<T>(): void;
  321. }
  322. ```
  323. Allow keyword in object/class property names with Flow type parameters ([#145](https://github.com/babel/babylon/pull/145)) (Dan Harper)
  324. ```js
  325. class Foo {
  326. delete<T>(item: T): T {
  327. return item;
  328. }
  329. }
  330. ```
  331. Allow typeAnnotations for yield expressions ([#174](https://github.com/babel/babylon/pull/174))) (Daniel Tschinder)
  332. ```js
  333. function *foo() {
  334. const x = (yield 5: any);
  335. }
  336. ```
  337. ### :nail_care: Polish
  338. Annotate more errors with expected token ([#172](https://github.com/babel/babylon/pull/172))) (Moti Zilberman)
  339. ```js
  340. // Unexpected token, expected ; (1:6)
  341. { set 1 }
  342. ```
  343. ### :house: Internal
  344. Remove kcheck ([#173](https://github.com/babel/babylon/pull/173))) (Daniel Tschinder)
  345. Also run flow, linting, babel tests on seperate instances (add back node 0.10)
  346. ## v6.11.6 (2016-10-12)
  347. ### :bug: Bug Fix/Regression
  348. Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels)
  349. ```js
  350. // was failing with `Cannot read property 'type' of null` because of null identifiers
  351. export const { foo: [ ,, qux7 ] } = bar;
  352. ```
  353. ## v6.11.5 (2016-10-12)
  354. ### :eyeglasses: Spec Compliancy
  355. Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo)
  356. ```js
  357. // `foo` has already been exported. Exported identifiers must be unique. (2:20)
  358. export function foo() {};
  359. export const { a: [{foo}] } = bar;
  360. ```
  361. Fix: Check for duplicate named exports in exported rest elements/properties ([#164](https://github.com/babel/babylon/pull/164)) (Kai Cataldo)
  362. ```js
  363. // `foo` has already been exported. Exported identifiers must be unique. (2:22)
  364. export const foo = 1;
  365. export const [bar, ...foo] = baz;
  366. ```
  367. ### :bug: Bug Fix
  368. Fix: Allow identifier `async` for default param in arrow expression ([#165](https://github.com/babel/babylon/pull/165)) (Kai Cataldo)
  369. ```js
  370. // this is ok now
  371. const test = ({async = true}) => {};
  372. ```
  373. ### :nail_care: Polish
  374. 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)
  375. ```bash
  376. # So in the case of a missing ending curly (`}`)
  377. Module build failed: SyntaxError: Unexpected token, expected } (30:0)
  378. 28 | }
  379. 29 |
  380. > 30 |
  381. | ^
  382. ```
  383. ## v6.11.4 (2016-10-03)
  384. Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu)
  385. ## v6.11.3 (2016-10-01)
  386. ### :eyeglasses: Spec Compliancy
  387. Add static errors for object rest (#149) ([@danez](https://github.com/danez))
  388. > https://github.com/sebmarkbage/ecmascript-rest-spread
  389. Object rest copies the *rest* of properties from the right hand side `obj` starting from the left to right.
  390. ```js
  391. let { x, y, ...z } = { x: 1, y: 2, z: 3 };
  392. // x = 1
  393. // y = 2
  394. // z = { z: 3 }
  395. ```
  396. #### New Syntax Errors:
  397. **SyntaxError**: The rest element has to be the last element when destructuring (1:10)
  398. ```bash
  399. > 1 | let { ...x, y, z } = { x: 1, y: 2, z: 3};
  400. | ^
  401. # Previous behavior:
  402. # x = { x: 1, y: 2, z: 3 }
  403. # y = 2
  404. # z = 3
  405. ```
  406. Before, this was just a more verbose way of shallow copying `obj` since it doesn't actually do what you think.
  407. **SyntaxError**: Cannot have multiple rest elements when destructuring (1:13)
  408. ```bash
  409. > 1 | let { x, ...y, ...z } = { x: 1, y: 2, z: 3};
  410. | ^
  411. # Previous behavior:
  412. # x = 1
  413. # y = { y: 2, z: 3 }
  414. # z = { y: 2, z: 3 }
  415. ```
  416. Before y and z would just be the same value anyway so there is no reason to need to have both.
  417. **SyntaxError**: A trailing comma is not permitted after the rest element (1:16)
  418. ```js
  419. let { x, y, ...z, } = obj;
  420. ```
  421. 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.
  422. ---
  423. get / set are valid property names in default assignment (#142) ([@jezell](https://github.com/jezell))
  424. ```js
  425. // valid
  426. function something({ set = null, get = null }) {}
  427. ```
  428. ## v6.11.2 (2016-09-23)
  429. ### Bug Fix
  430. - [#139](https://github.com/babel/babylon/issues/139) Don't do the duplicate check if not an identifier (#140) @hzoo
  431. ```js
  432. // regression with duplicate export check
  433. SyntaxError: ./typography.js: `undefined` has already been exported. Exported identifiers must be unique. (22:13)
  434. 20 |
  435. 21 | export const { rhythm } = typography;
  436. > 22 | export const { TypographyStyle } = typography
  437. ```
  438. Bail out for now, and make a change to account for destructuring in the next release.
  439. ## 6.11.1 (2016-09-22)
  440. ### Bug Fix
  441. - [#137](https://github.com/babel/babylon/pull/137) - Fix a regression with duplicate exports - it was erroring on all keys in `Object.prototype`. @danez
  442. ```javascript
  443. export toString from './toString';
  444. ```
  445. ```bash
  446. `toString` has already been exported. Exported identifiers must be unique. (1:7)
  447. > 1 | export toString from './toString';
  448. | ^
  449. 2 |
  450. ```
  451. ## 6.11.0 (2016-09-22)
  452. ### Spec Compliancy (will break CI)
  453. - Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo
  454. ```js
  455. // Only one default export allowed per module. (2:9)
  456. export default function() {};
  457. export { foo as default };
  458. // Only one default export allowed per module. (2:0)
  459. export default {};
  460. export default function() {};
  461. // `Foo` has already been exported. Exported identifiers must be unique. (2:0)
  462. export { Foo };
  463. export class Foo {};
  464. ```
  465. ### New Feature (Syntax)
  466. - Add support for computed class property names ([#121](https://github.com/babel/babylon/pull/121)) @motiz88
  467. ```js
  468. // AST
  469. interface ClassProperty <: Node {
  470. type: "ClassProperty";
  471. key: Identifier;
  472. value: Expression;
  473. computed: boolean; // added
  474. }
  475. ```
  476. ```js
  477. // with "plugins": ["classProperties"]
  478. class Foo {
  479. [x]
  480. ['y']
  481. }
  482. class Bar {
  483. [p]
  484. [m] () {}
  485. }
  486. ```
  487. ### Bug Fix
  488. - Fix `static` property falling through in the declare class Flow AST ([#135](https://github.com/babel/babylon/pull/135)) @danharper
  489. ```js
  490. declare class X {
  491. a: number;
  492. static b: number; // static
  493. c: number; // this was being marked as static in the AST as well
  494. }
  495. ```
  496. ### Polish
  497. - Rephrase "assigning/binding to rvalue" errors to include context ([#119](https://github.com/babel/babylon/pull/119)) @motiz88
  498. ```js
  499. // Used to error with:
  500. // SyntaxError: Assigning to rvalue (1:0)
  501. // Now:
  502. // Invalid left-hand side in assignment expression (1:0)
  503. 3 = 4
  504. // Invalid left-hand side in for-in statement (1:5)
  505. for (+i in {});
  506. ```
  507. ### Internal
  508. - Fix call to `this.parseMaybeAssign` with correct arguments ([#133](https://github.com/babel/babylon/pull/133)) @danez
  509. - Add semver note to changelog ([#131](https://github.com/babel/babylon/pull/131)) @hzoo
  510. ## 6.10.0 (2016-09-19)
  511. > We plan to include some spec compliancy bugs in patch versions. An example was the multiple default exports issue.
  512. ### Spec Compliancy
  513. * Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu)
  514. > 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
  515. 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)
  516. For example:
  517. ```js
  518. // this errors because it uses destructuring and default parameters
  519. // in a function with a "use strict" directive
  520. function a([ option1, option2 ] = []) {
  521. "use strict";
  522. }
  523. ```
  524. 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.
  525. ### New Feature
  526. * Exact object type annotations for Flow plugin ([#104](https://github.com/babel/babylon/pull/104)) (Basil Hosmer)
  527. Added to flow in https://github.com/facebook/flow/commit/c710c40aa2a115435098d6c0dfeaadb023cd39b8
  528. Looks like:
  529. ```js
  530. var a : {| x: number, y: string |} = { x: 0, y: 'foo' };
  531. ```
  532. ### Bug Fixes
  533. * Include `typeParameter` location in `ArrowFunctionExpression` ([#126](https://github.com/babel/babylon/pull/126)) (Daniel Tschinder)
  534. * Error on invalid flow type annotation with default assignment ([#122](https://github.com/babel/babylon/pull/122)) (Dan Harper)
  535. * Fix Flow return types on arrow functions ([#124](https://github.com/babel/babylon/pull/124)) (Dan Harper)
  536. ### Misc
  537. * Add tests for export extensions ([#127](https://github.com/babel/babylon/pull/127)) (Daniel Tschinder)
  538. * Fix Contributing guidelines [skip ci] (Daniel Tschinder)
  539. ## 6.9.2 (2016-09-09)
  540. 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.
  541. ## 6.9.1 (2016-08-23)
  542. 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.
  543. ### Bug Fixes
  544. - Fix issues with default object params in async functions ([#96](https://github.com/babel/babylon/pull/96)) @danez
  545. - Fix issues with flow-types and async function ([#95](https://github.com/babel/babylon/pull/95)) @danez
  546. - Fix arrow functions with destructuring, types & default value ([#94](https://github.com/babel/babylon/pull/94)) @danharper
  547. - Fix declare class with qualified type identifier ([#97](https://github.com/babel/babylon/pull/97)) @danez
  548. - Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas plugins and enable them by default ([#98](https://github.com/babel/babylon/pull/98)) @danez
  549. ## 6.9.0 (2016-08-16)
  550. ### New syntax support
  551. - Add JSX spread children ([#42](https://github.com/babel/babylon/pull/42)) @calebmer
  552. (Be aware that React is not going to support this syntax)
  553. ```js
  554. <div>
  555. {...todos.map(todo => <Todo key={todo.id} todo={todo}/>)}
  556. </div>
  557. ```
  558. - Add support for declare module.exports ([#72](https://github.com/babel/babylon/pull/72)) @danez
  559. ```js
  560. declare module "foo" {
  561. declare module.exports: {}
  562. }
  563. ```
  564. ### New Features
  565. - If supplied, attach filename property to comment node loc. ([#80](https://github.com/babel/babylon/pull/80)) @divmain
  566. - Add identifier name to node loc field ([#90](https://github.com/babel/babylon/pull/90)) @kittens
  567. ### Bug Fixes
  568. - Fix exponential operator to behave according to spec ([#75](https://github.com/babel/babylon/pull/75)) @danez
  569. - Fix lookahead to not add comments to arrays which are not cloned ([#76](https://github.com/babel/babylon/pull/76)) @danez
  570. - Fix accidental fall-through in Flow type parsing. ([#82](https://github.com/babel/babylon/pull/82)) @xiemaisi
  571. - Only allow declares inside declare module ([#73](https://github.com/babel/babylon/pull/73)) @danez
  572. - Small fix for parsing type parameter declarations ([#83](https://github.com/babel/babylon/pull/83)) @gabelevi
  573. - Fix arrow param locations with flow types ([#57](https://github.com/babel/babylon/pull/57)) @danez
  574. - Fixes SyntaxError position with flow optional type ([#65](https://github.com/babel/babylon/pull/65)) @danez
  575. ### Internal
  576. - Add codecoverage to tests @danez
  577. - Fix tests to not save expected output if we expect the test to fail @danez
  578. - Make a shallow clone of babel for testing @danez
  579. - chore(package): update cross-env to version 2.0.0 ([#77](https://github.com/babel/babylon/pull/77)) @greenkeeperio-bot
  580. - chore(package): update ava to version 0.16.0 ([#86](https://github.com/babel/babylon/pull/86)) @greenkeeperio-bot
  581. - chore(package): update babel-plugin-istanbul to version 2.0.0 ([#89](https://github.com/babel/babylon/pull/89)) @greenkeeperio-bot
  582. - chore(package): update nyc to version 8.0.0 ([#88](https://github.com/babel/babylon/pull/88)) @greenkeeperio-bot
  583. ## 6.8.4 (2016-07-06)
  584. ### Bug Fixes
  585. - Fix the location of params, when flow and default value used ([#68](https://github.com/babel/babylon/pull/68)) @danez
  586. ## 6.8.3 (2016-07-02)
  587. ### Bug Fixes
  588. - Fix performance regression introduced in 6.8.2 with conditionals ([#63](https://github.com/babel/babylon/pull/63)) @danez
  589. ## 6.8.2 (2016-06-24)
  590. ### Bug Fixes
  591. - Fix parse error with yielding jsx elements in generators `function* it() { yield <a></a>; }` ([#31](https://github.com/babel/babylon/pull/31)) @eldereal
  592. - When cloning nodes do not clone its comments ([#24](https://github.com/babel/babylon/pull/24)) @danez
  593. - 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
  594. - Fix leading comments added from previous node ([#23](https://github.com/babel/babylon/pull/23)) @danez
  595. - Fix parse errors with flow's optional arguments `(arg?) => {}` ([#19](https://github.com/babel/babylon/pull/19)) @danez
  596. - Support negative numeric type literals @kittens
  597. - Remove line terminator restriction after await keyword @kittens
  598. - Remove grouped type arrow restriction as it seems flow no longer has it @kittens
  599. - 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
  600. - 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
  601. ### Documentation
  602. - Document AST differences from ESTree ([#41](https://github.com/babel/babylon/pull/41)) @nene
  603. - Move ast spec from babel/babel ([#46](https://github.com/babel/babylon/pull/46)) @hzoo
  604. ### Internal
  605. - Enable skipped tests ([#16](https://github.com/babel/babylon/pull/16)) @danez
  606. - Add script to test latest version of babylon with babel ([#21](https://github.com/babel/babylon/pull/21)) @danez
  607. - Upgrade test runner ava @kittens
  608. - Add missing generate-identifier-regex script @kittens
  609. - Rename parser context types @kittens
  610. - Add node v6 to travis testing @hzoo
  611. - Update to Unicode v9 ([#45](https://github.com/babel/babylon/pull/45)) @mathiasbynens
  612. ## 6.8.1 (2016-06-06)
  613. ### New Feature
  614. - Parse type parameter declarations with defaults like `type Foo<T = string> = T`
  615. ### Bug Fixes
  616. - Type parameter declarations need 1 or more type parameters.
  617. - The existential type `*` is not a valid type parameter.
  618. - The existential type `*` is a primary type
  619. ### Spec Compliancy
  620. - The param list for type parameter declarations now consists of `TypeParameter` nodes
  621. - New `TypeParameter` AST Node (replaces using the `Identifier` node before)
  622. ```
  623. interface TypeParameter <: Node {
  624. bound: TypeAnnotation;
  625. default: TypeAnnotation;
  626. name: string;
  627. variance: "plus" | "minus";
  628. }
  629. ```
  630. ## 6.8.0 (2016-05-02)
  631. #### New Feature
  632. ##### Parse Method Parameter Decorators ([#12](https://github.com/babel/babylon/pull/12))
  633. > [Method Parameter Decorators](https://goo.gl/8MmCMG) is now a TC39 [stage 0 proposal](https://github.com/tc39/ecma262/blob/master/stage0.md).
  634. Examples:
  635. ```js
  636. class Foo {
  637. constructor(@foo() x, @bar({ a: 123 }) @baz() y) {}
  638. }
  639. export default function func(@foo() x, @bar({ a: 123 }) @baz() y) {}
  640. var obj = {
  641. method(@foo() x, @bar({ a: 123 }) @baz() y) {}
  642. };
  643. ```
  644. ##### Parse for-await statements (w/ `asyncGenerators` plugin) ([#17](https://github.com/babel/babylon/pull/17))
  645. There is also a new node type, `ForAwaitStatement`.
  646. > [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).
  647. Example:
  648. ```js
  649. async function f() {
  650. for await (let x of y);
  651. }
  652. ```