better ExportDeclaration generation
This commit is contained in:
parent
500a0bdfb6
commit
e88505aba6
@ -15,38 +15,36 @@ exports.ExportBatchSpecifier = function () {
|
||||
};
|
||||
|
||||
exports.ExportDeclaration = function (node, print) {
|
||||
this.push("export");
|
||||
this.push("export ");
|
||||
|
||||
var specifiers = node.specifiers;
|
||||
|
||||
if (node.default) {
|
||||
this.push(" default");
|
||||
} else if (specifiers && specifiers.length > 0) {
|
||||
this.push("default ");
|
||||
}
|
||||
|
||||
if (node.declaration) {
|
||||
print(node.declaration);
|
||||
} else {
|
||||
if (specifiers.length === 1 && t.isExportBatchSpecifier(specifiers[0])) {
|
||||
this.push(" *");
|
||||
this.push("*");
|
||||
} else {
|
||||
this.push(" { ");
|
||||
this.printJoin(print, specifiers, ", ");
|
||||
this.push(" }");
|
||||
this.push("{");
|
||||
if (specifiers.length) {
|
||||
this.push(" ");
|
||||
this.printJoin(print, specifiers, ", ");
|
||||
this.push(" ");
|
||||
}
|
||||
this.push("}");
|
||||
}
|
||||
|
||||
if (node.source) {
|
||||
this.push(" from ");
|
||||
print(node.source);
|
||||
}
|
||||
|
||||
this.semicolon();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.declaration) {
|
||||
this.push(" ");
|
||||
print(node.declaration);
|
||||
} else {
|
||||
this.push(" { }");
|
||||
this.semicolon();
|
||||
}
|
||||
this.ensureSemicolon();
|
||||
};
|
||||
|
||||
exports.ImportDeclaration = function (node, print) {
|
||||
@ -65,14 +63,14 @@ exports.ImportDeclaration = function (node, print) {
|
||||
|
||||
if (!spec.default && spec.type !== "ImportBatchSpecifier" && !foundImportSpecifier) {
|
||||
foundImportSpecifier = true;
|
||||
self.push("{");
|
||||
self.push("{ ");
|
||||
}
|
||||
|
||||
print(spec);
|
||||
});
|
||||
|
||||
if (foundImportSpecifier) {
|
||||
this.push("}");
|
||||
this.push(" }");
|
||||
}
|
||||
|
||||
this.push(" from ");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user