310 Commits

Author SHA1 Message Date
Kay J
4dcc981d6a Removed unnecessary 'return' statements. (#3653)
* Removed unnecessary 'return' statements.

Returning a 'Promise' value in 'promise.then()' makes promise chains.
Used memory and promises are not garbage collected
until finishing 'helpers.asyncToGenerator'.

* Update test
2016-09-25 13:57:59 -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
Daniel Tschinder
10cd6519d8 Fix class inheritance in IE <=10 (T3041) (#3527)
* Fix class inheritance in IE9 & IE10 (T3041)

Internet Explorer 9&10 do not support __proto__ at all, don't have
Object.setPrototypeOf(), but have Object.getPrototypeOf().

Because of this setting the prototype is not possible, which makes the
babelHelpers.inherits() function to set __proto__ although not supported.

Afterwards Object.getPrototypeOf() is used, but this one is not
respecting the "custom" property __proto__ that we set.

The solution is to check for __proto__ first and afterwards fallback to
Object.getPrototypeOf().

* Do the same logic in babel-helper-replace-supers

* Fix tests

* Extract creation of prototype nodes to small helper
2016-08-23 15:08:44 -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
Sebastian McKenzie
4a19661346 Generate names field for identifiers to get correct names mappings (#3658) 2016-08-16 13:43:55 -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
10f4546fef Remove unnecessary import 2016-08-08 17:34:01 -07:00
James Kyle
f36d07d303 Fixes from PR comments 2016-08-08 17:32:58 -07:00
James Talmage
0a9cbe6e83 git commit add test for package.json config 2016-07-07 16:58:22 -04:00
James Talmage
8e84196eb8 add tests for env options 2016-07-07 16:36:34 -04:00
James Talmage
62ad67e5d9 add tests for build-config-chain 2016-07-03 23:58:44 -04:00
Logan Smyth
231f27f170 Fix non-unique 'ref' binding name - fixes T7468 2016-06-28 19:16:44 -07:00
Jesse McCarthy
ff044bbb0f Use more ideal mocha hooks (#3446)
* setup() instead of manual before().
* suiteTeardown() instead of afterEach().
2016-05-19 08:26:59 -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
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
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
3af8ec16e9 Handle input source mappings with no source location - fixes T7151 2016-04-07 09:34:45 -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
Amjad Masad
fd7b1c3386 don't rely on scope to get the type alias 2016-03-10 12:13:05 -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
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
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
937b8a6767 use flow instead of flow-comments 2016-03-04 15:50:05 -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
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
Henry Zhu
9182fcd71b make a test for #3303 2016-02-04 10:54:14 -05:00
Sebastian McKenzie
35e8250b57 add a top level analyze method for path marking sugar 2016-02-03 21:29:47 +00: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
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
10105bb077 Add test for 2892 2016-01-14 17:23:20 -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
Jesse McCarthy
77f5d30fb1 Add test for file-relative addon resolution
Plugins & presets.
2015-12-22 14:25:23 -05: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
Amjad Masad
12fac9cadf Inference recursion bug 2015-12-15 19:56:27 -08:00
Amjad Masad
036e90e9cc Fix bug with evaluating an expression in it's own binding 2015-12-06 07:56:17 -08:00
Amjad Masad
35e575cf93 Print a block when encountering consequents that are if statements 2015-11-17 19:07:20 -08:00
Amjad Masad
507557c48e Add failing test 2015-11-17 18:45:35 -08:00
Amjad Masad
352a604fe2 Make sure the test fails 2015-11-11 12:07:23 -08:00