| | |
| | | Object.defineProperty(exports, "__esModule", { |
| | | value: true |
| | | }); |
| | | exports.ImportSpecifier = ImportSpecifier; |
| | | exports.ImportDefaultSpecifier = ImportDefaultSpecifier; |
| | | exports.ExportDefaultSpecifier = ExportDefaultSpecifier; |
| | | exports.ExportSpecifier = ExportSpecifier; |
| | | exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; |
| | | exports.ExportAllDeclaration = ExportAllDeclaration; |
| | | exports.ExportNamedDeclaration = ExportNamedDeclaration; |
| | | exports.ExportDefaultDeclaration = ExportDefaultDeclaration; |
| | | exports.ImportDeclaration = ImportDeclaration; |
| | | exports.ExportDefaultSpecifier = ExportDefaultSpecifier; |
| | | exports.ExportNamedDeclaration = ExportNamedDeclaration; |
| | | exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; |
| | | exports.ExportSpecifier = ExportSpecifier; |
| | | exports.ImportAttribute = ImportAttribute; |
| | | exports.ImportDeclaration = ImportDeclaration; |
| | | exports.ImportDefaultSpecifier = ImportDefaultSpecifier; |
| | | exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; |
| | | exports.ImportSpecifier = ImportSpecifier; |
| | | |
| | | var _t = require("@babel/types"); |
| | | |
| | |
| | | } |
| | | |
| | | function ExportSpecifier(node) { |
| | | if (node.exportKind === "type") { |
| | | this.word("type"); |
| | | this.space(); |
| | | } |
| | | |
| | | this.print(node.local, node); |
| | | |
| | | if (node.exported && node.local.name !== node.exported.name) { |
| | |
| | | function ImportDeclaration(node) { |
| | | this.word("import"); |
| | | this.space(); |
| | | const isTypeKind = node.importKind === "type" || node.importKind === "typeof"; |
| | | |
| | | if (node.importKind === "type" || node.importKind === "typeof") { |
| | | if (isTypeKind) { |
| | | this.word(node.importKind); |
| | | this.space(); |
| | | } |
| | | |
| | | const specifiers = node.specifiers.slice(0); |
| | | const hasSpecifiers = !!specifiers.length; |
| | | |
| | | if (specifiers != null && specifiers.length) { |
| | | for (;;) { |
| | | const first = specifiers[0]; |
| | | while (hasSpecifiers) { |
| | | const first = specifiers[0]; |
| | | |
| | | if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { |
| | | this.print(specifiers.shift(), node); |
| | | if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { |
| | | this.print(specifiers.shift(), node); |
| | | |
| | | if (specifiers.length) { |
| | | this.token(","); |
| | | this.space(); |
| | | } |
| | | } else { |
| | | break; |
| | | if (specifiers.length) { |
| | | this.token(","); |
| | | this.space(); |
| | | } |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (specifiers.length) { |
| | | this.token("{"); |
| | | this.space(); |
| | | this.printList(specifiers, node); |
| | | this.space(); |
| | | this.token("}"); |
| | | } |
| | | if (specifiers.length) { |
| | | this.token("{"); |
| | | this.space(); |
| | | this.printList(specifiers, node); |
| | | this.space(); |
| | | this.token("}"); |
| | | } else if (isTypeKind && !hasSpecifiers) { |
| | | this.token("{"); |
| | | this.token("}"); |
| | | } |
| | | |
| | | if (hasSpecifiers || isTypeKind) { |
| | | this.space(); |
| | | this.word("from"); |
| | | this.space(); |