@teambit/watcher 1.0.792 → 1.0.793
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/watcher.d.ts
CHANGED
|
@@ -53,8 +53,13 @@ export declare class Watcher {
|
|
|
53
53
|
private multipleWatchers;
|
|
54
54
|
private logger;
|
|
55
55
|
private workspacePathLinux;
|
|
56
|
+
private snapshotPath;
|
|
57
|
+
private dropErrorDebounceTimer;
|
|
58
|
+
private dropErrorCount;
|
|
59
|
+
private isRecoveringFromSnapshot;
|
|
56
60
|
constructor(workspace: Workspace, pubsub: PubsubMain, watcherMain: WatcherMain, options: WatchOptions, msgs?: EventMessages | undefined);
|
|
57
61
|
get consumer(): Consumer;
|
|
62
|
+
private getParcelIgnorePatterns;
|
|
58
63
|
watch(): Promise<void>;
|
|
59
64
|
private watchParcel;
|
|
60
65
|
private watchChokidar;
|
|
@@ -124,6 +129,20 @@ export declare class Watcher {
|
|
|
124
129
|
private shouldIgnoreFromLocalScopeParcel;
|
|
125
130
|
private createChokidarWatcher;
|
|
126
131
|
private onParcelWatch;
|
|
132
|
+
/**
|
|
133
|
+
* Process a list of file system events through the normal change handling pipeline.
|
|
134
|
+
*/
|
|
135
|
+
private processEvents;
|
|
127
136
|
private setRootDirs;
|
|
137
|
+
/**
|
|
138
|
+
* Write a snapshot of the current filesystem state for recovery after FSEvents buffer overflow.
|
|
139
|
+
* This is called after successful event processing.
|
|
140
|
+
*/
|
|
141
|
+
private writeSnapshotIfNeeded;
|
|
142
|
+
/**
|
|
143
|
+
* Recover from FSEvents buffer overflow by reading all events since the last snapshot.
|
|
144
|
+
* This is called after debouncing multiple drop errors.
|
|
145
|
+
*/
|
|
146
|
+
private recoverFromSnapshot;
|
|
128
147
|
}
|
|
129
148
|
export {};
|
package/dist/watcher.js
CHANGED
|
@@ -109,6 +109,8 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
109
109
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
110
110
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
111
111
|
const DEBOUNCE_WAIT_MS = 100;
|
|
112
|
+
const DROP_ERROR_DEBOUNCE_MS = 300; // Wait 300ms after last drop error before recovering
|
|
113
|
+
|
|
112
114
|
// ts fails when importing it from @teambit/legacy/dist/utils/path.
|
|
113
115
|
|
|
114
116
|
class Watcher {
|
|
@@ -129,10 +131,16 @@ class Watcher {
|
|
|
129
131
|
_defineProperty(this, "multipleWatchers", []);
|
|
130
132
|
_defineProperty(this, "logger", void 0);
|
|
131
133
|
_defineProperty(this, "workspacePathLinux", void 0);
|
|
134
|
+
// Snapshot-based recovery for FSEvents buffer overflow
|
|
135
|
+
_defineProperty(this, "snapshotPath", void 0);
|
|
136
|
+
_defineProperty(this, "dropErrorDebounceTimer", null);
|
|
137
|
+
_defineProperty(this, "dropErrorCount", 0);
|
|
138
|
+
_defineProperty(this, "isRecoveringFromSnapshot", false);
|
|
132
139
|
this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;
|
|
133
140
|
this.verbose = this.options.verbose || false;
|
|
134
141
|
this.logger = this.watcherMain.logger;
|
|
135
142
|
this.workspacePathLinux = (0, _legacy3().pathNormalizeToLinux)(this.workspace.path);
|
|
143
|
+
this.snapshotPath = (0, _path().join)(this.workspace.scope.path, 'watcher-snapshot.txt');
|
|
136
144
|
if (process.env.BIT_WATCHER_USE_CHOKIDAR === 'true' || process.env.BIT_WATCHER_USE_CHOKIDAR === '1') {
|
|
137
145
|
this.watcherType = 'chokidar';
|
|
138
146
|
}
|
|
@@ -140,6 +148,9 @@ class Watcher {
|
|
|
140
148
|
get consumer() {
|
|
141
149
|
return this.workspace.consumer;
|
|
142
150
|
}
|
|
151
|
+
getParcelIgnorePatterns() {
|
|
152
|
+
return ['**/node_modules/**', '**/package.json', `**/${this.workspace.scope.path}/cache/**`, `**/${this.workspace.scope.path}/tmp/**`, `**/${this.workspace.scope.path}/objects/**`];
|
|
153
|
+
}
|
|
143
154
|
async watch() {
|
|
144
155
|
await this.setRootDirs();
|
|
145
156
|
const componentIds = Object.values(this.rootDirs);
|
|
@@ -151,8 +162,12 @@ class Watcher {
|
|
|
151
162
|
this.msgs?.onStart(this.workspace);
|
|
152
163
|
try {
|
|
153
164
|
await _watcher().default.subscribe(this.workspace.path, this.onParcelWatch.bind(this), {
|
|
154
|
-
ignore:
|
|
165
|
+
ignore: this.getParcelIgnorePatterns()
|
|
155
166
|
});
|
|
167
|
+
|
|
168
|
+
// Write initial snapshot for FSEvents buffer overflow recovery
|
|
169
|
+
await this.writeSnapshotIfNeeded();
|
|
170
|
+
this.logger.debug('Initial watcher snapshot created');
|
|
156
171
|
} catch (err) {
|
|
157
172
|
if (err.message.includes('Error starting FSEvents stream')) {
|
|
158
173
|
throw new Error(`Failed to start the watcher: ${err.message}
|
|
@@ -496,11 +511,12 @@ https://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-regi
|
|
|
496
511
|
}
|
|
497
512
|
shouldIgnoreFromLocalScopeChokidar(pathToCheck) {
|
|
498
513
|
if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(_legacy4().UNMERGED_FILENAME)) return false;
|
|
499
|
-
|
|
514
|
+
const scopePathLinux = (0, _legacy3().pathNormalizeToLinux)(this.workspace.scope.path);
|
|
515
|
+
return pathToCheck.startsWith(`${scopePathLinux}/`);
|
|
500
516
|
}
|
|
501
517
|
shouldIgnoreFromLocalScopeParcel(pathToCheck) {
|
|
502
518
|
if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(_legacy4().UNMERGED_FILENAME)) return false;
|
|
503
|
-
return pathToCheck.startsWith(
|
|
519
|
+
return pathToCheck.startsWith(this.workspace.scope.path + _path().sep);
|
|
504
520
|
}
|
|
505
521
|
async createChokidarWatcher() {
|
|
506
522
|
const chokidarOpts = await this.watcherMain.getChokidarWatchOptions();
|
|
@@ -514,25 +530,59 @@ https://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-regi
|
|
|
514
530
|
}
|
|
515
531
|
async onParcelWatch(err, allEvents) {
|
|
516
532
|
const events = allEvents.filter(event => !this.shouldIgnoreFromLocalScopeParcel(event.path));
|
|
517
|
-
if (
|
|
518
|
-
|
|
533
|
+
if (this.verbose) {
|
|
534
|
+
this.logger.debug(`onParcelWatch: ${allEvents.length} events, ${events.length} after filtering, error: ${err?.message || 'none'}`);
|
|
519
535
|
}
|
|
520
536
|
const msgs = this.msgs;
|
|
521
537
|
if (this.verbose) {
|
|
522
538
|
if (msgs?.onAll) events.forEach(event => msgs.onAll(event.type, event.path));
|
|
523
539
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
540
|
+
|
|
541
|
+
// Handle FSEvents buffer overflow with debounced snapshot recovery
|
|
542
|
+
if (err?.message.includes('Events were dropped')) {
|
|
543
|
+
// If recovery is already in progress, don't schedule another one
|
|
544
|
+
if (this.isRecoveringFromSnapshot) {
|
|
545
|
+
this.logger.debug('Recovery already in progress, ignoring additional drop error');
|
|
546
|
+
return;
|
|
528
547
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
//
|
|
548
|
+
this.dropErrorCount++;
|
|
549
|
+
this.logger.warn(`⚠️ FSEvents buffer overflow detected (occurrence #${this.dropErrorCount})`);
|
|
550
|
+
|
|
551
|
+
// Clear existing timer and schedule new recovery
|
|
552
|
+
if (this.dropErrorDebounceTimer) {
|
|
553
|
+
clearTimeout(this.dropErrorDebounceTimer);
|
|
554
|
+
}
|
|
555
|
+
this.dropErrorDebounceTimer = setTimeout(async () => {
|
|
556
|
+
await this.recoverFromSnapshot();
|
|
557
|
+
this.dropErrorDebounceTimer = null;
|
|
558
|
+
}, DROP_ERROR_DEBOUNCE_MS);
|
|
559
|
+
|
|
560
|
+
// Don't process events if we got a drop error - wait for recovery
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// Handle other errors
|
|
565
|
+
if (err) {
|
|
566
|
+
msgs?.onError(err);
|
|
567
|
+
// Continue processing events even with other errors
|
|
568
|
+
}
|
|
569
|
+
if (!events.length) {
|
|
570
|
+
return;
|
|
533
571
|
}
|
|
534
572
|
const startTime = new Date().getTime();
|
|
535
|
-
await
|
|
573
|
+
await this.processEvents(events, startTime);
|
|
574
|
+
|
|
575
|
+
// Write snapshot after successful processing (non-blocking)
|
|
576
|
+
this.writeSnapshotIfNeeded().catch(writeErr => {
|
|
577
|
+
this.logger.debug(`Failed to write watcher snapshot: ${writeErr.message}`);
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Process a list of file system events through the normal change handling pipeline.
|
|
583
|
+
*/
|
|
584
|
+
async processEvents(events, startTime) {
|
|
585
|
+
await Promise.all(events.map(async event => {
|
|
536
586
|
const {
|
|
537
587
|
files,
|
|
538
588
|
results,
|
|
@@ -544,8 +594,8 @@ https://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-regi
|
|
|
544
594
|
return;
|
|
545
595
|
}
|
|
546
596
|
const duration = new Date().getTime() - startTime;
|
|
547
|
-
msgs?.onChange(files, results, this.verbose, duration, failureMsg);
|
|
548
|
-
});
|
|
597
|
+
this.msgs?.onChange(files, results, this.verbose, duration, failureMsg);
|
|
598
|
+
}));
|
|
549
599
|
}
|
|
550
600
|
async setRootDirs() {
|
|
551
601
|
this.rootDirs = {};
|
|
@@ -556,6 +606,119 @@ https://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-regi
|
|
|
556
606
|
this.rootDirs[rootDir] = componentId;
|
|
557
607
|
});
|
|
558
608
|
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Write a snapshot of the current filesystem state for recovery after FSEvents buffer overflow.
|
|
612
|
+
* This is called after successful event processing.
|
|
613
|
+
*/
|
|
614
|
+
async writeSnapshotIfNeeded() {
|
|
615
|
+
if (this.watcherType !== 'parcel') {
|
|
616
|
+
return; // Snapshots only work with Parcel watcher
|
|
617
|
+
}
|
|
618
|
+
if (this.isRecoveringFromSnapshot) {
|
|
619
|
+
return; // Don't write snapshot while recovering
|
|
620
|
+
}
|
|
621
|
+
try {
|
|
622
|
+
await _watcher().default.writeSnapshot(this.workspace.path, this.snapshotPath, {
|
|
623
|
+
ignore: this.getParcelIgnorePatterns()
|
|
624
|
+
});
|
|
625
|
+
this.logger.debug('Watcher snapshot written successfully');
|
|
626
|
+
} catch (err) {
|
|
627
|
+
this.logger.debug(`Failed to write watcher snapshot: ${err.message}`);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Recover from FSEvents buffer overflow by reading all events since the last snapshot.
|
|
633
|
+
* This is called after debouncing multiple drop errors.
|
|
634
|
+
*/
|
|
635
|
+
async recoverFromSnapshot() {
|
|
636
|
+
if (this.isRecoveringFromSnapshot) {
|
|
637
|
+
this.logger.debug('Already recovering from snapshot, skipping');
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
this.isRecoveringFromSnapshot = true;
|
|
641
|
+
|
|
642
|
+
// Clear the debounce timer since we're now executing the recovery
|
|
643
|
+
if (this.dropErrorDebounceTimer) {
|
|
644
|
+
clearTimeout(this.dropErrorDebounceTimer);
|
|
645
|
+
this.dropErrorDebounceTimer = null;
|
|
646
|
+
}
|
|
647
|
+
const startTime = new Date().getTime();
|
|
648
|
+
const dropsDetected = this.dropErrorCount;
|
|
649
|
+
|
|
650
|
+
// Reset drop error counter immediately to prevent multiple recoveries
|
|
651
|
+
this.dropErrorCount = 0;
|
|
652
|
+
try {
|
|
653
|
+
if (this.verbose) {
|
|
654
|
+
this.logger.console(_chalk().default.yellow(`Recovering from FSEvents buffer overflow (${dropsDetected} drops detected). Scanning for missed events...`));
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// Check if snapshot exists
|
|
658
|
+
if (!(await _fsExtra().default.pathExists(this.snapshotPath))) {
|
|
659
|
+
if (this.verbose) {
|
|
660
|
+
this.logger.console(_chalk().default.yellow('No snapshot found. Skipping recovery.'));
|
|
661
|
+
}
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// Get all events since last snapshot
|
|
666
|
+
const missedEvents = await _watcher().default.getEventsSince(this.workspace.path, this.snapshotPath, {
|
|
667
|
+
ignore: this.getParcelIgnorePatterns()
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
// Write new snapshot immediately after reading events to prevent re-processing same events
|
|
671
|
+
await this.writeSnapshotIfNeeded();
|
|
672
|
+
const filteredEvents = missedEvents.filter(event => !this.shouldIgnoreFromLocalScopeParcel(event.path));
|
|
673
|
+
if (this.verbose) {
|
|
674
|
+
this.logger.console(_chalk().default.green(`Found ${filteredEvents.length} missed events (${missedEvents.length} total, ${missedEvents.length - filteredEvents.length} ignored)`));
|
|
675
|
+
}
|
|
676
|
+
if (filteredEvents.length === 0) {
|
|
677
|
+
if (this.verbose) {
|
|
678
|
+
this.logger.console(_chalk().default.green('No relevant missed events. Watcher state is consistent.'));
|
|
679
|
+
}
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// Log critical files that were missed (for debugging)
|
|
684
|
+
if (this.verbose) {
|
|
685
|
+
const criticalFiles = filteredEvents.filter(e => e.path.endsWith(_legacy().BIT_MAP) || e.path.endsWith(_legacy().WORKSPACE_JSONC));
|
|
686
|
+
if (criticalFiles.length > 0) {
|
|
687
|
+
this.logger.console(_chalk().default.cyan(`Critical files in missed events: ${criticalFiles.map(e => (0, _path().basename)(e.path)).join(', ')}`));
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// Process all missed events using shared helper
|
|
692
|
+
await this.processEvents(filteredEvents, startTime);
|
|
693
|
+
if (this.verbose) {
|
|
694
|
+
const duration = new Date().getTime() - startTime;
|
|
695
|
+
this.logger.console(_chalk().default.green(`✓ Recovery complete in ${duration}ms. Watcher state restored.`));
|
|
696
|
+
}
|
|
697
|
+
} catch (err) {
|
|
698
|
+
// If recovery failed with the same drop error, the operation is still ongoing - retry after delay
|
|
699
|
+
if (err.message?.includes('Events were dropped by the FSEvents client')) {
|
|
700
|
+
if (this.verbose) {
|
|
701
|
+
this.logger.console(_chalk().default.yellow(`Recovery scan also encountered buffer overflow. Retrying in ${DROP_ERROR_DEBOUNCE_MS}ms...`));
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
// Increment counter since we're encountering another drop
|
|
705
|
+
this.dropErrorCount++;
|
|
706
|
+
|
|
707
|
+
// Schedule another retry
|
|
708
|
+
setTimeout(async () => {
|
|
709
|
+
await this.recoverFromSnapshot();
|
|
710
|
+
}, DROP_ERROR_DEBOUNCE_MS);
|
|
711
|
+
} else {
|
|
712
|
+
// Other errors - log and give up (counter already reset at start)
|
|
713
|
+
this.logger.error(`Snapshot recovery failed: ${err.message}`);
|
|
714
|
+
if (this.verbose) {
|
|
715
|
+
this.logger.console(_chalk().default.red(`Failed to recover from snapshot. Some events may have been missed.`));
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
} finally {
|
|
719
|
+
this.isRecoveringFromSnapshot = false;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
559
722
|
}
|
|
560
723
|
exports.Watcher = Watcher;
|
|
561
724
|
|
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","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","Watcher","constructor","workspace","pubsub","watcherMain","options","msgs","WatchQueue","ipcEventsDir","ipcEvents","eventsDir","verbose","logger","workspacePathLinux","pathNormalizeToLinux","path","process","env","BIT_WATCHER_USE_CHOKIDAR","watcherType","consumer","watch","setRootDirs","componentIds","values","rootDirs","triggerOnPreWatch","watchScopeInternalFiles","watchParcel","watchChokidar","onStart","ParcelWatcher","subscribe","onParcelWatch","bind","ignore","err","message","includes","Error","onReady","clearStatusLine","createChokidarWatcher","watcher","chokidarWatcher","Promise","resolve","reject","onAll","on","watched","getWatched","totalWatched","flat","console","chalk","bold","JSON","stringify","toString","event","filePath","startTime","Date","getTime","files","results","debounced","irrelevant","failureMsg","handleChange","duration","onChange","onError","endsWith","BIT_MAP","bitMapChangesInProgress","buildResults","watchQueue","add","handleBitmapChanges","onIdle","dirname","eventName","basename","content","fs","readFile","debug","parsed","parse","sendEventsToClients","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","changedFilesPerComponent","sleep","triggerCompChanges","undefined","join","msg","error","ms","setTimeout","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","scope","isComponentInScope","useCache","lane","getCurrentLaneObject","pub","WorkspaceAspect","createOnComponentRemovedEvent","triggerOnComponentRemove","isChange","isComponentWatchedExternally","idStr","createOnComponentChangeEvent","createOnComponentAddEvent","triggerOnComponentAdd","OnComponentRemovedEvent","now","hook","OnComponentChangeEvent","OnComponentAddEvent","watcherData","multipleWatchers","m","compilerId","rootDir","findRootDirByFilePathRecursively","parentDir","shouldIgnoreFromLocalScopeChokidar","pathToCheck","startsWith","shouldIgnoreFromLocalScopeParcel","sep","chokidarOpts","getChokidarWatchOptions","ignored","chokidar","allEvents","events","type","componentsFromBitMap","getAllComponents","getRootDir","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';\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;\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 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\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 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 try {\n await ParcelWatcher.subscribe(this.workspace.path, this.onParcelWatch.bind(this), {\n ignore: ['**/node_modules/**', '**/package.json'],\n });\n } catch (err: any) {\n if (err.message.includes('Error starting FSEvents stream')) {\n throw new Error(`Failed to start the watcher: ${err.message}\nThis is usually caused by too many watchers running in the same workspace (e.g., bit-watch, bit-start, bit-run, or VSCode with the Bit plugin).\nTry closing the other watchers and re-running the command.\n\nIn general, if you're using \"bit start\" or \"bit run\", you don't need to run \"bit watch\" as well.\nSimilarly, if you're using VSCode with the Bit extension, you can enable \"Compile on Change\" instead of running a watcher manually.\n\nIf the issue persists, please refer to the Watchman troubleshooting guide:\nhttps://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-register_with_server-error-f2d_register_rpc--null--21`);\n }\n }\n this.msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n this.logger.clearStatusLine();\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 return (\n pathToCheck.startsWith(`${this.workspacePathLinux}/.git/`) ||\n pathToCheck.startsWith(`${this.workspacePathLinux}/.bit/`)\n );\n }\n\n private shouldIgnoreFromLocalScopeParcel(pathToCheck: string) {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return (\n pathToCheck.startsWith(join(this.workspace.path, '.git') + sep) ||\n pathToCheck.startsWith(join(this.workspace.path, '.bit') + sep)\n );\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 if (!events.length) {\n return;\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 if (err) {\n if (!err.message.includes('Events were dropped by the FSEvents client')) {\n // the message above shows up too many times and it doesn't affect the watcher.\n msgs?.onError(err);\n }\n // don't throw on other errors, just log them.\n // for example, when running \"bit install\" on a big project, it might error out with:\n // \"Error: Events were dropped by the FSEvents client. File system must be re-scanned.\"\n // but it still works for the future events.\n }\n const startTime = new Date().getTime();\n await mapSeries(events, 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 msgs?.onChange(files, results, this.verbose, duration, failureMsg);\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 root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,CAACG,QAAQ,GAAG,CAAC,CAAC;IAClB,MAAMmL,oBAAoB,GAAG,IAAI,CAACxL,QAAQ,CAACsH,MAAM,CAACmE,gBAAgB,CAAC,CAAC;IACpED,oBAAoB,CAACrE,GAAG,CAAEf,YAAY,IAAK;MACzC,MAAMvB,WAAW,GAAGuB,YAAY,CAACN,EAAE;MACnC,MAAM2E,OAAO,GAAGrE,YAAY,CAACsF,UAAU,CAAC,CAAC;MACzC,IAAI,CAACrL,QAAQ,CAACoK,OAAO,CAAC,GAAG5F,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAAC8G,OAAA,CAAA/M,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_legacy","_legacy2","_legacy3","_pMapSeries","_chalk","_legacy4","_chokidar","_workspace","_watchQueue","_watcher","_harmonyModules","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","ParcelWatcher","subscribe","onParcelWatch","bind","ignore","writeSnapshotIfNeeded","debug","err","message","includes","Error","onReady","clearStatusLine","createChokidarWatcher","watcher","chokidarWatcher","Promise","resolve","reject","onAll","on","watched","getWatched","totalWatched","flat","console","chalk","bold","JSON","stringify","toString","event","filePath","startTime","Date","getTime","files","results","debounced","irrelevant","failureMsg","handleChange","duration","onChange","onError","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","sleep","triggerCompChanges","undefined","msg","error","ms","setTimeout","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","now","hook","OnComponentChangeEvent","OnComponentAddEvent","watcherData","multipleWatchers","m","compilerId","rootDir","findRootDirByFilePathRecursively","parentDir","shouldIgnoreFromLocalScopeChokidar","pathToCheck","startsWith","scopePathLinux","shouldIgnoreFromLocalScopeParcel","sep","chokidarOpts","getChokidarWatchOptions","ignored","chokidar","allEvents","events","type","isRecoveringFromSnapshot","dropErrorCount","warn","dropErrorDebounceTimer","clearTimeout","recoverFromSnapshot","processEvents","catch","writeErr","componentsFromBitMap","getAllComponents","getRootDir","writeSnapshot","dropsDetected","yellow","missedEvents","getEventsSince","filteredEvents","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';\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 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 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 throw new Error(`Failed to start the watcher: ${err.message}\nThis is usually caused by too many watchers running in the same workspace (e.g., bit-watch, bit-start, bit-run, or VSCode with the Bit plugin).\nTry closing the other watchers and re-running the command.\n\nIn general, if you're using \"bit start\" or \"bit run\", you don't need to run \"bit watch\" as well.\nSimilarly, if you're using VSCode with the Bit extension, you can enable \"Compile on Change\" instead of running a watcher manually.\n\nIf the issue persists, please refer to the Watchman troubleshooting guide:\nhttps://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-register_with_server-error-f2d_register_rpc--null--21`);\n }\n }\n this.msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n this.logger.clearStatusLine();\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,C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,oEAAoE,CAAC,CAAC;QACtG;MACF;IACF,CAAC,SAAS;MACR,IAAI,CAACrB,wBAAwB,GAAG,KAAK;IACvC;EACF;AACF;AAACsB,OAAA,CAAAtO,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.793",
|
|
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.793"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@teambit/legacy.logger": "0.0.30",
|
|
30
30
|
"@teambit/legacy.scope": "0.0.84",
|
|
31
31
|
"@teambit/legacy.utils": "0.0.28",
|
|
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.793",
|
|
33
|
+
"@teambit/ipc-events": "1.0.793",
|
|
34
|
+
"@teambit/pubsub": "1.0.793",
|
|
35
|
+
"@teambit/scope": "1.0.793"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/lodash": "4.14.165",
|
|
File without changes
|