Skip to content

Commit

Permalink
feat!: deprecate createBrowserFetcher in favor of BrowserFetcher (#…
Browse files Browse the repository at this point in the history
…9079)

This PR deprecates the `createBrowserFetcher` API and requests users to
import the `BrowserFetcher` directly.

Fixed: #8999
  • Loading branch information
jrandolf committed Oct 10, 2022
1 parent 1847704 commit 7294dfe
Show file tree
Hide file tree
Showing 16 changed files with 208 additions and 169 deletions.
21 changes: 21 additions & 0 deletions docs/api/puppeteer.browserfetcher._constructor_.md
@@ -0,0 +1,21 @@
---
sidebar_label: BrowserFetcher.(constructor)
---

# BrowserFetcher.(constructor)

Constructs a browser fetcher for the given options.

**Signature:**

```typescript
class BrowserFetcher {
constructor(options?: BrowserFetcherOptions);
}
```

## Parameters

| Parameter | Type | Description |
| --------- | ------------------------------------------------------------- | ----------------- |
| options | [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | <i>(Optional)</i> |
12 changes: 7 additions & 5 deletions docs/api/puppeteer.browserfetcher.md
Expand Up @@ -14,23 +14,25 @@ export declare class BrowserFetcher

## Remarks

BrowserFetcher operates on revision strings that specify a precise version of Chromium, e.g. `"533271"`. Revision strings can be obtained from [omahaproxy.appspot.com](http://omahaproxy.appspot.com/). In the Firefox case, BrowserFetcher downloads Firefox Nightly and operates on version numbers such as `"75"`.

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BrowserFetcher` class.
BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.

## Example

An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it:

```ts
const browserFetcher = puppeteer.createBrowserFetcher();
const browserFetcher = new BrowserFetcher();
const revisionInfo = await browserFetcher.download('533271');
const browser = await puppeteer.launch({
executablePath: revisionInfo.executablePath,
});
```

**NOTE** BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.
## Constructors

| Constructor | Modifiers | Description |
| --------------------------------------------------------------------- | --------- | --------------------------------------------------- |
| [(constructor)(options)](./puppeteer.browserfetcher._constructor_.md) | | Constructs a browser fetcher for the given options. |

## Methods

Expand Down
2 changes: 2 additions & 0 deletions docs/api/puppeteer.browserfetcheroptions.host.md
Expand Up @@ -4,6 +4,8 @@ sidebar_label: BrowserFetcherOptions.host

# BrowserFetcherOptions.host property

Determines the host that will be used for downloading.

**Signature:**

```typescript
Expand Down
12 changes: 6 additions & 6 deletions docs/api/puppeteer.browserfetcheroptions.md
Expand Up @@ -12,9 +12,9 @@ export interface BrowserFetcherOptions

## Properties

| Property | Modifiers | Type | Description |
| ---------------------------------------------------------- | --------- | ----------------------------------- | ----------------- |
| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> |
| [path?](./puppeteer.browserfetcheroptions.path.md) | | string | <i>(Optional)</i> |
| [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> |
| [product?](./puppeteer.browserfetcheroptions.product.md) | | string | <i>(Optional)</i> |
| Property | Modifiers | Type | Description |
| ---------------------------------------------------------- | --------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> Determines the host that will be used for downloading. |
| [path?](./puppeteer.browserfetcheroptions.path.md) | | string | <i>(Optional)</i> Determines the path to download browsers to. |
| [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> Determines which platform the browser will be suited for. |
| [product?](./puppeteer.browserfetcheroptions.product.md) | | 'chrome' \| 'firefox' | <i>(Optional)</i> Determines which product the [BrowserFetcher](./puppeteer.browserfetcher.md) is for. |
2 changes: 2 additions & 0 deletions docs/api/puppeteer.browserfetcheroptions.path.md
Expand Up @@ -4,6 +4,8 @@ sidebar_label: BrowserFetcherOptions.path

# BrowserFetcherOptions.path property

Determines the path to download browsers to.

**Signature:**

```typescript
Expand Down
2 changes: 2 additions & 0 deletions docs/api/puppeteer.browserfetcheroptions.platform.md
Expand Up @@ -4,6 +4,8 @@ sidebar_label: BrowserFetcherOptions.platform

# BrowserFetcherOptions.platform property

Determines which platform the browser will be suited for.

**Signature:**

```typescript
Expand Down
4 changes: 3 additions & 1 deletion docs/api/puppeteer.browserfetcheroptions.product.md
Expand Up @@ -4,10 +4,12 @@ sidebar_label: BrowserFetcherOptions.product

# BrowserFetcherOptions.product property

Determines which product the [BrowserFetcher](./puppeteer.browserfetcher.md) is for.

**Signature:**

```typescript
interface BrowserFetcherOptions {
product?: string;
product?: 'chrome' | 'firefox';
}
```
4 changes: 4 additions & 0 deletions docs/api/puppeteer.createbrowserfetcher.md
Expand Up @@ -4,6 +4,10 @@ sidebar_label: createBrowserFetcher

# createBrowserFetcher variable

> Warning: This API is now obsolete.
>
> Import [BrowserFetcher](./puppeteer.browserfetcher.md) directly and use the constructor.
**Signature:**

```typescript
Expand Down
4 changes: 4 additions & 0 deletions docs/api/puppeteer.puppeteernode.createbrowserfetcher.md
Expand Up @@ -4,6 +4,10 @@ sidebar_label: PuppeteerNode.createBrowserFetcher

# PuppeteerNode.createBrowserFetcher() method

> Warning: This API is now obsolete.
>
> Import [BrowserFetcher](./puppeteer.browserfetcher.md) directly and use the constructor.
**Signature:**

```typescript
Expand Down

0 comments on commit 7294dfe

Please sign in to comment.