@xbrowser/cli 1.8.4 → 1.8.5

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.
@@ -20,7 +20,7 @@ import {
20
20
  saveSessionDiskMeta,
21
21
  setActivePage,
22
22
  touchSession
23
- } from "./chunk-6QGZN5U7.js";
23
+ } from "./chunk-TAHJCCME.js";
24
24
  import "./chunk-VJNMAWPZ.js";
25
25
  import "./chunk-TNEN6VQ2.js";
26
26
  import "./chunk-GDKLH7ZY.js";
@@ -20,7 +20,7 @@ import {
20
20
  saveSessionDiskMeta,
21
21
  setActivePage,
22
22
  touchSession
23
- } from "./chunk-IGWWPMEQ.js";
23
+ } from "./chunk-7EOQV6ZW.js";
24
24
  import "./chunk-VJNMAWPZ.js";
25
25
  import "./chunk-TNEN6VQ2.js";
26
26
  import "./chunk-GDKLH7ZY.js";
@@ -20,7 +20,7 @@ import {
20
20
  saveSessionDiskMeta,
21
21
  setActivePage,
22
22
  touchSession
23
- } from "./chunk-35DOHDTA.js";
23
+ } from "./chunk-U25ZKXBJ.js";
24
24
  import "./chunk-TNEN6VQ2.js";
25
25
  import "./chunk-GDKLH7ZY.js";
26
26
  import "./chunk-KFQGP6VL.js";
@@ -656,7 +656,7 @@ async function closeSessionByName(name) {
656
656
  } catch {
657
657
  }
658
658
  try {
659
- const { SessionRecorder } = await import("./session-recorder-RTDGURIJ.js");
659
+ const { SessionRecorder } = await import("./session-recorder-H2WPBCSW.js");
660
660
  SessionRecorder.cleanup(session.name);
661
661
  } catch {
662
662
  }
@@ -1725,6 +1725,16 @@ var SessionRecorder = class _SessionRecorder {
1725
1725
  await this.page.addInitScript(getSelectorGeneratorScript());
1726
1726
  await this.page.addInitScript(ACTION_SIGNAL_SCRIPT);
1727
1727
  await this.page.addInitScript(CHECKPOINT_OVERLAY_SCRIPT);
1728
+ this.context.on("request", this.handleRequest);
1729
+ this.context.on("response", this.handleResponse);
1730
+ this.context.on("page", this.handleNewPage);
1731
+ for (const p of this.context.pages()) {
1732
+ p.on("request", this.handleRequest);
1733
+ p.on("response", this.handleResponse);
1734
+ }
1735
+ this.page.on("framenavigated", this.handleFrameNavigated);
1736
+ this.page.on("dialog", this.handleDialog);
1737
+ this.page.on("filechooser", this.handleFileChooser);
1728
1738
  if (url) {
1729
1739
  await this.page.goto(url, { waitUntil: "domcontentloaded", timeout: 3e4 });
1730
1740
  this.startUrl = url;
@@ -1740,17 +1750,7 @@ var SessionRecorder = class _SessionRecorder {
1740
1750
  };
1741
1751
  writeFileSync2(this.controlFilePath, JSON.stringify(control, null, 2), "utf-8");
1742
1752
  await this.injectActionScript(this.page);
1743
- this.context.on("request", this.handleRequest);
1744
- this.context.on("response", this.handleResponse);
1745
- this.context.on("page", this.handleNewPage);
1746
- for (const p of this.context.pages()) {
1747
- p.on("request", this.handleRequest);
1748
- p.on("response", this.handleResponse);
1749
- }
1750
1753
  this.context.on("page", this.handleNewPage);
1751
- this.page.on("framenavigated", this.handleFrameNavigated);
1752
- this.page.on("dialog", this.handleDialog);
1753
- this.page.on("filechooser", this.handleFileChooser);
1754
1754
  this.pollTimer = setInterval(() => void this.pollActions(), 200);
1755
1755
  this.flushTimer = setInterval(() => this.flushToDisk(), 5e3);
1756
1756
  }
@@ -2066,7 +2066,7 @@ var SessionRecorder = class _SessionRecorder {
2066
2066
  this.activePages.delete(page);
2067
2067
  });
