@letsscrapedata/controller 0.0.50 → 0.0.51

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
@@ -40,21 +40,22 @@ __export(src_exports, {
40
40
  PuppeteerBrowserContext: () => PuppeteerBrowserContext,
41
41
  PuppeteerElement: () => PuppeteerElement,
42
42
  PuppeteerPage: () => PuppeteerPage,
43
- controller: () => controller
43
+ controller: () => controller,
44
+ setControllerLogFun: () => setControllerLogFun
44
45
  });
45
46
  module.exports = __toCommonJS(src_exports);
46
47
 
47
- // src/playwright/browser.ts
48
- var import_node_events3 = __toESM(require("events"), 1);
49
- var import_utils5 = require("@letsscrapedata/utils");
50
-
51
- // src/playwright/context.ts
52
- var import_node_events2 = __toESM(require("events"), 1);
53
- var import_utils4 = require("@letsscrapedata/utils");
54
-
55
48
  // src/utils/log.ts
56
49
  var import_utils = require("@letsscrapedata/utils");
57
50
  var pkgLog = import_utils.log;
51
+ function setControllerLogFun(logFun) {
52
+ if (typeof logFun === "function") {
53
+ pkgLog = logFun;
54
+ return true;
55
+ } else {
56
+ return false;
57
+ }
58
+ }
58
59
  async function loginfo(...args) {
59
60
  await pkgLog(import_utils.LogLevel.INF, ...args);
60
61
  }
@@ -65,6 +66,14 @@ async function logerr(...args) {
65
66
  await pkgLog(import_utils.LogLevel.ERR, ...args);
66
67
  }
67
68
 
69
+ // src/playwright/browser.ts
70
+ var import_node_events3 = __toESM(require("events"), 1);
71
+ var import_utils5 = require("@letsscrapedata/utils");
72
+
73
+ // src/playwright/context.ts
74
+ var import_node_events2 = __toESM(require("events"), 1);
75
+ var import_utils4 = require("@letsscrapedata/utils");
76
+
68
77
  // src/playwright/page.ts
69
78
  var import_node_events = __toESM(require("events"), 1);
70
79
  var import_utils3 = require("@letsscrapedata/utils");
@@ -3919,5 +3928,6 @@ var controller = new LsdBrowserController();
3919
3928
  PuppeteerBrowserContext,
3920
3929
  PuppeteerElement,
3921
3930
  PuppeteerPage,
3922
- controller
3931
+ controller,
3932
+ setControllerLogFun
3923
3933
  });
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import EventEmitter from 'node:events';
2
2
  import { Browser as Browser$1, BrowserContext as BrowserContext$1, Frame as Frame$1, Page as Page$1, ElementHandle, HTTPResponse, PuppeteerNode } from 'puppeteer';
3
3
  import { Browser, BrowserContext, Frame, Page, Locator, Response, APIRequestContext, BrowserType, FrameLocator } from 'playwright';
4
+ import { LogFunction } from '@letsscrapedata/utils';
4
5
 
5
6
  type AllBrowser = Browser | Browser$1;
6
7
  type AllBrowserContext = BrowserContext | BrowserContext$1;
@@ -1108,6 +1109,8 @@ interface LsdBrowserController$1 {
1108
1109
  newApiContext(options?: LsdApiContextOptions): Promise<LsdApiContext>;
1109
1110
  }
1110
1111
 
1112
+ declare function setControllerLogFun(logFun: LogFunction): boolean;
1113
+
1111
1114
  declare class PlaywrightBrowser extends EventEmitter implements LsdBrowser {
1112
1115
  #private;
1113
1116
  constructor(browser: Browser, browerType: LsdBrowserType, browserCreateMethod: BrowserCreationMethod, options: LsdLaunchOptions | LsdConnectOptions, browserIdx?: number, pid?: number);
@@ -1457,4 +1460,4 @@ declare class LsdBrowserController implements LsdBrowserController$1 {
1457
1460
  }
1458
1461
  declare const controller: LsdBrowserController;
1459
1462
 
1460
- export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller };
1463
+ export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, setControllerLogFun };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import EventEmitter from 'node:events';
2
2
  import { Browser as Browser$1, BrowserContext as BrowserContext$1, Frame as Frame$1, Page as Page$1, ElementHandle, HTTPResponse, PuppeteerNode } from 'puppeteer';
