@@ -58,22 +58,14 @@ namespace ts {
5858 return getPathFromPathComponents ( commonPathComponents ) ;
5959 }
6060
61- interface OutputFingerprint {
62- hash : string ;
63- byteOrderMark : boolean ;
64- mtime : Date ;
65- }
66-
6761 export function createCompilerHost ( options : CompilerOptions , setParentNodes ?: boolean ) : CompilerHost {
6862 return createCompilerHostWorker ( options , setParentNodes ) ;
6963 }
7064
7165 /*@internal */
72- // TODO(shkamat): update this after reworking ts build API
7366 export function createCompilerHostWorker ( options : CompilerOptions , setParentNodes ?: boolean , system = sys ) : CompilerHost {
7467 const existingDirectories = new Map < string , boolean > ( ) ;
7568 const getCanonicalFileName = createGetCanonicalFileName ( system . useCaseSensitiveFileNames ) ;
76- const computeHash = maybeBind ( system , system . createHash ) || generateDjb2Hash ;
7769 function getSourceFile ( fileName : string , languageVersionOrOptions : ScriptTarget | CreateSourceFileOptions , onError ?: ( message : string ) => void ) : SourceFile | undefined {
7870 let text : string | undefined ;
7971 try {
@@ -113,7 +105,7 @@ namespace ts {
113105 fileName ,
114106 data ,
115107 writeByteOrderMark ,
116- ( path , data , writeByteOrderMark ) => writeFileWorker ( path , data , writeByteOrderMark ) ,
108+ ( path , data , writeByteOrderMark ) => system . writeFile ( path , data , writeByteOrderMark ) ,
117109 path => ( compilerHost . createDirectory || system . createDirectory ) ( path ) ,
118110 path => directoryExists ( path ) ) ;
119111
@@ -127,42 +119,6 @@ namespace ts {
127119 }
128120 }
129121
130- let outputFingerprints : ESMap < string , OutputFingerprint > ;
131- function writeFileWorker ( fileName : string , data : string , writeByteOrderMark : boolean ) {
132- if ( ! isWatchSet ( options ) || ! system . getModifiedTime ) {
133- system . writeFile ( fileName , data , writeByteOrderMark ) ;
134- return ;
135- }
136-
137- if ( ! outputFingerprints ) {
138- outputFingerprints = new Map < string , OutputFingerprint > ( ) ;
139- }
140-
141- const hash = computeHash ( data ) ;
142- const mtimeBefore = system . getModifiedTime ( fileName ) ;
143-
144- if ( mtimeBefore ) {
145- const fingerprint = outputFingerprints . get ( fileName ) ;
146- // If output has not been changed, and the file has no external modification
147- if ( fingerprint &&
148- fingerprint . byteOrderMark === writeByteOrderMark &&
149- fingerprint . hash === hash &&
150- fingerprint . mtime . getTime ( ) === mtimeBefore . getTime ( ) ) {
151- return ;
152- }
153- }
154-
155- system . writeFile ( fileName , data , writeByteOrderMark ) ;
156-
157- const mtimeAfter = system . getModifiedTime ( fileName ) || missingFileModifiedTime ;
158-
159- outputFingerprints . set ( fileName , {
160- hash,
161- byteOrderMark : writeByteOrderMark ,
162- mtime : mtimeAfter
163- } ) ;
164- }
165-
166122 function getDefaultLibLocation ( ) : string {
167123 return getDirectoryPath ( normalizePath ( system . getExecutingFilePath ( ) ) ) ;
168124 }
0 commit comments