Skip to content

Commit 7fc11f7

Browse files
committed
fixup! perf(@angular/build): replace watchpack with @parcel/watcher and chokidar
1 parent afa5b29 commit 7fc11f7

1 file changed

Lines changed: 3 additions & 20 deletions

File tree

  • packages/angular/build/src/tools/esbuild

packages/angular/build/src/tools/esbuild/watcher.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ class WatcherQueue {
119119
private readonly nextQueue: ((value?: ChangedFiles) => void)[] = [];
120120
private currentChangedFiles: ChangedFiles | undefined;
121121
private isClosed = false;
122-
private timeoutId: NodeJS.Timeout | undefined;
123122

124123
addChange(type: 'added' | 'modified' | 'removed', file: string): void {
125124
if (this.isClosed) {
@@ -128,7 +127,7 @@ class WatcherQueue {
128127

129128
const changedFiles = (this.currentChangedFiles ??= new ChangedFiles());
130129
changedFiles[type].add(file);
131-
this.scheduleFlush();
130+
this.flush();
132131
}
133132

134133
addChanges(
@@ -142,17 +141,7 @@ class WatcherQueue {
142141
for (const { type, file } of changes) {
143142
changedFiles[type].add(file);
144143
}
145-
this.scheduleFlush();
146-
}
147-
148-
private scheduleFlush(): void {
149-
if (this.timeoutId) {
150-
clearTimeout(this.timeoutId);
151-
}
152-
this.timeoutId = setTimeout(() => {
153-
this.timeoutId = undefined;
154-
this.flush();
155-
}, 250);
144+
this.flush();
156145
}
157146

158147
private flush(): void {
@@ -174,8 +163,7 @@ class WatcherQueue {
174163
if (
175164
this.currentChangedFiles &&
176165
this.currentChangedFiles.all.length > 0 &&
177-
this.nextQueue.length === 0 &&
178-
!this.timeoutId
166+
this.nextQueue.length === 0
179167
) {
180168
const result = { value: this.currentChangedFiles };
181169
this.currentChangedFiles = undefined;
@@ -199,11 +187,6 @@ class WatcherQueue {
199187
return;
200188
}
201189

202-
if (this.timeoutId) {
203-
clearTimeout(this.timeoutId);
204-
this.timeoutId = undefined;
205-
}
206-
207190
this.isClosed = true;
208191
this.currentChangedFiles = undefined;
209192

0 commit comments

Comments
 (0)