@@ -35,13 +35,15 @@ namespace ts {
3535 forEachEmittedFile ( host , getDeclarationDiagnosticsFromFile , targetSourceFile ) ;
3636 return declarationDiagnostics . getDiagnostics ( targetSourceFile ? targetSourceFile . fileName : undefined ) ;
3737
38- function getDeclarationDiagnosticsFromFile ( { declarationFilePath } : EmitFileNames , sources : SourceFile [ ] , isBundledEmit : boolean ) {
39- emitDeclarations ( host , resolver , declarationDiagnostics , declarationFilePath , sources , isBundledEmit , /*emitOnlyDtsFiles*/ false ) ;
38+ function getDeclarationDiagnosticsFromFile ( { declarationFilePath } : EmitFileNames , sourceFileOrBundle : SourceFile | Bundle ) {
39+ emitDeclarations ( host , resolver , declarationDiagnostics , declarationFilePath , sourceFileOrBundle , /*emitOnlyDtsFiles*/ false ) ;
4040 }
4141 }
4242
4343 function emitDeclarations ( host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection , declarationFilePath : string ,
44- sourceFiles : SourceFile [ ] , isBundledEmit : boolean , emitOnlyDtsFiles : boolean ) : DeclarationEmit {
44+ sourceFileOrBundle : SourceFile | Bundle , emitOnlyDtsFiles : boolean ) : DeclarationEmit {
45+ const sourceFiles = sourceFileOrBundle . kind === SyntaxKind . Bundle ? sourceFileOrBundle . sourceFiles : [ sourceFileOrBundle ] ;
46+ const isBundledEmit = sourceFileOrBundle . kind === SyntaxKind . Bundle ;
4547 const newLine = host . getNewLine ( ) ;
4648 const compilerOptions = host . getCompilerOptions ( ) ;
4749
@@ -1803,8 +1805,9 @@ namespace ts {
18031805 }
18041806 return addedBundledEmitReference ;
18051807
1806- function getDeclFileName ( emitFileNames : EmitFileNames , _sourceFiles : SourceFile [ ] , isBundledEmit : boolean ) {
1808+ function getDeclFileName ( emitFileNames : EmitFileNames , sourceFileOrBundle : SourceFile | Bundle ) {
18071809 // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path
1810+ const isBundledEmit = sourceFileOrBundle . kind === SyntaxKind . Bundle ;
18081811 if ( isBundledEmit && ! addBundledFileReference ) {
18091812 return ;
18101813 }
@@ -1817,10 +1820,11 @@ namespace ts {
18171820 }
18181821
18191822 /* @internal */
1820- export function writeDeclarationFile ( declarationFilePath : string , sourceFiles : SourceFile [ ] , isBundledEmit : boolean , host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection , emitOnlyDtsFiles : boolean ) {
1821- const emitDeclarationResult = emitDeclarations ( host , resolver , emitterDiagnostics , declarationFilePath , sourceFiles , isBundledEmit , emitOnlyDtsFiles ) ;
1823+ export function writeDeclarationFile ( declarationFilePath : string , sourceFileOrBundle : SourceFile | Bundle , host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection , emitOnlyDtsFiles : boolean ) {
1824+ const emitDeclarationResult = emitDeclarations ( host , resolver , emitterDiagnostics , declarationFilePath , sourceFileOrBundle , emitOnlyDtsFiles ) ;
18221825 const emitSkipped = emitDeclarationResult . reportedDeclarationError || host . isEmitBlocked ( declarationFilePath ) || host . getCompilerOptions ( ) . noEmit ;
18231826 if ( ! emitSkipped ) {
1827+ const sourceFiles = sourceFileOrBundle . kind === SyntaxKind . Bundle ? sourceFileOrBundle . sourceFiles : [ sourceFileOrBundle ] ;
18241828 const declarationOutput = emitDeclarationResult . referencesOutput
18251829 + getDeclarationOutput ( emitDeclarationResult . synchronousDeclarationOutput , emitDeclarationResult . moduleElementDeclarationEmitInfo ) ;
18261830 writeFile ( host , emitterDiagnostics , declarationFilePath , declarationOutput , host . getCompilerOptions ( ) . emitBOM , sourceFiles ) ;
0 commit comments