refactor(ivy): ngcc - simplify Transformer.transform API (#29092)

By ensuring that EntryPointBundle contains everything that `Transformer.transform()`
needs to do its work, we can simplify its signature.

PR Close #29092
This commit is contained in:
Pete Bacon Darwin
2019-03-20 13:47:58 +00:00
committed by Matias Niemelä
parent 7b55ba58b9
commit c9f7cdaafd
7 changed files with 12 additions and 9 deletions

View File

@ -80,7 +80,7 @@ export function mainNgcc({baseSourcePath, targetEntryPointPath, propertiesToCons
compiledFormats.size === 0);
if (bundle) {
console.warn(`Compiling ${entryPoint.name} : ${property} as ${format}`);
transformer.transform(entryPoint, isCore, bundle);
transformer.transform(bundle);
compiledFormats.add(formatPath);
} else {
console.warn(

View File

@ -20,6 +20,7 @@ import {EntryPointFormat} from './entry_point';
*/
export interface EntryPointBundle {
format: EntryPointFormat;
isCore: boolean;
isFlatCore: boolean;
rootDirs: AbsoluteFsPath[];
src: BundleProgram;
@ -56,5 +57,5 @@ export function makeEntryPointBundle(
null;
const isFlatCore = isCore && src.r3SymbolsFile === null;
return {format, rootDirs, isFlatCore, src, dts};
return {format, rootDirs, isCore, isFlatCore, src, dts};
}

View File

@ -55,7 +55,8 @@ export class Transformer {
* Transform the source (and typings) files of a bundle.
* @param bundle the bundle to transform.
*/
transform(entryPoint: EntryPoint, isCore: boolean, bundle: EntryPointBundle): void {
transform(bundle: EntryPointBundle): void {
const isCore = bundle.isCore;
const reflectionHost = this.getHost(isCore, bundle);
// Parse and analyze the files.