@crawlee/playwright 4.0.0-beta.86 → 4.0.0-beta.87

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.
@@ -139,7 +139,10 @@ export class PlaywrightCrawler extends BrowserCrawler {
139
139
  },
140
140
  infiniteScroll: async (options) => playwrightUtils.infiniteScroll(context.page, options),
141
141
  listDownloads: async () => downloads,
142
- saveSnapshot: async (options) => playwrightUtils.saveSnapshot(context.page, { ...options, config: serviceLocator.getConfiguration() }),
142
+ saveSnapshot: async (options) => playwrightUtils.saveSnapshot(context.page, {
143
+ ...options,
144
+ configuration: serviceLocator.getConfiguration(),
145
+ }),
143
146
  enqueueLinksByClickingElements: async (options) => playwrightUtils.enqueueLinksByClickingElements({
144
147
  ...options,
145
148
  page: context.page,
@@ -70,7 +70,7 @@ export interface PlaywrightLaunchContext extends BrowserLaunchContext<LaunchOpti
70
70
  * @ignore
71
71
  */
72
72
  export declare class PlaywrightLauncher extends BrowserLauncher<PlaywrightPlugin> {
73
- readonly config: Configuration;
73
+ readonly configuration: Configuration;
74
74
  protected static optionsShape: {
75
75
  // @ts-ignore optional peer dependency or compatibility with es2022
76
76
  launcher: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
@@ -96,7 +96,7 @@ export declare class PlaywrightLauncher extends BrowserLauncher<PlaywrightPlugin
96
96
  /**
97
97
  * All `PlaywrightLauncher` parameters are passed via this launchContext object.
98
98
  */
99
- constructor(launchContext?: PlaywrightLaunchContext, config?: Configuration);
99
+ constructor(launchContext?: PlaywrightLaunchContext, configuration?: Configuration);
100
100
  }
101
101
  /**
102
102
  * Launches headless browsers using Playwright pre-configured to work within the Apify platform.
@@ -127,8 +127,8 @@ export declare class PlaywrightLauncher extends BrowserLauncher<PlaywrightPlugin
127
127
  * Optional settings passed to `browserType.launch()`. In addition to
128
128
  * [Playwright's options](https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions)
129
129
  * the object may contain our own {@link PlaywrightLaunchContext} that enable additional features.
130
- * @param [config]
130
+ * @param [configuration]
131
131
  * @returns
132
132
  * Promise that resolves to Playwright's `Browser` instance.
133
133
  */
134
- export declare function launchPlaywright(launchContext?: PlaywrightLaunchContext, config?: Configuration): Promise<Browser>;
134
+ export declare function launchPlaywright(launchContext?: PlaywrightLaunchContext, configuration?: Configuration): Promise<Browser>;
@@ -6,7 +6,7 @@ import ow from 'ow';
6
6
  * @ignore
7
7
  */
8
8
  export class PlaywrightLauncher extends BrowserLauncher {
9
- config;
9
+ configuration;
10
10
  static optionsShape = {
11
11
  ...BrowserLauncher.optionsShape,
12
12
  launcher: ow.optional.object,
@@ -15,7 +15,7 @@ export class PlaywrightLauncher extends BrowserLauncher {
15
15
  /**
16
16
  * All `PlaywrightLauncher` parameters are passed via this launchContext object.
17
17
  */
18
- constructor(launchContext = {}, config = Configuration.getGlobalConfig()) {
18
+ constructor(launchContext = {}, configuration = Configuration.getGlobalConfiguration()) {
19
19
  ow(launchContext, 'PlaywrightLauncherOptions', ow.object.exactShape(PlaywrightLauncher.optionsShape));
20
20
  const { launcher = BrowserLauncher.requireLauncherOrThrow('playwright', 'apify/actor-node-playwright-*').chromium, } = launchContext;
21
21
  const { launchOptions = {}, ...rest } = launchContext;
@@ -23,11 +23,11 @@ export class PlaywrightLauncher extends BrowserLauncher {
23
23
  ...rest,
24
24
  launchOptions: {
25
25
  ...launchOptions,
26
- executablePath: getDefaultExecutablePath(launchContext, config),
26
+ executablePath: getDefaultExecutablePath(launchContext, configuration),
27
27
  },
28
28
  launcher,
29
- }, config);
30
- this.config = config;
29
+ }, configuration);
30
+ this.configuration = configuration;
31
31
  this.Plugin = PlaywrightPlugin;
32
32
  }
33
33
  }
@@ -36,8 +36,8 @@ export class PlaywrightLauncher extends BrowserLauncher {
36
36
  * @returns default path to browser.
37
37
  * @ignore
38
38
  */
39
- function getDefaultExecutablePath(launchContext, config) {
40
- const pathFromPlaywrightImage = config.defaultBrowserPath;
39
+ function getDefaultExecutablePath(launchContext, configuration) {
40
+ const pathFromPlaywrightImage = configuration.defaultBrowserPath;
41
41
  const { launchOptions = {} } = launchContext;
42
42
  if (launchOptions.executablePath) {
43
43
  return launchOptions.executablePath;
@@ -79,11 +79,11 @@ function getDefaultExecutablePath(launchContext, config) {
79
79
  * Optional settings passed to `browserType.launch()`. In addition to
80
80
  * [Playwright's options](https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions)
81
81
  * the object may contain our own {@link PlaywrightLaunchContext} that enable additional features.
82
- * @param [config]
82
+ * @param [configuration]
83
83
  * @returns
84
84
  * Promise that resolves to Playwright's `Browser` instance.
85
85
  */
86
- export async function launchPlaywright(launchContext, config = Configuration.getGlobalConfig()) {
87
- const playwrightLauncher = new PlaywrightLauncher(launchContext, config);
86
+ export async function launchPlaywright(launchContext, configuration = Configuration.getGlobalConfiguration()) {
87
+ const playwrightLauncher = new PlaywrightLauncher(launchContext, configuration);
88
88
  return playwrightLauncher.launch();
89
89
  }
@@ -265,9 +265,9 @@ export interface SaveSnapshotOptions {
265
265
  keyValueStoreName?: string | null;
266
266
  /**
267
267
  * Configuration of the crawler that will be used to save the snapshot.
268
- * @default Configuration.getGlobalConfig()
268
+ * @default Configuration.getGlobalConfiguration()
269
269
  */
270
- config?: Configuration;
270
+ configuration?: Configuration;
271
271
  }
272
272
  /**
273
273
  * Saves a full screenshot and HTML of the current page into a Key-Value store.
@@ -357,12 +357,12 @@ export async function saveSnapshot(page, options = {}) {
357
357
  saveScreenshot: ow.optional.boolean,
358
358
  saveHtml: ow.optional.boolean,
359
359
  keyValueStoreName: ow.optional.string,
360
- config: ow.optional.object,
360
+ configuration: ow.optional.object,
361
361
  }));
362
- const { key = 'SNAPSHOT', screenshotQuality = 50, saveScreenshot = true, saveHtml = true, keyValueStoreName, config, } = options;
362
+ const { key = 'SNAPSHOT', screenshotQuality = 50, saveScreenshot = true, saveHtml = true, keyValueStoreName, configuration, } = options;
363
363
  try {
364
364
  const store = await KeyValueStore.open(keyValueStoreName ? { name: keyValueStoreName } : null, {
365
- config: config ?? Configuration.getGlobalConfig(),
365
+ configuration: configuration ?? Configuration.getGlobalConfiguration(),
366
366
  });
367
367
  if (saveScreenshot) {
368
368
  const screenshotName = `${key}.jpg`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/playwright",
3
- "version": "4.0.0-beta.86",
3
+ "version": "4.0.0-beta.87",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -49,13 +49,13 @@
49
49
  "dependencies": {
50
50
  "@apify/datastructures": "^2.0.3",
51
51
  "@apify/timeout": "^0.3.2",
52
- "@crawlee/basic": "4.0.0-beta.86",
53
- "@crawlee/browser": "4.0.0-beta.86",
54
- "@crawlee/browser-pool": "4.0.0-beta.86",
55
- "@crawlee/cheerio": "4.0.0-beta.86",
56
- "@crawlee/core": "4.0.0-beta.86",
57
- "@crawlee/types": "4.0.0-beta.86",
58
- "@crawlee/utils": "4.0.0-beta.86",
52
+ "@crawlee/basic": "4.0.0-beta.87",
53
+ "@crawlee/browser": "4.0.0-beta.87",
54
+ "@crawlee/browser-pool": "4.0.0-beta.87",
55
+ "@crawlee/cheerio": "4.0.0-beta.87",
56
+ "@crawlee/core": "4.0.0-beta.87",
57
+ "@crawlee/types": "4.0.0-beta.87",
58
+ "@crawlee/utils": "4.0.0-beta.87",
59
59
  "cheerio": "^1.0.0",
60
60
  "idcac-playwright": "^0.1.3",
61
61
  "jquery": "^3.7.1",
@@ -85,5 +85,5 @@
85
85
  }
86
86
  }
87
87
  },
88
- "gitHead": "c2f251426f3ccfcc6efc920e6d492be57beac43b"
88
+ "gitHead": "1b7604cd77b694460aac4448b4555444fa1b2bdb"
89
89
  }