@letsscrapedata/controller 0.0.24 → 0.0.25

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
@@ -1481,7 +1481,7 @@ var PlaywrightBrowser = class extends import_node_events3.default {
1481
1481
  return null;
1482
1482
  }
1483
1483
  const browserContextOptions = {};
1484
- if (this.#options.args?.includes("--start-maximized")) {
1484
+ if (this.#options.maxWindowSize) {
1485
1485
  browserContextOptions.viewport = null;
1486
1486
  }
1487
1487
  const proxy = options?.proxy ? Object.assign({}, options.proxy) : this.#proxy;
@@ -17234,6 +17234,7 @@ var LsdBrowserController = class _LsdBrowserController {
17234
17234
  timeout = 3e4,
17235
17235
  args = [],
17236
17236
  executablePath = "",
17237
+ maxWindowSize = false,
17237
17238
  headless = true,
17238
17239
  minBrowserContexts = 1,
17239
17240
  // incognito
@@ -17242,7 +17243,7 @@ var LsdBrowserController = class _LsdBrowserController {
17242
17243
  userAgent = ""
17243
17244
  } = options ? options : {};
17244
17245
  const incognito = typeof options?.incognito === "boolean" ? options.incognito : browserControllerType === "puppeteer" ? false : true;
17245
- const actOptions = { closeFreePagesIntervalSeconds, maxBrowserContextsPerBrowser, maxPagesPerBrowserContext, maxPageFreeSeconds, maxViewportOfNewPage, proxy, timeout, args, executablePath, headless, minBrowserContexts, incognito, proxyPerBrowserContext, userDataDir, userAgent };
17246
+ const actOptions = { closeFreePagesIntervalSeconds, maxBrowserContextsPerBrowser, maxPagesPerBrowserContext, maxPageFreeSeconds, maxViewportOfNewPage, proxy, timeout, args, executablePath, maxWindowSize, headless, minBrowserContexts, incognito, proxyPerBrowserContext, userDataDir, userAgent };
17246
17247
  let idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--incoginto"));
17247
17248
  if (idx >= 0) {
17248
17249
  (0, import_utils15.logwarn)(`Please use options.incognito instead when launching new browser.`);
@@ -17258,12 +17259,20 @@ var LsdBrowserController = class _LsdBrowserController {
17258
17259
  (0, import_utils15.logwarn)(`Please use options.userDataDir instead when launching new browser.`);
17259
17260
  args.splice(idx, 1);
17260
17261
  }
17262
+ idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--start-maximized"));
17263
+ if (idx >= 0) {
17264
+ (0, import_utils15.logwarn)(`Please use options.maxWindowSize instead when launching new browser.`);
17265
+ args.splice(idx, 1);
17266
+ }
17261
17267
  let lsdBrowser;
17262
17268
  if (browserControllerType === "playwright") {
17263
17269
  const launchOptions = { headless, timeout };
17264
17270
  if (executablePath) {
17265
17271
  launchOptions.executablePath = executablePath;
17266
17272
  }
17273
+ if (maxWindowSize) {
17274
+ args.push("--start-maximized");
17275
+ }
17267
17276
  if (proxy?.server && proxy.server !== "default") {
17268
17277
  launchOptions.proxy = proxy;
17269
17278
  } else if (proxyPerBrowserContext && browserType === "chromium" && this.#osPlatform.startsWith("win")) {
@@ -17288,12 +17297,13 @@ var LsdBrowserController = class _LsdBrowserController {
17288
17297
  } else if (browserControllerType === "puppeteer") {
17289
17298
  const product = this.#puppeteerProduct(browserType);
17290
17299
  const launchOptions = { headless, timeout, product };
17291
- if (actOptions.args?.includes("--start-maximized")) {
17292
- launchOptions.defaultViewport = null;
17293
- }
17294
17300
  if (executablePath) {
17295
17301
  launchOptions.executablePath = executablePath;
17296
17302
  }
17303
+ if (maxWindowSize) {
17304
+ args.push("--start-maximized");
17305
+ launchOptions.defaultViewport = null;
17306
+ }
17297
17307
  if (browserType === "chromium") {
17298
17308
  if (incognito) {
17299
17309
  args.push("--incognito");
package/dist/index.d.cts CHANGED
@@ -80,6 +80,10 @@ interface BrowserOptions {
80
80
  interface LsdLaunchOptions extends BrowserOptions {
81
81
  args?: string[];
82
82
  executablePath?: string;
83
+ /**
84
+ * @default false
85
+ */
86
+ maxWindowSize?: boolean;
83
87
  /**
84
88
  * @default true
85
89
  */
package/dist/index.d.ts CHANGED
@@ -80,6 +80,10 @@ interface BrowserOptions {
80
80
  interface LsdLaunchOptions extends BrowserOptions {
81
81
  args?: string[];
82
82
  executablePath?: string;
83
+ /**
84
+ * @default false
85
+ */
86
+ maxWindowSize?: boolean;
83
87
  /**
84
88
  * @default true
85
89
  */
package/dist/index.js CHANGED
@@ -1461,7 +1461,7 @@ var PlaywrightBrowser = class extends EventEmitter3 {
1461
1461
  return null;
1462
1462
  }
1463
1463
  const browserContextOptions = {};
1464
- if (this.#options.args?.includes("--start-maximized")) {
1464
+ if (this.#options.maxWindowSize) {
1465
1465
  browserContextOptions.viewport = null;
1466
1466
  }
1467
1467
  const proxy = options?.proxy ? Object.assign({}, options.proxy) : this.#proxy;
@@ -17214,6 +17214,7 @@ var LsdBrowserController = class _LsdBrowserController {
17214
17214
  timeout = 3e4,
17215
17215
  args = [],
17216
17216
  executablePath = "",
17217
+ maxWindowSize = false,
17217
17218
  headless = true,
17218
17219
  minBrowserContexts = 1,
17219
17220
  // incognito
@@ -17222,7 +17223,7 @@ var LsdBrowserController = class _LsdBrowserController {
17222
17223
  userAgent = ""
17223
17224
  } = options ? options : {};
17224
17225
  const incognito = typeof options?.incognito === "boolean" ? options.incognito : browserControllerType === "puppeteer" ? false : true;
17225
- const actOptions = { closeFreePagesIntervalSeconds, maxBrowserContextsPerBrowser, maxPagesPerBrowserContext, maxPageFreeSeconds, maxViewportOfNewPage, proxy, timeout, args, executablePath, headless, minBrowserContexts, incognito, proxyPerBrowserContext, userDataDir, userAgent };
17226
+ const actOptions = { closeFreePagesIntervalSeconds, maxBrowserContextsPerBrowser, maxPagesPerBrowserContext, maxPageFreeSeconds, maxViewportOfNewPage, proxy, timeout, args, executablePath, maxWindowSize, headless, minBrowserContexts, incognito, proxyPerBrowserContext, userDataDir, userAgent };
17226
17227
  let idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--incoginto"));
17227
17228
  if (idx >= 0) {
17228
17229
  logwarn6(`Please use options.incognito instead when launching new browser.`);
@@ -17238,12 +17239,20 @@ var LsdBrowserController = class _LsdBrowserController {
17238
17239
  logwarn6(`Please use options.userDataDir instead when launching new browser.`);
17239
17240
  args.splice(idx, 1);
17240
17241
  }
17242
+ idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--start-maximized"));
17243
+ if (idx >= 0) {
17244
+ logwarn6(`Please use options.maxWindowSize instead when launching new browser.`);
17245
+ args.splice(idx, 1);
17246
+ }
17241
17247
  let lsdBrowser;
17242
17248
  if (browserControllerType === "playwright") {
17243
17249
  const launchOptions = { headless, timeout };
17244
17250
  if (executablePath) {
17245
17251
  launchOptions.executablePath = executablePath;
17246
17252
  }
17253
+ if (maxWindowSize) {
17254
+ args.push("--start-maximized");
17255
+ }
17247
17256
  if (proxy?.server && proxy.server !== "default") {
17248
17257
  launchOptions.proxy = proxy;
17249
17258
  } else if (proxyPerBrowserContext && browserType === "chromium" && this.#osPlatform.startsWith("win")) {
@@ -17268,12 +17277,13 @@ var LsdBrowserController = class _LsdBrowserController {
17268
17277
  } else if (browserControllerType === "puppeteer") {
17269
17278
  const product = this.#puppeteerProduct(browserType);
17270
17279
  const launchOptions = { headless, timeout, product };
17271
- if (actOptions.args?.includes("--start-maximized")) {
17272
- launchOptions.defaultViewport = null;
17273
- }
17274
17280
  if (executablePath) {
17275
17281
  launchOptions.executablePath = executablePath;
17276
17282
  }
17283
+ if (maxWindowSize) {
17284
+ args.push("--start-maximized");
17285
+ launchOptions.defaultViewport = null;
17286
+ }
17277
17287
  if (browserType === "chromium") {
17278
17288
  if (incognito) {
17279
17289
  args.push("--incognito");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letsscrapedata/controller",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "Unified browser / HTML controller interfaces that support playwright, puppeteer and cheerio",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",