build: produce metadata bundles for @angular modules (#14509)
Closes #14509
This commit is contained in:

committed by
Igor Minar

parent
3b896709a9
commit
724ca373e7
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {AotCompilerHost} from '@angular/compiler';
|
||||
import {MetadataCollector} from '@angular/tsc-wrapped';
|
||||
import {MetadataBundlerHost, MetadataCollector, ModuleMetadata} from '@angular/tsc-wrapped';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as ts from 'typescript';
|
||||
@ -216,12 +216,15 @@ export class MockCompilerHost implements ts.CompilerHost {
|
||||
}
|
||||
const effectiveName = this.getEffectiveName(fileName);
|
||||
if (effectiveName == fileName) {
|
||||
return open(fileName, this.data) != null;
|
||||
let result = open(fileName, this.data) != null;
|
||||
return result;
|
||||
} else {
|
||||
if (fileName.match(rxjs)) {
|
||||
return fs.existsSync(effectiveName);
|
||||
let result = fs.existsSync(effectiveName);
|
||||
return result;
|
||||
}
|
||||
return this.angular.has(effectiveName);
|
||||
let result = this.angular.has(effectiveName);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,6 +392,17 @@ export class MockAotCompilerHost implements AotCompilerHost {
|
||||
}
|
||||
}
|
||||
|
||||
export class MockMetadataBundlerHost implements MetadataBundlerHost {
|
||||
private collector = new MetadataCollector();
|
||||
|
||||
constructor(private host: ts.CompilerHost) {}
|
||||
|
||||
getMetadataFor(moduleName: string): ModuleMetadata {
|
||||
const source = this.host.getSourceFile(moduleName + '.ts', ts.ScriptTarget.Latest);
|
||||
return this.collector.getMetadata(source);
|
||||
}
|
||||
}
|
||||
|
||||
function find(fileName: string, data: MockData): MockData|undefined {
|
||||
let names = fileName.split('/');
|
||||
if (names.length && !names[0].length) names.shift();
|
||||
|
Reference in New Issue
Block a user