@@ -22,7 +22,6 @@ import {
22
22
createCompilerHostFromProgramHost ,
23
23
createDiagnosticCollection ,
24
24
createDiagnosticReporter ,
25
- createGetCanonicalFileName ,
26
25
createModuleResolutionCache ,
27
26
createModuleResolutionLoader ,
28
27
CreateProgram ,
@@ -54,7 +53,6 @@ import {
54
53
formatColorAndReset ,
55
54
getAllProjectOutputs ,
56
55
getBuildInfoFileVersionMap ,
57
- GetCanonicalFileName ,
58
56
getConfigFileParsingDiagnostics ,
59
57
getDirectoryPath ,
60
58
getEntries ,
@@ -370,8 +368,6 @@ interface BuildInfoCacheEntry {
370
368
interface SolutionBuilderState < T extends BuilderProgram = BuilderProgram > extends WatchFactory < WatchType , ResolvedConfigFileName > {
371
369
readonly host : SolutionBuilderHost < T > ;
372
370
readonly hostWithWatch : SolutionBuilderWithWatchHost < T > ;
373
- readonly currentDirectory : string ;
374
- readonly getCanonicalFileName : GetCanonicalFileName ;
375
371
readonly parseConfigFileHost : ParseConfigFileHost ;
376
372
readonly write : ( ( s : string ) => void ) | undefined ;
377
373
@@ -426,8 +422,6 @@ interface SolutionBuilderState<T extends BuilderProgram = BuilderProgram> extend
426
422
function createSolutionBuilderState < T extends BuilderProgram > ( watch : boolean , hostOrHostWithWatch : SolutionBuilderHost < T > | SolutionBuilderWithWatchHost < T > , rootNames : readonly string [ ] , options : BuildOptions , baseWatchOptions : WatchOptions | undefined ) : SolutionBuilderState < T > {
427
423
const host = hostOrHostWithWatch as SolutionBuilderHost < T > ;
428
424
const hostWithWatch = hostOrHostWithWatch as SolutionBuilderWithWatchHost < T > ;
429
- const currentDirectory = host . getCurrentDirectory ( ) ;
430
- const getCanonicalFileName = createGetCanonicalFileName ( host . useCaseSensitiveFileNames ( ) ) ;
431
425
432
426
// State of the solution
433
427
const baseCompilerOptions = getCompilerOptionsOfBuildOptions ( options ) ;
@@ -441,7 +435,7 @@ function createSolutionBuilderState<T extends BuilderProgram>(watch: boolean, ho
441
435
compilerHost . getModuleResolutionCache = maybeBind ( host , host . getModuleResolutionCache ) ;
442
436
let moduleResolutionCache : ModuleResolutionCache | undefined , typeReferenceDirectiveResolutionCache : TypeReferenceDirectiveResolutionCache | undefined ;
443
437
if ( ! compilerHost . resolveModuleNameLiterals && ! compilerHost . resolveModuleNames ) {
444
- moduleResolutionCache = createModuleResolutionCache ( currentDirectory , getCanonicalFileName ) ;
438
+ moduleResolutionCache = createModuleResolutionCache ( compilerHost . getCurrentDirectory ( ) , compilerHost . getCanonicalFileName ) ;
445
439
compilerHost . resolveModuleNameLiterals = ( moduleNames , containingFile , redirectedReference , options , containingSourceFile ) =>
446
440
loadWithModeAwareCache (
447
441
moduleNames ,
@@ -456,7 +450,7 @@ function createSolutionBuilderState<T extends BuilderProgram>(watch: boolean, ho
456
450
compilerHost . getModuleResolutionCache = ( ) => moduleResolutionCache ;
457
451
}
458
452
if ( ! compilerHost . resolveTypeReferenceDirectiveReferences && ! compilerHost . resolveTypeReferenceDirectives ) {
459
- typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache ( currentDirectory , getCanonicalFileName , /*options*/ undefined , moduleResolutionCache ?. getPackageJsonInfoCache ( ) ) ;
453
+ typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache ( compilerHost . getCurrentDirectory ( ) , compilerHost . getCanonicalFileName , /*options*/ undefined , moduleResolutionCache ?. getPackageJsonInfoCache ( ) ) ;
460
454
compilerHost . resolveTypeReferenceDirectiveReferences = ( typeDirectiveNames , containingFile , redirectedReference , options , containingSourceFile ) =>
461
455
loadWithModeAwareCache (
462
456
typeDirectiveNames ,
@@ -476,8 +470,6 @@ function createSolutionBuilderState<T extends BuilderProgram>(watch: boolean, ho
476
470
const state : SolutionBuilderState < T > = {
477
471
host,
478
472
hostWithWatch,
479
- currentDirectory,
480
- getCanonicalFileName,
481
473
parseConfigFileHost : parseConfigHostFromCompilerHostLike ( host ) ,
482
474
write : maybeBind ( host , host . trace ) ,
483
475
@@ -534,7 +526,7 @@ function createSolutionBuilderState<T extends BuilderProgram>(watch: boolean, ho
534
526
}
535
527
536
528
function toPath ( state : SolutionBuilderState , fileName : string ) {
537
- return ts . toPath ( fileName , state . currentDirectory , state . getCanonicalFileName ) ;
529
+ return ts . toPath ( fileName , state . compilerHost . getCurrentDirectory ( ) , state . compilerHost . getCanonicalFileName ) ;
538
530
}
539
531
540
532
function toResolvedConfigFilePath ( state : SolutionBuilderState , fileName : ResolvedConfigFileName ) : ResolvedConfigFilePath {
@@ -583,7 +575,7 @@ function parseConfigFile(state: SolutionBuilderState, configFileName: ResolvedCo
583
575
}
584
576
585
577
function resolveProjectName ( state : SolutionBuilderState , name : string ) : ResolvedConfigFileName {
586
- return resolveConfigFileProjectName ( resolvePath ( state . currentDirectory , name ) ) ;
578
+ return resolveConfigFileProjectName ( resolvePath ( state . compilerHost . getCurrentDirectory ( ) , name ) ) ;
587
579
}
588
580
589
581
function createBuildOrder ( state : SolutionBuilderState , roots : readonly ResolvedConfigFileName [ ] ) : AnyBuildOrder {
@@ -887,7 +879,7 @@ function createUpdateOutputFileStampsProject(
887
879
projectPath,
888
880
buildOrder,
889
881
getCompilerOptions : ( ) => config . options ,
890
- getCurrentDirectory : ( ) => state . currentDirectory ,
882
+ getCurrentDirectory : ( ) => state . compilerHost . getCurrentDirectory ( ) ,
891
883
updateOutputFileStatmps : ( ) => {
892
884
updateOutputTimestamps ( state , config , projectPath ) ;
893
885
updateOutputFileStampsPending = false ;
@@ -935,7 +927,7 @@ function createBuildOrUpdateInvalidedProject<T extends BuilderProgram>(
935
927
projectPath,
936
928
buildOrder,
937
929
getCompilerOptions : ( ) => config . options ,
938
- getCurrentDirectory : ( ) => state . currentDirectory ,
930
+ getCurrentDirectory : ( ) => state . compilerHost . getCurrentDirectory ( ) ,
939
931
getBuilderProgram : ( ) => withProgramOrUndefined ( identity ) ,
940
932
getProgram : ( ) =>
941
933
withProgramOrUndefined (
@@ -1000,7 +992,7 @@ function createBuildOrUpdateInvalidedProject<T extends BuilderProgram>(
1000
992
projectPath,
1001
993
buildOrder,
1002
994
getCompilerOptions : ( ) => config . options ,
1003
- getCurrentDirectory : ( ) => state . currentDirectory ,
995
+ getCurrentDirectory : ( ) => state . compilerHost . getCurrentDirectory ( ) ,
1004
996
emit : ( writeFile : WriteFileCallback | undefined , customTransformers : CustomTransformers | undefined ) => {
1005
997
if ( step !== BuildStep . EmitBundle ) return invalidatedProjectOfBundle ;
1006
998
return emitBundle ( writeFile , customTransformers ) ;
@@ -2334,7 +2326,7 @@ function watchWildCardDirectories(state: SolutionBuilderState, resolved: Resolve
2334
2326
fileOrDirectory,
2335
2327
fileOrDirectoryPath : toPath ( state , fileOrDirectory ) ,
2336
2328
configFileName : resolved ,
2337
- currentDirectory : state . currentDirectory ,
2329
+ currentDirectory : state . compilerHost . getCurrentDirectory ( ) ,
2338
2330
options : parsed . options ,
2339
2331
program : state . builderPrograms . get ( resolvedPath ) || getCachedParsedConfigFile ( state , resolvedPath ) ?. fileNames ,
2340
2332
useCaseSensitiveFileNames : state . parseConfigFileHost . useCaseSensitiveFileNames ,
@@ -2454,7 +2446,7 @@ function createSolutionBuilderWorker<T extends BuilderProgram>(watch: boolean, h
2454
2446
}
2455
2447
2456
2448
function relName ( state : SolutionBuilderState , path : string ) : string {
2457
- return convertToRelativePath ( path , state . currentDirectory , f => state . getCanonicalFileName ( f ) ) ;
2449
+ return convertToRelativePath ( path , state . compilerHost . getCurrentDirectory ( ) , state . compilerHost . getCanonicalFileName ) ;
2458
2450
}
2459
2451
2460
2452
function reportStatus ( state : SolutionBuilderState , message : DiagnosticMessage , ...args : string [ ] ) {
0 commit comments