11387 Commits

Author SHA1 Message Date
Logan Smyth
1c1e9c764b Revert "Upgrade lerna to current beta." (#5303) 2017-02-13 14:20:10 -08:00
Logan Smyth
8a28c07d20 Upgrade lerna to current beta. (#5300) 2017-02-13 14:01:57 -08:00
Brian Ng
6522a255d9 Add greenkeeperio-bot to mention-bot blacklist (#5301) [skip ci] 2017-02-13 16:56:12 -05:00
Ben Alpert
14d3c2e256 Avoid adding unnecessary closure for block scoping (#5246)
When you write

```
for (const x of l) {
  setTimeout(() => x);
}
```

we need to add a closure because the variable is meant to be block-scoped and recreated each time the block runs. We do this.

However, we also add the closure when no loop is present. This isn't necessary, because if no loop is present then each piece of code runs at most once. I changed the transform to only add a closure if a variable is referenced from within a loop.
2017-02-13 13:46:00 -08:00
Yongxu Ren
2985597d40 Rewrite Hub as interface #5047 (#5050)
* Rewrite Hub as interface #5047

* Update index.js
2017-02-13 12:49:10 -08:00
Justin Ridgewell
ca45904a45 Fix loose for-of with label (#5298) 2017-02-13 10:30:36 -05:00
Samuel Reed
2aa2de8c6f feature: Support pure expressions in transform-react-constant-elements (#4812) 2017-02-12 20:02:38 -08:00
Logan Smyth
4edcd02965 Fix linting error 2017-02-12 18:48:07 -08:00
Samuel Reed
f4e3dfee74 Fix PathHoister hoisting before bindings. (#5153)
Fixes #5149 and enables a few additional safe hoists.
2017-02-12 18:35:08 -08:00
Samuel Reed
eb91bd831c Fix PathHoister hoisting JSX member expressions on "this". (#5143)
The PathHoister ignored member references on "this", causing it
to potentially hoist an expression above its function scope.

This patch tells the hoister to watch for "this", and if seen,
mark the nearest non-arrow function scope as the upper limit
for hoistng.

This fixes #4397 and is an alternative to #4787.
2017-02-12 18:34:07 -08:00
Daniel Tschinder
d2ccc6ae22 Fix test 2017-02-12 15:39:52 +01:00
Daniel Tschinder
09c1f069f9 Fix test 2017-02-12 15:38:11 +01:00
Brian Ng
57aaceaae7 Update contributing with more test info [skip ci] (#355) 2017-02-12 13:45:23 +01:00
Daniel Tschinder
d88befdd30
Merge branch 'master' into 7.0
# Conflicts:
#	src/parser/index.js
2017-02-12 13:32:06 +01:00
Daniel Tschinder
1cca7000d1 Reintroduce Variance node (#333)
* Reintroduce Variance node

* Optimize code and coverage

tt.plusMin can only be + or - so no need to have an elseif
2017-02-12 13:28:14 +01:00
Charles Pick
cd3f14921e Rename NumericLiteralTypeAnnotation to NumberLiteralTypeAnnotation (#332) 2017-02-12 13:14:35 +01:00
Daniel Tschinder
fac13290d7 Estree compatibility as plugin (#277)
* Initial estree support for ClassMethod

* Handle literals for estree

* Fix regex

* correct output of regexp and regenerate test

* Add tests for validation stuff with estree plugin

* Parse Properties correctly

This also refactors how babylon parses obj properties in general
so that this logic can be more easily extended.

* Run all throws-tests a second time with estree plugin

* Fix all throw tests

* Remove rebase conflict

* Correctly set kind

This ensures state.inMethod gets propagated correctly

* Add computed: false to methods with ident async

* Implement directive field on Directives

* Test invalid directives

* more tests
2017-02-12 12:48:41 +01:00
Kristof Degrave
1eaf01661b babel/babylon#328 babel/babylon#205 ?. as nullPropagation. For now it only works for member access. (.? or ?.[) If the object is undefined this will return undefined. If the object on which you want to access the property is defined, the value of the propery will be given back. 2017-02-11 21:20:15 +01:00
Kristof Degrave
b902fe6c7b ?. && ?[ as member access with nullPropagation. If the object is undefined this will return undefined. If the object on which you want to access the property is defined, the value of the propery will be given back. 2017-02-11 16:44:28 +01:00
Henry Zhu
dde70c0a04 [7.0] remove standalone babel package (#5293)
Having it isn't compatible with the changes for `babel-cli -> @babel/cli`
2017-02-10 14:40:24 -05:00
Daniel Tschinder
c79dd953ea Fix #304 and #309 (#339) 2017-02-10 15:36:46 +01:00
Raphael Mu
f25a2fbc78 add startLine option (#346) 2017-02-10 15:06:28 +01:00
Daniel Tschinder
407c97c9c2 Fix #321 by allowing question marks in type params (#338)
* Fix #321 by allowing question marks in type params

* Require commas between params
2017-02-10 15:03:15 +01:00
Daniel Tschinder
bc771bd0f9 Fix #336 by correctly setting arrow-param (#337) 2017-02-10 15:01:39 +01:00
Timothy Gu
88d38a1abb Update API documentation (#330) 2017-02-10 14:59:35 +01:00
Daniel Tschinder
4bd682e90b keywords are not allowed as local specifier (#307)
Also fix some error messages to be more specific
2017-02-10 14:58:44 +01:00
Panagiotis Vekris
e049ec3456 [Flow] Function predicate declaration (#103)
* [Flow] Function predicate declaration

The accepted syntax for function declarations is extended to allow
the following predicate declaration:

  FunctionReturnType :=
    Type
    Predicate
    Type Predicate

  Predicate :=
    %checks
    %checks ( ConditionalExpression )

* [Flow] Minor tweaks and more examples to function predicates

* [Flow] Clean-up and better message for function predicates

* [Flow] Adding abstract function predicate example

* [Flow] Rearranging the `predicate` field to ease babel generator.
2017-02-10 14:55:13 +01:00
james kyle
75ac320cf7 Add new flow preset (#5288) 2017-02-09 16:45:38 -08:00
Henry Zhu
870a37834c .gitignore for test [skip ci] 2017-02-09 19:19:41 -05:00
Henry Zhu
982cdb2a3a update yarn 2017-02-09 18:54:42 -05:00
Henry Zhu
ad91c6d186 use lerna@2-beta.37 (#5254) 2017-02-09 18:47:58 -05:00
Henry Zhu
9083bd6283 Merge branch 'master' into 7.0 2017-02-09 18:36:02 -05:00
Brandon Dail
56928dca66 [7.0] Remove ForAwaitStatement, add await flag to ForOfStatement (#349)
* Remove ForAwaitStatement, add await flag to ForOfStatement

* Set await flag for all ForOfStatements
2017-02-09 17:37:03 -05:00
Brian Ng
6da9bb83df Prevent multiple return statements in a loop when replacing expressions (#5030) 2017-02-09 13:06:41 -08:00
jwbay
1a325ce5d5 codegen performance: use trim-right instead of lodash/trimEnd (#5255) 2017-02-09 13:04:42 -08:00
greenkeeper[bot]
0834cb5b72 chore(package): update ava to version 0.18.0 (#345)
https://greenkeeper.io/
2017-02-09 14:55:55 +01:00
greenkeeper[bot]
b0220bfd3e chore(package): update babel-plugin-istanbul to version 4.0.0 (#350)
https://greenkeeper.io/
2017-02-09 14:30:19 +01:00
Sven SAULEAU
fb0a91b750 Fix TypeError with babel-register's cache (#5260) 2017-02-08 15:24:23 -05:00
Boopathi Rajaa
f8ffe03e79 Deopt evaluation of undefined with a local binding. Fix #5204 (#5206) 2017-02-08 10:37:14 -05:00
Mark Jones
5c5262437e Add definition of stage 3 (#5253) [skip ci] 2017-02-08 10:25:43 -05:00
Mark Jones
64e7d76b6b Added info about stage 2 (#5252) [skip ci] 2017-02-08 10:25:10 -05:00
Mark Jones
01eabd0d34 Add background for stage 1 (#5251) [skip ci] 2017-02-08 10:23:54 -05:00
Jimmy Jia
9de923258c Don't transpile ES7 symbol properties (#5195) 2017-02-07 11:19:14 -05:00
Vicente Jr Yuchitcho
1ba4a3fe5d Add path sibling traversal methods (#5230)
* getPrevSibling
* getNextSibling
* getAllNextSiblings
* getAllPrevSiblings
2017-02-07 11:17:50 -05:00
Łukasz Lityński
badce969da Fix confusing comment (#5272) (#5273) 2017-02-06 16:17:26 -08:00
Ben Alpert
ff8a10e52f Add option to block-scoping to slow on throw code (#5236)
The let/const plugin can add closures where you don't expect them. This is undesirable in some perf-sensitive projects (ex: React). I added an option that throws whenever the plugin adds a function (as opposed to simply renaming variables when converting to var).
2017-02-06 13:50:56 -05:00
Christina
6ee7bf6df5 checks if babel is installed globally and displays correct cli message (#5258)
* checks if babel is installed globally and displays correct cli message - fixes #5228

* recommend local installation and fix lint errors

* uses babel-cli vs babel

* switch back to babel

* use process.cwd() to determine if globally executed

* checks for /node_module/.bin/babel

* compare execPath and module execution path to determine global or local installation

* Move the babel/cli.js into a 'src' so the 'const's are compiled Node < 6.
2017-02-06 10:30:56 -08:00
Erik Desjardins
e9d7757433 Emit parens for await (but not yield) of ternary expressions (#5270) 2017-02-06 09:06:48 -08:00
Logan Smyth
6fa6f5924d [7.0] Run Babel's unittests in a custom sandbox (take 2). (#5263)
* Run Babel's unittests in a custom sandbox (take 2).

* Add tests for sandboxing behavior.
2017-02-04 13:31:33 -08:00
Andres Suarez
8c3392f058 Remove uses of lodash/compact (#5181) 2017-02-04 13:01:45 -08:00