fix(compiler-cli): flat module index metadata should be transformed (#23129)

Currently, the flat module index metadata is produced directly from
the source metadata. The compiler, however, applies transformations
on the Typescript sources during transpilation, and also equivalent
transformations on the metadata itself. This transformed metadata
doesn't end up in the flat module index.

This changes the compiler to generate the flat module index metadata
from its transformed version instead of directly from source.

PR Close #23129
This commit is contained in:
Alex Rickabaugh
2018-04-02 13:05:08 -07:00
parent aaefd51a88
commit f99cb5c995
4 changed files with 66 additions and 19 deletions

View File

@ -149,7 +149,7 @@ class AngularCompilerProgram implements Program {
if (options.flatModuleOutFile) {
const {host: bundleHost, indexName, errors} =
createBundleIndexHost(options, this.rootNames, host);
createBundleIndexHost(options, this.rootNames, host, () => this.metadataCache);
if (errors) {
this._optionsDiagnostics.push(...errors.map(e => ({
category: e.category,
@ -338,7 +338,6 @@ class AngularCompilerProgram implements Program {
writeFile: writeTsFile, emitOnlyDtsFiles,
customTransformers: tsCustomTransformers
});
return emitResult;
}
@ -518,6 +517,7 @@ class AngularCompilerProgram implements Program {
`- ${genJsonFiles.length + metadataJsonCount} generated json files`,
].join('\n'))]);
}
return emitResult;
}