@xbrowser/cli 0.14.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/README.md +858 -0
- package/dist/admin-6UTU2RZ2.js +281 -0
- package/dist/admin-MDGF4CET.js +285 -0
- package/dist/admin-RPJJ5CAF.js +282 -0
- package/dist/browser-GWBH6OJK.js +46 -0
- package/dist/browser-I2HJZ7IP.js +48 -0
- package/dist/browser-R7B255ML.js +46 -0
- package/dist/chunk-2ONMTDLK.js +2050 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-43VX3TYN.js +83 -0
- package/dist/chunk-ATFTAKMN.js +267 -0
- package/dist/chunk-DESA2KMG.js +77 -0
- package/dist/chunk-DTJRVA76.js +206 -0
- package/dist/chunk-F3ZWFCJJ.js +2051 -0
- package/dist/chunk-FF5WHQHN.js +135 -0
- package/dist/chunk-HINTG75P.js +77 -0
- package/dist/chunk-KDYXFLAC.js +1503 -0
- package/dist/chunk-KTSQU4QT.js +29 -0
- package/dist/chunk-L53IDAWK.js +68 -0
- package/dist/chunk-M7CMBPCA.js +100 -0
- package/dist/chunk-NFGO7J2I.js +29 -0
- package/dist/chunk-OLB6UJ25.js +438 -0
- package/dist/chunk-OPRXFZVE.js +52 -0
- package/dist/chunk-RS6YYWTK.js +685 -0
- package/dist/chunk-VEDJ5XSQ.js +196 -0
- package/dist/chunk-VEKPHQBR.js +47 -0
- package/dist/chunk-VUJDJCIN.js +437 -0
- package/dist/chunk-YEN2ODUI.js +14 -0
- package/dist/chunk-ZZ2TFWIV.js +1382 -0
- package/dist/cli.js +11012 -0
- package/dist/convert-4DUWZIKH.js +205 -0
- package/dist/convert-EKQVHKB4.js +11 -0
- package/dist/daemon-client-3IJD6X4B.js +59 -0
- package/dist/daemon-client-GX2UYIW4.js +241 -0
- package/dist/daemon-client-XWSSQBEA.js +58 -0
- package/dist/daemon-main.js +9910 -0
- package/dist/extract-EGRXZSSK.js +67 -0
- package/dist/extract-JUOQQX4V.js +11 -0
- package/dist/filter-OLAE26HN.js +51 -0
- package/dist/filter-VID2GGZ7.js +9 -0
- package/dist/human-interaction-QPHNDD76.js +8 -0
- package/dist/index.d.ts +2313 -0
- package/dist/index.js +13839 -0
- package/dist/marketplace-FCVN5OTZ.js +706 -0
- package/dist/marketplace-FPT5YLKB.js +351 -0
- package/dist/marketplace-W545W4FR.js +706 -0
- package/dist/network-store-2S5HATEV.js +194 -0
- package/dist/network-store-BN6QEZ7R.js +196 -0
- package/dist/network-store-YAF5OIBH.js +12 -0
- package/dist/parse-action-dsl-DRSPBALP.js +72 -0
- package/dist/parse-action-dsl-T3DYC33D.js +74 -0
- package/dist/proxy-WKGUCH2C.js +7 -0
- package/dist/session-recorder-ILSSV2UC.js +6 -0
- package/dist/session-recorder-XET3DNML.js +7 -0
- package/package.json +111 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// src/commands/extract.ts
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as yaml from "yaml";
|
|
4
|
+
function extractRecording(filePath) {
|
|
5
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
6
|
+
const recording = yaml.parse(content);
|
|
7
|
+
const keyEvents = [];
|
|
8
|
+
const eventTypes = {};
|
|
9
|
+
for (const event of recording.events || []) {
|
|
10
|
+
const type = event.type;
|
|
11
|
+
eventTypes[type] = (eventTypes[type] || 0) + 1;
|
|
12
|
+
if (["click", "input", "type", "keydown", "keypress", "hover", "hover_enter", "hover_leave"].includes(type)) {
|
|
13
|
+
keyEvents.push({
|
|
14
|
+
type: event.type,
|
|
15
|
+
selector: event.selector,
|
|
16
|
+
tagName: event.tagName,
|
|
17
|
+
data: event.data,
|
|
18
|
+
timestamp: event.timestamp,
|
|
19
|
+
pageState: {
|
|
20
|
+
url: event.pageState?.url,
|
|
21
|
+
title: event.pageState?.title
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
startUrl: recording.startUrl,
|
|
28
|
+
totalEvents: (recording.events || []).length,
|
|
29
|
+
keyEventsCount: keyEvents.length,
|
|
30
|
+
eventTypes,
|
|
31
|
+
operations: keyEvents.map((e, i) => ({
|
|
32
|
+
step: i + 1,
|
|
33
|
+
type: e.type,
|
|
34
|
+
selector: e.selector,
|
|
35
|
+
tagName: e.tagName,
|
|
36
|
+
data: e.data,
|
|
37
|
+
url: e.pageState?.url
|
|
38
|
+
}))
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function extractAndSave(filePath) {
|
|
42
|
+
const summary = extractRecording(filePath);
|
|
43
|
+
const outputPath = filePath.replace(/\.ya?ml$/i, "-summary.json");
|
|
44
|
+
fs.writeFileSync(outputPath, JSON.stringify(summary, null, 2));
|
|
45
|
+
return { summary, outputPath };
|
|
46
|
+
}
|
|
47
|
+
function printExtractSummary(summary) {
|
|
48
|
+
console.log("Analysis Results:");
|
|
49
|
+
console.log(` Start URL: ${summary.startUrl}`);
|
|
50
|
+
console.log(` Total events: ${summary.totalEvents}`);
|
|
51
|
+
console.log(` Key events: ${summary.keyEventsCount}`);
|
|
52
|
+
console.log("");
|
|
53
|
+
console.log("Event type stats:");
|
|
54
|
+
for (const [type, count] of Object.entries(summary.eventTypes)) {
|
|
55
|
+
console.log(` ${type}: ${count}`);
|
|
56
|
+
}
|
|
57
|
+
console.log("");
|
|
58
|
+
console.log("Key operations:");
|
|
59
|
+
for (const op of summary.operations) {
|
|
60
|
+
console.log(` ${op.step}. ${op.type} -> ${op.selector || op.tagName || "(none)"}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
extractAndSave,
|
|
65
|
+
extractRecording,
|
|
66
|
+
printExtractSummary
|
|
67
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/commands/filter.ts
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as yaml from "yaml";
|
|
4
|
+
var DEFAULT_EXCLUDE_TYPES = [
|
|
5
|
+
"panel_item_added",
|
|
6
|
+
"panel_debug",
|
|
7
|
+
"panel_items_count",
|
|
8
|
+
"panel_debug_detail",
|
|
9
|
+
"element_at_position",
|
|
10
|
+
"element_at_click",
|
|
11
|
+
"navigation",
|
|
12
|
+
"panel_appeared",
|
|
13
|
+
"panel_items",
|
|
14
|
+
"blur",
|
|
15
|
+
"focus",
|
|
16
|
+
"dom_change",
|
|
17
|
+
"tab_open",
|
|
18
|
+
"click_inferred",
|
|
19
|
+
"pointerup",
|
|
20
|
+
"pointerdown",
|
|
21
|
+
"mouseup",
|
|
22
|
+
"mousedown"
|
|
23
|
+
];
|
|
24
|
+
function filterRecording(inputPath, outputPath, excludeTypes) {
|
|
25
|
+
const content = fs.readFileSync(inputPath, "utf-8");
|
|
26
|
+
const recording = yaml.parse(content);
|
|
27
|
+
const exclude = excludeTypes || DEFAULT_EXCLUDE_TYPES;
|
|
28
|
+
const events = recording.events || [];
|
|
29
|
+
const originalCount = events.length;
|
|
30
|
+
const filteredEvents = events.filter((event) => {
|
|
31
|
+
return !exclude.includes(event.type);
|
|
32
|
+
});
|
|
33
|
+
const filteredCount = filteredEvents.length;
|
|
34
|
+
const removed = originalCount - filteredCount;
|
|
35
|
+
const percentage = originalCount > 0 ? Math.round(removed / originalCount * 100) : 0;
|
|
36
|
+
const output = { ...recording, events: filteredEvents };
|
|
37
|
+
fs.writeFileSync(outputPath, yaml.stringify(output));
|
|
38
|
+
return { originalCount, filteredCount, removed, percentage };
|
|
39
|
+
}
|
|
40
|
+
function parseExcludeTypes(args) {
|
|
41
|
+
for (const arg of args) {
|
|
42
|
+
if (arg.startsWith("--exclude-types=")) {
|
|
43
|
+
return arg.replace("--exclude-types=", "").split(",");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
filterRecording,
|
|
50
|
+
parseExcludeTypes
|
|
51
|
+
};
|