344 Commits

Author SHA1 Message Date
Deven Bansod
95894397eb Migrate babel-cli and babel-generator tests to use jest-expect (#7549) 2018-04-11 13:12:56 -05: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
Justin Ridgewell
450a1678f2
Use getProto and setProto helpers (#7675)
Depends on #7674.
2018-04-06 02:54:08 +01:00
Daniel Tschinder
f0d681a238 Remove obsolete max-len eslint rule and reformat some stuff to fit (#7602) 2018-03-20 08:51:47 -05:00
Daniel Tschinder
3a7881379a jest: ToEqual -> toBe 2018-03-10 11:48:09 +01:00
Deven Bansod
f3f0197890 Migrate babel-core tests to use jest-expect (#7513)
* Used codemods at: https://gist.github.com/devenbansod/03c5cff857661e076cbec72fcb2e7eb3 along with some manual intervention and review
2018-03-10 11:40:28 +01:00
Logan Smyth
b5e6536f26
Remove the sourceMapTarget option from core and implement it in babel-cli. (#7500) 2018-03-09 14:14:25 -08:00
Logan Smyth
7cc00cce0d Require output fixture extension to match sourceType output. 2018-03-04 13:31:33 -08:00
Logan Smyth
beb99dfda1 Rename test fixtures using module syntax to .mjs files. 2018-03-04 13:31:32 -08:00
Daniel Tschinder
3e95830646
Migrate to jest (#7455) 2018-03-03 10:58:19 +01:00
Logan Smyth
ddd40bf5c7
Rely entirely on sourceType for module vs script differentiation. (#7417) 2018-02-27 18:11:13 -08:00
Logan Smyth
8e3e6e0a88 Require AST output to be opt-in, rather than opt-out. 2018-02-26 18:44:59 -08:00
Kai Cataldo
22c8f6376c babel-core: Add parse method (#7291) 2018-01-30 12:38:58 -05:00
Nicolò Ribaudo
8659e1a88c Remove old expected.{js,json} files (#7187) 2018-01-09 13:10:30 -06:00
Raja Sekar
0f42accb87 Renamed files 2018-01-09 15:36:42 +01:00
Raja Sekar
07e69c009b Code changes 2018-01-09 10:36:11 +01:00
Logan Smyth
c292140254 Implement an 'overrides' config array to process in order for overrides. 2018-01-05 12:47:47 -08:00
Logan Smyth
f4a24a38ca Allow config objects to use test/include/exclude to limit application to specific files. 2018-01-05 12:47:47 -08:00
Tim Seckinger
c3f6f7fe28 fix buildCodeFrameError empty code frames 2018-01-03 13:53:15 +11:00
Brian Ng
ebbd5c7321
Bump regenerator-transform and regen fixture (#7137) 2017-12-30 16:44:22 -06:00
Logan Smyth
758fd0369c Rewrite config chain loading to build chain recursively to keep caching readable. 2017-12-21 19:06:36 -08:00
Maaz Syed Adeeb
17b37b5013 Handling babylon parsing errors in a better way (#6961)
* Handling babylon parsing errors in a better way

* Better error messages + Helpful URLs

* Replaced message from babylon completely

* Add importMeta plugin to the map
2017-12-18 15:49:34 -05:00
Nicolò Ribaudo
05b22d2597
Update @babel/helper-wrap-function templates (#6984)
This commit introduces 4 changes:

1) Function declarations are wrapped using function declarations.
   This has two advantages:
    - We can rely on native hoisting, instead of using _blockHoist
    - The function isn't wrapped until it is called. This avoids
      problems where `regeneratorRuntime.wrap` was called before
      that `babel-polyfill` was imported.

   Example:
     function fn() {}
     // becomes
     function fn() { return _fn.apply(this, arguments); }
     function _fn() {
       _fn = _wrapper(/* Original function ... */);
       return _fn.apply(this, arguments);
     }

2) Use a single template for both named and anonymous function
   expressions. They already had the same behavior, but the one
   used for named functions was a bit longer.

3) Use normal functions instead of arrow functions to wrap
   function expressions.

4) Generate a name based on the original one for wrapped
   functions (e.g. `foo` becomes `_foo` instead of `_ref`).
2017-12-13 16:21:58 +01:00
Logan Smyth
8fc8a1f2ee Use public options API for tests. 2017-11-28 13:25:10 -08:00
Logan Smyth
189c56628a Replace repeated plugins/preset in top-level config instead of running both. 2017-11-25 18:47:13 -08:00
Logan Smyth
cdf420d4d8
Rewrite config chain tests to use public loadOptions API. (#6909) 2017-11-25 18:25:20 -08:00
Nicolas Marien
cf62908bbd Keep user options intact in transformFile (#6890)
* Preserve user options in transformFile

* Improve tests for transformFile user opts handling
2017-11-25 10:13:56 -08:00
Logan Smyth
18ea5aca51 Expose a 'cwd' option for Babel's root options. 2017-11-24 19:43:25 -08:00
Logan Smyth
db28c18458 Disallow nested '.env' blocks since they are useless. 2017-11-24 17:45:27 -08:00
Logan Smyth
a89171910f
Merge pull request #6834 from loganfsmyth/caching-refactor
Expose `envName` as a top-level Babel option to avoid using environmental variables
2017-11-24 17:42:16 -08:00
Gidi Meir Morris
edbf5d33dc Fix "Better error messaging for unexpected tokens #6715" (#6875) 2017-11-22 15:31:03 -06:00
Logan Smyth
74439889d8 Centralize envName lookup using caching sidechannel. 2017-11-15 10:05:48 -08:00
Logan Smyth
bbff566024 Use expanded caching API to simplify usage. 2017-11-15 09:51:13 -08:00
Logan Smyth
3942862a2a Expose more caching flexibility for Babel's internal use. 2017-11-15 09:51:12 -08:00
Satyajit Sahoo
7ae6e1e5a0 Add /*#__PURE__*/ annotatiotion for babel-plugin-async-to-generator. Fixes #6572 2017-11-12 18:31:48 +05:30
Logan Smyth
2bfa2eb5cd Apply option defaults when transforming, not up front. 2017-11-09 12:20:52 -08:00
Logan Smyth
9e2828322e
Merge pull request #6556 from loganfsmyth/early-validation
Strictly validate Babel's options to centralize Flow refinement of datatype
2017-11-02 16:24:36 -07:00
Henry Zhu
9ac326b075
remove es20xx prefixes from plugins and rename folders (#6575) 2017-10-28 20:43:15 -04: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
1b4307205e Limit file-based plugins/presets to only exporting functions. (#6494) 2017-10-18 10:17:45 -07:00
Mateusz Burzyński
47fa189053 Scoped: update more babel- to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
691f90a774 Scoped: change test imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
aardito2
bfa167cc21 Add additional tests for ignore/only (#5647) 2017-10-12 20:20:07 -05:00
Logan Smyth
35312dc3d2 Track options on the plugin instance to avoid array pair usage. 2017-10-02 14:15:40 -07:00
Logan Smyth
f9bac2a358 Implement caching of plugins/presets/options 2017-10-02 14:09:59 -07:00
Logan Smyth
eae76e5b89 Break apart the File class into multiple files and add type definitions. 2017-10-02 13:55:37 -07:00
Logan Smyth
828aec757a Merge pull request #6326 from loganfsmyth/preserve-config-identity
Preserve object identity when loading config, for improved future caching.
2017-09-29 15:36:03 -07:00
Logan Smyth
f20f8b164f Remove unused module metadata collection. 2017-09-29 15:17:11 -07:00
Logan Smyth
3bac67b4b9 Remove the resolveModuleSource options. 2017-09-29 15:17:11 -07:00