@memlab/cli 1.0.6 → 1.0.7

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/bin/memlab CHANGED
@@ -10,5 +10,10 @@
10
10
  * @format
11
11
  */
12
12
 
13
- var cli = require("@memlab/cli");
14
- cli.run();
13
+ var cli = require("../dist/index");
14
+
15
+ // register the `@memlab/cli` package info
16
+ // so that `memlab version` get use the info
17
+ (cli.registerPackage()).then(() => {
18
+ cli.run();
19
+ });
@@ -12,6 +12,7 @@ import BaseCommand from '../BaseCommand';
12
12
  export default class GetVersionCommand extends BaseCommand {
13
13
  getCommandName(): string;
14
14
  getDescription(): string;
15
+ private loadDepencyPackageInfo;
15
16
  run(options: CLIOptions): Promise<void>;
16
17
  }
17
18
  //# sourceMappingURL=GetVersionCommand.d.ts.map
@@ -24,6 +24,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  const chalk_1 = __importDefault(require("chalk"));
25
25
  const BaseCommand_1 = __importDefault(require("../BaseCommand"));
26
26
  const core_1 = require("@memlab/core");
27
+ const api_1 = require("@memlab/api");
28
+ const core_2 = require("@memlab/core");
29
+ const heap_analysis_1 = require("@memlab/heap-analysis");
30
+ const e2e_1 = require("@memlab/e2e");
27
31
  class GetVersionCommand extends BaseCommand_1.default {
28
32
  getCommandName() {
29
33
  return 'version';
@@ -31,10 +35,25 @@ class GetVersionCommand extends BaseCommand_1.default {
31
35
  getDescription() {
32
36
  return 'Show the versions of all memlab packages installed';
33
37
  }
38
+ loadDepencyPackageInfo() {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ // require all sub-packages to register package information
41
+ // memlab and cli packages already registered in the bin file
42
+ // the following sub-packages are registered here lazily to
43
+ // avoid too many file operations
44
+ return Promise.all([
45
+ (0, api_1.registerPackage)(),
46
+ (0, core_2.registerPackage)(),
47
+ (0, heap_analysis_1.registerPackage)(),
48
+ (0, e2e_1.registerPackage)(),
49
+ ]);
50
+ });
51
+ }
34
52
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
53
  run(options) {
36
54
  return __awaiter(this, void 0, void 0, function* () {
37
- const packages = core_1.config._packageInfo;
55
+ yield this.loadDepencyPackageInfo();
56
+ const packages = core_1.config.packageInfo;
38
57
  core_1.info.topLevel('');
39
58
  for (const pkg of packages) {
40
59
  const version = chalk_1.default.grey(`@${pkg.version}`);
@@ -58,6 +58,8 @@ const LogTraceAsClusterOption_1 = __importDefault(require("../../options/heap/Lo
58
58
  const CleanLoggerDataCommand_1 = __importDefault(require("../CleanLoggerDataCommand"));
59
59
  const LeakFilterFileOption_1 = __importDefault(require("../../options/heap/leak-filter/LeakFilterFileOption"));
60
60
  const LeakClusterSizeThresholdOption_1 = __importDefault(require("../../options/heap/LeakClusterSizeThresholdOption"));
61
+ const MLClusteringOption_1 = __importDefault(require("../../options/MLClusteringOption"));
62
+ const MLClusteringLinkageMaxDistanceOption_1 = __importDefault(require("../../options/MLClusteringLinkageMaxDistanceOption"));
61
63
  class CheckLeakCommand extends BaseCommand_1.default {
62
64
  getCommandName() {
63
65
  return 'find-leaks';
@@ -83,6 +85,8 @@ class CheckLeakCommand extends BaseCommand_1.default {
83
85
  new LeakClusterSizeThresholdOption_1.default(),
84
86
  new TraceAllObjectsOption_1.default(),
85
87
  new LogTraceAsClusterOption_1.default(),
88
+ new MLClusteringOption_1.default(),
89
+ new MLClusteringLinkageMaxDistanceOption_1.default(),
86
90
  ];
87
91
  }
88
92
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @emails oncall+ws_labs
8
+ * @format
9
+ */
10
+ import type { ParsedArgs } from 'minimist';
11
+ import { MemLabConfig } from '@memlab/core';
12
+ import { BaseOption } from '@memlab/core';
13
+ export default class MLClusteringLinkageMaxDistanceOption extends BaseOption {
14
+ getOptionName(): string;
15
+ getDescription(): string;
16
+ parse(config: MemLabConfig, args: ParsedArgs): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=MLClusteringLinkageMaxDistanceOption.d.ts.map
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const core_1 = require("@memlab/core");
22
+ const core_2 = require("@memlab/core");
23
+ class MLClusteringLinkageMaxDistanceOption extends core_2.BaseOption {
24
+ getOptionName() {
25
+ return 'ml-linkage-max-dist';
26
+ }
27
+ getDescription() {
28
+ return 'set linkage max distance value for clustering. The value should be between [0, 1] inclusive.';
29
+ }
30
+ parse(config, args) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ if (args['ml-linkage-max-dist']) {
33
+ const linkageMaxDist = args['ml-linkage-max-dist'];
34
+ const linkageMaxDistNum = parseFloat(linkageMaxDist);
35
+ if (!isNaN(linkageMaxDistNum) &&
36
+ linkageMaxDistNum >= 0 &&
37
+ linkageMaxDistNum <= 1) {
38
+ config.mlClusteringLinkageMaxDistance = linkageMaxDistNum;
39
+ }
40
+ else {
41
+ core_1.utils.haltOrThrow(`ml-linkage-max-dist is not number between [0, 1]. ml-linkage-max-dist=${linkageMaxDist}`);
42
+ }
43
+ }
44
+ });
45
+ }
46
+ }
47
+ exports.default = MLClusteringLinkageMaxDistanceOption;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @emails oncall+ws_labs
8
+ * @format
9
+ */
10
+ import type { ParsedArgs } from 'minimist';
11
+ import type { MemLabConfig } from '@memlab/core';
12
+ import { BaseOption } from '@memlab/core';
13
+ export default class MLClusteringOption extends BaseOption {
14
+ getOptionName(): string;
15
+ getDescription(): string;
16
+ parse(config: MemLabConfig, args: ParsedArgs): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=MLClusteringOption.d.ts.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const core_1 = require("@memlab/core");
22
+ class MLClusteringOption extends core_1.BaseOption {
23
+ getOptionName() {
24
+ return 'ml-clustering';
25
+ }
26
+ getDescription() {
27
+ return 'use machine learning algorithms for clustering leak traces (by default, traces are clustered by heuristics)';
28
+ }
29
+ parse(config, args) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ if (args['ml-clustering']) {
32
+ config.isMLClustering = true;
33
+ }
34
+ });
35
+ }
36
+ }
37
+ exports.default = MLClusteringOption;
@@ -5,7 +5,6 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
- * @emails oncall+ws_labs
9
8
  * @format
10
9
  * @oncall ws_labs
11
10
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memlab/cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "license": "MIT",
5
5
  "description": "command line interface for memlab",
6
6
  "author": "Liang Gong <lgong@fb.com>",
@@ -24,10 +24,10 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@memlab/api": "^1.0.0",
28
- "@memlab/core": "^1.1.5",
29
- "@memlab/e2e": "^1.0.0",
30
- "@memlab/heap-analysis": "^1.0.0",
27
+ "@memlab/api": "^1.0.6",
28
+ "@memlab/core": "^1.1.6",
29
+ "@memlab/e2e": "^1.0.7",
30
+ "@memlab/heap-analysis": "^1.0.5",
31
31
  "ansi": "^0.3.1",
32
32
  "babar": "^0.2.0",
33
33
  "chalk": "^4.0.0",