@@ -288,7 +288,6 @@ namespace ts {
288
288
const { enter, exit } = performance . createTimer ( "printTime" , "beforePrint" , "afterPrint" ) ;
289
289
let bundleBuildInfo : BundleBuildInfo | undefined ;
290
290
let emitSkipped = false ;
291
- let exportedModulesFromDeclarationEmit : ExportedModulesFromDeclarationEmit | undefined ;
292
291
293
292
// Emit each output file
294
293
enter ( ) ;
@@ -308,7 +307,6 @@ namespace ts {
308
307
diagnostics : emitterDiagnostics . getDiagnostics ( ) ,
309
308
emittedFiles : emittedFilesList ,
310
309
sourceMaps : sourceMapDataList ,
311
- exportedModulesFromDeclarationEmit
312
310
} ;
313
311
314
312
function emitSourceFileOrBundle ( { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } : EmitFileNames , sourceFileOrBundle : SourceFile | Bundle | undefined ) {
@@ -453,7 +451,7 @@ namespace ts {
453
451
noEmitHelpers : true ,
454
452
module : compilerOptions . module ,
455
453
target : compilerOptions . target ,
456
- sourceMap : compilerOptions . sourceMap ,
454
+ sourceMap : ! forceDtsEmit && compilerOptions . declarationMap ,
457
455
inlineSourceMap : compilerOptions . inlineSourceMap ,
458
456
extendedDiagnostics : compilerOptions . extendedDiagnostics ,
459
457
onlyPrintJsDocStyle : true ,
@@ -481,17 +479,13 @@ namespace ts {
481
479
declarationTransform . transformed [ 0 ] ,
482
480
declarationPrinter ,
483
481
{
484
- sourceMap : ! forceDtsEmit && compilerOptions . declarationMap ,
482
+ sourceMap : printerOptions . sourceMap ,
485
483
sourceRoot : compilerOptions . sourceRoot ,
486
484
mapRoot : compilerOptions . mapRoot ,
487
485
extendedDiagnostics : compilerOptions . extendedDiagnostics ,
488
486
// Explicitly do not passthru either `inline` option
489
487
}
490
488
) ;
491
- if ( forceDtsEmit && declarationTransform . transformed [ 0 ] . kind === SyntaxKind . SourceFile ) {
492
- const sourceFile = declarationTransform . transformed [ 0 ] ;
493
- exportedModulesFromDeclarationEmit = sourceFile . exportedModulesFromDeclarationEmit ;
494
- }
495
489
}
496
490
declarationTransform . dispose ( ) ;
497
491
if ( bundleBuildInfo ) bundleBuildInfo . dts = declarationPrinter . bundleFileInfo ;
@@ -559,7 +553,7 @@ namespace ts {
559
553
if ( sourceMapFilePath ) {
560
554
const sourceMap = sourceMapGenerator . toString ( ) ;
561
555
writeFile ( host , emitterDiagnostics , sourceMapFilePath , sourceMap , /*writeByteOrderMark*/ false , sourceFiles ) ;
562
- if ( printer . bundleFileInfo ) printer . bundleFileInfo . mapHash = BuilderState . computeSignature ( sourceMap , maybeBind ( host , host . createHash ) ) ;
556
+ if ( printer . bundleFileInfo ) printer . bundleFileInfo . mapHash = computeSignature ( sourceMap , maybeBind ( host , host . createHash ) ) ;
563
557
}
564
558
}
565
559
else {
@@ -571,7 +565,7 @@ namespace ts {
571
565
writeFile ( host , emitterDiagnostics , jsFilePath , text , ! ! compilerOptions . emitBOM , sourceFiles , { sourceMapUrlPos } ) ;
572
566
// We store the hash of the text written in the buildinfo to ensure that text of the referenced d.ts file is same as whats in the buildinfo
573
567
// This is needed because incremental can be toggled between two runs and we might use stale file text to do text manipulation in prepend mode
574
- if ( printer . bundleFileInfo ) printer . bundleFileInfo . hash = BuilderState . computeSignature ( text , maybeBind ( host , host . createHash ) ) ;
568
+ if ( printer . bundleFileInfo ) printer . bundleFileInfo . hash = computeSignature ( text , maybeBind ( host , host . createHash ) ) ;
575
569
576
570
// Reset state
577
571
writer . clear ( ) ;
@@ -774,20 +768,20 @@ namespace ts {
774
768
const jsFileText = host . readFile ( Debug . checkDefined ( jsFilePath ) ) ;
775
769
if ( ! jsFileText ) return jsFilePath ! ;
776
770
// If the jsFileText is not same has what it was created with, tsbuildinfo is stale so dont use it
777
- if ( BuilderState . computeSignature ( jsFileText , createHash ) !== buildInfo . bundle . js . hash ) return jsFilePath ! ;
771
+ if ( computeSignature ( jsFileText , createHash ) !== buildInfo . bundle . js . hash ) return jsFilePath ! ;
778
772
const sourceMapText = sourceMapFilePath && host . readFile ( sourceMapFilePath ) ;
779
773
// error if no source map or for now if inline sourcemap
780
774
if ( ( sourceMapFilePath && ! sourceMapText ) || config . options . inlineSourceMap ) return sourceMapFilePath || "inline sourcemap decoding" ;
781
- if ( sourceMapFilePath && BuilderState . computeSignature ( sourceMapText ! , createHash ) !== buildInfo . bundle . js . mapHash ) return sourceMapFilePath ;
775
+ if ( sourceMapFilePath && computeSignature ( sourceMapText ! , createHash ) !== buildInfo . bundle . js . mapHash ) return sourceMapFilePath ;
782
776
783
777
// read declaration text
784
778
const declarationText = declarationFilePath && host . readFile ( declarationFilePath ) ;
785
779
if ( declarationFilePath && ! declarationText ) return declarationFilePath ;
786
- if ( declarationFilePath && BuilderState . computeSignature ( declarationText ! , createHash ) !== buildInfo . bundle . dts ! . hash ) return declarationFilePath ;
780
+ if ( declarationFilePath && computeSignature ( declarationText ! , createHash ) !== buildInfo . bundle . dts ! . hash ) return declarationFilePath ;
787
781
const declarationMapText = declarationMapPath && host . readFile ( declarationMapPath ) ;
788
782
// error if no source map or for now if inline sourcemap
789
783
if ( ( declarationMapPath && ! declarationMapText ) || config . options . inlineSourceMap ) return declarationMapPath || "inline sourcemap decoding" ;
790
- if ( declarationMapPath && BuilderState . computeSignature ( declarationMapText ! , createHash ) !== buildInfo . bundle . dts ! . mapHash ) return declarationMapPath ;
784
+ if ( declarationMapPath && computeSignature ( declarationMapText ! , createHash ) !== buildInfo . bundle . dts ! . mapHash ) return declarationMapPath ;
791
785
792
786
const buildInfoDirectory = getDirectoryPath ( getNormalizedAbsolutePath ( buildInfoPath ! , host . getCurrentDirectory ( ) ) ) ;
793
787
const ownPrependInput = createInputFiles (
@@ -836,7 +830,7 @@ namespace ts {
836
830
newBuildInfo . program = buildInfo . program ;
837
831
if ( newBuildInfo . program && changedDtsText !== undefined && config . options . composite ) {
838
832
// Update the output signature
839
- ( newBuildInfo . program as ProgramBundleEmitBuildInfo ) . outSignature = computeSignature ( changedDtsText , changedDtsData , createHash ) ;
833
+ ( newBuildInfo . program as ProgramBundleEmitBuildInfo ) . outSignature = computeSignature ( changedDtsText , createHash , changedDtsData ) ;
840
834
newBuildInfo . program . dtsChangeTime = getCurrentTime ( host ) . getTime ( ) ;
841
835
}
842
836
// Update sourceFileInfo
0 commit comments