11599 Commits

Author SHA1 Message Date
Justin Ridgewell
f8ab9466d3
Move subclass inheritance to end (#7772)
We were using `Object.create` to setup the prototype chain at the start of the class definition, which lead to #7771.

I was a bit worried about a speed hit, but it seems everyone optimizes the two patterns the same way.
https://jsbench.github.io/#f9fca52407643d96458a35763b201215

Fixes #7771.
2018-04-21 17:31:44 -04:00
Justin Ridgewell
8f24f91166
Implement MemberExpressionToFunctions helper (#7763)
* Implement MemberExpressionToFunctions helper

Fixes #7733.

This will also be used to simplify the Private Fields transform, which had [almost the same code](ccd941057a/packages/babel-plugin-proposal-class-properties/src/index.js (L114-L217)) hand written.

* Cleanup

* Little more comment cleanup

* Use unary plus

This can't be redefined, unlike the `Number` identifier.

* Review comments

* Remove unused deps
2018-04-21 13:13:42 -04:00
Henry Zhu
dbdce0e4e4
add overwrite for tests [skip ci] 2018-04-21 11:46:15 -04:00
Vinh Le
4595c7fdfd Correct test running command (#7768) [skip ci]
* Correct test running command

* Also refine test/index.js content
2018-04-21 11:35:48 -04:00
Yosuke Kurami
1f97b91655 fix: don't write ': ' token when name is null (#7769) 2018-04-21 11:34:24 -04:00
Christopher Hiller
b0e1e84471 drop support for Node.js v4 (#7755)
* drop support for Node.js v4; closes #7753

- remove version 4 from Travis build matrix
- update environment support doc
- update `CONTRIBUTING.md`
- update `engines` field of root `package.json`

Signed-off-by: Christopher Hiller <boneskull@boneskull.com>

* update engines for babylon

Signed-off-by: Christopher Hiller <boneskull@boneskull.com>
2018-04-21 01:09:10 -04:00
Logan Smyth
f7c26bf2bf Add some docs for config searching. 2018-04-20 17:00:54 -07:00
Logan Smyth
a67eb25547 Only search for .babelrc files in the 'root' package by default. 2018-04-20 17:00:53 -07:00
Logan Smyth
485e37fcb0 Support a babel.config.fs file in a 'root' directory. 2018-04-20 17:00:53 -07:00
Logan Smyth
f013dab5fb Restrict .babelrc resolution to within a given package. 2018-04-20 17:00:53 -07:00
Brian Ng
e45b58dcb1
Fix small typo with decorators legacy option [skip ci] (#7762) 2018-04-19 20:26:54 -05:00
Henry Zhu
339dfddca5
Merge pull request #7734 from nicolo-ribaudo/decorators-legacy-option
Decorators legacy option
2018-04-19 14:36:18 -04:00
Brian Ng
0cd868a5f2
fixup tests 2018-04-19 09:17:33 -05:00
Nicolò Ribaudo
29db23ed87
Remove old comment 2018-04-19 09:08:15 -05:00
Nicolò Ribaudo
2679d6775c
Add "decoratorsLegacy" to presets 2018-04-19 09:08:15 -05:00
Nicolò Ribaudo
96316dcf88
Add legacy option to plugin-proposal-decorators. 2018-04-19 09:08:14 -05:00
Logan Smyth
42244123e1 Update the docs to correctly reflect default value changed in #7436. [skip ci] 2018-04-18 23:33:34 -07:00
Andy
4b97e837ea Fix type error (#7752) 2018-04-18 15:31:15 -04:00
Brian Ng
3299086955
Add support for flow implements (#7741) 2018-04-18 08:54:30 -05:00
Jason Quense
2bded404f3 Improve asyncIterator error (#7745)
* Improve asyncIterator error

When an object is has neither asyncIterator or iterator defined, throw the "not an async iterable" error

* Correct logic

* reduce access

* Update helpers.js
2018-04-17 21:02:53 -05:00
Justin Ridgewell
21c7ff3f37
Classes cleanup (#7737)
* Cleanup

* Move verifyConstructorVisitor out of closure
2018-04-17 17:52:43 -04:00
Nicolò Ribaudo
341bdab90c Update decorators parsing (#7719)
* Update decorators parsing

This commit introduces three changes:
1) Class properties can be decorated
2) Decorators can contain arbitrary expressions, using @(...)
3) The Decorator node type has a new property, "arguments". This
    makes it possible do distinguish @dec() and @(dec()), which have
    different behaviors because @(dec()) is equivalent to @(dec())().

* Rename Decorator#expression to Decorator#callee

* Add test for @dec()()
2018-04-17 16:22:03 -05:00
Brian Ng
81149a5cc9
Add initial support for ES2018 in preset-env (#7658) 2018-04-17 16:16:33 -05:00
Mateusz Burzyński
5166eef103 Optimize class properties output (#6656) 2018-04-15 01:03:47 -04:00
Justin Ridgewell
0ee9a4e612
Fix default class super inheritance (#7732)
Fixes #7683.
2018-04-14 15:15:40 -04:00
Henry Zhu
858a2c74e7
update readme [skip ci] 2018-04-14 15:13:31 -04:00
Justin Ridgewell
668358c4d0
Fix class properties after nested class' bare super (#7671)
* Fix class properties after nested class' bare super

Fixes #7371.

* Fix node 4 test

* This damn node 4 test

* All of the ClassBody, but not the methods or field inits

* tmp

* tmp

* Use common class environment visitor

* Tests

* Use skipKey to avoid recursive traversal

* Remove old state

* Use jest expect
2018-04-14 13:48:38 -04:00
Justin Ridgewell
39b05598a0
Drop Chai from packages (#7729) 2018-04-14 09:01:38 -04:00
Justin Ridgewell
29eafbbf44
Remove tagged template literal global caching (#7722)
* Remove tagged template literal global caching

Fixes #7350.

* Review comments

* assert output
2018-04-13 11:51:00 -04:00
Henry Zhu
7a106025ea
Merge pull request #7720 from devenbansod/migrate_to_jest_expect-3
Migrate more packages' tests to use jest expect assertions
2018-04-13 11:04:44 -04:00
Deven Bansod
4f1473da3d Remove global chai.assert in fixture runner's test context 2018-04-13 19:14:30 +05:30
Deven Bansod
c62b202e6a Migrate remaining test assertions to jest-expect 2018-04-13 19:14:03 +05:30
Deven Bansod
a084339a15 Migrate -computed-properties and -jscript tests to use jest expect assertions 2018-04-13 16:30:06 +05:30
Deven Bansod
d7987fbbd2 Migrate -transform-object-super tests to use jest expect assertions 2018-04-13 14:21:02 +05:30
Deven Bansod
8a31eabf5e Migrate -transform-classes tests to use jest expect assertions 2018-04-13 14:20:51 +05:30
Deven Bansod
80428dec47 Migrate -optional-catch-binding, -block-scoping to use jest expect assertions 2018-04-13 14:19:49 +05:30
Dennis Czombera
61ec5ce957 Provide better error message for invalid default export declaration (#7717) 2018-04-12 17:07:41 -05:00
Alexander Pepper
1e41f613bb [babel-preset-typescript] Fixed link of plugin-transform-typescript. (#7700) [skip ci] 2018-04-12 16:44:43 -04:00
Nicolò Ribaudo
a86d14de61 Disallow super() in class properties 2018-04-12 22:41:28 +02:00
Nicolò Ribaudo
a62cfe9045 Disallow arguments in class properties 2018-04-12 22:41:28 +02:00
Nicolò Ribaudo
f797454a18 Disallow super in functions in class properties 2018-04-12 22:41:28 +02:00
Justin Ridgewell
ec882be44d
Uncomment super increment expression set tests (#7721)
This was failing because of the bugs fixed by #7687.
2018-04-12 13:24:07 -04:00
Justin Ridgewell
ecbf0dd53c
Fix super nested class bugs (#7691)
* Properly traverse nested class for supers

* Add object nested in class cases

* Add object nested object cases

* Test class properties

* Undo changes to lerna.json

* Add tests arournd prefix/postfix super increment

* tmp

* Use sets
2018-04-12 13:02:26 -04:00
Nicolò Ribaudo
af3d6526e7 Add slack links to CONTRIBUTING.md (#7713) 2018-04-11 21:56:45 -05:00
Deven Bansod
95894397eb Migrate babel-cli and babel-generator tests to use jest-expect (#7549) 2018-04-11 13:12:56 -05:00
Justin Ridgewell
b1c9af3f05
Use new isInStrictMode (#7714) 2018-04-11 12:17:01 -04:00
Justin Ridgewell
ec3722b3f9
Get set helpers (#7687)
* Improve get/set helper

* fixtures

* Edge cases

* Add loose edge cases

* Spec compliant

* Add issue case

* Even more edge cases!

* Final updates

* Fix name

* Use Reflect.{get, set} when available

* Avoid block scoping in loose

* Remove semicolon

* Do not redefine a non-enumerable

* Get strictness from call site, not helpers

* Add called assertions

* Classes are always strict

* Update test fixture
2018-04-11 11:56:59 -04:00
Justin Ridgewell
7ae724f553
Add Path#isInStrictMode (#7712)
* Add Path#isInStrictMode

* Fix undefined directives

* Explicitly return for arrow expressions
2018-04-11 09:13:38 -04:00
Markus Török
6597a472b3 Add "use strict" directive (#7411)
* #7349
- Add "use strict" directive to transformed class bodies

* Update tests (#7349)

* Add test for program with use strict directive (#7349)

* Update tests (#7349)

* Update source mapping (#7349)

* Add test for parent blockStatement with use strict directive (#7349)

* Update tests (#7349)

* Update tests (#7349)

* Update tests (#7349)

* Add test for constructor-only class (#7349)

* Constructor only classes are strict, too

But constructor only that use non-simple parameters must use a strict function wrapper.

* Fix test

* Wrapper not needed if class is already strict

* Revert change to lerna.json
2018-04-10 17:33:38 -04:00
Hendrik Niemann
fdd0789936 Fix literal type annotation argument number (#7706)
Added the value argument to the visitors of flow literal type
annotations.
Literal type annotations need a value since they work very much like
primitive literals in normal JavaScript.

Fixes #7697
2018-04-10 09:38:20 -04:00