@appland/scanner 1.87.0 → 1.87.1

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,10 @@
1
+ # [@appland/scanner-v1.87.1](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.87.0...@appland/scanner-v1.87.1) (2024-07-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * conditionally create sql_warnings.txt ([737f59f](https://github.com/getappmap/appmap-js/commit/737f59f323b3c9300bc6985cb179fa7264c8f7fd))
7
+
1
8
  # [@appland/scanner-v1.87.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.86.0...@appland/scanner-v1.87.0) (2024-04-30)
2
9
 
3
10
 
@@ -17,12 +17,22 @@ function writeErrorToFile(error) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
18
  const flags = SqlParseErrorFileOpened ? 'a' : 'w';
19
19
  SqlParseErrorFileOpened = true;
20
- (0, promises_1.open)(SqlParseErrorFileName, flags).then((handle) => {
21
- handle.write([error.toString(), ''].join('\n')).finally(handle.close.bind(handle));
22
- });
20
+ const msg = [String(error), ''].join('\n');
21
+ try {
22
+ (0, promises_1.open)(SqlParseErrorFileName, flags).then((handle) => {
23
+ handle.write([error.toString(), ''].join('\n')).finally(handle.close.bind(handle));
24
+ });
25
+ }
26
+ catch (e) {
27
+ console.warn(e);
28
+ console.warn(`SQL Error: ${msg}`);
29
+ }
23
30
  });
24
31
  }
25
32
  function sqlWarning(parseError) {
33
+ if (!process.env['APPMAP_SQL_WARNING']) {
34
+ return;
35
+ }
26
36
  if (!SqlErrors.has(parseError.sql)) {
27
37
  writeErrorToFile(parseError);
28
38
  SqlErrors.add(parseError.sql);
@@ -368,12 +368,14 @@ class GitProperties {
368
368
  }
369
369
  }
370
370
  const gitCache = new Map();
371
+ const noCacheList = ['clearCache'];
371
372
  // GitProperties is available externally as Git.
372
373
  // This export provides a simple caching layer around GitProperties to avoid
373
374
  // excessive shelling out to git.
374
375
  exports.Git = new Proxy(GitProperties, {
375
376
  get(target, prop) {
376
- if (typeof target[prop] === 'function') {
377
+ if (!noCacheList.includes(prop.toString()) &&
378
+ typeof target[prop] === 'function') {
377
379
  return new Proxy(target[prop], {
378
380
  apply(target, thisArg, argArray) {
379
381
  const cacheKey = `${prop.toString()}(${JSON.stringify(argArray)})`;
@@ -382,12 +384,7 @@ exports.Git = new Proxy(GitProperties, {
382
384
  }
383
385
  /* eslint-disable-next-line @typescript-eslint/ban-types */
384
386
  const result = Reflect.apply(target, thisArg, argArray);
385
- if (result instanceof Promise) {
386
- return result.then((r) => {
387
- gitCache.set(cacheKey, r);
388
- return r;
389
- });
390
- }
387
+ gitCache.set(cacheKey, result);
391
388
  return result;
392
389
  },
393
390
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appland/scanner",
3
- "version": "1.87.0",
3
+ "version": "1.87.1",
4
4
  "description": "Analyze AppMaps for code flaws",
5
5
  "bin": "built/cli.js",
6
6
  "main": "built/index.js",
@@ -19,7 +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": "jest --filter=./test/testFilter.js --detectOpenHandles",
22
+ "test": "yarn jest",
23
23
  "jest": "jest --filter=./test/testFilter.js --detectOpenHandles",
24
24
  "semantic-release": "semantic-release",
25
25
  "watch": "node bin/preBuild.js && tsc -p tsconfig.build.json --watch"