use normalized path when checking for mangled new contents, (#171964)

* use normalized path when checking for mangled new contents,

https://github.com/microsoft/vscode/issues/170767

* add missing js file
This commit is contained in:
Johannes Rieken 2023-01-23 14:11:36 +01:00 committed by GitHub
parent f1b09237cd
commit 3db45fbd42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -127,7 +127,9 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod
let ts2tsMangler = new Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data));
const newContentsByFileName = ts2tsMangler.computeNewFileContents();
mangleStream = es.through(function write(data: File & { sourceMap?: RawSourceMap }) {
const newContents = newContentsByFileName.get(data.path);
type TypeScriptExt = typeof ts & { normalizePath(path: string): string };
const tsNormalPath = (<TypeScriptExt>ts).normalizePath(data.path);
const newContents = newContentsByFileName.get(tsNormalPath);
if (newContents !== undefined) {
data.contents = Buffer.from(newContents.out);
data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);