@memlab/cli 1.0.13 → 1.0.15
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/LICENSE +21 -0
- package/bin/preinstall +23 -0
- package/dist/commands/MemLabRunCommand.js +4 -4
- package/dist/commands/RunMeasureCommand.js +16 -14
- package/dist/commands/WarmupAppCommand.js +11 -9
- package/dist/commands/heap/GetRetainerTraceCommand.js +1 -1
- package/dist/commands/heap/interactive/InteractiveHeapExploreCommand.js +1 -1
- package/dist/commands/heap/interactive/ui-components/CliScreen.js +9 -4
- package/dist/commands/helper/HelperCommand.d.ts +1 -0
- package/dist/commands/helper/HelperCommand.js +18 -3
- package/dist/commands/snapshot/TakeSnapshotCommand.js +16 -14
- package/dist/options/{AppOption.d.ts → e2e/AppOption.d.ts} +0 -0
- package/dist/options/{AppOption.js → e2e/AppOption.js} +0 -0
- package/dist/options/{DisableXvfbOption.d.ts → e2e/DisableXvfbOption.d.ts} +0 -0
- package/dist/options/{DisableXvfbOption.js → e2e/DisableXvfbOption.js} +0 -0
- package/dist/options/{FullExecutionOption.d.ts → e2e/FullExecutionOption.d.ts} +0 -0
- package/dist/options/{FullExecutionOption.js → e2e/FullExecutionOption.js} +0 -0
- package/dist/options/{HeadfulBrowserOption.d.ts → e2e/HeadfulBrowserOption.d.ts} +0 -0
- package/dist/options/{HeadfulBrowserOption.js → e2e/HeadfulBrowserOption.js} +0 -0
- package/dist/options/{InteractionOption.d.ts → e2e/InteractionOption.d.ts} +0 -0
- package/dist/options/{InteractionOption.js → e2e/InteractionOption.js} +0 -0
- package/dist/options/{RemoteBrowserDebugOption.d.ts → e2e/RemoteBrowserDebugOption.d.ts} +0 -0
- package/dist/options/{RemoteBrowserDebugOption.js → e2e/RemoteBrowserDebugOption.js} +0 -0
- package/dist/options/{RunningModeOption.d.ts → e2e/RunningModeOption.d.ts} +0 -0
- package/dist/options/{RunningModeOption.js → e2e/RunningModeOption.js} +0 -0
- package/dist/options/{ScenarioFileOption.d.ts → e2e/ScenarioFileOption.d.ts} +0 -0
- package/dist/options/{ScenarioFileOption.js → e2e/ScenarioFileOption.js} +0 -0
- package/dist/options/{SetDeviceOption.d.ts → e2e/SetDeviceOption.d.ts} +0 -0
- package/dist/options/{SetDeviceOption.js → e2e/SetDeviceOption.js} +0 -0
- package/dist/options/e2e/SetUserAgentOption.d.ts +19 -0
- package/dist/options/e2e/SetUserAgentOption.js +42 -0
- package/dist/options/{SkipExtraOperationOption.d.ts → e2e/SkipExtraOperationOption.d.ts} +0 -0
- package/dist/options/{SkipExtraOperationOption.js → e2e/SkipExtraOperationOption.js} +0 -0
- package/dist/options/{SkipGCOption.d.ts → e2e/SkipGCOption.d.ts} +0 -0
- package/dist/options/{SkipGCOption.js → e2e/SkipGCOption.js} +0 -0
- package/dist/options/{SkipScreenshotOption.d.ts → e2e/SkipScreenshotOption.d.ts} +0 -0
- package/dist/options/{SkipScreenshotOption.js → e2e/SkipScreenshotOption.js} +0 -0
- package/dist/options/{SkipScrollOption.d.ts → e2e/SkipScrollOption.d.ts} +0 -0
- package/dist/options/{SkipScrollOption.js → e2e/SkipScrollOption.js} +0 -0
- package/dist/options/{SkipSnapshotOption.d.ts → e2e/SkipSnapshotOption.d.ts} +0 -0
- package/dist/options/{SkipSnapshotOption.js → e2e/SkipSnapshotOption.js} +0 -0
- package/dist/options/{SkipWarmupOption.d.ts → e2e/SkipWarmupOption.d.ts} +0 -0
- package/dist/options/{SkipWarmupOption.js → e2e/SkipWarmupOption.js} +0 -0
- package/dist/options/{HeapNodeIdOption.d.ts → heap/HeapNodeIdOption.d.ts} +0 -0
- package/dist/options/{HeapNodeIdOption.js → heap/HeapNodeIdOption.js} +0 -0
- package/package.json +4 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/preinstall
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @format
|
|
10
|
+
* @oncall ws_labs
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
if (process.platform !== "win32") {
|
|
16
|
+
const memlabFile = path.join(__dirname, "../bin/memlab.js");
|
|
17
|
+
const content = fs.readFileSync(memlabFile, "UTF-8");
|
|
18
|
+
fs.writeFileSync(
|
|
19
|
+
memlabFile,
|
|
20
|
+
content.replace("#!/usr/bin/env node", "#!/usr/bin/env -S node"),
|
|
21
|
+
"UTF-8"
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -52,10 +52,10 @@ const CheckLeakCommand_1 = __importDefault(require("./heap/CheckLeakCommand"));
|
|
|
52
52
|
const InitDirectoryCommand_1 = __importDefault(require("./InitDirectoryCommand"));
|
|
53
53
|
const TakeSnapshotCommand_1 = __importDefault(require("./snapshot/TakeSnapshotCommand"));
|
|
54
54
|
const SetWorkingDirectoryOption_1 = __importDefault(require("../options/SetWorkingDirectoryOption"));
|
|
55
|
-
const AppOption_1 = __importDefault(require("../options/AppOption"));
|
|
56
|
-
const InteractionOption_1 = __importDefault(require("../options/InteractionOption"));
|
|
57
|
-
const SkipSnapshotOption_1 = __importDefault(require("../options/SkipSnapshotOption"));
|
|
58
|
-
const RunningModeOption_1 = __importDefault(require("../options/RunningModeOption"));
|
|
55
|
+
const AppOption_1 = __importDefault(require("../options/e2e/AppOption"));
|
|
56
|
+
const InteractionOption_1 = __importDefault(require("../options/e2e/InteractionOption"));
|
|
57
|
+
const SkipSnapshotOption_1 = __importDefault(require("../options/e2e/SkipSnapshotOption"));
|
|
58
|
+
const RunningModeOption_1 = __importDefault(require("../options/e2e/RunningModeOption"));
|
|
59
59
|
const BaselineFileOption_1 = __importDefault(require("../options/heap/BaselineFileOption"));
|
|
60
60
|
const TargetFileOption_1 = __importDefault(require("../options/heap/TargetFileOption"));
|
|
61
61
|
const FinalFileOption_1 = __importDefault(require("../options/heap/FinalFileOption"));
|
|
@@ -26,21 +26,22 @@ const InitDirectoryCommand_1 = __importDefault(require("./InitDirectoryCommand")
|
|
|
26
26
|
const core_1 = require("@memlab/core");
|
|
27
27
|
const CleanRunDataCommand_1 = __importDefault(require("./CleanRunDataCommand"));
|
|
28
28
|
const Snapshot_1 = require("./snapshot/Snapshot");
|
|
29
|
-
const AppOption_1 = __importDefault(require("../options/AppOption"));
|
|
30
|
-
const FullExecutionOption_1 = __importDefault(require("../options/FullExecutionOption"));
|
|
31
|
-
const InteractionOption_1 = __importDefault(require("../options/InteractionOption"));
|
|
32
|
-
const SkipScreenshotOption_1 = __importDefault(require("../options/SkipScreenshotOption"));
|
|
33
|
-
const SkipSnapshotOption_1 = __importDefault(require("../options/SkipSnapshotOption"));
|
|
34
|
-
const SkipGCOption_1 = __importDefault(require("../options/SkipGCOption"));
|
|
35
|
-
const SkipScrollOption_1 = __importDefault(require("../options/SkipScrollOption"));
|
|
36
|
-
const SkipExtraOperationOption_1 = __importDefault(require("../options/SkipExtraOperationOption"));
|
|
37
|
-
const RunningModeOption_1 = __importDefault(require("../options/RunningModeOption"));
|
|
38
|
-
const RemoteBrowserDebugOption_1 = __importDefault(require("../options/RemoteBrowserDebugOption"));
|
|
39
|
-
const ScenarioFileOption_1 = __importDefault(require("../options/ScenarioFileOption"));
|
|
40
|
-
const SetDeviceOption_1 = __importDefault(require("../options/SetDeviceOption"));
|
|
41
|
-
const
|
|
29
|
+
const AppOption_1 = __importDefault(require("../options/e2e/AppOption"));
|
|
30
|
+
const FullExecutionOption_1 = __importDefault(require("../options/e2e/FullExecutionOption"));
|
|
31
|
+
const InteractionOption_1 = __importDefault(require("../options/e2e/InteractionOption"));
|
|
32
|
+
const SkipScreenshotOption_1 = __importDefault(require("../options/e2e/SkipScreenshotOption"));
|
|
33
|
+
const SkipSnapshotOption_1 = __importDefault(require("../options/e2e/SkipSnapshotOption"));
|
|
34
|
+
const SkipGCOption_1 = __importDefault(require("../options/e2e/SkipGCOption"));
|
|
35
|
+
const SkipScrollOption_1 = __importDefault(require("../options/e2e/SkipScrollOption"));
|
|
36
|
+
const SkipExtraOperationOption_1 = __importDefault(require("../options/e2e/SkipExtraOperationOption"));
|
|
37
|
+
const RunningModeOption_1 = __importDefault(require("../options/e2e/RunningModeOption"));
|
|
38
|
+
const RemoteBrowserDebugOption_1 = __importDefault(require("../options/e2e/RemoteBrowserDebugOption"));
|
|
39
|
+
const ScenarioFileOption_1 = __importDefault(require("../options/e2e/ScenarioFileOption"));
|
|
40
|
+
const SetDeviceOption_1 = __importDefault(require("../options/e2e/SetDeviceOption"));
|
|
41
|
+
const SetUserAgentOption_1 = __importDefault(require("../options/e2e/SetUserAgentOption"));
|
|
42
|
+
const DisableXvfbOption_1 = __importDefault(require("../options/e2e/DisableXvfbOption"));
|
|
42
43
|
const NumberOfRunsOption_1 = __importDefault(require("../options/NumberOfRunsOption"));
|
|
43
|
-
const HeadfulBrowserOption_1 = __importDefault(require("../options/HeadfulBrowserOption"));
|
|
44
|
+
const HeadfulBrowserOption_1 = __importDefault(require("../options/e2e/HeadfulBrowserOption"));
|
|
44
45
|
class RunMeasureCommand extends BaseCommand_1.default {
|
|
45
46
|
getCommandName() {
|
|
46
47
|
return 'measure';
|
|
@@ -74,6 +75,7 @@ class RunMeasureCommand extends BaseCommand_1.default {
|
|
|
74
75
|
new RemoteBrowserDebugOption_1.default(),
|
|
75
76
|
new ScenarioFileOption_1.default(),
|
|
76
77
|
new SetDeviceOption_1.default(),
|
|
78
|
+
new SetUserAgentOption_1.default(),
|
|
77
79
|
new DisableXvfbOption_1.default(),
|
|
78
80
|
];
|
|
79
81
|
}
|
|
@@ -24,16 +24,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
24
|
const BaseCommand_1 = __importDefault(require("../BaseCommand"));
|
|
25
25
|
const api_1 = require("@memlab/api");
|
|
26
26
|
const InitDirectoryCommand_1 = __importDefault(require("./InitDirectoryCommand"));
|
|
27
|
-
const AppOption_1 = __importDefault(require("../options/AppOption"));
|
|
28
|
-
const InteractionOption_1 = __importDefault(require("../options/InteractionOption"));
|
|
29
|
-
const RunningModeOption_1 = __importDefault(require("../options/RunningModeOption"));
|
|
30
|
-
const RemoteBrowserDebugOption_1 = __importDefault(require("../options/RemoteBrowserDebugOption"));
|
|
31
|
-
const ScenarioFileOption_1 = __importDefault(require("../options/ScenarioFileOption"));
|
|
32
|
-
const SetDeviceOption_1 = __importDefault(require("../options/SetDeviceOption"));
|
|
33
|
-
const
|
|
34
|
-
const
|
|
27
|
+
const AppOption_1 = __importDefault(require("../options/e2e/AppOption"));
|
|
28
|
+
const InteractionOption_1 = __importDefault(require("../options/e2e/InteractionOption"));
|
|
29
|
+
const RunningModeOption_1 = __importDefault(require("../options/e2e/RunningModeOption"));
|
|
30
|
+
const RemoteBrowserDebugOption_1 = __importDefault(require("../options/e2e/RemoteBrowserDebugOption"));
|
|
31
|
+
const ScenarioFileOption_1 = __importDefault(require("../options/e2e/ScenarioFileOption"));
|
|
32
|
+
const SetDeviceOption_1 = __importDefault(require("../options/e2e/SetDeviceOption"));
|
|
33
|
+
const SetUserAgentOption_1 = __importDefault(require("../options/e2e/SetUserAgentOption"));
|
|
34
|
+
const DisableXvfbOption_1 = __importDefault(require("../options/e2e/DisableXvfbOption"));
|
|
35
|
+
const SkipWarmupOption_1 = __importDefault(require("../options/e2e/SkipWarmupOption"));
|
|
35
36
|
const CheckXvfbSupportCommand_1 = __importDefault(require("./snapshot/CheckXvfbSupportCommand"));
|
|
36
|
-
const HeadfulBrowserOption_1 = __importDefault(require("../options/HeadfulBrowserOption"));
|
|
37
|
+
const HeadfulBrowserOption_1 = __importDefault(require("../options/e2e/HeadfulBrowserOption"));
|
|
37
38
|
class FBWarmupAppCommand extends BaseCommand_1.default {
|
|
38
39
|
getCommandName() {
|
|
39
40
|
return 'warmup';
|
|
@@ -59,6 +60,7 @@ class FBWarmupAppCommand extends BaseCommand_1.default {
|
|
|
59
60
|
new RemoteBrowserDebugOption_1.default(),
|
|
60
61
|
new ScenarioFileOption_1.default(),
|
|
61
62
|
new SetDeviceOption_1.default(),
|
|
63
|
+
new SetUserAgentOption_1.default(),
|
|
62
64
|
new DisableXvfbOption_1.default(),
|
|
63
65
|
new SkipWarmupOption_1.default(),
|
|
64
66
|
];
|
|
@@ -49,7 +49,7 @@ const BaseCommand_1 = __importStar(require("../../BaseCommand"));
|
|
|
49
49
|
const core_1 = require("@memlab/core");
|
|
50
50
|
const SnapshotFileOption_1 = __importDefault(require("../../options/heap/SnapshotFileOption"));
|
|
51
51
|
const JSEngineOption_1 = __importDefault(require("../../options/heap/JSEngineOption"));
|
|
52
|
-
const HeapNodeIdOption_1 = __importDefault(require("../../options/HeapNodeIdOption"));
|
|
52
|
+
const HeapNodeIdOption_1 = __importDefault(require("../../options/heap/HeapNodeIdOption"));
|
|
53
53
|
const SnapshotDirectoryOption_1 = __importDefault(require("../../options/heap/SnapshotDirectoryOption"));
|
|
54
54
|
const core_2 = require("@memlab/core");
|
|
55
55
|
function calculateRetainerTrace() {
|
|
@@ -51,7 +51,7 @@ const BaseCommand_1 = __importStar(require("../../../BaseCommand"));
|
|
|
51
51
|
const SnapshotFileOption_1 = __importDefault(require("../../../options/heap/SnapshotFileOption"));
|
|
52
52
|
const JSEngineOption_1 = __importDefault(require("../../../options/heap/JSEngineOption"));
|
|
53
53
|
const CliScreen_1 = __importDefault(require("./ui-components/CliScreen"));
|
|
54
|
-
const HeapNodeIdOption_1 = __importDefault(require("../../../options/HeapNodeIdOption"));
|
|
54
|
+
const HeapNodeIdOption_1 = __importDefault(require("../../../options/heap/HeapNodeIdOption"));
|
|
55
55
|
const MLClusteringOption_1 = __importDefault(require("../../../options/MLClusteringOption"));
|
|
56
56
|
class InteractiveHeapViewCommand extends BaseCommand_1.default {
|
|
57
57
|
getCommandName() {
|
|
@@ -63,11 +63,16 @@ class CliScreen {
|
|
|
63
63
|
if (keys.length === 0) {
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
let nodes;
|
|
67
|
+
for (const key of keys) {
|
|
68
|
+
nodes = objectCategory.get(key);
|
|
69
|
+
if (nodes && nodes.length > 0) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (nodes && nodes.length > 0) {
|
|
74
|
+
this.heapController.setCurrentHeapObject((0, HeapViewUtils_1.getHeapObjectAt)(nodes, 0));
|
|
69
75
|
}
|
|
70
|
-
this.heapController.setCurrentHeapObject((0, HeapViewUtils_1.getHeapObjectAt)(nodes, 0));
|
|
71
76
|
}
|
|
72
77
|
initScreen(title) {
|
|
73
78
|
return blessed_1.default.screen({
|
|
@@ -28,6 +28,7 @@ export default class HelperCommand extends BaseCommand {
|
|
|
28
28
|
private printCategory;
|
|
29
29
|
private getCommandOptionsSummary;
|
|
30
30
|
private printOptions;
|
|
31
|
+
private formatOptionText;
|
|
31
32
|
private printCommand;
|
|
32
33
|
private printHelperTextForCommand;
|
|
33
34
|
private printFullHelperTextForCommand;
|
|
@@ -171,12 +171,27 @@ class HelperCommand extends BaseCommand_1.default {
|
|
|
171
171
|
}
|
|
172
172
|
const headerLength = optionsText.reduce((acc, cur) => Math.max(acc, cur.header.length), 0);
|
|
173
173
|
for (const optionText of optionsText) {
|
|
174
|
-
const
|
|
175
|
-
const prefix = core_1.utils.repeat(' ', headerLength - optionText.header.length);
|
|
176
|
-
const msg = `${indent}${prefix}${header} ${optionText.desc}`;
|
|
174
|
+
const msg = this.formatOptionText(optionText, indent, headerLength);
|
|
177
175
|
core_1.info.topLevel(`\n${msg}`);
|
|
178
176
|
}
|
|
179
177
|
}
|
|
178
|
+
formatOptionText(optionText, indent, headerLength) {
|
|
179
|
+
const header = chalk_1.default.green(optionText.header);
|
|
180
|
+
const prefix = core_1.utils.repeat(' ', headerLength - optionText.header.length);
|
|
181
|
+
const headerString = `${indent}${prefix}${header} `;
|
|
182
|
+
const headerStringWidth = (0, string_width_1.default)(headerString);
|
|
183
|
+
const maxWidth = Math.min(process.stdout.columns, 150);
|
|
184
|
+
const descMaxWidth = maxWidth - headerStringWidth;
|
|
185
|
+
let descString = optionText.desc.substring(0, descMaxWidth);
|
|
186
|
+
let descStringRemain = optionText.desc.substring(descMaxWidth);
|
|
187
|
+
while (descStringRemain.length > 0) {
|
|
188
|
+
descString += '\n';
|
|
189
|
+
descString += core_1.utils.repeat(' ', headerStringWidth);
|
|
190
|
+
descString += descStringRemain.substring(0, descMaxWidth);
|
|
191
|
+
descStringRemain = descStringRemain.substring(descMaxWidth);
|
|
192
|
+
}
|
|
193
|
+
return `${headerString}${descString}`;
|
|
194
|
+
}
|
|
180
195
|
printCommand(command, extraIndent = '', printOptions = false) {
|
|
181
196
|
const indent = ' ' + extraIndent;
|
|
182
197
|
const name = command.getFullCommand();
|
|
@@ -24,22 +24,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
24
|
const BaseCommand_1 = __importDefault(require("../../BaseCommand"));
|
|
25
25
|
const Snapshot_1 = require("./Snapshot");
|
|
26
26
|
const CleanRunDataCommand_1 = __importDefault(require("../CleanRunDataCommand"));
|
|
27
|
-
const FullExecutionOption_1 = __importDefault(require("../../options/FullExecutionOption"));
|
|
28
|
-
const AppOption_1 = __importDefault(require("../../options/AppOption"));
|
|
29
|
-
const InteractionOption_1 = __importDefault(require("../../options/InteractionOption"));
|
|
30
|
-
const SkipSnapshotOption_1 = __importDefault(require("../../options/SkipSnapshotOption"));
|
|
31
|
-
const SkipScreenshotOption_1 = __importDefault(require("../../options/SkipScreenshotOption"));
|
|
32
|
-
const SkipGCOption_1 = __importDefault(require("../../options/SkipGCOption"));
|
|
33
|
-
const SkipScrollOption_1 = __importDefault(require("../../options/SkipScrollOption"));
|
|
34
|
-
const SkipExtraOperationOption_1 = __importDefault(require("../../options/SkipExtraOperationOption"));
|
|
35
|
-
const RunningModeOption_1 = __importDefault(require("../../options/RunningModeOption"));
|
|
36
|
-
const RemoteBrowserDebugOption_1 = __importDefault(require("../../options/RemoteBrowserDebugOption"));
|
|
37
|
-
const ScenarioFileOption_1 = __importDefault(require("../../options/ScenarioFileOption"));
|
|
38
|
-
const SetDeviceOption_1 = __importDefault(require("../../options/SetDeviceOption"));
|
|
39
|
-
const DisableXvfbOption_1 = __importDefault(require("../../options/DisableXvfbOption"));
|
|
27
|
+
const FullExecutionOption_1 = __importDefault(require("../../options/e2e/FullExecutionOption"));
|
|
28
|
+
const AppOption_1 = __importDefault(require("../../options/e2e/AppOption"));
|
|
29
|
+
const InteractionOption_1 = __importDefault(require("../../options/e2e/InteractionOption"));
|
|
30
|
+
const SkipSnapshotOption_1 = __importDefault(require("../../options/e2e/SkipSnapshotOption"));
|
|
31
|
+
const SkipScreenshotOption_1 = __importDefault(require("../../options/e2e/SkipScreenshotOption"));
|
|
32
|
+
const SkipGCOption_1 = __importDefault(require("../../options/e2e/SkipGCOption"));
|
|
33
|
+
const SkipScrollOption_1 = __importDefault(require("../../options/e2e/SkipScrollOption"));
|
|
34
|
+
const SkipExtraOperationOption_1 = __importDefault(require("../../options/e2e/SkipExtraOperationOption"));
|
|
35
|
+
const RunningModeOption_1 = __importDefault(require("../../options/e2e/RunningModeOption"));
|
|
36
|
+
const RemoteBrowserDebugOption_1 = __importDefault(require("../../options/e2e/RemoteBrowserDebugOption"));
|
|
37
|
+
const ScenarioFileOption_1 = __importDefault(require("../../options/e2e/ScenarioFileOption"));
|
|
38
|
+
const SetDeviceOption_1 = __importDefault(require("../../options/e2e/SetDeviceOption"));
|
|
39
|
+
const DisableXvfbOption_1 = __importDefault(require("../../options/e2e/DisableXvfbOption"));
|
|
40
40
|
const InitDirectoryCommand_1 = __importDefault(require("../InitDirectoryCommand"));
|
|
41
41
|
const CheckXvfbSupportCommand_1 = __importDefault(require("./CheckXvfbSupportCommand"));
|
|
42
|
-
const HeadfulBrowserOption_1 = __importDefault(require("../../options/HeadfulBrowserOption"));
|
|
42
|
+
const HeadfulBrowserOption_1 = __importDefault(require("../../options/e2e/HeadfulBrowserOption"));
|
|
43
|
+
const SetUserAgentOption_1 = __importDefault(require("../../options/e2e/SetUserAgentOption"));
|
|
43
44
|
class TakeSnapshotCommand extends BaseCommand_1.default {
|
|
44
45
|
getCommandName() {
|
|
45
46
|
return 'snapshot';
|
|
@@ -76,6 +77,7 @@ class TakeSnapshotCommand extends BaseCommand_1.default {
|
|
|
76
77
|
new RemoteBrowserDebugOption_1.default(),
|
|
77
78
|
new ScenarioFileOption_1.default(),
|
|
78
79
|
new SetDeviceOption_1.default(),
|
|
80
|
+
new SetUserAgentOption_1.default(),
|
|
79
81
|
new DisableXvfbOption_1.default(),
|
|
80
82
|
];
|
|
81
83
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
* @format
|
|
8
|
+
* @oncall ws_labs
|
|
9
|
+
*/
|
|
10
|
+
import type { ParsedArgs } from 'minimist';
|
|
11
|
+
import type { MemLabConfig } from '@memlab/core';
|
|
12
|
+
import { BaseOption } from '@memlab/core';
|
|
13
|
+
export default class SetUserAgentOption extends BaseOption {
|
|
14
|
+
getOptionName(): string;
|
|
15
|
+
getDescription(): string;
|
|
16
|
+
getExampleValues(): string[];
|
|
17
|
+
parse(config: MemLabConfig, args: ParsedArgs): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=SetUserAgentOption.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
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 ws_labs
|
|
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 SetUserAgentOption extends core_1.BaseOption {
|
|
23
|
+
getOptionName() {
|
|
24
|
+
return 'user-agent';
|
|
25
|
+
}
|
|
26
|
+
getDescription() {
|
|
27
|
+
return ('set the UserAgent string in browser (for E2E interaction), ' +
|
|
28
|
+
'otherwise it uses the default UserAgent from Chromium');
|
|
29
|
+
}
|
|
30
|
+
getExampleValues() {
|
|
31
|
+
return ['"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2)"'];
|
|
32
|
+
}
|
|
33
|
+
parse(config, args) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const optionName = this.getOptionName();
|
|
36
|
+
if (args[optionName]) {
|
|
37
|
+
config.defaultUserAgent = args[optionName];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = SetUserAgentOption;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memlab/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "command line interface for memlab",
|
|
6
6
|
"author": "Liang Gong <lgong@fb.com>",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
],
|
|
16
16
|
"main": "dist/index.js",
|
|
17
17
|
"files": [
|
|
18
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"bin",
|
|
20
|
+
"LICENSE"
|
|
19
21
|
],
|
|
20
22
|
"bin": {
|
|
21
23
|
"memlab": "bin/memlab.js"
|