@memlab/cli 1.0.23 → 1.0.25

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.
Files changed (52) hide show
  1. package/dist/BaseCommand.d.ts +4 -3
  2. package/dist/BaseCommand.js +11 -1
  3. package/dist/Dispatcher.js +6 -0
  4. package/dist/commands/MemLabRunCommand.d.ts +2 -2
  5. package/dist/commands/RunMeasureCommand.d.ts +2 -2
  6. package/dist/commands/RunMeasureCommand.js +3 -2
  7. package/dist/commands/WarmupAppCommand.d.ts +2 -2
  8. package/dist/commands/WarmupAppCommand.js +2 -0
  9. package/dist/commands/heap/CheckLeakCommand.d.ts +12 -1
  10. package/dist/commands/heap/CheckLeakCommand.js +71 -9
  11. package/dist/commands/heap/DiffLeakCommand.d.ts +13 -2
  12. package/dist/commands/heap/DiffLeakCommand.js +49 -25
  13. package/dist/commands/heap/GetRetainerTraceCommand.d.ts +2 -2
  14. package/dist/commands/heap/HeapAnalysisCommand.d.ts +2 -2
  15. package/dist/commands/heap/interactive/InteractiveHeapCommand.d.ts +2 -2
  16. package/dist/commands/heap/interactive/InteractiveHeapExploreCommand.d.ts +2 -2
  17. package/dist/commands/heap/interactive/ui-components/CliScreen.d.ts +5 -0
  18. package/dist/commands/heap/interactive/ui-components/CliScreen.js +51 -11
  19. package/dist/commands/heap/interactive/ui-components/HeapViewController.d.ts +2 -0
  20. package/dist/commands/heap/interactive/ui-components/HeapViewController.js +5 -1
  21. package/dist/commands/heap/interactive/ui-components/HeapViewUtils.d.ts +2 -0
  22. package/dist/commands/heap/interactive/ui-components/HeapViewUtils.js +25 -21
  23. package/dist/commands/heap/interactive/ui-components/ListComponent.js +2 -1
  24. package/dist/commands/helper/GenerateCLIDocCommand.js +16 -8
  25. package/dist/commands/helper/HelperCommand.d.ts +7 -4
  26. package/dist/commands/helper/HelperCommand.js +34 -27
  27. package/dist/commands/helper/lib/DocUtils.d.ts +19 -0
  28. package/dist/commands/helper/lib/DocUtils.js +39 -0
  29. package/dist/commands/snapshot/TakeSnapshotCommand.d.ts +2 -2
  30. package/dist/commands/snapshot/TakeSnapshotCommand.js +2 -0
  31. package/dist/commands/snapshot/WarmupAndSnapshotCommand.d.ts +3 -1
  32. package/dist/commands/snapshot/WarmupAndSnapshotCommand.js +23 -0
  33. package/dist/lib/CLIUtils.d.ts +22 -0
  34. package/dist/lib/CLIUtils.js +129 -0
  35. package/dist/options/MLClusteringOption.d.ts +1 -0
  36. package/dist/options/MLClusteringOption.js +4 -0
  37. package/dist/options/NumberOfRunsOption.d.ts +4 -2
  38. package/dist/options/NumberOfRunsOption.js +12 -4
  39. package/dist/options/SetMaxClusterSampleSizeOption.d.ts +19 -0
  40. package/dist/options/SetMaxClusterSampleSizeOption.js +49 -0
  41. package/dist/options/e2e/SetChromiumBinaryOption.d.ts +18 -0
  42. package/dist/options/e2e/SetChromiumBinaryOption.js +43 -0
  43. package/dist/options/experiment/SetControlWorkDirOption.d.ts +3 -2
  44. package/dist/options/experiment/SetControlWorkDirOption.js +25 -6
  45. package/dist/options/experiment/SetTreatmentWorkDirOption.js +6 -0
  46. package/dist/options/heap/SetTraceContainsFilterOption.d.ts +18 -0
  47. package/dist/options/heap/SetTraceContainsFilterOption.js +42 -0
  48. package/dist/options/heap/TraceAllObjectsOption.d.ts +4 -2
  49. package/dist/options/heap/TraceAllObjectsOption.js +32 -4
  50. package/dist/options/lib/OptionConstant.d.ts +6 -0
  51. package/dist/options/lib/OptionConstant.js +3 -0
  52. package/package.json +1 -1
