@@ -6629,7 +6629,7 @@ namespace ts {
6629
6629
includeFilePattern : getRegularExpressionForWildcard ( includes , absolutePath , "files" ) ,
6630
6630
includeDirectoryPattern : getRegularExpressionForWildcard ( includes , absolutePath , "directories" ) ,
6631
6631
excludePattern : getRegularExpressionForWildcard ( excludes , absolutePath , "exclude" ) ,
6632
- basePaths : getBasePaths ( absolutePath , includes , useCaseSensitiveFileNames )
6632
+ basePaths : getBasePaths ( path , includes , useCaseSensitiveFileNames )
6633
6633
} ;
6634
6634
}
6635
6635
@@ -6653,22 +6653,22 @@ namespace ts {
6653
6653
const results : string [ ] [ ] = includeFileRegexes ? includeFileRegexes . map ( ( ) => [ ] ) : [ [ ] ] ;
6654
6654
const visited = new Map < string , true > ( ) ;
6655
6655
const toCanonical = createGetCanonicalFileName ( useCaseSensitiveFileNames ) ;
6656
- for ( const absoluteBasePath of patterns . basePaths ) {
6657
- if ( directoryExists ( absoluteBasePath ) ) {
6658
- visitDirectory ( absoluteBasePath , depth ) ;
6656
+ for ( const basePath of patterns . basePaths ) {
6657
+ if ( directoryExists ( basePath ) ) {
6658
+ visitDirectory ( basePath , combinePaths ( currentDirectory , basePath ) , depth ) ;
6659
6659
}
6660
6660
}
6661
6661
6662
6662
return flatten ( results ) ;
6663
6663
6664
- function visitDirectory ( absolutePath : string , depth : number | undefined ) {
6664
+ function visitDirectory ( path : string , absolutePath : string , depth : number | undefined ) {
6665
6665
const canonicalPath = toCanonical ( realpath ( absolutePath ) ) ;
6666
6666
if ( visited . has ( canonicalPath ) ) return ;
6667
6667
visited . set ( canonicalPath , true ) ;
6668
- const { files, directories } = getFileSystemEntries ( absolutePath ) ;
6668
+ const { files, directories } = getFileSystemEntries ( path ) ;
6669
6669
6670
6670
for ( const current of sort < string > ( files , compareStringsCaseSensitive ) ) {
6671
- const name = combinePaths ( absolutePath , current ) ;
6671
+ const name = combinePaths ( path , current ) ;
6672
6672
const absoluteName = combinePaths ( absolutePath , current ) ;
6673
6673
if ( extensions && ! fileExtensionIsOneOf ( name , extensions ) ) continue ;
6674
6674
if ( excludeRegex && excludeRegex . test ( absoluteName ) ) continue ;
@@ -6691,32 +6691,32 @@ namespace ts {
6691
6691
}
6692
6692
6693
6693
for ( const current of sort < string > ( directories , compareStringsCaseSensitive ) ) {
6694
+ const name = combinePaths ( path , current ) ;
6694
6695
const absoluteName = combinePaths ( absolutePath , current ) ;
6695
6696
if ( ( ! includeDirectoryRegex || includeDirectoryRegex . test ( absoluteName ) ) &&
6696
6697
( ! excludeRegex || ! excludeRegex . test ( absoluteName ) ) ) {
6697
- visitDirectory ( absoluteName , depth ) ;
6698
+ visitDirectory ( name , absoluteName , depth ) ;
6698
6699
}
6699
6700
}
6700
6701
}
6701
6702
}
6702
6703
6703
6704
/**
6704
6705
* Computes the unique non-wildcard base paths amongst the provided include patterns.
6705
- * @returns Absolute directory paths
6706
6706
*/
6707
- function getBasePaths ( absoluteTsconfigPath : string , includes : readonly string [ ] | undefined , useCaseSensitiveFileNames : boolean ) : string [ ] {
6707
+ function getBasePaths ( path : string , includes : readonly string [ ] | undefined , useCaseSensitiveFileNames : boolean ) : string [ ] {
6708
6708
// Storage for our results in the form of literal paths (e.g. the paths as written by the user).
6709
- const basePaths : string [ ] = [ absoluteTsconfigPath ] ;
6709
+ const basePaths : string [ ] = [ path ] ;
6710
6710
6711
6711
if ( includes ) {
6712
6712
// Storage for literal base paths amongst the include patterns.
6713
6713
const includeBasePaths : string [ ] = [ ] ;
6714
6714
for ( const include of includes ) {
6715
6715
// We also need to check the relative paths by converting them to absolute and normalizing
6716
6716
// in case they escape the base path (e.g "..\somedirectory")
6717
- const absoluteIncludePath : string = isRootedDiskPath ( include ) ? include : normalizePath ( combinePaths ( absoluteTsconfigPath , include ) ) ;
6717
+ const absolute : string = isRootedDiskPath ( include ) ? include : normalizePath ( combinePaths ( path , include ) ) ;
6718
6718
// Append the literal and canonical candidate base paths.
6719
- includeBasePaths . push ( getIncludeBasePath ( absoluteIncludePath ) ) ;
6719
+ includeBasePaths . push ( getIncludeBasePath ( absolute ) ) ;
6720
6720
}
6721
6721
6722
6722
// Sort the offsets array using either the literal or canonical path representations.
@@ -6725,7 +6725,7 @@ namespace ts {
6725
6725
// Iterate over each include base path and include unique base paths that are not a
6726
6726
// subpath of an existing base path
6727
6727
for ( const includeBasePath of includeBasePaths ) {
6728
- if ( every ( basePaths , basePath => ! containsPath ( basePath , includeBasePath , absoluteTsconfigPath , ! useCaseSensitiveFileNames ) ) ) {
6728
+ if ( every ( basePaths , basePath => ! containsPath ( basePath , includeBasePath , path , ! useCaseSensitiveFileNames ) ) ) {
6729
6729
basePaths . push ( includeBasePath ) ;
6730
6730
}
6731
6731
}
0 commit comments