3
3
  import { Browser, BrowserContext, Frame, Page, Locator, Response, APIRequestContext, BrowserType, FrameLocator } from 'playwright';
4
+ import { LogFunction } from '@letsscrapedata/utils';
4
5
 
5
6
  type AllBrowser = Browser | Browser$1;
6
7
  type AllBrowserContext = BrowserContext | BrowserContext$1;
@@ -1108,6 +1109,8 @@ interface LsdBrowserController$1 {
1108
1109
  newApiContext(options?: LsdApiContextOptions): Promise<LsdApiContext>;
1109
1110
  }
1110
1111
 
1112
+ declare function setControllerLogFun(logFun: LogFunction): boolean;
1113
+
1111
1114
  declare class PlaywrightBrowser extends EventEmitter implements LsdBrowser {
1112
1115
  #private;
1113
1116
  constructor(browser: Browser, browerType: LsdBrowserType, browserCreateMethod: BrowserCreationMethod, options: LsdLaunchOptions | LsdConnectOptions, browserIdx?: number, pid?: number);
@@ -1457,4 +1460,4 @@ declare class LsdBrowserController implements LsdBrowserController$1 {
1457
1460
  }
1458
1461
  declare const controller: LsdBrowserController;
1459
1462
 
1460
- export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller };
1463
+ export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, setControllerLogFun };
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- // src/playwright/browser.ts
2
- import EventEmitter3 from "events";
3
- import { getCurrentUnixTime as getCurrentUnixTime3, getPerformanceOfPidTree } from "@letsscrapedata/utils";
4
-
5
- // src/playwright/context.ts
6
- import EventEmitter2 from "events";
7
- import { getCurrentUnixTime as getCurrentUnixTime2, sleep } from "@letsscrapedata/utils";
8
-
9
1
  // src/utils/log.ts
10
2
  import { log, LogLevel } from "@letsscrapedata/utils";
11
3
  var pkgLog = log;
4
+ function setControllerLogFun(logFun) {
5
+ if (typeof logFun === "function") {
6
+ pkgLog = logFun;
7
+ return true;
8
+ } else {
9
+ return false;
10
+ }
11
+ }
12
12
  async function loginfo(...args) {
13
13
  await pkgLog(LogLevel.INF, ...args);
14
14
  }
@@ -19,6 +19,14 @@ async function logerr(...args) {
19
19
  await pkgLog(LogLevel.ERR, ...args);
20
20
  }
21
21
 
22
+ // src/playwright/browser.ts
23
+ import EventEmitter3 from "events";
24
+ import { getCurrentUnixTime as getCurrentUnixTime3, getPerformanceOfPidTree } from "@letsscrapedata/utils";
25
+
26
+ // src/playwright/context.ts
27
+ import EventEmitter2 from "events";
28
+ import { getCurrentUnixTime as getCurrentUnixTime2, sleep } from "@letsscrapedata/utils";
29
+
22
30
  // src/playwright/page.ts
23
31
  import EventEmitter from "events";
24
32
  import { getCurrentUnixTime, unreachable as unreachable2 } from "@letsscrapedata/utils";
@@ -3872,5 +3880,6 @@ export {
3872
3880
  PuppeteerBrowserContext,
3873
3881
  PuppeteerElement,
3874
3882
  PuppeteerPage,
3875
- controller
3883
+ controller,
3884
+ setControllerLogFun
3876
3885
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letsscrapedata/controller",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "description": "Unified browser / HTML controller interfaces that support playwright, puppeteer and cheerio",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",