@@ -10,7 +10,7 @@ const TS = /\.tsx?$/i;
1010const D_TS = / \. d \. t s $ / i;
1111
1212import * as ts from 'typescript' ;
13- import { AbsoluteFsPath , absoluteFrom } from '../../file_system' ;
13+ import { AbsoluteFsPath , getFileSystem } from '../../file_system' ;
1414import { DeclarationNode } from '../../reflection' ;
1515
1616export function isDtsPath ( filePath : string ) : boolean {
@@ -96,19 +96,21 @@ export function getRootDirs(
9696 host : Pick < ts . CompilerHost , 'getCurrentDirectory' | 'getCanonicalFileName' > ,
9797 options : ts . CompilerOptions ) : AbsoluteFsPath [ ] {
9898 const rootDirs : string [ ] = [ ] ;
99+ const cwd = host . getCurrentDirectory ( ) ;
100+ const fs = getFileSystem ( ) ;
99101 if ( options . rootDirs !== undefined ) {
100102 rootDirs . push ( ...options . rootDirs ) ;
101103 } else if ( options . rootDir !== undefined ) {
102104 rootDirs . push ( options . rootDir ) ;
103105 } else {
104- rootDirs . push ( host . getCurrentDirectory ( ) ) ;
106+ rootDirs . push ( cwd ) ;
105107 }
106108
107109 // In Windows the above might not always return posix separated paths
108110 // See:
109111 // https://github.com/Microsoft/TypeScript/blob/3f7357d37f66c842d70d835bc925ec2a873ecfec/src/compiler/sys.ts#L650
110112 // Also compiler options might be set via an API which doesn't normalize paths
111- return rootDirs . map ( rootDir => absoluteFrom ( host . getCanonicalFileName ( rootDir ) ) ) ;
113+ return rootDirs . map ( rootDir => fs . resolve ( cwd , host . getCanonicalFileName ( rootDir ) ) ) ;
112114}
113115
114116export function nodeDebugInfo ( node : ts . Node ) : string {
0 commit comments