Skip to content

Commit c101a3a

Browse files
devversionatscott
authored andcommitted
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
1 parent 1a811c9 commit c101a3a

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

packages/core/schematics/migrations/self-closing-tags-migration/self-closing-tags-migration.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,9 @@ export class SelfClosingTagsMigration extends TsurgeFunnelMigration<
110110
unitA: SelfClosingTagsCompilationUnitData,
111111
unitB: SelfClosingTagsCompilationUnitData,
112112
): Promise<Serializable<SelfClosingTagsCompilationUnitData>> {
113-
const uniqueReplacements = removeDuplicateReplacements([
114-
...unitA.tagReplacements,
115-
...unitB.tagReplacements,
116-
]);
117-
118-
return confirmAsSerializable({tagReplacements: uniqueReplacements});
113+
return confirmAsSerializable({
114+
tagReplacements: [...unitA.tagReplacements, ...unitB.tagReplacements],
115+
});
119116
}
120117

121118
override async globalMeta(
@@ -165,20 +162,3 @@ function prepareTextReplacement(
165162
}),
166163
);
167164
}
168-
169-
function removeDuplicateReplacements(
170-
replacements: SelfClosingTagsMigrationData[],
171-
): SelfClosingTagsMigrationData[] {
172-
const uniqueFiles = new Set<string>();
173-
const result: SelfClosingTagsMigrationData[] = [];
174-
175-
for (const replacement of replacements) {
176-
const fileId = replacement.file.id;
177-
if (!uniqueFiles.has(fileId)) {
178-
uniqueFiles.add(fileId);
179-
result.push(replacement);
180-
}
181-
}
182-
183-
return result;
184-
}

packages/core/schematics/ng-generate/cleanup-unused-imports/unused_imports_migration.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ export class UnusedImportsMigration extends TsurgeFunnelMigration<
9494
diag.length !== undefined &&
9595
diag.code === ngErrorCode(ErrorCode.UNUSED_STANDALONE_IMPORTS)
9696
) {
97+
// Skip files that aren't owned by this compilation unit.
98+
if (!info.sourceFiles.includes(diag.file)) {
99+
return;
100+
}
101+
97102
if (!nodePositions.has(diag.file)) {
98103
nodePositions.set(diag.file, new Set());
99104
}

0 commit comments

Comments
 (0)