refactor(compiler): add createAotCompiler factory

Also adds 2 more methods to the `AotCompilerHost`:
- `loadResource`
- `resolveFileToImport`
This commit is contained in:
Tobias Bosch
2016-11-15 11:13:20 -08:00
committed by Chuck Jazdzewski
parent 484119e59f
commit 2235048432
13 changed files with 174 additions and 100 deletions

View File

@ -28,6 +28,14 @@ export class MockContext implements NgHostContext {
return undefined;
}
readResource(fileName: string): Promise<string> {
const result = this.readFile(fileName);
if (result == null) {
return Promise.reject(new Error(`Resource not found: ${fileName}`));
}
return Promise.resolve(result);
}
writeFile(fileName: string, data: string): void {
const parts = fileName.split('/');
const name = parts.pop();