MCPcopy Create free account
hub / github.com/angular/angular / getExtendedConfigPath

Function getExtendedConfigPath

packages/compiler-cli/src/perform_compile.ts:272–300  ·  view source on GitHub ↗
(
  configFile: string,
  extendsValue: string,
  host: ConfigurationHost,
  fs: FileSystem,
  parseConfigHost: ts.ParseConfigHost,
)

Source from the content-addressed store, hash-verified

270}
271
272function getExtendedConfigPath(
273 configFile: string,
274 extendsValue: string,
275 host: ConfigurationHost,
276 fs: FileSystem,
277 parseConfigHost: ts.ParseConfigHost,
278): AbsoluteFsPath | null {
279 for (const candidate of [extendsValue, `${extendsValue}.json`]) {
280 if (candidate[0] === '.' || fs.isRooted(candidate)) {
281 const extendedConfigPath = host.resolve(host.dirname(configFile), candidate);
282 if (host.exists(extendedConfigPath)) {
283 return extendedConfigPath;
284 }
285 } else {
286 // Path isn't a rooted or relative path, resolve like a module.
287 const {resolvedModule} = ts.nodeModuleNameResolver(
288 candidate,
289 configFile,
290 {moduleResolution: ts.ModuleResolutionKind.NodeNext, resolveJsonModule: true},
291 parseConfigHost,
292 );
293 if (resolvedModule) {
294 return absoluteFrom(resolvedModule.resolvedFileName);
295 }
296 }
297 }
298
299 return null;
300}
301
302export interface PerformCompilationResult {
303 diagnostics: ReadonlyArray<ts.Diagnostic>;

Callers 1

Calls 5

absoluteFromFunction · 0.90
isRootedMethod · 0.65
resolveMethod · 0.65
dirnameMethod · 0.65
existsMethod · 0.65

Tested by

no test coverage detected