mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
polish mangler output to align with build (#169388)
This commit is contained in:
parent
9e8d78012d
commit
983b06e9bf
File diff suppressed because one or more lines are too long
|
@ -124,7 +124,7 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod
|
|||
// mangle: TypeScript to TypeScript
|
||||
let mangleStream = es.through();
|
||||
if (build) {
|
||||
let ts2tsMangler = new Mangler(compile.projectPath);
|
||||
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);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -367,7 +367,7 @@ export class Mangler {
|
|||
ts.forEachChild(file, visit);
|
||||
}
|
||||
}
|
||||
this.log(`done COLLECTING ${this.allClassDataByKey.size} classes`);
|
||||
this.log(`Done collecting classes: ${this.allClassDataByKey.size}`);
|
||||
|
||||
|
||||
// STEP: connect sub and super-types
|
||||
|
@ -423,7 +423,7 @@ export class Mangler {
|
|||
for (const data of this.allClassDataByKey.values()) {
|
||||
ClassData.fillInReplacement(data);
|
||||
}
|
||||
this.log(`done creating REPLACEMENTS`);
|
||||
this.log(`Done creating replacements`);
|
||||
|
||||
// STEP: prepare rename edits
|
||||
type Edit = { newText: string; offset: number; length: number };
|
||||
|
@ -471,7 +471,7 @@ export class Mangler {
|
|||
}
|
||||
}
|
||||
|
||||
this.log(`done preparing EDITS for ${editsByFile.size} files`);
|
||||
this.log(`Done preparing edits: ${editsByFile.size} files`);
|
||||
|
||||
// STEP: apply all rename edits (per file)
|
||||
const result = new Map<string, MangleOutput>();
|
||||
|
@ -507,7 +507,7 @@ export class Mangler {
|
|||
if (lastEdit && lastEdit.offset === edit.offset) {
|
||||
//
|
||||
if (lastEdit.length !== edit.length || lastEdit.newText !== edit.newText) {
|
||||
this.log('OVERLAPPING edit', item.fileName, edit.offset, edits);
|
||||
this.log('ERROR: Overlapping edit', item.fileName, edit.offset, edits);
|
||||
throw new Error('OVERLAPPING edit');
|
||||
} else {
|
||||
continue;
|
||||
|
@ -557,7 +557,7 @@ export class Mangler {
|
|||
result.set(item.fileName, { out: newFullText, sourceMap: generator?.toString() });
|
||||
}
|
||||
|
||||
this.log(`DONE saved ${savedBytes / 1000}kb`);
|
||||
this.log(`Done: ${savedBytes / 1000}kb saved`);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue