@letsscrapedata/controller 0.0.66 → 0.0.68

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/index.cjs CHANGED
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  CheerioElement: () => CheerioElement,
34
34
  CheerioPage: () => CheerioPage,
35
35
  ControllerEvent: () => ControllerEvent,
@@ -47,7 +47,7 @@ __export(src_exports, {
47
47
  controller: () => controller,
48
48
  setControllerLogFun: () => setControllerLogFun
49
49
  });
50
- module.exports = __toCommonJS(src_exports);
50
+ module.exports = __toCommonJS(index_exports);
51
51
 
52
52
  // src/types/types.ts
53
53
  var ControllerEvent = /* @__PURE__ */ ((ControllerEvent2) => {
@@ -2166,7 +2166,6 @@ var PuppeteerElement = class _PuppeteerElement {
2166
2166
  await this.#$ele.click(actOptions);
2167
2167
  } else if (clickType === "evaluate") {
2168
2168
  await this.#frame.evaluate(async (ev) => await ev.click(), this.#$ele);
2169
- await this.#$ele.click(actOptions);
2170
2169
  } else {
2171
2170
  (0, import_utils6.unreachable)(clickType);
2172
2171
  }
@@ -2199,7 +2198,7 @@ var PuppeteerElement = class _PuppeteerElement {
2199
2198
  await this.#$ele.press(key, options);
2200
2199
  return true;
2201
2200
  }
2202
- async screenshot(options) {
2201
+ async screenshot(options = {}) {
2203
2202
  return await this.#$ele.screenshot(options);
2204
2203
  }
2205
2204
  async scrollIntoView() {
@@ -6293,7 +6292,7 @@ var CamoufoxPage = class extends import_node_events11.default {
6293
6292
  #closeWhenFree;
6294
6293
  #resquestInterceptionOptions;
6295
6294
  #responseInterceptionOptions;
6296
- #client;
6295
+ // #client: CDPSession | null;
6297
6296
  #responseCb;
6298
6297
  #isDebugTask;
6299
6298
  #hasValidUrl(page) {
@@ -6563,7 +6562,6 @@ var CamoufoxPage = class extends import_node_events11.default {
6563
6562
  this.#closeWhenFree = false;
6564
6563
  this.#resquestInterceptionOptions = [];
6565
6564
  this.#responseInterceptionOptions = [];
6566
- this.#client = null;
6567
6565
  this.#responseCb = null;
6568
6566
  this.#isDebugTask = false;
6569
6567
  loginfo(`##browser LsdPage ${this.#pageId} ${openType}ed`);
@@ -6916,23 +6914,8 @@ var CamoufoxPage = class extends import_node_events11.default {
6916
6914
  );
6917
6915
  return true;
6918
6916
  }
6919
- async sendCDPMessage(method, params = null, detach = true) {
6920
- if (!this.#client) {
6921
- const origContext = this.browserContext()._origBrowserContext();
6922
- if (!origContext) {
6923
- throw new Error(`Invalid playwright browserContext`);
6924
- }
6925
- this.#client = await origContext.newCDPSession(this.#page);
6926
- }
6927
- if (!this.#client) {
6928
- throw new Error("No valid CDP session to send message");
6929
- }
6930
- const response = params ? await this.#client.send(method, params) : await this.#client.send(method);
6931
- if (detach) {
6932
- await this.#client.detach();
6933
- this.#client = null;
6934
- }
6935
- return response;
6917
+ async sendCDPMessage(_method, _params = null, _detach = true) {
6918
+ throw new Error("##browser Camoufox does not support sendCDPMessage");
6936
6919
  }
6937
6920
  setCloseWhenFree(closeWhenFree) {
6938
6921
  this.#closeWhenFree = closeWhenFree;
@@ -8043,8 +8026,8 @@ var LsdBrowserController = class _LsdBrowserController {
8043
8026
  lsdBrowser = new PatchrightBrowser(browser, browserType, "launch", actOptions, this.#nextBrowserIdx++, browserPid);
8044
8027
  }
8045
8028
  } else if (browserControllerType === "puppeteer") {
8046
- const product = this.#puppeteerProduct(browserType);
8047
- const launchOptions = { headless, timeout, product };
8029
+ const pupBrowserType = this.#puppeteerProduct(browserType);
8030
+ const launchOptions = { headless, timeout, browser: pupBrowserType };
8048
8031
  if (executablePath) {
8049
8032
  launchOptions.executablePath = executablePath;
8050
8033
  }
package/dist/index.js CHANGED
@@ -2115,7 +2115,6 @@ var PuppeteerElement = class _PuppeteerElement {
2115
2115
  await this.#$ele.click(actOptions);
2116
2116
  } else if (clickType === "evaluate") {
2117
2117
  await this.#frame.evaluate(async (ev) => await ev.click(), this.#$ele);
2118
- await this.#$ele.click(actOptions);
2119
2118
  } else {
2120
2119
  unreachable3(clickType);
2121
2120
  }
@@ -2148,7 +2147,7 @@ var PuppeteerElement = class _PuppeteerElement {
2148
2147
  await this.#$ele.press(key, options);
2149
2148
  return true;
2150
2149
  }
2151
- async screenshot(options) {
2150
+ async screenshot(options = {}) {
2152
2151
  return await this.#$ele.screenshot(options);
2153
2152
  }
2154
2153
  async scrollIntoView() {
@@ -6242,7 +6241,7 @@ var CamoufoxPage = class extends EventEmitter11 {
6242
6241
  #closeWhenFree;
6243
6242
  #resquestInterceptionOptions;
6244
6243
  #responseInterceptionOptions;
6245
- #client;
6244
+ // #client: CDPSession | null;
6246
6245
  #responseCb;
6247
6246
  #isDebugTask;
6248
6247
  #hasValidUrl(page) {
@@ -6512,7 +6511,6 @@ var CamoufoxPage = class extends EventEmitter11 {
6512
6511
  this.#closeWhenFree = false;
6513
6512
  this.#resquestInterceptionOptions = [];
6514
6513
  this.#responseInterceptionOptions = [];
6515
- this.#client = null;
6516
6514
  this.#responseCb = null;
6517
6515
  this.#isDebugTask = false;
6518
6516
  loginfo(`##browser LsdPage ${this.#pageId} ${openType}ed`);
@@ -6865,23 +6863,8 @@ var CamoufoxPage = class extends EventEmitter11 {
6865
6863
  );
6866
6864
  return true;
6867
6865
  }
6868
- async sendCDPMessage(method, params = null, detach = true) {
6869
- if (!this.#client) {
6870
- const origContext = this.browserContext()._origBrowserContext();
6871
- if (!origContext) {
6872
- throw new Error(`Invalid playwright browserContext`);
6873
- }
6874
- this.#client = await origContext.newCDPSession(this.#page);
6875
- }
6876
- if (!this.#client) {
6877
- throw new Error("No valid CDP session to send message");
6878
- }
6879
- const response = params ? await this.#client.send(method, params) : await this.#client.send(method);
6880
- if (detach) {
6881
- await this.#client.detach();
6882
- this.#client = null;
6883
- }
6884
- return response;
6866
+ async sendCDPMessage(_method, _params = null, _detach = true) {
6867
+ throw new Error("##browser Camoufox does not support sendCDPMessage");
6885
6868
  }
6886
6869
  setCloseWhenFree(closeWhenFree) {
6887
6870
  this.#closeWhenFree = closeWhenFree;
@@ -7992,8 +7975,8 @@ var LsdBrowserController = class _LsdBrowserController {
7992
7975
  lsdBrowser = new PatchrightBrowser(browser, browserType, "launch", actOptions, this.#nextBrowserIdx++, browserPid);
7993
7976
  }
7994
7977
  } else if (browserControllerType === "puppeteer") {
7995
- const product = this.#puppeteerProduct(browserType);
7996
- const launchOptions = { headless, timeout, product };
7978
+ const pupBrowserType = this.#puppeteerProduct(browserType);
7979
+ const launchOptions = { headless, timeout, browser: pupBrowserType };
7997
7980
  if (executablePath) {
7998
7981
  launchOptions.executablePath = executablePath;
7999
7982
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letsscrapedata/controller",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "description": "Unified browser / HTML controller interfaces that support patchright, camoufox, playwright, puppeteer and cheerio",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -52,15 +52,16 @@
52
52
  "camoufox-js-lsd": "^0.6.5",
53
53
  "cheerio": "^1.0.0",
54
54
  "patchright": "^1.52.5",
55
- "playwright": "^1.43.0",
55
+ "playwright": "^1.54.2",
56
56
  "playwright-extra": "^4.3.6",
57
- "puppeteer": "^22.6.3",
57
+ "puppeteer": "^24.16.0",
58
58
  "puppeteer-extra": "^3.3.6",
59
- "puppeteer-extra-plugin-stealth": "^2.11.2"
59
+ "puppeteer-extra-plugin-stealth": "^2.11.2",
60
+ "utils": "^0.3.1"
60
61
  },
61
62
  "devDependencies": {
62
63
  "@types/cheerio": "^0.22.35",
63
- "tsup": "^8.0.2",
64
- "typescript": "^5.7.2"
64
+ "tsup": "^8.5.0",
65
+ "typescript": "^5.9.2"
65
66
  }
66
67
  }