@@ -276,60 +276,6 @@ namespace ts {
276
276
return getOrCreateValueFromConfigFileMap < Map < T > > ( configFileMap , resolved , createMap ) ;
277
277
}
278
278
279
- export function getOutputDeclarationFileName ( inputFileName : string , configFile : ParsedCommandLine ) {
280
- const relativePath = getRelativePathFromDirectory ( rootDirOfOptions ( configFile . options , configFile . options . configFilePath ! ) , inputFileName , /*ignoreCase*/ true ) ;
281
- const outputPath = resolvePath ( configFile . options . declarationDir || configFile . options . outDir || getDirectoryPath ( configFile . options . configFilePath ! ) , relativePath ) ;
282
- return changeExtension ( outputPath , Extension . Dts ) ;
283
- }
284
-
285
- function getOutputJSFileName ( inputFileName : string , configFile : ParsedCommandLine ) {
286
- const relativePath = getRelativePathFromDirectory ( rootDirOfOptions ( configFile . options , configFile . options . configFilePath ! ) , inputFileName , /*ignoreCase*/ true ) ;
287
- const outputPath = resolvePath ( configFile . options . outDir || getDirectoryPath ( configFile . options . configFilePath ! ) , relativePath ) ;
288
- const newExtension = fileExtensionIs ( inputFileName , Extension . Json ) ? Extension . Json :
289
- fileExtensionIs ( inputFileName , Extension . Tsx ) && configFile . options . jsx === JsxEmit . Preserve ? Extension . Jsx : Extension . Js ;
290
- return changeExtension ( outputPath , newExtension ) ;
291
- }
292
-
293
- function getOutputFileNames ( inputFileName : string , configFile : ParsedCommandLine ) : ReadonlyArray < string > {
294
- // outFile is handled elsewhere; .d.ts files don't generate outputs
295
- if ( configFile . options . outFile || configFile . options . out || fileExtensionIs ( inputFileName , Extension . Dts ) ) {
296
- return emptyArray ;
297
- }
298
-
299
- const outputs : string [ ] = [ ] ;
300
- const js = getOutputJSFileName ( inputFileName , configFile ) ;
301
- outputs . push ( js ) ;
302
- if ( configFile . options . sourceMap ) {
303
- outputs . push ( `${ js } .map` ) ;
304
- }
305
- if ( getEmitDeclarations ( configFile . options ) && ! fileExtensionIs ( inputFileName , Extension . Json ) ) {
306
- const dts = getOutputDeclarationFileName ( inputFileName , configFile ) ;
307
- outputs . push ( dts ) ;
308
- if ( configFile . options . declarationMap ) {
309
- outputs . push ( `${ dts } .map` ) ;
310
- }
311
- }
312
- return outputs ;
313
- }
314
-
315
- function getOutFileOutputs ( project : ParsedCommandLine , ignoreBuildInfo ?: boolean ) : ReadonlyArray < string > {
316
- Debug . assert ( ! ! project . options . outFile || ! ! project . options . out , "outFile must be set" ) ;
317
- const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle ( project . options , /*forceDtsPaths*/ false ) ;
318
-
319
- let outputs : string [ ] | undefined = [ ] ;
320
- const addOutput = ( path : string | undefined ) => path && ( outputs || ( outputs = [ ] ) ) . push ( path ) ;
321
- addOutput ( jsFilePath ) ;
322
- addOutput ( sourceMapFilePath ) ;
323
- addOutput ( declarationFilePath ) ;
324
- addOutput ( declarationMapPath ) ;
325
- if ( ! ignoreBuildInfo ) addOutput ( buildInfoPath ) ;
326
- return outputs || emptyArray ;
327
- }
328
-
329
- function rootDirOfOptions ( opts : CompilerOptions , configFileName : string ) {
330
- return opts . rootDir || getDirectoryPath ( configFileName ) ;
331
- }
332
-
333
279
function newer ( date1 : Date , date2 : Date ) : Date {
334
280
return date2 > date1 ? date2 : date1 ;
335
281
}
@@ -715,7 +661,7 @@ namespace ts {
715
661
}
716
662
717
663
// Collect the expected outputs of this project
718
- const outputs = getAllProjectOutputs ( project ) ;
664
+ const outputs = getAllProjectOutputs ( project , ! host . useCaseSensitiveFileNames ( ) ) ;
719
665
720
666
if ( outputs . length === 0 ) {
721
667
return {
@@ -1199,10 +1145,10 @@ namespace ts {
1199
1145
// Update time stamps for rest of the outputs
1200
1146
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker ( configFile , newestDeclarationFileContentChangedTime , Diagnostics . Updating_unchanged_output_timestamps_of_project_0 , emittedOutputs ) ;
1201
1147
1202
- const status : UpToDateStatus = {
1148
+ const status : Status . UpToDate = {
1203
1149
type : UpToDateStatusType . UpToDate ,
1204
1150
newestDeclarationFileContentChangedTime : anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime ,
1205
- oldestOutputFileName : outputFiles . length ? outputFiles [ 0 ] . name : getFirstProjectOutput ( configFile )
1151
+ oldestOutputFileName : outputFiles . length ? outputFiles [ 0 ] . name : getFirstProjectOutput ( configFile , ! host . useCaseSensitiveFileNames ( ) )
1206
1152
} ;
1207
1153
diagnostics . removeKey ( proj ) ;
1208
1154
projectStatus . setValue ( proj , status ) ;
@@ -1275,7 +1221,7 @@ namespace ts {
1275
1221
// Update timestamps for dts
1276
1222
const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker ( config , minimumDate , Diagnostics . Updating_unchanged_output_timestamps_of_project_0 , emittedOutputs ) ;
1277
1223
1278
- const status : UpToDateStatus = {
1224
+ const status : Status . UpToDate = {
1279
1225
type : UpToDateStatusType . UpToDate ,
1280
1226
newestDeclarationFileContentChangedTime,
1281
1227
oldestOutputFileName : outputFiles [ 0 ] . name
@@ -1292,11 +1238,16 @@ namespace ts {
1292
1238
return reportStatus ( Diagnostics . A_non_dry_build_would_update_timestamps_for_output_of_project_0 , proj . options . configFilePath ! ) ;
1293
1239
}
1294
1240
const priorNewestUpdateTime = updateOutputTimestampsWorker ( proj , minimumDate , Diagnostics . Updating_output_timestamps_of_project_0 ) ;
1295
- projectStatus . setValue ( proj . options . configFilePath as ResolvedConfigFilePath , { type : UpToDateStatusType . UpToDate , newestDeclarationFileContentChangedTime : priorNewestUpdateTime } as UpToDateStatus ) ;
1241
+ const status : Status . UpToDate = {
1242
+ type : UpToDateStatusType . UpToDate ,
1243
+ newestDeclarationFileContentChangedTime : priorNewestUpdateTime ,
1244
+ oldestOutputFileName : getFirstProjectOutput ( proj , ! host . useCaseSensitiveFileNames ( ) )
1245
+ } ;
1246
+ projectStatus . setValue ( proj . options . configFilePath as ResolvedConfigFilePath , status ) ;
1296
1247
}
1297
1248
1298
1249
function updateOutputTimestampsWorker ( proj : ParsedCommandLine , priorNewestUpdateTime : Date , verboseMessage : DiagnosticMessage , skipOutputs ?: FileMap < true > ) {
1299
- const outputs = getAllProjectOutputs ( proj ) ;
1250
+ const outputs = getAllProjectOutputs ( proj , ! host . useCaseSensitiveFileNames ( ) ) ;
1300
1251
if ( ! skipOutputs || outputs . length !== skipOutputs . getSize ( ) ) {
1301
1252
if ( options . verbose ) {
1302
1253
reportStatus ( verboseMessage , proj . options . configFilePath ! ) ;
@@ -1332,7 +1283,7 @@ namespace ts {
1332
1283
reportParseConfigFileDiagnostic ( proj ) ;
1333
1284
continue ;
1334
1285
}
1335
- const outputs = getAllProjectOutputs ( parsed ) ;
1286
+ const outputs = getAllProjectOutputs ( parsed , ! host . useCaseSensitiveFileNames ( ) ) ;
1336
1287
for ( const output of outputs ) {
1337
1288
if ( host . fileExists ( output ) ) {
1338
1289
filesToDelete . push ( output ) ;
@@ -1494,35 +1445,6 @@ namespace ts {
1494
1445
return combinePaths ( project , "tsconfig.json" ) as ResolvedConfigFileName ;
1495
1446
}
1496
1447
1497
- export function getAllProjectOutputs ( project : ParsedCommandLine ) : ReadonlyArray < string > {
1498
- if ( project . options . outFile || project . options . out ) {
1499
- return getOutFileOutputs ( project ) ;
1500
- }
1501
- else {
1502
- const outputs : string [ ] = [ ] ;
1503
- for ( const inputFile of project . fileNames ) {
1504
- outputs . push ( ...getOutputFileNames ( inputFile , project ) ) ;
1505
- }
1506
- const buildInfoPath = getOutputPathForBuildInfo ( project . options ) ;
1507
- if ( buildInfoPath ) outputs . push ( buildInfoPath ) ;
1508
- return outputs ;
1509
- }
1510
- }
1511
-
1512
- function getFirstProjectOutput ( project : ParsedCommandLine ) : string {
1513
- if ( project . options . outFile || project . options . out ) {
1514
- return first ( getOutFileOutputs ( project ) ) ;
1515
- }
1516
-
1517
- for ( const inputFile of project . fileNames ) {
1518
- const outputs = getOutputFileNames ( inputFile , project ) ;
1519
- if ( outputs . length ) {
1520
- return first ( outputs ) ;
1521
- }
1522
- }
1523
- return Debug . fail ( `project ${ project . options . configFilePath } expected to have at least one output` ) ;
1524
- }
1525
-
1526
1448
export function formatUpToDateStatus < T > ( configFileName : string , status : UpToDateStatus , relName : ( fileName : string ) => string , formatMessage : ( message : DiagnosticMessage , ...args : string [ ] ) => T ) {
1527
1449
switch ( status . type ) {
1528
1450
case UpToDateStatusType . OutOfDateWithSelf :
0 commit comments