@@ -36,12 +36,12 @@ namespace ts {
36
36
return declarationDiagnostics . getDiagnostics ( targetSourceFile ? targetSourceFile . fileName : undefined ) ;
37
37
38
38
function getDeclarationDiagnosticsFromFile ( { declarationFilePath } : EmitFileNames , sources : SourceFile [ ] , isBundledEmit : boolean ) {
39
- emitDeclarations ( host , resolver , declarationDiagnostics , declarationFilePath , sources , isBundledEmit ) ;
39
+ emitDeclarations ( host , resolver , declarationDiagnostics , declarationFilePath , sources , isBundledEmit , /*emitOnlyDtsFiles*/ false ) ;
40
40
}
41
41
}
42
42
43
43
function emitDeclarations ( host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection , declarationFilePath : string ,
44
- sourceFiles : SourceFile [ ] , isBundledEmit : boolean ) : DeclarationEmit {
44
+ sourceFiles : SourceFile [ ] , isBundledEmit : boolean , emitOnlyDtsFiles : boolean ) : DeclarationEmit {
45
45
const newLine = host . getNewLine ( ) ;
46
46
const compilerOptions = host . getCompilerOptions ( ) ;
47
47
@@ -98,7 +98,7 @@ namespace ts {
98
98
// global file reference is added only
99
99
// - if it is not bundled emit (because otherwise it would be self reference)
100
100
// - and it is not already added
101
- if ( writeReferencePath ( referencedFile , ! isBundledEmit && ! addedGlobalFileReference ) ) {
101
+ if ( writeReferencePath ( referencedFile , ! isBundledEmit && ! addedGlobalFileReference , emitOnlyDtsFiles ) ) {
102
102
addedGlobalFileReference = true ;
103
103
}
104
104
emittedReferencedFiles . push ( referencedFile ) ;
@@ -1713,7 +1713,7 @@ namespace ts {
1713
1713
* @param referencedFile
1714
1714
* @param addBundledFileReference Determines if global file reference corresponding to bundled file should be emitted or not
1715
1715
*/
1716
- function writeReferencePath ( referencedFile : SourceFile , addBundledFileReference : boolean ) : boolean {
1716
+ function writeReferencePath ( referencedFile : SourceFile , addBundledFileReference : boolean , emitOnlyDtsFiles : boolean ) : boolean {
1717
1717
let declFileName : string ;
1718
1718
let addedBundledEmitReference = false ;
1719
1719
if ( isDeclarationFile ( referencedFile ) ) {
@@ -1722,7 +1722,7 @@ namespace ts {
1722
1722
}
1723
1723
else {
1724
1724
// Get the declaration file path
1725
- forEachExpectedEmitFile ( host , getDeclFileName , referencedFile ) ;
1725
+ forEachExpectedEmitFile ( host , getDeclFileName , referencedFile , emitOnlyDtsFiles ) ;
1726
1726
}
1727
1727
1728
1728
if ( declFileName ) {
@@ -1751,8 +1751,8 @@ namespace ts {
1751
1751
}
1752
1752
1753
1753
/* @internal */
1754
- export function writeDeclarationFile ( declarationFilePath : string , sourceFiles : SourceFile [ ] , isBundledEmit : boolean , host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection ) {
1755
- const emitDeclarationResult = emitDeclarations ( host , resolver , emitterDiagnostics , declarationFilePath , sourceFiles , isBundledEmit ) ;
1754
+ export function writeDeclarationFile ( declarationFilePath : string , sourceFiles : SourceFile [ ] , isBundledEmit : boolean , host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection , emitOnlyDtsFiles : boolean ) {
1755
+ const emitDeclarationResult = emitDeclarations ( host , resolver , emitterDiagnostics , declarationFilePath , sourceFiles , isBundledEmit , emitOnlyDtsFiles ) ;
1756
1756
const emitSkipped = emitDeclarationResult . reportedDeclarationError || host . isEmitBlocked ( declarationFilePath ) || host . getCompilerOptions ( ) . noEmit ;
1757
1757
if ( ! emitSkipped ) {
1758
1758
const declarationOutput = emitDeclarationResult . referencesOutput
0 commit comments