@teambit/watcher 1.0.840 → 1.0.842
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fsevents-error.js
CHANGED
|
@@ -119,6 +119,10 @@ Each running watcher process may consume multiple streams internally.`;
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
message += `\n
|
|
122
|
+
${_chalk().default.green('Recommended solution:')} Install Watchman to avoid FSEvents limits entirely.
|
|
123
|
+
Watchman is a file watching service that uses a single daemon for all watchers:
|
|
124
|
+
${_chalk().default.cyan('brew install watchman')}
|
|
125
|
+
|
|
122
126
|
${_chalk().default.yellow('Note:')} If you're using "bit start" or "bit run", you don't need "bit watch" separately.
|
|
123
127
|
With the VS Code Bit extension, you can use "Compile on Change" instead of running a watcher manually.
|
|
124
128
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_child_process","data","require","_util","_chalk","_interopRequireDefault","e","__esModule","default","execAsync","promisify","exec","detectRunningBitWatchers","process","platform","stdout","trim","processes","lines","split","line","trimmedLine","firstSpaceIdx","indexOf","pidStr","slice","command","test","pid","parseInt","isVSCodeServer","cwd","lsofOut","cwdMatch","match","push","formatFSEventsErrorMessage","runningWatchers","killableProcesses","filter","p","vscodeServers","message","length","chalk","yellow","proc","cwdInfo","vscodeNote","gray","cyan","map","join"],"sources":["fsevents-error.ts"],"sourcesContent":["import { exec } from 'child_process';\nimport { promisify } from 'util';\nimport chalk from 'chalk';\n\nconst execAsync = promisify(exec);\n\ntype BitWatcherProcess = {\n pid: number;\n command: string;\n cwd: string;\n isVSCodeServer: boolean; // bit server processes are managed by VS Code extension\n};\n\n/**\n * Detect running bit watcher processes on macOS.\n * Returns a list of processes running bit watch, bit start, bit run, or bit server commands.\n */\nasync function detectRunningBitWatchers(): Promise<BitWatcherProcess[]> {\n if (process.platform !== 'darwin') {\n return []; // FSEvents is macOS-specific\n }\n\n try {\n // Use ps -eo for more predictable output format (just pid and command)\n const { stdout } = await execAsync(\n `ps -eo pid,command | grep -E \"/bit (watch|start|run|server)\" | grep -v grep || true`\n );\n\n if (!stdout.trim()) {\n return [];\n }\n\n const processes: BitWatcherProcess[] = [];\n const lines = stdout.trim().split('\\n');\n\n for (const line of lines) {\n const trimmedLine = line.trim();\n const firstSpaceIdx = trimmedLine.indexOf(' ');\n if (firstSpaceIdx === -1) continue;\n\n const pidStr = trimmedLine.slice(0, firstSpaceIdx);\n const command = trimmedLine.slice(firstSpaceIdx + 1).trim();\n\n // Validate PID is purely numeric to prevent command injection\n if (!/^\\d+$/.test(pidStr)) continue;\n\n const pid = parseInt(pidStr, 10);\n if (pid === process.pid) continue; // Skip current process\n\n // server-forever is just a spawner process, it doesn't run a watcher itself\n if (/server-forever/.test(command)) continue;\n\n // bit server is started by VS Code extension - users should close VS Code windows instead of killing these\n const isVSCodeServer = /bit server(?:\\s|$)/.test(command);\n\n // Get the working directory of this process using lsof\n let cwd = 'unknown';\n try {\n const { stdout: lsofOut } = await execAsync(`lsof -p ${pid} 2>/dev/null | grep cwd | head -1 || true`);\n // lsof output format: \"node PID user cwd DIR ... /path/to/dir\"\n // The path is the last field and starts with /\n const cwdMatch = lsofOut.match(/\\s(\\/[^\\s]+)\\s*$/);\n if (cwdMatch) {\n cwd = cwdMatch[1];\n }\n } catch {\n // Ignore lsof errors\n }\n\n processes.push({ pid, command, cwd, isVSCodeServer });\n }\n\n return processes;\n } catch {\n return [];\n }\n}\n\n/**\n * Format a helpful error message when FSEvents stream limit is reached.\n * Lists running bit watchers and provides suggestions for freeing up streams.\n */\nexport async function formatFSEventsErrorMessage(): Promise<string> {\n const runningWatchers = await detectRunningBitWatchers();\n const killableProcesses = runningWatchers.filter((p) => !p.isVSCodeServer);\n const vscodeServers = runningWatchers.filter((p) => p.isVSCodeServer);\n\n let message = `Failed to start the watcher: Error starting FSEvents stream\nmacOS limits the total number of FSEvents watchers system-wide (undocumented limit, typically ~500).\nEach running watcher process may consume multiple streams internally.`;\n\n if (runningWatchers.length > 0) {\n message += `\\n\\n${chalk.yellow('Found the following Bit watcher processes:')}`;\n for (const proc of runningWatchers) {\n const cwdInfo = proc.cwd !== 'unknown' ? ` (${proc.cwd})` : '';\n const vscodeNote = proc.isVSCodeServer ? chalk.gray(' [VS Code extension]') : '';\n message += `\\n ${chalk.cyan(`PID ${proc.pid}`)}: ${proc.command}${cwdInfo}${vscodeNote}`;\n }\n\n message += `\\n\\n${chalk.yellow('To free up FSEvents streams, you can:')}`;\n if (killableProcesses.length > 0) {\n message += `\\n 1. Close unnecessary terminal tabs running bit watch/start/run`;\n message += `\\n 2. Kill specific processes: ${chalk.cyan(`kill ${killableProcesses.map((p) => p.pid).join(' ')}`)}`;\n }\n if (vscodeServers.length > 0) {\n message += `\\n ${killableProcesses.length > 0 ? '3' : '1'}. Close unused VS Code windows (${vscodeServers.length} VS Code Bit server${vscodeServers.length > 1 ? 's' : ''} running)`;\n }\n }\n\n message += `\\n\n${chalk.yellow('Note:')} If you're using \"bit start\" or \"bit run\", you don't need \"bit watch\" separately.\nWith the VS Code Bit extension, you can use \"Compile on Change\" instead of running a watcher manually.\n\nFor more details, see: https://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-register_with_server-error-f2d_register_rpc--null--21`;\n\n return message;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAI,uBAAAC,CA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gBAAK,CAACK,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE;MAChFP,OAAO,IAAI,OAAOE,gBAAK,CAACM,IAAI,CAAC,OAAOJ,IAAI,CAAClB,GAAG,EAAE,CAAC,KAAKkB,IAAI,CAACpB,OAAO,GAAGqB,OAAO,GAAGC,UAAU,EAAE;IAC3F;IAEAN,OAAO,IAAI,OAAOE,gBAAK,CAACC,MAAM,CAAC,uCAAuC,CAAC,EAAE;IACzE,IAAIP,iBAAiB,CAACK,MAAM,GAAG,CAAC,EAAE;MAChCD,OAAO,IAAI,oEAAoE;MAC/EA,OAAO,IAAI,mCAAmCE,gBAAK,CAACM,IAAI,CAAC,QAAQZ,iBAAiB,CAACa,GAAG,CAAEX,CAAC,IAAKA,CAAC,CAACZ,GAAG,CAAC,CAACwB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;IACrH;IACA,IAAIX,aAAa,CAACE,MAAM,GAAG,CAAC,EAAE;MAC5BD,OAAO,IAAI,OAAOJ,iBAAiB,CAACK,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,mCAAmCF,aAAa,CAACE,MAAM,sBAAsBF,aAAa,CAACE,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,WAAW;IACvL;EACF;EAEAD,OAAO,IAAI;AACb,EAAEE,gBAAK,CAACC,MAAM,CAAC,OAAO,CAAC;AACvB;AACA;AACA,yJAAyJ;EAEvJ,OAAOH,OAAO;AAChB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_child_process","data","require","_util","_chalk","_interopRequireDefault","e","__esModule","default","execAsync","promisify","exec","detectRunningBitWatchers","process","platform","stdout","trim","processes","lines","split","line","trimmedLine","firstSpaceIdx","indexOf","pidStr","slice","command","test","pid","parseInt","isVSCodeServer","cwd","lsofOut","cwdMatch","match","push","formatFSEventsErrorMessage","runningWatchers","killableProcesses","filter","p","vscodeServers","message","length","chalk","yellow","proc","cwdInfo","vscodeNote","gray","cyan","map","join","green"],"sources":["fsevents-error.ts"],"sourcesContent":["import { exec } from 'child_process';\nimport { promisify } from 'util';\nimport chalk from 'chalk';\n\nconst execAsync = promisify(exec);\n\ntype BitWatcherProcess = {\n pid: number;\n command: string;\n cwd: string;\n isVSCodeServer: boolean; // bit server processes are managed by VS Code extension\n};\n\n/**\n * Detect running bit watcher processes on macOS.\n * Returns a list of processes running bit watch, bit start, bit run, or bit server commands.\n */\nasync function detectRunningBitWatchers(): Promise<BitWatcherProcess[]> {\n if (process.platform !== 'darwin') {\n return []; // FSEvents is macOS-specific\n }\n\n try {\n // Use ps -eo for more predictable output format (just pid and command)\n const { stdout } = await execAsync(\n `ps -eo pid,command | grep -E \"/bit (watch|start|run|server)\" | grep -v grep || true`\n );\n\n if (!stdout.trim()) {\n return [];\n }\n\n const processes: BitWatcherProcess[] = [];\n const lines = stdout.trim().split('\\n');\n\n for (const line of lines) {\n const trimmedLine = line.trim();\n const firstSpaceIdx = trimmedLine.indexOf(' ');\n if (firstSpaceIdx === -1) continue;\n\n const pidStr = trimmedLine.slice(0, firstSpaceIdx);\n const command = trimmedLine.slice(firstSpaceIdx + 1).trim();\n\n // Validate PID is purely numeric to prevent command injection\n if (!/^\\d+$/.test(pidStr)) continue;\n\n const pid = parseInt(pidStr, 10);\n if (pid === process.pid) continue; // Skip current process\n\n // server-forever is just a spawner process, it doesn't run a watcher itself\n if (/server-forever/.test(command)) continue;\n\n // bit server is started by VS Code extension - users should close VS Code windows instead of killing these\n const isVSCodeServer = /bit server(?:\\s|$)/.test(command);\n\n // Get the working directory of this process using lsof\n let cwd = 'unknown';\n try {\n const { stdout: lsofOut } = await execAsync(`lsof -p ${pid} 2>/dev/null | grep cwd | head -1 || true`);\n // lsof output format: \"node PID user cwd DIR ... /path/to/dir\"\n // The path is the last field and starts with /\n const cwdMatch = lsofOut.match(/\\s(\\/[^\\s]+)\\s*$/);\n if (cwdMatch) {\n cwd = cwdMatch[1];\n }\n } catch {\n // Ignore lsof errors\n }\n\n processes.push({ pid, command, cwd, isVSCodeServer });\n }\n\n return processes;\n } catch {\n return [];\n }\n}\n\n/**\n * Format a helpful error message when FSEvents stream limit is reached.\n * Lists running bit watchers and provides suggestions for freeing up streams.\n */\nexport async function formatFSEventsErrorMessage(): Promise<string> {\n const runningWatchers = await detectRunningBitWatchers();\n const killableProcesses = runningWatchers.filter((p) => !p.isVSCodeServer);\n const vscodeServers = runningWatchers.filter((p) => p.isVSCodeServer);\n\n let message = `Failed to start the watcher: Error starting FSEvents stream\nmacOS limits the total number of FSEvents watchers system-wide (undocumented limit, typically ~500).\nEach running watcher process may consume multiple streams internally.`;\n\n if (runningWatchers.length > 0) {\n message += `\\n\\n${chalk.yellow('Found the following Bit watcher processes:')}`;\n for (const proc of runningWatchers) {\n const cwdInfo = proc.cwd !== 'unknown' ? ` (${proc.cwd})` : '';\n const vscodeNote = proc.isVSCodeServer ? chalk.gray(' [VS Code extension]') : '';\n message += `\\n ${chalk.cyan(`PID ${proc.pid}`)}: ${proc.command}${cwdInfo}${vscodeNote}`;\n }\n\n message += `\\n\\n${chalk.yellow('To free up FSEvents streams, you can:')}`;\n if (killableProcesses.length > 0) {\n message += `\\n 1. Close unnecessary terminal tabs running bit watch/start/run`;\n message += `\\n 2. Kill specific processes: ${chalk.cyan(`kill ${killableProcesses.map((p) => p.pid).join(' ')}`)}`;\n }\n if (vscodeServers.length > 0) {\n message += `\\n ${killableProcesses.length > 0 ? '3' : '1'}. Close unused VS Code windows (${vscodeServers.length} VS Code Bit server${vscodeServers.length > 1 ? 's' : ''} running)`;\n }\n }\n\n message += `\\n\n${chalk.green('Recommended solution:')} Install Watchman to avoid FSEvents limits entirely.\nWatchman is a file watching service that uses a single daemon for all watchers:\n ${chalk.cyan('brew install watchman')}\n\n${chalk.yellow('Note:')} If you're using \"bit start\" or \"bit run\", you don't need \"bit watch\" separately.\nWith the VS Code Bit extension, you can use \"Compile on Change\" instead of running a watcher manually.\n\nFor more details, see: https://facebook.github.io/watchman/docs/troubleshooting#f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G,CAAC,GAAG,GAAG,GAAG,EAAE,WAAW;IACvL;EACF;EAEAD,OAAO,IAAI;AACb,EAAEE,gBAAK,CAACS,KAAK,CAAC,uBAAuB,CAAC;AACtC;AACA,IAAIT,gBAAK,CAACM,IAAI,CAAC,uBAAuB,CAAC;AACvC;AACA,EAAEN,gBAAK,CAACC,MAAM,CAAC,OAAO,CAAC;AACvB;AACA;AACA,yJAAyJ;EAEvJ,OAAOH,OAAO;AAChB","ignoreList":[]}
|
package/dist/watcher.d.ts
CHANGED
|
@@ -62,9 +62,21 @@ export declare class Watcher {
|
|
|
62
62
|
private isDaemon;
|
|
63
63
|
private parcelSubscription;
|
|
64
64
|
private signalCleanupHandler;
|
|
65
|
+
private watchmanAvailable;
|
|
65
66
|
constructor(workspace: Workspace, pubsub: PubsubMain, watcherMain: WatcherMain, options: WatchOptions, msgs?: EventMessages | undefined);
|
|
66
67
|
get consumer(): Consumer;
|
|
67
68
|
private getParcelIgnorePatterns;
|
|
69
|
+
/**
|
|
70
|
+
* Get Parcel watcher options, preferring Watchman on macOS when available.
|
|
71
|
+
* On macOS, FSEvents is the default but has a system-wide limit of ~500 streams.
|
|
72
|
+
* Watchman is a single-daemon solution that avoids this limit.
|
|
73
|
+
*/
|
|
74
|
+
private getParcelWatcherOptions;
|
|
75
|
+
/**
|
|
76
|
+
* Check if Watchman is installed.
|
|
77
|
+
* Result is cached to avoid repeated executions.
|
|
78
|
+
*/
|
|
79
|
+
private isWatchmanAvailable;
|
|
68
80
|
watch(): Promise<void>;
|
|
69
81
|
private watchParcel;
|
|
70
82
|
/**
|
package/dist/watcher.js
CHANGED
|
@@ -95,6 +95,13 @@ function _watcher() {
|
|
|
95
95
|
};
|
|
96
96
|
return data;
|
|
97
97
|
}
|
|
98
|
+
function _child_process() {
|
|
99
|
+
const data = require("child_process");
|
|
100
|
+
_child_process = function () {
|
|
101
|
+
return data;
|
|
102
|
+
};
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
98
105
|
function _harmonyModules() {
|
|
99
106
|
const data = require("@teambit/harmony.modules.send-server-sent-events");
|
|
100
107
|
_harmonyModules = function () {
|
|
@@ -158,6 +165,8 @@ class Watcher {
|
|
|
158
165
|
_defineProperty(this, "parcelSubscription", null);
|
|
159
166
|
// Signal handlers for cleanup (to avoid accumulation)
|
|
160
167
|
_defineProperty(this, "signalCleanupHandler", null);
|
|
168
|
+
// Cached Watchman availability (checked once per process lifetime)
|
|
169
|
+
_defineProperty(this, "watchmanAvailable", null);
|
|
161
170
|
this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;
|
|
162
171
|
this.verbose = this.options.verbose || false;
|
|
163
172
|
this.logger = this.watcherMain.logger;
|
|
@@ -173,6 +182,50 @@ class Watcher {
|
|
|
173
182
|
getParcelIgnorePatterns() {
|
|
174
183
|
return ['**/node_modules/**', '**/package.json', `**/${this.workspace.scope.path}/cache/**`, `**/${this.workspace.scope.path}/tmp/**`, `**/${this.workspace.scope.path}/objects/**`];
|
|
175
184
|
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Get Parcel watcher options, preferring Watchman on macOS when available.
|
|
188
|
+
* On macOS, FSEvents is the default but has a system-wide limit of ~500 streams.
|
|
189
|
+
* Watchman is a single-daemon solution that avoids this limit.
|
|
190
|
+
*/
|
|
191
|
+
getParcelWatcherOptions() {
|
|
192
|
+
const options = {
|
|
193
|
+
ignore: this.getParcelIgnorePatterns()
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// On macOS, prefer Watchman if available to avoid FSEvents stream limit
|
|
197
|
+
if (process.platform === 'darwin') {
|
|
198
|
+
if (this.isWatchmanAvailable()) {
|
|
199
|
+
options.backend = 'watchman';
|
|
200
|
+
this.logger.debug('Using Watchman backend for file watching');
|
|
201
|
+
} else {
|
|
202
|
+
this.logger.debug('Using FSEvents backend for file watching (Watchman not available)');
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return options;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Check if Watchman is installed.
|
|
210
|
+
* Result is cached to avoid repeated executions.
|
|
211
|
+
*/
|
|
212
|
+
isWatchmanAvailable() {
|
|
213
|
+
if (this.watchmanAvailable !== null) {
|
|
214
|
+
return this.watchmanAvailable;
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
// Use spawnSync with shell: false (default) for security - prevents command injection
|
|
218
|
+
const result = (0, _child_process().spawnSync)('watchman', ['version'], {
|
|
219
|
+
stdio: 'ignore',
|
|
220
|
+
timeout: 5000
|
|
221
|
+
});
|
|
222
|
+
// Check for spawn errors (e.g., command not found) or non-zero exit status
|
|
223
|
+
this.watchmanAvailable = !result.error && result.status === 0;
|
|
224
|
+
} catch {
|
|
225
|
+
this.watchmanAvailable = false;
|
|
226
|
+
}
|
|
227
|
+
return this.watchmanAvailable;
|
|
228
|
+
}
|
|
176
229
|
async watch() {
|
|
177
230
|
await this.setRootDirs();
|
|
178
231
|
const componentIds = Object.values(this.rootDirs);
|
|
@@ -217,9 +270,7 @@ class Watcher {
|
|
|
217
270
|
|
|
218
271
|
// Original direct Parcel watcher logic (fallback)
|
|
219
272
|
try {
|
|
220
|
-
await _watcher().default.subscribe(this.workspace.path, this.onParcelWatch.bind(this),
|
|
221
|
-
ignore: this.getParcelIgnorePatterns()
|
|
222
|
-
});
|
|
273
|
+
await _watcher().default.subscribe(this.workspace.path, this.onParcelWatch.bind(this), this.getParcelWatcherOptions());
|
|
223
274
|
|
|
224
275
|
// Write initial snapshot for FSEvents buffer overflow recovery
|
|
225
276
|
await this.writeSnapshotIfNeeded();
|
|
@@ -245,9 +296,7 @@ class Watcher {
|
|
|
245
296
|
await this.parcelSubscription.unsubscribe();
|
|
246
297
|
this.parcelSubscription = null;
|
|
247
298
|
}
|
|
248
|
-
this.parcelSubscription = await _watcher().default.subscribe(this.workspace.path, this.onParcelWatchAsDaemon.bind(this),
|
|
249
|
-
ignore: this.getParcelIgnorePatterns()
|
|
250
|
-
});
|
|
299
|
+
this.parcelSubscription = await _watcher().default.subscribe(this.workspace.path, this.onParcelWatchAsDaemon.bind(this), this.getParcelWatcherOptions());
|
|
251
300
|
|
|
252
301
|
// Write initial snapshot for FSEvents buffer overflow recovery
|
|
253
302
|
await this.writeSnapshotIfNeeded();
|
|
@@ -856,9 +905,7 @@ class Watcher {
|
|
|
856
905
|
return; // Don't write snapshot while recovering
|
|
857
906
|
}
|
|
858
907
|
try {
|
|
859
|
-
await _watcher().default.writeSnapshot(this.workspace.path, this.snapshotPath,
|
|
860
|
-
ignore: this.getParcelIgnorePatterns()
|
|
861
|
-
});
|
|
908
|
+
await _watcher().default.writeSnapshot(this.workspace.path, this.snapshotPath, this.getParcelWatcherOptions());
|
|
862
909
|
this.logger.debug('Watcher snapshot written successfully');
|
|
863
910
|
} catch (err) {
|
|
864
911
|
this.logger.debug(`Failed to write watcher snapshot: ${err.message}`);
|
|
@@ -900,9 +947,7 @@ class Watcher {
|
|
|
900
947
|
}
|
|
901
948
|
|
|
902
949
|
// Get all events since last snapshot
|
|
903
|
-
const missedEvents = await _watcher().default.getEventsSince(this.workspace.path, this.snapshotPath,
|
|
904
|
-
ignore: this.getParcelIgnorePatterns()
|
|
905
|
-
});
|
|
950
|
+
const missedEvents = await _watcher().default.getEventsSince(this.workspace.path, this.snapshotPath, this.getParcelWatcherOptions());
|
|
906
951
|
|
|
907
952
|
// Write new snapshot immediately after reading events to prevent re-processing same events
|
|
908
953
|
await this.writeSnapshotIfNeeded();
|
package/dist/watcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_legacy","_legacy2","_legacy3","_pMapSeries","_chalk","_legacy4","_chokidar","_workspace","_watchQueue","_watcher","_harmonyModules","_watcherDaemon","_fseventsError","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DEBOUNCE_WAIT_MS","DROP_ERROR_DEBOUNCE_MS","Watcher","constructor","workspace","pubsub","watcherMain","options","msgs","WatchQueue","ipcEventsDir","ipcEvents","eventsDir","verbose","logger","workspacePathLinux","pathNormalizeToLinux","path","snapshotPath","join","scope","process","env","BIT_WATCHER_USE_CHOKIDAR","watcherType","consumer","getParcelIgnorePatterns","watch","setRootDirs","componentIds","values","rootDirs","triggerOnPreWatch","watchScopeInternalFiles","watchParcel","watchChokidar","onStart","isMacOS","platform","isSharedDisabled","BIT_WATCHER_NO_SHARED","useSharedWatcher","connection","getOrCreateWatcherConnection","isDaemon","daemon","watcherDaemon","debug","startParcelWatcherAsDaemon","client","watcherClient","startAsClient","onReady","clearStatusLine","err","message","ParcelWatcher","subscribe","onParcelWatch","bind","ignore","writeSnapshotIfNeeded","includes","errorMessage","formatFSEventsErrorMessage","Error","parcelSubscription","unsubscribe","onParcelWatchAsDaemon","setupDaemonShutdown","stop","allEvents","events","event","shouldIgnoreFromLocalScopeParcel","broadcastEvents","isDropError","broadcastError","onEvents","filteredEvents","startTime","Date","now","processEvents","onError","error","onDisconnect","handleDaemonDisconnection","setupClientShutdown","sleep","console","chalk","yellow","removeSignalHandlers","signalCleanupHandler","off","isShuttingDown","cleanup","catch","finally","exit","setTimeout","unref","on","disconnect","createChokidarWatcher","watcher","chokidarWatcher","Promise","resolve","reject","onAll","watched","getWatched","totalWatched","flat","bold","JSON","stringify","toString","filePath","getTime","files","results","debounced","irrelevant","failureMsg","handleChange","duration","onChange","endsWith","BIT_MAP","bitMapChangesInProgress","buildResults","watchQueue","add","handleBitmapChanges","onIdle","dirname","eventName","basename","content","fs","readFile","parsed","parse","sendEventsToClients","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","changedFilesPerComponent","triggerCompChanges","undefined","msg","ms","updatedComponentId","hasId","ids","listIds","find","id","isEqual","ignoreVersion","clearComponentCache","component","get","componentMap","state","_consumer","compFilesRelativeToWorkspace","getFilesRelativeToConsumer","compFiles","nonCompFiles","partition","relativeFile","getRelativePathLinux","Boolean","p","removedFiles","compact","all","map","pathExists","toStringWithoutVersion","bitMap","updateComponentPaths","f","getPathRelativeToConsumer","executeWatchOperationsOnComponent","trigger","triggerOnComponentChange","previewsRootDirs","previewsIds","getAllBitIds","_reloadConsumer","importObjectsIfNeeded","triggerOnBitmapChange","newDirs","difference","removedDirs","addResults","mapSeries","dir","executeWatchOperationsOnRemove","import","currentIds","hasVersionChanges","prevId","searchWithoutVersion","version","existsInScope","isComponentInScope","useCache","lane","getCurrentLaneObject","pub","WorkspaceAspect","createOnComponentRemovedEvent","triggerOnComponentRemove","isChange","isComponentWatchedExternally","idStr","createOnComponentChangeEvent","createOnComponentAddEvent","triggerOnComponentAdd","OnComponentRemovedEvent","hook","OnComponentChangeEvent","OnComponentAddEvent","watcherData","multipleWatchers","m","compilerId","rootDir","findRootDirByFilePathRecursively","parentDir","shouldIgnoreFromLocalScopeChokidar","pathToCheck","startsWith","scopePathLinux","sep","chokidarOpts","getChokidarWatchOptions","ignored","chokidar","type","isRecoveringFromSnapshot","dropErrorCount","warn","dropErrorDebounceTimer","clearTimeout","recoverFromSnapshot","writeErr","componentsFromBitMap","getAllComponents","getRootDir","writeSnapshot","dropsDetected","missedEvents","getEventsSince","green","criticalFiles","cyan","red","exports"],"sources":["watcher.ts"],"sourcesContent":["import type { PubsubMain } from '@teambit/pubsub';\nimport fs from 'fs-extra';\nimport { dirname, basename, join, sep } from 'path';\nimport { compact, difference, partition } from 'lodash';\nimport type { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BIT_MAP, WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport type { PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport { pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport mapSeries from 'p-map-series';\nimport chalk from 'chalk';\nimport type { ChildProcess } from 'child_process';\nimport { UNMERGED_FILENAME } from '@teambit/legacy.scope';\nimport type { FSWatcher } from 'chokidar';\nimport chokidar from 'chokidar';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\nimport type { Workspace, OnComponentEventResult } from '@teambit/workspace';\nimport {\n WorkspaceAspect,\n OnComponentChangeEvent,\n OnComponentAddEvent,\n OnComponentRemovedEvent,\n} from '@teambit/workspace';\nimport type { CheckTypes } from './check-types';\nimport type { WatcherMain } from './watcher.main.runtime';\nimport { WatchQueue } from './watch-queue';\nimport type { Logger } from '@teambit/logger';\nimport type { Event } from '@parcel/watcher';\nimport ParcelWatcher from '@parcel/watcher';\nimport { sendEventsToClients } from '@teambit/harmony.modules.send-server-sent-events';\nimport { WatcherDaemon, WatcherClient, getOrCreateWatcherConnection, type WatcherError } from './watcher-daemon';\nimport { formatFSEventsErrorMessage } from './fsevents-error';\n\nexport type WatcherProcessData = { watchProcess: ChildProcess; compilerId: ComponentID; componentIds: ComponentID[] };\n\nexport type EventMessages = {\n onAll: Function;\n onStart: Function;\n onReady: Function;\n onChange: OnFileEventFunc;\n onAdd: OnFileEventFunc;\n onUnlink: OnFileEventFunc;\n onError: Function;\n};\n\nexport type OnFileEventFunc = (\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) => void;\n\nexport type WatchOptions = {\n initiator?: any; // the real type is CompilationInitiator, however it creates a circular dependency with the compiler aspect.\n verbose?: boolean; // print watch events to the console. (also ts-server events if spawnTSServer is true)\n spawnTSServer?: boolean; // needed for check types and extract API/docs.\n checkTypes?: CheckTypes; // if enabled, the spawnTSServer becomes true.\n preCompile?: boolean; // whether compile all components before start watching\n compile?: boolean; // whether compile modified/added components during watch process\n import?: boolean; // whether import objects during watch when .bitmap got version changes\n preImport?: boolean; // whether import objects before starting the watch process in case .bitmap is more updated than local scope.\n generateTypes?: boolean; // whether generate d.ts files for typescript files during watch process (hurts performance)\n trigger?: ComponentID; // trigger onComponentChange for the specified component-id. helpful when this comp must be a bundle, and needs to be recompile on any dep change.\n};\n\nexport type RootDirs = { [dir: PathLinux]: ComponentID };\n\ntype WatcherType = 'chokidar' | 'parcel';\n\nconst DEBOUNCE_WAIT_MS = 100;\nconst DROP_ERROR_DEBOUNCE_MS = 300; // Wait 300ms after last drop error before recovering\ntype PathLinux = string; // ts fails when importing it from @teambit/legacy/dist/utils/path.\n\nexport class Watcher {\n private watcherType: WatcherType = 'parcel';\n private chokidarWatcher: FSWatcher;\n private changedFilesPerComponent: { [componentId: string]: string[] } = {};\n private watchQueue = new WatchQueue();\n private bitMapChangesInProgress = false;\n private ipcEventsDir: PathOsBasedAbsolute;\n private rootDirs: RootDirs = {};\n private verbose = false;\n private multipleWatchers: WatcherProcessData[] = [];\n private logger: Logger;\n private workspacePathLinux: string;\n // Snapshot-based recovery for FSEvents buffer overflow\n private snapshotPath: PathOsBasedAbsolute;\n private dropErrorDebounceTimer: NodeJS.Timeout | null = null;\n private dropErrorCount = 0;\n private isRecoveringFromSnapshot = false;\n // Shared watcher daemon/client\n private watcherDaemon: WatcherDaemon | null = null;\n private watcherClient: WatcherClient | null = null;\n private isDaemon = false;\n // Parcel watcher subscription for cleanup\n private parcelSubscription: { unsubscribe: () => Promise<void> } | null = null;\n // Signal handlers for cleanup (to avoid accumulation)\n private signalCleanupHandler: (() => void) | null = null;\n constructor(\n private workspace: Workspace,\n private pubsub: PubsubMain,\n private watcherMain: WatcherMain,\n private options: WatchOptions,\n private msgs?: EventMessages\n ) {\n this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;\n this.verbose = this.options.verbose || false;\n this.logger = this.watcherMain.logger;\n this.workspacePathLinux = pathNormalizeToLinux(this.workspace.path);\n this.snapshotPath = join(this.workspace.scope.path, 'watcher-snapshot.txt');\n\n if (process.env.BIT_WATCHER_USE_CHOKIDAR === 'true' || process.env.BIT_WATCHER_USE_CHOKIDAR === '1') {\n this.watcherType = 'chokidar';\n }\n }\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n private getParcelIgnorePatterns(): string[] {\n return [\n '**/node_modules/**',\n '**/package.json',\n `**/${this.workspace.scope.path}/cache/**`,\n `**/${this.workspace.scope.path}/tmp/**`,\n `**/${this.workspace.scope.path}/objects/**`,\n ];\n }\n\n async watch() {\n await this.setRootDirs();\n const componentIds = Object.values(this.rootDirs);\n await this.watcherMain.triggerOnPreWatch(componentIds, this.options);\n await this.watcherMain.watchScopeInternalFiles();\n this.watcherType === 'parcel' ? await this.watchParcel() : await this.watchChokidar();\n }\n\n private async watchParcel() {\n this.msgs?.onStart(this.workspace);\n\n // Use shared watcher daemon pattern to avoid FSEvents limit on macOS\n // FSEvents has a system-wide limit on concurrent watchers, which causes\n // \"Error starting FSEvents stream\" when multiple bit commands run watchers.\n // This is only an issue on macOS - other platforms don't have this limitation.\n const isMacOS = process.platform === 'darwin';\n const isSharedDisabled = process.env.BIT_WATCHER_NO_SHARED === 'true' || process.env.BIT_WATCHER_NO_SHARED === '1';\n const useSharedWatcher = isMacOS && !isSharedDisabled;\n\n if (useSharedWatcher) {\n try {\n const connection = await getOrCreateWatcherConnection(this.workspace.scope.path, this.logger);\n\n if (connection.isDaemon && connection.daemon) {\n // We're the daemon - run the actual Parcel watcher\n this.isDaemon = true;\n this.watcherDaemon = connection.daemon;\n this.logger.debug('Started as watcher daemon');\n await this.startParcelWatcherAsDaemon();\n } else if (connection.client) {\n // We're a client - receive events from the daemon\n this.isDaemon = false;\n this.watcherClient = connection.client;\n this.logger.debug('Connected to existing watcher daemon');\n await this.startAsClient();\n }\n\n this.msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n this.logger.clearStatusLine();\n return;\n } catch (err: any) {\n // If shared watcher setup fails, fall back to direct Parcel watcher\n this.logger.debug(`Shared watcher setup failed, falling back to direct watcher: ${err.message}`);\n }\n }\n\n // Original direct Parcel watcher logic (fallback)\n try {\n await ParcelWatcher.subscribe(this.workspace.path, this.onParcelWatch.bind(this), {\n ignore: this.getParcelIgnorePatterns(),\n });\n\n // Write initial snapshot for FSEvents buffer overflow recovery\n await this.writeSnapshotIfNeeded();\n this.logger.debug('Initial watcher snapshot created');\n } catch (err: any) {\n if (err.message.includes('Error starting FSEvents stream')) {\n const errorMessage = await formatFSEventsErrorMessage();\n throw new Error(errorMessage);\n }\n throw err;\n }\n this.msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n this.logger.clearStatusLine();\n }\n\n /**\n * Start Parcel watcher as the daemon - broadcast events to all clients\n */\n private async startParcelWatcherAsDaemon(): Promise<void> {\n try {\n // Clean up existing subscription if any (e.g., when transitioning from client to daemon)\n if (this.parcelSubscription) {\n await this.parcelSubscription.unsubscribe();\n this.parcelSubscription = null;\n }\n\n this.parcelSubscription = await ParcelWatcher.subscribe(\n this.workspace.path,\n this.onParcelWatchAsDaemon.bind(this),\n {\n ignore: this.getParcelIgnorePatterns(),\n }\n );\n\n // Write initial snapshot for FSEvents buffer overflow recovery\n await this.writeSnapshotIfNeeded();\n this.logger.debug('Initial watcher snapshot created (daemon mode)');\n\n // Setup graceful shutdown\n this.setupDaemonShutdown();\n } catch (err: any) {\n // Clean up daemon on failure\n await this.watcherDaemon?.stop();\n if (err.message.includes('Error starting FSEvents stream')) {\n const errorMessage = await formatFSEventsErrorMessage();\n throw new Error(errorMessage);\n }\n throw err;\n }\n }\n\n /**\n * Handle Parcel watcher events when running as daemon\n */\n private async onParcelWatchAsDaemon(err: Error | null, allEvents: Event[]) {\n const events = allEvents.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n\n // Broadcast events to all clients\n if (events.length > 0) {\n this.watcherDaemon?.broadcastEvents(events);\n }\n\n // Also broadcast errors\n if (err) {\n const isDropError = err.message.includes('Events were dropped');\n this.watcherDaemon?.broadcastError(err.message, isDropError);\n }\n\n // Process events locally (the daemon is also a watcher)\n await this.onParcelWatch(err, allEvents);\n }\n\n /**\n * Start as a client receiving events from the daemon\n */\n private async startAsClient(): Promise<void> {\n if (!this.watcherClient) {\n throw new Error('Watcher client not initialized');\n }\n\n // Handle events from the daemon\n this.watcherClient.onEvents(async (events) => {\n const filteredEvents = events.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n if (filteredEvents.length > 0) {\n const startTime = Date.now();\n await this.processEvents(filteredEvents, startTime);\n }\n });\n\n // Handle errors from the daemon\n this.watcherClient.onError(async (error: WatcherError) => {\n if (error.isDropError) {\n // The daemon will handle recovery, but we should be aware\n this.logger.debug('Daemon reported FSEvents buffer overflow');\n } else {\n this.msgs?.onError(new Error(error.message));\n }\n });\n\n // Handle disconnection from the daemon\n this.watcherClient.onDisconnect(async () => {\n this.logger.debug('Disconnected from watcher daemon');\n\n // Try to become the new daemon or reconnect\n await this.handleDaemonDisconnection();\n });\n\n // Setup graceful shutdown\n this.setupClientShutdown();\n }\n\n /**\n * Handle disconnection from the daemon - try to become the new daemon or reconnect\n */\n private async handleDaemonDisconnection(): Promise<void> {\n // Wait a bit for any other client to potentially become the daemon\n await this.sleep(500);\n\n try {\n const connection = await getOrCreateWatcherConnection(this.workspace.scope.path, this.logger);\n\n if (connection.isDaemon && connection.daemon) {\n // We became the new daemon\n this.isDaemon = true;\n this.watcherDaemon = connection.daemon;\n this.watcherClient = null;\n this.logger.console(\n chalk.yellow('Previous watcher daemon disconnected. This process is now the watcher daemon.')\n );\n await this.startParcelWatcherAsDaemon();\n } else if (connection.client) {\n // Another process became the daemon, connect to it\n this.watcherClient = connection.client;\n this.logger.debug('Reconnected to new watcher daemon');\n await this.startAsClient();\n }\n } catch (err: any) {\n this.logger.error(`Failed to reconnect after daemon disconnection: ${err.message}`);\n this.msgs?.onError(err);\n }\n }\n\n /**\n * Remove any existing signal handlers to prevent accumulation.\n * This is important when transitioning between client and daemon modes.\n */\n private removeSignalHandlers(): void {\n if (this.signalCleanupHandler) {\n process.off('SIGINT', this.signalCleanupHandler);\n process.off('SIGTERM', this.signalCleanupHandler);\n this.signalCleanupHandler = null;\n }\n }\n\n /**\n * Setup graceful shutdown handlers for daemon mode.\n * When SIGINT/SIGTERM is received, we need to:\n * 1. Stop the daemon (cleanup socket, notify clients)\n * 2. Call process.exit() to actually terminate\n *\n * Important: Once you add a handler for SIGINT, Node.js no longer exits automatically.\n * You must call process.exit() explicitly.\n */\n private setupDaemonShutdown(): void {\n // Remove old handlers to prevent accumulation when transitioning modes\n this.removeSignalHandlers();\n\n let isShuttingDown = false;\n\n const cleanup = () => {\n if (isShuttingDown) return;\n isShuttingDown = true;\n\n this.logger.debug('Daemon shutting down...');\n // Unsubscribe from Parcel watcher\n this.parcelSubscription?.unsubscribe().catch((err) => {\n this.logger.debug(`Error unsubscribing from Parcel watcher: ${err.message}`);\n });\n // Stop is async but we need to exit - start the cleanup and exit\n // The socket will be cleaned up by the OS when the process exits\n this.watcherDaemon\n ?.stop()\n .catch((err) => {\n this.logger.error(`Error stopping daemon: ${err.message}`);\n })\n .finally(() => {\n process.exit(0);\n });\n\n // Fallback: if stop() hangs, force exit after 1 second\n setTimeout(() => {\n process.exit(0);\n }, 1000).unref();\n };\n\n this.signalCleanupHandler = cleanup;\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n }\n\n /**\n * Setup graceful shutdown handlers for client mode.\n */\n private setupClientShutdown(): void {\n // Remove old handlers to prevent accumulation when transitioning modes\n this.removeSignalHandlers();\n\n let isShuttingDown = false;\n\n const cleanup = () => {\n if (isShuttingDown) return;\n isShuttingDown = true;\n\n this.watcherClient?.disconnect();\n process.exit(0);\n };\n\n this.signalCleanupHandler = cleanup;\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n }\n\n private async watchChokidar() {\n await this.createChokidarWatcher();\n const watcher = this.chokidarWatcher;\n const msgs = this.msgs;\n msgs?.onStart(this.workspace);\n\n return new Promise((resolve, reject) => {\n if (this.verbose) {\n // @ts-ignore\n if (msgs?.onAll) watcher.on('all', msgs.onAll);\n }\n watcher.on('ready', () => {\n msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n if (this.verbose) {\n const watched = this.chokidarWatcher.getWatched();\n const totalWatched = Object.values(watched).flat().length;\n logger.console(\n `${chalk.bold('the following files are being watched:')}\\n${JSON.stringify(watched, null, 2)}`\n );\n logger.console(`\\nTotal files being watched: ${chalk.bold(totalWatched.toString())}`);\n }\n\n this.logger.clearStatusLine();\n });\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n watcher.on('all', async (event, filePath) => {\n if (event !== 'change' && event !== 'add' && event !== 'unlink') return;\n const startTime = new Date().getTime();\n const { files, results, debounced, irrelevant, failureMsg } = await this.handleChange(filePath);\n if (debounced || irrelevant) {\n return;\n }\n const duration = new Date().getTime() - startTime;\n msgs?.onChange(files, results, this.verbose, duration, failureMsg);\n });\n watcher.on('error', (err) => {\n msgs?.onError(err);\n reject(err);\n });\n });\n }\n\n /**\n * *** DEBOUNCING ***\n * some actions trigger multiple files changes at (almost) the same time. e.g. \"git pull\".\n * this causes some performance and instability issues. a debouncing mechanism was implemented to help with this.\n * the way how it works is that the first file of the same component starts the execution with a delay (e.g. 200ms).\n * if, in the meanwhile, another file of the same component was changed, it won't start a new execution, instead,\n * it'll only add the file to `this.changedFilesPerComponent` prop.\n * once the execution starts, it'll delete this component-id from the `this.changedFilesPerComponent` array,\n * indicating the next file-change to start a new execution.\n *\n * implementation wise, `lodash.debounce` doesn't help here, because:\n * A) it doesn't return the results, unless \"leading\" option is true. here, it must be false, otherwise, it'll start\n * the execution immediately.\n * B) it debounces the method regardless the param passes to it. so it'll disregard the component-id and will delay\n * other components undesirably.\n *\n * *** QUEUE ***\n * the debouncing helps to not execute the same component multiple times concurrently. however, multiple components\n * and .bitmap changes execution can still be processed concurrently.\n * the following example explains why this is an issue.\n * compA is changed in the .bitmap file from version 0.0.1 to 0.0.2. its files were changed as well.\n * all these changes get pulled at the same time by \"git pull\", as a result, the execution of compA and the .bitmap\n * happen at the same time.\n * during the execution of compA, the component id is parsed as compA@0.0.1, later, it asks for the Workspace for this\n * id. while the workspace is looking for this id, the .bitmap execution reloaded the consumer and changed all versions.\n * after this change, the workspace doesn't have this id anymore, which will trigger an error.\n * to ensure this won't happen, we keep a flag to indicate whether the .bitmap execution is running, and if so, all\n * other executions are paused until the queue is empty (this is done by awaiting for queue.onIdle).\n * once the queue is empty, we know the .bitmap process was done and the workspace has all new ids.\n * in the example above, at this stage, the id will be resolved to compA@0.0.2.\n * one more thing, the queue is configured to have concurrency of 1. to make sure two components are not processed at\n * the same time. (the same way is done when loading all components from the filesystem/scope).\n * this way we can also ensure that if compA was started before the .bitmap execution, it will complete before the\n * .bitmap execution starts.\n */\n private async handleChange(filePath: string): Promise<{\n results: OnComponentEventResult[];\n files: string[];\n failureMsg?: string;\n debounced?: boolean;\n irrelevant?: boolean; // file/dir is not part of any component\n }> {\n try {\n if (filePath.endsWith(BIT_MAP)) {\n this.bitMapChangesInProgress = true;\n const buildResults = await this.watchQueue.add(() => this.handleBitmapChanges());\n this.bitMapChangesInProgress = false;\n this.logger.clearStatusLine();\n return { results: buildResults, files: [filePath] };\n }\n if (this.bitMapChangesInProgress) {\n await this.watchQueue.onIdle();\n }\n if (dirname(filePath) === this.ipcEventsDir) {\n const eventName = basename(filePath);\n if (eventName === 'onNotifySSE') {\n const content = await fs.readFile(filePath, 'utf8');\n this.logger.debug(`Watcher, onNotifySSE ${content}`);\n const parsed = JSON.parse(content);\n sendEventsToClients(parsed.event, parsed);\n } else {\n await this.watcherMain.ipcEvents.triggerGotEvent(eventName as any);\n }\n return { results: [], files: [filePath] };\n }\n if (filePath.endsWith(WORKSPACE_JSONC)) {\n await this.workspace.triggerOnWorkspaceConfigChange();\n return { results: [], files: [filePath] };\n }\n if (filePath.endsWith(UNMERGED_FILENAME)) {\n await this.workspace.clearCache();\n return { results: [], files: [filePath] };\n }\n const componentId = this.getComponentIdByPath(filePath);\n if (!componentId) {\n this.logger.clearStatusLine();\n return { results: [], files: [], irrelevant: true };\n }\n const compIdStr = componentId.toString();\n if (this.changedFilesPerComponent[compIdStr]) {\n this.changedFilesPerComponent[compIdStr].push(filePath);\n this.logger.clearStatusLine();\n return { results: [], files: [], debounced: true };\n }\n this.changedFilesPerComponent[compIdStr] = [filePath];\n await this.sleep(DEBOUNCE_WAIT_MS);\n const files = this.changedFilesPerComponent[compIdStr];\n delete this.changedFilesPerComponent[compIdStr];\n\n const buildResults = await this.watchQueue.add(() => this.triggerCompChanges(componentId, files));\n const failureMsg = buildResults.length\n ? undefined\n : `files ${files.join(', ')} are inside the component ${compIdStr} but configured to be ignored`;\n this.logger.clearStatusLine();\n return { results: buildResults, files, failureMsg };\n } catch (err: any) {\n const msg = `watcher found an error while handling ${filePath}`;\n logger.error(msg, err);\n logger.console(`${msg}, ${err.message}`);\n this.logger.clearStatusLine();\n return { results: [], files: [filePath], failureMsg: err.message };\n }\n }\n\n private async sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private async triggerCompChanges(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[]\n ): Promise<OnComponentEventResult[]> {\n let updatedComponentId: ComponentID | undefined = componentId;\n if (!this.workspace.hasId(componentId)) {\n // bitmap has changed meanwhile, which triggered `handleBitmapChanges`, which re-loaded consumer and updated versions\n // so the original componentId might not be in the workspace now, and we need to find the updated one\n const ids = this.workspace.listIds();\n updatedComponentId = ids.find((id) => id.isEqual(componentId, { ignoreVersion: true }));\n if (!updatedComponentId) {\n logger.debug(`triggerCompChanges, the component ${componentId.toString()} was probably removed from .bitmap`);\n return [];\n }\n }\n this.workspace.clearComponentCache(updatedComponentId);\n const component = await this.workspace.get(updatedComponentId);\n const componentMap: ComponentMap = component.state._consumer.componentMap;\n if (!componentMap) {\n throw new Error(\n `unable to find componentMap for ${updatedComponentId.toString()}, make sure this component is in .bitmap`\n );\n }\n const compFilesRelativeToWorkspace = componentMap.getFilesRelativeToConsumer();\n const [compFiles, nonCompFiles] = partition(files, (filePath) => {\n const relativeFile = this.getRelativePathLinux(filePath);\n return Boolean(compFilesRelativeToWorkspace.find((p) => p === relativeFile));\n });\n // nonCompFiles are either, files that were removed from the filesystem or existing files that are ignored.\n // the compiler takes care of removedFiles differently, e.g. removes dists dir and old symlinks.\n const removedFiles = compact(\n await Promise.all(nonCompFiles.map(async (filePath) => ((await fs.pathExists(filePath)) ? null : filePath)))\n );\n\n if (!compFiles.length && !removedFiles.length) {\n logger.debug(\n `the following files are part of the component ${componentId.toStringWithoutVersion()} but configured to be ignored:\\n${files.join(\n '\\n'\n )}'`\n );\n return [];\n }\n this.consumer.bitMap.updateComponentPaths(\n componentId,\n compFiles.map((f) => this.consumer.getPathRelativeToConsumer(f)),\n removedFiles.map((f) => this.consumer.getPathRelativeToConsumer(f))\n );\n const buildResults = await this.executeWatchOperationsOnComponent(\n updatedComponentId,\n compFiles,\n removedFiles,\n true\n );\n if (this.options.trigger && !updatedComponentId.isEqual(this.options.trigger)) {\n await this.workspace.triggerOnComponentChange(this.options.trigger, [], [], this.options);\n }\n\n return buildResults;\n }\n\n /**\n * if .bitmap changed, it's possible that a new component has been added. trigger onComponentAdd.\n */\n private async handleBitmapChanges(): Promise<OnComponentEventResult[]> {\n const previewsRootDirs = { ...this.rootDirs };\n const previewsIds = this.consumer.bitMap.getAllBitIds();\n await this.workspace._reloadConsumer();\n await this.setRootDirs();\n await this.importObjectsIfNeeded(previewsIds);\n await this.workspace.triggerOnBitmapChange();\n const newDirs: string[] = difference(Object.keys(this.rootDirs), Object.keys(previewsRootDirs));\n const removedDirs: string[] = difference(Object.keys(previewsRootDirs), Object.keys(this.rootDirs));\n const results: OnComponentEventResult[] = [];\n if (newDirs.length) {\n const addResults = await mapSeries(newDirs, async (dir) =>\n this.executeWatchOperationsOnComponent(this.rootDirs[dir], [], [], false)\n );\n results.push(...addResults.flat());\n }\n if (removedDirs.length) {\n await mapSeries(removedDirs, (dir) => this.executeWatchOperationsOnRemove(previewsRootDirs[dir]));\n }\n\n return results;\n }\n\n /**\n * needed when using git.\n * it resolves the following issue - a user is running `git pull` which updates the components and the .bitmap file.\n * because the objects locally are not updated, the .bitmap has new versions that don't exist in the local scope.\n * as soon as the watcher gets an event about a file change, it loads the component which throws\n * ComponentsPendingImport error.\n * to resolve this, we import the new objects as soon as the .bitmap file changes.\n * for performance reasons, we import only when: 1) the .bitmap file has version changes and 2) this new version is\n * not already in the scope.\n */\n private async importObjectsIfNeeded(previewsIds: ComponentIdList) {\n if (!this.options.import) {\n return;\n }\n const currentIds = this.consumer.bitMap.getAllBitIds();\n const hasVersionChanges = currentIds.find((id) => {\n const prevId = previewsIds.searchWithoutVersion(id);\n return prevId && prevId.version !== id.version;\n });\n if (!hasVersionChanges) {\n return;\n }\n const existsInScope = await this.workspace.scope.isComponentInScope(hasVersionChanges);\n if (existsInScope) {\n // the .bitmap change was probably a result of tag/snap/merge, no need to import.\n return;\n }\n if (this.options.verbose) {\n logger.console(\n `Watcher: .bitmap has changed with new versions which do not exist locally, importing the objects...`\n );\n }\n await this.workspace.scope.import(currentIds, {\n useCache: true,\n lane: await this.workspace.getCurrentLaneObject(),\n });\n }\n\n private async executeWatchOperationsOnRemove(componentId: ComponentID) {\n logger.debug(`running OnComponentRemove hook for ${chalk.bold(componentId.toString())}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentRemovedEvent(componentId.toString()));\n await this.workspace.triggerOnComponentRemove(componentId);\n }\n\n private async executeWatchOperationsOnComponent(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[],\n removedFiles: PathOsBasedAbsolute[] = [],\n isChange = true\n ): Promise<OnComponentEventResult[]> {\n if (this.isComponentWatchedExternally(componentId)) {\n // update capsule, once done, it automatically triggers the external watcher\n await this.workspace.get(componentId);\n return [];\n }\n const idStr = componentId.toString();\n\n if (isChange) {\n logger.debug(`running OnComponentChange hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentChangeEvent(idStr, 'OnComponentChange'));\n } else {\n logger.debug(`running OnComponentAdd hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentAddEvent(idStr, 'OnComponentAdd'));\n }\n\n const buildResults = isChange\n ? await this.workspace.triggerOnComponentChange(componentId, files, removedFiles, this.options)\n : await this.workspace.triggerOnComponentAdd(componentId, this.options);\n\n return buildResults;\n }\n\n private createOnComponentRemovedEvent(idStr) {\n return new OnComponentRemovedEvent(Date.now(), idStr);\n }\n\n private createOnComponentChangeEvent(idStr, hook) {\n return new OnComponentChangeEvent(Date.now(), idStr, hook);\n }\n\n private createOnComponentAddEvent(idStr, hook) {\n return new OnComponentAddEvent(Date.now(), idStr, hook);\n }\n\n private isComponentWatchedExternally(componentId: ComponentID) {\n const watcherData = this.multipleWatchers.find((m) => m.componentIds.find((id) => id.isEqual(componentId)));\n if (watcherData) {\n logger.debug(`${componentId.toString()} is watched by ${watcherData.compilerId.toString()}`);\n return true;\n }\n return false;\n }\n\n private getComponentIdByPath(filePath: string): ComponentID | null {\n const relativeFile = this.getRelativePathLinux(filePath);\n const rootDir = this.findRootDirByFilePathRecursively(relativeFile);\n if (!rootDir) {\n // the file is not part of any component. If it was a new component, or a new file of\n // existing component, then, handleBitmapChanges() should deal with it.\n return null;\n }\n return this.rootDirs[rootDir];\n }\n\n private getRelativePathLinux(filePath: string) {\n return pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(filePath));\n }\n\n private findRootDirByFilePathRecursively(filePath: string): string | null {\n if (this.rootDirs[filePath]) return filePath;\n const parentDir = dirname(filePath);\n if (parentDir === filePath) return null;\n return this.findRootDirByFilePathRecursively(parentDir);\n }\n\n private shouldIgnoreFromLocalScopeChokidar(pathToCheck: string) {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n const scopePathLinux = pathNormalizeToLinux(this.workspace.scope.path);\n return pathToCheck.startsWith(`${scopePathLinux}/`);\n }\n\n private shouldIgnoreFromLocalScopeParcel(pathToCheck: string) {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return pathToCheck.startsWith(this.workspace.scope.path + sep);\n }\n\n private async createChokidarWatcher() {\n const chokidarOpts = await this.watcherMain.getChokidarWatchOptions();\n // `chokidar` matchers have Bash-parity, so Windows-style backslashes are not supported as separators.\n // (windows-style backslashes are converted to forward slashes)\n chokidarOpts.ignored = [\n '**/node_modules/**',\n '**/package.json',\n this.shouldIgnoreFromLocalScopeChokidar.bind(this),\n ];\n this.chokidarWatcher = chokidar.watch(this.workspace.path, chokidarOpts);\n if (this.verbose) {\n logger.console(\n `${chalk.bold('chokidar.options:\\n')} ${JSON.stringify(this.chokidarWatcher.options, undefined, 2)}`\n );\n }\n }\n\n private async onParcelWatch(err: Error | null, allEvents: Event[]) {\n const events = allEvents.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n\n if (this.verbose) {\n this.logger.debug(\n `onParcelWatch: ${allEvents.length} events, ${events.length} after filtering, error: ${err?.message || 'none'}`\n );\n }\n\n const msgs = this.msgs;\n if (this.verbose) {\n if (msgs?.onAll) events.forEach((event) => msgs.onAll(event.type, event.path));\n }\n\n // Handle FSEvents buffer overflow with debounced snapshot recovery\n if (err?.message.includes('Events were dropped')) {\n // If recovery is already in progress, don't schedule another one\n if (this.isRecoveringFromSnapshot) {\n this.logger.debug('Recovery already in progress, ignoring additional drop error');\n return;\n }\n\n this.dropErrorCount++;\n this.logger.warn(`⚠️ FSEvents buffer overflow detected (occurrence #${this.dropErrorCount})`);\n\n // Clear existing timer and schedule new recovery\n if (this.dropErrorDebounceTimer) {\n clearTimeout(this.dropErrorDebounceTimer);\n }\n\n this.dropErrorDebounceTimer = setTimeout(async () => {\n await this.recoverFromSnapshot();\n this.dropErrorDebounceTimer = null;\n }, DROP_ERROR_DEBOUNCE_MS);\n\n // Don't process events if we got a drop error - wait for recovery\n return;\n }\n\n // Handle other errors\n if (err) {\n msgs?.onError(err);\n // Continue processing events even with other errors\n }\n\n if (!events.length) {\n return;\n }\n\n const startTime = new Date().getTime();\n await this.processEvents(events, startTime);\n\n // Write snapshot after successful processing (non-blocking)\n this.writeSnapshotIfNeeded().catch((writeErr) => {\n this.logger.debug(`Failed to write watcher snapshot: ${writeErr.message}`);\n });\n }\n\n /**\n * Process a list of file system events through the normal change handling pipeline.\n */\n private async processEvents(events: Event[], startTime: number): Promise<void> {\n await Promise.all(\n events.map(async (event) => {\n const { files, results, debounced, irrelevant, failureMsg } = await this.handleChange(event.path);\n if (debounced || irrelevant) {\n return;\n }\n const duration = new Date().getTime() - startTime;\n this.msgs?.onChange(files, results, this.verbose, duration, failureMsg);\n })\n );\n }\n\n private async setRootDirs() {\n this.rootDirs = {};\n const componentsFromBitMap = this.consumer.bitMap.getAllComponents();\n componentsFromBitMap.map((componentMap) => {\n const componentId = componentMap.id;\n const rootDir = componentMap.getRootDir();\n this.rootDirs[rootDir] = componentId;\n });\n }\n\n /**\n * Write a snapshot of the current filesystem state for recovery after FSEvents buffer overflow.\n * This is called after successful event processing.\n */\n private async writeSnapshotIfNeeded(): Promise<void> {\n if (this.watcherType !== 'parcel') {\n return; // Snapshots only work with Parcel watcher\n }\n\n if (this.isRecoveringFromSnapshot) {\n return; // Don't write snapshot while recovering\n }\n\n try {\n await ParcelWatcher.writeSnapshot(this.workspace.path, this.snapshotPath, {\n ignore: this.getParcelIgnorePatterns(),\n });\n this.logger.debug('Watcher snapshot written successfully');\n } catch (err: any) {\n this.logger.debug(`Failed to write watcher snapshot: ${err.message}`);\n }\n }\n\n /**\n * Recover from FSEvents buffer overflow by reading all events since the last snapshot.\n * This is called after debouncing multiple drop errors.\n */\n private async recoverFromSnapshot(): Promise<void> {\n if (this.isRecoveringFromSnapshot) {\n this.logger.debug('Already recovering from snapshot, skipping');\n return;\n }\n\n this.isRecoveringFromSnapshot = true;\n\n // Clear the debounce timer since we're now executing the recovery\n if (this.dropErrorDebounceTimer) {\n clearTimeout(this.dropErrorDebounceTimer);\n this.dropErrorDebounceTimer = null;\n }\n\n const startTime = new Date().getTime();\n const dropsDetected = this.dropErrorCount;\n\n // Reset drop error counter immediately to prevent multiple recoveries\n this.dropErrorCount = 0;\n\n try {\n if (this.verbose) {\n this.logger.console(\n chalk.yellow(\n `Recovering from FSEvents buffer overflow (${dropsDetected} drops detected). Scanning for missed events...`\n )\n );\n }\n\n // Check if snapshot exists\n if (!(await fs.pathExists(this.snapshotPath))) {\n if (this.verbose) {\n this.logger.console(chalk.yellow('No snapshot found. Skipping recovery.'));\n }\n return;\n }\n\n // Get all events since last snapshot\n const missedEvents = await ParcelWatcher.getEventsSince(this.workspace.path, this.snapshotPath, {\n ignore: this.getParcelIgnorePatterns(),\n });\n\n // Write new snapshot immediately after reading events to prevent re-processing same events\n await this.writeSnapshotIfNeeded();\n\n const filteredEvents = missedEvents.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n\n if (this.verbose) {\n this.logger.console(\n chalk.green(\n `Found ${filteredEvents.length} missed events (${missedEvents.length} total, ${missedEvents.length - filteredEvents.length} ignored)`\n )\n );\n }\n\n if (filteredEvents.length === 0) {\n if (this.verbose) {\n this.logger.console(chalk.green('No relevant missed events. Watcher state is consistent.'));\n }\n return;\n }\n\n // Log critical files that were missed (for debugging)\n if (this.verbose) {\n const criticalFiles = filteredEvents.filter(\n (e) => e.path.endsWith(BIT_MAP) || e.path.endsWith(WORKSPACE_JSONC)\n );\n if (criticalFiles.length > 0) {\n this.logger.console(\n chalk.cyan(`Critical files in missed events: ${criticalFiles.map((e) => basename(e.path)).join(', ')}`)\n );\n }\n }\n\n // Process all missed events using shared helper\n await this.processEvents(filteredEvents, startTime);\n\n if (this.verbose) {\n const duration = new Date().getTime() - startTime;\n this.logger.console(chalk.green(`✓ Recovery complete in ${duration}ms. Watcher state restored.`));\n }\n } catch (err: any) {\n // If recovery failed with the same drop error, the operation is still ongoing - retry after delay\n if (err.message?.includes('Events were dropped by the FSEvents client')) {\n if (this.verbose) {\n this.logger.console(\n chalk.yellow(`Recovery scan also encountered buffer overflow. Retrying in ${DROP_ERROR_DEBOUNCE_MS}ms...`)\n );\n }\n\n // Increment counter since we're encountering another drop\n this.dropErrorCount++;\n\n // Schedule another retry\n setTimeout(async () => {\n await this.recoverFromSnapshot();\n }, DROP_ERROR_DEBOUNCE_MS);\n } else {\n // Other errors - log and give up (counter already reset at start)\n this.logger.error(`Snapshot recovery failed: ${err.message}`);\n if (this.verbose) {\n this.logger.console(chalk.red(`Failed to recover from snapshot. Some events may have been missed.`));\n }\n }\n } finally {\n this.isRecoveringFromSnapshot = false;\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA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CAAC;QACH;MACF;;MAEA;MACA,MAAM,IAAI,CAACgE,aAAa,CAACJ,cAAc,EAAEC,SAAS,CAAC;MAEnD,IAAI,IAAI,CAACnE,OAAO,EAAE;QAChB,MAAMmH,QAAQ,GAAG,IAAI/C,IAAI,CAAC,CAAC,CAACwC,OAAO,CAAC,CAAC,GAAGzC,SAAS;QACjD,IAAI,CAAClE,MAAM,CAAC4E,OAAO,CAACC,gBAAK,CAAC8K,KAAK,CAAC,0BAA0BzI,QAAQ,6BAA6B,CAAC,CAAC;MACnG;IACF,CAAC,CAAC,OAAO1E,GAAQ,EAAE;MACjB;MACA,IAAIA,GAAG,CAACC,OAAO,EAAEO,QAAQ,CAAC,4CAA4C,CAAC,EAAE;QACvE,IAAI,IAAI,CAACjD,OAAO,EAAE;UAChB,IAAI,CAACC,MAAM,CAAC4E,OAAO,CACjBC,gBAAK,CAACC,MAAM,CAAC,+DAA+D3F,sBAAsB,OAAO,CAC3G,CAAC;QACH;;QAEA;QACA,IAAI,CAAC2P,cAAc,EAAE;;QAErB;QACAvJ,UAAU,CAAC,YAAY;UACrB,MAAM,IAAI,CAAC2J,mBAAmB,CAAC,CAAC;QAClC,CAAC,EAAE/P,sBAAsB,CAAC;MAC5B,CAAC,MAAM;QACL;QACA,IAAI,CAACa,MAAM,CAACuE,KAAK,CAAC,6BAA6B/B,GAAG,CAACC,OAAO,EAAE,CAAC;QAC7D,IAAI,IAAI,CAAC1C,OAAO,EAAE;UAChB,IAAI,CAACC,MAAM,CAAC4E,OAAO,CAACC,gBAAK,CAACiL,GAAG,CAAC,oEAAoE,CAAC,CAAC;QACtG;MACF;IACF,CAAC,SAAS;MACR,IAAI,CAACjB,wBAAwB,GAAG,KAAK;IACvC;EACF;AACF;AAACkB,OAAA,CAAA3Q,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_legacy","_legacy2","_legacy3","_pMapSeries","_chalk","_legacy4","_chokidar","_workspace","_watchQueue","_watcher","_child_process","_harmonyModules","_watcherDaemon","_fseventsError","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DEBOUNCE_WAIT_MS","DROP_ERROR_DEBOUNCE_MS","Watcher","constructor","workspace","pubsub","watcherMain","options","msgs","WatchQueue","ipcEventsDir","ipcEvents","eventsDir","verbose","logger","workspacePathLinux","pathNormalizeToLinux","path","snapshotPath","join","scope","process","env","BIT_WATCHER_USE_CHOKIDAR","watcherType","consumer","getParcelIgnorePatterns","getParcelWatcherOptions","ignore","platform","isWatchmanAvailable","backend","debug","watchmanAvailable","result","spawnSync","stdio","timeout","error","status","watch","setRootDirs","componentIds","values","rootDirs","triggerOnPreWatch","watchScopeInternalFiles","watchParcel","watchChokidar","onStart","isMacOS","isSharedDisabled","BIT_WATCHER_NO_SHARED","useSharedWatcher","connection","getOrCreateWatcherConnection","isDaemon","daemon","watcherDaemon","startParcelWatcherAsDaemon","client","watcherClient","startAsClient","onReady","clearStatusLine","err","message","ParcelWatcher","subscribe","onParcelWatch","bind","writeSnapshotIfNeeded","includes","errorMessage","formatFSEventsErrorMessage","Error","parcelSubscription","unsubscribe","onParcelWatchAsDaemon","setupDaemonShutdown","stop","allEvents","events","event","shouldIgnoreFromLocalScopeParcel","broadcastEvents","isDropError","broadcastError","onEvents","filteredEvents","startTime","Date","now","processEvents","onError","onDisconnect","handleDaemonDisconnection","setupClientShutdown","sleep","console","chalk","yellow","removeSignalHandlers","signalCleanupHandler","off","isShuttingDown","cleanup","catch","finally","exit","setTimeout","unref","on","disconnect","createChokidarWatcher","watcher","chokidarWatcher","Promise","resolve","reject","onAll","watched","getWatched","totalWatched","flat","bold","JSON","stringify","toString","filePath","getTime","files","results","debounced","irrelevant","failureMsg","handleChange","duration","onChange","endsWith","BIT_MAP","bitMapChangesInProgress","buildResults","watchQueue","add","handleBitmapChanges","onIdle","dirname","eventName","basename","content","fs","readFile","parsed","parse","sendEventsToClients","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","changedFilesPerComponent","triggerCompChanges","undefined","msg","ms","updatedComponentId","hasId","ids","listIds","find","id","isEqual","ignoreVersion","clearComponentCache","component","get","componentMap","state","_consumer","compFilesRelativeToWorkspace","getFilesRelativeToConsumer","compFiles","nonCompFiles","partition","relativeFile","getRelativePathLinux","Boolean","p","removedFiles","compact","all","map","pathExists","toStringWithoutVersion","bitMap","updateComponentPaths","f","getPathRelativeToConsumer","executeWatchOperationsOnComponent","trigger","triggerOnComponentChange","previewsRootDirs","previewsIds","getAllBitIds","_reloadConsumer","importObjectsIfNeeded","triggerOnBitmapChange","newDirs","difference","removedDirs","addResults","mapSeries","dir","executeWatchOperationsOnRemove","import","currentIds","hasVersionChanges","prevId","searchWithoutVersion","version","existsInScope","isComponentInScope","useCache","lane","getCurrentLaneObject","pub","WorkspaceAspect","createOnComponentRemovedEvent","triggerOnComponentRemove","isChange","isComponentWatchedExternally","idStr","createOnComponentChangeEvent","createOnComponentAddEvent","triggerOnComponentAdd","OnComponentRemovedEvent","hook","OnComponentChangeEvent","OnComponentAddEvent","watcherData","multipleWatchers","m","compilerId","rootDir","findRootDirByFilePathRecursively","parentDir","shouldIgnoreFromLocalScopeChokidar","pathToCheck","startsWith","scopePathLinux","sep","chokidarOpts","getChokidarWatchOptions","ignored","chokidar","type","isRecoveringFromSnapshot","dropErrorCount","warn","dropErrorDebounceTimer","clearTimeout","recoverFromSnapshot","writeErr","componentsFromBitMap","getAllComponents","getRootDir","writeSnapshot","dropsDetected","missedEvents","getEventsSince","green","criticalFiles","cyan","red","exports"],"sources":["watcher.ts"],"sourcesContent":["import type { PubsubMain } from '@teambit/pubsub';\nimport fs from 'fs-extra';\nimport { dirname, basename, join, sep } from 'path';\nimport { compact, difference, partition } from 'lodash';\nimport type { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BIT_MAP, WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport type { PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport { pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport mapSeries from 'p-map-series';\nimport chalk from 'chalk';\nimport type { ChildProcess } from 'child_process';\nimport { UNMERGED_FILENAME } from '@teambit/legacy.scope';\nimport type { FSWatcher } from 'chokidar';\nimport chokidar from 'chokidar';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\nimport type { Workspace, OnComponentEventResult } from '@teambit/workspace';\nimport {\n WorkspaceAspect,\n OnComponentChangeEvent,\n OnComponentAddEvent,\n OnComponentRemovedEvent,\n} from '@teambit/workspace';\nimport type { CheckTypes } from './check-types';\nimport type { WatcherMain } from './watcher.main.runtime';\nimport { WatchQueue } from './watch-queue';\nimport type { Logger } from '@teambit/logger';\nimport type { Event, Options as ParcelWatcherOptions } from '@parcel/watcher';\nimport ParcelWatcher from '@parcel/watcher';\nimport { spawnSync } from 'child_process';\nimport { sendEventsToClients } from '@teambit/harmony.modules.send-server-sent-events';\nimport { WatcherDaemon, WatcherClient, getOrCreateWatcherConnection, type WatcherError } from './watcher-daemon';\nimport { formatFSEventsErrorMessage } from './fsevents-error';\n\nexport type WatcherProcessData = { watchProcess: ChildProcess; compilerId: ComponentID; componentIds: ComponentID[] };\n\nexport type EventMessages = {\n onAll: Function;\n onStart: Function;\n onReady: Function;\n onChange: OnFileEventFunc;\n onAdd: OnFileEventFunc;\n onUnlink: OnFileEventFunc;\n onError: Function;\n};\n\nexport type OnFileEventFunc = (\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) => void;\n\nexport type WatchOptions = {\n initiator?: any; // the real type is CompilationInitiator, however it creates a circular dependency with the compiler aspect.\n verbose?: boolean; // print watch events to the console. (also ts-server events if spawnTSServer is true)\n spawnTSServer?: boolean; // needed for check types and extract API/docs.\n checkTypes?: CheckTypes; // if enabled, the spawnTSServer becomes true.\n preCompile?: boolean; // whether compile all components before start watching\n compile?: boolean; // whether compile modified/added components during watch process\n import?: boolean; // whether import objects during watch when .bitmap got version changes\n preImport?: boolean; // whether import objects before starting the watch process in case .bitmap is more updated than local scope.\n generateTypes?: boolean; // whether generate d.ts files for typescript files during watch process (hurts performance)\n trigger?: ComponentID; // trigger onComponentChange for the specified component-id. helpful when this comp must be a bundle, and needs to be recompile on any dep change.\n};\n\nexport type RootDirs = { [dir: PathLinux]: ComponentID };\n\ntype WatcherType = 'chokidar' | 'parcel';\n\nconst DEBOUNCE_WAIT_MS = 100;\nconst DROP_ERROR_DEBOUNCE_MS = 300; // Wait 300ms after last drop error before recovering\ntype PathLinux = string; // ts fails when importing it from @teambit/legacy/dist/utils/path.\n\nexport class Watcher {\n private watcherType: WatcherType = 'parcel';\n private chokidarWatcher: FSWatcher;\n private changedFilesPerComponent: { [componentId: string]: string[] } = {};\n private watchQueue = new WatchQueue();\n private bitMapChangesInProgress = false;\n private ipcEventsDir: PathOsBasedAbsolute;\n private rootDirs: RootDirs = {};\n private verbose = false;\n private multipleWatchers: WatcherProcessData[] = [];\n private logger: Logger;\n private workspacePathLinux: string;\n // Snapshot-based recovery for FSEvents buffer overflow\n private snapshotPath: PathOsBasedAbsolute;\n private dropErrorDebounceTimer: NodeJS.Timeout | null = null;\n private dropErrorCount = 0;\n private isRecoveringFromSnapshot = false;\n // Shared watcher daemon/client\n private watcherDaemon: WatcherDaemon | null = null;\n private watcherClient: WatcherClient | null = null;\n private isDaemon = false;\n // Parcel watcher subscription for cleanup\n private parcelSubscription: { unsubscribe: () => Promise<void> } | null = null;\n // Signal handlers for cleanup (to avoid accumulation)\n private signalCleanupHandler: (() => void) | null = null;\n // Cached Watchman availability (checked once per process lifetime)\n private watchmanAvailable: boolean | null = null;\n constructor(\n private workspace: Workspace,\n private pubsub: PubsubMain,\n private watcherMain: WatcherMain,\n private options: WatchOptions,\n private msgs?: EventMessages\n ) {\n this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;\n this.verbose = this.options.verbose || false;\n this.logger = this.watcherMain.logger;\n this.workspacePathLinux = pathNormalizeToLinux(this.workspace.path);\n this.snapshotPath = join(this.workspace.scope.path, 'watcher-snapshot.txt');\n\n if (process.env.BIT_WATCHER_USE_CHOKIDAR === 'true' || process.env.BIT_WATCHER_USE_CHOKIDAR === '1') {\n this.watcherType = 'chokidar';\n }\n }\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n private getParcelIgnorePatterns(): string[] {\n return [\n '**/node_modules/**',\n '**/package.json',\n `**/${this.workspace.scope.path}/cache/**`,\n `**/${this.workspace.scope.path}/tmp/**`,\n `**/${this.workspace.scope.path}/objects/**`,\n ];\n }\n\n /**\n * Get Parcel watcher options, preferring Watchman on macOS when available.\n * On macOS, FSEvents is the default but has a system-wide limit of ~500 streams.\n * Watchman is a single-daemon solution that avoids this limit.\n */\n private getParcelWatcherOptions(): ParcelWatcherOptions {\n const options: ParcelWatcherOptions = {\n ignore: this.getParcelIgnorePatterns(),\n };\n\n // On macOS, prefer Watchman if available to avoid FSEvents stream limit\n if (process.platform === 'darwin') {\n if (this.isWatchmanAvailable()) {\n options.backend = 'watchman';\n this.logger.debug('Using Watchman backend for file watching');\n } else {\n this.logger.debug('Using FSEvents backend for file watching (Watchman not available)');\n }\n }\n\n return options;\n }\n\n /**\n * Check if Watchman is installed.\n * Result is cached to avoid repeated executions.\n */\n private isWatchmanAvailable(): boolean {\n if (this.watchmanAvailable !== null) {\n return this.watchmanAvailable;\n }\n try {\n // Use spawnSync with shell: false (default) for security - prevents command injection\n const result = spawnSync('watchman', ['version'], { stdio: 'ignore', timeout: 5000 });\n // Check for spawn errors (e.g., command not found) or non-zero exit status\n this.watchmanAvailable = !result.error && result.status === 0;\n } catch {\n this.watchmanAvailable = false;\n }\n return this.watchmanAvailable;\n }\n\n async watch() {\n await this.setRootDirs();\n const componentIds = Object.values(this.rootDirs);\n await this.watcherMain.triggerOnPreWatch(componentIds, this.options);\n await this.watcherMain.watchScopeInternalFiles();\n this.watcherType === 'parcel' ? await this.watchParcel() : await this.watchChokidar();\n }\n\n private async watchParcel() {\n this.msgs?.onStart(this.workspace);\n\n // Use shared watcher daemon pattern to avoid FSEvents limit on macOS\n // FSEvents has a system-wide limit on concurrent watchers, which causes\n // \"Error starting FSEvents stream\" when multiple bit commands run watchers.\n // This is only an issue on macOS - other platforms don't have this limitation.\n const isMacOS = process.platform === 'darwin';\n const isSharedDisabled = process.env.BIT_WATCHER_NO_SHARED === 'true' || process.env.BIT_WATCHER_NO_SHARED === '1';\n const useSharedWatcher = isMacOS && !isSharedDisabled;\n\n if (useSharedWatcher) {\n try {\n const connection = await getOrCreateWatcherConnection(this.workspace.scope.path, this.logger);\n\n if (connection.isDaemon && connection.daemon) {\n // We're the daemon - run the actual Parcel watcher\n this.isDaemon = true;\n this.watcherDaemon = connection.daemon;\n this.logger.debug('Started as watcher daemon');\n await this.startParcelWatcherAsDaemon();\n } else if (connection.client) {\n // We're a client - receive events from the daemon\n this.isDaemon = false;\n this.watcherClient = connection.client;\n this.logger.debug('Connected to existing watcher daemon');\n await this.startAsClient();\n }\n\n this.msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n this.logger.clearStatusLine();\n return;\n } catch (err: any) {\n // If shared watcher setup fails, fall back to direct Parcel watcher\n this.logger.debug(`Shared watcher setup failed, falling back to direct watcher: ${err.message}`);\n }\n }\n\n // Original direct Parcel watcher logic (fallback)\n try {\n await ParcelWatcher.subscribe(this.workspace.path, this.onParcelWatch.bind(this), this.getParcelWatcherOptions());\n\n // Write initial snapshot for FSEvents buffer overflow recovery\n await this.writeSnapshotIfNeeded();\n this.logger.debug('Initial watcher snapshot created');\n } catch (err: any) {\n if (err.message.includes('Error starting FSEvents stream')) {\n const errorMessage = await formatFSEventsErrorMessage();\n throw new Error(errorMessage);\n }\n throw err;\n }\n this.msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n this.logger.clearStatusLine();\n }\n\n /**\n * Start Parcel watcher as the daemon - broadcast events to all clients\n */\n private async startParcelWatcherAsDaemon(): Promise<void> {\n try {\n // Clean up existing subscription if any (e.g., when transitioning from client to daemon)\n if (this.parcelSubscription) {\n await this.parcelSubscription.unsubscribe();\n this.parcelSubscription = null;\n }\n\n this.parcelSubscription = await ParcelWatcher.subscribe(\n this.workspace.path,\n this.onParcelWatchAsDaemon.bind(this),\n this.getParcelWatcherOptions()\n );\n\n // Write initial snapshot for FSEvents buffer overflow recovery\n await this.writeSnapshotIfNeeded();\n this.logger.debug('Initial watcher snapshot created (daemon mode)');\n\n // Setup graceful shutdown\n this.setupDaemonShutdown();\n } catch (err: any) {\n // Clean up daemon on failure\n await this.watcherDaemon?.stop();\n if (err.message.includes('Error starting FSEvents stream')) {\n const errorMessage = await formatFSEventsErrorMessage();\n throw new Error(errorMessage);\n }\n throw err;\n }\n }\n\n /**\n * Handle Parcel watcher events when running as daemon\n */\n private async onParcelWatchAsDaemon(err: Error | null, allEvents: Event[]) {\n const events = allEvents.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n\n // Broadcast events to all clients\n if (events.length > 0) {\n this.watcherDaemon?.broadcastEvents(events);\n }\n\n // Also broadcast errors\n if (err) {\n const isDropError = err.message.includes('Events were dropped');\n this.watcherDaemon?.broadcastError(err.message, isDropError);\n }\n\n // Process events locally (the daemon is also a watcher)\n await this.onParcelWatch(err, allEvents);\n }\n\n /**\n * Start as a client receiving events from the daemon\n */\n private async startAsClient(): Promise<void> {\n if (!this.watcherClient) {\n throw new Error('Watcher client not initialized');\n }\n\n // Handle events from the daemon\n this.watcherClient.onEvents(async (events) => {\n const filteredEvents = events.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n if (filteredEvents.length > 0) {\n const startTime = Date.now();\n await this.processEvents(filteredEvents, startTime);\n }\n });\n\n // Handle errors from the daemon\n this.watcherClient.onError(async (error: WatcherError) => {\n if (error.isDropError) {\n // The daemon will handle recovery, but we should be aware\n this.logger.debug('Daemon reported FSEvents buffer overflow');\n } else {\n this.msgs?.onError(new Error(error.message));\n }\n });\n\n // Handle disconnection from the daemon\n this.watcherClient.onDisconnect(async () => {\n this.logger.debug('Disconnected from watcher daemon');\n\n // Try to become the new daemon or reconnect\n await this.handleDaemonDisconnection();\n });\n\n // Setup graceful shutdown\n this.setupClientShutdown();\n }\n\n /**\n * Handle disconnection from the daemon - try to become the new daemon or reconnect\n */\n private async handleDaemonDisconnection(): Promise<void> {\n // Wait a bit for any other client to potentially become the daemon\n await this.sleep(500);\n\n try {\n const connection = await getOrCreateWatcherConnection(this.workspace.scope.path, this.logger);\n\n if (connection.isDaemon && connection.daemon) {\n // We became the new daemon\n this.isDaemon = true;\n this.watcherDaemon = connection.daemon;\n this.watcherClient = null;\n this.logger.console(\n chalk.yellow('Previous watcher daemon disconnected. This process is now the watcher daemon.')\n );\n await this.startParcelWatcherAsDaemon();\n } else if (connection.client) {\n // Another process became the daemon, connect to it\n this.watcherClient = connection.client;\n this.logger.debug('Reconnected to new watcher daemon');\n await this.startAsClient();\n }\n } catch (err: any) {\n this.logger.error(`Failed to reconnect after daemon disconnection: ${err.message}`);\n this.msgs?.onError(err);\n }\n }\n\n /**\n * Remove any existing signal handlers to prevent accumulation.\n * This is important when transitioning between client and daemon modes.\n */\n private removeSignalHandlers(): void {\n if (this.signalCleanupHandler) {\n process.off('SIGINT', this.signalCleanupHandler);\n process.off('SIGTERM', this.signalCleanupHandler);\n this.signalCleanupHandler = null;\n }\n }\n\n /**\n * Setup graceful shutdown handlers for daemon mode.\n * When SIGINT/SIGTERM is received, we need to:\n * 1. Stop the daemon (cleanup socket, notify clients)\n * 2. Call process.exit() to actually terminate\n *\n * Important: Once you add a handler for SIGINT, Node.js no longer exits automatically.\n * You must call process.exit() explicitly.\n */\n private setupDaemonShutdown(): void {\n // Remove old handlers to prevent accumulation when transitioning modes\n this.removeSignalHandlers();\n\n let isShuttingDown = false;\n\n const cleanup = () => {\n if (isShuttingDown) return;\n isShuttingDown = true;\n\n this.logger.debug('Daemon shutting down...');\n // Unsubscribe from Parcel watcher\n this.parcelSubscription?.unsubscribe().catch((err) => {\n this.logger.debug(`Error unsubscribing from Parcel watcher: ${err.message}`);\n });\n // Stop is async but we need to exit - start the cleanup and exit\n // The socket will be cleaned up by the OS when the process exits\n this.watcherDaemon\n ?.stop()\n .catch((err) => {\n this.logger.error(`Error stopping daemon: ${err.message}`);\n })\n .finally(() => {\n process.exit(0);\n });\n\n // Fallback: if stop() hangs, force exit after 1 second\n setTimeout(() => {\n process.exit(0);\n }, 1000).unref();\n };\n\n this.signalCleanupHandler = cleanup;\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n }\n\n /**\n * Setup graceful shutdown handlers for client mode.\n */\n private setupClientShutdown(): void {\n // Remove old handlers to prevent accumulation when transitioning modes\n this.removeSignalHandlers();\n\n let isShuttingDown = false;\n\n const cleanup = () => {\n if (isShuttingDown) return;\n isShuttingDown = true;\n\n this.watcherClient?.disconnect();\n process.exit(0);\n };\n\n this.signalCleanupHandler = cleanup;\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n }\n\n private async watchChokidar() {\n await this.createChokidarWatcher();\n const watcher = this.chokidarWatcher;\n const msgs = this.msgs;\n msgs?.onStart(this.workspace);\n\n return new Promise((resolve, reject) => {\n if (this.verbose) {\n // @ts-ignore\n if (msgs?.onAll) watcher.on('all', msgs.onAll);\n }\n watcher.on('ready', () => {\n msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n if (this.verbose) {\n const watched = this.chokidarWatcher.getWatched();\n const totalWatched = Object.values(watched).flat().length;\n logger.console(\n `${chalk.bold('the following files are being watched:')}\\n${JSON.stringify(watched, null, 2)}`\n );\n logger.console(`\\nTotal files being watched: ${chalk.bold(totalWatched.toString())}`);\n }\n\n this.logger.clearStatusLine();\n });\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n watcher.on('all', async (event, filePath) => {\n if (event !== 'change' && event !== 'add' && event !== 'unlink') return;\n const startTime = new Date().getTime();\n const { files, results, debounced, irrelevant, failureMsg } = await this.handleChange(filePath);\n if (debounced || irrelevant) {\n return;\n }\n const duration = new Date().getTime() - startTime;\n msgs?.onChange(files, results, this.verbose, duration, failureMsg);\n });\n watcher.on('error', (err) => {\n msgs?.onError(err);\n reject(err);\n });\n });\n }\n\n /**\n * *** DEBOUNCING ***\n * some actions trigger multiple files changes at (almost) the same time. e.g. \"git pull\".\n * this causes some performance and instability issues. a debouncing mechanism was implemented to help with this.\n * the way how it works is that the first file of the same component starts the execution with a delay (e.g. 200ms).\n * if, in the meanwhile, another file of the same component was changed, it won't start a new execution, instead,\n * it'll only add the file to `this.changedFilesPerComponent` prop.\n * once the execution starts, it'll delete this component-id from the `this.changedFilesPerComponent` array,\n * indicating the next file-change to start a new execution.\n *\n * implementation wise, `lodash.debounce` doesn't help here, because:\n * A) it doesn't return the results, unless \"leading\" option is true. here, it must be false, otherwise, it'll start\n * the execution immediately.\n * B) it debounces the method regardless the param passes to it. so it'll disregard the component-id and will delay\n * other components undesirably.\n *\n * *** QUEUE ***\n * the debouncing helps to not execute the same component multiple times concurrently. however, multiple components\n * and .bitmap changes execution can still be processed concurrently.\n * the following example explains why this is an issue.\n * compA is changed in the .bitmap file from version 0.0.1 to 0.0.2. its files were changed as well.\n * all these changes get pulled at the same time by \"git pull\", as a result, the execution of compA and the .bitmap\n * happen at the same time.\n * during the execution of compA, the component id is parsed as compA@0.0.1, later, it asks for the Workspace for this\n * id. while the workspace is looking for this id, the .bitmap execution reloaded the consumer and changed all versions.\n * after this change, the workspace doesn't have this id anymore, which will trigger an error.\n * to ensure this won't happen, we keep a flag to indicate whether the .bitmap execution is running, and if so, all\n * other executions are paused until the queue is empty (this is done by awaiting for queue.onIdle).\n * once the queue is empty, we know the .bitmap process was done and the workspace has all new ids.\n * in the example above, at this stage, the id will be resolved to compA@0.0.2.\n * one more thing, the queue is configured to have concurrency of 1. to make sure two components are not processed at\n * the same time. (the same way is done when loading all components from the filesystem/scope).\n * this way we can also ensure that if compA was started before the .bitmap execution, it will complete before the\n * .bitmap execution starts.\n */\n private async handleChange(filePath: string): Promise<{\n results: OnComponentEventResult[];\n files: string[];\n failureMsg?: string;\n debounced?: boolean;\n irrelevant?: boolean; // file/dir is not part of any component\n }> {\n try {\n if (filePath.endsWith(BIT_MAP)) {\n this.bitMapChangesInProgress = true;\n const buildResults = await this.watchQueue.add(() => this.handleBitmapChanges());\n this.bitMapChangesInProgress = false;\n this.logger.clearStatusLine();\n return { results: buildResults, files: [filePath] };\n }\n if (this.bitMapChangesInProgress) {\n await this.watchQueue.onIdle();\n }\n if (dirname(filePath) === this.ipcEventsDir) {\n const eventName = basename(filePath);\n if (eventName === 'onNotifySSE') {\n const content = await fs.readFile(filePath, 'utf8');\n this.logger.debug(`Watcher, onNotifySSE ${content}`);\n const parsed = JSON.parse(content);\n sendEventsToClients(parsed.event, parsed);\n } else {\n await this.watcherMain.ipcEvents.triggerGotEvent(eventName as any);\n }\n return { results: [], files: [filePath] };\n }\n if (filePath.endsWith(WORKSPACE_JSONC)) {\n await this.workspace.triggerOnWorkspaceConfigChange();\n return { results: [], files: [filePath] };\n }\n if (filePath.endsWith(UNMERGED_FILENAME)) {\n await this.workspace.clearCache();\n return { results: [], files: [filePath] };\n }\n const componentId = this.getComponentIdByPath(filePath);\n if (!componentId) {\n this.logger.clearStatusLine();\n return { results: [], files: [], irrelevant: true };\n }\n const compIdStr = componentId.toString();\n if (this.changedFilesPerComponent[compIdStr]) {\n this.changedFilesPerComponent[compIdStr].push(filePath);\n this.logger.clearStatusLine();\n return { results: [], files: [], debounced: true };\n }\n this.changedFilesPerComponent[compIdStr] = [filePath];\n await this.sleep(DEBOUNCE_WAIT_MS);\n const files = this.changedFilesPerComponent[compIdStr];\n delete this.changedFilesPerComponent[compIdStr];\n\n const buildResults = await this.watchQueue.add(() => this.triggerCompChanges(componentId, files));\n const failureMsg = buildResults.length\n ? undefined\n : `files ${files.join(', ')} are inside the component ${compIdStr} but configured to be ignored`;\n this.logger.clearStatusLine();\n return { results: buildResults, files, failureMsg };\n } catch (err: any) {\n const msg = `watcher found an error while handling ${filePath}`;\n logger.error(msg, err);\n logger.console(`${msg}, ${err.message}`);\n this.logger.clearStatusLine();\n return { results: [], files: [filePath], failureMsg: err.message };\n }\n }\n\n private async sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private async triggerCompChanges(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[]\n ): Promise<OnComponentEventResult[]> {\n let updatedComponentId: ComponentID | undefined = componentId;\n if (!this.workspace.hasId(componentId)) {\n // bitmap has changed meanwhile, which triggered `handleBitmapChanges`, which re-loaded consumer and updated versions\n // so the original componentId might not be in the workspace now, and we need to find the updated one\n const ids = this.workspace.listIds();\n updatedComponentId = ids.find((id) => id.isEqual(componentId, { ignoreVersion: true }));\n if (!updatedComponentId) {\n logger.debug(`triggerCompChanges, the component ${componentId.toString()} was probably removed from .bitmap`);\n return [];\n }\n }\n this.workspace.clearComponentCache(updatedComponentId);\n const component = await this.workspace.get(updatedComponentId);\n const componentMap: ComponentMap = component.state._consumer.componentMap;\n if (!componentMap) {\n throw new Error(\n `unable to find componentMap for ${updatedComponentId.toString()}, make sure this component is in .bitmap`\n );\n }\n const compFilesRelativeToWorkspace = componentMap.getFilesRelativeToConsumer();\n const [compFiles, nonCompFiles] = partition(files, (filePath) => {\n const relativeFile = this.getRelativePathLinux(filePath);\n return Boolean(compFilesRelativeToWorkspace.find((p) => p === relativeFile));\n });\n // nonCompFiles are either, files that were removed from the filesystem or existing files that are ignored.\n // the compiler takes care of removedFiles differently, e.g. removes dists dir and old symlinks.\n const removedFiles = compact(\n await Promise.all(nonCompFiles.map(async (filePath) => ((await fs.pathExists(filePath)) ? null : filePath)))\n );\n\n if (!compFiles.length && !removedFiles.length) {\n logger.debug(\n `the following files are part of the component ${componentId.toStringWithoutVersion()} but configured to be ignored:\\n${files.join(\n '\\n'\n )}'`\n );\n return [];\n }\n this.consumer.bitMap.updateComponentPaths(\n componentId,\n compFiles.map((f) => this.consumer.getPathRelativeToConsumer(f)),\n removedFiles.map((f) => this.consumer.getPathRelativeToConsumer(f))\n );\n const buildResults = await this.executeWatchOperationsOnComponent(\n updatedComponentId,\n compFiles,\n removedFiles,\n true\n );\n if (this.options.trigger && !updatedComponentId.isEqual(this.options.trigger)) {\n await this.workspace.triggerOnComponentChange(this.options.trigger, [], [], this.options);\n }\n\n return buildResults;\n }\n\n /**\n * if .bitmap changed, it's possible that a new component has been added. trigger onComponentAdd.\n */\n private async handleBitmapChanges(): Promise<OnComponentEventResult[]> {\n const previewsRootDirs = { ...this.rootDirs };\n const previewsIds = this.consumer.bitMap.getAllBitIds();\n await this.workspace._reloadConsumer();\n await this.setRootDirs();\n await this.importObjectsIfNeeded(previewsIds);\n await this.workspace.triggerOnBitmapChange();\n const newDirs: string[] = difference(Object.keys(this.rootDirs), Object.keys(previewsRootDirs));\n const removedDirs: string[] = difference(Object.keys(previewsRootDirs), Object.keys(this.rootDirs));\n const results: OnComponentEventResult[] = [];\n if (newDirs.length) {\n const addResults = await mapSeries(newDirs, async (dir) =>\n this.executeWatchOperationsOnComponent(this.rootDirs[dir], [], [], false)\n );\n results.push(...addResults.flat());\n }\n if (removedDirs.length) {\n await mapSeries(removedDirs, (dir) => this.executeWatchOperationsOnRemove(previewsRootDirs[dir]));\n }\n\n return results;\n }\n\n /**\n * needed when using git.\n * it resolves the following issue - a user is running `git pull` which updates the components and the .bitmap file.\n * because the objects locally are not updated, the .bitmap has new versions that don't exist in the local scope.\n * as soon as the watcher gets an event about a file change, it loads the component which throws\n * ComponentsPendingImport error.\n * to resolve this, we import the new objects as soon as the .bitmap file changes.\n * for performance reasons, we import only when: 1) the .bitmap file has version changes and 2) this new version is\n * not already in the scope.\n */\n private async importObjectsIfNeeded(previewsIds: ComponentIdList) {\n if (!this.options.import) {\n return;\n }\n const currentIds = this.consumer.bitMap.getAllBitIds();\n const hasVersionChanges = currentIds.find((id) => {\n const prevId = previewsIds.searchWithoutVersion(id);\n return prevId && prevId.version !== id.version;\n });\n if (!hasVersionChanges) {\n return;\n }\n const existsInScope = await this.workspace.scope.isComponentInScope(hasVersionChanges);\n if (existsInScope) {\n // the .bitmap change was probably a result of tag/snap/merge, no need to import.\n return;\n }\n if (this.options.verbose) {\n logger.console(\n `Watcher: .bitmap has changed with new versions which do not exist locally, importing the objects...`\n );\n }\n await this.workspace.scope.import(currentIds, {\n useCache: true,\n lane: await this.workspace.getCurrentLaneObject(),\n });\n }\n\n private async executeWatchOperationsOnRemove(componentId: ComponentID) {\n logger.debug(`running OnComponentRemove hook for ${chalk.bold(componentId.toString())}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentRemovedEvent(componentId.toString()));\n await this.workspace.triggerOnComponentRemove(componentId);\n }\n\n private async executeWatchOperationsOnComponent(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[],\n removedFiles: PathOsBasedAbsolute[] = [],\n isChange = true\n ): Promise<OnComponentEventResult[]> {\n if (this.isComponentWatchedExternally(componentId)) {\n // update capsule, once done, it automatically triggers the external watcher\n await this.workspace.get(componentId);\n return [];\n }\n const idStr = componentId.toString();\n\n if (isChange) {\n logger.debug(`running OnComponentChange hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentChangeEvent(idStr, 'OnComponentChange'));\n } else {\n logger.debug(`running OnComponentAdd hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentAddEvent(idStr, 'OnComponentAdd'));\n }\n\n const buildResults = isChange\n ? await this.workspace.triggerOnComponentChange(componentId, files, removedFiles, this.options)\n : await this.workspace.triggerOnComponentAdd(componentId, this.options);\n\n return buildResults;\n }\n\n private createOnComponentRemovedEvent(idStr) {\n return new OnComponentRemovedEvent(Date.now(), idStr);\n }\n\n private createOnComponentChangeEvent(idStr, hook) {\n return new OnComponentChangeEvent(Date.now(), idStr, hook);\n }\n\n private createOnComponentAddEvent(idStr, hook) {\n return new OnComponentAddEvent(Date.now(), idStr, hook);\n }\n\n private isComponentWatchedExternally(componentId: ComponentID) {\n const watcherData = this.multipleWatchers.find((m) => m.componentIds.find((id) => id.isEqual(componentId)));\n if (watcherData) {\n logger.debug(`${componentId.toString()} is watched by ${watcherData.compilerId.toString()}`);\n return true;\n }\n return false;\n }\n\n private getComponentIdByPath(filePath: string): ComponentID | null {\n const relativeFile = this.getRelativePathLinux(filePath);\n const rootDir = this.findRootDirByFilePathRecursively(relativeFile);\n if (!rootDir) {\n // the file is not part of any component. If it was a new component, or a new file of\n // existing component, then, handleBitmapChanges() should deal with it.\n return null;\n }\n return this.rootDirs[rootDir];\n }\n\n private getRelativePathLinux(filePath: string) {\n return pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(filePath));\n }\n\n private findRootDirByFilePathRecursively(filePath: string): string | null {\n if (this.rootDirs[filePath]) return filePath;\n const parentDir = dirname(filePath);\n if (parentDir === filePath) return null;\n return this.findRootDirByFilePathRecursively(parentDir);\n }\n\n private shouldIgnoreFromLocalScopeChokidar(pathToCheck: string) {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n const scopePathLinux = pathNormalizeToLinux(this.workspace.scope.path);\n return pathToCheck.startsWith(`${scopePathLinux}/`);\n }\n\n private shouldIgnoreFromLocalScopeParcel(pathToCheck: string) {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return pathToCheck.startsWith(this.workspace.scope.path + sep);\n }\n\n private async createChokidarWatcher() {\n const chokidarOpts = await this.watcherMain.getChokidarWatchOptions();\n // `chokidar` matchers have Bash-parity, so Windows-style backslashes are not supported as separators.\n // (windows-style backslashes are converted to forward slashes)\n chokidarOpts.ignored = [\n '**/node_modules/**',\n '**/package.json',\n this.shouldIgnoreFromLocalScopeChokidar.bind(this),\n ];\n this.chokidarWatcher = chokidar.watch(this.workspace.path, chokidarOpts);\n if (this.verbose) {\n logger.console(\n `${chalk.bold('chokidar.options:\\n')} ${JSON.stringify(this.chokidarWatcher.options, undefined, 2)}`\n );\n }\n }\n\n private async onParcelWatch(err: Error | null, allEvents: Event[]) {\n const events = allEvents.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n\n if (this.verbose) {\n this.logger.debug(\n `onParcelWatch: ${allEvents.length} events, ${events.length} after filtering, error: ${err?.message || 'none'}`\n );\n }\n\n const msgs = this.msgs;\n if (this.verbose) {\n if (msgs?.onAll) events.forEach((event) => msgs.onAll(event.type, event.path));\n }\n\n // Handle FSEvents buffer overflow with debounced snapshot recovery\n if (err?.message.includes('Events were dropped')) {\n // If recovery is already in progress, don't schedule another one\n if (this.isRecoveringFromSnapshot) {\n this.logger.debug('Recovery already in progress, ignoring additional drop error');\n return;\n }\n\n this.dropErrorCount++;\n this.logger.warn(`⚠️ FSEvents buffer overflow detected (occurrence #${this.dropErrorCount})`);\n\n // Clear existing timer and schedule new recovery\n if (this.dropErrorDebounceTimer) {\n clearTimeout(this.dropErrorDebounceTimer);\n }\n\n this.dropErrorDebounceTimer = setTimeout(async () => {\n await this.recoverFromSnapshot();\n this.dropErrorDebounceTimer = null;\n }, DROP_ERROR_DEBOUNCE_MS);\n\n // Don't process events if we got a drop error - wait for recovery\n return;\n }\n\n // Handle other errors\n if (err) {\n msgs?.onError(err);\n // Continue processing events even with other errors\n }\n\n if (!events.length) {\n return;\n }\n\n const startTime = new Date().getTime();\n await this.processEvents(events, startTime);\n\n // Write snapshot after successful processing (non-blocking)\n this.writeSnapshotIfNeeded().catch((writeErr) => {\n this.logger.debug(`Failed to write watcher snapshot: ${writeErr.message}`);\n });\n }\n\n /**\n * Process a list of file system events through the normal change handling pipeline.\n */\n private async processEvents(events: Event[], startTime: number): Promise<void> {\n await Promise.all(\n events.map(async (event) => {\n const { files, results, debounced, irrelevant, failureMsg } = await this.handleChange(event.path);\n if (debounced || irrelevant) {\n return;\n }\n const duration = new Date().getTime() - startTime;\n this.msgs?.onChange(files, results, this.verbose, duration, failureMsg);\n })\n );\n }\n\n private async setRootDirs() {\n this.rootDirs = {};\n const componentsFromBitMap = this.consumer.bitMap.getAllComponents();\n componentsFromBitMap.map((componentMap) => {\n const componentId = componentMap.id;\n const rootDir = componentMap.getRootDir();\n this.rootDirs[rootDir] = componentId;\n });\n }\n\n /**\n * Write a snapshot of the current filesystem state for recovery after FSEvents buffer overflow.\n * This is called after successful event processing.\n */\n private async writeSnapshotIfNeeded(): Promise<void> {\n if (this.watcherType !== 'parcel') {\n return; // Snapshots only work with Parcel watcher\n }\n\n if (this.isRecoveringFromSnapshot) {\n return; // Don't write snapshot while recovering\n }\n\n try {\n await ParcelWatcher.writeSnapshot(this.workspace.path, this.snapshotPath, this.getParcelWatcherOptions());\n this.logger.debug('Watcher snapshot written successfully');\n } catch (err: any) {\n this.logger.debug(`Failed to write watcher snapshot: ${err.message}`);\n }\n }\n\n /**\n * Recover from FSEvents buffer overflow by reading all events since the last snapshot.\n * This is called after debouncing multiple drop errors.\n */\n private async recoverFromSnapshot(): Promise<void> {\n if (this.isRecoveringFromSnapshot) {\n this.logger.debug('Already recovering from snapshot, skipping');\n return;\n }\n\n this.isRecoveringFromSnapshot = true;\n\n // Clear the debounce timer since we're now executing the recovery\n if (this.dropErrorDebounceTimer) {\n clearTimeout(this.dropErrorDebounceTimer);\n this.dropErrorDebounceTimer = null;\n }\n\n const startTime = new Date().getTime();\n const dropsDetected = this.dropErrorCount;\n\n // Reset drop error counter immediately to prevent multiple recoveries\n this.dropErrorCount = 0;\n\n try {\n if (this.verbose) {\n this.logger.console(\n chalk.yellow(\n `Recovering from FSEvents buffer overflow (${dropsDetected} drops detected). Scanning for missed events...`\n )\n );\n }\n\n // Check if snapshot exists\n if (!(await fs.pathExists(this.snapshotPath))) {\n if (this.verbose) {\n this.logger.console(chalk.yellow('No snapshot found. Skipping recovery.'));\n }\n return;\n }\n\n // Get all events since last snapshot\n const missedEvents = await ParcelWatcher.getEventsSince(\n this.workspace.path,\n this.snapshotPath,\n this.getParcelWatcherOptions()\n );\n\n // Write new snapshot immediately after reading events to prevent re-processing same events\n await this.writeSnapshotIfNeeded();\n\n const filteredEvents = missedEvents.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n\n if (this.verbose) {\n this.logger.console(\n chalk.green(\n `Found ${filteredEvents.length} missed events (${missedEvents.length} total, ${missedEvents.length - filteredEvents.length} ignored)`\n )\n );\n }\n\n if (filteredEvents.length === 0) {\n if (this.verbose) {\n this.logger.console(chalk.green('No relevant missed events. Watcher state is consistent.'));\n }\n return;\n }\n\n // Log critical files that were missed (for debugging)\n if (this.verbose) {\n const criticalFiles = filteredEvents.filter(\n (e) => e.path.endsWith(BIT_MAP) || e.path.endsWith(WORKSPACE_JSONC)\n );\n if (criticalFiles.length > 0) {\n this.logger.console(\n chalk.cyan(`Critical files in missed events: ${criticalFiles.map((e) => basename(e.path)).join(', ')}`)\n );\n }\n }\n\n // Process all missed events using shared helper\n await this.processEvents(filteredEvents, startTime);\n\n if (this.verbose) {\n const duration = new Date().getTime() - startTime;\n this.logger.console(chalk.green(`✓ Recovery complete in ${duration}ms. Watcher state restored.`));\n }\n } catch (err: any) {\n // If recovery failed with the same drop error, the operation is still ongoing - retry after delay\n if (err.message?.includes('Events were dropped by the FSEvents client')) {\n if (this.verbose) {\n this.logger.console(\n chalk.yellow(`Recovery scan also encountered buffer overflow. Retrying in ${DROP_ERROR_DEBOUNCE_MS}ms...`)\n );\n }\n\n // Increment counter since we're encountering another drop\n this.dropErrorCount++;\n\n // Schedule another retry\n setTimeout(async () => {\n await this.recoverFromSnapshot();\n }, DROP_ERROR_DEBOUNCE_MS);\n } else {\n // Other errors - log and give up (counter already reset at start)\n this.logger.error(`Snapshot recovery failed: ${err.message}`);\n if (this.verbose) {\n this.logger.console(chalk.red(`Failed to recover from snapshot. Some events may have been missed.`));\n }\n }\n } finally {\n this.isRecoveringFromSnapshot = false;\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,YAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,WAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,OAAA;EAAA,MAAAT,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAO,MAAA,YAAAA,CAAA;IAAA,OAAAT,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,QAAQ,CAAC,4CAA4C,CAAC,EAAE;QACvE,IAAI,IAAI,CAAC3D,OAAO,EAAE;UAChB,IAAI,CAACC,MAAM,CAACqF,OAAO,CACjBC,gBAAK,CAACC,MAAM,CAAC,+DAA+DpG,sBAAsB,OAAO,CAC3G,CAAC;QACH;;QAEA;QACA,IAAI,CAACoQ,cAAc,EAAE;;QAErB;QACAvJ,UAAU,CAAC,YAAY;UACrB,MAAM,IAAI,CAAC2J,mBAAmB,CAAC,CAAC;QAClC,CAAC,EAAExQ,sBAAsB,CAAC;MAC5B,CAAC,MAAM;QACL;QACA,IAAI,CAACa,MAAM,CAACwB,KAAK,CAAC,6BAA6B2B,GAAG,CAACC,OAAO,EAAE,CAAC;QAC7D,IAAI,IAAI,CAACrD,OAAO,EAAE;UAChB,IAAI,CAACC,MAAM,CAACqF,OAAO,CAACC,gBAAK,CAACiL,GAAG,CAAC,oEAAoE,CAAC,CAAC;QACtG;MACF;IACF,CAAC,SAAS;MACR,IAAI,CAACjB,wBAAwB,GAAG,KAAK;IACvC;EACF;AACF;AAACkB,OAAA,CAAApR,OAAA,GAAAA,OAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/watcher",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.842",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/workspace/watcher",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.workspace",
|
|
8
8
|
"name": "watcher",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.842"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@teambit/legacy.logger": "0.0.31",
|
|
30
30
|
"@teambit/legacy.scope": "0.0.90",
|
|
31
31
|
"@teambit/legacy.utils": "0.0.30",
|
|
32
|
-
"@teambit/workspace": "1.0.
|
|
33
|
-
"@teambit/ipc-events": "1.0.
|
|
34
|
-
"@teambit/pubsub": "1.0.
|
|
35
|
-
"@teambit/scope": "1.0.
|
|
32
|
+
"@teambit/workspace": "1.0.842",
|
|
33
|
+
"@teambit/ipc-events": "1.0.842",
|
|
34
|
+
"@teambit/pubsub": "1.0.842",
|
|
35
|
+
"@teambit/scope": "1.0.842"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/lodash": "4.14.165",
|
|
File without changes
|