MCPcopy Index your code
hub / github.com/angular/angular / getRootDirs

Function getRootDirs

packages/compiler-cli/src/ngtsc/util/src/typescript.ts:129–149  ·  view source on GitHub ↗
(
  host: Pick<ts.CompilerHost, 'getCurrentDirectory' | 'getCanonicalFileName'>,
  options: ts.CompilerOptions,
)

Source from the content-addressed store, hash-verified

127}
128
129export 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
151export function nodeDebugInfo(node: ts.Node): string {
152 const sf = getSourceFile(node);

Callers 6

constructorMethod · 0.90
wrapMethod · 0.90
setupFunction · 0.90
typescript_spec.tsFile · 0.90

Calls 6

getFileSystemFunction · 0.90
mapMethod · 0.80
resolveMethod · 0.65
getCurrentDirectoryMethod · 0.45
pushMethod · 0.45
getCanonicalFileNameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…