more mangler output polishing (#169400)

related to #169388
This commit is contained in:
João Moreno 2022-12-16 17:18:17 +01:00 committed by GitHub
parent cb1113ac32
commit d97f2c1aeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,8 @@
const fs = require('fs');
const webpack = require('webpack');
const fancyLog = require('fancy-log');
const ansiColors = require('ansi-colors');
const { Mangler } = require('../build/lib/mangleTypeScript');
/**
@ -21,8 +23,9 @@ const mangleMap = new Map();
function getMangledFileContents(projectPath) {
let entry = mangleMap.get(projectPath);
if (!entry) {
console.log(`Mangling ${projectPath}`);
const ts2tsMangler = new Mangler(projectPath, console.log);
const log = (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data);
log(`Mangling ${projectPath}`);
const ts2tsMangler = new Mangler(projectPath, log);
entry = ts2tsMangler.computeNewFileContents();
mangleMap.set(projectPath, entry);
}