fix(compiler): emit preamble in generated files.
This commit is contained in:

committed by
Matias Niemelä

parent
5ef6e6366f
commit
b1055a5edb
@ -11,6 +11,13 @@ import * as ts from 'typescript';
|
||||
|
||||
import {TypeScriptNodeEmitter} from './node_emitter';
|
||||
|
||||
const PREAMBLE = `/**
|
||||
* @fileoverview This file is generated by the Angular template compiler.
|
||||
* Do not edit.
|
||||
* @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride}
|
||||
* tslint:disable
|
||||
*/`;
|
||||
|
||||
export function getAngularEmitterTransformFactory(generatedFiles: GeneratedFile[]): () =>
|
||||
(sourceFile: ts.SourceFile) => ts.SourceFile {
|
||||
return function() {
|
||||
@ -20,10 +27,10 @@ export function getAngularEmitterTransformFactory(generatedFiles: GeneratedFile[
|
||||
return function(sourceFile: ts.SourceFile): ts.SourceFile {
|
||||
const g = map.get(sourceFile.fileName);
|
||||
if (g && g.stmts) {
|
||||
const [newSourceFile] = emitter.updateSourceFile(sourceFile, g.stmts);
|
||||
const [newSourceFile] = emitter.updateSourceFile(sourceFile, g.stmts, PREAMBLE);
|
||||
return newSourceFile;
|
||||
}
|
||||
return sourceFile;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user