@letsscrapedata/controller 0.0.23 → 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,6 +1481,9 @@ var PlaywrightBrowser = class extends import_node_events3.default {
1481
1481
  return null;
1482
1482
  }
1483
1483
  const browserContextOptions = {};
1484
+ if (this.#options.maxWindowSize) {
1485
+ browserContextOptions.viewport = null;
1486
+ }
1484
1487
  const proxy = options?.proxy ? Object.assign({}, options.proxy) : this.#proxy;
1485
1488
  if (proxy) {
1486
1489
  const { server, username, password } = proxy;
@@ -17231,6 +17234,7 @@ var LsdBrowserController = class _LsdBrowserController {
17231
17234
  timeout = 3e4,
17232
17235
  args = [],
17233
17236
  executablePath = "",
17237
+ maxWindowSize = false,
17234
17238
  headless = true,
17235
17239
  minBrowserContexts = 1,
17236
17240
  // incognito
@@ -17239,7 +17243,7 @@ var LsdBrowserController = class _LsdBrowserController {
17239
17243
  userAgent = ""
17240
17244
  } = options ? options : {};
17241
17245
  const incognito = typeof options?.incognito === "boolean" ? options.incognito : browserControllerType === "puppeteer" ? false : true;
17242
- 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 };
17243
17247
  let idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--incoginto"));
17244
17248
  if (idx >= 0) {
17245
17249
  (0, import_utils15.logwarn)(`Please use options.incognito instead when launching new browser.`);
@@ -17255,12 +17259,20 @@ var LsdBrowserController = class _LsdBrowserController {
17255
17259
  (0, import_utils15.logwarn)(`Please use options.userDataDir instead when launching new browser.`);
17256
17260
  args.splice(idx, 1);
17257
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
+ }
17258
17267
  let lsdBrowser;
17259
17268
  if (browserControllerType === "playwright") {
17260
17269
  const launchOptions = { headless, timeout };
17261
17270
  if (executablePath) {
17262
17271
  launchOptions.executablePath = executablePath;
17263
17272
  }
17273
+ if (maxWindowSize) {
17274
+ args.push("--start-maximized");
17275
+ }
17264
17276
  if (proxy?.server && proxy.server !== "default") {
17265
17277
  launchOptions.proxy = proxy;
17266
17278
  } else if (proxyPerBrowserContext && browserType === "chromium" && this.#osPlatform.startsWith("win")) {
@@ -17288,6 +17300,10 @@ var LsdBrowserController = class _LsdBrowserController {
17288
17300
  if (executablePath) {
17289
17301
  launchOptions.executablePath = executablePath;
17290
17302
  }
17303
+ if (maxWindowSize) {
17304
+ args.push("--start-maximized");
17305
+ launchOptions.defaultViewport = null;
17306
+ }
17291
17307
  if (browserType === "chromium") {
17292
17308
  if (incognito) {
17293
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,6 +1461,9 @@ var PlaywrightBrowser = class extends EventEmitter3 {
1461
1461
  return null;
1462
1462
  }
1463
1463
  const browserContextOptions = {};
1464
+ if (this.#options.maxWindowSize) {
1465
+ browserContextOptions.viewport = null;
1466
+ }
1464
1467
  const proxy = options?.proxy ? Object.assign({}, options.proxy) : this.#proxy;
1465
1468
  if (proxy) {
1466
1469
  const { server, username, password } = proxy;
@@ -17211,6 +17214,7 @@ var LsdBrowserController = class _LsdBrowserController {
17211
17214
  timeout = 3e4,
17212
17215
  args = [],
17213
17216
  executablePath = "",
17217
+ maxWindowSize = false,
17214
17218
  headless = true,
17215
17219
  minBrowserContexts = 1,
17216
17220
  // incognito
@@ -17219,7 +17223,7 @@ var LsdBrowserController = class _LsdBrowserController {
17219
17223
  userAgent = ""
17220
17224
  } = options ? options : {};
17221
17225
  const incognito = typeof options?.incognito === "boolean" ? options.incognito : browserControllerType === "puppeteer" ? false : true;
17222
- 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 };
17223
17227
  let idx = args.findIndex((arg) => arg.toLowerCase().startsWith("--incoginto"));
17224
17228
  if (idx >= 0) {
17225
17229
  logwarn6(`Please use options.incognito instead when launching new browser.`);
@@ -17235,12 +17239,20 @@ var LsdBrowserController = class _LsdBrowserController {
17235
17239
  logwarn6(`Please use options.userDataDir instead when launching new browser.`);
17236
17240
  args.splice(idx, 1);
17237
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
+ }
17238
17247
  let lsdBrowser;
17239
17248
  if (browserControllerType === "playwright") {
17240
17249
  const launchOptions = { headless, timeout };
17241
17250
  if (executablePath) {
17242
17251
  launchOptions.executablePath = executablePath;
17243
17252
  }
17253
+ if (maxWindowSize) {
17254
+ args.push("--start-maximized");
17255
+ }
17244
17256
  if (proxy?.server && proxy.server !== "default") {
17245
17257
  launchOptions.proxy = proxy;
17246
17258
  } else if (proxyPerBrowserContext && browserType === "chromium" && this.#osPlatform.startsWith("win")) {
@@ -17268,6 +17280,10 @@ var LsdBrowserController = class _LsdBrowserController {
17268
17280
  if (executablePath) {
17269
17281
  launchOptions.executablePath = executablePath;
17270
17282
  }
17283
+ if (maxWindowSize) {
17284
+ args.push("--start-maximized");
17285
+ launchOptions.defaultViewport = null;
17286
+ }
17271
17287
  if (browserType === "chromium") {
17272
17288
  if (incognito) {
17273
17289
  args.push("--incognito");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letsscrapedata/controller",
3
- "version": "0.0.23",
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",