refactor(ngcc): rename Configuration.getConfig() (#36838)

Strictly this method only returns config for packages. So this commit
renames it to `getPackageConfig()`, which frees us up to add other
"getXxxxConfig()` methods later.

PR Close #36838
This commit is contained in:
Pete Bacon Darwin
2020-04-28 14:39:27 +01:00
committed by Alex Rickabaugh
parent 9b85b533ff
commit 98931bf9b5
5 changed files with 37 additions and 28 deletions

View File

@ -225,7 +225,7 @@ export class DependencyResolver {
private filterIgnorableDeepImports(entryPoint: EntryPoint, deepImports: Set<AbsoluteFsPath>):
AbsoluteFsPath[] {
const version = (entryPoint.packageJson.version || null) as string | null;
const packageConfig = this.config.getConfig(entryPoint.package, version);
const packageConfig = this.config.getPackageConfig(entryPoint.package, version);
const matchers = packageConfig.ignorableDeepImportMatchers || [];
return Array.from(deepImports)
.filter(deepImport => !matchers.some(matcher => matcher.test(deepImport)));

View File

@ -177,7 +177,7 @@ export class NgccConfiguration {
* @param version The version of the package whose config we want, or `null` if the package's
* package.json did not exist or was invalid.
*/
getConfig(packagePath: AbsoluteFsPath, version: string|null): VersionedPackageConfig {
getPackageConfig(packagePath: AbsoluteFsPath, version: string|null): VersionedPackageConfig {
const cacheKey = packagePath + (version !== null ? `@${version}` : '');
if (this.cache.has(cacheKey)) {
return this.cache.get(cacheKey)!;

View File

@ -121,7 +121,7 @@ export function getEntryPointInfo(
const packageJsonPath = resolve(entryPointPath, 'package.json');
const packageVersion = getPackageVersion(fs, packageJsonPath);
const entryPointConfig =
config.getConfig(packagePath, packageVersion).entryPoints[entryPointPath];
config.getPackageConfig(packagePath, packageVersion).entryPoints[entryPointPath];
const hasConfig = entryPointConfig !== undefined;
if (!hasConfig && !fs.exists(packageJsonPath)) {