( host: Pick<ts.CompilerHost, 'getCurrentDirectory' | 'getCanonicalFileName'>, options: ts.CompilerOptions, )
| 127 | } |
| 128 | |
| 129 | export function getRootDirs( |
| 130 | host: Pick<ts.CompilerHost, 'getCurrentDirectory' | 'getCanonicalFileName'>, |
| 131 | options: ts.CompilerOptions, |
| 132 | ): AbsoluteFsPath[] { |
| 133 | const rootDirs: string[] = []; |
| 134 | const cwd = host.getCurrentDirectory(); |
| 135 | const fs = getFileSystem(); |
| 136 | if (options.rootDirs !== undefined) { |
| 137 | rootDirs.push(...options.rootDirs); |
| 138 | } else if (options.rootDir !== undefined) { |
| 139 | rootDirs.push(options.rootDir); |
| 140 | } else { |
| 141 | rootDirs.push(cwd); |
| 142 | } |
| 143 | |
| 144 | // In Windows the above might not always return posix separated paths |
| 145 | // See: |
| 146 | // https://github.com/Microsoft/TypeScript/blob/3f7357d37f66c842d70d835bc925ec2a873ecfec/src/compiler/sys.ts#L650 |
| 147 | // Also compiler options might be set via an API which doesn't normalize paths |
| 148 | return rootDirs.map((rootDir) => fs.resolve(cwd, host.getCanonicalFileName(rootDir))); |
| 149 | } |
| 150 | |
| 151 | export function nodeDebugInfo(node: ts.Node): string { |
| 152 | const sf = getSourceFile(node); |
no test coverage detected
searching dependent graphs…