2068
2068
  page.on("framenavigated", async (frame) => {
2069
- if (frame !== frame.page().mainFrame()) return;
2069
+ if (frame.isDetached()) return;
2070
2070
  const url = frame.url();
2071
2071
  if (url && url !== "about:blank" && !url.startsWith("chrome")) {
2072
2072
  try {
@@ -2077,7 +2077,7 @@ var SessionRecorder = class _SessionRecorder {
2077
2077
  });
2078
2078
  };
2079
2079
  handleFrameNavigated = (frame) => {
2080
- if (frame !== frame.page().mainFrame()) return;
2080
+ if (frame.isDetached()) return;
2081
2081
  const newUrl = frame.url();
2082
2082
  this.contextCounter++;
2083
2083
  this.contextChanges.push({
@@ -2021,7 +2021,7 @@ async function closeSessionByName(name) {
2021
2021
  } catch {
2022
2022
  }
2023
2023
  try {
2024
- const { SessionRecorder } = await import("./session-recorder-YI7YYM36.js");
2024
+ const { SessionRecorder } = await import("./session-recorder-CV5EJSDY.js");
2025
2025
  SessionRecorder.cleanup(session.name);
2026
2026
  } catch {
2027
2027
  }
@@ -4965,7 +4965,7 @@ async function closeSessionByName(name) {
4965
4965
  } catch {
4966
4966
  }
4967
4967
  try {
4968
- const { SessionRecorder } = await import("./session-recorder-RTDGURIJ.js");
4968
+ const { SessionRecorder } = await import("./session-recorder-H2WPBCSW.js");
4969
4969
  SessionRecorder.cleanup(session.name);
4970
4970
  } catch {
4971
4971
  }
@@ -1328,6 +1328,16 @@ var SessionRecorder = class _SessionRecorder {
1328
1328
  await this.page.addInitScript(getSelectorGeneratorScript());
1329
1329
  await this.page.addInitScript(ACTION_SIGNAL_SCRIPT);
1330
1330
  await this.page.addInitScript(CHECKPOINT_OVERLAY_SCRIPT);
1331
+ this.context.on("request", this.handleRequest);
1332
+ this.context.on("response", this.handleResponse);
1333
+ this.context.on("page", this.handleNewPage);
1334
+ for (const p of this.context.pages()) {
1335
+ p.on("request", this.handleRequest);
1336
+ p.on("response", this.handleResponse);
1337
+ }
1338
+ this.page.on("framenavigated", this.handleFrameNavigated);
1339
+ this.page.on("dialog", this.handleDialog);
1340
+ this.page.on("filechooser", this.handleFileChooser);
1331
1341
  if (url) {
1332
1342
  await this.page.goto(url, { waitUntil: "domcontentloaded", timeout: 3e4 });
1333
1343
  this.startUrl = url;
@@ -1343,17 +1353,7 @@ var SessionRecorder = class _SessionRecorder {
1343
1353
  };
1344
1354
  writeFileSync(this.controlFilePath, JSON.stringify(control, null, 2), "utf-8");
1345
1355
  await this.injectActionScript(this.page);
1346
- this.context.on("request", this.handleRequest);
1347
- this.context.on("response", this.handleResponse);
1348
- this.context.on("page", this.handleNewPage);
1349
- for (const p of this.context.pages()) {
1350
- p.on("request", this.handleRequest);
1351
- p.on("response", this.handleResponse);
1352
- }
1353
1356
  this.context.on("page", this.handleNewPage);
1354
- this.page.on("framenavigated", this.handleFrameNavigated);
1355
- this.page.on("dialog", this.handleDialog);
1356
- this.page.on("filechooser", this.handleFileChooser);
1357
1357
  this.pollTimer = setInterval(() => void this.pollActions(), 200);
1358
1358
  this.flushTimer = setInterval(() => this.flushToDisk(), 5e3);
1359
1359
  }
@@ -1669,7 +1669,7 @@ var SessionRecorder = class _SessionRecorder {
1669
1669
  this.activePages.delete(page);
1670
1670
  });
1671
1671
  page.on("framenavigated", async (frame) => {
1672
- if (frame !== frame.page().mainFrame()) return;
1672
+ if (frame.isDetached()) return;
1673
1673
  const url = frame.url();
1674
1674
  if (url && url !== "about:blank" && !url.startsWith("chrome")) {
1675
1675
  try {
@@ -1680,7 +1680,7 @@ var SessionRecorder = class _SessionRecorder {
1680
1680
  });
1681
1681
  };
1682
1682
  handleFrameNavigated = (frame) => {
1683
- if (frame !== frame.page().mainFrame()) return;
1683
+ if (frame.isDetached()) return;
1684
1684
  const newUrl = frame.url();
1685
1685
  this.contextCounter++;
1686
1686
  this.contextChanges.push({
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  SessionRecorder
4
- } from "./chunk-ACFE6PKF.js";
4
+ } from "./chunk-XU5WOJIV.js";
5
5
  import {
6
6
  addKnownIssue,
7
7
  getKnowledgePath,
@@ -25,7 +25,7 @@ import {
25
25
  resolveLaunchOpts,
26
26
  saveSessionDiskMeta,
27
27
  setActivePage
28
- } from "./chunk-35DOHDTA.js";
28
+ } from "./chunk-U25ZKXBJ.js";
29
29
  import "./chunk-TNEN6VQ2.js";
30
30
  import {
31
31
  forwardCommandLog,
@@ -7207,7 +7207,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
7207
7207
  }
7208
7208
  let targetPageOverride = null;
7209
7209
  if (_target && extraOpts?.cdpEndpoint) {
7210
- const { findTargetPage } = await import("./browser-KVTJQKBA.js");
7210
+ const { findTargetPage } = await import("./browser-PUAJ3AHG.js");
7211
7211
  targetPageOverride = await findTargetPage(extraOpts.cdpEndpoint, _target);
7212
7212
  if (!targetPageOverride) {
7213
7213
  return errorResult(`Target "${_target}" not found. Use 'xbrowser targets --cdp ${extraOpts.cdpEndpoint}' to list available pages.`);
@@ -11152,7 +11152,7 @@ async function handleFilter(args, _mode, options) {
11152
11152
  console.log(` Original: ${result.originalCount}, After: ${result.filteredCount}, Removed: ${result.removed} (${result.percentage}%)`);
11153
11153
  }
11154
11154
  async function handleGeneratePlugin(sessionName, pluginName, outputDir) {
11155
- const { SessionRecorder: SessionRecorder2 } = await import("./session-recorder-RTDGURIJ.js");
11155
+ const { SessionRecorder: SessionRecorder2 } = await import("./session-recorder-H2WPBCSW.js");
11156
11156
  const { readSiteKnowledge: readSiteKnowledge2, toMarkdown } = await import("./site-knowledge-SYC6VCDB.js");
11157
11157
  const { mkdirSync: mkdirSync10, writeFileSync: writeFileSync12 } = await import("fs");
11158
11158
  const { join: join14 } = await import("path");
@@ -13359,7 +13359,7 @@ async function main() {
13359
13359
  const command = process.argv[2];
13360
13360
  const isLongRunning = command === "preview" || command === "serve";
13361
13361
  if (!isLongRunning) {
13362
- const { ensureProcessCanExit } = await import("./browser-KVTJQKBA.js");
13362
+ const { ensureProcessCanExit } = await import("./browser-PUAJ3AHG.js");
13363
13363
  await ensureProcessCanExit().catch(() => {
13364
13364
  });
13365
13365
  process.exit(exitCode);
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-VEDJ5XSQ.js";
6
6
  import {
7
7
  SessionRecorder
8
- } from "./chunk-2SVQTI2O.js";
8
+ } from "./chunk-BALOM2HW.js";
9
9
  import {
10
10
  closeEphemeralContext,
11
11
  closeSessionByName,
@@ -21,7 +21,7 @@ import {
21
21
  resolveLaunchOpts,
22
22
  saveSessionDiskMeta,
23
23
  setActivePage
24
- } from "./chunk-6QGZN5U7.js";
24
+ } from "./chunk-TAHJCCME.js";
25
25
  import "./chunk-VJNMAWPZ.js";
26
26
  import "./chunk-TNEN6VQ2.js";
27
27
  import {
@@ -6744,7 +6744,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
6744
6744
  }
6745
6745
  let targetPageOverride = null;
6746
6746
  if (_target && extraOpts?.cdpEndpoint) {
6747
- const { findTargetPage } = await import("./browser-4PIVOYCW.js");
6747
+ const { findTargetPage } = await import("./browser-NSSCH4MJ.js");
6748
6748
  targetPageOverride = await findTargetPage(extraOpts.cdpEndpoint, _target);
6749
6749
  if (!targetPageOverride) {
6750
6750
  return errorResult(`Target "${_target}" not found. Use 'xbrowser targets --cdp ${extraOpts.cdpEndpoint}' to list available pages.`);
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ import {
57
57
  } from "./chunk-GJAV3QGG.js";
58
58
  import {
59
59
  SessionRecorder
60
- } from "./chunk-ACFE6PKF.js";
60
+ } from "./chunk-XU5WOJIV.js";
61
61
  import {
62
62
  addKnownIssue,
63
63
  getKnowledgePath,
@@ -82,7 +82,7 @@ import {
82
82
  resolveLaunchOpts,
83
83
  saveSessionDiskMeta,
84
84
  setActivePage
85
- } from "./chunk-IGWWPMEQ.js";
85
+ } from "./chunk-7EOQV6ZW.js";
86
86
  import "./chunk-VJNMAWPZ.js";
87
87
  import "./chunk-TNEN6VQ2.js";
88
88
  import {
@@ -7527,7 +7527,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
7527
7527
  }
7528
7528
  let targetPageOverride = null;
7529
7529
  if (_target && extraOpts?.cdpEndpoint) {
7530
- const { findTargetPage } = await import("./browser-RJIRI2H5.js");
7530
+ const { findTargetPage } = await import("./browser-PTELW3WS.js");
7531
7531
  targetPageOverride = await findTargetPage(extraOpts.cdpEndpoint, _target);
7532
7532
  if (!targetPageOverride) {
7533
7533
  return errorResult(`Target "${_target}" not found. Use 'xbrowser targets --cdp ${extraOpts.cdpEndpoint}' to list available pages.`);
@@ -11475,7 +11475,7 @@ async function handleFilter(args, _mode, options) {
11475
11475
  console.log(` Original: ${result.originalCount}, After: ${result.filteredCount}, Removed: ${result.removed} (${result.percentage}%)`);
11476
11476
  }
11477
11477
  async function handleGeneratePlugin(sessionName, pluginName, outputDir) {
11478
- const { SessionRecorder: SessionRecorder2 } = await import("./session-recorder-RTDGURIJ.js");
11478
+ const { SessionRecorder: SessionRecorder2 } = await import("./session-recorder-H2WPBCSW.js");
11479
11479
  const { readSiteKnowledge: readSiteKnowledge2, toMarkdown } = await import("./site-knowledge-SYC6VCDB.js");
11480
11480
  const { mkdirSync: mkdirSync11, writeFileSync: writeFileSync13 } = await import("fs");
11481
11481
  const { join: join14 } = await import("path");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SessionRecorder
3
- } from "./chunk-2SVQTI2O.js";
3
+ } from "./chunk-BALOM2HW.js";
4
4
  import "./chunk-KFQGP6VL.js";
5
5
  export {
6
6
  SessionRecorder
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SessionRecorder
3
- } from "./chunk-ACFE6PKF.js";
3
+ } from "./chunk-XU5WOJIV.js";
4
4
  import "./chunk-OZKD3W4X.js";
5
5
  import "./chunk-KFQGP6VL.js";
6
6
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xbrowser/cli",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
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": {