133 Commits

Author SHA1 Message Date
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
Jordan Klassen
dc1f40540d Upgrade to lodash 4 (#3315)
* Upgrade to lodash 4

* Fix incorrect require in babel-runtime/scripts

* Replace cloneDeep with cloneDeepWith where applicable
2016-05-13 17:15:14 -04:00
Logan Smyth
9843c87573 Fix block statement code style. (#3493) 2016-05-02 21:15:37 -04:00
Henry Zhu
c9e5da6ad0 use named exports instead of export * as a temp workaround 2016-04-24 20:06:23 -04:00
Matt Krick
caab035115 turn transform into a simple for loop 2016-04-22 16:53:10 -05:00
Logan Smyth
b311517fd3 Merge pull request #3422 from loganfsmyth/this-shadow-constructor
Initialize shadowed 'this' bindings in constructors after super - fixes T7191
2016-04-16 14:29:38 -07:00
Logan Smyth
3af8ec16e9 Handle input source mappings with no source location - fixes T7151 2016-04-07 09:34:45 -07:00
Anna Henningsen
bd99179abc
Make sure input to path.{dir,base}name is a string
Since nodejs/node@08085c49b6, which will be part of Node.js v6.0,
functions from the `path` core module (like `dirname`) will require
their input to be a string.

Currently, at some points in the code they might be called
with `undefined`; This patch adds `… || ""` so that the input
is always a string.

For `path.dirname` in the babel-core file, this does not change
behaviour, since
`path.dirname(undefined) === path.dirname("") === "."` (where the
first expression is only defined for Node.js ≤ v5.x).

For `path.basename`, this changes the return value, since
`path.basename(undefined) === "undefined"` (on Node.js ≤ v5.x), but
`path.basename("") === ""`. However, it seems reasonable to assume
that, due to the trailing expression in
`path.basename(…) || "stdout"`, the current behaviour is not actually
the intended one.

There are possibly more places in the code base where similar changes
may be neccessary; However, these suffice to make the tests pass
and un-break the build of at least one external project when using
the current Node.js master branch.
2016-03-28 15:31:38 +02:00
Logan Smyth
e3af434250 Inserting shadowed 'this' bindings in constructors after super - fixes T7191 2016-03-12 16:18:56 -08:00
Logan Smyth
de21f2ef77 Resolve 'arguments' for rest args relative to direct parent. 2016-03-07 20:45:21 -08:00
Logan Smyth
51ddeade8a Avoid renaming this bindings in simple arrow function cases. 2016-03-07 20:45:20 -08:00
Logan Smyth
db3a43869c Remap across arrow function boundaries - fixes T7108 2016-03-07 20:45:19 -08:00
Amjad Masad
2f5a17fd90 fix eslint 2016-03-03 15:22:16 -08:00
Amjad Masad
2fbe28cc88 Remove remaining @flow annotations 2016-03-03 15:10:59 -08:00
Amjad Masad
12ee11a0a4 Revert "Remove Flow annotations and pragmas"
This reverts commit 4252244d06b225ab26a02d52c04f9940a3e4d6a2.
2016-03-03 15:03:55 -08:00
Amjad Masad
3667527d04 Revert "Remove flow"
This reverts commit 2827ff6b01dcce69e9d3c0402e96b52b3a2a47ee.
2016-03-03 14:49:20 -08:00
Sam Goldman
2827ff6b01 Remove flow 2016-03-01 22:33:30 -08:00
Amjad Masad
f4197cc77b Merge pull request #3350 from skevy/fix-babelrc-plugin-resolution
Make Babel actually resolve plugins relative to where they were specified (via .babelrc).
2016-03-01 17:19:40 -08:00
Henry Zhu
0916e2d189 Give specific error messages for babel 5 options that were removed in babel 6 2016-02-29 14:34:46 -05:00
Sam Goldman
5167d001c5 Remove @noflow as well 2016-02-28 13:25:36 -10:00
Sam Goldman
4252244d06 Remove Flow annotations and pragmas 2016-02-28 13:18:57 -10:00
Henry Zhu
6425c47537 Show a better error when trying to use a babel 5 plugin 2016-02-17 20:31:49 -05:00
Sebastian McKenzie
5b89849f43 Switch to klint, fix some lint rules 2016-02-14 23:25:14 +00:00
Adam Miskiewicz
c1960dbe02 Make Babel resolve plugins relative to where they were specified.
Given the following `.babelrc`:

```
{
  "plugins": ["./myPluginDir/somePlugin.js"]
}
```

Babel should resolve that plugin relative to the directory that contains the `.babelrc` file.

Currently, Babel is resolving the plugin relative to the current `process.cwd()`, as you can see in this test case: https://github.com/skevy/babel-plugin-resolution-test-case

This is occurring because the "fake" `Module` that we're creating in the `resolve` helper doesn't have an `id` and `filename`. Therefore, Node builds an array of paths that contains a number of node_module paths as well as `.`, and doesn't contain the path in which we'd actually like to look up the plugin. `.` of course resolves to the current `process.cwd()`, and thus makes the Babel plugin resolution mechanism quite fragile. The relevant code in Node.JS can be found here (tagged at the v5.4.1 release): ff99203724/lib/module.js (L236-L242).

This PR adds `id` and `filename` to that fake `Module` in order to resolve this issue.
2016-02-11 11:13:57 -05:00
Logan Smyth
8c910d6a4c Merge config options into list after babelrc options - fixes T7079 2016-02-10 21:18:27 -08:00
Sebastian McKenzie
bc2f84f371 Fix API change that e7187faea64b64d65a17c57d6578903f1fff27d6 introduced that wasn't changed in babel-register. Also use an object rather than a long ass list of arguments. 2016-02-08 02:17:09 +00:00
Henry Zhu
807e190728 Merge pull request #3186 from hzoo/add-some-flow
add some more flow types
2016-02-04 11:10:02 -05:00
Henry Zhu
c2d7e95e1a add some more flow types 2016-02-04 11:07:03 -05:00
Henry Zhu
26cd517932 Merge pull request #3303 from BlackGlory/patch-1
Throw a TypeError when falsy value found in plugins
2016-02-04 10:50:38 -05:00
Sebastian McKenzie
35e8250b57 add a top level analyze method for path marking sugar 2016-02-03 21:29:47 +00:00
CrocoDillon
1ba81153a7 Use this.options.babelrc instead of opts.babelrc 2016-01-30 12:11:33 -05:00
BlackGlory
6ca20c5540 Throw a TypeError when falsy value found in plugins 2016-01-24 14:38:46 +08:00
Dmitry Soshnikov
e7187faea6 Pass per preset: merge nested preset sub-options into preset 2016-01-20 13:36:27 -08:00
Dmitry Soshnikov
3f1353d01f [RFC] Pass per preset
This introduces "pass per preset" feature, spawting a new traversal for each preset in case if the `passPerPreset` is `true` (default is `false`). This gives opportunity to define "before" and "after" presets, mimicking a similar feature from Babel 5. A rationally for this is to make plugins as short as possible, and handled only needed nodes, not afrading potential collisions in case if presets are merged.
2016-01-18 21:00:37 -08:00
Henry Zhu
51dfd2237e Internal: temporarily remove flow types
- Will need to investigate the issue regarding eslint/babel-eslint.
2016-01-17 17:14:57 -05:00
Marshall Roch
8b55f4dfc2 Upgrade to flow 0.20.0 2015-12-17 12:49:48 -08:00
Steven Luscher
603bb64db0 Clarify description of comments config.
It doesn't mean anything for “strip/output” to be “on.”
2015-12-17 10:36:10 -08:00
Amjad Masad
cb03a98b65 Add minified format option
As a follow up from #3145 we agreed to add a new format that is a
superset of the compact format option. Do things that are considered
dangerous. e.g. not printing semicolons, or print literal values
as opposed to raw values.
2015-12-09 17:34:23 -08:00
Henry Zhu
d06cfe63c2 eslint: add space-after-keywords 2015-12-06 11:30:07 -05:00