38 Commits

Author SHA1 Message Date
Andrew Levine
c0038221d7 Run ESLint on test files, and fix lint errors in test files (#4732) 2016-10-15 18:27:48 -04:00
Moti Zilberman
9fc51d6292 Consolidate contiguous var declarations in destructuring transform (#4690)
* Consolidate contiguous var declarations in destructuring transform

Fixes #3081.

* Simplify var node coalescing in es2015-destructuring

* Revert "Simplify var node coalescing in es2015-destructuring"

This reverts commit 15cb373f0726f68225f7080a7ae206a63af174ee.

* More careful condition for var coalescing in es2015-destructuring
2016-10-14 11:51:22 -04:00
Logan Smyth
819cde936c Merge pull request #4511 from motiz88/fix-4462
Fix UpdateExpression handling in es2015-modules-commonjs, resolve #4462
2016-09-25 14:16:53 -07:00
Justin Ridgewell
c2ed9de7fb Flip default parameter template (#4515)
* Flip default parameter template

YMMV, I saved ~10b on a 2kb library. Not noticeable at the small scale, by why not do it anyway?

I've (unscientifically) found that flipping the default parameter conditional yields better gzip results. I think this is due to the slightly longer string it can now repeatedly match:

```js
// old
var param = arguments.length <= 0 || void 0 === arguments[0] ? null : arguments[0]
--------------------------------------------------------------^

// new
var param = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null
------------------------------------------------------------------------^
```

Though it's entirely likely gzip will also choose up to the index of the arguments if you many default parameters at different indexes.

* Update tests
2016-09-25 14:05:53 -07:00
Kai Cataldo
1db8c02d05 Remove duplicate default error (#4543)
* Revert "Throw error for multiple exports default (#3518)"

This reverts commit aa51dd4a3dbb956d8b619d884acf40194d5ffac8.

* Fix export default tests
2016-09-22 12:00:18 -04:00
Kai Cataldo
f3a6e4b0ae Fix tests with duplicate named exports (#4538)
* Fix babel-plugin-transform-flow-strip-types tests

* Fix babel-plugin-transform-es2015-modules-umd tests

* Fix babel-generator tests

* Fix babel-plugin-transform-es2015-modules-systemjs tests

* Fix babel-plugin-transform-es2015-modules-commonjs tests

* Fix babel-plugin-transform-es2015-modules-amd tests
2016-09-21 10:52:59 +02:00
Daniel Tschinder
cbbc1c7333 fix default exported classes without a name (#4518)
* fix default exported classes without a name

This correctly requeues class without name so the es3 transform can
transform the default keyword.

* Replace phabricator issue number with github
2016-09-17 22:50:54 -04:00
Moti Zilberman
43e0cfb08d Fix UpdateExpression handling in es2015-modules-commonjs, resolve #4462 2016-09-13 19:06:52 +03:00
Kai Cataldo
aa51dd4a3d Throw error for multiple exports default (#3518)
Fixes https://phabricator.babeljs.io/T7242
2016-08-16 13:21:00 -04:00
Henry Zhu
253918c30f Fix buildExportAll to account for commonjs/amd/systemjs (#3591)
* Fix buildExportAll to account for commonjs/amd

If the re-exported module was generated with Babel and it is a commonjs or amd module and so is the current module, this will result in an attempt to redefine the __esModule property, which throws a runtime error.

* Add test: don't overwrite __esModule on re-export

(Failing.)

* fixup tests

* Add fix for systemjs
2016-07-23 13:21:07 -04:00
Logan Smyth
1bbf109e8e Move aux comments entirely into printer. 2016-07-17 21:51:01 -07:00
Logan Smyth
38b91235cc Print inter-node newlines before other node items. 2016-07-17 21:51:00 -07:00
James Kyle
c561312bee Adds strictMode option to strict-mode transform (#3562) 2016-07-02 13:27:57 -07:00
Logan Smyth
2ba27c73d7 Allow empty 'export {};' statements - fixes T7439 2016-06-18 12:41:44 -07:00
Henry Zhu
c24b0b043a Add test for T7272 2016-04-08 09:02:02 -04:00
Logan Smyth
b1c50b01f2 Ensure that we push and pop evenly so things don't fail to queue - fixes T7199 2016-03-12 12:30:33 -08:00
Amjad Masad
ad3d5bea44 Add more test cases 2016-03-08 15:28:29 -08:00
Amjad Masad
13dc2423f0 Fix auxiliary comment test 2016-03-08 13:59:34 -08:00
Amjad Masad
46ebd90acb Test and fix export statement sourcemap 2016-03-08 13:47:02 -08:00
Amjad Masad
108838c66c Copy source location to require statement for sourcemap generation 2016-03-08 13:38:24 -08:00
Henry Zhu
5eb13059e2 Merge pull request #3383 from babel/T7160
Regression with exporting an arrow function with a default param
2016-03-06 15:40:27 -05:00
Henry Zhu
414efef7e3 Regression with exporting an arrow function with a default param 2016-03-02 09:49:43 -05:00
Ben Newman
9acd33b93a Make buildExportAll generate pure ES5 code.
The untransformed `let` keyword causes problems for older parsers. I
understand using `let` instead of `var` ensures each getter function has
its own binding for the KEY variable, but the same can be accomplished
(with less code) using a `.forEach` callback function, and this way
there's no need to worry about generating a unique name for the `key`
variable.
2016-03-02 00:08:55 -05:00
Logan Smyth
f2fea017c6 Ensure that the found context is active before pushing it. 2016-03-01 08:14:14 -08:00
Logan Smyth
0a0407be41 Re-queue remapped imports so they are re-traversed - fixes T6863 2016-02-22 22:54:28 -08:00
59naga
c509847588 Fix T6953,T2541 export-from statement renamed default issue
- Use `interopRequireDefault` helper if local name is default.

Via 59naga/babel-plugin-add-module-exports#20
2016-01-20 02:54:54 +09:00
Sebastian McKenzie
f1ef0ff5e9 Merge pull request #3118 from benjamn/import-hoisting
Add test of import hoisting that fails when the runtime transform is used.
2016-01-19 02:20:17 +00: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
Ben Newman
4ca25ac7a9 Add test of import hoisting that fails with the runtime transform. 2016-01-12 18:01:31 -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
kpdecker
9e382b1686 Fix aux comment termination in lists and calls 2015-12-18 01:37:26 -06:00
kpdecker
3791491b79 Strip location information from import remaps
Fixes https://phabricator.babeljs.io/T6851
2015-12-18 01:36:24 -06:00
Logan Smyth
f37acd293c Set the proper parents for new node paths - fixes T2763 2015-12-05 16:16:02 -08:00
kpdecker
1286200712 Output auxiliaryCommentAfter before trail comment
Quick fix for the case where generated comment is the terminal leaf in a subtree that is followed by a trailing comment.

Partial for #3034
2015-11-16 20:59:24 -06:00
kpdecker
488f5a067e Avoid duplicate auxiliary start if in aux section
Fixes #3032
2015-11-13 13:43:23 -06:00
kpdecker
1563e74cc0 Add a few auxiliary comment tests 2015-11-13 12:56:30 -06:00
Sebastian McKenzie
15969a0904 move all plugin tests out of babel-core and into their appropriate folders 2015-11-08 23:04:10 -08:00