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

Function readConfiguration

packages/compiler-cli/src/perform_compile.ts:75–154  ·  view source on GitHub ↗
(
  project: string,
  existingOptions?: api.CompilerOptions,
  host: ConfigurationHost = getFileSystem(),
  extendedConfigCache = new Map<string, ts.ExtendedConfigCacheEntry>(),
)

Source from the content-addressed store, hash-verified

73}
74
75export function readConfiguration(
76 project: string,
77 existingOptions?: api.CompilerOptions,
78 host: ConfigurationHost = getFileSystem(),
79 extendedConfigCache = new Map<string, ts.ExtendedConfigCacheEntry>(),
80): ParsedConfiguration {
81 try {
82 const fs = getFileSystem();
83 const {projectFile, basePath} = calcProjectFileAndBasePath(project, host);
84 const parseConfigHost = createParseConfigHost(host, fs);
85 const {config, error} = readConfigFile(projectFile, host, fs, extendedConfigCache);
86
87 if (error) {
88 return {
89 project,
90 errors: [error],
91 rootNames: [],
92 options: {},
93 emitFlags: api.EmitFlags.Default,
94 };
95 }
96
97 const existingCompilerOptions: api.CompilerOptions = {
98 genDir: basePath,
99 basePath,
100 ...existingOptions,
101 };
102
103 const {
104 options,
105 errors,
106 fileNames: rootNames,
107 projectReferences,
108 } = ts.parseJsonConfigFileContent(
109 /* json */ config,
110 /* host */ parseConfigHost,
111 /* basePath */ basePath,
112 /* existingOptions */ existingCompilerOptions,
113 /* configFileName */ projectFile,
114 /* resolutionStack */ undefined,
115 /* extraFileExtensions */ undefined,
116 /* extendedConfigCache */ extendedConfigCache,
117 );
118
119 const angularCompilerOptions = readAngularCompilerOptions(
120 projectFile,
121 config,
122 host,
123 fs,
124 parseConfigHost,
125 extendedConfigCache,
126 );
127
128 Object.assign(options, angularCompilerOptions, existingOptions);
129
130 let emitFlags = api.EmitFlags.Default;
131 if (!options['skipMetadataEmit'] && !options['flatModuleOutFile']) {
132 emitFlags |= api.EmitFlags.Metadata;

Callers 6

parseTsconfigOrDieFunction · 0.90
parseNgCompilerOptionsFunction · 0.90
createPerformWatchHostFunction · 0.90
createProjectMethod · 0.90

Calls 5

getFileSystemFunction · 0.90
createParseConfigHostFunction · 0.85
readConfigFileFunction · 0.85

Tested by

no test coverage detected