@@ -135,9 +135,11 @@ namespace ts {
135135 if ( node . kind === SyntaxKind . Bundle ) {
136136 isBundledEmit = true ;
137137 const refs = createMap < SourceFile > ( ) ;
138+ let hasNoDefaultLib = false ;
138139 const bundle = createBundle ( map ( node . sourceFiles ,
139140 sourceFile => {
140141 if ( sourceFile . isDeclarationFile || isSourceFileJavaScript ( sourceFile ) ) return ; // Omit declaration files from bundle results, too
142+ hasNoDefaultLib = hasNoDefaultLib || sourceFile . hasNoDefaultLib ;
141143 currentSourceFile = sourceFile ;
142144 enclosingDeclaration = sourceFile ;
143145 possibleImports = undefined ;
@@ -154,16 +156,17 @@ namespace ts {
154156 [ createModifier ( SyntaxKind . DeclareKeyword ) ] ,
155157 createLiteral ( getResolvedExternalModuleName ( context . getEmitHost ( ) , sourceFile ) ) ,
156158 createModuleBlock ( setTextRange ( createNodeArray ( filterCandidateImports ( statements ) ) , sourceFile . statements ) )
157- ) ] , /*isDeclarationFile*/ true , /*referencedFiles*/ [ ] , /*typeReferences*/ [ ] ) ;
159+ ) ] , /*isDeclarationFile*/ true , /*referencedFiles*/ [ ] , /*typeReferences*/ [ ] , /*hasNoDefaultLib*/ false ) ;
158160 return newFile ;
159161 }
160162 needsDeclare = true ;
161163 const updated = visitNodes ( sourceFile . statements , visitDeclarationStatements ) ;
162- return updateSourceFileNode ( sourceFile , updated , /*isDeclarationFile*/ true , /*referencedFiles*/ [ ] , /*typeReferences*/ [ ] ) ;
164+ return updateSourceFileNode ( sourceFile , updated , /*isDeclarationFile*/ true , /*referencedFiles*/ [ ] , /*typeReferences*/ [ ] , /*hasNoDefaultLib*/ false ) ;
163165 }
164166 ) ) ;
165167 bundle . syntheticFileReferences = [ ] ;
166168 bundle . syntheticTypeReferences = getFileReferencesForUsedTypeReferences ( ) ;
169+ bundle . hasNoDefaultLib = hasNoDefaultLib ;
167170 const outputFilePath = getDirectoryPath ( normalizeSlashes ( getOutputPathsFor ( node , host , /*forceDtsPaths*/ true ) . declarationFilePath ) ) ;
168171 const referenceVisitor = mapReferencesIntoArray ( bundle . syntheticFileReferences as FileReference [ ] , outputFilePath ) ;
169172 refs . forEach ( referenceVisitor ) ;
@@ -191,7 +194,7 @@ namespace ts {
191194 if ( isExternalModule ( node ) && ! resultHasExternalModuleIndicator ) {
192195 combinedStatements = setTextRange ( createNodeArray ( [ ...combinedStatements , createExportDeclaration ( /*decorators*/ undefined , /*modifiers*/ undefined , createNamedExports ( [ ] ) , /*moduleSpecifier*/ undefined ) ] ) , combinedStatements ) ;
193196 }
194- const updated = updateSourceFileNode ( node , combinedStatements , /*isDeclarationFile*/ true , references , getFileReferencesForUsedTypeReferences ( ) ) ;
197+ const updated = updateSourceFileNode ( node , combinedStatements , /*isDeclarationFile*/ true , references , getFileReferencesForUsedTypeReferences ( ) , node . hasNoDefaultLib ) ;
195198 return updated ;
196199
197200 function getFileReferencesForUsedTypeReferences ( ) {
0 commit comments