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
Logan Smyth
8339e036bf
Remove babel.analyse and surrounding helpers.
2017-09-29 15:17:11 -07:00
Logan Smyth
fc448ca8f2
Flatten, process, and cache incoming options by key.
2017-09-27 11:20:27 -07:00
Logan Smyth
5eda451fb8
Remove the unused '.addImports' API from 'babel-core'.
2017-09-26 11:28:57 -07:00
Logan Smyth
b115ea5da7
Merge pull request #6280 from loganfsmyth/only-transform-modules
...
Only transform 'this'->'undefined' and inject 'use strict' if module statements are present
2017-09-23 11:24:52 -07:00
Mateusz Burzyński
9159323b1e
Skip adding explicit undefined for let declarations when it is not ne… ( #6288 )
2017-09-21 22:26:08 -07:00
Mateusz Burzyński
88b7983e4f
Fixed asyncToGenerator helper using arrow function ( #6289 )
2017-09-21 17:09:43 -07:00
Logan Smyth
2b88e079ef
Only transform this/use strict if a module.
2017-09-20 10:19:35 -07:00
Henry Zhu
57584268cd
move out syntax plugins to babel/babel-archive, they don't need to be updated ( #6229 )
2017-09-19 15:19:13 -04:00
Mateusz Burzyński
4519f95a29
Fixed buildExternalHelpers tool for var and module output types ( #6260 )
2017-09-19 14:44:40 -04:00
Ajay Narain Mathur
3cdb7d7f0f
added instanceOf plugin to preset es2015 ( #6257 )
...
* added instanceOf plugin to preset es2015
* fixed test cases
2017-09-17 17:33:42 -04:00
Logan Smyth
158e9fbfd7
Represent helpers as simple modules.
2017-09-12 22:15:16 -07:00
Sven SAULEAU
0c5fae2faa
Make sure source type is module when parsing .mjs ( #5700 )
...
* feat: force source type module for mjs extension
* style: fix lint
2017-09-12 20:59:00 -07:00
Logan Smyth
1e750a945c
Convert CommonJS to use new shared implementation.
2017-09-12 17:17:41 -07:00
Mateusz Burzyński
c47258d68c
Annotating transformed classes with #__PURE__ comment ( #6209 )
2017-09-11 11:18:37 -04:00
Mateusz Burzyński
fffa604023
Fixed regenerator related fixtures
2017-08-16 10:02:33 +02:00
Henry Zhu
0f823beeb1
Newlines in fixtures ( #6044 )
...
* write newlines for fixtures
* rerun fixtures
2017-08-02 15:35:29 -04:00
chocolateboy
605adc922d
allow PluginPass.file.addImport to create empty import statements ( #6022 )
...
* allow PluginPass.file.addImport to create empty import statements; fixes #6021
omitting addImport's second argument creates an import statement with an
empty `specifiers` array i.e. an empty import statement:
plugin:
Program (path, { file }) {
file.addImport('foo-bar/register')
}
output:
import "foo-bar/register";
2017-07-28 12:37:00 -04:00