fix SystemJS module formatter exporting function parameters - fixes #2681
This commit is contained in:
parent
3a7d258c5c
commit
26cb025151
@ -3,3 +3,5 @@ export {foo, bar};
|
||||
export {foo as bar};
|
||||
export {foo as default};
|
||||
export {foo as default, bar};
|
||||
export function foo() {}
|
||||
export function foo2(bar) {}
|
||||
|
||||
@ -17,6 +17,14 @@ System.register([], function (_export) {
|
||||
_export("default", foo);
|
||||
|
||||
_export("bar", bar);
|
||||
|
||||
function foo() {}
|
||||
|
||||
_export("foo", foo);
|
||||
|
||||
function foo2(bar) {}
|
||||
|
||||
_export("foo2", foo2);
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@ -13,8 +13,6 @@ System.register(["./evens"], function (_export) {
|
||||
|
||||
_export("nextOdd", nextOdd);
|
||||
|
||||
_export("n", n);
|
||||
|
||||
_export("p", p = 5);
|
||||
|
||||
_export("p", p);
|
||||
@ -32,4 +30,4 @@ System.register(["./evens"], function (_export) {
|
||||
_export("isOdd", isOdd);
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@ -50,7 +50,7 @@ export default function ({ types: t }) {
|
||||
|
||||
return {
|
||||
inherits: require("babel-plugin-transform-strict-mode"),
|
||||
|
||||
|
||||
visitor: {
|
||||
Program: {
|
||||
exit(path) {
|
||||
@ -136,7 +136,13 @@ export default function ({ types: t }) {
|
||||
path.replaceWith(declar);
|
||||
|
||||
let nodes = [];
|
||||
for (let name in declar.getBindingIdentifiers()) {
|
||||
let bindingIdentifiers;
|
||||
if (path.isFunction()) {
|
||||
bindingIdentifiers = { [declar.node.id.name]: declar.node.id };
|
||||
} else {
|
||||
bindingIdentifiers = declar.getBindingIdentifiers();
|
||||
}
|
||||
for (let name in bindingIdentifiers) {
|
||||
addExportName(name, name);
|
||||
nodes.push(buildExportCall(name, t.identifier(name)));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user