@@ -7,7 +7,7 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import type { CLIOptions, Nullable } from '@memlab/core';
10
+ import type { CLIOptions, CommandOptionExample, Nullable, Optional } from '@memlab/core';
11
11
  import { BaseOption } from '@memlab/core';
12
12
  export declare enum CommandCategory {
13
13
  COMMON = "COMMON",
@@ -24,14 +24,15 @@ declare abstract class Command {
24
24
  }
25
25
  export default class BaseCommand extends Command {
26
26
  getCommandName(): string;
27
- getExamples(): string[];
27
+ getExamples(): CommandOptionExample[];
28
28
  getCategory(): CommandCategory;
29
29
  getDescription(): string;
30
+ getDocumenation(): string;
30
31
  getPrerequisites(): BaseCommand[];
31
32
  isInternalCommand(): boolean;
32
33
  getOptions(): BaseOption[];
33
34
  getExcludedOptions(): BaseOption[];
34
- getSubCommands(): BaseCommand[];
35
+ getSubCommands(): Optional<BaseCommand[]>;
35
36
  run(_options: CLIOptions): Promise<void>;
36
37
  }
37
38
  export {};
@@ -85,7 +85,7 @@ class BaseCommand extends Command {
85
85
  const className = this.constructor.name;
86
86
  throw new Error(`${className}.getCommandName is not implemented`);
87
87
  }
88
- // get a list of examples
88
+ // get a list of CLI option examples
89
89
  // examples will be displayed in helper text
90
90
  getExamples() {
91
91
  return [];
@@ -101,6 +101,12 @@ class BaseCommand extends Command {
101
101
  const className = this.constructor.name;
102
102
  throw new Error(`${className}.getDescription is not implemented`);
103
103
  }
104
+ // More detailed description or documentation about this command.
105
+ // This will be printed as helper text in CLI for a specific command.
106
+ // Documentation generator will also use the description returned here.
107
+ getDocumenation() {
108
+ return '';
109
+ }
104
110
  // get a sequence of commands that must be executed before
105
111
  // running this command
106
112
  getPrerequisites() {
@@ -125,6 +131,10 @@ class BaseCommand extends Command {
125
131
  // for example command 'A' has two sub-commands 'B' and 'C'
126
132
  // CLI supports running in terminal: `memlab A B` or `memlab A C`
127
133
  // The parent command will be executed before its subcommands
134
+ //
135
+ // If this callback returns null or undefined, it means
136
+ // the command will handle the dispatcher won't try to match and process
137
+ // the subcommands (the command will handle sub-commands by itself).
128
138
  getSubCommands() {
129
139
  return [];
130
140
  }
@@ -107,6 +107,8 @@ class CommandDispatcher {
107
107
  const { configFromOptions } = runCmdOpt;
108
108
  // execute command
109
109
  yield command.run({ cliArgs: args, configFromOptions });
110
+ // recommand CLI command and flags
111
+ core_1.config.setRunInfo('command', process.argv.slice(2).join(' '));
110
112
  if (runCmdOpt.isPrerequisite !== true) {
111
113
  // execute subcommands
112
114
  const commandIndex = ((_a = runCmdOpt.commandIndex) !== null && _a !== void 0 ? _a : 0) + 1;
@@ -125,6 +127,10 @@ class CommandDispatcher {
125
127
  return;
126
128
  }
127
129
  const subCommands = command.getSubCommands();
130
+ // if the command will handle the sub-commands by itself
131
+ if (subCommands == null) {
132
+ return;
133
+ }
128
134
  for (const subCommand of subCommands) {
129
135
  if (subCommand.getCommandName() === args._[subCommandIndex]) {
130
136
  yield this.runCommand(subCommand, args, runCmdOpt);
@@ -7,12 +7,12 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import type { BaseOption, CLIOptions } from '@memlab/core';
10
+ import type { BaseOption, CLIOptions, CommandOptionExample } from '@memlab/core';
11
11
  import BaseCommand, { CommandCategory } from '../BaseCommand';
12
12
  export default class MemLabRunCommand extends BaseCommand {
13
13
  getCommandName(): string;
14
14
  getDescription(): string;
15
- getExamples(): string[];
15
+ getExamples(): CommandOptionExample[];
16
16
  getPrerequisites(): BaseCommand[];
17
17
  getOptions(): BaseOption[];
18
18
  getExcludedOptions(): BaseOption[];
@@ -7,14 +7,14 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import type { CLIOptions } from '@memlab/core';
10
+ import type { CLIOptions, CommandOptionExample } from '@memlab/core';
11
11
  import BaseCommand from '../BaseCommand';
12
12
  import { BaseOption } from '@memlab/core';
13
13
  export default class RunMeasureCommand extends BaseCommand {
14
14
  getCommandName(): string;
15
15
  getDescription(): string;
16
16
  getPrerequisites(): BaseCommand[];
17
- getExamples(): string[];
17
+ getExamples(): CommandOptionExample[];
18
18
  getOptions(): BaseOption[];
19
19
  run(options: CLIOptions): Promise<void>;
20
20
  }
@@ -45,6 +45,7 @@ const HeadfulBrowserOption_1 = __importDefault(require("../options/e2e/HeadfulBr
45
45
  const DisableWebSecurityOption_1 = __importDefault(require("../options/e2e/DisableWebSecurityOption"));
46
46
  const EnableJSRewriteOption_1 = __importDefault(require("../options/e2e/EnableJSRewriteOption"));
47
47
  const EnableJSInterceptOption_1 = __importDefault(require("../options/e2e/EnableJSInterceptOption"));
48
+ const SetChromiumBinaryOption_1 = __importDefault(require("../options/e2e/SetChromiumBinaryOption"));
48
49
  class RunMeasureCommand extends BaseCommand_1.default {
49
50
  getCommandName() {
50
51
  return 'measure';
@@ -77,6 +78,7 @@ class RunMeasureCommand extends BaseCommand_1.default {
77
78
  new RunningModeOption_1.default(),
78
79
  new RemoteBrowserDebugOption_1.default(),
79
80
  new ScenarioFileOption_1.default(),
81
+ new SetChromiumBinaryOption_1.default(),
80
82
  new SetDeviceOption_1.default(),
81
83
  new SetUserAgentOption_1.default(),
82
84
  new DisableXvfbOption_1.default(),
@@ -86,9 +88,8 @@ class RunMeasureCommand extends BaseCommand_1.default {
86
88
  ];
87
89
  }
88
90
  run(options) {
89
- var _a, _b;
90
91
  return __awaiter(this, void 0, void 0, function* () {
91
- const numRuns = (_b = (_a = options.configFromOptions) === null || _a === void 0 ? void 0 : _a.numOfRuns) !== null && _b !== void 0 ? _b : NumberOfRunsOption_1.default.DEFAULT_NUM_RUNS;
92
+ const numRuns = NumberOfRunsOption_1.default.getParsedOption(options.configFromOptions);
92
93
  core_1.config.runningMode = core_1.modes.get('measure', core_1.config);
93
94
  for (let i = 0; i < numRuns; ++i) {
94
95
  yield (0, Snapshot_1.runPageInteractionFromCLI)();
@@ -7,14 +7,14 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import type { CLIOptions } from '@memlab/core';
10
+ import type { CLIOptions, CommandOptionExample } from '@memlab/core';
11
11
  import { BaseOption } from '@memlab/core';
12
12
  import BaseCommand from '../BaseCommand';
13
13
  export default class FBWarmupAppCommand extends BaseCommand {
14
14
  getCommandName(): string;
15
15
  getDescription(): string;
16
16
  getPrerequisites(): BaseCommand[];
17
- getExamples(): string[];
17
+ getExamples(): CommandOptionExample[];
18
18
  getOptions(): BaseOption[];
19
19
  run(_options: CLIOptions): Promise<void>;
20
20
  }
@@ -38,6 +38,7 @@ const HeadfulBrowserOption_1 = __importDefault(require("../options/e2e/HeadfulBr
38
38
  const DisableWebSecurityOption_1 = __importDefault(require("../options/e2e/DisableWebSecurityOption"));
39
39
  const EnableJSRewriteOption_1 = __importDefault(require("../options/e2e/EnableJSRewriteOption"));
40
40
  const EnableJSInterceptOption_1 = __importDefault(require("../options/e2e/EnableJSInterceptOption"));
41
+ const SetChromiumBinaryOption_1 = __importDefault(require("../options/e2e/SetChromiumBinaryOption"));
41
42
  class FBWarmupAppCommand extends BaseCommand_1.default {
42
43
  getCommandName() {
43
44
  return 'warmup';
@@ -62,6 +63,7 @@ class FBWarmupAppCommand extends BaseCommand_1.default {
62
63
  new RunningModeOption_1.default(),
63
64
  new RemoteBrowserDebugOption_1.default(),
64
65
  new ScenarioFileOption_1.default(),
66
+ new SetChromiumBinaryOption_1.default(),
65
67
  new SetDeviceOption_1.default(),
66
68
  new SetUserAgentOption_1.default(),
67
69
  new DisableXvfbOption_1.default(),
@@ -7,11 +7,22 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import type { BaseOption, CLIOptions } from '@memlab/core';
10
+ import type { ParsedArgs } from 'minimist';
11
+ import type { BaseOption, CLIOptions, CommandOptionExample } from '@memlab/core';
11
12
  import BaseCommand, { CommandCategory } from '../../BaseCommand';
13
+ export declare type CheckLeakCommandOptions = {
14
+ isMLClustering?: boolean;
15
+ };
12
16
  export default class CheckLeakCommand extends BaseCommand {
17
+ private isMLClustering;
18
+ private isMLClusteringSettingCache;
19
+ protected useDefaultMLClusteringSetting(cliArgs: ParsedArgs): void;
20
+ protected restoreDefaultMLClusteringSetting(cliArgs: ParsedArgs): void;
21
+ constructor(options?: CheckLeakCommandOptions);
13
22
  getCommandName(): string;
23
+ getExamples(): CommandOptionExample[];
14
24
  getDescription(): string;
25
+ getDocumenation(): string;
15
26
  getCategory(): CommandCategory;
16
27
  getPrerequisites(): BaseCommand[];
17
28
  getOptions(): BaseOption[];
@@ -1,13 +1,4 @@
1
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
- * @format
9
- * @oncall web_perf_infra
10
- */
11
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
3
  if (k2 === undefined) k2 = k;
13
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -63,13 +54,77 @@ const MLClusteringLinkageMaxDistanceOption_1 = __importDefault(require("../../op
63
54
  const MLClusteringMaxDFOption_1 = __importDefault(require("../../options/MLClusteringMaxDFOption"));
64
55
  const CleanupSnapshotOption_1 = __importDefault(require("../../options/heap/CleanupSnapshotOption"));
65
56
  const SetWorkingDirectoryOption_1 = __importDefault(require("../../options/SetWorkingDirectoryOption"));
57
+ const OptionConstant_1 = __importDefault(require("../../options/lib/OptionConstant"));
66
58
  class CheckLeakCommand extends BaseCommand_1.default {
59
+ constructor(options = {}) {
60
+ super();
61
+ this.isMLClustering = false;
62
+ this.isMLClusteringSettingCache = false;
63
+ this.isMLClustering = !!(options === null || options === void 0 ? void 0 : options.isMLClustering);
64
+ }
65
+ useDefaultMLClusteringSetting(cliArgs) {
66
+ if (!MLClusteringOption_1.default.hasOptionSet(cliArgs)) {
67
+ core_1.config.isMLClustering = this.isMLClustering;
68
+ this.isMLClusteringSettingCache = core_1.config.isMLClustering;
69
+ }
70
+ }
71
+ restoreDefaultMLClusteringSetting(cliArgs) {
72
+ if (!MLClusteringOption_1.default.hasOptionSet(cliArgs)) {
73
+ core_1.config.isMLClustering = this.isMLClusteringSettingCache;
74
+ }
75
+ }
67
76
  getCommandName() {
68
77
  return 'find-leaks';
69
78
  }
79
+ getExamples() {
80
+ const optionNames = OptionConstant_1.default.optionNames;
81
+ const workDirOption = `--${optionNames.WORK_DIR}`;
82
+ const snapshotDirOption = `--${optionNames.SNAPSHOT_DIR}`;
83
+ const baselineOption = `--${optionNames.BASELINE}`;
84
+ const targetOption = `--${optionNames.TARGET}`;
85
+ const finalOption = `--${optionNames.FINAL}`;
86
+ return [
87
+ {
88
+ description: 'check memory leaks in the default working directory generated by\n' +
89
+ `memlab run (without setting the ${workDirOption} option)`,
90
+ cliOptionExample: '', // default empty command options
91
+ },
92
+ {
93
+ description: 'specify the baseline, target, and final heap snapshot file path separately',
94
+ cliOptionExample: `${baselineOption} /tmp/baseline.heapsnapshot ${targetOption} /tmp/target.heapsnapshot ${finalOption} /tmp/final.heapsnapshot`,
95
+ },
96
+ {
97
+ description: 'specifies the directory that holds all three heap snapshot files',
98
+ cliOptionExample: `${snapshotDirOption} /dir/containing/heapsnapshot/files/`,
99
+ },
100
+ {
101
+ description: 'specifies the output working directory of the `memlab run` or the `memlab snapshot` command',
102
+ cliOptionExample: `${workDirOption} /memlab/working/dir/generated/by/memlab/`,
103
+ },
104
+ ];
105
+ }
70
106
  getDescription() {
71
107
  return 'find memory leaks in heap snapshots';
72
108
  }
109
+ getDocumenation() {
110
+ const optionNames = OptionConstant_1.default.optionNames;
111
+ const workDirOption = `--${optionNames.WORK_DIR}`;
112
+ const snapshotDirOption = `--${optionNames.SNAPSHOT_DIR}`;
113
+ const baselineOption = `--${optionNames.BASELINE}`;
114
+ const targetOption = `--${optionNames.TARGET}`;
115
+ const finalOption = `--${optionNames.FINAL}`;
116
+ return `There are three ways to specify inputs for the \`memlab ${this.getCommandName()}\` command:
117
+ 1. \`${baselineOption}\`, \`${targetOption}\`, \`${finalOption}\` specifies each heap snapshot input individually;
118
+ 2. \`${snapshotDirOption}\` specifies the directory that holds all three heap snapshot files (MemLab will assign baseline, target, and final based on alphabetic order of the file);
119
+ 3. \`${workDirOption}\` specifies the output working directory of the \`memlab run\` or the \`memlab snapshot\` command;
120
+
121
+ Please only use one of the three ways to specify the input.
122
+
123
+ You can also manually take heap snapshots in Chrome Devtools, save them to disk.
124
+ Then process them using this command with the CLI flags (either option 1
125
+ or option 2 mentioned above).
126
+ `;
127
+ }
73
128
  getCategory() {
74
129
  return BaseCommand_1.CommandCategory.COMMON;
75
130
  }
@@ -100,8 +155,15 @@ class CheckLeakCommand extends BaseCommand_1.default {
100
155
  return __awaiter(this, void 0, void 0, function* () {
101
156
  const workDir = (_a = options.configFromOptions) === null || _a === void 0 ? void 0 : _a.workDir;
102
157
  core_1.fileManager.initDirs(core_1.config, { workDir });
158
+ const { runMetaInfoManager } = core_1.runInfoUtils;
159
+ runMetaInfoManager.setConfigFromRunMeta({
160
+ workDir,
161
+ silentFail: true,
162
+ });
103
163
  core_1.config.chaseWeakMapEdge = false;
164
+ this.useDefaultMLClusteringSetting(options.cliArgs);
104
165
  yield core_1.analysis.checkLeak();
166
+ this.restoreDefaultMLClusteringSetting(options.cliArgs);
105
167
  const configFromOptions = (_b = options.configFromOptions) !== null && _b !== void 0 ? _b : {};
106
168
  if (configFromOptions['cleanUpSnapshot']) {
107
169
  core_1.fileManager.removeSnapshotFiles();
@@ -7,15 +7,26 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import { CLIOptions } from '@memlab/core';
10
+ import type { ParsedArgs } from 'minimist';
11
+ import { BaseOption, CLIOptions } from '@memlab/core';
12
+ import type { CheckLeakCommandOptions } from './CheckLeakCommand';
11
13
  import BaseCommand, { CommandCategory } from '../../BaseCommand';
12
- import { BaseOption } from '@memlab/core';
14
+ export declare type WorkDirSettings = {
15
+ controlWorkDirs: Array<string>;
16
+ treatmentWorkDir: string;
17
+ };
13
18
  export default class CheckLeakCommand extends BaseCommand {
19
+ private isMLClustering;
20
+ private isMLClusteringSettingCache;
21
+ protected useDefaultMLClusteringSetting(cliArgs: ParsedArgs): void;
22
+ protected restoreDefaultMLClusteringSetting(cliArgs: ParsedArgs): void;
23
+ constructor(options?: CheckLeakCommandOptions);
14
24
  getCommandName(): string;
15
25
  getDescription(): string;
16
26
  getCategory(): CommandCategory;
17
27
  getPrerequisites(): BaseCommand[];
18
28
  getOptions(): BaseOption[];
29
+ protected getWorkDirs(options: CLIOptions): WorkDirSettings;
19
30
  run(options: CLIOptions): Promise<void>;
20
31
  }
21
32
  //# sourceMappingURL=DiffLeakCommand.d.ts.map
@@ -1,13 +1,4 @@
1
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
- * @format
9
- * @oncall web_perf_infra
10
- */
11
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
3
  if (k2 === undefined) k2 = k;
13
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -45,9 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
45
36
  };
46
37
  Object.defineProperty(exports, "__esModule", { value: true });
47
38
  const core_1 = require("@memlab/core");
48
- const core_2 = require("@memlab/core");
49
39
  const BaseCommand_1 = __importStar(require("../../BaseCommand"));
50
- const core_3 = require("@memlab/core");
51
40
  const JSEngineOption_1 = __importDefault(require("../../options/heap/JSEngineOption"));
52
41
  const InitDirectoryCommand_1 = __importDefault(require("../InitDirectoryCommand"));
53
42
  const OversizeThresholdOption_1 = __importDefault(require("../../options/heap/OversizeThresholdOption"));
@@ -61,7 +50,26 @@ const MLClusteringLinkageMaxDistanceOption_1 = __importDefault(require("../../op
61
50
  const MLClusteringMaxDFOption_1 = __importDefault(require("../../options/MLClusteringMaxDFOption"));
62
51
  const SetControlWorkDirOption_1 = __importDefault(require("../../options/experiment/SetControlWorkDirOption"));
63
52
  const SetTreatmentWorkDirOption_1 = __importDefault(require("../../options/experiment/SetTreatmentWorkDirOption"));
53
+ const SetMaxClusterSampleSizeOption_1 = __importDefault(require("../../options/SetMaxClusterSampleSizeOption"));
54
+ const SetTraceContainsFilterOption_1 = __importDefault(require("../../options/heap/SetTraceContainsFilterOption"));
64
55
  class CheckLeakCommand extends BaseCommand_1.default {
56
+ constructor(options = {}) {
57
+ super();
58
+ this.isMLClustering = false;
59
+ this.isMLClusteringSettingCache = false;
60
+ this.isMLClustering = !!(options === null || options === void 0 ? void 0 : options.isMLClustering);
61
+ }
62
+ useDefaultMLClusteringSetting(cliArgs) {
63
+ if (!MLClusteringOption_1.default.hasOptionSet(cliArgs)) {
64
+ core_1.config.isMLClustering = this.isMLClustering;
65
+ this.isMLClusteringSettingCache = core_1.config.isMLClustering;
66
+ }
67
+ }
68
+ restoreDefaultMLClusteringSetting(cliArgs) {
69
+ if (!MLClusteringOption_1.default.hasOptionSet(cliArgs)) {
70
+ core_1.config.isMLClustering = this.isMLClusteringSettingCache;
71
+ }
72
+ }
65
73
  getCommandName() {
66
74
  return 'diff-leaks';
67
75
  }
@@ -76,8 +84,8 @@ class CheckLeakCommand extends BaseCommand_1.default {
76
84
  }
77
85
  getOptions() {
78
86
  return [
79
- new SetControlWorkDirOption_1.default().required(),
80
- new SetTreatmentWorkDirOption_1.default().required(),
87
+ new SetControlWorkDirOption_1.default(),
88
+ new SetTreatmentWorkDirOption_1.default(),
81
89
  new JSEngineOption_1.default(),
82
90
  new LeakFilterFileOption_1.default(),
83
91
  new OversizeThresholdOption_1.default(),
@@ -87,23 +95,39 @@ class CheckLeakCommand extends BaseCommand_1.default {
87
95
  new MLClusteringOption_1.default(),
88
96
  new MLClusteringLinkageMaxDistanceOption_1.default(),
89
97
  new MLClusteringMaxDFOption_1.default(),
98
+ new SetMaxClusterSampleSizeOption_1.default(),
99
+ new SetTraceContainsFilterOption_1.default(),
90
100
  ];
91
101
  }
92
- run(options) {
102
+ getWorkDirs(options) {
93
103
  var _a, _b;
104
+ // double check parameters
105
+ if (!((_a = options.configFromOptions) === null || _a === void 0 ? void 0 : _a.controlWorkDirs) ||
106
+ !((_b = options.configFromOptions) === null || _b === void 0 ? void 0 : _b.treatmentWorkDir)) {
107
+ core_1.info.error('Please specify control and test working directory');
108
+ throw core_1.utils.haltOrThrow('No control or test working directory specified');
109
+ }
110
+ // get parameters
111
+ const controlWorkDirs = options.configFromOptions['controlWorkDirs'];
112
+ const treatmentWorkDir = options.configFromOptions['treatmentWorkDir'];
113
+ return {
114
+ controlWorkDirs,
115
+ treatmentWorkDir,
116
+ };
117
+ }
118
+ run(options) {
94
119
  return __awaiter(this, void 0, void 0, function* () {
95
- core_3.config.chaseWeakMapEdge = false;
96
- // double check parameters
97
- if (!((_a = options.configFromOptions) === null || _a === void 0 ? void 0 : _a.controlWorkDir) ||
98
- !((_b = options.configFromOptions) === null || _b === void 0 ? void 0 : _b.treatmentWorkDir)) {
99
- core_2.info.error('Please specify control and test working directory');
100
- throw core_1.utils.haltOrThrow('No control or test working directory specified');
101
- }
102
- // get parameters
103
- const controlWorkDir = options.configFromOptions['controlWorkDir'];
104
- const treatmentWorkDir = options.configFromOptions['treatmentWorkDir'];
120
+ core_1.config.chaseWeakMapEdge = false;
121
+ const { controlWorkDirs, treatmentWorkDir } = this.getWorkDirs(options);
122
+ const { runMetaInfoManager } = core_1.runInfoUtils;
123
+ runMetaInfoManager.setConfigFromRunMeta({
124
+ workDir: treatmentWorkDir,
125
+ silentFail: true,
126
+ });
105
127
  // diff memory leaks
106
- yield core_3.analysis.diffLeakByWorkDir({ controlWorkDir, treatmentWorkDir });
128
+ this.useDefaultMLClusteringSetting(options.cliArgs);
129
+ yield core_1.analysis.diffLeakByWorkDir({ controlWorkDirs, treatmentWorkDir });
130
+ this.restoreDefaultMLClusteringSetting(options.cliArgs);
107
131
  });
108
132
  }
109
133
  }
@@ -7,14 +7,14 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import type { CLIOptions } from '@memlab/core';
10
+ import type { CLIOptions, CommandOptionExample } from '@memlab/core';
11
11
  import BaseCommand, { CommandCategory } from '../../BaseCommand';
12
12
  import { BaseOption } from '@memlab/core';
13
13
  export default class GetRetainerTraceCommand extends BaseCommand {
14
14
  getCommandName(): string;
15
15
  getDescription(): string;
16
16
  getCategory(): CommandCategory;
17
- getExamples(): string[];
17
+ getExamples(): CommandOptionExample[];
18
18
  getOptions(): BaseOption[];
19
19
  run(options: CLIOptions): Promise<void>;
20
20
  }
@@ -7,7 +7,7 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import type { CLIOptions } from '@memlab/core';
10
+ import type { CLIOptions, CommandOptionExample } from '@memlab/core';
11
11
  import BaseCommand, { CommandCategory } from '../../BaseCommand';
12
12
  export default class RunHeapAnalysisCommand extends BaseCommand {
13
13
  getCommandName(): string;
@@ -15,7 +15,7 @@ export default class RunHeapAnalysisCommand extends BaseCommand {
15
15
  getCategory(): CommandCategory;
16
16
  getPrerequisites(): BaseCommand[];
17
17
  getSubCommands(): BaseCommand[];
18
- getExamples(): string[];
18
+ getExamples(): CommandOptionExample[];
19
19
  run(options: CLIOptions): Promise<void>;
20
20
  }
21
21
  //# sourceMappingURL=HeapAnalysisCommand.d.ts.map
@@ -7,14 +7,14 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import { CLIOptions } from '@memlab/core';
10
+ import { CLIOptions, CommandOptionExample } from '@memlab/core';
11
11
  import BaseCommand, { CommandCategory } from '../../../BaseCommand';
12
12
  import { BaseOption } from '@memlab/core';
13
13
  export default class InteractiveHeapCommand extends BaseCommand {
14
14
  getCommandName(): string;
15
15
  getDescription(): string;
16
16
  getCategory(): CommandCategory;
17
- getExamples(): string[];
17
+ getExamples(): CommandOptionExample[];
18
18
  getOptions(): BaseOption[];
19
19
  private exitAttempt;
20
20
  private printPromptInfo;
@@ -7,13 +7,13 @@
7
7
  * @format
8
8
  * @oncall web_perf_infra
9
9
  */
10
- import type { BaseOption, CLIOptions } from '@memlab/core';
10
+ import type { BaseOption, CLIOptions, CommandOptionExample } from '@memlab/core';
11
11
  import BaseCommand, { CommandCategory } from '../../../BaseCommand';
12
12
  export default class InteractiveHeapViewCommand extends BaseCommand {
13
13
  getCommandName(): string;
14
14
  getDescription(): string;
15
15
  getCategory(): CommandCategory;
16
- getExamples(): string[];
16
+ getExamples(): CommandOptionExample[];
17
17
  getOptions(): BaseOption[];
18
18
  private getHeap;
19
19
  private getNodesToFocus;
@@ -12,6 +12,7 @@ export default class CliScreen {
12
12
  private currentFocuseKey;
13
13
  private keyToComponent;
14
14
  private heapController;
15
+ private fullScreenComponent;
15
16
  constructor(title: string, heap: IHeapSnapshot, objectCategory: Map<string, ComponentDataItem[]>);
16
17
  private setFirstObjectAsCurrrent;
17
18
  private initScreen;
@@ -19,9 +20,12 @@ export default class CliScreen {
19
20
  start(): void;
20
21
  private registerEvents;
21
22
  private registerScreenResize;
23
+ private updateAllComponentsSize;
22
24
  private updateComponentSize;
23
25
  private updateElementSize;
24
26
  private registerKeys;
27
+ private makeComponentFullScreen;
28
+ private makeNoComponentFullScreen;
25
29
  private addComponentToFocusKeyMap;
26
30
  private getNextFocusKey;
27
31
  private initClusteredObjectBox;
@@ -29,6 +33,7 @@ export default class CliScreen {
29
33
  private initReferrerBox;
30
34
  private getReferrerBoxSize;
31
35
  private initObjectBox;
36
+ private getComponentFullScreenSize;
32
37
  private getObjectBoxSize;
33
38
  private initObjectPropertyBox;
34
39
  private getObjectPropertyBoxSize;