1016 Commits

Author SHA1 Message Date
Logan Smyth
f6be6e0bd4 Merge pull request #3463 from loganfsmyth/sourcemap-rework
Support more fine-grained source location tracking and use it for functions
2016-04-20 18:57:18 -07: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
81e6d4147d Map the end of block statement nodes to the end of their original location - fixes T7258 2016-04-11 01:54:41 -07:00
Logan Smyth
76bb1dffaa Track sourcemap location on a stack - fixes T7255 2016-04-11 01:54:40 -07:00
Logan Smyth
0130c6c186 v6.7.6 2016-04-08 09:27:12 -07:00
Logan Smyth
c3ccddaaaf Revert "Merge pull request #3433 from loganfsmyth/bail-out-rename"
This reverts commit 2d0a007d14e519fe60a849dd17068a0f3df79a28, reversing
changes made to e4d6d420415a0c290a321fb6c18ba5f19675b5c1.
2016-04-08 09:09:48 -07:00
Logan Smyth
89ecbda25c v6.7.5 2016-04-07 20:24:49 -07:00
Logan Smyth
3af8ec16e9 Handle input source mappings with no source location - fixes T7151 2016-04-07 09:34:45 -07:00
Logan Smyth
2d0a007d14 Merge pull request #3433 from loganfsmyth/bail-out-rename
Only attempt to rename export declarations, not expressions - fixes T7215
2016-04-06 19:04:21 -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
6470426f7a v6.7.4 2016-03-22 20:37:46 -07:00
Logan Smyth
078f6c0ed3 Only attempt to rename export declarations, not expressions - fixes T7215 2016-03-16 23:26:52 -07:00
Amjad Masad
f6ff14624f localize side-effectful test 2016-03-16 18:13:40 -07:00
Logan Smyth
e3af434250 Inserting shadowed 'this' bindings in constructors after super - fixes T7191 2016-03-12 16:18:56 -08:00
Amjad Masad
de92d632f3 v6.7.2 2016-03-10 14:41:27 -08:00
Amjad Masad
fd7b1c3386 don't rely on scope to get the type alias 2016-03-10 12:13:05 -08:00
Amjad Masad
3d5969ecff v6.7.0 2016-03-08 16:52:45 -08:00
Logan Smyth
af4575c43e Expand the regression tests for T2765. 2016-03-08 08:15:42 -08:00
Amjad Masad
2f654650bb Merge pull request #3407 from babel/async-tests
Async context tests
2016-03-08 02:00:40 -08:00
Amjad Masad
b35013abe5 Merge pull request #3406 from babel/fix-scope-info
Update scope info after block-scoping transform
2016-03-08 00:57:18 -08:00
Amjad Masad
69773a45f4 Add more async context tests 2016-03-08 00:55:42 -08:00
Amjad Masad
57c6c4ea81 Add test for T2765 2016-03-08 00:47:18 -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
77c7cc5363 Rework scope info updating in block-scoping transform
I previously tried an approach to scope bindings from var to scope but
it didn't catch all cases. This is evident in this bug:

https://phabricator.babeljs.io/T2892

Where even after transforming a const to a var we still get an error
that it's read-only.

This approach will go through and delete every existing let and const
binding and creates a new one with the kind "var"
2016-03-07 18:19:10 -08:00
Henry Zhu
1f92e5a15c Failing test for nested async with const 2016-03-07 13:59:03 -08:00
Henry Zhu
57ef6a2b6a v6.6.5 2016-03-04 18:16:17 -05:00
Henry Zhu
3689cae8e5 Merge pull request #3399 from babel/flow-comments
use flow instead of flow-comments
2016-03-04 16:24:28 -05:00
Henry Zhu
937b8a6767 use flow instead of flow-comments 2016-03-04 15:50:05 -05: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
Henry Zhu
39a8f5b796 v6.6.4 2016-03-02 16:29:17 -05: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
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