feat(compiler-cli): automatically lower lambda expressions in metadata
This commit is contained in:

committed by
Alex Rickabaugh

parent
67dff7bd5d
commit
b6c4af6495
@ -25,8 +25,9 @@ export interface CompilerHostContext extends ts.ModuleResolutionHost {
|
||||
assumeFileExists(fileName: string): void;
|
||||
}
|
||||
|
||||
export interface MetadataProvider { getMetadata(source: ts.SourceFile): ModuleMetadata|undefined; }
|
||||
|
||||
export class CompilerHost implements AotCompilerHost {
|
||||
protected metadataCollector = new MetadataCollector();
|
||||
private isGenDirChildOfRootDir: boolean;
|
||||
protected basePath: string;
|
||||
private genDir: string;
|
||||
@ -39,7 +40,8 @@ export class CompilerHost implements AotCompilerHost {
|
||||
|
||||
constructor(
|
||||
protected program: ts.Program, protected options: AngularCompilerOptions,
|
||||
protected context: CompilerHostContext, collectorOptions?: CollectorOptions) {
|
||||
protected context: CompilerHostContext, collectorOptions?: CollectorOptions,
|
||||
protected metadataProvider: MetadataProvider = new MetadataCollector()) {
|
||||
// normalize the path so that it never ends with '/'.
|
||||
this.basePath = path.normalize(path.join(this.options.basePath !, '.')).replace(/\\/g, '/');
|
||||
this.genDir = path.normalize(path.join(this.options.genDir !, '.')).replace(/\\/g, '/');
|
||||
@ -206,7 +208,7 @@ export class CompilerHost implements AotCompilerHost {
|
||||
}
|
||||
|
||||
const sf = this.getSourceFile(filePath);
|
||||
const metadata = this.metadataCollector.getMetadata(sf);
|
||||
const metadata = this.metadataProvider.getMetadata(sf);
|
||||
return metadata ? [metadata] : [];
|
||||
}
|
||||
|
||||
@ -245,7 +247,7 @@ export class CompilerHost implements AotCompilerHost {
|
||||
v3Metadata.metadata[prop] = v1Metadata.metadata[prop];
|
||||
}
|
||||
|
||||
const exports = this.metadataCollector.getMetadata(this.getSourceFile(dtsFilePath));
|
||||
const exports = this.metadataProvider.getMetadata(this.getSourceFile(dtsFilePath));
|
||||
if (exports) {
|
||||
for (let prop in exports.metadata) {
|
||||
if (!v3Metadata.metadata[prop]) {
|
||||
|
Reference in New Issue
Block a user