@@ -3628,12 +3628,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
36283628 // only allow export default at a source file level
36293629 if ( modulekind === ModuleKind . CommonJS || modulekind === ModuleKind . AMD || modulekind === ModuleKind . UMD ) {
36303630 if ( ! isEs6Module ) {
3631- if ( languageVersion === ScriptTarget . ES5 ) {
3631+ if ( languageVersion !== ScriptTarget . ES3 ) {
36323632 // default value of configurable, enumerable, writable are `false`.
36333633 write ( "Object.defineProperty(exports, \"__esModule\", { value: true });" ) ;
36343634 writeLine ( ) ;
36353635 }
3636- else if ( languageVersion === ScriptTarget . ES3 ) {
3636+ else {
36373637 write ( "exports.__esModule = true;" ) ;
36383638 writeLine ( ) ;
36393639 }
@@ -5171,36 +5171,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
51715171 if ( ! ( node . flags & NodeFlags . Export ) ) {
51725172 return ;
51735173 }
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+ }
51885188 }
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 ( " = " ) ;
51915194 emitDeclarationName ( node ) ;
5195+ emitEnd ( node ) ;
51925196 write ( ";" ) ;
51935197 }
51945198 }
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- }
52045199 }
52055200
52065201 function emitClassLikeDeclarationBelowES6 ( node : ClassLikeDeclaration ) {
0 commit comments