refactor: clean-up deduplication workaround from migrations (#61421) (#61612)

Since the duplication root-cause was solved by the previous commit, we
can revert/drop the logic that was added back then to overcome this
problem with Tsurge.

PR Close #61421

PR Close #61612
This commit is contained in:
Paul Gschwendtner 2025-05-16 07:05:59 +00:00 committed by Andrew Scott
parent 1a811c9f9d
commit c101a3aa7d
2 changed files with 8 additions and 23 deletions

View file

@ -110,12 +110,9 @@ export class SelfClosingTagsMigration extends TsurgeFunnelMigration<
unitA: SelfClosingTagsCompilationUnitData,
unitB: SelfClosingTagsCompilationUnitData,
): Promise<Serializable<SelfClosingTagsCompilationUnitData>> {
const uniqueReplacements = removeDuplicateReplacements([
...unitA.tagReplacements,
...unitB.tagReplacements,
]);
return confirmAsSerializable({tagReplacements: uniqueReplacements});
return confirmAsSerializable({
tagReplacements: [...unitA.tagReplacements, ...unitB.tagReplacements],
});
}
override async globalMeta(
@ -165,20 +162,3 @@ function prepareTextReplacement(
}),
);
}
function removeDuplicateReplacements(
replacements: SelfClosingTagsMigrationData[],
): SelfClosingTagsMigrationData[] {
const uniqueFiles = new Set<string>();
const result: SelfClosingTagsMigrationData[] = [];
for (const replacement of replacements) {
const fileId = replacement.file.id;
if (!uniqueFiles.has(fileId)) {
uniqueFiles.add(fileId);
result.push(replacement);
}
}
return result;
}

View file

@ -94,6 +94,11 @@ export class UnusedImportsMigration extends TsurgeFunnelMigration<
diag.length !== undefined &&
diag.code === ngErrorCode(ErrorCode.UNUSED_STANDALONE_IMPORTS)
) {
// Skip files that aren't owned by this compilation unit.
if (!info.sourceFiles.includes(diag.file)) {
return;
}
if (!nodePositions.has(diag.file)) {
nodePositions.set(diag.file, new Set());
}