@appland/scanner 1.70.4 → 1.70.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [@appland/scanner-v1.70.5](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.70.4...@appland/scanner-v1.70.5) (2022-09-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Ignore node_modules and .git when watching files ([a53e2a8](https://github.com/getappmap/appmap-js/commit/a53e2a8c0de25e0e7ae7c0515763a9f46d3bc307))
7
+ * More reliable AppMap change detection when scanning ([94a454b](https://github.com/getappmap/appmap-js/commit/94a454b14c3bea4c1c5e0cd81d75e7d919bc8e85))
8
+
1
9
  # [@appland/scanner-v1.70.4](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.70.3...@appland/scanner-v1.70.4) (2022-09-27)
2
10
 
3
11
 
@@ -61,21 +61,31 @@ class Watcher {
61
61
  // Chokidar struggles with relative paths. Make sure the watch pattern is absolute.
62
62
  const watchPattern = path_1.default.resolve(this.options.appmapDir, '**', 'mtime');
63
63
  this.appmapWatcher = chokidar.watch(watchPattern, {
64
+ ignoreInitial: true,
65
+ ignored: ['**/node_modules/**', '**/.git/**'],
66
+ });
67
+ this.appmapPoller = chokidar.watch(watchPattern, {
64
68
  ignoreInitial: false,
69
+ ignored: ['**/node_modules/**', '**/.git/**'],
70
+ usePolling: true,
71
+ interval: 1000,
72
+ persistent: false,
65
73
  });
66
- this.appmapWatcher
67
- .on('add', (filePath) => this.scan(filePath))
68
- .on('change', (filePath) => this.scan(filePath));
74
+ for (const ch of [this.appmapWatcher, this.appmapPoller]) {
75
+ ch.on('add', (filePath) => this.scan(filePath));
76
+ ch.on('change', (filePath) => this.scan(filePath));
77
+ }
69
78
  });
70
79
  }
71
80
  close() {
72
- if (!this.appmapWatcher)
73
- return;
74
- (0, assert_1.default)(this.configWatcher, `configWatcher should always be defined if appmapWatcher is defined`);
75
- this.appmapWatcher.close();
76
- this.configWatcher.close();
77
- this.appmapWatcher = undefined;
78
- this.configWatcher = undefined;
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ yield Promise.all(['appmapWatcher', 'appmapPoller', 'configWatcher'].map((k) => {
83
+ var _a;
84
+ const closer = (_a = this[k]) === null || _a === void 0 ? void 0 : _a.close();
85
+ this[k] = undefined;
86
+ return closer;
87
+ }));
88
+ });
79
89
  }
80
90
  scan(fileName) {
81
91
  return __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appland/scanner",
3
- "version": "1.70.4",
3
+ "version": "1.70.5",
4
4
  "description": "",
5
5
  "bin": "built/cli.js",
6
6
  "files": [