@xbrowser/cli 1.21.0 → 1.23.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 +21 -3
- package/dist/{browser-CNBSH53B.js → browser-BVRFSUXU.js} +3 -2
- package/dist/{browser-C2VEOJC2.js → browser-DSYUAE7H.js} +5 -4
- package/dist/{browser-VZOOFLAH.js → browser-Q67BJTI2.js} +4 -3
- package/dist/{cdp-driver-KFX4A6WR.js → cdp-driver-DC7EIUG5.js} +4 -3
- package/dist/{cdp-driver-7Z6ZAT5E.js → cdp-driver-T7D6H2RW.js} +335 -546
- package/dist/{cdp-driver-26LGCHXV.js → cdp-driver-WWO2UZDR.js} +3 -2
- package/dist/{chunk-Z5RTK4GW.js → chunk-2Q3GQRUP.js} +2 -2
- package/dist/{chunk-CLYZPSDR.js → chunk-4OU37CXP.js} +354 -576
- package/dist/{chunk-HWWG2ISJ.js → chunk-7OP2ISEY.js} +353 -575
- package/dist/{chunk-PIWNMC36.js → chunk-A3MORKYR.js} +1 -1
- package/dist/{chunk-3FWLW7FS.js → chunk-A7NEA4PA.js} +39 -1
- package/dist/{chunk-OMU63E6J.js → chunk-FBQZ3PVD.js} +5 -8
- package/dist/chunk-GYB5BOSP.js +602 -0
- package/dist/{chunk-ESJYANQO.js → chunk-IFKJO2UR.js} +360 -582
- package/dist/{chunk-NODRQGOK.js → chunk-IR6C24P7.js} +97 -0
- package/dist/{chunk-TEXCXIBW.js → chunk-LPW6QS4M.js} +5 -8
- package/dist/{chunk-3KZ34AUC.js → chunk-MYH6FIBZ.js} +2 -1
- package/dist/{chunk-AVSTNODR.js → chunk-T4WTKBWI.js} +2 -2
- package/dist/{chunk-HBHOKZPN.js → chunk-V6KGBU5J.js} +97 -0
- package/dist/{chunk-IWVG4XYZ.js → chunk-VCVDILH6.js} +2 -1
- package/dist/{chunk-NKW4A74J.js → chunk-XTUAUFL3.js} +5 -8
- package/dist/cli.js +497 -252
- package/dist/daemon-main.js +25 -19
- package/dist/{human-interaction-Y5IDH6LD.js → human-interaction-57VYIR56.js} +1 -1
- package/dist/{human-interaction-ZUTR5AC2.js → human-interaction-67K43B4O.js} +1 -1
- package/dist/{human-interaction-4YR2N6R6.js → human-interaction-MXST5ZQM.js} +1 -1
- package/dist/index.d.ts +52 -4
- package/dist/index.js +500 -256
- package/dist/keep-awake-M4KJS4B4.js +29 -0
- package/dist/{launcher-44STYRJC.js → launcher-IK2FKW6T.js} +1 -1
- package/dist/{launcher-EXJHHAUL.js → launcher-LUOMMGZC.js} +1 -1
- package/dist/{plugin-singleton-FCNDN3FX.js → plugin-singleton-GJO7EZXB.js} +1 -1
- package/dist/{recovery-NXC35EQN.js → recovery-6RI2FE3E.js} +1 -1
- package/dist/{recovery-MDWAVXE4.js → recovery-LGY25LIM.js} +1 -1
- package/dist/{recovery-L5GLDX4O.js → recovery-LMJW537X.js} +1 -1
- package/dist/{session-recorder-SLDBENVF.js → session-recorder-563ISSJK.js} +1 -1
- package/dist/{session-recorder-3BEVWHOK.js → session-recorder-GEZVQBKW.js} +1 -1
- package/dist/session-replayer-N665T3G5.js +932 -0
- package/dist/stealth-2AA2FSNN.js +29 -0
- package/dist/stealth-JOXGV34D.js +29 -0
- package/package.json +11 -7
- package/dist/session-replayer-EVD4HZBB.js +0 -413
|
@@ -95,7 +95,7 @@ import { join } from "path";
|
|
|
95
95
|
import { execSync } from "child_process";
|
|
96
96
|
var SHARED_PLUGIN_DEPENDENCIES = {
|
|
97
97
|
"zod": "^3.24.0",
|
|
98
|
-
"@dyyz1993/xcli-core": "^0.
|
|
98
|
+
"@dyyz1993/xcli-core": "^0.19.0"
|
|
99
99
|
};
|
|
100
100
|
function ensurePluginDependencies(pluginsDir) {
|
|
101
101
|
const zodPath = join(pluginsDir, "node_modules", "zod");
|
|
@@ -99,8 +99,46 @@ function queryAllJS(selector) {
|
|
|
99
99
|
}
|
|
100
100
|
return `document.querySelectorAll(${JSON.stringify(selector)})`;
|
|
101
101
|
}
|
|
102
|
+
function queryAllDeepJS(selector) {
|
|
103
|
+
return `(${deepQueryAllIIFE})( ${JSON.stringify(queryAllMainJS(selector))} )`;
|
|
104
|
+
}
|
|
105
|
+
function queryAllMainJS(selector) {
|
|
106
|
+
if (selector.startsWith("xpath=")) {
|
|
107
|
+
const xpath = JSON.stringify(selector.slice(6));
|
|
108
|
+
return `(() => { const it = document.evaluate(${xpath}, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); const r=[]; for(let i=0;i<it.snapshotLength;i++) r.push(it.snapshotItem(i)); return r; })()`;
|
|
109
|
+
}
|
|
110
|
+
if (selector.startsWith("text=") || selector.startsWith("popup-text=")) {
|
|
111
|
+
return `(() => { const el = (${queryMainJS(selector)}); return el ? [el] : []; })()`;
|
|
112
|
+
}
|
|
113
|
+
return `Array.from(document.querySelectorAll(${JSON.stringify(selector)}))`;
|
|
114
|
+
}
|
|
115
|
+
var deepQueryAllIIFE = `(function(allExpr) {
|
|
116
|
+
const run = (root) => {
|
|
117
|
+
// allExpr \u8FD4\u56DE\u7684\u662F\u6570\u7EC4\uFF08querySelectorAll \u5FEB\u7167\uFF09\u2014\u2014\u4E0D\u8981\u6309\u5355\u5143\u7D20\u5305\u88C5
|
|
118
|
+
try { return new Function('document', 'return (' + allExpr + ')')(root) || []; }
|
|
119
|
+
catch (e) { return []; }
|
|
120
|
+
};
|
|
121
|
+
const out = [];
|
|
122
|
+
const scanRoot = (root) => {
|
|
123
|
+
const found = run(root);
|
|
124
|
+
for (const el of found) out.push(el);
|
|
125
|
+
let all;
|
|
126
|
+
try { all = root.querySelectorAll('*'); } catch (e) { return; }
|
|
127
|
+
for (const el of all) {
|
|
128
|
+
if (el.shadowRoot) scanRoot(el.shadowRoot);
|
|
129
|
+
if (el.tagName === 'IFRAME') {
|
|
130
|
+
let inner = null;
|
|
131
|
+
try { inner = el.contentDocument; } catch (e) { /* cross-origin */ }
|
|
132
|
+
if (inner) scanRoot(inner);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
scanRoot(document);
|
|
137
|
+
return out;
|
|
138
|
+
})`;
|
|
102
139
|
|
|
103
140
|
export {
|
|
104
141
|
queryJS,
|
|
105
|
-
queryAllJS
|
|
142
|
+
queryAllJS,
|
|
143
|
+
queryAllDeepJS
|
|
106
144
|
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-HBMEFSTB.js";
|
|
5
5
|
|
|
6
6
|
// src/human-interaction.ts
|
|
7
|
-
import {
|
|
7
|
+
import { execFile } from "child_process";
|
|
8
8
|
|
|
9
9
|
// src/captcha-detector.ts
|
|
10
10
|
var CAPTCHA_SELECTORS = [
|
|
@@ -138,11 +138,6 @@ var WebhookNotifier = class {
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
// src/utils/shell-escape.ts
|
|
142
|
-
function shellEscape(value) {
|
|
143
|
-
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
141
|
// src/human-interaction.ts
|
|
147
142
|
var HumanInteractionManager = class {
|
|
148
143
|
wsServer;
|
|
@@ -171,8 +166,10 @@ var HumanInteractionManager = class {
|
|
|
171
166
|
tryAutoOpen(previewUrl) {
|
|
172
167
|
if (!this.autoOpen) return;
|
|
173
168
|
try {
|
|
174
|
-
const
|
|
175
|
-
|
|
169
|
+
const opener = process.platform === "darwin" ? "open" : process.platform === "linux" ? "xdg-open" : "cmd";
|
|
170
|
+
const args = process.platform === "win32" ? ["/c", "start", "", previewUrl] : [previewUrl];
|
|
171
|
+
execFile(opener, args, { timeout: 1e4 }, () => {
|
|
172
|
+
});
|
|
176
173
|
} catch {
|
|
177
174
|
}
|
|
178
175
|
}
|