@@ -499,7 +499,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
499499 let externalImports : ( ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration ) [ ] ;
500500 let exportSpecifiers : Map < ExportSpecifier [ ] > ;
501501 let exportEquals : ExportAssignment ;
502- let hasExportStars : boolean ;
502+ let hasExportStarsToExportValues : boolean ;
503503
504504 let detachedCommentsInfo : { nodePos : number ; detachedCommentEndPos : number } [ ] ;
505505
@@ -574,7 +574,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
574574 externalImports = undefined ;
575575 exportSpecifiers = undefined ;
576576 exportEquals = undefined ;
577- hasExportStars = undefined ;
577+ hasExportStarsToExportValues = undefined ;
578578 detachedCommentsInfo = undefined ;
579579 sourceMapData = undefined ;
580580 isEs6Module = false ;
@@ -1453,6 +1453,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
14531453 case SyntaxKind . ForInStatement :
14541454 case SyntaxKind . ForOfStatement :
14551455 case SyntaxKind . IfStatement :
1456+ case SyntaxKind . JsxClosingElement :
14561457 case SyntaxKind . JsxSelfClosingElement :
14571458 case SyntaxKind . JsxOpeningElement :
14581459 case SyntaxKind . JsxSpreadAttribute :
@@ -6230,15 +6231,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
62306231 }
62316232 else {
62326233 // export * from "foo"
6233- writeLine ( ) ;
6234- write ( "__export(" ) ;
6235- if ( modulekind !== ModuleKind . AMD ) {
6236- emitRequire ( getExternalModuleName ( node ) ) ;
6237- }
6238- else {
6239- write ( generatedName ) ;
6234+ if ( hasExportStarsToExportValues && resolver . moduleExportsSomeValue ( node . moduleSpecifier ) ) {
6235+ writeLine ( ) ;
6236+ write ( "__export(" ) ;
6237+ if ( modulekind !== ModuleKind . AMD ) {
6238+ emitRequire ( getExternalModuleName ( node ) ) ;
6239+ }
6240+ else {
6241+ write ( generatedName ) ;
6242+ }
6243+ write ( ");" ) ;
62406244 }
6241- write ( ");" ) ;
62426245 }
62436246 emitEnd ( node ) ;
62446247 }
@@ -6326,7 +6329,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
63266329 externalImports = [ ] ;
63276330 exportSpecifiers = { } ;
63286331 exportEquals = undefined ;
6329- hasExportStars = false ;
6332+ hasExportStarsToExportValues = false ;
63306333 for ( const node of sourceFile . statements ) {
63316334 switch ( node . kind ) {
63326335 case SyntaxKind . ImportDeclaration :
@@ -6349,8 +6352,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
63496352 if ( ( < ExportDeclaration > node ) . moduleSpecifier ) {
63506353 if ( ! ( < ExportDeclaration > node ) . exportClause ) {
63516354 // export * from "mod"
6352- externalImports . push ( < ExportDeclaration > node ) ;
6353- hasExportStars = true ;
6355+ if ( resolver . moduleExportsSomeValue ( ( < ExportDeclaration > node ) . moduleSpecifier ) ) {
6356+ externalImports . push ( < ExportDeclaration > node ) ;
6357+ hasExportStarsToExportValues = true ;
6358+ }
63546359 }
63556360 else if ( resolver . isValueAliasDeclaration ( node ) ) {
63566361 // export { x, y } from "mod" where at least one export is a value symbol
@@ -6376,7 +6381,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
63766381 }
63776382
63786383 function emitExportStarHelper ( ) {
6379- if ( hasExportStars ) {
6384+ if ( hasExportStarsToExportValues ) {
63806385 writeLine ( ) ;
63816386 write ( "function __export(m) {" ) ;
63826387 increaseIndent ( ) ;
@@ -6454,7 +6459,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
64546459 // should always win over entries with similar names that were added via star exports
64556460 // to support this we store names of local/indirect exported entries in a set.
64566461 // this set is used to filter names brought by star expors.
6457- if ( ! hasExportStars ) {
6462+ if ( ! hasExportStarsToExportValues ) {
64586463 // local names set is needed only in presence of star exports
64596464 return undefined ;
64606465 }
@@ -6879,6 +6884,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
68796884 write ( "});" ) ;
68806885 }
68816886 else {
6887+ // collectExternalModuleInfo prefilters star exports to keep only ones that export values
6888+ // this means that check 'resolver.moduleExportsSomeValue' is redundant and can be omitted here
68826889 writeLine ( ) ;
68836890 // export * from 'foo'
68846891 // emit as:
@@ -7147,7 +7154,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
71477154 externalImports = undefined ;
71487155 exportSpecifiers = undefined ;
71497156 exportEquals = undefined ;
7150- hasExportStars = false ;
7157+ hasExportStarsToExportValues = false ;
71517158 const startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ false ) ;
71527159 emitEmitHelpers ( node ) ;
71537160 emitCaptureThisForNodeIfNecessary ( node ) ;
@@ -7371,7 +7378,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
73717378 externalImports = undefined ;
73727379 exportSpecifiers = undefined ;
73737380 exportEquals = undefined ;
7374- hasExportStars = false ;
7381+ hasExportStarsToExportValues = false ;
73757382 emitEmitHelpers ( node ) ;
73767383 emitCaptureThisForNodeIfNecessary ( node ) ;
73777384 emitLinesStartingAt ( node . statements , startIndex ) ;
0 commit comments