24 Commits

Author SHA1 Message Date
Nicolò Ribaudo
f3912ac08f
Mark transpiled JSX elements as pure (#11126)
* Mark transpiled JSX elements as pure

* Avoid duble annotation

* Add "pure" option to the React preset

* Fix generator indentation

* Update tests

* Add tests for the "pure" option

* Update windows fixtures
2020-03-19 15:43:54 +01:00
Nicolò Ribaudo
8c7d4b55c9
Add plugins name (#8769)
* Add plugins name

* Add missing names found by the plugin

* Add eslint plugin
2018-11-18 23:02:58 +01:00
Logan Smyth
a4795408b4
Allow plugins to assert that a specific babel version has loaded the plugin. (#7450) 2018-03-04 14:36:54 -08:00
Mouad Debbar
e9ed687666 Bail out on JSX fragments instead of throwing (#7166)
* Bail out on JSX fragments instead of throwing

The `transform-react-inline-elements` plugin doesn't handle JSX fragments. It throws an exception because `node.openingElement` is undefined.

* Add a comment explaining `node.openingElement`
2018-01-08 21:38:52 -08:00
Logan Smyth
b19b66d94b Use peerDep rather than plugin param for common APIs. 2017-11-06 11:32:47 -08:00
Henry Zhu
cde0054227 Scoped: change src imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Nicolò Ribaudo
8aabbbc822 Use helper-builder-react-jsx inside plugin-transform-react-inline-elements (#6294)
* Use helper-builder-react-jsx inside plugin-transform-react-inline-elements.

This avoids duplicating the logic for converting jsx elements to plain JavaScript.

* Add a comment which explains the _jsx signature, [skip ci]
so it is a little bit easier to understand what all those .splice() calls do
2017-09-26 10:15:27 -04:00
Justin Ridgewell
9d612e717e Fix react-inline-elements bug (#5958) 2017-07-17 10:46:13 -04:00
Brian Ng
e4b35f680d
Run prettier 2017-06-27 12:15:00 -05:00
Brian Ng
8a82cc060a Run new lint rules (#5413) 2017-03-04 10:46:01 -05:00
Henry Zhu
672adba9a1 enable prefer const (#5113) 2017-01-14 09:48:52 -05:00
Amjad Masad
3667527d04 Revert "Remove flow"
This reverts commit 2827ff6b01dcce69e9d3c0402e96b52b3a2a47ee.
2016-03-03 14:49:20 -08:00
Sam Goldman
2827ff6b01 Remove flow 2016-03-01 22:33:30 -08:00
Ben Alpert
d1b8db1532 React inlining: Refactor to reduce parsing cost
- Have the `jsx` helper do the `defaultProps` work instead of calling `defaultProps` inline.
- Put `key` after `props` and make it optional.
- Inline `children` as rest args instead of in the object.
- Rename `createRawReactElement` to `jsx`. I wish I was kidding.

Most of these are silly microoptimizations. In my test file (based off an internal RN app), this reduces the parsing overhead of inlining from around 1% to 0.1% in JSC and from 0.6% to 0.0% in V8 (compared to element inlining before this commit).

Once parsed, the initial render with inlining is the same speed as not inlining in JSC and ~1% slower in V8. A second initial render in the same context (reusing the function objects, JIT, etc) is 2.0% faster in JSC and 5.5% faster in V8.
2015-11-12 18:05:57 -08:00
Ben Alpert
e8ebc7074e React inlining: Make sure some props object always exists 2015-11-11 15:33:43 -08:00
Ben Alpert
07a5bcc04a React inlining: Fix transform for computed key
(This was broken before my last change too.)
2015-11-11 15:27:02 -08:00
Ben Alpert
3cad287233 Use a helper function for React "inlining"
Either due to lower parsing costs or better type inference, this seems
to perform better than direct object inlining. (All along, the main win
was skipping a loop through props, not avoiding a function call.)
2015-11-10 21:10:06 -08:00
Sebastian McKenzie
da20aa90c1 omit defaultProps helper when there are no props 2015-11-08 17:10:33 -08:00
Sebastian McKenzie
2a1a038031 move children prop pushing to after props to ensure correct order - fixes #2395 2015-11-08 06:24:10 -08:00
Henry Zhu
f01d2054d4 transformation-react-inline-elements: ensure invalid identifier JSX attribute keys are quoted - fixes #2808 2015-11-04 08:47:09 -05:00
Sebastian McKenzie
91c463c0f7 fix react inline elements plugin when creating properties out of jsx expression containers - fixes #2766 2015-11-03 03:34:46 +00:00
Samuel Reed
b98d24594a optimisations.react.inline: don't pass empty array.
This fixes incompatibilities with code that check for the existence
of children.
2015-10-29 21:18:07 -05:00
Sebastian McKenzie
ae7d5367f1 6.0.0
I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.
2015-10-29 17:51:24 +00:00
Sebastian McKenzie
9969224a93 add more plugins, rename some 2015-09-15 06:12:46 +01:00