mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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:
parent
1a811c9f9d
commit
c101a3aa7d
2 changed files with 8 additions and 23 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue