Skip to content

Commit e3ad0d6

Browse files
committed
refactor(@angular/build): address PR #33715 review comments
- Replace unnecessary Promise.allSettled with direct dispose calls in execute-build.ts - Rename SourceFileCache dispose() to override clear() and call super.clear() to clear base Map alongside internal cache structures
1 parent c0cf4a5 commit e3ad0d6

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

packages/angular/build/src/builders/application/execute-build.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ export async function executeBuild(
167167
// without blocking the critical path of post-bundle optimization steps.
168168
// Any in-flight disposal is awaited in the builder action's finally block.
169169
if (!options.watch) {
170-
void Promise.allSettled([angularCompilationContext?.dispose(), executionResult.dispose()]);
170+
void angularCompilationContext?.dispose();
171+
void executionResult.dispose();
171172
}
172173

173174
// Return if the bundling has errors

packages/angular/build/src/tools/esbuild/angular/source-file-cache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export class SourceFileCache extends Map<string, ts.SourceFile> {
3030
* rebuilds and can include the emitted contents of every TypeScript file in the
3131
* program. The cache is repopulated if a build is performed after this is called.
3232
*/
33-
dispose(): void {
34-
this.clear();
33+
override clear(): void {
34+
super.clear();
3535
this.modifiedFiles.clear();
3636
this.typeScriptFileCache.clear();
3737
this.loadResultCache.clear();

packages/angular/build/src/tools/esbuild/bundler-execution-result.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class ExecutionResult {
208208
this.componentStyleBundler.dispose(),
209209
]);
210210
} finally {
211-
this.codeBundleCache?.dispose();
211+
this.codeBundleCache?.clear();
212212
}
213213
}
214214
}

0 commit comments

Comments
 (0)