feat(compiler): make .ngsummary.json
files portable
This also allows to customize the filePaths in `.ngsummary.json` file via the new methods `toSummaryFileName` and `fromSummaryFileName` on the `CompilerHost`.
This commit is contained in:
@ -105,7 +105,8 @@ const summaryResolver = new AotSummaryResolver(
|
||||
{
|
||||
loadSummary(filePath: string) { return null; },
|
||||
isSourceFile(sourceFilePath: string) { return true; },
|
||||
getOutputFileName(sourceFilePath: string) { return sourceFilePath; }
|
||||
toSummaryFileName(sourceFilePath: string) { return sourceFilePath; },
|
||||
fromSummaryFileName(filePath: string): string{return filePath;},
|
||||
},
|
||||
staticSymbolCache);
|
||||
|
||||
|
@ -67,8 +67,13 @@ describe('NgCompilerHost', () => {
|
||||
]
|
||||
}
|
||||
});
|
||||
// both files are in the rootDirs
|
||||
expect(ngHostWithMultipleRoots.fileNameToModuleName('/tmp/src/b/b.ts', '/tmp/src/a/a.ts'))
|
||||
.toBe('./b');
|
||||
|
||||
// one file is not in the rootDirs
|
||||
expect(ngHostWithMultipleRoots.fileNameToModuleName('/tmp/src/c/c.ts', '/tmp/src/a/a.ts'))
|
||||
.toBe('../c/c');
|
||||
});
|
||||
|
||||
it('should error if accessing a source file from a package', () => {
|
||||
|
Reference in New Issue
Block a user