* 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]
* Fix OOB string character access in Printer#_maybeAddParen.
The `_maybeAddParen` method of the `Printer` class does
```js
const chaPost = str[i + 1]
```
without checking that `i + 1` is still within the bounds of `str`. It
seems like this triggers fairly often that the `str[i + 1]` access is
out of bounds. The first out of bounds access will turn the KeyedLoadIC
(in case of V8) into *MEGAMORPHIC* state, which is significantly slower
for strings (there's a fix in flight for V8 to mitigate the cost a bit
in that case). Even worse than that, the out of bounds access also
pollutes the later comparisons, namely
```js
chaPost === "/"
```
and
```js
chaPost === "*"
```
which are now no longer monomorphic on strings, since `chaPost` was
sometimes `undefined`.
This is a non-breaking performance fix, which improves babel execution
on the [web-tooling-benchmark](github.com/v8/web-tooling-benchmark)
workload by around 6-9%.
* Restructure and optimize the code a bit.
The code
```js
linesInfo && linesInfo[type]
```
performs a lot of dynamic lookups on the `Boolean.prototype`, as the
*ToBoolean* operation let's `true` pass for `linesInfo` (which might
itself be concerning that this can be a boolean). Instead of the
coercion, the code should properly check for valid objects via `typeof`
and strict equality with `null` comparison.
This is a non-breaking performance fix.
This reverts the former fix done in #5743 and always requeues
BlockStatements when they get created.
This also fixes a bug in babel-generator which would indent code
even though no comments are present.
* babel-generator: Add TypeScript support
* Remove type declarations; not published from babylon
* Remove TODOs
* Consistently use `this.word` for tokens that are words
* babel-types: Add TypeScript definitions
* Add missing builders
* Allow arrow function to have "generator"
* Replace link to resolved issue with comment
* Re-add 'generator' to functionCommon