@@ -3628,12 +3628,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
3628
3628
// only allow export default at a source file level
3629
3629
if ( modulekind === ModuleKind . CommonJS || modulekind === ModuleKind . AMD || modulekind === ModuleKind . UMD ) {
3630
3630
if ( ! isEs6Module ) {
3631
- if ( languageVersion === ScriptTarget . ES5 ) {
3631
+ if ( languageVersion !== ScriptTarget . ES3 ) {
3632
3632
// default value of configurable, enumerable, writable are `false`.
3633
3633
write ( "Object.defineProperty(exports, \"__esModule\", { value: true });" ) ;
3634
3634
writeLine ( ) ;
3635
3635
}
3636
- else if ( languageVersion === ScriptTarget . ES3 ) {
3636
+ else {
3637
3637
write ( "exports.__esModule = true;" ) ;
3638
3638
writeLine ( ) ;
3639
3639
}
@@ -5171,36 +5171,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
5171
5171
if ( ! ( node . flags & NodeFlags . Export ) ) {
5172
5172
return ;
5173
5173
}
5174
- // If this is an exported class, but not on the top level (i.e. on an internal
5175
- // module), export it
5176
- if ( node . flags & NodeFlags . Default ) {
5177
- // if this is a top level default export of decorated class, write the export after the declaration.
5178
- writeLine ( ) ;
5179
- if ( thisNodeIsDecorated && modulekind === ModuleKind . ES6 ) {
5180
- write ( "export default " ) ;
5181
- emitDeclarationName ( node ) ;
5182
- write ( ";" ) ;
5183
- }
5184
- else if ( modulekind === ModuleKind . System ) {
5185
- write ( ` ${ exportFunctionForFile } ("default", ` ) ;
5186
- emitDeclarationName ( node ) ;
5187
- write ( ");" ) ;
5174
+ if ( modulekind !== ModuleKind . ES6 ) {
5175
+ emitExportMemberAssignment ( node as ClassDeclaration ) ;
5176
+ }
5177
+ else {
5178
+ // If this is an exported class, but not on the top level (i.e. on an internal
5179
+ // module), export it
5180
+ if ( node . flags & NodeFlags . Default ) {
5181
+ // if this is a top level default export of decorated class, write the export after the declaration.
5182
+ if ( thisNodeIsDecorated ) {
5183
+ writeLine ( ) ;
5184
+ write ( "export default " ) ;
5185
+ emitDeclarationName ( node ) ;
5186
+ write ( ";" ) ;
5187
+ }
5188
5188
}
5189
- else if ( modulekind !== ModuleKind . ES6 ) {
5190
- write ( `exports.default = ` ) ;
5189
+ else if ( node . parent . kind !== SyntaxKind . SourceFile ) {
5190
+ writeLine ( ) ;
5191
+ emitStart ( node ) ;
5192
+ emitModuleMemberName ( node ) ;
5193
+ write ( " = " ) ;
5191
5194
emitDeclarationName ( node ) ;
5195
+ emitEnd ( node ) ;
5192
5196
write ( ";" ) ;
5193
5197
}
5194
5198
}
5195
- else if ( node . parent . kind !== SyntaxKind . SourceFile || ( modulekind !== ModuleKind . ES6 && ! ( node . flags & NodeFlags . Default ) ) ) {
5196
- writeLine ( ) ;
5197
- emitStart ( node ) ;
5198
- emitModuleMemberName ( node ) ;
5199
- write ( " = " ) ;
5200
- emitDeclarationName ( node ) ;
5201
- emitEnd ( node ) ;
5202
- write ( ";" ) ;
5203
- }
5204
5199
}
5205
5200
5206
5201
function emitClassLikeDeclarationBelowES6 ( node : ClassLikeDeclaration ) {
0 commit comments