Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix default exported classes without a name #4518

Merged
merged 2 commits into from Sep 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -267,13 +267,18 @@ export default function () {
]);
} else {
path.replaceWith(buildExportsAssignment(defNode, t.toExpression(declaration.node)));

// Manualy re-queue `export default class {}` expressions so that the ES3 transform
// has an opportunity to convert them. Ideally this would happen automatically from the
// replaceWith above. See #4140 for more info.
path.parentPath.requeue(path.get("expression.left"));
}
} else {
path.replaceWith(buildExportsAssignment(t.identifier("default"), declaration.node));

// Manualy re-queue `export default foo;` expressions so that the ES3 transform
// has an opportunity to convert them. Ideally this would happen automatically from the
// replaceWith above. See T7166 for more info.
// replaceWith above. See #4140 for more info.
path.parentPath.requeue(path.get("expression.left"));
}
exportDefaultFound = true;
Expand Down
@@ -0,0 +1 @@
export default class {}
@@ -0,0 +1,6 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = class {};
@@ -0,0 +1,7 @@
{
"plugins": [
"transform-es2015-modules-commonjs",
"transform-es3-member-expression-literals",
"transform-es3-property-literals"
]
}
@@ -0,0 +1 @@
export default function () {}
@@ -0,0 +1,7 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});

exports["default"] = function () {};
@@ -0,0 +1,7 @@
{
"plugins": [
"transform-es2015-modules-commonjs",
"transform-es3-member-expression-literals",
"transform-es3-property-literals"
]
}
@@ -0,0 +1 @@
export default class Foo {}
@@ -0,0 +1,7 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
class Foo {}
exports["default"] = Foo;
@@ -0,0 +1,7 @@
{
"plugins": [
"transform-es2015-modules-commonjs",
"transform-es3-member-expression-literals",
"transform-es3-property-literals"
]
}
@@ -0,0 +1 @@
export default function bat () {}
@@ -0,0 +1,7 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = bat;
function bat() {}
@@ -0,0 +1,7 @@
{
"plugins": [
"transform-es2015-modules-commonjs",
"transform-es3-member-expression-literals",
"transform-es3-property-literals"
]
}