mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Optimize source mapping into external source map sources (#40055)
This commit is contained in:
parent
6a622a11c9
commit
1e84ffc703
@ -13,6 +13,7 @@ namespace ts {
|
||||
const rawSources: string[] = [];
|
||||
const sources: string[] = [];
|
||||
const sourceToSourceIndexMap = new Map<string, number>();
|
||||
const fileNameToSourceIndexMap = new Map<string, number>();
|
||||
let sourcesContent: (string | null)[] | undefined;
|
||||
|
||||
const names: string[] = [];
|
||||
@ -51,6 +52,10 @@ namespace ts {
|
||||
|
||||
function addSource(fileName: string) {
|
||||
enter();
|
||||
const sourceIndexByFileName = fileNameToSourceIndexMap.get(fileName);
|
||||
if (sourceIndexByFileName !== undefined) {
|
||||
return sourceIndexByFileName;
|
||||
}
|
||||
const source = getRelativePathToDirectoryOrUrl(sourcesDirectoryPath,
|
||||
fileName,
|
||||
host.getCurrentDirectory(),
|
||||
@ -64,6 +69,7 @@ namespace ts {
|
||||
rawSources.push(fileName);
|
||||
sourceToSourceIndexMap.set(source, sourceIndex);
|
||||
}
|
||||
fileNameToSourceIndexMap.set(fileName, sourceIndex);
|
||||
exit();
|
||||
return sourceIndex;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user