@appland/scanner 1.79.0 → 1.80.0

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,15 @@
1
+ # [@appland/scanner-v1.80.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.79.0...@appland/scanner-v1.80.0) (2023-07-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Make sure to not process the same appmap multiple times ([da0a0d8](https://github.com/getappmap/appmap-js/commit/da0a0d8826844b4bd92bb671a3ea1b74a5563cb1))
7
+
8
+
9
+ ### Features
10
+
11
+ * upgrade @appland/models to 2.6.3 ([6e31f9c](https://github.com/getappmap/appmap-js/commit/6e31f9cc179ac0edfcde2861b937cd104ed4c687))
12
+
1
13
  # [@appland/scanner-v1.79.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.78.0...@appland/scanner-v1.79.0) (2023-06-23)
2
14
 
3
15
 
@@ -49,6 +49,8 @@ const telemetry_1 = __importDefault(require("../../telemetry"));
49
49
  const events_1 = __importDefault(require("events"));
50
50
  const watchScanTelemetry_1 = require("./watchScanTelemetry");
51
51
  const isAncestorPath_1 = __importDefault(require("../../util/isAncestorPath"));
52
+ const util_1 = require("util");
53
+ const debug = (0, util_1.debuglog)('scanner:watch');
52
54
  function isDir(targetPath) {
53
55
  return __awaiter(this, void 0, void 0, function* () {
54
56
  try {
@@ -76,6 +78,7 @@ class Watcher {
76
78
  // do not remove callbackify, apparently on windows
77
79
  // passing plain async function doesn't work (?)
78
80
  this.queue = (0, async_1.queue)((0, node_util_1.callbackify)(this.scan.bind(this)), 2);
81
+ this.processing = new Set();
79
82
  watchScanTelemetry_1.WatchScanTelemetry.watch(this.scanEventEmitter, options.appmapDir);
80
83
  this.queue.error((error, task) => console.warn(`Problem processing ${task}:\n`, error));
81
84
  }
@@ -165,8 +168,9 @@ class Watcher {
165
168
  });
166
169
  }
167
170
  enqueue(mtimePath) {
168
- if ([...this.queue].includes(mtimePath))
171
+ if (this.processing.has(mtimePath))
169
172
  return;
173
+ this.processing.add(mtimePath);
170
174
  this.queue.push(mtimePath);
171
175
  }
172
176
  scan(mtimePath) {
@@ -177,9 +181,11 @@ class Watcher {
177
181
  const [appmapStats, reportStats] = yield Promise.all([appmapFile, reportFile].map((f) => (0, promises_1.stat)(f).catch(() => null)));
178
182
  if (!appmapStats)
179
183
  return;
184
+ const cut = (str) => str.substring(str.length - 8);
185
+ debug('%s: %s, findings: %s, config: %s', appmapFile, cut(appmapStats.mtimeMs.toFixed(3)), reportStats && cut(reportStats.mtimeMs.toFixed(3)), cut(this.config.timestampMs.toFixed(3)));
180
186
  if (reportStats &&
181
- reportStats.mtimeMs > appmapStats.mtimeMs &&
182
- reportStats.mtimeMs > this.config.timestampMs)
187
+ reportStats.mtimeMs > appmapStats.mtimeMs - 1000 &&
188
+ reportStats.mtimeMs > this.config.timestampMs - 1000)
183
189
  return; // report is up to date
184
190
  const startTime = Date.now();
185
191
  const scanner = yield (0, scanner_1.default)(true, this.config, [appmapFile]);
@@ -188,6 +194,7 @@ class Watcher {
188
194
  this.scanEventEmitter.emit('scan', { scanResults: rawScanResults, elapsed });
189
195
  // Always report the raw data
190
196
  yield (0, promises_1.writeFile)(reportFile, (0, formatReport_1.formatReport)(rawScanResults));
197
+ this.processing.delete(mtimePath);
191
198
  });
192
199
  }
193
200
  reloadConfig() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appland/scanner",
3
- "version": "1.79.0",
3
+ "version": "1.80.0",
4
4
  "description": "Analyze AppMaps for code flaws",
5
5
  "bin": "built/cli.js",
6
6
  "files": [
@@ -19,8 +19,7 @@
19
19
  "doc-up-to-date": "git diff --exit-code doc/",
20
20
  "lint": "eslint src --ext .ts",
21
21
  "ci": "yarn lint && yarn build && yarn schema-up-to-date && yarn doc-up-to-date && yarn test",
22
- "test": "appmap-agent-js && jest -t @appmap-fixme --filter=./test/testFilter.js",
23
- "test:no-appmap": "yarn jest",
22
+ "test": "jest --filter=./test/testFilter.js",
24
23
  "jest": "jest --filter=./test/testFilter.js",
25
24
  "semantic-release": "semantic-release",
26
25
  "watch": "node bin/preBuild.js && tsc -p tsconfig.build.json --watch"
@@ -64,17 +63,17 @@
64
63
  },
65
64
  "dependencies": {
66
65
  "@appland/client": "^1.5.0",
67
- "@appland/models": "^2.6.2",
68
- "@appland/openapi": "1.5.0",
66
+ "@appland/models": "^2.6.3",
67
+ "@appland/openapi": "1.6.0",
69
68
  "@appland/sql-parser": "^1.5.0",
70
69
  "@types/cli-progress": "^3.9.2",
71
70
  "ajv": "^8.8.2",
72
71
  "applicationinsights": "^2.1.4",
73
- "async": "^3.2.3",
72
+ "async": "^3.2.4",
74
73
  "boxen": "^5.0.1",
75
74
  "chalk": "^4.1.2",
76
75
  "chokidar": "^3.5.1",
77
- "cli-progress": "^3.11.0",
76
+ "cli-progress": "^3.12.0",
78
77
  "conf": "10.2.0",
79
78
  "crypto-js": "^4.0.0",
80
79
  "glob": "7.2.3",