fix(compiler): make .ngsummary.json files idempotent (#21448)

Fixes: #21432

PR Close #21448
This commit is contained in:
Chuck Jazdzewski
2018-01-10 09:55:03 -08:00
committed by Alex Eagle
parent 6be9c0466c
commit e64b1e99c2
5 changed files with 18 additions and 1 deletions

View File

@ -39,6 +39,12 @@ export interface StaticSymbolResolverHost {
* `path/to/containingFile.ts` containing `import {...} from 'module-name'`.
*/
moduleNameToFileName(moduleName: string, containingFile?: string): string|null;
/**
* Get a file suitable for display to the user that should be relative to the project directory
* or the current directory.
*/
getOutputName(filePath: string): string;
}
const SUPPORTED_SCHEMA_VERSION = 4;
@ -382,7 +388,8 @@ export class StaticSymbolResolver {
// .ts or .d.ts, append `.ts'. Also, if it is in `node_modules`, trim the `node_module`
// location as it is not important to finding the file.
_originalFileMemo =
topLevelPath.replace(/((\.ts)|(\.d\.ts)|)$/, '.ts').replace(/^.*node_modules[/\\]/, '');
this.host.getOutputName(topLevelPath.replace(/((\.ts)|(\.d\.ts)|)$/, '.ts')
.replace(/^.*node_modules[/\\]/, ''));
}
return _originalFileMemo;
};