Fix extension private prop mangling when compiling all projects (#167464)

#167269
This commit is contained in:
Matt Bierner
2022-11-28 16:32:18 -08:00
committed by GitHub
parent cf01f3bb99
commit 725330a7cd
2 changed files with 22 additions and 13 deletions
+13 -4
View File
@@ -7,17 +7,26 @@
const webpack = require('webpack');
const { Mangler } = require('../build/lib/mangleTypeScript');
let map;
/**
* Map of project paths to mangled file contents
*
* @type {Map<string, Map<string, string>>}
*/
const mangleMap = new Map();
/**
* @param {string} projectPath
*/
function getMangledFileContents(projectPath) {
if (!map) {
let entry = mangleMap.get(projectPath);
if (!entry) {
console.log(`Mangling ${projectPath}`);
const ts2tsMangler = new Mangler(projectPath, console.log);
map = ts2tsMangler.computeNewFileContents();
entry = ts2tsMangler.computeNewFileContents();
mangleMap.set(projectPath, entry);
}
return map;
return entry;
}
/**