352 Commits

Author SHA1 Message Date
Nicolò Ribaudo
a328b6ad1a Arrow functions and methods' params are binding identifiers (#6770) 2018-03-04 15:19:48 -08:00
Daniel Tschinder
3e95830646
Migrate to jest (#7455) 2018-03-03 10:58:19 +01:00
Logan Smyth
7ff4a73916
Upgrade flow to 0.66 and fix a few minor errors. (#7431) 2018-02-25 19:22:23 -08:00
Brian Ng
8823e4247e Fix up flow errors (#7227)
* charcodes@0.1.0

* Add hasFlowComment to tokenizer/state

* Fix babel-types flow errors

* Add isIterator to tokenizer/state

* Remove unnecessary argument from flow/readToken

* Add annotation to tokenizer/isIterator

* Fix reference to generated index.js.flow

* Add workaround in babel-template expression formatter

* Fix tsEatThenParseType return type

* Fix inconsistency with ParseSubscript state

* Add workaround for flow handling error with tagged template in optional chain

* Add flow workaround in expectPlugin inside tokenizer
2018-02-25 18:12:33 -08:00
Andy
6f3be3a543 typescript: Support definite assignment assertion (#7159) 2018-02-24 16:26:07 -06:00
Andy
6f6c8dabba TypeScript: Support conditional types syntax (#7404)
Microsoft/TypeScript#21316 and Microsoft/TypeScript#21496
2018-02-24 14:56:14 +01:00
Henry Zhu
ea3f2d9299 v7.0.0-beta.40 2018-02-12 11:41:13 -05:00
Naveen jain
a3ad518ce1 [BugFix] : OptionalChaining Bug fixes (#7288)
* Added optionalExpression types to babylon and babel-types

* OptionalChain transforms bug fix

* Added OptionalExpressions to babel-generator. Fixed OptionalChain Bugs

* Removed 'optionalChain' from newExpression and added test cases

* Added test cases for optionalChain

* Update index.js
2018-02-07 19:42:14 -05:00
Henry Zhu
73e64c6cb0 v7.0.0-beta.39 2018-01-30 15:27:19 -05:00
Mateusz Burzyński
912bcc186d Fix reused nodes - part 1 (#7149) 2018-01-29 22:59:06 +01:00
Nicolò Ribaudo
63ae923987 Add t.cloneNode and deprecate t.clone and t.cloneDeep (#7149) 2018-01-29 22:59:06 +01:00
Henry Zhu
b5d20ab171 v7.0.0-beta.38 2018-01-17 11:31:32 -05:00
Boris Cherny
c3654d83c8 Generate TypeScript typings, and improve generated Flow typings (#7101)
* generate typescript types

* improve type generator output

* move generator scripts to scripts/generators

* use new stringifier for generating flow types too

* export summary types

* add support for oneOfNodeOrValueTypes to improve type generation

* export typescript types from top level, and remove module declaration

* generate typescript/flow types and copy typescript types to babel-types/lib as part of make build

* copy flow types to babel-types/lib as part of make build (fix #6839)

* improve typing: Identifier->name should be a string, not any

* avoid destructuring, to support node 4

* update doc generator to share more code, regenerate babel-types readme, pipe all generator output to stdout

* regenerate babel-types readme as part of make build

* improve typing: ClassProperty->key should be Identifier | StringLiteral | NumericLiteral | Expression, not any

* improve typing: optional node properties are nullable, not undefinedable

* improve docs: FlowClassImplements should be ClassImplements

* make ts usage more friendly: when using babel-types api, make optional params | undefined, and when reading nodes keep optional params | null

* rm lib/types.d.ts and lib/types.js in favor of packages/babel-types/lib

* add missing variance node type, address review comments

* add tests for flow variance

* Comment should be a disjoint union of tagged types

* update .flowconfig
2018-01-17 10:31:46 -05:00
Nicolò Ribaudo
64dfb7574e Remove old comment (#7220) 2018-01-15 14:57:43 -06:00
Claudio Procida
ce420ba51c Fixes React isCompatTag validator accepting leading dash character (#7164) 2018-01-09 09:42:05 +01:00
Henry Zhu
7c99f4653f v7.0.0-beta.37 2018-01-08 11:02:14 -05:00
Boris Cherny
4208099f5b Add validators for Flow AST node fields (#7107) 2017-12-30 15:26:01 -06:00
Henry Zhu
7d798952d2 v7.0.0-beta.36 2017-12-25 14:04:08 -05:00
Francisco Ryan Tolmasky I
f0e46772a6 babel-types lists JSXIdentifier as an Expression (#6960)
Currently, Babel is treating JSXIdentifier, JSXMemberExpression, and JSXEmptyExpression as expressions as well, which means Babel will for example incorrectly allow you to place these anywhere an expression is wanted.

Closes #6851.
2017-12-18 09:27:43 -06:00
Henry Zhu
8a4124b2ff v7.0.0-beta.35 2017-12-14 16:47:27 -05:00
Brian Ng
42f66782be
Improve error message in types assert (#7001) 2017-12-11 09:31:56 -06:00
Daniel Poindexter
12ac1bccd7 Fix type definitions to fully support Typescript (#6939) 2017-12-08 17:03:01 -06:00
Brian Ng
c7980b2b90 Bump prettier (#6991) 2017-12-07 17:36:49 -05:00
Nicolò Ribaudo
a2aabbd33d
Generate better builder names for JSX* and TS* (#6967)
e.g. JSXIdentifier -> jsxIdentifier.
The jSXIdentifier alias isn't removed, so this commit doesn't introduce breaking changes.
2017-12-07 12:17:40 +01:00
Henry Zhu
a7c9264c79 v7.0.0-beta.34 2017-12-02 09:38:52 -05:00
Daniel Tschinder
8270903ba2
Refactor @babel/types to be 100% ES-module (#6741)
This generates the dynamic functions at buildtime and also
splits the package into smaller files to avoid dependency circles.
2017-12-02 12:20:10 +01:00
Henry Zhu
413aa79711 v7.0.0-beta.33 2017-12-01 09:27:57 -05:00
Brian Ng
ccd7c25174
Regen babel-types docsdocs and interfaces [skip ci] 2017-11-22 08:53:16 -06:00
Daniel Tschinder
7064b298d7
Make SpreadProperty and RestProperty a deprecatedAlias (#6853)
instead of hardcoding backwards compatiblity.
This way we get deprecation warnings and also builders will work.
2017-11-18 21:54:24 +01:00
Daniel Tschinder
f3004d0d4d
Fix validation of WithStatement and enable flow in definitions (#6852)
Fixes also flow errors after activating flow
2017-11-18 18:17:31 +01:00
Henry Zhu
4e6cd298c7 v7.0.0-beta.32 2017-11-12 08:32:53 -05:00
Henry Zhu
f76ac0b197 v7.0.0-beta.31 2017-11-03 16:03:01 -04:00
Clement Hoang
1a7194a22f Add JSX Fragment syntax support (#6552)
* Add JSX Fragments to babel-types

* Support JSX fragments in the transform-react-jsx plugin

* Add tests JSX fragments

* Update helper-builder and transform plugin documentations for jsx fragment

* Add generator for jsx fragments

* Add test for jsx fragment generator

* Split jsx transform example into normal and fragment examples

* Remove unnecessary fields from ElementState in babel-helper-builder-react-jsx

* inline [skip ci]
2017-11-03 10:43:48 -04:00
Henry Zhu
690d6465d8 v7.0.0-beta.5 2017-10-30 16:55:46 -04:00
Henry Zhu
38f984f956 v7.0.0-beta.4 2017-10-30 14:33:56 -04:00
Henry Zhu
96c380899b update types [skip ci] 2017-10-30 12:35:08 -04:00
Jakub Beneš
04d2c030be Add a 'throwIfNamespace' option for JSX transform (#6563)
* Added tests for ifThrowNamespace flag

* JSX transformator could work with XMLNamespaces (ifThrowNamespace flag)

* Use template literal instead

* Attempt to reword the message

* Added docs

* Reworded docs

* Reworded docs

* Fixed missing space in error message
2017-10-28 20:44:15 -04:00
Henry Zhu
962128c0f0
Update to babylon v7 beta.30 (#6587) 2017-10-28 20:01:52 -04:00
Mauro Bringolf
2311ddbe67 Add transform to rename variables that are ES3 reserved words (#6479)
* Initial version

* Replace .includes with .indexOf and better node set to visit

* Alphabetically sort es3 reserved words and make difference helper for readability

* Fix second Array.include error that was not polyfilled

* Move es3 keywords into separate babel-types helper and use in all es3 transforms

* Reference local plugin build directly for tests

* Try relative import for babel-types

* Update to scoped package name and beta 3

* Fix unscoped package import

* Replace local plugin reference with proper plugin name
2017-10-18 15:00:58 -07:00
Logan Smyth
191624d800 Add a new utility for traversing the AST. 2017-10-18 13:55:14 -07:00
Brian Ng
72d1a72122
Update babel-types docs and lib/types [skip ci] 2017-10-18 09:43:54 -05:00
Lucas Azzola
99be60b53d Implement transform for nullish-coalescing operator (#6483)
* Implement transform for nullish-coalescing operator

* Update example output

* Switch from BinaryExpression to LogicalExpression

* Address review comments

- Use generateUidIdentifierBasedOnNode
- Inline "??"
- Clone ref node
- Move "??" to LogicalExpression in babel-types

* Fix reference to @babel/helper-plugin-test-runner

* Fix reference to @babel/plugin-syntax-nullish-coalescing-operator

* Don't use parent scope

* Remove .vscode from .gitignore, change 'lib/index.js' to 'lib'

* Ensure `document.all ?? 0 === document.all`

* Fix note and copy to an inline comment
2017-10-18 03:10:05 -04:00
Mateusz Burzyński
859ea4b175 Scoped: updated numerous docs with scoped packages change [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
c0a958098f Scoped: update readme headers to @babel/ [skip ci] 2017-10-16 22:49:57 -04:00
Brian Ng
645bf56838 Scoped: rename installation instructions for presets [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
691f90a774 Scoped: change test imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
cde0054227 Scoped: change src imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
8e5e27577a Scoped: update package.json dependencies to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
1cd564bd16 Scoped: rename package names to @babel/ [skip ci] 2017-10-16 22:49:01 -04:00
Henry Zhu
279f55cd9b update to babylon beta.29 2017-10-16 20:10:55 -05:00