| 162660 | return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); |
| 162661 | } |
| 162662 | function addEs6Export(d) { |
| 162663 | var modifiers = ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], d.modifiers); |
| 162664 | switch (d.kind) { |
| 162665 | case 256 /* SyntaxKind.FunctionDeclaration */: |
| 162666 | return ts.factory.updateFunctionDeclaration(d, d.decorators, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); |
| 162667 | case 257 /* SyntaxKind.ClassDeclaration */: |
| 162668 | return ts.factory.updateClassDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); |
| 162669 | case 237 /* SyntaxKind.VariableStatement */: |
| 162670 | return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); |
| 162671 | case 261 /* SyntaxKind.ModuleDeclaration */: |
| 162672 | return ts.factory.updateModuleDeclaration(d, d.decorators, modifiers, d.name, d.body); |
| 162673 | case 260 /* SyntaxKind.EnumDeclaration */: |
| 162674 | return ts.factory.updateEnumDeclaration(d, d.decorators, modifiers, d.name, d.members); |
| 162675 | case 259 /* SyntaxKind.TypeAliasDeclaration */: |
| 162676 | return ts.factory.updateTypeAliasDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.type); |
| 162677 | case 258 /* SyntaxKind.InterfaceDeclaration */: |
| 162678 | return ts.factory.updateInterfaceDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); |
| 162679 | case 265 /* SyntaxKind.ImportEqualsDeclaration */: |
| 162680 | return ts.factory.updateImportEqualsDeclaration(d, d.decorators, modifiers, d.isTypeOnly, d.name, d.moduleReference); |
| 162681 | case 238 /* SyntaxKind.ExpressionStatement */: |
| 162682 | return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` |
| 162683 | default: |
| 162684 | return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); |
| 162685 | } |
| 162686 | } |
| 162687 | function addCommonjsExport(decl) { |
| 162688 | return __spreadArray([decl], getNamesToExportInCommonJS(decl).map(createExportAssignment), true); |
| 162689 | } |