( project: string, existingOptions?: api.CompilerOptions, host: ConfigurationHost = getFileSystem(), extendedConfigCache = new Map<string, ts.ExtendedConfigCacheEntry>(), )
| 73 | } |
| 74 | |
| 75 | export 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; |
no test coverage detected