930 Commits

Author SHA1 Message Date
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
f34e6518ff v6.6.0 2016-02-29 16:12:12 -05: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
b8cdd6e28c Merge pull request #3365 from jridgewell/replace-implicit-arrow-with-block
Replace arrow expression body with block statement
2016-02-25 22:02:31 -05:00
Justin Ridgewell
de1431e8c6 Replace arrow expression body with block statement
Original PR: https://github.com/babel/babel/pull/2469. Seems this got
lost in the v6 changes.

- - -

Without this, the only way to replace the arrow function is to either
manually override its `node.body`, or duplicate the arrow:

```js
// Old
ArrowFunctionExpression: function (node) {
  node.body = t.blockStatement(...);
  // Or
  return t.ArrowFunctionExpression(
    node.params,
    t.blockStatement(...),
    node.async
  );
}

// New
ArrowFunctionExpression: function() {
  this.get("body").replaceWith(t.blockStatement(...));
}
```
2016-02-20 04:36:40 -05: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
Henry Zhu
b1bb39e733 v6.5.2 2016-02-12 11:29:58 -05: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
a0fdb77413 v6.5.1 2016-02-08 02:18:10 +00: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
f9f8ad6eff v6.5.0 2016-02-06 19:06:41 -05: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
9182fcd71b make a test for #3303 2016-02-04 10:54:14 -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
Amjad Masad
12b7a44796 Merge pull request #3281 from DmitrySoshnikov/pass_per_preset
[RFC] Pass per preset
2016-01-22 14:29:07 -08:00
Dmitry Soshnikov
845a4fa557 Pass per preset: Use full function systax in test for old Node versions 2016-01-21 15:14:42 -08:00
Dmitry Soshnikov
e2486b5f71 Pass per preset: added unit test 2016-01-21 14:54:40 -08:00
Dmitry Soshnikov
e7187faea6 Pass per preset: merge nested preset sub-options into preset 2016-01-20 13:36:27 -08:00
Henry Zhu
e152e7044e v6.4.5 2016-01-19 18:02:31 -05: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
Sebastian McKenzie
65a4c8f4a4 Merge branch 'source-map-reenter' of https://github.com/kpdecker/babel into kpdecker-source-map-reenter
Conflicts:
	packages/babel-generator/src/printer.js
2016-01-18 18:36:57 +00: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
Henry Zhu
10105bb077 Add test for 2892 2016-01-14 17:23:20 -05:00
Henry Zhu
8cac20d845 v6.4.0 2016-01-06 15:34:12 -05:00
Amjad Masad
0d8e5a9e86 Fix over-parenthesizing of function expressions 2015-12-24 14:55:51 -08:00
Sebastian McKenzie
1fa24b1efd rename babel-plugin-external-helpers-2 to babel-plugin-external-helpers 2015-12-24 03:54:40 +00:00
Amjad Masad
ae8b7ea352 v6.3.26 2015-12-22 23:11:59 -08:00
Jesse McCarthy
77f5d30fb1 Add test for file-relative addon resolution
Plugins & presets.
2015-12-22 14:25:23 -05:00
Amjad Masad
31032ee7ad v6.3.21 2015-12-18 00:23:03 -08:00
kpdecker
94e7e4da8e Update source map handling to be reentrant
Rather than repeating the original location when we exit a node, we need to restore the previous parent’s original line location, since the source map format denotes the start location.
2015-12-18 01:11:32 -06:00
kpdecker
9b79fbcdf5 Avoid emitting duplicate source map entries 2015-12-18 00:57:48 -06: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
12fac9cadf Inference recursion bug 2015-12-15 19:56:27 -08:00
Amjad Masad
1fbbdd61e3 v6.3.17 2015-12-10 17:20:27 -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
3f7019f964 v6.3.15 2015-12-06 11:31:46 -05:00
Henry Zhu
d06cfe63c2 eslint: add space-after-keywords 2015-12-06 11:30:07 -05:00
Amjad Masad
036e90e9cc Fix bug with evaluating an expression in it's own binding 2015-12-06 07:56:17 -08:00
Sebastian McKenzie
7b36967416 v6.3.13 2015-12-04 22:56:51 +11:00
Sebastian McKenzie
ae831c2270 v6.3.12 2015-12-04 22:56:13 +11:00
Henry Zhu
b515fa8db8 v6.3.2 2015-12-03 22:48:04 -05:00