fix(compiler): don’t emit metadata for generated files

This commit is contained in:
Tobias Bosch 2016-05-02 17:50:09 -07:00 committed by Alex Eagle
parent de978229b2
commit 43e0fa513b
1 changed files with 6 additions and 0 deletions

View File

@ -60,6 +60,8 @@ export class TsickleHost extends DelegatingHost {
} }
} }
const IGNORED_FILES = /\.ngfactory\.js$|\.css\.js$|\.css\.shim\.js$/;
export class MetadataWriterHost extends DelegatingHost { export class MetadataWriterHost extends DelegatingHost {
private reflectorHost: NodeReflectorHost; private reflectorHost: NodeReflectorHost;
constructor(delegate: ts.CompilerHost, program: ts.Program, options: ts.CompilerOptions, constructor(delegate: ts.CompilerHost, program: ts.Program, options: ts.CompilerOptions,
@ -80,6 +82,10 @@ export class MetadataWriterHost extends DelegatingHost {
return; return;
} }
if (IGNORED_FILES.test(fileName)) {
return;
}
if (!sourceFiles) { if (!sourceFiles) {
throw new Error('Metadata emit requires the sourceFiles are passed to WriteFileCallback. ' + throw new Error('Metadata emit requires the sourceFiles are passed to WriteFileCallback. ' +
'Update to TypeScript ^1.9.0-dev'); 'Update to TypeScript ^1.9.0-dev');