521 Commits

Author SHA1 Message Date
Izaak Schroeder
8d9195f862 Pass dirname as extra metadata to preset constructor. (#4834)
* Pass `dirname` as extra metadata to preset constructor.

Sometimes a preset would like to know where it should resolve relative paths from (e.g. https://github.com/tleunen/babel-plugin-module-resolver) and this extra information makes that possible.

* Test for `dirname` passed into preset constructor

This adds a check for `dirname`’s existence and correctness to the
`resolve-addons-relative-to-file` test, and serves as a minimal example
of a path-aware preset.
2017-02-21 22:13:03 -05:00
Marcelo Dapper
724c949244 Replace lodash/assign with Object.assign (#5356)
Remove imports to lodash/assign and replace assign with Object.assign.
The lodash/assign is unnecessary for babel 7 as node >4 has the same
functionality built-in with Object.assign as used here.

This resolve the [issue 5353](https://github.com/babel/babel/issues/5353)
2017-02-21 22:08:20 -05:00
Logan Smyth
4ee385e96c Avoid usage of exports/module.exports/require(). 2017-02-21 16:52:42 -08:00
Logan Smyth
454933ef76 Revert "Rewrite Hub as interface #5047" (#5306) 2017-02-13 18:15:50 -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
Henry Zhu
9083bd6283 Merge branch 'master' into 7.0 2017-02-09 18:36:02 -05:00
Logan Smyth
b845f2b69d Re-enable the max-len ESLint rule. (#5265) 2017-02-04 11:07:15 -05:00
Kai Cataldo
e09ea222c9 Remove babel-runtime from packages' dependencies (#5218) 2017-01-27 09:04:35 -05:00
Andres Suarez
e9d87ed55c Remove path-is-absolute in favor of builtin path.isAbsolute (#5179) 2017-01-21 08:33:34 -05:00
Jordan Jones
1742035a98 [7.0] Fixes #5108, browser.js and browser.js test removed (#5124)
* Fixes #5108, browser.js and browser.js test removed

* Moved api/node.js to index.js and adjusted associated file references
2017-01-19 22:43:11 -05:00
Brian Ng
8c35b320d3 Bump eslint-config-babel and fix lint (#5129) 2017-01-17 10:51:16 +01:00
Andres Suarez
658f13e030 Replace uses of "lodash/each" with native equivalents 2017-01-15 13:54:54 -08:00
Andres Suarez
2bee765e6b Replace lodash is* with equivalent typeof check 2017-01-15 13:53:58 -08:00
Henry Zhu
672adba9a1 enable prefer const (#5113) 2017-01-14 09:48:52 -05:00
Sven SAULEAU
1672982873 fix: require debug directly instead of debug/node 2016-12-21 18:09:58 +01:00
Logan Smyth
ce0c620a9f Merge pull request #4729 from rmacklin/add-resolvePlugin-and-resolvePreset
Add resolvePlugin and resolvePreset methods to babel-core API
2016-12-20 08:42:27 -08:00
Daniel Tschinder
1d9e509df2 Fix eslint (#4897)
* Fix eslint call

* Fix linting errors
2016-11-26 11:24:38 -05:00
Diogo Franco
35b795ce54 Fix Valid example to be actually valid (#4773)
* Fix Valid example to be actually valid

* Rename 'pluginName' to 'presetName' in the example
2016-10-25 11:27:20 +02:00
Simen Bekkhus
9c2794dc85 Replace path-exists with fs.existsSync (#4731)
It's not deprecated anymore, see nodejs/node#8364
2016-10-17 14:31:49 -04:00
Richard Macklin
6ec93d782b Extract resolveFromPossibleNames to remove duplicated logic
"DRY"s the duplicated algorithm in resolvePlugin and resolvePreset
2016-10-16 11:18:43 -07:00
Richard Macklin
e24f07dfda Extract resolvePreset method to babel-core public API
This encapsulates the logic for turning an acceptable preset name into
the absolute path for that preset. It can be used to preprocess a
presets list to map each preset to its absolute path, which is necessary
if `babel.transform` is going to be executed on a file outside the
directory subtree where the presets are installed.

This adds a getPossiblePresetNames helper encapsulating the logic for
what preset names we should try to resolve, and the resolvePreset method
just calls this helper and actually resolves them.
2016-10-16 11:06:47 -07:00
Richard Macklin
f4389a1886 Extract resolvePlugin method to babel-core public API
This encapsulates the logic for turning an acceptable plugin name into
the absolute path for that plugin. It can be used to preprocess a
plugins list to map each plugin to its absolute path, which is necessary
if `babel.transform` is going to be executed on a file outside the
directory subtree where the plugins are installed.

This adds a getPossiblePluginNames helper encapsulating the logic for
what plugin names we should try to resolve, and the resolvePlugin method
just calls this helper and actually resolves them.
2016-10-16 10:52:13 -07:00
Moti Zilberman
2827d660fc Make special case for class property initializers in shadow-functions (#4502) 2016-10-14 15:21:11 -04:00
Henry Zhu
71790aace0 update eslint-config, fixes, add commands (#4721)
* update eslint-config, fixes, add commands

* switch plugin
2016-10-13 21:37:07 +02:00
Eric Rozell
c2387f0444 fix(shouldIgnore): filename normalization should be platform sensitive (#4631)
* fix(shouldIgnore): filename normalization should be platform sensitive

shouldIgnore normalizes the path of the filename prior to running any "only" regexes or functions. The normalization uses "slash", which has some undesirable special cases for non-ASCII characters and longer paths. Changing the normalization behavior to always replace path separators.

There is no real need to add additional tests, because the tests are not run in an environment where path.sep !== '/'.

* Minor style fix to use double quotes.

* Remove conditional for regex replace to keep consistent behavior.

* whitespace [skip ci]
2016-10-11 16:02:50 -04:00
Kai Cataldo
27ee74ea14 Better error messaging when preset options are given without a corresponding preset (#4685) 2016-10-11 16:56:53 +02:00
Brian Ng
0aa3ac2bb5 Update babel parser options (#4688)
* Update babel parser options
2016-10-07 14:30:47 -04:00
Daniel Tschinder
e0dbb1e770 Inline shebang-regex (#4650) 2016-10-03 20:58:26 -04:00
Daniel Tschinder
5a8070a397 Forward bound shadowed function when hoisting identifiers (#4635)
This change ensures that when hoisting an identifier we do not hoist it up to
the first no shadowed function, but rather up to the bound shadowed function
2016-10-01 13:24:12 -04:00
Daniel Tschinder
46339463bd Resolve presets with named exports correctly (#4620) 2016-09-30 18:27:40 -04:00
Henry Zhu
5ea57d5e9c fix tests and add exec test 2016-09-27 17:37:21 -04:00
Henry Zhu
b2eb5eca6f babel-core: add options for different parser/generator (#3561)
* babel-core: add options for different parser/generator

* test for experiemental plugins, other babylon options

* fix passing options into parser

* Fix when no code is provided

* fixup tests

* fix tests again

* use filename and fallback to cwd
2016-09-27 09:09:31 -04:00
Micha Reiser
a81a0d0f84 Fix fileName options passed to babylon (#4570)
The filename options used by babylon is called `sourceFilename` and not `filename`. Therefore the option should be adjusted to be called `sourceFilename`.
2016-09-26 16:31:05 +02:00
Logan Smyth
ef794198e9 Allow presets to be ES6 exports. 2016-09-25 11:41:43 -07:00
Henry Zhu
c07919bc9b Add support for preset organization shortcuts (#4542)
* add support for @org shortcats, fixes #4362

* add shortcut test

* fixes
2016-09-21 16:44:13 -04:00
Moti Zilberman
e64d86c1eb If loading a preset fails, show its name/path (#4506) (#4517) 2016-09-17 23:01:08 -04:00
Sebastian McKenzie
07b3dc18a0 Add wrapPluginVisitorMethod option to allow introspection and metrics tracking of plugins (#3659) 2016-08-20 10:36:52 -04:00
Henry Zhu
090f8cd10f Internal: remove comments (#3657) 2016-08-15 11:40:10 -04:00
Jordan Scales
ca27cf135d Revert "Merge pull request #3641 from babel/guy-fieri" (#3646)
This reverts commit 033681af8941d9678961f985c13e500c3c70f337, reversing
changes made to a2d66c0fc8ee58e82be3efd59173803e66dee3e0.

I brought you into this world, and I can take you out.
2016-08-15 11:35:39 -04:00
James Kyle
f36d07d303 Fixes from PR comments 2016-08-08 17:32:58 -07:00
James Kyle
9eb12e2c34 Fix lint 2016-08-05 12:40:50 -07:00
James Kyle
fd89bd136f Fix exports of babel-core 2016-08-05 12:36:08 -07:00
Henry Zhu
7213e57ee2 add tests, be able to pass preset options to test helper 2016-08-05 09:36:52 -04:00
Christophe Hurpeau
425d460ebf [Bug Fix] option manager: val = val.buildPreset should be before the check if the preset supports options 2016-08-05 12:06:07 +02:00
Logan Smyth
66317b10db Fix backward-compatibility of babel-preset-es2015 - fixes T7536 2016-08-04 20:55:20 -07:00
Henry Zhu
c6354a2132 es2015: transpile the preset, modify modules option to support "amd,umd,systemjs" as well, tests (#3627)
* es2015: transpile the preset, at spec option

* es2015: add support for modules option

* fixes + tests

* fixup preset error messsage

* es2015: update readme [skip ci]

* pass loose to other module transforms
2016-08-04 17:54:04 -04:00
Logan Smyth
897f553dc7 Support passing options to presets. (#3331) 2016-08-03 22:14:16 -04:00
James Talmage
62ad67e5d9 add tests for build-config-chain 2016-07-03 23:58:44 -04:00
James Talmage
79d8c5aa14 find list of applicable configs without requiring babel-core or plugins
`build-config-chain.js` creates an array of options which will be passed to `OptionsManager#mergeOptions`. The advantage of separating it out is that `build-config-chain` has a very minimal dependency list. The eventual intent is to allow the require hook to lazy load only when required. In other words, if no required files ever match the patterns `ignore` / `only` patterns, the bulk of babel-core, and the associated plugins, will never be loaded.
2016-07-02 03:04:49 -04:00
Andrew Johnston
f408f28a02 Fix: assign _this to this when there is no Superclass - Fixes T7364
Closes gh-3508
2016-05-28 09:51:28 -04:00