11387 Commits

Author SHA1 Message Date
Benedikt Meurer
ffe4301fe2 Fix property lookup on booleans in needsWhitespace. (#6584)
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.
2017-10-28 20:16:48 -04:00
Benedikt Meurer
5baa36109e Fix access to "-1" property on nodesOut array. (#6582)
Similar to the fixes in https://github.com/babel/babel/pull/6580 and
https://github.com/babel/babel/pull/6581, accesses of the form

```js
nodesOut[nodesOut.length - 1]
```

where `nodesOut` can be an empty array, are bad for performance in Node.
In this particular case it's easy to restructure the code a bit to not
require the array access at all, but just track the current `tail` as we
go.

This is a non-breaking performance fix.
2017-10-28 20:16:04 -04:00
Henry Zhu
962128c0f0
Update to babylon v7 beta.30 (#6587) 2017-10-28 20:01:52 -04:00
Henry Zhu
8f8ea04b62 7.0.0-beta.30 2017-10-28 19:40:53 -04:00
Henry Zhu
c6d369b32b fix flow unused supressing comment [skip ci] 2017-10-28 19:40:31 -04:00
Benedikt Meurer
f9e0643460 Fix path.popContext() to not try to load "-1" from contexts array. (#6580)
* Fix path.popContext() to not try to load "-1" from contexts array.

The current implement of popContext does

```js
this.setContext(this.contexts[this.contexts.length - 1]);
```

even if `this.contexts` can be empty, which causes it to lookup the
property `"-1"`, which is not found on the array itself and obviously
also not in the `Object.prototype` and the `Array.prototype`. However
since `"-1"` is not a valid array index, but has a valid integer
representation, this is a very expensive lookup in V8 (and probably
other engines too, but that is probably less relevant, since Babel
most often runs on Node nowadays).

* Make zero check explicit (for readability).
2017-10-28 16:17:05 -04:00
Benedikt Meurer
df0d9d05a3 Fix hasRest to not try to load "-1" from params array. (#6581)
Similar in spirit to https://github.com/babel/babel/pull/6580, the
current implementation did

```js
node.params[node.params.length - 1]
```

where `node.params` can also be empty, which causes it to lookup the
property `"-1"`, which is not found on the array itself and obviously
also not in the `Object.prototype` and the `Array.prototype`. However
since `"-1"` is not a valid array index, but has a valid integer
representation, this is a very expensive lookup in V8 (and probably
other engines too, but that is probably less relevant, since Babel
most often runs on Node nowadays). In V8 this causes a call to
the `%SetProperty` runtime function for each of these `"-1"`
property lookups, and in addition sends the whole `KeyedLoadIC`
to `MEGAMORPHIC` state, which also penalizes other accesses
on this line.

This is a small non-breaking performance fix.
2017-10-28 16:16:05 -04:00
Clement Hoang
a1125b26ce Add JSX fragment syntax support (#755) 2017-10-28 16:12:14 -04:00
Benedikt Meurer
55d5545614 Fix "-1" array accesses in CommentsParser. (#777)
Similar to the fixes in https://github.com/babel/babel/pull/6580 and
https://github.com/babel/babel/pull/6581, accesses of the form

```js
stack[stack.length - 1];
```

when `stack` can be an empty array are pretty bad for performance.
In this case it also breaks the type safety, since the function
`last<T>` is declared to only return values of type `T`, but
occasionally also returns `undefined` now, since the `stack` parameters
passed to it never contain a property `"-1"` and neither do the
`Object.prototype` or the `Array.prototype`.

This is a non-breaking performance fix, which adds proper checking
to ensure that `last` is only invoked on non-empty arrays.
2017-10-28 16:07:28 -04:00
Henry Zhu
5b47e4a6cb
Merge transform-async-to-module-method into transform-async-to-generator (#6573) 2017-10-27 17:14:40 -04:00
Henry Zhu
f5ec9251c9
updated readme organization [skip ci] 2017-10-27 17:12:45 -04:00
Henry Zhu
c41abd79a1
Rename all proposal plugins to -proposal- from -transform- (#6570) 2017-10-27 15:26:38 -04:00
Logan Smyth
e4bcd1d0ff
Allow Flowtype's imports and exports when sourceType:script is set. (#771) 2017-10-27 11:55:24 -07:00
Brian Ng
a94aa54230 Re-add electron-to-chromium as preset-env devdep (#6551) 2017-10-27 11:51:46 -04:00
Henry Zhu
476ec5ed8f
Fix readmes to use @babel/ [skip ci] (#6569) 2017-10-27 11:50:59 -04:00
Henry Zhu
e5e7f5bf79 Lerna: Add publishConfig access public [skip ci] (#6557) 2017-10-26 19:22:13 -04:00
Logan Smyth
1d6cbd8dce Standardize descriptor creation. 2017-10-25 15:55:58 -07:00
Logan Smyth
fed2a14da1 Fail if there are cycles in config files. 2017-10-25 15:55:58 -07:00
Logan Smyth
0f31ce5686 Disallow 'null' as a general blank option placeholder. 2017-10-25 15:55:58 -07:00
Logan Smyth
64abf75d1f Perform option validation up front to avoid repeating assertions. 2017-10-25 15:55:58 -07:00
Logan Smyth
3673fbbd52 Refactor config item processing. 2017-10-25 15:55:58 -07:00
Logan Smyth
14901aa74f Remove the .loc from config items. 2017-10-25 15:55:57 -07:00
Logan Smyth
a25942bda9 Remove unused suppressDeprecationMessages option. 2017-10-25 15:55:57 -07:00
Logan Smyth
107648cd0b Remove unused 'mode' option. 2017-10-25 15:55:57 -07:00
Logan Smyth
0a2a0bb254 Remove the relative babel-core option. 2017-10-25 15:55:57 -07:00
Henry Zhu
0a823fbe8d add another team link [skip ci] 2017-10-25 17:51:47 -04:00
Henry Zhu
e3cebbf6bc Add peerDep on specific babel-core version in transform plugins, presets, and cli (#6549) 2017-10-25 08:36:00 -07:00
Simon Lydell
d2b3138bdd Make syntax highlighting for @ and # nicer (#6550) 2017-10-25 03:10:32 -04:00
Brian Ng
cb6082e98f Update flow tests whitelist (#770) 2017-10-24 15:58:27 -05:00
Sylvain Delabye
eb19ea18cc Remove stale emoji tests in plugin-transform-unicode-property-regex (#6548) 2017-10-24 13:17:05 -05:00
Raja Sekar
7f5a216e2d Changed Team link to babel website 2017-10-24 08:56:16 -05:00
Logan Smyth
11d8e0555f Avoid mutating the passed-in options for babel-register (#6542) 2017-10-23 15:49:10 -07:00
Ruslan Gunawardana
70818c3db8 UepdateEADME: useBuiltins: true is changed to "entry" [skip ci] (#6527)
babel-preset-env@next founds "useBuiltins": true is illegal. README is updated accordingly.
2017-10-23 17:08:00 -05:00
Sven SAULEAU
101529ffe0 Merge pull request #6529 from Borales/core-transformation-file-has
Providing File.has method for core/transformation package
2017-10-23 15:37:00 +02:00
Adam
3214c5004e docs - Add helper-get-function-arity readme [skip ci] (#6532)
* Add README to babel-helper-get-function-arity

* Use javascript template

* Address code review

* Comment out ellipsis
2017-10-23 10:30:36 +02:00
Sven SAULEAU
7185bd25e8 Merge pull request #6533 from athomann/add-helper-bindify-decorators-docs
Add API to helper-bindify-decorators README [skip ci]
2017-10-23 10:28:52 +02:00
Sven SAULEAU
546a844e32 Merge pull request #6534 from athomann/add-helper-hoist-variables-api
Add API to babel-helper-hoist-vars README [skip ci]
2017-10-23 10:23:32 +02:00
Adam Thomann
aeedabfa4f Add installation 2017-10-22 21:42:27 -04:00
Adam Thomann
9cebe88a9c Add API to babel-helper-hoist-vars README 2017-10-22 21:31:07 -04:00
Adam Thomann
a94b0d2e54 Add API to helper-bindify-decorators 2017-10-22 21:14:48 -04:00
Lucas Azzola
cd4f0ae393 Add loose mode for nullish coalescing operator (#6531)
* Add loose mode for nullish-coalescing

* Remove unneeded SequenceExpression
2017-10-22 13:25:29 +02:00
Borales
416e9aba39 Providing File.has method for core/transformation package 2017-10-22 00:45:40 +02:00
Lucas Azzola
9e0f5235b1 Optional Chaining: Account for document.all (#6525) 2017-10-21 15:55:39 -04:00
Mateusz Burzyński
4684edaec7 Adhering to async generator yield behavior change (#6452) 2017-10-21 21:48:27 +02:00
Alex Jover
39d05da3ed fix(babel-core): add missing extension to package.json dependency (#6524) 2017-10-21 11:46:10 +02:00
Mateusz Burzyński
54aa4cb3f9 Fixed async generator named declarations with inline helpers 2017-10-20 14:23:27 +02:00
Logan Smyth
765e920e48 Fix regression that leaks JSX pragma config between files. (#6519) 2017-10-19 16:09:56 -07:00
Mateusz Burzyński
fc75198fb4 Cloning reused node in class properties transform (#6517) 2017-10-19 18:12:57 -04:00
Justin Ridgewell
8d4674ca5a Fix destructuring in pipeline operator (#6515)
* Fix destructuring in pipeline operator

Fixes #6514.

* Run exec only on node 6
2017-10-19 15:59:36 -04:00
Brian Ng
923fd4705e Remove syntax-trailing-function-commas from Babel presets (#6513) 2017-10-19 15:50:48 -04:00