@xbrowser/cli 1.0.7 → 1.0.8
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 +4 -2
- package/dist/{browser-X7OVRKJH.js → browser-6QN42A4K.js} +2 -2
- package/dist/{browser-U4VWPTS2.js → browser-AN6MKGOD.js} +1 -1
- package/dist/{browser-AXCKBSWS.js → browser-MUPES4UY.js} +2 -2
- package/dist/{cdp-driver-CWNZVWHX.js → cdp-driver-E4I3AEJK.js} +4 -0
- package/dist/{cdp-driver-ZAVN7GRB.js → cdp-driver-LKNM6OQI.js} +1 -1
- package/dist/{chunk-5QAYN5EZ.js → chunk-EUHVZVVL.js} +1 -1
- package/dist/{chunk-7POCCXIB.js → chunk-HRTXMFW4.js} +4 -0
- package/dist/{chunk-SEFIJY2M.js → chunk-IX4JY6OO.js} +4 -0
- package/dist/{chunk-MXG2H3HJ.js → chunk-JUNEBEGF.js} +1 -1
- package/dist/cli.js +16 -4
- package/dist/daemon-main.js +4 -4
- package/dist/index.js +17 -5
- package/dist/{session-replayer-GCGY6KFK.js → session-replayer-YWMSSZWC.js} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,8 +50,10 @@ xbrowser "goto https://example.com && wait .content && text --selector .content"
|
|
|
50
50
|
|
|
51
51
|
**SEO & Backlink Automation**
|
|
52
52
|
```bash
|
|
53
|
-
#
|
|
54
|
-
xbrowser publish --
|
|
53
|
+
# Publish articles to SEO platforms via site plugins
|
|
54
|
+
xbrowser devto publish --file article.md
|
|
55
|
+
xbrowser juejin publish --file article.md
|
|
56
|
+
# (Each platform has its own plugin — run `xbrowser plugin list` to see available)
|
|
55
57
|
```
|
|
56
58
|
|
|
57
59
|
## 快速开始
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
saveSessionDiskMeta,
|
|
21
21
|
setActivePage,
|
|
22
22
|
touchSession
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-EUHVZVVL.js";
|
|
24
|
+
import "./chunk-IX4JY6OO.js";
|
|
25
25
|
import "./chunk-TNEN6VQ2.js";
|
|
26
26
|
import "./chunk-GDKLH7ZY.js";
|
|
27
27
|
import "./chunk-ABXMBNQ6.js";
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
saveSessionDiskMeta,
|
|
21
21
|
setActivePage,
|
|
22
22
|
touchSession
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-JUNEBEGF.js";
|
|
24
|
+
import "./chunk-IX4JY6OO.js";
|
|
25
25
|
import "./chunk-TNEN6VQ2.js";
|
|
26
26
|
import "./chunk-GDKLH7ZY.js";
|
|
27
27
|
import "./chunk-KFQGP6VL.js";
|
|
@@ -1669,6 +1669,10 @@ Last error: ${lastError.message}` : "";
|
|
|
1669
1669
|
}
|
|
1670
1670
|
};
|
|
1671
1671
|
this._emit("dialog", dialog);
|
|
1672
|
+
setTimeout(() => {
|
|
1673
|
+
this.conn.send("Page.handleJavaScriptDialog", { accept: false }, this.sessionId).catch(() => {
|
|
1674
|
+
});
|
|
1675
|
+
}, 100);
|
|
1672
1676
|
})
|
|
1673
1677
|
);
|
|
1674
1678
|
this._subscriptions.push(
|
|
@@ -1674,6 +1674,10 @@ Last error: ${lastError.message}` : "";
|
|
|
1674
1674
|
}
|
|
1675
1675
|
};
|
|
1676
1676
|
this._emit("dialog", dialog);
|
|
1677
|
+
setTimeout(() => {
|
|
1678
|
+
this.conn.send("Page.handleJavaScriptDialog", { accept: false }, this.sessionId).catch(() => {
|
|
1679
|
+
});
|
|
1680
|
+
}, 100);
|
|
1677
1681
|
})
|
|
1678
1682
|
);
|
|
1679
1683
|
this._subscriptions.push(
|
|
@@ -1668,6 +1668,10 @@ Last error: ${lastError.message}` : "";
|
|
|
1668
1668
|
}
|
|
1669
1669
|
};
|
|
1670
1670
|
this._emit("dialog", dialog);
|
|
1671
|
+
setTimeout(() => {
|
|
1672
|
+
this.conn.send("Page.handleJavaScriptDialog", { accept: false }, this.sessionId).catch(() => {
|
|
1673
|
+
});
|
|
1674
|
+
}, 100);
|
|
1671
1675
|
})
|
|
1672
1676
|
);
|
|
1673
1677
|
this._subscriptions.push(
|
package/dist/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
resolveLaunchOpts,
|
|
26
26
|
saveSessionDiskMeta,
|
|
27
27
|
setActivePage
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-HRTXMFW4.js";
|
|
29
29
|
import "./chunk-TNEN6VQ2.js";
|
|
30
30
|
import {
|
|
31
31
|
forwardCommandLog,
|
|
@@ -6967,7 +6967,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
|
|
|
6967
6967
|
}
|
|
6968
6968
|
let targetPageOverride = null;
|
|
6969
6969
|
if (_target && extraOpts?.cdpEndpoint) {
|
|
6970
|
-
const { findTargetPage } = await import("./browser-
|
|
6970
|
+
const { findTargetPage } = await import("./browser-AN6MKGOD.js");
|
|
6971
6971
|
targetPageOverride = await findTargetPage(extraOpts.cdpEndpoint, _target);
|
|
6972
6972
|
if (!targetPageOverride) {
|
|
6973
6973
|
return errorResult(`Target "${_target}" not found. Use 'xbrowser targets --cdp ${extraOpts.cdpEndpoint}' to list available pages.`);
|
|
@@ -9648,6 +9648,18 @@ async function handleBrowserCommand(command, args, options, sessionName, mode, c
|
|
|
9648
9648
|
params = { width, height };
|
|
9649
9649
|
break;
|
|
9650
9650
|
}
|
|
9651
|
+
case "mouse": {
|
|
9652
|
+
const action = options.action || args.find((a) => ["move", "click", "dblclick", "down", "up"].includes(a));
|
|
9653
|
+
const actionIdx = action ? args.indexOf(action) : -1;
|
|
9654
|
+
const x = options.x !== void 0 ? Number(options.x) : actionIdx >= 0 && args[actionIdx + 1] ? Number(args[actionIdx + 1]) : void 0;
|
|
9655
|
+
const y = options.y !== void 0 ? Number(options.y) : actionIdx >= 0 && args[actionIdx + 2] ? Number(args[actionIdx + 2]) : void 0;
|
|
9656
|
+
if (!action || x === void 0 || y === void 0) {
|
|
9657
|
+
outputError("Usage: xbrowser mouse <move|click|dblclick> <x> <y>\n xbrowser mouse --action <action> --x <x> --y <y>");
|
|
9658
|
+
}
|
|
9659
|
+
cmdName = "mouse";
|
|
9660
|
+
params = { action, x, y, ...options.button ? { button: options.button } : {} };
|
|
9661
|
+
break;
|
|
9662
|
+
}
|
|
9651
9663
|
case "html":
|
|
9652
9664
|
cmdName = "html";
|
|
9653
9665
|
params = { selector: options.selector || options.s };
|
|
@@ -12595,7 +12607,7 @@ async function handleServe(_args, options, mode) {
|
|
|
12595
12607
|
\u{1F310} xbrowser HTTP Server`);
|
|
12596
12608
|
console.log(`
|
|
12597
12609
|
URL: ${output.url}`);
|
|
12598
|
-
console.log(` Auth: ${output.authRequired ? "Enabled (Bearer token)" : "Disabled (dev mode)"}
|
|
12610
|
+
console.log(` Auth: ${output.authRequired ? "Enabled (Bearer token, except /health)" : "Disabled (dev mode)"}
|
|
12599
12611
|
`);
|
|
12600
12612
|
console.log(` Endpoints:`);
|
|
12601
12613
|
for (const [, value] of Object.entries(output.endpoints)) {
|
|
@@ -12715,7 +12727,7 @@ async function main() {
|
|
|
12715
12727
|
const command = process.argv[2];
|
|
12716
12728
|
const isLongRunning = command === "preview" || command === "serve";
|
|
12717
12729
|
if (!isLongRunning) {
|
|
12718
|
-
const { ensureProcessCanExit } = await import("./browser-
|
|
12730
|
+
const { ensureProcessCanExit } = await import("./browser-AN6MKGOD.js");
|
|
12719
12731
|
await ensureProcessCanExit().catch(() => {
|
|
12720
12732
|
});
|
|
12721
12733
|
process.exit(exitCode);
|
package/dist/daemon-main.js
CHANGED
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
resolveLaunchOpts,
|
|
22
22
|
saveSessionDiskMeta,
|
|
23
23
|
setActivePage
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-JUNEBEGF.js";
|
|
25
|
+
import "./chunk-IX4JY6OO.js";
|
|
26
26
|
import "./chunk-TNEN6VQ2.js";
|
|
27
27
|
import {
|
|
28
28
|
getDaemonConfig,
|
|
@@ -6925,7 +6925,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
|
|
|
6925
6925
|
}
|
|
6926
6926
|
let targetPageOverride = null;
|
|
6927
6927
|
if (_target && extraOpts?.cdpEndpoint) {
|
|
6928
|
-
const { findTargetPage } = await import("./browser-
|
|
6928
|
+
const { findTargetPage } = await import("./browser-MUPES4UY.js");
|
|
6929
6929
|
targetPageOverride = await findTargetPage(extraOpts.cdpEndpoint, _target);
|
|
6930
6930
|
if (!targetPageOverride) {
|
|
6931
6931
|
return errorResult(`Target "${_target}" not found. Use 'xbrowser targets --cdp ${extraOpts.cdpEndpoint}' to list available pages.`);
|
|
@@ -8609,7 +8609,7 @@ function createRPCHandler() {
|
|
|
8609
8609
|
const isNewFormat = Array.isArray(parsed.actions);
|
|
8610
8610
|
if (isNewFormat) {
|
|
8611
8611
|
try {
|
|
8612
|
-
const { SessionReplayer } = await import("./session-replayer-
|
|
8612
|
+
const { SessionReplayer } = await import("./session-replayer-YWMSSZWC.js");
|
|
8613
8613
|
const replayer = new SessionReplayer({
|
|
8614
8614
|
page: session.page,
|
|
8615
8615
|
stepDelay: slowMo * 500,
|
package/dist/index.js
CHANGED
|
@@ -81,8 +81,8 @@ import {
|
|
|
81
81
|
resolveLaunchOpts,
|
|
82
82
|
saveSessionDiskMeta,
|
|
83
83
|
setActivePage
|
|
84
|
-
} from "./chunk-
|
|
85
|
-
import "./chunk-
|
|
84
|
+
} from "./chunk-EUHVZVVL.js";
|
|
85
|
+
import "./chunk-IX4JY6OO.js";
|
|
86
86
|
import "./chunk-TNEN6VQ2.js";
|
|
87
87
|
import {
|
|
88
88
|
errMsg
|
|
@@ -7287,7 +7287,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
|
|
|
7287
7287
|
}
|
|
7288
7288
|
let targetPageOverride = null;
|
|
7289
7289
|
if (_target && extraOpts?.cdpEndpoint) {
|
|
7290
|
-
const { findTargetPage } = await import("./browser-
|
|
7290
|
+
const { findTargetPage } = await import("./browser-6QN42A4K.js");
|
|
7291
7291
|
targetPageOverride = await findTargetPage(extraOpts.cdpEndpoint, _target);
|
|
7292
7292
|
if (!targetPageOverride) {
|
|
7293
7293
|
return errorResult(`Target "${_target}" not found. Use 'xbrowser targets --cdp ${extraOpts.cdpEndpoint}' to list available pages.`);
|
|
@@ -9988,6 +9988,18 @@ async function handleBrowserCommand(command, args, options, sessionName, mode, c
|
|
|
9988
9988
|
params = { width, height };
|
|
9989
9989
|
break;
|
|
9990
9990
|
}
|
|
9991
|
+
case "mouse": {
|
|
9992
|
+
const action = options.action || args.find((a) => ["move", "click", "dblclick", "down", "up"].includes(a));
|
|
9993
|
+
const actionIdx = action ? args.indexOf(action) : -1;
|
|
9994
|
+
const x = options.x !== void 0 ? Number(options.x) : actionIdx >= 0 && args[actionIdx + 1] ? Number(args[actionIdx + 1]) : void 0;
|
|
9995
|
+
const y = options.y !== void 0 ? Number(options.y) : actionIdx >= 0 && args[actionIdx + 2] ? Number(args[actionIdx + 2]) : void 0;
|
|
9996
|
+
if (!action || x === void 0 || y === void 0) {
|
|
9997
|
+
outputError("Usage: xbrowser mouse <move|click|dblclick> <x> <y>\n xbrowser mouse --action <action> --x <x> --y <y>");
|
|
9998
|
+
}
|
|
9999
|
+
cmdName = "mouse";
|
|
10000
|
+
params = { action, x, y, ...options.button ? { button: options.button } : {} };
|
|
10001
|
+
break;
|
|
10002
|
+
}
|
|
9991
10003
|
case "html":
|
|
9992
10004
|
cmdName = "html";
|
|
9993
10005
|
params = { selector: options.selector || options.s };
|
|
@@ -12935,7 +12947,7 @@ async function handleServe(_args, options, mode) {
|
|
|
12935
12947
|
\u{1F310} xbrowser HTTP Server`);
|
|
12936
12948
|
console.log(`
|
|
12937
12949
|
URL: ${output.url}`);
|
|
12938
|
-
console.log(` Auth: ${output.authRequired ? "Enabled (Bearer token)" : "Disabled (dev mode)"}
|
|
12950
|
+
console.log(` Auth: ${output.authRequired ? "Enabled (Bearer token, except /health)" : "Disabled (dev mode)"}
|
|
12939
12951
|
`);
|
|
12940
12952
|
console.log(` Endpoints:`);
|
|
12941
12953
|
for (const [, value] of Object.entries(output.endpoints)) {
|
|
@@ -15842,7 +15854,7 @@ var DataCollector = class {
|
|
|
15842
15854
|
return results;
|
|
15843
15855
|
}
|
|
15844
15856
|
async createBrowserContext() {
|
|
15845
|
-
const { launch } = await import("./cdp-driver-
|
|
15857
|
+
const { launch } = await import("./cdp-driver-LKNM6OQI.js");
|
|
15846
15858
|
const { browser } = await launch({
|
|
15847
15859
|
headless: true,
|
|
15848
15860
|
args: ["--no-sandbox", "--disable-setuid-sandbox"]
|
|
@@ -31,7 +31,7 @@ var SessionReplayer = class {
|
|
|
31
31
|
if (this.opts.page) {
|
|
32
32
|
this.page = this.opts.page;
|
|
33
33
|
} else if (this.opts.cdpUrl) {
|
|
34
|
-
const { launch } = await import("./cdp-driver-
|
|
34
|
+
const { launch } = await import("./cdp-driver-LKNM6OQI.js");
|
|
35
35
|
const { browser } = await launch({ cdpEndpoint: this.opts.cdpUrl });
|
|
36
36
|
let contexts = browser.contexts();
|
|
37
37
|
for (let i = 0; i < 10 && contexts.length === 0; i++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xbrowser/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Browser automation CLI for web scraping, headless browsing, SEO analysis, and AI agent workflows. A command-line alternative to Playwright, Puppeteer, and Selenium.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|