13320 Commits

Author SHA1 Message Date
Sven SAULEAU
a2ed843636
feat: add more charCodes 2017-11-02 18:14:29 +01:00
Sven SAULEAU
b95810f4b4
refactor: switch to individual exports 2017-11-02 17:57:58 +01:00
Raja Sekar
2d0211a085 Fix parsing arrow with existential return type (#6726) 2017-11-02 10:56:27 -05:00
Sven SAULEAU
abb4850709
refactor: use charCodes 2017-11-02 16:40:08 +01:00
Sven SAULEAU
459e289d63
feat: setup constants 2017-11-02 09:10:26 +01:00
Daniel Tschinder
3b540e3f5a
Integrate babylon into babel workflow 2017-11-01 23:26:51 +01:00
Daniel Tschinder
52537410ef Merge histories of babylon and babel 2017-11-01 16:17:41 +01:00
Daniel Tschinder
2d378d076e
Move babylon into monorepo 2017-11-01 16:16:48 +01:00
Daniel Tschinder
1b612148bf "yield" parsing inside function name and parameters (#689)
* Use parseFunctionParams to parse method parameters

* [funct] Set this.state.inGenerator before parsing the function name/params

This allows "yield" inside generator parameters to be actually
parsed as a yield expression

* [funct] Disallow yield in function parameters

* [arrow] "yield" can start an arrow function (e.g. "yield => {}")

* [arrow] Disallow YieldExpressions inside arrow parameters.

* [err msg] Disallow yield as fn name in strict mode using checkReservedWord.

So Babylon throws "yield is a reserved word" instead of
a custom "Binding yield in strict mode"

* [err msg] "X is reserved in strict mode" should have precedence over "X is reserved", since it is more specific.

This was observable if "checkKeywords" is true and the word is both a keyword and a reserved
word in strict mode

* Disallow "yield" as an identifier inside generators

* [tests] Add tests, update wrong esprima tests and enable disabled esprima tests

* [tests] Move uncategorized tests to es2015/yield

* [tests] Update test262 whitelist

* Fix regression introduced by 8c77073

* [tests] Update flow whitelist

* Fix flow errors
2017-11-01 16:05:18 +01:00
Logan Smyth
0b3182911a
Avoid node duplication to fix spread bug with import. (#6657) 2017-10-31 20:37:16 -07:00
Henry Zhu
dbff057b8c update lockfile [skip ci] 2017-10-31 21:26:54 -04:00
Logan Smyth
d31c2c1470
Merge pull request #6655 from loganfsmyth/more-peerdeps
Use peerDeps in register and babel-node, add missing peerDependencies, and declare devDependencies
2017-10-31 18:10:55 -07:00
Logan Smyth
2d7685bdeb Explicitly declare devDependency to satisfy peerDep on babel-core. 2017-10-31 17:00:55 -07:00
Logan Smyth
ffad34e1a6 Remove unused @babel/types dependency. 2017-10-31 17:00:45 -07:00
Logan Smyth
8c95145c14 Use peerDependency for @babel register/node/cli. 2017-10-31 17:00:41 -07:00
Logan Smyth
948f741067 Add missing peerDependencies. 2017-10-31 16:57:56 -07:00
Henry Zhu
0e2a249746
Update to beta.5 with scoped packages 👻 (#6654)
* Update to beta.5 with scoped packages

* update to released version

* allow node 9 [skip ci]
2017-10-31 19:55:54 -04:00
Brian Ng
29a4aea27b Update parsing flow type/typeof imports (#773)
* Remove extranneous backticks from type/typeof error message

* Add isLookaheadContextual util

* Update parsing flow type/typeof imports
2017-10-31 17:09:39 +01:00
Nicolò Ribaudo
cd050e1405 Parse parameters inside function's env (#652)
* Parse parameters inside function context

* Add test for new.target inside parameters
2017-10-31 16:31:35 +01:00
M Behzad
fee7de2c1d white lists getter and setter acceseors for having stage-2 decorators (#766)
- adds `get` and `set` kind in addition to `method` to the list of allowed class members for having a decorator,
- adds tests for this two cases (decorator + set and decorator + get)
2017-10-31 16:13:04 +01:00
Henry Zhu
690d6465d8 v7.0.0-beta.5 v7.0.0-beta.5 2017-10-30 16:55:46 -04:00
Henry Zhu
bede73122d
fixup places that aren not scoped [skip ci] (#6646) 2017-10-30 16:47:13 -04:00
Mateusz Burzyński
a1c7449a92 Fixed incorrect static class field initialization order (#6530) 2017-10-30 16:32:45 -04:00
Henry Zhu
624f00f23c
Fix peerDep to ^ for beta only (#6644) 2017-10-30 16:24:42 -04:00
Henry Zhu
38f984f956 v7.0.0-beta.4 v7.0.0-beta.4 2017-10-30 14:33:56 -04:00
Henry Zhu
acfe99a4bc remove deprecated lerna command [skip ci] 2017-10-30 14:27:41 -04:00
Henry Zhu
96c380899b update types [skip ci] 2017-10-30 12:35:08 -04:00
Henry Zhu
397953c32d update lock [skip ci] 2017-10-30 12:21:20 -04:00
Benedikt Meurer
00342452e2 Fix OOB string character access in Printer#_maybeAddParen. (#6589)
* 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.
2017-10-30 09:16:44 -04:00
Daniel Tschinder
86abc16b37
Fix decorators2 to support export @decorator class A {} (#767)
* Fix decorators2 to support `export @decorator class A {}`

* change to better error message

Also ensure that null/undefined options get default value
2017-10-29 12:20:15 +01: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
9ac326b075
remove es20xx prefixes from plugins and rename folders (#6575) 2017-10-28 20:43:15 -04:00
Henry Zhu
92a3caeb9c
remove warning (still applies but don't need it there) [skip ci] (#6579) 2017-10-28 20:17:16 -04:00
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