Skip to content

Commit

Permalink
refactor(@angular/build): cleanup persistent JS transformer cache on …
Browse files Browse the repository at this point in the history
…plugin dispose

Close and allow the persistent JS transformer cache to cleanup open
lock files when the Angular compiler plugin is disposed. While this is
not strictly necessary, it does help prevent extra cache lock files from
being retained after build completion.

(cherry picked from commit 7a539ab)
  • Loading branch information
clydin authored and dgp1130 committed May 16, 2024
1 parent 4111153 commit 2265f63
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export function createCompilerPlugin(
const preserveSymlinks = build.initialOptions.preserveSymlinks;

// Initialize a worker pool for JavaScript transformations
let cacheStore;
let cacheStore: LmbdCacheStore | undefined;
if (pluginOptions.sourceFileCache?.persistentCachePath) {
cacheStore = new LmbdCacheStore(
pluginOptions.sourceFileCache.persistentCachePath + '/angular-compiler.db',
path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'),
);
}
const javascriptTransformer = new JavaScriptTransformer(
Expand Down Expand Up @@ -446,6 +446,7 @@ export function createCompilerPlugin(
sharedTSCompilationState?.dispose();
void stylesheetBundler.dispose();
void compilation.close?.();
void cacheStore?.close();
});

/**
Expand Down

0 comments on commit 2265f63

Please sign in to comment.