@xbrowser/cli 1.8.1 → 1.8.2
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/dist/cli.js +23 -3
- package/dist/daemon-main.js +7 -2
- package/dist/index.js +23 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5554,7 +5554,7 @@ var InitScriptParams = z24.object({
|
|
|
5554
5554
|
stdin: z24.boolean().optional(),
|
|
5555
5555
|
name: z24.string().optional(),
|
|
5556
5556
|
list: z24.boolean().optional(),
|
|
5557
|
-
remove: z24.string().optional(),
|
|
5557
|
+
remove: z24.union([z24.string(), z24.boolean()]).optional(),
|
|
5558
5558
|
base64: z24.string().optional()
|
|
5559
5559
|
});
|
|
5560
5560
|
var registeredScripts = /* @__PURE__ */ new Map();
|
|
@@ -5607,10 +5607,15 @@ var addInitScriptCommand = registerCommand({
|
|
|
5607
5607
|
}));
|
|
5608
5608
|
return ok23({ scripts });
|
|
5609
5609
|
}
|
|
5610
|
-
if (params.remove) {
|
|
5610
|
+
if (params.remove && typeof params.remove === "string") {
|
|
5611
5611
|
const existed = registeredScripts.delete(params.remove);
|
|
5612
5612
|
return ok23({ removed: params.remove, existed });
|
|
5613
5613
|
}
|
|
5614
|
+
const removeTarget = (typeof params.remove === "string" ? params.remove : null) || (params.name && !resolveScriptContent(params) ? params.name : null);
|
|
5615
|
+
if (removeTarget && !resolveScriptContent(params)) {
|
|
5616
|
+
const existed = registeredScripts.delete(removeTarget);
|
|
5617
|
+
return ok23({ removed: removeTarget, existed });
|
|
5618
|
+
}
|
|
5614
5619
|
let content = params.stdin ? await readStdin() : resolveScriptContent(params);
|
|
5615
5620
|
if (!content) {
|
|
5616
5621
|
return ok23({ error: "No script content provided. Use --script, --file, --stdin, or --base64" });
|
|
@@ -7903,10 +7908,25 @@ var configBuiltin = {
|
|
|
7903
7908
|
}
|
|
7904
7909
|
if (subcommand === "set") {
|
|
7905
7910
|
const [key, value] = rest;
|
|
7906
|
-
if (!key ||
|
|
7911
|
+
if (!key || value === void 0) {
|
|
7907
7912
|
console.error("Usage: xbrowser config set <key> <value>");
|
|
7908
7913
|
process.exit(1);
|
|
7909
7914
|
}
|
|
7915
|
+
const knownKeys = /* @__PURE__ */ new Set([
|
|
7916
|
+
"browser.executablePath",
|
|
7917
|
+
"browser.headless",
|
|
7918
|
+
"browser.args",
|
|
7919
|
+
"captcha.notifyUrl",
|
|
7920
|
+
"captcha.autoOpen",
|
|
7921
|
+
"captcha.timeout",
|
|
7922
|
+
"captcha.strategy",
|
|
7923
|
+
"preview.port",
|
|
7924
|
+
"preview.quality",
|
|
7925
|
+
"preview.fps"
|
|
7926
|
+
]);
|
|
7927
|
+
if (!knownKeys.has(key) && !key.startsWith("browser.") && !key.startsWith("captcha.") && !key.startsWith("preview.")) {
|
|
7928
|
+
console.warn(`\u26A0\uFE0F Unknown config key: "${key}". Known keys: browser.*, captcha.*, preview.*`);
|
|
7929
|
+
}
|
|
7910
7930
|
setConfigValue(key, value);
|
|
7911
7931
|
console.log(`Set ${key} = ${value}`);
|
|
7912
7932
|
return;
|
package/dist/daemon-main.js
CHANGED
|
@@ -5521,7 +5521,7 @@ var InitScriptParams = z24.object({
|
|
|
5521
5521
|
stdin: z24.boolean().optional(),
|
|
5522
5522
|
name: z24.string().optional(),
|
|
5523
5523
|
list: z24.boolean().optional(),
|
|
5524
|
-
remove: z24.string().optional(),
|
|
5524
|
+
remove: z24.union([z24.string(), z24.boolean()]).optional(),
|
|
5525
5525
|
base64: z24.string().optional()
|
|
5526
5526
|
});
|
|
5527
5527
|
var registeredScripts = /* @__PURE__ */ new Map();
|
|
@@ -5574,10 +5574,15 @@ var addInitScriptCommand = registerCommand({
|
|
|
5574
5574
|
}));
|
|
5575
5575
|
return ok23({ scripts });
|
|
5576
5576
|
}
|
|
5577
|
-
if (params.remove) {
|
|
5577
|
+
if (params.remove && typeof params.remove === "string") {
|
|
5578
5578
|
const existed = registeredScripts.delete(params.remove);
|
|
5579
5579
|
return ok23({ removed: params.remove, existed });
|
|
5580
5580
|
}
|
|
5581
|
+
const removeTarget = (typeof params.remove === "string" ? params.remove : null) || (params.name && !resolveScriptContent(params) ? params.name : null);
|
|
5582
|
+
if (removeTarget && !resolveScriptContent(params)) {
|
|
5583
|
+
const existed = registeredScripts.delete(removeTarget);
|
|
5584
|
+
return ok23({ removed: removeTarget, existed });
|
|
5585
|
+
}
|
|
5581
5586
|
let content = params.stdin ? await readStdin() : resolveScriptContent(params);
|
|
5582
5587
|
if (!content) {
|
|
5583
5588
|
return ok23({ error: "No script content provided. Use --script, --file, --stdin, or --base64" });
|
package/dist/index.js
CHANGED
|
@@ -5871,7 +5871,7 @@ var InitScriptParams = z24.object({
|
|
|
5871
5871
|
stdin: z24.boolean().optional(),
|
|
5872
5872
|
name: z24.string().optional(),
|
|
5873
5873
|
list: z24.boolean().optional(),
|
|
5874
|
-
remove: z24.string().optional(),
|
|
5874
|
+
remove: z24.union([z24.string(), z24.boolean()]).optional(),
|
|
5875
5875
|
base64: z24.string().optional()
|
|
5876
5876
|
});
|
|
5877
5877
|
var registeredScripts = /* @__PURE__ */ new Map();
|
|
@@ -5924,10 +5924,15 @@ var addInitScriptCommand = registerCommand({
|
|
|
5924
5924
|
}));
|
|
5925
5925
|
return ok23({ scripts });
|
|
5926
5926
|
}
|
|
5927
|
-
if (params.remove) {
|
|
5927
|
+
if (params.remove && typeof params.remove === "string") {
|
|
5928
5928
|
const existed = registeredScripts.delete(params.remove);
|
|
5929
5929
|
return ok23({ removed: params.remove, existed });
|
|
5930
5930
|
}
|
|
5931
|
+
const removeTarget = (typeof params.remove === "string" ? params.remove : null) || (params.name && !resolveScriptContent(params) ? params.name : null);
|
|
5932
|
+
if (removeTarget && !resolveScriptContent(params)) {
|
|
5933
|
+
const existed = registeredScripts.delete(removeTarget);
|
|
5934
|
+
return ok23({ removed: removeTarget, existed });
|
|
5935
|
+
}
|
|
5931
5936
|
let content = params.stdin ? await readStdin() : resolveScriptContent(params);
|
|
5932
5937
|
if (!content) {
|
|
5933
5938
|
return ok23({ error: "No script content provided. Use --script, --file, --stdin, or --base64" });
|
|
@@ -8221,10 +8226,25 @@ var configBuiltin = {
|
|
|
8221
8226
|
}
|
|
8222
8227
|
if (subcommand === "set") {
|
|
8223
8228
|
const [key, value] = rest;
|
|
8224
|
-
if (!key ||
|
|
8229
|
+
if (!key || value === void 0) {
|
|
8225
8230
|
console.error("Usage: xbrowser config set <key> <value>");
|
|
8226
8231
|
process.exit(1);
|
|
8227
8232
|
}
|
|
8233
|
+
const knownKeys = /* @__PURE__ */ new Set([
|
|
8234
|
+
"browser.executablePath",
|
|
8235
|
+
"browser.headless",
|
|
8236
|
+
"browser.args",
|
|
8237
|
+
"captcha.notifyUrl",
|
|
8238
|
+
"captcha.autoOpen",
|
|
8239
|
+
"captcha.timeout",
|
|
8240
|
+
"captcha.strategy",
|
|
8241
|
+
"preview.port",
|
|
8242
|
+
"preview.quality",
|
|
8243
|
+
"preview.fps"
|
|
8244
|
+
]);
|
|
8245
|
+
if (!knownKeys.has(key) && !key.startsWith("browser.") && !key.startsWith("captcha.") && !key.startsWith("preview.")) {
|
|
8246
|
+
console.warn(`\u26A0\uFE0F Unknown config key: "${key}". Known keys: browser.*, captcha.*, preview.*`);
|
|
8247
|
+
}
|
|
8228
8248
|
setConfigValue(key, value);
|
|
8229
8249
|
console.log(`Set ${key} = ${value}`);
|
|
8230
8250
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xbrowser/cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
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": {
|