Skip to content

Commit

Permalink
refactor(@angular-devkit/build-angular): use for loop instead of `f…
Browse files Browse the repository at this point in the history
…ilter` and `forEach`

Reduce iterations by using a `for loop`.

(cherry picked from commit 14b1be2)
  • Loading branch information
alan-agius4 committed Jan 22, 2024
1 parent aca1cfc commit 18879eb
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,12 @@ export class BundlerContext {
if (this.incremental) {
// When incremental always add any files from the load result cache
if (this.#loadCache) {
this.#loadCache.watchFiles
.filter((file) => !isInternalAngularFile(file))
// watch files are fully resolved paths
.forEach((file) => this.watchFiles.add(file));
for (const file of this.#loadCache.watchFiles) {
if (!isInternalAngularFile(file)) {
// watch files are fully resolved paths
this.watchFiles.add(file);
}
}
}
}
}
Expand All @@ -247,10 +249,12 @@ export class BundlerContext {
// currently enabled with watch mode where watch files are needed.
if (this.incremental) {
// Add input files except virtual angular files which do not exist on disk
Object.keys(result.metafile.inputs)
.filter((input) => !isInternalAngularFile(input))
// input file paths are always relative to the workspace root
.forEach((input) => this.watchFiles.add(join(this.workspaceRoot, input)));
for (const input of Object.keys(result.metafile.inputs)) {
if (!isInternalAngularFile(input)) {
// input file paths are always relative to the workspace root
this.watchFiles.add(join(this.workspaceRoot, input));
}
}
}

// Return if the build encountered any errors
Expand Down

0 comments on commit 18879eb

Please sign in to comment.