@appland/scanner 1.74.5 → 1.75.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,17 @@
1
+ # [@appland/scanner-v1.75.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.74.6...@appland/scanner-v1.75.0) (2023-01-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * Report env var names ([6264cb6](https://github.com/getappmap/appmap-js/commit/6264cb6c73927a90fc350bfb1531d3a8dd97df69))
7
+
8
+ # [@appland/scanner-v1.74.6](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.74.5...@appland/scanner-v1.74.6) (2023-01-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Scan-watching directories on other than the current drive ([8cd131a](https://github.com/getappmap/appmap-js/commit/8cd131ae99ba649a710fff1ae41ef16aa3b2d4b0))
14
+
1
15
  # [@appland/scanner-v1.74.5](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.74.4...@appland/scanner-v1.74.5) (2023-01-09)
2
16
 
3
17
 
@@ -48,6 +48,7 @@ const configurationProvider_1 = require("../../configuration/configurationProvid
48
48
  const telemetry_1 = __importDefault(require("../../telemetry"));
49
49
  const events_1 = __importDefault(require("events"));
50
50
  const watchScanTelemetry_1 = require("./watchScanTelemetry");
51
+ const isAncestorPath_1 = __importDefault(require("../../lib/isAncestorPath"));
51
52
  function isDir(targetPath) {
52
53
  return __awaiter(this, void 0, void 0, function* () {
53
54
  try {
@@ -68,9 +69,6 @@ function existingParent(targetPath) {
68
69
  return targetPath;
69
70
  });
70
71
  }
71
- function isAncestorPath(ancestor, descendant) {
72
- return !path_1.default.relative(ancestor, descendant).startsWith('..');
73
- }
74
72
  class Watcher {
75
73
  constructor(options) {
76
74
  this.options = options;
@@ -98,11 +96,11 @@ class Watcher {
98
96
  // If the appmap directory is a descendant of cwd, watch cwd (presumably project directory).
99
97
  // This ensures the watch will survive even if the appmap dir is removed and recreated.
100
98
  // Otherwise, make sure to use an existing directory. Chokidar struggles with missing directories.
101
- const watchDir = isAncestorPath(cwd, appmapDir) ? cwd : yield existingParent(appmapDir);
99
+ const watchDir = (0, isAncestorPath_1.default)(cwd, appmapDir) ? cwd : yield existingParent(appmapDir);
102
100
  // Custom ignore function needed to cut down the watch tree to just what we need.
103
101
  const ignored = (targetPath) => {
104
102
  // Ignore anything that isn't an ancestor or descendant of the appmap dir.
105
- if (!(isAncestorPath(targetPath, appmapDir) || isAncestorPath(appmapDir, targetPath)))
103
+ if (!((0, isAncestorPath_1.default)(targetPath, appmapDir) || (0, isAncestorPath_1.default)(appmapDir, targetPath)))
106
104
  return true;
107
105
  // Also make sure to not try to recurse down node_modules or .git
108
106
  const basename = path_1.default.basename(targetPath);
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ function isAncestorPath(ancestor, descendant) {
8
+ const relative = path_1.default.relative(ancestor, descendant);
9
+ return !relative.startsWith('..') && !path_1.default.isAbsolute(relative);
10
+ }
11
+ exports.default = isAncestorPath;
@@ -101,6 +101,7 @@ function sendScanResultsTelemetry(telemetry) {
101
101
  numAppMaps: telemetry.numAppMaps,
102
102
  numFindings: telemetry.numFindings,
103
103
  },
104
- });
104
+ }),
105
+ { includeEnvironmentVariables: true };
105
106
  }
106
107
  exports.sendScanResultsTelemetry = sendScanResultsTelemetry;
@@ -159,11 +159,14 @@ class Telemetry {
159
159
  }
160
160
  return this._client;
161
161
  }
162
- static sendEvent(data) {
162
+ static sendEvent(data, options = { includeEnvironment: false }) {
163
163
  try {
164
164
  const transformedProperties = transformProps(Object.assign({ version: version, args: process.argv.slice(1).join(' ') }, data.properties));
165
165
  const transformedMetrics = transformProps(data.metrics || {});
166
166
  const properties = Object.assign({ 'common.source': name, 'common.os': os.platform(), 'common.platformversion': os.release(), 'common.arch': os.arch(), 'appmap.cli.machineId': Telemetry.machineId, 'appmap.cli.sessionId': Telemetry.session.id }, transformedProperties);
167
+ if (options.includeEnvironment) {
168
+ properties['common.environmentVariables'] = Object.keys(process.env).sort().join(',');
169
+ }
167
170
  const event = {
168
171
  name: `${name}/${data.name}`,
169
172
  measurements: transformedMetrics,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appland/scanner",
3
- "version": "1.74.5",
3
+ "version": "1.75.0",
4
4
  "description": "Analyze AppMaps for code flaws",
5
5
  "bin": "built/cli.js",
6
6
  "files": [