Skip to content

Commit f9678f5

Browse files
authored
Update to puppeteer@14.1.1 (#50)
1 parent e112de0 commit f9678f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+19522
-12384
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<img src="./logo.png" height="200" align="right">
44

5-
###### [API](https://github.com/puppeteer/puppeteer/blob/v9.0.2/docs/api.md)
5+
###### [API](https://github.com/puppeteer/puppeteer/blob/v14.1.1/docs/api.md)
66

77
A fork of [Puppeteer](https://pptr.dev/) running on Deno.
88

@@ -31,21 +31,21 @@ Here are a few examples to get you started:
3131
To use Puppeteer, import it like so:
3232

3333
```ts
34-
import puppeteer from "https://deno.land/x/puppeteer@9.0.2/mod.ts";
34+
import puppeteer from "https://deno.land/x/puppeteer@14.1.1/mod.ts";
3535
```
3636

3737
Puppeteer can use any recent version of Chromium or Firefox Nightly, but this
3838
version of Puppeteer is only validated against a specific version. To cache
3939
these versions in the Puppeteer cache, run the commands below.
4040

4141
```shell
42-
PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@9.0.2/install.ts
43-
PUPPETEER_PRODUCT=firefox deno run -A --unstable https://deno.land/x/puppeteer@9.0.2/install.ts
42+
PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@14.1.1/install.ts
43+
PUPPETEER_PRODUCT=firefox deno run -A --unstable https://deno.land/x/puppeteer@14.1.1/install.ts
4444
```
4545

4646
You can find all of the supported environment variables to customize
4747
installation
48-
[in the Puppeteer docs](https://pptr.dev/#?product=Puppeteer&version=v5.5.0&show=api-environment-variables).
48+
[in the Puppeteer docs](https://pptr.dev/#?product=Puppeteer&version=v14.1.1&show=api-environment-variables).
4949

5050
### Usage
5151

@@ -59,7 +59,7 @@ _example.png_:
5959
Save file as **example.js**
6060

6161
```js
62-
import puppeteer from "https://deno.land/x/puppeteer@9.0.2/mod.ts";
62+
import puppeteer from "https://deno.land/x/puppeteer@14.1.1/mod.ts";
6363

6464
const browser = await puppeteer.launch();
6565
const page = await browser.newPage();
@@ -77,14 +77,14 @@ deno run -A --unstable example.js
7777

7878
Puppeteer sets an initial page size to 800×600px, which defines the screenshot
7979
size. The page size can be customized with
80-
[`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#pagesetviewportviewport).
80+
[`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v14.1.1/docs/api.md#pagesetviewportviewport).
8181

8282
**Example** - create a PDF.
8383

8484
Save file as **hn.js**
8585

8686
```js
87-
import puppeteer from "https://deno.land/x/puppeteer@9.0.2/mod.ts";
87+
import puppeteer from "https://deno.land/x/puppeteer@14.1.1/mod.ts";
8888

8989
const browser = await puppeteer.launch();
9090
const page = await browser.newPage();
@@ -103,15 +103,15 @@ deno run -A --unstable hn.js
103103
```
104104

105105
See
106-
[`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#pagepdfoptions)
106+
[`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v14.1.1/docs/api.md#pagepdfoptions)
107107
for more information about creating pdfs.
108108

109109
**Example** - evaluate script in the context of the page
110110

111111
Save file as **get-dimensions.js**
112112

113113
```js
114-
import puppeteer from "https://deno.land/x/puppeteer@9.0.2/mod.ts";
114+
import puppeteer from "https://deno.land/x/puppeteer@14.1.1/mod.ts";
115115

116116
const browser = await puppeteer.launch();
117117
const page = await browser.newPage();
@@ -145,7 +145,8 @@ deno run -A --unstable get-dimensions.js
145145
some minor changes to make it compatible with Deno.
146146

147147
The most noticable difference is likely that instead of some methods taking /
148-
returning Node `Buffer`, they take / return `Uint8Array`.
148+
returning Node `Buffer`, they take / return `Uint8Array`. One method also
149+
returns a web native `ReadableStream` instead of the Node `Readable`.
149150

150151
Other than this, the documentation on https://pptr.dev generally applies.
151152

src/deno/Puppeteer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class PuppeteerDeno extends Puppeteer {
7474
*/
7575
constructor(settings: { preferredRevision: string; productName?: Product }) {
7676
const { preferredRevision, productName } = settings;
77-
super();
77+
super({ isPuppeteerCore: false });
7878
this.__productName = productName;
7979
this._preferredRevision = preferredRevision;
8080
}

tools/update_puppeteer.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ for await (const file of untar) {
2222
const encoder = new TextEncoder();
2323
const decoder = new TextDecoder();
2424

25+
const packageJSON = decoder.decode(originalFiles["package.json"]);
26+
const packageJSONObject = JSON.parse(packageJSON);
27+
28+
const protocolVersion = packageJSONObject.dependencies["devtools-protocol"];
29+
2530
const protocolReq = await fetch(
26-
"https://unpkg.com/devtools-protocol@0.0.818844/types/protocol.d.ts",
31+
`https://unpkg.com/devtools-protocol@${protocolVersion}/types/protocol.d.ts`,
2732
);
2833
const protocolMapping = await fetch(
29-
"https://unpkg.com/devtools-protocol@0.0.818844/types/protocol-mapping.d.ts",
34+
`https://unpkg.com/devtools-protocol@${protocolVersion}/types/protocol-mapping.d.ts`,
3035
);
3136
const files: Record<string, Uint8Array> = {
3237
LICENSE: originalFiles.LICENSE,

vendor/puppeteer-core/puppeteer/common/Accessibility.d.ts

Lines changed: 72 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -21,85 +21,85 @@ import { ElementHandle } from "./JSHandle.js";
2121
*/
2222
export interface SerializedAXNode {
2323
/**
24-
* The {@link https://www.w3.org/TR/wai-aria/#usage_intro | role} of the node.
25-
*/
24+
* The {@link https://www.w3.org/TR/wai-aria/#usage_intro | role} of the node.
25+
*/
2626
role: string;
2727
/**
28-
* A human readable name for the node.
29-
*/
28+
* A human readable name for the node.
29+
*/
3030
name?: string;
3131
/**
32-
* The current value of the node.
33-
*/
32+
* The current value of the node.
33+
*/
3434
value?: string | number;
3535
/**
36-
* An additional human readable description of the node.
37-
*/
36+
* An additional human readable description of the node.
37+
*/
3838
description?: string;
3939
/**
40-
* Any keyboard shortcuts associated with this node.
41-
*/
40+
* Any keyboard shortcuts associated with this node.
41+
*/
4242
keyshortcuts?: string;
4343
/**
44-
* A human readable alternative to the role.
45-
*/
44+
* A human readable alternative to the role.
45+
*/
4646
roledescription?: string;
4747
/**
48-
* A description of the current value.
49-
*/
48+
* A description of the current value.
49+
*/
5050
valuetext?: string;
5151
disabled?: boolean;
5252
expanded?: boolean;
5353
focused?: boolean;
5454
modal?: boolean;
5555
multiline?: boolean;
5656
/**
57-
* Whether more than one child can be selected.
58-
*/
57+
* Whether more than one child can be selected.
58+
*/
5959
multiselectable?: boolean;
6060
readonly?: boolean;
6161
required?: boolean;
6262
selected?: boolean;
6363
/**
64-
* Whether the checkbox is checked, or in a
65-
* {@link https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html | mixed state}.
66-
*/
64+
* Whether the checkbox is checked, or in a
65+
* {@link https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html | mixed state}.
66+
*/
6767
checked?: boolean | "mixed";
6868
/**
69-
* Whether the node is checked or in a mixed state.
70-
*/
69+
* Whether the node is checked or in a mixed state.
70+
*/
7171
pressed?: boolean | "mixed";
7272
/**
73-
* The level of a heading.
74-
*/
73+
* The level of a heading.
74+
*/
7575
level?: number;
7676
valuemin?: number;
7777
valuemax?: number;
7878
autocomplete?: string;
7979
haspopup?: string;
8080
/**
81-
* Whether and in what way this node's value is invalid.
82-
*/
81+
* Whether and in what way this node's value is invalid.
82+
*/
8383
invalid?: string;
8484
orientation?: string;
8585
/**
86-
* Children of this node, if there are any.
87-
*/
86+
* Children of this node, if there are any.
87+
*/
8888
children?: SerializedAXNode[];
8989
}
9090
/**
9191
* @public
9292
*/
9393
export interface SnapshotOptions {
9494
/**
95-
* Prune uninteresting nodes from the tree.
96-
* @defaultValue true
97-
*/
95+
* Prune uninteresting nodes from the tree.
96+
* @defaultValue true
97+
*/
9898
interestingOnly?: boolean;
9999
/**
100-
* Root node to get the accessibility tree for
101-
* @defaultValue The root node of the entire page.
102-
*/
100+
* Root node to get the accessibility tree for
101+
* @defaultValue The root node of the entire page.
102+
*/
103103
root?: ElementHandle;
104104
}
105105
/**
@@ -127,48 +127,47 @@ export interface SnapshotOptions {
127127
export declare class Accessibility {
128128
private _client;
129129
/**
130-
* @internal
131-
*/
130+
* @internal
131+
*/
132132
constructor(client: CDPSession);
133133
/**
134-
* Captures the current state of the accessibility tree.
135-
* The returned object represents the root accessible node of the page.
136-
*
137-
* @remarks
138-
*
139-
* **NOTE** The Chromium accessibility tree contains nodes that go unused on
140-
* most platforms and by most screen readers. Puppeteer will discard them as
141-
* well for an easier to process tree, unless `interestingOnly` is set to
142-
* `false`.
143-
*
144-
* @example
145-
* An example of dumping the entire accessibility tree:
146-
* ```js
147-
* const snapshot = await page.accessibility.snapshot();
148-
* console.log(snapshot);
149-
* ```
150-
*
151-
* @example
152-
* An example of logging the focused node's name:
153-
* ```js
154-
* const snapshot = await page.accessibility.snapshot();
155-
* const node = findFocusedNode(snapshot);
156-
* console.log(node && node.name);
157-
*
158-
* function findFocusedNode(node) {
159-
* if (node.focused)
160-
* return node;
161-
* for (const child of node.children || []) {
162-
* const foundNode = findFocusedNode(child);
163-
* return foundNode;
164-
* }
165-
* return null;
166-
* }
167-
* ```
168-
*
169-
* @returns An AXNode object representing the snapshot.
170-
*
171-
*/
134+
* Captures the current state of the accessibility tree.
135+
* The returned object represents the root accessible node of the page.
136+
*
137+
* @remarks
138+
*
139+
* **NOTE** The Chromium accessibility tree contains nodes that go unused on
140+
* most platforms and by most screen readers. Puppeteer will discard them as
141+
* well for an easier to process tree, unless `interestingOnly` is set to
142+
* `false`.
143+
*
144+
* @example
145+
* An example of dumping the entire accessibility tree:
146+
* ```js
147+
* const snapshot = await page.accessibility.snapshot();
148+
* console.log(snapshot);
149+
* ```
150+
*
151+
* @example
152+
* An example of logging the focused node's name:
153+
* ```js
154+
* const snapshot = await page.accessibility.snapshot();
155+
* const node = findFocusedNode(snapshot);
156+
* console.log(node && node.name);
157+
*
158+
* function findFocusedNode(node) {
159+
* if (node.focused)
160+
* return node;
161+
* for (const child of node.children || []) {
162+
* const foundNode = findFocusedNode(child);
163+
* return foundNode;
164+
* }
165+
* return null;
166+
* }
167+
* ```
168+
*
169+
* @returns An AXNode object representing the snapshot.
170+
*/
172171
snapshot(options?: SnapshotOptions): Promise<SerializedAXNode>;
173172
private serializeTree;
174173
private collectInterestingNodes;

0 commit comments

Comments
 (0)