├── .github ├── FUNDING.yml └── workflows │ └── ci.yml ├── .vscode └── settings.json ├── Dockerfile ├── LICENSE ├── README.md ├── examples ├── docker.js ├── firefox.ts ├── get-dimensions.js ├── hackernews.ts └── screenshot.ts ├── fixtures └── dom-tsconfig.json ├── install.ts ├── logo.png ├── mod.ts ├── src ├── deno │ ├── BrowserFetcher.ts │ ├── BrowserRunner.ts │ ├── LaunchOptions.ts │ ├── Launcher.ts │ └── Puppeteer.ts ├── initialize-deno.ts └── mod.ts ├── tests.ts ├── tools └── update_puppeteer.ts └── vendor └── puppeteer-core ├── LICENSE ├── puppeteer ├── api-docs-entry.d.ts ├── api-docs-entry.js ├── common │ ├── Accessibility.d.ts │ ├── Accessibility.js │ ├── AriaQueryHandler.d.ts │ ├── AriaQueryHandler.js │ ├── Browser.d.ts │ ├── Browser.js │ ├── BrowserConnector.d.ts │ ├── BrowserConnector.js │ ├── BrowserWebSocketTransport.d.ts │ ├── BrowserWebSocketTransport.js │ ├── ChromeTargetManager.d.ts │ ├── ChromeTargetManager.js │ ├── Connection.d.ts │ ├── Connection.js │ ├── ConnectionTransport.d.ts │ ├── ConnectionTransport.js │ ├── ConsoleMessage.d.ts │ ├── ConsoleMessage.js │ ├── Coverage.d.ts │ ├── Coverage.js │ ├── Debug.d.ts │ ├── Debug.js │ ├── DeviceDescriptors.d.ts │ ├── DeviceDescriptors.js │ ├── Dialog.d.ts │ ├── Dialog.js │ ├── ElementHandle.d.ts │ ├── ElementHandle.js │ ├── EmulationManager.d.ts │ ├── EmulationManager.js │ ├── Errors.d.ts │ ├── Errors.js │ ├── EventEmitter.d.ts │ ├── EventEmitter.js │ ├── ExecutionContext.d.ts │ ├── ExecutionContext.js │ ├── FileChooser.d.ts │ ├── FileChooser.js │ ├── FirefoxTargetManager.d.ts │ ├── FirefoxTargetManager.js │ ├── Frame.d.ts │ ├── Frame.js │ ├── FrameManager.d.ts │ ├── FrameManager.js │ ├── HTTPRequest.d.ts │ ├── HTTPRequest.js │ ├── HTTPResponse.d.ts │ ├── HTTPResponse.js │ ├── Input.d.ts │ ├── Input.js │ ├── IsolatedWorld.d.ts │ ├── IsolatedWorld.js │ ├── JSHandle.d.ts │ ├── JSHandle.js │ ├── LifecycleWatcher.d.ts │ ├── LifecycleWatcher.js │ ├── NetworkConditions.d.ts │ ├── NetworkConditions.js │ ├── NetworkEventManager.d.ts │ ├── NetworkEventManager.js │ ├── NetworkManager.d.ts │ ├── NetworkManager.js │ ├── PDFOptions.d.ts │ ├── PDFOptions.js │ ├── Page.d.ts │ ├── Page.js │ ├── Product.d.ts │ ├── Product.js │ ├── Puppeteer.d.ts │ ├── Puppeteer.js │ ├── PuppeteerViewport.d.ts │ ├── PuppeteerViewport.js │ ├── QueryHandler.d.ts │ ├── QueryHandler.js │ ├── SecurityDetails.d.ts │ ├── SecurityDetails.js │ ├── Target.d.ts │ ├── Target.js │ ├── TargetManager.d.ts │ ├── TargetManager.js │ ├── TaskQueue.d.ts │ ├── TaskQueue.js │ ├── TimeoutSettings.d.ts │ ├── TimeoutSettings.js │ ├── Tracing.d.ts │ ├── Tracing.js │ ├── USKeyboardLayout.d.ts │ ├── USKeyboardLayout.js │ ├── WebWorker.d.ts │ ├── WebWorker.js │ ├── fetch.d.ts │ ├── fetch.js │ ├── types.d.ts │ ├── types.js │ ├── util.d.ts │ └── util.js ├── generated │ ├── injected.d.ts │ ├── injected.js │ ├── version.d.ts │ └── version.js ├── injected │ ├── Poller.d.ts │ ├── Poller.js │ ├── injected.d.ts │ └── injected.js ├── puppeteer-core.d.ts ├── puppeteer-core.js ├── revisions.d.ts ├── revisions.js ├── types.d.ts ├── types.js └── util │ ├── DeferredPromise.d.ts │ ├── DeferredPromise.js │ ├── ErrorLike.d.ts │ ├── ErrorLike.js │ ├── assert.d.ts │ └── assert.js └── vendor ├── cache.ts ├── devtools-protocol └── types │ ├── protocol-mapping.d.ts │ └── protocol.d.ts ├── mitt └── src │ ├── index.d.ts │ └── index.js ├── std.ts └── zip ├── mod.ts └── types.ts /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: lucacasonato 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | test: 11 | name: test-${{ matrix.os }}-${{ matrix.deno }} 12 | runs-on: ${{ matrix.os }} # runs a test on Ubuntu, Windows and macOS 13 | 14 | strategy: 15 | matrix: 16 | deno: ["v1.x", "canary"] 17 | os: [windows-latest, ubuntu-latest, macos-latest] 18 | fail-fast: false 19 | 20 | steps: 21 | - name: Setup repo 22 | uses: actions/checkout@v2 23 | 24 | - name: Setup Deno 25 | uses: denoland/setup-deno@main 26 | with: 27 | deno-version: ${{ matrix.deno }} 28 | 29 | - name: Formatting 30 | if: contains(runner.os, 'ubuntu') 31 | run: deno fmt --check 32 | 33 | - name: Cache Dependencies 34 | run: deno cache --unstable mod.ts 35 | 36 | - name: Install Chromium 37 | run: deno run -A --unstable install.ts 38 | 39 | - name: Run tests 40 | run: deno test -A --unstable tests.ts 41 | 42 | - name: Run tests with lib.dom typings 43 | run: deno test -A --unstable --config fixtures/dom-tsconfig.json tests.ts 44 | 45 | docker: 46 | name: docker 47 | runs-on: ubuntu-latest 48 | 49 | steps: 50 | - name: Setup repo 51 | uses: actions/checkout@v2 52 | 53 | - name: Build image 54 | run: docker build -t denopuppeteer . 55 | 56 | - name: Run container 57 | run: docker run -i denopuppeteer -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enable": true, 3 | "deno.lint": false, 4 | "deno.unstable": true 5 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster-slim 2 | 3 | ENV DENO_VERSION=1.25.0 4 | ARG DEBIAN_FRONTEND=noninteractive 5 | 6 | RUN apt-get -qq update \ 7 | && apt-get -qq install -y --no-install-recommends \ 8 | curl \ 9 | ca-certificates \ 10 | unzip \ 11 | # ↓ https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix 12 | # Since I want to leave the contents of troubleshooting.md as it is, ca-certificates is intentionally duplicated here. 13 | ca-certificates \ 14 | fonts-liberation \ 15 | libappindicator3-1 \ 16 | libasound2 \ 17 | libatk-bridge2.0-0 \ 18 | libatk1.0-0 \ 19 | libc6 \ 20 | libcairo2 \ 21 | libcups2 \ 22 | libdbus-1-3 \ 23 | libexpat1 \ 24 | libfontconfig1 \ 25 | libgbm1 \ 26 | libgcc1 \ 27 | libglib2.0-0 \ 28 | libgtk-3-0 \ 29 | libnspr4 \ 30 | libnss3 \ 31 | libpango-1.0-0 \ 32 | libpangocairo-1.0-0 \ 33 | libstdc++6 \ 34 | libx11-6 \ 35 | libx11-xcb1 \ 36 | libxcb1 \ 37 | libxcomposite1 \ 38 | libxcursor1 \ 39 | libxdamage1 \ 40 | libxext6 \ 41 | libxfixes3 \ 42 | libxi6 \ 43 | libxrandr2 \ 44 | libxrender1 \ 45 | libxss1 \ 46 | libxtst6 \ 47 | lsb-release \ 48 | wget \ 49 | xdg-utils \ 50 | # ↑ https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix 51 | # ↓ Added based on the information obtained from by console.log(line) at https://deno.land/x/puppeteer@9.0.2/src/deno/BrowserRunner.ts#L168. 52 | libdrm2 \ 53 | libxkbcommon0 \ 54 | libxshmfence1 \ 55 | # ↑ Added based on the information obtained from by console.log(line) at https://deno.land/x/puppeteer@9.0.2/src/deno/BrowserRunner.ts#L168. 56 | && curl -fsSL https://github.com/denoland/deno/releases/download/v${DENO_VERSION}/deno-x86_64-unknown-linux-gnu.zip \ 57 | --output deno.zip \ 58 | && unzip deno.zip \ 59 | && rm deno.zip \ 60 | && chmod 755 deno \ 61 | && mv deno /usr/bin/deno \ 62 | && apt-get -qq remove --purge -y \ 63 | curl \ 64 | # Do not remove ca-certificates as it is required by puppeteer. 65 | # ca-certificates \ 66 | unzip \ 67 | && apt-get -y -qq autoremove \ 68 | && apt-get -qq clean \ 69 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 70 | 71 | RUN useradd --uid 1993 --user-group deno \ 72 | && mkdir /deno-dir/ \ 73 | && chown deno:deno /deno-dir/ 74 | 75 | ENV DENO_DIR /deno-dir/ 76 | 77 | # --- PLACE CUSTOM COMMANDS BELOW --- # 78 | 79 | WORKDIR /root 80 | COPY . . 81 | 82 | # https://deno.land/x/puppeteer@9.0.2#installation 83 | # In your real script, replace the installation script with https://deno.land/x/puppeteer@9.0.2/install.ts 84 | RUN PUPPETEER_PRODUCT=chrome deno run -A --unstable ./install.ts 85 | 86 | ENTRYPOINT ["deno"] 87 | CMD ["run", "-A", "--no-check", "--unstable", "./examples/docker.js"] 88 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Luca Casonato 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deno-puppeteer 2 | 3 | 4 | 5 | ###### [API](https://github.com/puppeteer/puppeteer/blob/v16.2.0/docs/api.md) 6 | 7 | A fork of [Puppeteer](https://pptr.dev/) running on Deno. 8 | 9 | > Puppeteer is a library which provides a high-level API to control Chrome, 10 | > Chromium, or Firefox Nightly over the DevTools Protocol. Puppeteer runs 11 | > headless by default, but can be configured to run full (non-headless) Chrome 12 | > or Chromium. 13 | 14 | Most things that you can do manually in the browser can be done using Puppeteer! 15 | Here are a few examples to get you started: 16 | 17 | - Generate screenshots and PDFs of pages. 18 | - Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. 19 | "SSR" (Server-Side Rendering)). 20 | - Automate form submission, UI testing, keyboard input, etc. 21 | - Create an up-to-date, automated testing environment. Run your tests directly 22 | in the latest version of Chrome using the latest JavaScript and browser 23 | features. 24 | - Capture a timeline trace of your site to help diagnose performance issues. 25 | - Test Chrome Extensions. 26 | 27 | ## Getting Started 28 | 29 | ### Installation 30 | 31 | To use Puppeteer, import it like so: 32 | 33 | ```ts 34 | import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts"; 35 | ``` 36 | 37 | Puppeteer can use any recent version of Chromium or Firefox Nightly, but this 38 | version of Puppeteer is only validated against a specific version. To cache 39 | these versions in the Puppeteer cache, run the commands below. 40 | 41 | ```shell 42 | PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts 43 | PUPPETEER_PRODUCT=firefox deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts 44 | ``` 45 | 46 | You can find all of the supported environment variables to customize 47 | installation 48 | [in the Puppeteer docs](https://pptr.dev/#?product=Puppeteer&version=v16.2.0&show=api-environment-variables). 49 | 50 | ### Usage 51 | 52 | Puppeteer will be familiar to people using other browser testing frameworks. You 53 | create an instance of `Browser`, open pages, and then manipulate them with 54 | Puppeteer's API. 55 | 56 | **Example** - navigating to https://example.com and saving a screenshot as 57 | _example.png_: 58 | 59 | Save file as **example.js** 60 | 61 | ```js 62 | import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts"; 63 | 64 | const browser = await puppeteer.launch(); 65 | const page = await browser.newPage(); 66 | await page.goto("https://example.com"); 67 | await page.screenshot({ path: "example.png" }); 68 | 69 | await browser.close(); 70 | ``` 71 | 72 | Execute script on the command line 73 | 74 | ```bash 75 | deno run -A --unstable example.js 76 | ``` 77 | 78 | Puppeteer sets an initial page size to 800×600px, which defines the screenshot 79 | size. The page size can be customized with 80 | [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v16.2.0/docs/api.md#pagesetviewportviewport). 81 | 82 | **Example** - create a PDF. 83 | 84 | Save file as **hn.js** 85 | 86 | ```js 87 | import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts"; 88 | 89 | const browser = await puppeteer.launch(); 90 | const page = await browser.newPage(); 91 | await page.goto("https://news.ycombinator.com", { 92 | waitUntil: "networkidle2", 93 | }); 94 | await page.pdf({ path: "hn.pdf", format: "A4" }); 95 | 96 | await browser.close(); 97 | ``` 98 | 99 | Execute script on the command line 100 | 101 | ```bash 102 | deno run -A --unstable hn.js 103 | ``` 104 | 105 | See 106 | [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v16.2.0/docs/api.md#pagepdfoptions) 107 | for more information about creating pdfs. 108 | 109 | **Example** - evaluate script in the context of the page 110 | 111 | Save file as **get-dimensions.js** 112 | 113 | ```js 114 | import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts"; 115 | 116 | const browser = await puppeteer.launch(); 117 | const page = await browser.newPage(); 118 | await page.goto("https://example.com"); 119 | 120 | // Get the "viewport" of the page, as reported by the page. 121 | const dimensions = await page.evaluate(() => { 122 | return { 123 | width: document.documentElement.clientWidth, 124 | height: document.documentElement.clientHeight, 125 | deviceScaleFactor: window.devicePixelRatio, 126 | }; 127 | }); 128 | 129 | console.log("Dimensions:", dimensions); 130 | 131 | await browser.close(); 132 | ``` 133 | 134 | Execute script on the command line 135 | 136 | ```bash 137 | deno run -A --unstable get-dimensions.js 138 | ``` 139 | 140 | ## FAQ 141 | 142 | ### How does deno-puppeteer compare to the Node version? 143 | 144 | `deno-puppeteer` effectively runs a regular version of Puppeteer, except for 145 | some minor changes to make it compatible with Deno. 146 | 147 | The most noticable difference is likely that instead of some methods taking / 148 | returning Node `Buffer`, they take / return `Uint8Array`. One method also 149 | returns a web native `ReadableStream` instead of the Node `Readable`. 150 | 151 | Other than this, the documentation on https://pptr.dev generally applies. 152 | 153 | ### How to run in Docker? 154 | 155 | An example Dockerfile can be found in this repository. It will install all 156 | necessary dependencies, and shows how to run the ./examples/docker.js. 157 | 158 | It is just meant as a jumping off point - customize it as you wish. 159 | -------------------------------------------------------------------------------- /examples/docker.js: -------------------------------------------------------------------------------- 1 | import puppeteer from "../mod.ts"; 2 | 3 | const browser = await puppeteer.launch({ 4 | args: [ 5 | "--no-sandbox", 6 | "--disable-dev-shm-usage", 7 | ], 8 | }); 9 | const page = await browser.newPage(); 10 | await page.goto("https://example.com"); 11 | 12 | // Get the "viewport" of the page, as reported by the page. 13 | const dimensions = await page.evaluate(() => { 14 | return { 15 | width: document.documentElement.clientWidth, 16 | height: document.documentElement.clientHeight, 17 | deviceScaleFactor: window.devicePixelRatio, 18 | }; 19 | }); 20 | 21 | console.log("Dimensions:", dimensions); 22 | 23 | await browser.close(); 24 | -------------------------------------------------------------------------------- /examples/firefox.ts: -------------------------------------------------------------------------------- 1 | import puppeteer from "../mod.ts"; 2 | 3 | const browser = await puppeteer.launch({ product: "firefox", headless: false }); 4 | const page = await browser.newPage(); 5 | await page.goto("https://example.com"); 6 | await page.screenshot({ path: "example.png" }); 7 | 8 | await browser.close(); 9 | -------------------------------------------------------------------------------- /examples/get-dimensions.js: -------------------------------------------------------------------------------- 1 | import puppeteer from "../mod.ts"; 2 | 3 | const browser = await puppeteer.launch(); 4 | const page = await browser.newPage(); 5 | await page.goto("https://example.com"); 6 | 7 | // Get the "viewport" of the page, as reported by the page. 8 | const dimensions = await page.evaluate(() => { 9 | return { 10 | width: document.documentElement.clientWidth, 11 | height: document.documentElement.clientHeight, 12 | deviceScaleFactor: window.devicePixelRatio, 13 | }; 14 | }); 15 | 16 | console.log("Dimensions:", dimensions); 17 | 18 | await browser.close(); 19 | -------------------------------------------------------------------------------- /examples/hackernews.ts: -------------------------------------------------------------------------------- 1 | import puppeteer from "../mod.ts"; 2 | 3 | const browser = await puppeteer.launch(); 4 | const page = await browser.newPage(); 5 | await page.goto("https://news.ycombinator.com", { waitUntil: "networkidle2" }); 6 | await page.pdf({ path: "hn.pdf", format: "a4" }); 7 | 8 | await browser.close(); 9 | -------------------------------------------------------------------------------- /examples/screenshot.ts: -------------------------------------------------------------------------------- 1 | import puppeteer from "../mod.ts"; 2 | 3 | const browser = await puppeteer.launch(); 4 | const page = await browser.newPage(); 5 | await page.goto("https://example.com"); 6 | await page.screenshot({ path: "example.png" }); 7 | 8 | await browser.close(); 9 | -------------------------------------------------------------------------------- /fixtures/dom-tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["esnext", "dom", "deno.ns", "deno.unstable"] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /install.ts: -------------------------------------------------------------------------------- 1 | import puppeteer from "./mod.ts"; 2 | import { PUPPETEER_REVISIONS } from "./vendor/puppeteer-core/puppeteer/revisions.js"; 3 | import ProgressBar from "https://deno.land/x/progress@v1.1.4/mod.ts"; 4 | 5 | let product = Deno.env.get("PUPPETEER_PRODUCT"); 6 | if (product != "chrome" && product != "firefox") { 7 | if (product != undefined) { 8 | console.warn(`Unknown product '${product}', falling back to 'chrome'.`); 9 | } 10 | product = "chrome"; 11 | } 12 | const fetcher = puppeteer.createBrowserFetcher({ product }); 13 | let revision; 14 | if (product == "chrome") { 15 | revision = Deno.env.get("PUPPETEER_CHROMIUM_REVISION") || 16 | PUPPETEER_REVISIONS.chromium; 17 | } else if (product == "firefox") { 18 | puppeteer._preferredRevision = PUPPETEER_REVISIONS.firefox; 19 | const req = await fetch( 20 | "https://product-details.mozilla.org/1.0/firefox_versions.json", 21 | ); 22 | const versions = await req.json(); 23 | revision = versions.FIREFOX_NIGHTLY; 24 | if (!versions.FIREFOX_NIGHTLY) { 25 | throw new Error("Firefox version not found"); 26 | } 27 | } 28 | 29 | const revisionInfo = fetcher.revisionInfo(revision); 30 | if (revisionInfo.local) { 31 | console.log(`Already downloaded at ${revisionInfo.executablePath}`); 32 | } else { 33 | let progressBar: ProgressBar; 34 | const newRevisionInfo = await fetcher.download( 35 | revisionInfo.revision, 36 | (current, total) => { 37 | if (!progressBar) { 38 | progressBar = new ProgressBar({ 39 | total, 40 | }); 41 | } 42 | if (!(progressBar as any).isCompleted) { 43 | progressBar.render(current); 44 | } else { 45 | console.log("Done downloading. Installing now."); 46 | } 47 | }, 48 | ); 49 | console.log( 50 | `Downloaded ${newRevisionInfo.product} ${newRevisionInfo.revision} to ${newRevisionInfo.executablePath} from ${newRevisionInfo.url}`, 51 | ); 52 | } 53 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucacasonato/deno-puppeteer/45b3162585b98ad8d54abeb56f48ecbb17c614eb/logo.png -------------------------------------------------------------------------------- /mod.ts: -------------------------------------------------------------------------------- 1 | import puppeteer from "./src/mod.ts"; 2 | export default puppeteer; 3 | export * from "./vendor/puppeteer-core/puppeteer/types.js"; 4 | -------------------------------------------------------------------------------- /src/deno/LaunchOptions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Launcher options that only apply to Chrome. 18 | * 19 | * @public 20 | */ 21 | export interface ChromeArgOptions { 22 | headless?: boolean; 23 | args?: string[]; 24 | userDataDir?: string; 25 | devtools?: boolean; 26 | } 27 | 28 | /** 29 | * Generic launch options that can be passed when launching any browser. 30 | * @public 31 | */ 32 | export interface LaunchOptions { 33 | executablePath?: string; 34 | ignoreDefaultArgs?: boolean | string[]; 35 | timeout?: number; 36 | env?: Record; 37 | dumpio?: boolean; 38 | } 39 | -------------------------------------------------------------------------------- /src/initialize-deno.ts: -------------------------------------------------------------------------------- 1 | import { PuppeteerDeno } from "./deno/Puppeteer.ts"; 2 | import { PUPPETEER_REVISIONS } from "../vendor/puppeteer-core/puppeteer/revisions.js"; 3 | 4 | export const initializePuppeteerDeno = (): PuppeteerDeno => { 5 | const productName = Deno.env.get("PUPPETEER_PRODUCT") as "chrome" | "firefox"; 6 | 7 | let preferredRevision: string = PUPPETEER_REVISIONS.chromium; 8 | if (productName == "firefox") preferredRevision = PUPPETEER_REVISIONS.firefox; 9 | 10 | return new PuppeteerDeno({ 11 | preferredRevision, 12 | productName, 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /src/mod.ts: -------------------------------------------------------------------------------- 1 | import { initializePuppeteerDeno } from "./initialize-deno.ts"; 2 | export default initializePuppeteerDeno(); 3 | -------------------------------------------------------------------------------- /tests.ts: -------------------------------------------------------------------------------- 1 | import { 2 | assert, 3 | assertEquals, 4 | } from "https://deno.land/std@0.93.0/testing/asserts.ts"; 5 | import puppeteer, { Browser } from "./mod.ts"; 6 | 7 | function browserTest( 8 | name: string, 9 | fn: (browser: Browser) => void | Promise, 10 | ) { 11 | Deno.test(name, async () => { 12 | let browser: Browser | undefined = undefined; 13 | try { 14 | browser = await puppeteer.launch({}); 15 | await fn(browser); 16 | } finally { 17 | if (browser) await browser.close(); 18 | } 19 | }); 20 | } 21 | 22 | browserTest("hello world", async (browser) => { 23 | const page = await browser.newPage(); 24 | await page.goto("https://example.com", { waitUntil: "domcontentloaded" }); 25 | const h1 = await page.$("h1"); 26 | assert(h1); 27 | assertEquals(await h1.evaluate((e: any) => e.innerText), "Example Domain"); 28 | }); 29 | -------------------------------------------------------------------------------- /tools/update_puppeteer.ts: -------------------------------------------------------------------------------- 1 | import { Untar } from "https://deno.land/std@0.93.0/archive/tar.ts"; 2 | import { basename, dirname } from "https://deno.land/std@0.93.0/path/mod.ts"; 3 | import { gzipDecode } from "https://deno.land/x/wasm_gzip@v1.0.0/mod.ts"; 4 | import { endsWith } from "https://deno.land/std@0.93.0/bytes/mod.ts"; 5 | 6 | const version = Deno.args[0]; 7 | 8 | const tarballReq = await fetch( 9 | `https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-${version}.tgz`, 10 | ); 11 | const tarballData = gzipDecode(new Uint8Array(await tarballReq.arrayBuffer())); 12 | const tarballReader = new Deno.Buffer(tarballData); 13 | const untar = new Untar(tarballReader); 14 | 15 | const originalFiles: Record = {}; 16 | 17 | for await (const file of untar) { 18 | const filename = file.fileName.substring("package/".length); 19 | originalFiles[filename] = await Deno.readAll(file); 20 | } 21 | 22 | const encoder = new TextEncoder(); 23 | const decoder = new TextDecoder(); 24 | 25 | const packageJSON = decoder.decode(originalFiles["package.json"]); 26 | const packageJSONObject = JSON.parse(packageJSON); 27 | 28 | const protocolVersion = packageJSONObject.dependencies["devtools-protocol"]; 29 | 30 | const protocolReq = await fetch( 31 | `https://unpkg.com/devtools-protocol@${protocolVersion}/types/protocol.d.ts`, 32 | ); 33 | const protocolMapping = await fetch( 34 | `https://unpkg.com/devtools-protocol@${protocolVersion}/types/protocol-mapping.d.ts`, 35 | ); 36 | const files: Record = { 37 | LICENSE: originalFiles.LICENSE, 38 | "vendor/devtools-protocol/types/protocol.d.ts": new Uint8Array( 39 | await protocolReq.arrayBuffer(), 40 | ), 41 | "vendor/devtools-protocol/types/protocol-mapping.d.ts": encoder.encode( 42 | (await protocolMapping.text()).replace(`'./protocol'`, `'./protocol.d.ts'`), 43 | ), 44 | }; 45 | 46 | for (const fileName in originalFiles) { 47 | if (fileName.startsWith("lib/esm/")) { 48 | files[fileName.substring("lib/esm/".length)] = originalFiles[fileName]; 49 | } 50 | } 51 | for (const fileName in files) { 52 | if ( 53 | fileName.startsWith("puppeteer/node") || 54 | fileName.endsWith(".map") || 55 | fileName.endsWith(".tsbuildinfo") || 56 | fileName.includes("/initialize-") || 57 | fileName.includes("/web.") || 58 | fileName.includes("/node.") || 59 | fileName.includes("/environment.") 60 | ) { 61 | delete files[fileName]; 62 | } 63 | } 64 | 65 | for (const fileName in files) { 66 | // add to js files 67 | if (fileName.endsWith(".js")) { 68 | const src = decoder.decode(files[fileName]); 69 | const base = basename(fileName, ".js"); 70 | files[fileName] = encoder.encode( 71 | `/// \n` + 72 | src.replaceAll( 73 | "'devtools-protocol'", 74 | "'../../vendor/devtools-protocol/types/protocol.d.ts'", 75 | ), 76 | ); 77 | } 78 | if (fileName.endsWith(".d.ts")) { 79 | const src = decoder.decode(files[fileName]); 80 | const base = basename(fileName, ".d.ts"); 81 | files[fileName] = encoder.encode( 82 | src 83 | .replace(`//# sourceMappingURL=${base}.d.ts.map`, "") 84 | .replace(`/// \n`, "") 85 | .replaceAll( 86 | "'devtools-protocol'", 87 | "'../../vendor/devtools-protocol/types/protocol.d.ts'", 88 | ) 89 | .replaceAll( 90 | "'devtools-protocol/types/protocol-mapping.js'", 91 | "'../../vendor/devtools-protocol/types/protocol-mapping.d.ts'", 92 | ) 93 | .replaceAll(" Element ", " any ") 94 | .replaceAll(" Element ", " any ") 95 | .replaceAll(" Element[", " any[") 96 | .replaceAll(" Element,", " any,") 97 | .replaceAll("Element>", "any>") 98 | .replaceAll("| Document", "") 99 | .replaceAll("| NodeListOf", "") 100 | .replaceAll("NodeJS.Timeout", "number"), 101 | ); 102 | } 103 | } 104 | 105 | { 106 | const fileName = "puppeteer/api-docs-entry.js"; 107 | const src = decoder.decode(files[fileName]); 108 | files[fileName] = encoder.encode( 109 | src 110 | .split("\n") 111 | .filter((l) => !l.includes("./node/")) 112 | .join("\n") 113 | .replace( 114 | "'devtools-protocol/types/protocol'", 115 | "'../vendor/devtools-protocol/types/protocol.d.ts'", 116 | ), 117 | ); 118 | } 119 | { 120 | const fileName = "puppeteer/api-docs-entry.d.ts"; 121 | const src = decoder.decode(files[fileName]); 122 | files[fileName] = encoder.encode( 123 | src 124 | .split("\n") 125 | .filter((l) => !l.includes("./node/")) 126 | .join("\n") 127 | .replace( 128 | "'devtools-protocol/types/protocol'", 129 | "'../vendor/devtools-protocol/types/protocol.d.ts'", 130 | ), 131 | ); 132 | } 133 | 134 | { 135 | const fileName = "puppeteer/common/Browser.d.ts"; 136 | const src = decoder.decode(files[fileName]); 137 | files[fileName] = encoder.encode( 138 | src.replace( 139 | `import { ChildProcess } from 'child_process';\n`, 140 | ``, 141 | ).replace( 142 | `ChildProcess;\n`, 143 | `Deno.Process`, 144 | ), 145 | ); 146 | } 147 | 148 | const output = `./vendor/puppeteer-core`; 149 | 150 | await Deno.remove(output, { recursive: true }).catch(() => {}); 151 | await Deno.mkdir(output, { recursive: true }); 152 | 153 | const filenames = []; 154 | 155 | for (const filename in files) { 156 | const path = `${output}/${filename}`; 157 | filenames.push(path); 158 | await Deno.mkdir(dirname(path), { recursive: true }); 159 | await Deno.writeFile(path, files[filename]); 160 | } 161 | 162 | const cmd = Deno.run({ 163 | cmd: [ 164 | "deno", 165 | "fmt", 166 | ...filenames.filter((f) => f.endsWith(".js") || f.endsWith(".d.ts")), 167 | ], 168 | }); 169 | await cmd.status(); 170 | cmd.close(); 171 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/api-docs-entry.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucacasonato/deno-puppeteer/45b3162585b98ad8d54abeb56f48ecbb17c614eb/vendor/puppeteer-core/puppeteer/api-docs-entry.d.ts -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/api-docs-entry.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucacasonato/deno-puppeteer/45b3162585b98ad8d54abeb56f48ecbb17c614eb/vendor/puppeteer-core/puppeteer/api-docs-entry.js -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Accessibility.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the 'License'); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an 'AS IS' BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { CDPSession } from "./Connection.js"; 17 | import { ElementHandle } from "./ElementHandle.js"; 18 | /** 19 | * Represents a Node and the properties of it that are relevant to Accessibility. 20 | * @public 21 | */ 22 | export interface SerializedAXNode { 23 | /** 24 | * The {@link https://www.w3.org/TR/wai-aria/#usage_intro | role} of the node. 25 | */ 26 | role: string; 27 | /** 28 | * A human readable name for the node. 29 | */ 30 | name?: string; 31 | /** 32 | * The current value of the node. 33 | */ 34 | value?: string | number; 35 | /** 36 | * An additional human readable description of the node. 37 | */ 38 | description?: string; 39 | /** 40 | * Any keyboard shortcuts associated with this node. 41 | */ 42 | keyshortcuts?: string; 43 | /** 44 | * A human readable alternative to the role. 45 | */ 46 | roledescription?: string; 47 | /** 48 | * A description of the current value. 49 | */ 50 | valuetext?: string; 51 | disabled?: boolean; 52 | expanded?: boolean; 53 | focused?: boolean; 54 | modal?: boolean; 55 | multiline?: boolean; 56 | /** 57 | * Whether more than one child can be selected. 58 | */ 59 | multiselectable?: boolean; 60 | readonly?: boolean; 61 | required?: boolean; 62 | selected?: boolean; 63 | /** 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 | */ 67 | checked?: boolean | "mixed"; 68 | /** 69 | * Whether the node is checked or in a mixed state. 70 | */ 71 | pressed?: boolean | "mixed"; 72 | /** 73 | * The level of a heading. 74 | */ 75 | level?: number; 76 | valuemin?: number; 77 | valuemax?: number; 78 | autocomplete?: string; 79 | haspopup?: string; 80 | /** 81 | * Whether and in what way this node's value is invalid. 82 | */ 83 | invalid?: string; 84 | orientation?: string; 85 | /** 86 | * Children of this node, if there are any. 87 | */ 88 | children?: SerializedAXNode[]; 89 | } 90 | /** 91 | * @public 92 | */ 93 | export interface SnapshotOptions { 94 | /** 95 | * Prune uninteresting nodes from the tree. 96 | * @defaultValue true 97 | */ 98 | interestingOnly?: boolean; 99 | /** 100 | * Root node to get the accessibility tree for 101 | * @defaultValue The root node of the entire page. 102 | */ 103 | root?: ElementHandle; 104 | } 105 | /** 106 | * The Accessibility class provides methods for inspecting Chromium's 107 | * accessibility tree. The accessibility tree is used by assistive technology 108 | * such as {@link https://en.wikipedia.org/wiki/Screen_reader | screen readers} or 109 | * {@link https://en.wikipedia.org/wiki/Switch_access | switches}. 110 | * 111 | * @remarks 112 | * 113 | * Accessibility is a very platform-specific thing. On different platforms, 114 | * there are different screen readers that might have wildly different output. 115 | * 116 | * Blink - Chrome's rendering engine - has a concept of "accessibility tree", 117 | * which is then translated into different platform-specific APIs. Accessibility 118 | * namespace gives users access to the Blink Accessibility Tree. 119 | * 120 | * Most of the accessibility tree gets filtered out when converting from Blink 121 | * AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. 122 | * By default, Puppeteer tries to approximate this filtering, exposing only 123 | * the "interesting" nodes of the tree. 124 | * 125 | * @public 126 | */ 127 | export declare class Accessibility { 128 | #private; 129 | /** 130 | * @internal 131 | */ 132 | constructor(client: CDPSession); 133 | /** 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 | * 147 | * ```ts 148 | * const snapshot = await page.accessibility.snapshot(); 149 | * console.log(snapshot); 150 | * ``` 151 | * 152 | * @example 153 | * An example of logging the focused node's name: 154 | * 155 | * ```ts 156 | * const snapshot = await page.accessibility.snapshot(); 157 | * const node = findFocusedNode(snapshot); 158 | * console.log(node && node.name); 159 | * 160 | * function findFocusedNode(node) { 161 | * if (node.focused) return node; 162 | * for (const child of node.children || []) { 163 | * const foundNode = findFocusedNode(child); 164 | * return foundNode; 165 | * } 166 | * return null; 167 | * } 168 | * ``` 169 | * 170 | * @returns An AXNode object representing the snapshot. 171 | */ 172 | snapshot(options?: SnapshotOptions): Promise; 173 | private serializeTree; 174 | private collectInterestingNodes; 175 | } 176 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/AriaQueryHandler.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { InternalQueryHandler } from "./QueryHandler.js"; 17 | /** 18 | * @internal 19 | */ 20 | export declare const ariaHandler: InternalQueryHandler; 21 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/AriaQueryHandler.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { assert } from "../util/assert.js"; 18 | async function queryAXTree(client, element, accessibleName, role) { 19 | const { nodes } = await client.send("Accessibility.queryAXTree", { 20 | objectId: element.remoteObject().objectId, 21 | accessibleName, 22 | role, 23 | }); 24 | const filteredNodes = nodes.filter((node) => { 25 | return !node.role || node.role.value !== "StaticText"; 26 | }); 27 | return filteredNodes; 28 | } 29 | const normalizeValue = (value) => { 30 | return value.replace(/ +/g, " ").trim(); 31 | }; 32 | const knownAttributes = new Set(["name", "role"]); 33 | const attributeRegexp = 34 | /\[\s*(?\w+)\s*=\s*(?"|')(?\\.|.*?(?=\k))\k\s*\]/g; 35 | function isKnownAttribute(attribute) { 36 | return knownAttributes.has(attribute); 37 | } 38 | /** 39 | * The selectors consist of an accessible name to query for and optionally 40 | * further aria attributes on the form `[=]`. 41 | * Currently, we only support the `name` and `role` attribute. 42 | * The following examples showcase how the syntax works wrt. querying: 43 | * 44 | * - 'title[role="heading"]' queries for elements with name 'title' and role 'heading'. 45 | * - '[role="img"]' queries for elements with role 'img' and any name. 46 | * - 'label' queries for elements with name 'label' and any role. 47 | * - '[name=""][role="button"]' queries for elements with no name and role 'button'. 48 | */ 49 | function parseAriaSelector(selector) { 50 | const queryOptions = {}; 51 | const defaultName = selector.replace( 52 | attributeRegexp, 53 | (_, attribute, _quote, value) => { 54 | attribute = attribute.trim(); 55 | assert( 56 | isKnownAttribute(attribute), 57 | `Unknown aria attribute "${attribute}" in selector`, 58 | ); 59 | queryOptions[attribute] = normalizeValue(value); 60 | return ""; 61 | }, 62 | ); 63 | if (defaultName && !queryOptions.name) { 64 | queryOptions.name = normalizeValue(defaultName); 65 | } 66 | return queryOptions; 67 | } 68 | const queryOne = async (element, selector) => { 69 | const exeCtx = element.executionContext(); 70 | const { name, role } = parseAriaSelector(selector); 71 | const res = await queryAXTree(exeCtx._client, element, name, role); 72 | if (!res[0] || !res[0].backendDOMNodeId) { 73 | return null; 74 | } 75 | return (await exeCtx._world.adoptBackendNode(res[0].backendDOMNodeId)); 76 | }; 77 | const waitFor = async (isolatedWorld, selector, options) => { 78 | const binding = { 79 | name: "ariaQuerySelector", 80 | pptrFunction: async (selector) => { 81 | const root = options.root || (await isolatedWorld.document()); 82 | const element = await queryOne(root, selector); 83 | return element; 84 | }, 85 | }; 86 | return (await isolatedWorld._waitForSelectorInPage( 87 | (_, selector) => { 88 | return globalThis.ariaQuerySelector(selector); 89 | }, 90 | selector, 91 | options, 92 | binding, 93 | )); 94 | }; 95 | const queryAll = async (element, selector) => { 96 | const exeCtx = element.executionContext(); 97 | const { name, role } = parseAriaSelector(selector); 98 | const res = await queryAXTree(exeCtx._client, element, name, role); 99 | const world = exeCtx._world; 100 | return Promise.all(res.map((axNode) => { 101 | return world.adoptBackendNode(axNode.backendDOMNodeId); 102 | })); 103 | }; 104 | const queryAllArray = async (element, selector) => { 105 | const elementHandles = await queryAll(element, selector); 106 | const exeCtx = element.executionContext(); 107 | const jsHandle = exeCtx.evaluateHandle((...elements) => { 108 | return elements; 109 | }, ...elementHandles); 110 | return jsHandle; 111 | }; 112 | /** 113 | * @internal 114 | */ 115 | export const ariaHandler = { 116 | queryOne, 117 | waitFor, 118 | queryAll, 119 | queryAllArray, 120 | }; 121 | //# sourceMappingURL=AriaQueryHandler.js.map 122 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/BrowserConnector.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { 17 | Browser, 18 | IsPageTargetCallback, 19 | TargetFilterCallback, 20 | } from "./Browser.js"; 21 | import { ConnectionTransport } from "./ConnectionTransport.js"; 22 | import { Viewport } from "./PuppeteerViewport.js"; 23 | /** 24 | * Generic browser options that can be passed when launching any browser or when 25 | * connecting to an existing browser instance. 26 | * @public 27 | */ 28 | export interface BrowserConnectOptions { 29 | /** 30 | * Whether to ignore HTTPS errors during navigation. 31 | * @defaultValue false 32 | */ 33 | ignoreHTTPSErrors?: boolean; 34 | /** 35 | * Sets the viewport for each page. 36 | */ 37 | defaultViewport?: Viewport | null; 38 | /** 39 | * Slows down Puppeteer operations by the specified amount of milliseconds to 40 | * aid debugging. 41 | */ 42 | slowMo?: number; 43 | /** 44 | * Callback to decide if Puppeteer should connect to a given target or not. 45 | */ 46 | targetFilter?: TargetFilterCallback; 47 | /** 48 | * @internal 49 | */ 50 | _isPageTarget?: IsPageTargetCallback; 51 | } 52 | /** 53 | * Users should never call this directly; it's called when calling 54 | * `puppeteer.connect`. 55 | * 56 | * @internal 57 | */ 58 | export declare function _connectToBrowser( 59 | options: BrowserConnectOptions & { 60 | browserWSEndpoint?: string; 61 | browserURL?: string; 62 | transport?: ConnectionTransport; 63 | }, 64 | ): Promise; 65 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/BrowserConnector.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { debugError } from "./util.js"; 18 | import { isErrorLike } from "../util/ErrorLike.js"; 19 | import { assert } from "../util/assert.js"; 20 | import { Browser } from "./Browser.js"; 21 | import { Connection } from "./Connection.js"; 22 | import { getFetch } from "./fetch.js"; 23 | import { BrowserWebSocketTransport } from "./BrowserWebSocketTransport.js"; 24 | const getWebSocketTransportClass = async () => { 25 | return Promise.resolve(BrowserWebSocketTransport); 26 | }; 27 | /** 28 | * Users should never call this directly; it's called when calling 29 | * `puppeteer.connect`. 30 | * 31 | * @internal 32 | */ 33 | export async function _connectToBrowser(options) { 34 | const { 35 | browserWSEndpoint, 36 | browserURL, 37 | ignoreHTTPSErrors = false, 38 | defaultViewport = { width: 800, height: 600 }, 39 | transport, 40 | slowMo = 0, 41 | targetFilter, 42 | _isPageTarget: isPageTarget, 43 | } = options; 44 | assert( 45 | Number(!!browserWSEndpoint) + Number(!!browserURL) + Number(!!transport) === 46 | 1, 47 | "Exactly one of browserWSEndpoint, browserURL or transport must be passed to puppeteer.connect", 48 | ); 49 | let connection; 50 | if (transport) { 51 | connection = new Connection("", transport, slowMo); 52 | } else if (browserWSEndpoint) { 53 | const WebSocketClass = await getWebSocketTransportClass(); 54 | const connectionTransport = await WebSocketClass.create(browserWSEndpoint); 55 | connection = new Connection(browserWSEndpoint, connectionTransport, slowMo); 56 | } else if (browserURL) { 57 | const connectionURL = await getWSEndpoint(browserURL); 58 | const WebSocketClass = await getWebSocketTransportClass(); 59 | const connectionTransport = await WebSocketClass.create(connectionURL); 60 | connection = new Connection(connectionURL, connectionTransport, slowMo); 61 | } 62 | const version = await connection.send("Browser.getVersion"); 63 | const product = version.product.toLowerCase().includes("firefox") 64 | ? "firefox" 65 | : "chrome"; 66 | const { browserContextIds } = await connection.send( 67 | "Target.getBrowserContexts", 68 | ); 69 | const browser = await Browser._create( 70 | product || "chrome", 71 | connection, 72 | browserContextIds, 73 | ignoreHTTPSErrors, 74 | defaultViewport, 75 | undefined, 76 | () => { 77 | return connection.send("Browser.close").catch(debugError); 78 | }, 79 | targetFilter, 80 | isPageTarget, 81 | ); 82 | await browser.pages(); 83 | return browser; 84 | } 85 | async function getWSEndpoint(browserURL) { 86 | const endpointURL = new URL("/json/version", browserURL); 87 | const fetch = await getFetch(); 88 | try { 89 | const result = await fetch(endpointURL.toString(), { 90 | method: "GET", 91 | }); 92 | if (!result.ok) { 93 | throw new Error(`HTTP ${result.statusText}`); 94 | } 95 | const data = await result.json(); 96 | return data.webSocketDebuggerUrl; 97 | } catch (error) { 98 | if (isErrorLike(error)) { 99 | error.message = 100 | `Failed to fetch browser webSocket URL from ${endpointURL}: ` + 101 | error.message; 102 | } 103 | throw error; 104 | } 105 | } 106 | //# sourceMappingURL=BrowserConnector.js.map 107 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/BrowserWebSocketTransport.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { ConnectionTransport } from "./ConnectionTransport.js"; 17 | /** 18 | * @internal 19 | */ 20 | export declare class BrowserWebSocketTransport implements ConnectionTransport { 21 | #private; 22 | static create(url: string): Promise; 23 | onmessage?: (message: string) => void; 24 | onclose?: () => void; 25 | constructor(ws: WebSocket); 26 | send(message: string): void; 27 | close(): Promise; 28 | } 29 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/BrowserWebSocketTransport.js: -------------------------------------------------------------------------------- 1 | /// 2 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || 3 | function (receiver, state, value, kind, f) { 4 | if (kind === "m") throw new TypeError("Private method is not writable"); 5 | if (kind === "a" && !f) { 6 | throw new TypeError("Private accessor was defined without a setter"); 7 | } 8 | if ( 9 | typeof state === "function" 10 | ? receiver !== state || !f 11 | : !state.has(receiver) 12 | ) { 13 | throw new TypeError( 14 | "Cannot write private member to an object whose class did not declare it", 15 | ); 16 | } 17 | return (kind === "a" 18 | ? f.call(receiver, value) 19 | : f 20 | ? f.value = value 21 | : state.set(receiver, value)), 22 | value; 23 | }; 24 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || 25 | function (receiver, state, kind, f) { 26 | if (kind === "a" && !f) { 27 | throw new TypeError("Private accessor was defined without a getter"); 28 | } 29 | if ( 30 | typeof state === "function" 31 | ? receiver !== state || !f 32 | : !state.has(receiver) 33 | ) { 34 | throw new TypeError( 35 | "Cannot read private member from an object whose class did not declare it", 36 | ); 37 | } 38 | return kind === "m" 39 | ? f 40 | : kind === "a" 41 | ? f.call(receiver) 42 | : f 43 | ? f.value 44 | : state.get(receiver); 45 | }; 46 | var _BrowserWebSocketTransport_ws; 47 | /** 48 | * @internal 49 | */ 50 | export class BrowserWebSocketTransport { 51 | constructor(ws) { 52 | _BrowserWebSocketTransport_ws.set(this, void 0); 53 | __classPrivateFieldSet(this, _BrowserWebSocketTransport_ws, ws, "f"); 54 | __classPrivateFieldGet(this, _BrowserWebSocketTransport_ws, "f") 55 | .addEventListener("message", (event) => { 56 | if (this.onmessage) { 57 | this.onmessage.call(null, event.data); 58 | } 59 | }); 60 | __classPrivateFieldGet(this, _BrowserWebSocketTransport_ws, "f") 61 | .addEventListener("close", () => { 62 | this._closed = true; 63 | if (this.onclose) { 64 | this.onclose.call(null); 65 | } 66 | }); 67 | // Silently ignore all errors - we don't know what to do with them. 68 | __classPrivateFieldGet(this, _BrowserWebSocketTransport_ws, "f") 69 | .addEventListener("error", () => {}); 70 | this._closed = false; 71 | this.onmessage = null; 72 | this.onclose = null; 73 | } 74 | static create(url) { 75 | return new Promise((resolve, reject) => { 76 | const ws = new WebSocket(url); 77 | ws.addEventListener("open", () => { 78 | return resolve(new BrowserWebSocketTransport(ws)); 79 | }); 80 | ws.addEventListener("error", reject); 81 | }); 82 | } 83 | send(message) { 84 | __classPrivateFieldGet(this, _BrowserWebSocketTransport_ws, "f").send( 85 | message, 86 | ); 87 | } 88 | close() { 89 | const ws = __classPrivateFieldGet(this, _BrowserWebSocketTransport_ws, "f"); 90 | return new Promise((resolve, reject) => { 91 | ws.addEventListener("close", () => resolve()); 92 | ws.addEventListener("error", (err) => reject(err)); 93 | ws.close(); 94 | if (this._closed) resolve(); 95 | }); 96 | } 97 | } 98 | _BrowserWebSocketTransport_ws = new WeakMap(); 99 | //# sourceMappingURL=BrowserWebSocketTransport.js.map 100 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/ChromeTargetManager.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2022 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { CDPSession, Connection } from "./Connection.js"; 17 | import { EventEmitter } from "./EventEmitter.js"; 18 | import { Target } from "./Target.js"; 19 | import { TargetFilterCallback } from "./Browser.js"; 20 | import { 21 | TargetFactory, 22 | TargetInterceptor, 23 | TargetManager, 24 | } from "./TargetManager.js"; 25 | /** 26 | * ChromeTargetManager uses the CDP's auto-attach mechanism to intercept 27 | * new targets and allow the rest of Puppeteer to configure listeners while 28 | * the target is paused. 29 | * 30 | * @internal 31 | */ 32 | export declare class ChromeTargetManager extends EventEmitter 33 | implements TargetManager { 34 | #private; 35 | constructor( 36 | connection: Connection, 37 | targetFactory: TargetFactory, 38 | targetFilterCallback?: TargetFilterCallback, 39 | ); 40 | initialize(): Promise; 41 | dispose(): void; 42 | getAvailableTargets(): Map; 43 | addTargetInterceptor( 44 | session: CDPSession | Connection, 45 | interceptor: TargetInterceptor, 46 | ): void; 47 | removeTargetInterceptor( 48 | client: CDPSession | Connection, 49 | interceptor: TargetInterceptor, 50 | ): void; 51 | } 52 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Connection.d.ts: -------------------------------------------------------------------------------- 1 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 2 | import { ProtocolMapping } from "../../vendor/devtools-protocol/types/protocol-mapping.d.ts"; 3 | import { ConnectionTransport } from "./ConnectionTransport.js"; 4 | import { EventEmitter } from "./EventEmitter.js"; 5 | import { ProtocolError } from "./Errors.js"; 6 | /** 7 | * @public 8 | */ 9 | export { ConnectionTransport, ProtocolMapping }; 10 | /** 11 | * @public 12 | */ 13 | export interface ConnectionCallback { 14 | resolve(args: unknown): void; 15 | reject(args: unknown): void; 16 | error: ProtocolError; 17 | method: string; 18 | } 19 | /** 20 | * Internal events that the Connection class emits. 21 | * 22 | * @internal 23 | */ 24 | export declare const ConnectionEmittedEvents: { 25 | readonly Disconnected: symbol; 26 | }; 27 | /** 28 | * @public 29 | */ 30 | export declare class Connection extends EventEmitter { 31 | #private; 32 | constructor(url: string, transport: ConnectionTransport, delay?: number); 33 | static fromSession(session: CDPSession): Connection | undefined; 34 | /** 35 | * @internal 36 | */ 37 | get _closed(): boolean; 38 | /** 39 | * @internal 40 | */ 41 | get _sessions(): Map; 42 | /** 43 | * @param sessionId - The session id 44 | * @returns The current CDP session if it exists 45 | */ 46 | session(sessionId: string): CDPSession | null; 47 | url(): string; 48 | send( 49 | method: T, 50 | ...paramArgs: ProtocolMapping.Commands[T]["paramsType"] 51 | ): Promise; 52 | /** 53 | * @internal 54 | */ 55 | _rawSend(message: Record): number; 56 | /** 57 | * @internal 58 | */ 59 | protected onMessage(message: string): Promise; 60 | dispose(): void; 61 | /** 62 | * @internal 63 | */ 64 | isAutoAttached(targetId: string): boolean; 65 | /** 66 | * @internal 67 | */ 68 | _createSession( 69 | targetInfo: Protocol.Target.TargetInfo, 70 | isAutoAttachEmulated?: boolean, 71 | ): Promise; 72 | /** 73 | * @param targetInfo - The target info 74 | * @returns The CDP session that is created 75 | */ 76 | createSession(targetInfo: Protocol.Target.TargetInfo): Promise; 77 | } 78 | /** 79 | * @public 80 | */ 81 | export interface CDPSessionOnMessageObject { 82 | id?: number; 83 | method: string; 84 | params: Record; 85 | error: { 86 | message: string; 87 | data: any; 88 | code: number; 89 | }; 90 | result?: any; 91 | } 92 | /** 93 | * Internal events that the CDPSession class emits. 94 | * 95 | * @internal 96 | */ 97 | export declare const CDPSessionEmittedEvents: { 98 | readonly Disconnected: symbol; 99 | }; 100 | /** 101 | * The `CDPSession` instances are used to talk raw Chrome Devtools Protocol. 102 | * 103 | * @remarks 104 | * 105 | * Protocol methods can be called with {@link CDPSession.send} method and protocol 106 | * events can be subscribed to with `CDPSession.on` method. 107 | * 108 | * Useful links: {@link https://chromedevtools.github.io/devtools-protocol/ | DevTools Protocol Viewer} 109 | * and {@link https://github.com/aslushnikov/getting-started-with-cdp/blob/HEAD/README.md | Getting Started with DevTools Protocol}. 110 | * 111 | * @example 112 | * 113 | * ```ts 114 | * const client = await page.target().createCDPSession(); 115 | * await client.send('Animation.enable'); 116 | * client.on('Animation.animationCreated', () => 117 | * console.log('Animation created!') 118 | * ); 119 | * const response = await client.send('Animation.getPlaybackRate'); 120 | * console.log('playback rate is ' + response.playbackRate); 121 | * await client.send('Animation.setPlaybackRate', { 122 | * playbackRate: response.playbackRate / 2, 123 | * }); 124 | * ``` 125 | * 126 | * @public 127 | */ 128 | export declare class CDPSession extends EventEmitter { 129 | #private; 130 | /** 131 | * @internal 132 | */ 133 | constructor(connection: Connection, targetType: string, sessionId: string); 134 | connection(): Connection | undefined; 135 | send( 136 | method: T, 137 | ...paramArgs: ProtocolMapping.Commands[T]["paramsType"] 138 | ): Promise; 139 | /** 140 | * @internal 141 | */ 142 | _onMessage(object: CDPSessionOnMessageObject): void; 143 | /** 144 | * Detaches the cdpSession from the target. Once detached, the cdpSession object 145 | * won't emit any events and can't be used to send messages. 146 | */ 147 | detach(): Promise; 148 | /** 149 | * @internal 150 | */ 151 | _onClosed(): void; 152 | /** 153 | * Returns the session's id. 154 | */ 155 | id(): string; 156 | } 157 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/ConnectionTransport.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * @public 18 | */ 19 | export interface ConnectionTransport { 20 | send(message: string): void; 21 | close(): void; 22 | onmessage?: (message: string) => void; 23 | onclose?: () => void; 24 | } 25 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/ConnectionTransport.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | export {}; 18 | //# sourceMappingURL=ConnectionTransport.js.map 19 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/ConsoleMessage.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { JSHandle } from "./JSHandle.js"; 17 | /** 18 | * @public 19 | */ 20 | export interface ConsoleMessageLocation { 21 | /** 22 | * URL of the resource if known or `undefined` otherwise. 23 | */ 24 | url?: string; 25 | /** 26 | * 0-based line number in the resource if known or `undefined` otherwise. 27 | */ 28 | lineNumber?: number; 29 | /** 30 | * 0-based column number in the resource if known or `undefined` otherwise. 31 | */ 32 | columnNumber?: number; 33 | } 34 | /** 35 | * The supported types for console messages. 36 | * @public 37 | */ 38 | export declare type ConsoleMessageType = 39 | | "log" 40 | | "debug" 41 | | "info" 42 | | "error" 43 | | "warning" 44 | | "dir" 45 | | "dirxml" 46 | | "table" 47 | | "trace" 48 | | "clear" 49 | | "startGroup" 50 | | "startGroupCollapsed" 51 | | "endGroup" 52 | | "assert" 53 | | "profile" 54 | | "profileEnd" 55 | | "count" 56 | | "timeEnd" 57 | | "verbose"; 58 | /** 59 | * ConsoleMessage objects are dispatched by page via the 'console' event. 60 | * @public 61 | */ 62 | export declare class ConsoleMessage { 63 | #private; 64 | /** 65 | * @public 66 | */ 67 | constructor( 68 | type: ConsoleMessageType, 69 | text: string, 70 | args: JSHandle[], 71 | stackTraceLocations: ConsoleMessageLocation[], 72 | ); 73 | /** 74 | * @returns The type of the console message. 75 | */ 76 | type(): ConsoleMessageType; 77 | /** 78 | * @returns The text of the console message. 79 | */ 80 | text(): string; 81 | /** 82 | * @returns An array of arguments passed to the console. 83 | */ 84 | args(): JSHandle[]; 85 | /** 86 | * @returns The location of the console message. 87 | */ 88 | location(): ConsoleMessageLocation; 89 | /** 90 | * @returns The array of locations on the stack of the console message. 91 | */ 92 | stackTrace(): ConsoleMessageLocation[]; 93 | } 94 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/ConsoleMessage.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || 18 | function (receiver, state, value, kind, f) { 19 | if (kind === "m") throw new TypeError("Private method is not writable"); 20 | if (kind === "a" && !f) { 21 | throw new TypeError("Private accessor was defined without a setter"); 22 | } 23 | if ( 24 | typeof state === "function" 25 | ? receiver !== state || !f 26 | : !state.has(receiver) 27 | ) { 28 | throw new TypeError( 29 | "Cannot write private member to an object whose class did not declare it", 30 | ); 31 | } 32 | return (kind === "a" 33 | ? f.call(receiver, value) 34 | : f 35 | ? f.value = value 36 | : state.set(receiver, value)), 37 | value; 38 | }; 39 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || 40 | function (receiver, state, kind, f) { 41 | if (kind === "a" && !f) { 42 | throw new TypeError("Private accessor was defined without a getter"); 43 | } 44 | if ( 45 | typeof state === "function" 46 | ? receiver !== state || !f 47 | : !state.has(receiver) 48 | ) { 49 | throw new TypeError( 50 | "Cannot read private member from an object whose class did not declare it", 51 | ); 52 | } 53 | return kind === "m" 54 | ? f 55 | : kind === "a" 56 | ? f.call(receiver) 57 | : f 58 | ? f.value 59 | : state.get(receiver); 60 | }; 61 | var _ConsoleMessage_type, 62 | _ConsoleMessage_text, 63 | _ConsoleMessage_args, 64 | _ConsoleMessage_stackTraceLocations; 65 | /** 66 | * ConsoleMessage objects are dispatched by page via the 'console' event. 67 | * @public 68 | */ 69 | export class ConsoleMessage { 70 | /** 71 | * @public 72 | */ 73 | constructor(type, text, args, stackTraceLocations) { 74 | _ConsoleMessage_type.set(this, void 0); 75 | _ConsoleMessage_text.set(this, void 0); 76 | _ConsoleMessage_args.set(this, void 0); 77 | _ConsoleMessage_stackTraceLocations.set(this, void 0); 78 | __classPrivateFieldSet(this, _ConsoleMessage_type, type, "f"); 79 | __classPrivateFieldSet(this, _ConsoleMessage_text, text, "f"); 80 | __classPrivateFieldSet(this, _ConsoleMessage_args, args, "f"); 81 | __classPrivateFieldSet( 82 | this, 83 | _ConsoleMessage_stackTraceLocations, 84 | stackTraceLocations, 85 | "f", 86 | ); 87 | } 88 | /** 89 | * @returns The type of the console message. 90 | */ 91 | type() { 92 | return __classPrivateFieldGet(this, _ConsoleMessage_type, "f"); 93 | } 94 | /** 95 | * @returns The text of the console message. 96 | */ 97 | text() { 98 | return __classPrivateFieldGet(this, _ConsoleMessage_text, "f"); 99 | } 100 | /** 101 | * @returns An array of arguments passed to the console. 102 | */ 103 | args() { 104 | return __classPrivateFieldGet(this, _ConsoleMessage_args, "f"); 105 | } 106 | /** 107 | * @returns The location of the console message. 108 | */ 109 | location() { 110 | var _a; 111 | return (_a = __classPrivateFieldGet( 112 | this, 113 | _ConsoleMessage_stackTraceLocations, 114 | "f", 115 | )[0]) !== null && _a !== void 0 116 | ? _a 117 | : {}; 118 | } 119 | /** 120 | * @returns The array of locations on the stack of the console message. 121 | */ 122 | stackTrace() { 123 | return __classPrivateFieldGet( 124 | this, 125 | _ConsoleMessage_stackTraceLocations, 126 | "f", 127 | ); 128 | } 129 | } 130 | _ConsoleMessage_type = new WeakMap(), 131 | _ConsoleMessage_text = new WeakMap(), 132 | _ConsoleMessage_args = new WeakMap(), 133 | _ConsoleMessage_stackTraceLocations = new WeakMap(); 134 | //# sourceMappingURL=ConsoleMessage.js.map 135 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Coverage.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { PuppeteerEventListener } from "./util.js"; 17 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 18 | import { CDPSession } from "./Connection.js"; 19 | /** 20 | * @internal 21 | */ 22 | export { PuppeteerEventListener }; 23 | /** 24 | * The CoverageEntry class represents one entry of the coverage report. 25 | * @public 26 | */ 27 | export interface CoverageEntry { 28 | /** 29 | * The URL of the style sheet or script. 30 | */ 31 | url: string; 32 | /** 33 | * The content of the style sheet or script. 34 | */ 35 | text: string; 36 | /** 37 | * The covered range as start and end positions. 38 | */ 39 | ranges: Array<{ 40 | start: number; 41 | end: number; 42 | }>; 43 | } 44 | /** 45 | * The CoverageEntry class for JavaScript 46 | * @public 47 | */ 48 | export interface JSCoverageEntry extends CoverageEntry { 49 | /** 50 | * Raw V8 script coverage entry. 51 | */ 52 | rawScriptCoverage?: Protocol.Profiler.ScriptCoverage; 53 | } 54 | /** 55 | * Set of configurable options for JS coverage. 56 | * @public 57 | */ 58 | export interface JSCoverageOptions { 59 | /** 60 | * Whether to reset coverage on every navigation. 61 | */ 62 | resetOnNavigation?: boolean; 63 | /** 64 | * Whether anonymous scripts generated by the page should be reported. 65 | */ 66 | reportAnonymousScripts?: boolean; 67 | /** 68 | * Whether the result includes raw V8 script coverage entries. 69 | */ 70 | includeRawScriptCoverage?: boolean; 71 | } 72 | /** 73 | * Set of configurable options for CSS coverage. 74 | * @public 75 | */ 76 | export interface CSSCoverageOptions { 77 | /** 78 | * Whether to reset coverage on every navigation. 79 | */ 80 | resetOnNavigation?: boolean; 81 | } 82 | /** 83 | * The Coverage class provides methods to gathers information about parts of 84 | * JavaScript and CSS that were used by the page. 85 | * 86 | * @remarks 87 | * To output coverage in a form consumable by {@link https://github.com/istanbuljs | Istanbul}, 88 | * see {@link https://github.com/istanbuljs/puppeteer-to-istanbul | puppeteer-to-istanbul}. 89 | * 90 | * @example 91 | * An example of using JavaScript and CSS coverage to get percentage of initially 92 | * executed code: 93 | * 94 | * ```ts 95 | * // Enable both JavaScript and CSS coverage 96 | * await Promise.all([ 97 | * page.coverage.startJSCoverage(), 98 | * page.coverage.startCSSCoverage(), 99 | * ]); 100 | * // Navigate to page 101 | * await page.goto('https://example.com'); 102 | * // Disable both JavaScript and CSS coverage 103 | * const [jsCoverage, cssCoverage] = await Promise.all([ 104 | * page.coverage.stopJSCoverage(), 105 | * page.coverage.stopCSSCoverage(), 106 | * ]); 107 | * let totalBytes = 0; 108 | * let usedBytes = 0; 109 | * const coverage = [...jsCoverage, ...cssCoverage]; 110 | * for (const entry of coverage) { 111 | * totalBytes += entry.text.length; 112 | * for (const range of entry.ranges) usedBytes += range.end - range.start - 1; 113 | * } 114 | * console.log(`Bytes used: ${(usedBytes / totalBytes) * 100}%`); 115 | * ``` 116 | * 117 | * @public 118 | */ 119 | export declare class Coverage { 120 | #private; 121 | constructor(client: CDPSession); 122 | /** 123 | * @param options - Set of configurable options for coverage defaults to 124 | * `resetOnNavigation : true, reportAnonymousScripts : false` 125 | * @returns Promise that resolves when coverage is started. 126 | * 127 | * @remarks 128 | * Anonymous scripts are ones that don't have an associated url. These are 129 | * scripts that are dynamically created on the page using `eval` or 130 | * `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous 131 | * scripts will have `pptr://__puppeteer_evaluation_script__` as their URL. 132 | */ 133 | startJSCoverage(options?: JSCoverageOptions): Promise; 134 | /** 135 | * @returns Promise that resolves to the array of coverage reports for 136 | * all scripts. 137 | * 138 | * @remarks 139 | * JavaScript Coverage doesn't include anonymous scripts by default. 140 | * However, scripts with sourceURLs are reported. 141 | */ 142 | stopJSCoverage(): Promise; 143 | /** 144 | * @param options - Set of configurable options for coverage, defaults to 145 | * `resetOnNavigation : true` 146 | * @returns Promise that resolves when coverage is started. 147 | */ 148 | startCSSCoverage(options?: CSSCoverageOptions): Promise; 149 | /** 150 | * @returns Promise that resolves to the array of coverage reports 151 | * for all stylesheets. 152 | * @remarks 153 | * CSS Coverage doesn't include dynamically injected style tags 154 | * without sourceURLs. 155 | */ 156 | stopCSSCoverage(): Promise; 157 | } 158 | /** 159 | * @public 160 | */ 161 | export declare class JSCoverage { 162 | #private; 163 | constructor(client: CDPSession); 164 | start(options?: { 165 | resetOnNavigation?: boolean; 166 | reportAnonymousScripts?: boolean; 167 | includeRawScriptCoverage?: boolean; 168 | }): Promise; 169 | stop(): Promise; 170 | } 171 | /** 172 | * @public 173 | */ 174 | export declare class CSSCoverage { 175 | #private; 176 | constructor(client: CDPSession); 177 | start(options?: { 178 | resetOnNavigation?: boolean; 179 | }): Promise; 180 | stop(): Promise; 181 | } 182 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Debug.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * A debug function that can be used in any environment. 18 | * 19 | * @remarks 20 | * If used in Node, it falls back to the 21 | * {@link https://www.npmjs.com/package/debug | debug module}. In the browser it 22 | * uses `console.log`. 23 | * 24 | * In Node, use the `DEBUG` environment variable to control logging: 25 | * 26 | * ``` 27 | * DEBUG=* // logs all channels 28 | * DEBUG=foo // logs the `foo` channel 29 | * DEBUG=foo* // logs any channels starting with `foo` 30 | * ``` 31 | * 32 | * In the browser, set `window.__PUPPETEER_DEBUG` to a string: 33 | * 34 | * ``` 35 | * window.__PUPPETEER_DEBUG='*'; // logs all channels 36 | * window.__PUPPETEER_DEBUG='foo'; // logs the `foo` channel 37 | * window.__PUPPETEER_DEBUG='foo*'; // logs any channels starting with `foo` 38 | * ``` 39 | * 40 | * @example 41 | * 42 | * ``` 43 | * const log = debug('Page'); 44 | * 45 | * log('new page created') 46 | * // logs "Page: new page created" 47 | * ``` 48 | * 49 | * @param prefix - this will be prefixed to each log. 50 | * @returns a function that can be called to log to that debug channel. 51 | * 52 | * @internal 53 | */ 54 | export declare const debug: (prefix: string) => (...args: unknown[]) => void; 55 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Debug.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * A debug function that can be used in any environment. 19 | * 20 | * @remarks 21 | * If used in Node, it falls back to the 22 | * {@link https://www.npmjs.com/package/debug | debug module}. In the browser it 23 | * uses `console.log`. 24 | * 25 | * In Node, use the `DEBUG` environment variable to control logging: 26 | * 27 | * ``` 28 | * DEBUG=* // logs all channels 29 | * DEBUG=foo // logs the `foo` channel 30 | * DEBUG=foo* // logs any channels starting with `foo` 31 | * ``` 32 | * 33 | * In the browser, set `window.__PUPPETEER_DEBUG` to a string: 34 | * 35 | * ``` 36 | * window.__PUPPETEER_DEBUG='*'; // logs all channels 37 | * window.__PUPPETEER_DEBUG='foo'; // logs the `foo` channel 38 | * window.__PUPPETEER_DEBUG='foo*'; // logs any channels starting with `foo` 39 | * ``` 40 | * 41 | * @example 42 | * 43 | * ``` 44 | * const log = debug('Page'); 45 | * 46 | * log('new page created') 47 | * // logs "Page: new page created" 48 | * ``` 49 | * 50 | * @param prefix - this will be prefixed to each log. 51 | * @returns a function that can be called to log to that debug channel. 52 | * 53 | * @internal 54 | */ 55 | export const debug = (prefix) => { 56 | return (...logArgs) => { 57 | const debugLevel = globalThis.__PUPPETEER_DEBUG; 58 | if (!debugLevel) { 59 | return; 60 | } 61 | const everythingShouldBeLogged = debugLevel === "*"; 62 | const prefixMatchesDebugLevel = everythingShouldBeLogged || /** 63 | * If the debug level is `foo*`, that means we match any prefix that 64 | * starts with `foo`. If the level is `foo`, we match only the prefix 65 | * `foo`. 66 | */ 67 | (debugLevel.endsWith("*") 68 | ? prefix.startsWith(debugLevel) 69 | : prefix === debugLevel); 70 | if (!prefixMatchesDebugLevel) { 71 | return; 72 | } 73 | // eslint-disable-next-line no-console 74 | console.log(`${prefix}:`, ...logArgs); 75 | }; 76 | }; 77 | //# sourceMappingURL=Debug.js.map 78 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/DeviceDescriptors.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * @public 18 | */ 19 | export interface Device { 20 | name: string; 21 | userAgent: string; 22 | viewport: { 23 | width: number; 24 | height: number; 25 | deviceScaleFactor: number; 26 | isMobile: boolean; 27 | hasTouch: boolean; 28 | isLandscape: boolean; 29 | }; 30 | } 31 | /** 32 | * @public 33 | */ 34 | export declare type DevicesMap = { 35 | [name: string]: Device; 36 | }; 37 | /** 38 | * A list of devices to be used with `page.emulate(options)`. Actual list of devices can be found in {@link https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts | src/common/DeviceDescriptors.ts}. 39 | * 40 | * @example 41 | * 42 | * ```ts 43 | * const puppeteer = require('puppeteer'); 44 | * const iPhone = puppeteer.devices['iPhone 6']; 45 | * 46 | * (async () => { 47 | * const browser = await puppeteer.launch(); 48 | * const page = await browser.newPage(); 49 | * await page.emulate(iPhone); 50 | * await page.goto('https://www.google.com'); 51 | * // other actions... 52 | * await browser.close(); 53 | * })(); 54 | * ``` 55 | * 56 | * @public 57 | */ 58 | declare const devices: DevicesMap; 59 | export { devices }; 60 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Dialog.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { CDPSession } from "./Connection.js"; 17 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 18 | /** 19 | * Dialog instances are dispatched by the {@link Page} via the `dialog` event. 20 | * 21 | * @remarks 22 | * 23 | * @example 24 | * 25 | * ```ts 26 | * const puppeteer = require('puppeteer'); 27 | * 28 | * (async () => { 29 | * const browser = await puppeteer.launch(); 30 | * const page = await browser.newPage(); 31 | * page.on('dialog', async dialog => { 32 | * console.log(dialog.message()); 33 | * await dialog.dismiss(); 34 | * await browser.close(); 35 | * }); 36 | * page.evaluate(() => alert('1')); 37 | * })(); 38 | * ``` 39 | * 40 | * @public 41 | */ 42 | export declare class Dialog { 43 | #private; 44 | /** 45 | * @internal 46 | */ 47 | constructor( 48 | client: CDPSession, 49 | type: Protocol.Page.DialogType, 50 | message: string, 51 | defaultValue?: string, 52 | ); 53 | /** 54 | * @returns The type of the dialog. 55 | */ 56 | type(): Protocol.Page.DialogType; 57 | /** 58 | * @returns The message displayed in the dialog. 59 | */ 60 | message(): string; 61 | /** 62 | * @returns The default value of the prompt, or an empty string if the dialog 63 | * is not a `prompt`. 64 | */ 65 | defaultValue(): string; 66 | /** 67 | * @param promptText - optional text that will be entered in the dialog 68 | * prompt. Has no effect if the dialog's type is not `prompt`. 69 | * 70 | * @returns A promise that resolves when the dialog has been accepted. 71 | */ 72 | accept(promptText?: string): Promise; 73 | /** 74 | * @returns A promise which will resolve once the dialog has been dismissed 75 | */ 76 | dismiss(): Promise; 77 | } 78 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Dialog.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2017 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || 18 | function (receiver, state, value, kind, f) { 19 | if (kind === "m") throw new TypeError("Private method is not writable"); 20 | if (kind === "a" && !f) { 21 | throw new TypeError("Private accessor was defined without a setter"); 22 | } 23 | if ( 24 | typeof state === "function" 25 | ? receiver !== state || !f 26 | : !state.has(receiver) 27 | ) { 28 | throw new TypeError( 29 | "Cannot write private member to an object whose class did not declare it", 30 | ); 31 | } 32 | return (kind === "a" 33 | ? f.call(receiver, value) 34 | : f 35 | ? f.value = value 36 | : state.set(receiver, value)), 37 | value; 38 | }; 39 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || 40 | function (receiver, state, kind, f) { 41 | if (kind === "a" && !f) { 42 | throw new TypeError("Private accessor was defined without a getter"); 43 | } 44 | if ( 45 | typeof state === "function" 46 | ? receiver !== state || !f 47 | : !state.has(receiver) 48 | ) { 49 | throw new TypeError( 50 | "Cannot read private member from an object whose class did not declare it", 51 | ); 52 | } 53 | return kind === "m" 54 | ? f 55 | : kind === "a" 56 | ? f.call(receiver) 57 | : f 58 | ? f.value 59 | : state.get(receiver); 60 | }; 61 | var _Dialog_client, 62 | _Dialog_type, 63 | _Dialog_message, 64 | _Dialog_defaultValue, 65 | _Dialog_handled; 66 | import { assert } from "../util/assert.js"; 67 | /** 68 | * Dialog instances are dispatched by the {@link Page} via the `dialog` event. 69 | * 70 | * @remarks 71 | * 72 | * @example 73 | * 74 | * ```ts 75 | * const puppeteer = require('puppeteer'); 76 | * 77 | * (async () => { 78 | * const browser = await puppeteer.launch(); 79 | * const page = await browser.newPage(); 80 | * page.on('dialog', async dialog => { 81 | * console.log(dialog.message()); 82 | * await dialog.dismiss(); 83 | * await browser.close(); 84 | * }); 85 | * page.evaluate(() => alert('1')); 86 | * })(); 87 | * ``` 88 | * 89 | * @public 90 | */ 91 | export class Dialog { 92 | /** 93 | * @internal 94 | */ 95 | constructor(client, type, message, defaultValue = "") { 96 | _Dialog_client.set(this, void 0); 97 | _Dialog_type.set(this, void 0); 98 | _Dialog_message.set(this, void 0); 99 | _Dialog_defaultValue.set(this, void 0); 100 | _Dialog_handled.set(this, false); 101 | __classPrivateFieldSet(this, _Dialog_client, client, "f"); 102 | __classPrivateFieldSet(this, _Dialog_type, type, "f"); 103 | __classPrivateFieldSet(this, _Dialog_message, message, "f"); 104 | __classPrivateFieldSet(this, _Dialog_defaultValue, defaultValue, "f"); 105 | } 106 | /** 107 | * @returns The type of the dialog. 108 | */ 109 | type() { 110 | return __classPrivateFieldGet(this, _Dialog_type, "f"); 111 | } 112 | /** 113 | * @returns The message displayed in the dialog. 114 | */ 115 | message() { 116 | return __classPrivateFieldGet(this, _Dialog_message, "f"); 117 | } 118 | /** 119 | * @returns The default value of the prompt, or an empty string if the dialog 120 | * is not a `prompt`. 121 | */ 122 | defaultValue() { 123 | return __classPrivateFieldGet(this, _Dialog_defaultValue, "f"); 124 | } 125 | /** 126 | * @param promptText - optional text that will be entered in the dialog 127 | * prompt. Has no effect if the dialog's type is not `prompt`. 128 | * 129 | * @returns A promise that resolves when the dialog has been accepted. 130 | */ 131 | async accept(promptText) { 132 | assert( 133 | !__classPrivateFieldGet(this, _Dialog_handled, "f"), 134 | "Cannot accept dialog which is already handled!", 135 | ); 136 | __classPrivateFieldSet(this, _Dialog_handled, true, "f"); 137 | await __classPrivateFieldGet(this, _Dialog_client, "f").send( 138 | "Page.handleJavaScriptDialog", 139 | { 140 | accept: true, 141 | promptText: promptText, 142 | }, 143 | ); 144 | } 145 | /** 146 | * @returns A promise which will resolve once the dialog has been dismissed 147 | */ 148 | async dismiss() { 149 | assert( 150 | !__classPrivateFieldGet(this, _Dialog_handled, "f"), 151 | "Cannot dismiss dialog which is already handled!", 152 | ); 153 | __classPrivateFieldSet(this, _Dialog_handled, true, "f"); 154 | await __classPrivateFieldGet(this, _Dialog_client, "f").send( 155 | "Page.handleJavaScriptDialog", 156 | { 157 | accept: false, 158 | }, 159 | ); 160 | } 161 | } 162 | _Dialog_client = new WeakMap(), 163 | _Dialog_type = new WeakMap(), 164 | _Dialog_message = new WeakMap(), 165 | _Dialog_defaultValue = new WeakMap(), 166 | _Dialog_handled = new WeakMap(); 167 | //# sourceMappingURL=Dialog.js.map 168 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/EmulationManager.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { CDPSession } from "./Connection.js"; 17 | import { Viewport } from "./PuppeteerViewport.js"; 18 | /** 19 | * @internal 20 | */ 21 | export declare class EmulationManager { 22 | #private; 23 | constructor(client: CDPSession); 24 | emulateViewport(viewport: Viewport): Promise; 25 | } 26 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/EmulationManager.js: -------------------------------------------------------------------------------- 1 | /// 2 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || 3 | function (receiver, state, value, kind, f) { 4 | if (kind === "m") throw new TypeError("Private method is not writable"); 5 | if (kind === "a" && !f) { 6 | throw new TypeError("Private accessor was defined without a setter"); 7 | } 8 | if ( 9 | typeof state === "function" 10 | ? receiver !== state || !f 11 | : !state.has(receiver) 12 | ) { 13 | throw new TypeError( 14 | "Cannot write private member to an object whose class did not declare it", 15 | ); 16 | } 17 | return (kind === "a" 18 | ? f.call(receiver, value) 19 | : f 20 | ? f.value = value 21 | : state.set(receiver, value)), 22 | value; 23 | }; 24 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || 25 | function (receiver, state, kind, f) { 26 | if (kind === "a" && !f) { 27 | throw new TypeError("Private accessor was defined without a getter"); 28 | } 29 | if ( 30 | typeof state === "function" 31 | ? receiver !== state || !f 32 | : !state.has(receiver) 33 | ) { 34 | throw new TypeError( 35 | "Cannot read private member from an object whose class did not declare it", 36 | ); 37 | } 38 | return kind === "m" 39 | ? f 40 | : kind === "a" 41 | ? f.call(receiver) 42 | : f 43 | ? f.value 44 | : state.get(receiver); 45 | }; 46 | var _EmulationManager_client, 47 | _EmulationManager_emulatingMobile, 48 | _EmulationManager_hasTouch; 49 | /** 50 | * @internal 51 | */ 52 | export class EmulationManager { 53 | constructor(client) { 54 | _EmulationManager_client.set(this, void 0); 55 | _EmulationManager_emulatingMobile.set(this, false); 56 | _EmulationManager_hasTouch.set(this, false); 57 | __classPrivateFieldSet(this, _EmulationManager_client, client, "f"); 58 | } 59 | async emulateViewport(viewport) { 60 | const mobile = viewport.isMobile || false; 61 | const width = viewport.width; 62 | const height = viewport.height; 63 | const deviceScaleFactor = viewport.deviceScaleFactor || 1; 64 | const screenOrientation = viewport.isLandscape 65 | ? { angle: 90, type: "landscapePrimary" } 66 | : { angle: 0, type: "portraitPrimary" }; 67 | const hasTouch = viewport.hasTouch || false; 68 | await Promise.all([ 69 | __classPrivateFieldGet(this, _EmulationManager_client, "f").send( 70 | "Emulation.setDeviceMetricsOverride", 71 | { 72 | mobile, 73 | width, 74 | height, 75 | deviceScaleFactor, 76 | screenOrientation, 77 | }, 78 | ), 79 | __classPrivateFieldGet(this, _EmulationManager_client, "f").send( 80 | "Emulation.setTouchEmulationEnabled", 81 | { 82 | enabled: hasTouch, 83 | }, 84 | ), 85 | ]); 86 | const reloadNeeded = 87 | __classPrivateFieldGet(this, _EmulationManager_emulatingMobile, "f") !== 88 | mobile || 89 | __classPrivateFieldGet(this, _EmulationManager_hasTouch, "f") !== 90 | hasTouch; 91 | __classPrivateFieldSet( 92 | this, 93 | _EmulationManager_emulatingMobile, 94 | mobile, 95 | "f", 96 | ); 97 | __classPrivateFieldSet(this, _EmulationManager_hasTouch, hasTouch, "f"); 98 | return reloadNeeded; 99 | } 100 | } 101 | _EmulationManager_client = new WeakMap(), 102 | _EmulationManager_emulatingMobile = new WeakMap(), 103 | _EmulationManager_hasTouch = new WeakMap(); 104 | //# sourceMappingURL=EmulationManager.js.map 105 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Errors.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * @public 18 | */ 19 | export declare class CustomError extends Error { 20 | constructor(message?: string); 21 | } 22 | /** 23 | * TimeoutError is emitted whenever certain operations are terminated due to 24 | * timeout. 25 | * 26 | * @remarks 27 | * Example operations are {@link Page.waitForSelector | page.waitForSelector} or 28 | * {@link PuppeteerNode.launch | puppeteer.launch}. 29 | * 30 | * @public 31 | */ 32 | export declare class TimeoutError extends CustomError { 33 | } 34 | /** 35 | * ProtocolError is emitted whenever there is an error from the protocol. 36 | * 37 | * @public 38 | */ 39 | export declare class ProtocolError extends CustomError { 40 | code?: number; 41 | originalMessage: string; 42 | } 43 | /** 44 | * @public 45 | */ 46 | export interface PuppeteerErrors { 47 | TimeoutError: typeof TimeoutError; 48 | ProtocolError: typeof ProtocolError; 49 | } 50 | /** 51 | * Puppeteer methods might throw errors if they are unable to fulfill a request. 52 | * For example, `page.waitForSelector(selector[, options])` might fail if the 53 | * selector doesn't match any nodes during the given timeframe. 54 | * 55 | * For certain types of errors Puppeteer uses specific error classes. These 56 | * classes are available via `puppeteer.errors`. 57 | * 58 | * @example 59 | * An example of handling a timeout error: 60 | * 61 | * ```ts 62 | * try { 63 | * await page.waitForSelector('.foo'); 64 | * } catch (e) { 65 | * if (e instanceof puppeteer.errors.TimeoutError) { 66 | * // Do something if this is a timeout. 67 | * } 68 | * } 69 | * ``` 70 | * 71 | * @public 72 | */ 73 | export declare const errors: PuppeteerErrors; 74 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Errors.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2018 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * @public 19 | */ 20 | export class CustomError extends Error { 21 | constructor(message) { 22 | super(message); 23 | this.name = this.constructor.name; 24 | Error.captureStackTrace(this, this.constructor); 25 | } 26 | } 27 | /** 28 | * TimeoutError is emitted whenever certain operations are terminated due to 29 | * timeout. 30 | * 31 | * @remarks 32 | * Example operations are {@link Page.waitForSelector | page.waitForSelector} or 33 | * {@link PuppeteerNode.launch | puppeteer.launch}. 34 | * 35 | * @public 36 | */ 37 | export class TimeoutError extends CustomError { 38 | } 39 | /** 40 | * ProtocolError is emitted whenever there is an error from the protocol. 41 | * 42 | * @public 43 | */ 44 | export class ProtocolError extends CustomError { 45 | constructor() { 46 | super(...arguments); 47 | this.originalMessage = ""; 48 | } 49 | } 50 | /** 51 | * Puppeteer methods might throw errors if they are unable to fulfill a request. 52 | * For example, `page.waitForSelector(selector[, options])` might fail if the 53 | * selector doesn't match any nodes during the given timeframe. 54 | * 55 | * For certain types of errors Puppeteer uses specific error classes. These 56 | * classes are available via `puppeteer.errors`. 57 | * 58 | * @example 59 | * An example of handling a timeout error: 60 | * 61 | * ```ts 62 | * try { 63 | * await page.waitForSelector('.foo'); 64 | * } catch (e) { 65 | * if (e instanceof puppeteer.errors.TimeoutError) { 66 | * // Do something if this is a timeout. 67 | * } 68 | * } 69 | * ``` 70 | * 71 | * @public 72 | */ 73 | export const errors = Object.freeze({ 74 | TimeoutError, 75 | ProtocolError, 76 | }); 77 | //# sourceMappingURL=Errors.js.map 78 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/EventEmitter.d.ts: -------------------------------------------------------------------------------- 1 | import { EventType, Handler } from "../../vendor/mitt/src/index.js"; 2 | /** 3 | * @public 4 | */ 5 | export { EventType, Handler }; 6 | /** 7 | * @public 8 | */ 9 | export interface CommonEventEmitter { 10 | on(event: EventType, handler: Handler): CommonEventEmitter; 11 | off(event: EventType, handler: Handler): CommonEventEmitter; 12 | addListener(event: EventType, handler: Handler): CommonEventEmitter; 13 | removeListener(event: EventType, handler: Handler): CommonEventEmitter; 14 | emit(event: EventType, eventData?: unknown): boolean; 15 | once(event: EventType, handler: Handler): CommonEventEmitter; 16 | listenerCount(event: string): number; 17 | removeAllListeners(event?: EventType): CommonEventEmitter; 18 | } 19 | /** 20 | * The EventEmitter class that many Puppeteer classes extend. 21 | * 22 | * @remarks 23 | * 24 | * This allows you to listen to events that Puppeteer classes fire and act 25 | * accordingly. Therefore you'll mostly use {@link EventEmitter.on | on} and 26 | * {@link EventEmitter.off | off} to bind 27 | * and unbind to event listeners. 28 | * 29 | * @public 30 | */ 31 | export declare class EventEmitter implements CommonEventEmitter { 32 | private emitter; 33 | private eventsMap; 34 | /** 35 | * @internal 36 | */ 37 | constructor(); 38 | /** 39 | * Bind an event listener to fire when an event occurs. 40 | * @param event - the event type you'd like to listen to. Can be a string or symbol. 41 | * @param handler - the function to be called when the event occurs. 42 | * @returns `this` to enable you to chain method calls. 43 | */ 44 | on(event: EventType, handler: Handler): EventEmitter; 45 | /** 46 | * Remove an event listener from firing. 47 | * @param event - the event type you'd like to stop listening to. 48 | * @param handler - the function that should be removed. 49 | * @returns `this` to enable you to chain method calls. 50 | */ 51 | off(event: EventType, handler: Handler): EventEmitter; 52 | /** 53 | * Remove an event listener. 54 | * @deprecated please use {@link EventEmitter.off} instead. 55 | */ 56 | removeListener(event: EventType, handler: Handler): EventEmitter; 57 | /** 58 | * Add an event listener. 59 | * @deprecated please use {@link EventEmitter.on} instead. 60 | */ 61 | addListener(event: EventType, handler: Handler): EventEmitter; 62 | /** 63 | * Emit an event and call any associated listeners. 64 | * 65 | * @param event - the event you'd like to emit 66 | * @param eventData - any data you'd like to emit with the event 67 | * @returns `true` if there are any listeners, `false` if there are not. 68 | */ 69 | emit(event: EventType, eventData?: unknown): boolean; 70 | /** 71 | * Like `on` but the listener will only be fired once and then it will be removed. 72 | * @param event - the event you'd like to listen to 73 | * @param handler - the handler function to run when the event occurs 74 | * @returns `this` to enable you to chain method calls. 75 | */ 76 | once(event: EventType, handler: Handler): EventEmitter; 77 | /** 78 | * Gets the number of listeners for a given event. 79 | * 80 | * @param event - the event to get the listener count for 81 | * @returns the number of listeners bound to the given event 82 | */ 83 | listenerCount(event: EventType): number; 84 | /** 85 | * Removes all listeners. If given an event argument, it will remove only 86 | * listeners for that event. 87 | * @param event - the event to remove listeners for. 88 | * @returns `this` to enable you to chain method calls. 89 | */ 90 | removeAllListeners(event?: EventType): EventEmitter; 91 | private eventListenersCount; 92 | } 93 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/EventEmitter.js: -------------------------------------------------------------------------------- 1 | /// 2 | import mitt from "../../vendor/mitt/src/index.js"; 3 | /** 4 | * The EventEmitter class that many Puppeteer classes extend. 5 | * 6 | * @remarks 7 | * 8 | * This allows you to listen to events that Puppeteer classes fire and act 9 | * accordingly. Therefore you'll mostly use {@link EventEmitter.on | on} and 10 | * {@link EventEmitter.off | off} to bind 11 | * and unbind to event listeners. 12 | * 13 | * @public 14 | */ 15 | export class EventEmitter { 16 | /** 17 | * @internal 18 | */ 19 | constructor() { 20 | this.eventsMap = new Map(); 21 | this.emitter = mitt(this.eventsMap); 22 | } 23 | /** 24 | * Bind an event listener to fire when an event occurs. 25 | * @param event - the event type you'd like to listen to. Can be a string or symbol. 26 | * @param handler - the function to be called when the event occurs. 27 | * @returns `this` to enable you to chain method calls. 28 | */ 29 | on(event, handler) { 30 | this.emitter.on(event, handler); 31 | return this; 32 | } 33 | /** 34 | * Remove an event listener from firing. 35 | * @param event - the event type you'd like to stop listening to. 36 | * @param handler - the function that should be removed. 37 | * @returns `this` to enable you to chain method calls. 38 | */ 39 | off(event, handler) { 40 | this.emitter.off(event, handler); 41 | return this; 42 | } 43 | /** 44 | * Remove an event listener. 45 | * @deprecated please use {@link EventEmitter.off} instead. 46 | */ 47 | removeListener(event, handler) { 48 | this.off(event, handler); 49 | return this; 50 | } 51 | /** 52 | * Add an event listener. 53 | * @deprecated please use {@link EventEmitter.on} instead. 54 | */ 55 | addListener(event, handler) { 56 | this.on(event, handler); 57 | return this; 58 | } 59 | /** 60 | * Emit an event and call any associated listeners. 61 | * 62 | * @param event - the event you'd like to emit 63 | * @param eventData - any data you'd like to emit with the event 64 | * @returns `true` if there are any listeners, `false` if there are not. 65 | */ 66 | emit(event, eventData) { 67 | this.emitter.emit(event, eventData); 68 | return this.eventListenersCount(event) > 0; 69 | } 70 | /** 71 | * Like `on` but the listener will only be fired once and then it will be removed. 72 | * @param event - the event you'd like to listen to 73 | * @param handler - the handler function to run when the event occurs 74 | * @returns `this` to enable you to chain method calls. 75 | */ 76 | once(event, handler) { 77 | const onceHandler = (eventData) => { 78 | handler(eventData); 79 | this.off(event, onceHandler); 80 | }; 81 | return this.on(event, onceHandler); 82 | } 83 | /** 84 | * Gets the number of listeners for a given event. 85 | * 86 | * @param event - the event to get the listener count for 87 | * @returns the number of listeners bound to the given event 88 | */ 89 | listenerCount(event) { 90 | return this.eventListenersCount(event); 91 | } 92 | /** 93 | * Removes all listeners. If given an event argument, it will remove only 94 | * listeners for that event. 95 | * @param event - the event to remove listeners for. 96 | * @returns `this` to enable you to chain method calls. 97 | */ 98 | removeAllListeners(event) { 99 | if (event) { 100 | this.eventsMap.delete(event); 101 | } else { 102 | this.eventsMap.clear(); 103 | } 104 | return this; 105 | } 106 | eventListenersCount(event) { 107 | var _a; 108 | return ((_a = this.eventsMap.get(event)) === null || _a === void 0 109 | ? void 0 110 | : _a.length) || 0; 111 | } 112 | } 113 | //# sourceMappingURL=EventEmitter.js.map 114 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/FileChooser.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 17 | import { ElementHandle } from "./ElementHandle.js"; 18 | /** 19 | * File choosers let you react to the page requesting for a file. 20 | * 21 | * @remarks 22 | * `FileChooser` instances are returned via the {@link Page.waitForFileChooser} method. 23 | * 24 | * In browsers, only one file chooser can be opened at a time. 25 | * All file choosers must be accepted or canceled. Not doing so will prevent 26 | * subsequent file choosers from appearing. 27 | * 28 | * @example 29 | * 30 | * ```ts 31 | * const [fileChooser] = await Promise.all([ 32 | * page.waitForFileChooser(), 33 | * page.click('#upload-file-button'), // some button that triggers file selection 34 | * ]); 35 | * await fileChooser.accept(['/tmp/myfile.pdf']); 36 | * ``` 37 | * 38 | * @public 39 | */ 40 | export declare class FileChooser { 41 | #private; 42 | /** 43 | * @internal 44 | */ 45 | constructor( 46 | element: ElementHandle, 47 | event: Protocol.Page.FileChooserOpenedEvent, 48 | ); 49 | /** 50 | * Whether file chooser allow for 51 | * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple} 52 | * file selection. 53 | */ 54 | isMultiple(): boolean; 55 | /** 56 | * Accept the file chooser request with given paths. 57 | * 58 | * @param filePaths - If some of the `filePaths` are relative paths, then 59 | * they are resolved relative to the 60 | * {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. 61 | */ 62 | accept(filePaths: string[]): Promise; 63 | /** 64 | * Closes the file chooser without selecting any files. 65 | */ 66 | cancel(): void; 67 | } 68 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/FileChooser.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || 18 | function (receiver, state, value, kind, f) { 19 | if (kind === "m") throw new TypeError("Private method is not writable"); 20 | if (kind === "a" && !f) { 21 | throw new TypeError("Private accessor was defined without a setter"); 22 | } 23 | if ( 24 | typeof state === "function" 25 | ? receiver !== state || !f 26 | : !state.has(receiver) 27 | ) { 28 | throw new TypeError( 29 | "Cannot write private member to an object whose class did not declare it", 30 | ); 31 | } 32 | return (kind === "a" 33 | ? f.call(receiver, value) 34 | : f 35 | ? f.value = value 36 | : state.set(receiver, value)), 37 | value; 38 | }; 39 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || 40 | function (receiver, state, kind, f) { 41 | if (kind === "a" && !f) { 42 | throw new TypeError("Private accessor was defined without a getter"); 43 | } 44 | if ( 45 | typeof state === "function" 46 | ? receiver !== state || !f 47 | : !state.has(receiver) 48 | ) { 49 | throw new TypeError( 50 | "Cannot read private member from an object whose class did not declare it", 51 | ); 52 | } 53 | return kind === "m" 54 | ? f 55 | : kind === "a" 56 | ? f.call(receiver) 57 | : f 58 | ? f.value 59 | : state.get(receiver); 60 | }; 61 | var _FileChooser_element, _FileChooser_multiple, _FileChooser_handled; 62 | import { assert } from "../util/assert.js"; 63 | /** 64 | * File choosers let you react to the page requesting for a file. 65 | * 66 | * @remarks 67 | * `FileChooser` instances are returned via the {@link Page.waitForFileChooser} method. 68 | * 69 | * In browsers, only one file chooser can be opened at a time. 70 | * All file choosers must be accepted or canceled. Not doing so will prevent 71 | * subsequent file choosers from appearing. 72 | * 73 | * @example 74 | * 75 | * ```ts 76 | * const [fileChooser] = await Promise.all([ 77 | * page.waitForFileChooser(), 78 | * page.click('#upload-file-button'), // some button that triggers file selection 79 | * ]); 80 | * await fileChooser.accept(['/tmp/myfile.pdf']); 81 | * ``` 82 | * 83 | * @public 84 | */ 85 | export class FileChooser { 86 | /** 87 | * @internal 88 | */ 89 | constructor(element, event) { 90 | _FileChooser_element.set(this, void 0); 91 | _FileChooser_multiple.set(this, void 0); 92 | _FileChooser_handled.set(this, false); 93 | __classPrivateFieldSet(this, _FileChooser_element, element, "f"); 94 | __classPrivateFieldSet( 95 | this, 96 | _FileChooser_multiple, 97 | event.mode !== "selectSingle", 98 | "f", 99 | ); 100 | } 101 | /** 102 | * Whether file chooser allow for 103 | * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple} 104 | * file selection. 105 | */ 106 | isMultiple() { 107 | return __classPrivateFieldGet(this, _FileChooser_multiple, "f"); 108 | } 109 | /** 110 | * Accept the file chooser request with given paths. 111 | * 112 | * @param filePaths - If some of the `filePaths` are relative paths, then 113 | * they are resolved relative to the 114 | * {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. 115 | */ 116 | async accept(filePaths) { 117 | assert( 118 | !__classPrivateFieldGet(this, _FileChooser_handled, "f"), 119 | "Cannot accept FileChooser which is already handled!", 120 | ); 121 | __classPrivateFieldSet(this, _FileChooser_handled, true, "f"); 122 | await __classPrivateFieldGet(this, _FileChooser_element, "f").uploadFile( 123 | ...filePaths, 124 | ); 125 | } 126 | /** 127 | * Closes the file chooser without selecting any files. 128 | */ 129 | cancel() { 130 | assert( 131 | !__classPrivateFieldGet(this, _FileChooser_handled, "f"), 132 | "Cannot cancel FileChooser which is already handled!", 133 | ); 134 | __classPrivateFieldSet(this, _FileChooser_handled, true, "f"); 135 | } 136 | } 137 | _FileChooser_element = new WeakMap(), 138 | _FileChooser_multiple = new WeakMap(), 139 | _FileChooser_handled = new WeakMap(); 140 | //# sourceMappingURL=FileChooser.js.map 141 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/FirefoxTargetManager.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2022 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { CDPSession, Connection } from "./Connection.js"; 17 | import { Target } from "./Target.js"; 18 | import { TargetFilterCallback } from "./Browser.js"; 19 | import { 20 | TargetFactory, 21 | TargetInterceptor, 22 | TargetManager, 23 | } from "./TargetManager.js"; 24 | import { EventEmitter } from "./EventEmitter.js"; 25 | /** 26 | * FirefoxTargetManager implements target management using 27 | * `Target.setDiscoverTargets` without using auto-attach. It, therefore, creates 28 | * targets that lazily establish their CDP sessions. 29 | * 30 | * Although the approach is potentially flaky, there is no other way for Firefox 31 | * because Firefox's CDP implementation does not support auto-attach. 32 | * 33 | * Firefox does not support targetInfoChanged and detachedFromTarget events: 34 | * 35 | * - https://bugzilla.mozilla.org/show_bug.cgi?id=1610855 36 | * - https://bugzilla.mozilla.org/show_bug.cgi?id=1636979 37 | * @internal 38 | */ 39 | export declare class FirefoxTargetManager extends EventEmitter 40 | implements TargetManager { 41 | #private; 42 | constructor( 43 | connection: Connection, 44 | targetFactory: TargetFactory, 45 | targetFilterCallback?: TargetFilterCallback, 46 | ); 47 | addTargetInterceptor( 48 | client: CDPSession | Connection, 49 | interceptor: TargetInterceptor, 50 | ): void; 51 | removeTargetInterceptor( 52 | client: CDPSession | Connection, 53 | interceptor: TargetInterceptor, 54 | ): void; 55 | setupAttachmentListeners(session: CDPSession | Connection): void; 56 | removeSessionListeners(session: CDPSession): void; 57 | getAvailableTargets(): Map; 58 | dispose(): void; 59 | initialize(): Promise; 60 | } 61 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/FrameManager.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { CDPSession } from "./Connection.js"; 17 | import { EventEmitter } from "./EventEmitter.js"; 18 | import { ExecutionContext } from "./ExecutionContext.js"; 19 | import { Frame } from "./Frame.js"; 20 | import { NetworkManager } from "./NetworkManager.js"; 21 | import { Page } from "./Page.js"; 22 | import { Target } from "./Target.js"; 23 | import { TimeoutSettings } from "./TimeoutSettings.js"; 24 | /** 25 | * We use symbols to prevent external parties listening to these events. 26 | * They are internal to Puppeteer. 27 | * 28 | * @internal 29 | */ 30 | export declare const FrameManagerEmittedEvents: { 31 | FrameAttached: symbol; 32 | FrameNavigated: symbol; 33 | FrameDetached: symbol; 34 | FrameSwapped: symbol; 35 | LifecycleEvent: symbol; 36 | FrameNavigatedWithinDocument: symbol; 37 | ExecutionContextCreated: symbol; 38 | ExecutionContextDestroyed: symbol; 39 | }; 40 | /** 41 | * A frame manager manages the frames for a given {@link Page | page}. 42 | * 43 | * @internal 44 | */ 45 | export declare class FrameManager extends EventEmitter { 46 | #private; 47 | get timeoutSettings(): TimeoutSettings; 48 | get networkManager(): NetworkManager; 49 | get client(): CDPSession; 50 | constructor( 51 | client: CDPSession, 52 | page: Page, 53 | ignoreHTTPSErrors: boolean, 54 | timeoutSettings: TimeoutSettings, 55 | ); 56 | private setupEventListeners; 57 | initialize(targetId: string, client?: CDPSession): Promise; 58 | executionContextById( 59 | contextId: number, 60 | session?: CDPSession, 61 | ): ExecutionContext; 62 | page(): Page; 63 | mainFrame(): Frame; 64 | frames(): Frame[]; 65 | frame(frameId: string): Frame | null; 66 | onAttachedToTarget(target: Target): void; 67 | onDetachedFromTarget(target: Target): void; 68 | } 69 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/HTTPResponse.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { ProtocolMapping } from "../../vendor/devtools-protocol/types/protocol-mapping.d.ts"; 17 | import { EventEmitter } from "./EventEmitter.js"; 18 | import { Frame } from "./Frame.js"; 19 | import { HTTPRequest } from "./HTTPRequest.js"; 20 | import { SecurityDetails } from "./SecurityDetails.js"; 21 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 22 | /** 23 | * @public 24 | */ 25 | export interface RemoteAddress { 26 | ip?: string; 27 | port?: number; 28 | } 29 | interface CDPSession extends EventEmitter { 30 | send( 31 | method: T, 32 | ...paramArgs: ProtocolMapping.Commands[T]["paramsType"] 33 | ): Promise; 34 | } 35 | /** 36 | * The HTTPResponse class represents responses which are received by the 37 | * {@link Page} class. 38 | * 39 | * @public 40 | */ 41 | export declare class HTTPResponse { 42 | #private; 43 | /** 44 | * @internal 45 | */ 46 | constructor( 47 | client: CDPSession, 48 | request: HTTPRequest, 49 | responsePayload: Protocol.Network.Response, 50 | extraInfo: Protocol.Network.ResponseReceivedExtraInfoEvent | null, 51 | ); 52 | /** 53 | * @internal 54 | */ 55 | _resolveBody(err: Error | null): void; 56 | /** 57 | * @returns The IP address and port number used to connect to the remote 58 | * server. 59 | */ 60 | remoteAddress(): RemoteAddress; 61 | /** 62 | * @returns The URL of the response. 63 | */ 64 | url(): string; 65 | /** 66 | * @returns True if the response was successful (status in the range 200-299). 67 | */ 68 | ok(): boolean; 69 | /** 70 | * @returns The status code of the response (e.g., 200 for a success). 71 | */ 72 | status(): number; 73 | /** 74 | * @returns The status text of the response (e.g. usually an "OK" for a 75 | * success). 76 | */ 77 | statusText(): string; 78 | /** 79 | * @returns An object with HTTP headers associated with the response. All 80 | * header names are lower-case. 81 | */ 82 | headers(): Record; 83 | /** 84 | * @returns {@link SecurityDetails} if the response was received over the 85 | * secure connection, or `null` otherwise. 86 | */ 87 | securityDetails(): SecurityDetails | null; 88 | /** 89 | * @returns Timing information related to the response. 90 | */ 91 | timing(): Protocol.Network.ResourceTiming | null; 92 | /** 93 | * @returns Promise which resolves to an ArrayBuffer with response body. 94 | */ 95 | arrayBuffer(): Promise; 96 | /** 97 | * @returns Promise which resolves to a text representation of response body. 98 | */ 99 | text(): Promise; 100 | /** 101 | * @returns Promise which resolves to a JSON representation of response body. 102 | * 103 | * @remarks 104 | * 105 | * This method will throw if the response body is not parsable via 106 | * `JSON.parse`. 107 | */ 108 | json(): Promise; 109 | /** 110 | * @returns A matching {@link HTTPRequest} object. 111 | */ 112 | request(): HTTPRequest; 113 | /** 114 | * @returns True if the response was served from either the browser's disk 115 | * cache or memory cache. 116 | */ 117 | fromCache(): boolean; 118 | /** 119 | * @returns True if the response was served by a service worker. 120 | */ 121 | fromServiceWorker(): boolean; 122 | /** 123 | * @returns A {@link Frame} that initiated this response, or `null` if 124 | * navigating to error pages. 125 | */ 126 | frame(): Frame | null; 127 | } 128 | export {}; 129 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/LifecycleWatcher.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { TimeoutError } from "./Errors.js"; 17 | import { FrameManager } from "./FrameManager.js"; 18 | import { Frame } from "./Frame.js"; 19 | import { HTTPResponse } from "./HTTPResponse.js"; 20 | /** 21 | * @public 22 | */ 23 | export declare type PuppeteerLifeCycleEvent = 24 | | "load" 25 | | "domcontentloaded" 26 | | "networkidle0" 27 | | "networkidle2"; 28 | /** 29 | * @public 30 | */ 31 | export declare type ProtocolLifeCycleEvent = 32 | | "load" 33 | | "DOMContentLoaded" 34 | | "networkIdle" 35 | | "networkAlmostIdle"; 36 | /** 37 | * @internal 38 | */ 39 | export declare class LifecycleWatcher { 40 | #private; 41 | constructor( 42 | frameManager: FrameManager, 43 | frame: Frame, 44 | waitUntil: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[], 45 | timeout: number, 46 | ); 47 | navigationResponse(): Promise; 48 | sameDocumentNavigationPromise(): Promise; 49 | newDocumentNavigationPromise(): Promise; 50 | lifecyclePromise(): Promise; 51 | timeoutOrTerminationPromise(): Promise; 52 | dispose(): void; 53 | } 54 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/NetworkConditions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2021 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { NetworkConditions } from "./NetworkManager.js"; 17 | /** 18 | * A list of network conditions to be used with 19 | * `page.emulateNetworkConditions(networkConditions)`. Actual list of predefined 20 | * conditions can be found in 21 | * {@link https://github.com/puppeteer/puppeteer/blob/main/src/common/NetworkConditions.ts | src/common/NetworkConditions.ts}. 22 | * 23 | * @example 24 | * 25 | * ```ts 26 | * const puppeteer = require('puppeteer'); 27 | * const slow3G = puppeteer.networkConditions['Slow 3G']; 28 | * 29 | * (async () => { 30 | * const browser = await puppeteer.launch(); 31 | * const page = await browser.newPage(); 32 | * await page.emulateNetworkConditions(slow3G); 33 | * await page.goto('https://www.google.com'); 34 | * // other actions... 35 | * await browser.close(); 36 | * })(); 37 | * ``` 38 | * 39 | * @public 40 | */ 41 | export declare const networkConditions: Readonly<{ 42 | "Slow 3G": NetworkConditions; 43 | "Fast 3G": NetworkConditions; 44 | }>; 45 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/NetworkConditions.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2021 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * A list of network conditions to be used with 19 | * `page.emulateNetworkConditions(networkConditions)`. Actual list of predefined 20 | * conditions can be found in 21 | * {@link https://github.com/puppeteer/puppeteer/blob/main/src/common/NetworkConditions.ts | src/common/NetworkConditions.ts}. 22 | * 23 | * @example 24 | * 25 | * ```ts 26 | * const puppeteer = require('puppeteer'); 27 | * const slow3G = puppeteer.networkConditions['Slow 3G']; 28 | * 29 | * (async () => { 30 | * const browser = await puppeteer.launch(); 31 | * const page = await browser.newPage(); 32 | * await page.emulateNetworkConditions(slow3G); 33 | * await page.goto('https://www.google.com'); 34 | * // other actions... 35 | * await browser.close(); 36 | * })(); 37 | * ``` 38 | * 39 | * @public 40 | */ 41 | export const networkConditions = Object.freeze({ 42 | "Slow 3G": { 43 | download: ((500 * 1000) / 8) * 0.8, 44 | upload: ((500 * 1000) / 8) * 0.8, 45 | latency: 400 * 5, 46 | }, 47 | "Fast 3G": { 48 | download: ((1.6 * 1000 * 1000) / 8) * 0.9, 49 | upload: ((750 * 1000) / 8) * 0.9, 50 | latency: 150 * 3.75, 51 | }, 52 | }); 53 | //# sourceMappingURL=NetworkConditions.js.map 54 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/NetworkEventManager.d.ts: -------------------------------------------------------------------------------- 1 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 2 | import { HTTPRequest } from "./HTTPRequest.js"; 3 | /** 4 | * @internal 5 | */ 6 | export declare type QueuedEventGroup = { 7 | responseReceivedEvent: Protocol.Network.ResponseReceivedEvent; 8 | loadingFinishedEvent?: Protocol.Network.LoadingFinishedEvent; 9 | loadingFailedEvent?: Protocol.Network.LoadingFailedEvent; 10 | }; 11 | /** 12 | * @internal 13 | */ 14 | export declare type FetchRequestId = string; 15 | /** 16 | * @internal 17 | */ 18 | export declare type RedirectInfo = { 19 | event: Protocol.Network.RequestWillBeSentEvent; 20 | fetchRequestId?: FetchRequestId; 21 | }; 22 | /** 23 | * @internal 24 | */ 25 | export declare type NetworkRequestId = string; 26 | /** 27 | * Helper class to track network events by request ID 28 | * 29 | * @internal 30 | */ 31 | export declare class NetworkEventManager { 32 | #private; 33 | forget(networkRequestId: NetworkRequestId): void; 34 | responseExtraInfo( 35 | networkRequestId: NetworkRequestId, 36 | ): Protocol.Network.ResponseReceivedExtraInfoEvent[]; 37 | private queuedRedirectInfo; 38 | queueRedirectInfo( 39 | fetchRequestId: FetchRequestId, 40 | redirectInfo: RedirectInfo, 41 | ): void; 42 | takeQueuedRedirectInfo( 43 | fetchRequestId: FetchRequestId, 44 | ): RedirectInfo | undefined; 45 | numRequestsInProgress(): number; 46 | storeRequestWillBeSent( 47 | networkRequestId: NetworkRequestId, 48 | event: Protocol.Network.RequestWillBeSentEvent, 49 | ): void; 50 | getRequestWillBeSent( 51 | networkRequestId: NetworkRequestId, 52 | ): Protocol.Network.RequestWillBeSentEvent | undefined; 53 | forgetRequestWillBeSent(networkRequestId: NetworkRequestId): void; 54 | getRequestPaused( 55 | networkRequestId: NetworkRequestId, 56 | ): Protocol.Fetch.RequestPausedEvent | undefined; 57 | forgetRequestPaused(networkRequestId: NetworkRequestId): void; 58 | storeRequestPaused( 59 | networkRequestId: NetworkRequestId, 60 | event: Protocol.Fetch.RequestPausedEvent, 61 | ): void; 62 | getRequest(networkRequestId: NetworkRequestId): HTTPRequest | undefined; 63 | storeRequest(networkRequestId: NetworkRequestId, request: HTTPRequest): void; 64 | forgetRequest(networkRequestId: NetworkRequestId): void; 65 | getQueuedEventGroup( 66 | networkRequestId: NetworkRequestId, 67 | ): QueuedEventGroup | undefined; 68 | queueEventGroup( 69 | networkRequestId: NetworkRequestId, 70 | event: QueuedEventGroup, 71 | ): void; 72 | forgetQueuedEventGroup(networkRequestId: NetworkRequestId): void; 73 | } 74 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/NetworkManager.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 17 | import { ProtocolMapping } from "../../vendor/devtools-protocol/types/protocol-mapping.d.ts"; 18 | import { EventEmitter } from "./EventEmitter.js"; 19 | import { Frame } from "./Frame.js"; 20 | /** 21 | * @public 22 | */ 23 | export interface Credentials { 24 | username: string; 25 | password: string; 26 | } 27 | /** 28 | * @public 29 | */ 30 | export interface NetworkConditions { 31 | download: number; 32 | upload: number; 33 | latency: number; 34 | } 35 | /** 36 | * @public 37 | */ 38 | export interface InternalNetworkConditions extends NetworkConditions { 39 | offline: boolean; 40 | } 41 | /** 42 | * We use symbols to prevent any external parties listening to these events. 43 | * They are internal to Puppeteer. 44 | * 45 | * @internal 46 | */ 47 | export declare const NetworkManagerEmittedEvents: { 48 | readonly Request: symbol; 49 | readonly RequestServedFromCache: symbol; 50 | readonly Response: symbol; 51 | readonly RequestFailed: symbol; 52 | readonly RequestFinished: symbol; 53 | }; 54 | interface CDPSession extends EventEmitter { 55 | send( 56 | method: T, 57 | ...paramArgs: ProtocolMapping.Commands[T]["paramsType"] 58 | ): Promise; 59 | } 60 | interface FrameManager { 61 | frame(frameId: string): Frame | null; 62 | } 63 | /** 64 | * @internal 65 | */ 66 | export declare class NetworkManager extends EventEmitter { 67 | #private; 68 | constructor( 69 | client: CDPSession, 70 | ignoreHTTPSErrors: boolean, 71 | frameManager: FrameManager, 72 | ); 73 | /** 74 | * Initialize calls should avoid async dependencies between CDP calls as those 75 | * might not resolve until after the target is resumed causing a deadlock. 76 | */ 77 | initialize(): Promise; 78 | authenticate(credentials?: Credentials): Promise; 79 | setExtraHTTPHeaders(extraHTTPHeaders: Record): Promise; 80 | extraHTTPHeaders(): Record; 81 | numRequestsInProgress(): number; 82 | setOfflineMode(value: boolean): Promise; 83 | emulateNetworkConditions( 84 | networkConditions: NetworkConditions | null, 85 | ): Promise; 86 | setUserAgent( 87 | userAgent: string, 88 | userAgentMetadata?: Protocol.Emulation.UserAgentMetadata, 89 | ): Promise; 90 | setCacheEnabled(enabled: boolean): Promise; 91 | setRequestInterception(value: boolean): Promise; 92 | } 93 | export {}; 94 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/PDFOptions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * @public 18 | */ 19 | export interface PDFMargin { 20 | top?: string | number; 21 | bottom?: string | number; 22 | left?: string | number; 23 | right?: string | number; 24 | } 25 | /** 26 | * @public 27 | */ 28 | export declare type LowerCasePaperFormat = 29 | | "letter" 30 | | "legal" 31 | | "tabloid" 32 | | "ledger" 33 | | "a0" 34 | | "a1" 35 | | "a2" 36 | | "a3" 37 | | "a4" 38 | | "a5" 39 | | "a6"; 40 | /** 41 | * All the valid paper format types when printing a PDF. 42 | * 43 | * @remarks 44 | * 45 | * The sizes of each format are as follows: 46 | * 47 | * - `Letter`: 8.5in x 11in 48 | * 49 | * - `Legal`: 8.5in x 14in 50 | * 51 | * - `Tabloid`: 11in x 17in 52 | * 53 | * - `Ledger`: 17in x 11in 54 | * 55 | * - `A0`: 33.1in x 46.8in 56 | * 57 | * - `A1`: 23.4in x 33.1in 58 | * 59 | * - `A2`: 16.54in x 23.4in 60 | * 61 | * - `A3`: 11.7in x 16.54in 62 | * 63 | * - `A4`: 8.27in x 11.7in 64 | * 65 | * - `A5`: 5.83in x 8.27in 66 | * 67 | * - `A6`: 4.13in x 5.83in 68 | * 69 | * @public 70 | */ 71 | export declare type PaperFormat = 72 | | Uppercase 73 | | Capitalize 74 | | LowerCasePaperFormat; 75 | /** 76 | * Valid options to configure PDF generation via {@link Page.pdf}. 77 | * @public 78 | */ 79 | export interface PDFOptions { 80 | /** 81 | * Scales the rendering of the web page. Amount must be between `0.1` and `2`. 82 | * @defaultValue 1 83 | */ 84 | scale?: number; 85 | /** 86 | * Whether to show the header and footer. 87 | * @defaultValue false 88 | */ 89 | displayHeaderFooter?: boolean; 90 | /** 91 | * HTML template for the print header. Should be valid HTML with the following 92 | * classes used to inject values into them: 93 | * 94 | * - `date` formatted print date 95 | * 96 | * - `title` document title 97 | * 98 | * - `url` document location 99 | * 100 | * - `pageNumber` current page number 101 | * 102 | * - `totalPages` total pages in the document 103 | */ 104 | headerTemplate?: string; 105 | /** 106 | * HTML template for the print footer. Has the same constraints and support 107 | * for special classes as {@link PDFOptions.headerTemplate}. 108 | */ 109 | footerTemplate?: string; 110 | /** 111 | * Set to `true` to print background graphics. 112 | * @defaultValue false 113 | */ 114 | printBackground?: boolean; 115 | /** 116 | * Whether to print in landscape orientation. 117 | * @defaultValue = false 118 | */ 119 | landscape?: boolean; 120 | /** 121 | * Paper ranges to print, e.g. `1-5, 8, 11-13`. 122 | * @defaultValue The empty string, which means all pages are printed. 123 | */ 124 | pageRanges?: string; 125 | /** 126 | * @remarks 127 | * If set, this takes priority over the `width` and `height` options. 128 | * @defaultValue `letter`. 129 | */ 130 | format?: PaperFormat; 131 | /** 132 | * Sets the width of paper. You can pass in a number or a string with a unit. 133 | */ 134 | width?: string | number; 135 | /** 136 | * Sets the height of paper. You can pass in a number or a string with a unit. 137 | */ 138 | height?: string | number; 139 | /** 140 | * Give any CSS `@page` size declared in the page priority over what is 141 | * declared in the `width` or `height` or `format` option. 142 | * @defaultValue `false`, which will scale the content to fit the paper size. 143 | */ 144 | preferCSSPageSize?: boolean; 145 | /** 146 | * Set the PDF margins. 147 | * @defaultValue no margins are set. 148 | */ 149 | margin?: PDFMargin; 150 | /** 151 | * The path to save the file to. 152 | * 153 | * @remarks 154 | * 155 | * If the path is relative, it's resolved relative to the current working directory. 156 | * 157 | * @defaultValue the empty string, which means the PDF will not be written to disk. 158 | */ 159 | path?: string; 160 | /** 161 | * Hides default white background and allows generating pdfs with transparency. 162 | * @defaultValue false 163 | */ 164 | omitBackground?: boolean; 165 | /** 166 | * Timeout in milliseconds 167 | * @defaultValue 30000 168 | */ 169 | timeout?: number; 170 | } 171 | /** 172 | * @internal 173 | */ 174 | export interface PaperFormatDimensions { 175 | width: number; 176 | height: number; 177 | } 178 | /** 179 | * @internal 180 | */ 181 | export declare const _paperFormats: Record< 182 | LowerCasePaperFormat, 183 | PaperFormatDimensions 184 | >; 185 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/PDFOptions.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * @internal 19 | */ 20 | export const _paperFormats = { 21 | letter: { width: 8.5, height: 11 }, 22 | legal: { width: 8.5, height: 14 }, 23 | tabloid: { width: 11, height: 17 }, 24 | ledger: { width: 17, height: 11 }, 25 | a0: { width: 33.1, height: 46.8 }, 26 | a1: { width: 23.4, height: 33.1 }, 27 | a2: { width: 16.54, height: 23.4 }, 28 | a3: { width: 11.7, height: 16.54 }, 29 | a4: { width: 8.27, height: 11.7 }, 30 | a5: { width: 5.83, height: 8.27 }, 31 | a6: { width: 4.13, height: 5.83 }, 32 | }; 33 | //# sourceMappingURL=PDFOptions.js.map 34 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Product.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Supported products. 18 | * @public 19 | */ 20 | export declare type Product = "chrome" | "firefox"; 21 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Product.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | export {}; 18 | //# sourceMappingURL=Product.js.map 19 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Puppeteer.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { Browser } from "./Browser.js"; 17 | import { BrowserConnectOptions } from "./BrowserConnector.js"; 18 | import { ConnectionTransport } from "./ConnectionTransport.js"; 19 | import { devices } from "./DeviceDescriptors.js"; 20 | import { errors } from "./Errors.js"; 21 | import { networkConditions } from "./NetworkConditions.js"; 22 | import { CustomQueryHandler } from "./QueryHandler.js"; 23 | /** 24 | * Settings that are common to the Puppeteer class, regardless of environment. 25 | * 26 | * @internal 27 | */ 28 | export interface CommonPuppeteerSettings { 29 | isPuppeteerCore: boolean; 30 | } 31 | /** 32 | * @public 33 | */ 34 | export interface ConnectOptions extends BrowserConnectOptions { 35 | browserWSEndpoint?: string; 36 | browserURL?: string; 37 | transport?: ConnectionTransport; 38 | } 39 | /** 40 | * The main Puppeteer class. 41 | * 42 | * IMPORTANT: if you are using Puppeteer in a Node environment, you will get an 43 | * instance of {@link PuppeteerNode} when you import or require `puppeteer`. 44 | * That class extends `Puppeteer`, so has all the methods documented below as 45 | * well as all that are defined on {@link PuppeteerNode}. 46 | * @public 47 | */ 48 | export declare class Puppeteer { 49 | protected _isPuppeteerCore: boolean; 50 | protected _changedProduct: boolean; 51 | /** 52 | * @internal 53 | */ 54 | constructor(settings: CommonPuppeteerSettings); 55 | /** 56 | * This method attaches Puppeteer to an existing browser instance. 57 | * 58 | * @remarks 59 | * 60 | * @param options - Set of configurable options to set on the browser. 61 | * @returns Promise which resolves to browser instance. 62 | */ 63 | connect(options: ConnectOptions): Promise; 64 | /** 65 | * @deprecated Import directly puppeteer. 66 | * @example 67 | * 68 | * ```ts 69 | * import {devices} from 'puppeteer'; 70 | * ``` 71 | */ 72 | get devices(): typeof devices; 73 | /** 74 | * @deprecated Import directly puppeteer. 75 | * @example 76 | * 77 | * ```ts 78 | * import {errors} from 'puppeteer'; 79 | * ``` 80 | */ 81 | get errors(): typeof errors; 82 | /** 83 | * @deprecated Import directly puppeteer. 84 | * @example 85 | * 86 | * ```ts 87 | * import {networkConditions} from 'puppeteer'; 88 | * ``` 89 | */ 90 | get networkConditions(): typeof networkConditions; 91 | /** 92 | * @deprecated Import directly puppeteer. 93 | * @example 94 | * 95 | * ```ts 96 | * import {registerCustomQueryHandler} from 'puppeteer'; 97 | * ``` 98 | */ 99 | registerCustomQueryHandler( 100 | name: string, 101 | queryHandler: CustomQueryHandler, 102 | ): void; 103 | /** 104 | * @deprecated Import directly puppeteer. 105 | * @example 106 | * 107 | * ```ts 108 | * import {unregisterCustomQueryHandler} from 'puppeteer'; 109 | * ``` 110 | */ 111 | unregisterCustomQueryHandler(name: string): void; 112 | /** 113 | * @deprecated Import directly puppeteer. 114 | * @example 115 | * 116 | * ```ts 117 | * import {customQueryHandlerNames} from 'puppeteer'; 118 | * ``` 119 | */ 120 | customQueryHandlerNames(): string[]; 121 | /** 122 | * @deprecated Import directly puppeteer. 123 | * @example 124 | * 125 | * ```ts 126 | * import {clearCustomQueryHandlers} from 'puppeteer'; 127 | * ``` 128 | */ 129 | clearCustomQueryHandlers(): void; 130 | } 131 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Puppeteer.js: -------------------------------------------------------------------------------- 1 | /// 2 | import { _connectToBrowser } from "./BrowserConnector.js"; 3 | import { devices } from "./DeviceDescriptors.js"; 4 | import { errors } from "./Errors.js"; 5 | import { networkConditions } from "./NetworkConditions.js"; 6 | import { 7 | clearCustomQueryHandlers, 8 | customQueryHandlerNames, 9 | registerCustomQueryHandler, 10 | unregisterCustomQueryHandler, 11 | } from "./QueryHandler.js"; 12 | /** 13 | * The main Puppeteer class. 14 | * 15 | * IMPORTANT: if you are using Puppeteer in a Node environment, you will get an 16 | * instance of {@link PuppeteerNode} when you import or require `puppeteer`. 17 | * That class extends `Puppeteer`, so has all the methods documented below as 18 | * well as all that are defined on {@link PuppeteerNode}. 19 | * @public 20 | */ 21 | export class Puppeteer { 22 | /** 23 | * @internal 24 | */ 25 | constructor(settings) { 26 | this._changedProduct = false; 27 | this._isPuppeteerCore = settings.isPuppeteerCore; 28 | this.connect = this.connect.bind(this); 29 | } 30 | /** 31 | * This method attaches Puppeteer to an existing browser instance. 32 | * 33 | * @remarks 34 | * 35 | * @param options - Set of configurable options to set on the browser. 36 | * @returns Promise which resolves to browser instance. 37 | */ 38 | connect(options) { 39 | return _connectToBrowser(options); 40 | } 41 | /** 42 | * @deprecated Import directly puppeteer. 43 | * @example 44 | * 45 | * ```ts 46 | * import {devices} from 'puppeteer'; 47 | * ``` 48 | */ 49 | get devices() { 50 | return devices; 51 | } 52 | /** 53 | * @deprecated Import directly puppeteer. 54 | * @example 55 | * 56 | * ```ts 57 | * import {errors} from 'puppeteer'; 58 | * ``` 59 | */ 60 | get errors() { 61 | return errors; 62 | } 63 | /** 64 | * @deprecated Import directly puppeteer. 65 | * @example 66 | * 67 | * ```ts 68 | * import {networkConditions} from 'puppeteer'; 69 | * ``` 70 | */ 71 | get networkConditions() { 72 | return networkConditions; 73 | } 74 | /** 75 | * @deprecated Import directly puppeteer. 76 | * @example 77 | * 78 | * ```ts 79 | * import {registerCustomQueryHandler} from 'puppeteer'; 80 | * ``` 81 | */ 82 | registerCustomQueryHandler(name, queryHandler) { 83 | return registerCustomQueryHandler(name, queryHandler); 84 | } 85 | /** 86 | * @deprecated Import directly puppeteer. 87 | * @example 88 | * 89 | * ```ts 90 | * import {unregisterCustomQueryHandler} from 'puppeteer'; 91 | * ``` 92 | */ 93 | unregisterCustomQueryHandler(name) { 94 | return unregisterCustomQueryHandler(name); 95 | } 96 | /** 97 | * @deprecated Import directly puppeteer. 98 | * @example 99 | * 100 | * ```ts 101 | * import {customQueryHandlerNames} from 'puppeteer'; 102 | * ``` 103 | */ 104 | customQueryHandlerNames() { 105 | return customQueryHandlerNames(); 106 | } 107 | /** 108 | * @deprecated Import directly puppeteer. 109 | * @example 110 | * 111 | * ```ts 112 | * import {clearCustomQueryHandlers} from 'puppeteer'; 113 | * ``` 114 | */ 115 | clearCustomQueryHandlers() { 116 | return clearCustomQueryHandlers(); 117 | } 118 | } 119 | //# sourceMappingURL=Puppeteer.js.map 120 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/PuppeteerViewport.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Sets the viewport of the page. 18 | * @public 19 | */ 20 | export interface Viewport { 21 | /** 22 | * The page width in pixels. 23 | */ 24 | width: number; 25 | /** 26 | * The page height in pixels. 27 | */ 28 | height: number; 29 | /** 30 | * Specify device scale factor. 31 | * See {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio | devicePixelRatio} for more info. 32 | * @defaultValue 1 33 | */ 34 | deviceScaleFactor?: number; 35 | /** 36 | * Whether the `meta viewport` tag is taken into account. 37 | * @defaultValue false 38 | */ 39 | isMobile?: boolean; 40 | /** 41 | * Specifies if the viewport is in landscape mode. 42 | * @defaultValue false 43 | */ 44 | isLandscape?: boolean; 45 | /** 46 | * Specify if the viewport supports touch events. 47 | * @defaultValue false 48 | */ 49 | hasTouch?: boolean; 50 | } 51 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/PuppeteerViewport.js: -------------------------------------------------------------------------------- 1 | /// 2 | export {}; 3 | //# sourceMappingURL=PuppeteerViewport.js.map 4 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/QueryHandler.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { IsolatedWorld, WaitForSelectorOptions } from "./IsolatedWorld.js"; 17 | import { ElementHandle } from "./ElementHandle.js"; 18 | import { JSHandle } from "./JSHandle.js"; 19 | /** 20 | * @public 21 | */ 22 | export interface CustomQueryHandler { 23 | /** 24 | * @returns A {@link Node} matching the given `selector` from {@link node}. 25 | */ 26 | queryOne?: (node: any, selector: string) => any | null; 27 | /** 28 | * @returns Some {@link Node}s matching the given `selector` from {@link node}. 29 | */ 30 | queryAll?: (node: any, selector: string) => any[]; 31 | } 32 | /** 33 | * @internal 34 | */ 35 | export interface InternalQueryHandler { 36 | /** 37 | * Queries for a single node given a selector and {@link ElementHandle}. 38 | * 39 | * Akin to {@link Window.prototype.querySelector}. 40 | */ 41 | queryOne?: ( 42 | element: ElementHandle, 43 | selector: string, 44 | ) => Promise | null>; 45 | /** 46 | * Queries for multiple nodes given a selector and {@link ElementHandle}. 47 | * 48 | * Akin to {@link Window.prototype.querySelectorAll}. 49 | */ 50 | queryAll?: ( 51 | element: ElementHandle, 52 | selector: string, 53 | ) => Promise>>; 54 | /** 55 | * Queries for multiple nodes given a selector and {@link ElementHandle}. 56 | * Unlike {@link queryAll}, this returns a handle to a node array. 57 | * 58 | * Akin to {@link Window.prototype.querySelectorAll}. 59 | */ 60 | queryAllArray?: ( 61 | element: ElementHandle, 62 | selector: string, 63 | ) => Promise>; 64 | /** 65 | * Waits until a single node appears for a given selector and 66 | * {@link ElementHandle}. 67 | * 68 | * Akin to {@link Window.prototype.querySelectorAll}. 69 | */ 70 | waitFor?: ( 71 | isolatedWorld: IsolatedWorld, 72 | selector: string, 73 | options: WaitForSelectorOptions, 74 | ) => Promise | null>; 75 | } 76 | /** 77 | * Registers a {@link CustomQueryHandler | custom query handler}. 78 | * 79 | * @remarks 80 | * After registration, the handler can be used everywhere where a selector is 81 | * expected by prepending the selection string with `/`. The name is only 82 | * allowed to consist of lower- and upper case latin letters. 83 | * 84 | * @example 85 | * 86 | * ``` 87 | * puppeteer.registerCustomQueryHandler('text', { … }); 88 | * const aHandle = await page.$('text/…'); 89 | * ``` 90 | * 91 | * @param name - The name that the custom query handler will be registered 92 | * under. 93 | * @param queryHandler - The {@link CustomQueryHandler | custom query handler} 94 | * to register. 95 | * 96 | * @public 97 | */ 98 | export declare function registerCustomQueryHandler( 99 | name: string, 100 | handler: CustomQueryHandler, 101 | ): void; 102 | /** 103 | * @param name - The name of the query handler to unregistered. 104 | * 105 | * @public 106 | */ 107 | export declare function unregisterCustomQueryHandler(name: string): void; 108 | /** 109 | * @returns a list with the names of all registered custom query handlers. 110 | * 111 | * @public 112 | */ 113 | export declare function customQueryHandlerNames(): string[]; 114 | /** 115 | * Clears all registered handlers. 116 | * 117 | * @public 118 | */ 119 | export declare function clearCustomQueryHandlers(): void; 120 | /** 121 | * @internal 122 | */ 123 | export declare function getQueryHandlerAndSelector(selector: string): { 124 | updatedSelector: string; 125 | queryHandler: InternalQueryHandler; 126 | }; 127 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/SecurityDetails.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 17 | /** 18 | * The SecurityDetails class represents the security details of a 19 | * response that was received over a secure connection. 20 | * 21 | * @public 22 | */ 23 | export declare class SecurityDetails { 24 | #private; 25 | /** 26 | * @internal 27 | */ 28 | constructor(securityPayload: Protocol.Network.SecurityDetails); 29 | /** 30 | * @returns The name of the issuer of the certificate. 31 | */ 32 | issuer(): string; 33 | /** 34 | * @returns {@link https://en.wikipedia.org/wiki/Unix_time | Unix timestamp} 35 | * marking the start of the certificate's validity. 36 | */ 37 | validFrom(): number; 38 | /** 39 | * @returns {@link https://en.wikipedia.org/wiki/Unix_time | Unix timestamp} 40 | * marking the end of the certificate's validity. 41 | */ 42 | validTo(): number; 43 | /** 44 | * @returns The security protocol being used, e.g. "TLS 1.2". 45 | */ 46 | protocol(): string; 47 | /** 48 | * @returns The name of the subject to which the certificate was issued. 49 | */ 50 | subjectName(): string; 51 | /** 52 | * @returns The list of {@link https://en.wikipedia.org/wiki/Subject_Alternative_Name | subject alternative names (SANs)} of the certificate. 53 | */ 54 | subjectAlternativeNames(): string[]; 55 | } 56 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/SecurityDetails.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || 18 | function (receiver, state, value, kind, f) { 19 | if (kind === "m") throw new TypeError("Private method is not writable"); 20 | if (kind === "a" && !f) { 21 | throw new TypeError("Private accessor was defined without a setter"); 22 | } 23 | if ( 24 | typeof state === "function" 25 | ? receiver !== state || !f 26 | : !state.has(receiver) 27 | ) { 28 | throw new TypeError( 29 | "Cannot write private member to an object whose class did not declare it", 30 | ); 31 | } 32 | return (kind === "a" 33 | ? f.call(receiver, value) 34 | : f 35 | ? f.value = value 36 | : state.set(receiver, value)), 37 | value; 38 | }; 39 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || 40 | function (receiver, state, kind, f) { 41 | if (kind === "a" && !f) { 42 | throw new TypeError("Private accessor was defined without a getter"); 43 | } 44 | if ( 45 | typeof state === "function" 46 | ? receiver !== state || !f 47 | : !state.has(receiver) 48 | ) { 49 | throw new TypeError( 50 | "Cannot read private member from an object whose class did not declare it", 51 | ); 52 | } 53 | return kind === "m" 54 | ? f 55 | : kind === "a" 56 | ? f.call(receiver) 57 | : f 58 | ? f.value 59 | : state.get(receiver); 60 | }; 61 | var _SecurityDetails_subjectName, 62 | _SecurityDetails_issuer, 63 | _SecurityDetails_validFrom, 64 | _SecurityDetails_validTo, 65 | _SecurityDetails_protocol, 66 | _SecurityDetails_sanList; 67 | /** 68 | * The SecurityDetails class represents the security details of a 69 | * response that was received over a secure connection. 70 | * 71 | * @public 72 | */ 73 | export class SecurityDetails { 74 | /** 75 | * @internal 76 | */ 77 | constructor(securityPayload) { 78 | _SecurityDetails_subjectName.set(this, void 0); 79 | _SecurityDetails_issuer.set(this, void 0); 80 | _SecurityDetails_validFrom.set(this, void 0); 81 | _SecurityDetails_validTo.set(this, void 0); 82 | _SecurityDetails_protocol.set(this, void 0); 83 | _SecurityDetails_sanList.set(this, void 0); 84 | __classPrivateFieldSet( 85 | this, 86 | _SecurityDetails_subjectName, 87 | securityPayload.subjectName, 88 | "f", 89 | ); 90 | __classPrivateFieldSet( 91 | this, 92 | _SecurityDetails_issuer, 93 | securityPayload.issuer, 94 | "f", 95 | ); 96 | __classPrivateFieldSet( 97 | this, 98 | _SecurityDetails_validFrom, 99 | securityPayload.validFrom, 100 | "f", 101 | ); 102 | __classPrivateFieldSet( 103 | this, 104 | _SecurityDetails_validTo, 105 | securityPayload.validTo, 106 | "f", 107 | ); 108 | __classPrivateFieldSet( 109 | this, 110 | _SecurityDetails_protocol, 111 | securityPayload.protocol, 112 | "f", 113 | ); 114 | __classPrivateFieldSet( 115 | this, 116 | _SecurityDetails_sanList, 117 | securityPayload.sanList, 118 | "f", 119 | ); 120 | } 121 | /** 122 | * @returns The name of the issuer of the certificate. 123 | */ 124 | issuer() { 125 | return __classPrivateFieldGet(this, _SecurityDetails_issuer, "f"); 126 | } 127 | /** 128 | * @returns {@link https://en.wikipedia.org/wiki/Unix_time | Unix timestamp} 129 | * marking the start of the certificate's validity. 130 | */ 131 | validFrom() { 132 | return __classPrivateFieldGet(this, _SecurityDetails_validFrom, "f"); 133 | } 134 | /** 135 | * @returns {@link https://en.wikipedia.org/wiki/Unix_time | Unix timestamp} 136 | * marking the end of the certificate's validity. 137 | */ 138 | validTo() { 139 | return __classPrivateFieldGet(this, _SecurityDetails_validTo, "f"); 140 | } 141 | /** 142 | * @returns The security protocol being used, e.g. "TLS 1.2". 143 | */ 144 | protocol() { 145 | return __classPrivateFieldGet(this, _SecurityDetails_protocol, "f"); 146 | } 147 | /** 148 | * @returns The name of the subject to which the certificate was issued. 149 | */ 150 | subjectName() { 151 | return __classPrivateFieldGet(this, _SecurityDetails_subjectName, "f"); 152 | } 153 | /** 154 | * @returns The list of {@link https://en.wikipedia.org/wiki/Subject_Alternative_Name | subject alternative names (SANs)} of the certificate. 155 | */ 156 | subjectAlternativeNames() { 157 | return __classPrivateFieldGet(this, _SecurityDetails_sanList, "f"); 158 | } 159 | } 160 | _SecurityDetails_subjectName = new WeakMap(), 161 | _SecurityDetails_issuer = new WeakMap(), 162 | _SecurityDetails_validFrom = new WeakMap(), 163 | _SecurityDetails_validTo = new WeakMap(), 164 | _SecurityDetails_protocol = new WeakMap(), 165 | _SecurityDetails_sanList = new WeakMap(); 166 | //# sourceMappingURL=SecurityDetails.js.map 167 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Target.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { Page } from "./Page.js"; 17 | import { WebWorker } from "./WebWorker.js"; 18 | import { CDPSession } from "./Connection.js"; 19 | import { Browser, BrowserContext, IsPageTargetCallback } from "./Browser.js"; 20 | import { Viewport } from "./PuppeteerViewport.js"; 21 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 22 | import { TaskQueue } from "./TaskQueue.js"; 23 | import { TargetManager } from "./TargetManager.js"; 24 | /** 25 | * @public 26 | */ 27 | export declare class Target { 28 | #private; 29 | /** 30 | * @internal 31 | */ 32 | _initializedPromise: Promise; 33 | /** 34 | * @internal 35 | */ 36 | _initializedCallback: (x: boolean) => void; 37 | /** 38 | * @internal 39 | */ 40 | _isClosedPromise: Promise; 41 | /** 42 | * @internal 43 | */ 44 | _closedCallback: () => void; 45 | /** 46 | * @internal 47 | */ 48 | _isInitialized: boolean; 49 | /** 50 | * @internal 51 | */ 52 | _targetId: string; 53 | /** 54 | * @internal 55 | */ 56 | _isPageTargetCallback: IsPageTargetCallback; 57 | /** 58 | * @internal 59 | */ 60 | constructor( 61 | targetInfo: Protocol.Target.TargetInfo, 62 | session: CDPSession | undefined, 63 | browserContext: BrowserContext, 64 | targetManager: TargetManager, 65 | sessionFactory: (isAutoAttachEmulated: boolean) => Promise, 66 | ignoreHTTPSErrors: boolean, 67 | defaultViewport: Viewport | null, 68 | screenshotTaskQueue: TaskQueue, 69 | isPageTargetCallback: IsPageTargetCallback, 70 | ); 71 | /** 72 | * @internal 73 | */ 74 | _session(): CDPSession | undefined; 75 | /** 76 | * Creates a Chrome Devtools Protocol session attached to the target. 77 | */ 78 | createCDPSession(): Promise; 79 | /** 80 | * @internal 81 | */ 82 | _targetManager(): TargetManager; 83 | /** 84 | * @internal 85 | */ 86 | _getTargetInfo(): Protocol.Target.TargetInfo; 87 | /** 88 | * If the target is not of type `"page"` or `"background_page"`, returns `null`. 89 | */ 90 | page(): Promise; 91 | /** 92 | * If the target is not of type `"service_worker"` or `"shared_worker"`, returns `null`. 93 | */ 94 | worker(): Promise; 95 | url(): string; 96 | /** 97 | * Identifies what kind of target this is. 98 | * 99 | * @remarks 100 | * 101 | * See {@link https://developer.chrome.com/extensions/background_pages | docs} for more info about background pages. 102 | */ 103 | type(): 104 | | "page" 105 | | "background_page" 106 | | "service_worker" 107 | | "shared_worker" 108 | | "other" 109 | | "browser" 110 | | "webview"; 111 | /** 112 | * Get the browser the target belongs to. 113 | */ 114 | browser(): Browser; 115 | /** 116 | * Get the browser context the target belongs to. 117 | */ 118 | browserContext(): BrowserContext; 119 | /** 120 | * Get the target that opened this target. Top-level targets return `null`. 121 | */ 122 | opener(): Target | undefined; 123 | /** 124 | * @internal 125 | */ 126 | _targetInfoChanged(targetInfo: Protocol.Target.TargetInfo): void; 127 | } 128 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/TargetManager.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2022 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import Protocol from "../../vendor/devtools-protocol/types/protocol.d.ts"; 17 | import { CDPSession } from "./Connection.js"; 18 | import { EventEmitter } from "./EventEmitter.js"; 19 | import { Target } from "./Target.js"; 20 | /** 21 | * @internal 22 | */ 23 | export declare type TargetFactory = ( 24 | targetInfo: Protocol.Target.TargetInfo, 25 | session?: CDPSession, 26 | ) => Target; 27 | /** 28 | * @internal 29 | */ 30 | export declare type TargetInterceptor = ( 31 | createdTarget: Target, 32 | parentTarget: Target | null, 33 | ) => Promise; 34 | /** 35 | * TargetManager encapsulates all interactions with CDP targets and is 36 | * responsible for coordinating the configuration of targets with the rest of 37 | * Puppeteer. Code outside of this class should not subscribe `Target.*` events 38 | * and only use the TargetManager events. 39 | * 40 | * There are two implementations: one for Chrome that uses CDP's auto-attach 41 | * mechanism and one for Firefox because Firefox does not support auto-attach. 42 | * 43 | * @internal 44 | */ 45 | export interface TargetManager extends EventEmitter { 46 | getAvailableTargets(): Map; 47 | initialize(): Promise; 48 | dispose(): void; 49 | addTargetInterceptor( 50 | session: CDPSession, 51 | interceptor: TargetInterceptor, 52 | ): void; 53 | removeTargetInterceptor( 54 | session: CDPSession, 55 | interceptor: TargetInterceptor, 56 | ): void; 57 | } 58 | /** 59 | * @internal 60 | */ 61 | export declare const enum TargetManagerEmittedEvents { 62 | TargetDiscovered = "targetDiscovered", 63 | TargetAvailable = "targetAvailable", 64 | TargetGone = "targetGone", 65 | TargetChanged = "targetChanged", 66 | } 67 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/TargetManager.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2022 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | export {}; 18 | //# sourceMappingURL=TargetManager.js.map 19 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/TaskQueue.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * @internal 18 | */ 19 | export declare class TaskQueue { 20 | #private; 21 | constructor(); 22 | postTask(task: () => Promise): Promise; 23 | } 24 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/TaskQueue.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || 18 | function (receiver, state, value, kind, f) { 19 | if (kind === "m") throw new TypeError("Private method is not writable"); 20 | if (kind === "a" && !f) { 21 | throw new TypeError("Private accessor was defined without a setter"); 22 | } 23 | if ( 24 | typeof state === "function" 25 | ? receiver !== state || !f 26 | : !state.has(receiver) 27 | ) { 28 | throw new TypeError( 29 | "Cannot write private member to an object whose class did not declare it", 30 | ); 31 | } 32 | return (kind === "a" 33 | ? f.call(receiver, value) 34 | : f 35 | ? f.value = value 36 | : state.set(receiver, value)), 37 | value; 38 | }; 39 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || 40 | function (receiver, state, kind, f) { 41 | if (kind === "a" && !f) { 42 | throw new TypeError("Private accessor was defined without a getter"); 43 | } 44 | if ( 45 | typeof state === "function" 46 | ? receiver !== state || !f 47 | : !state.has(receiver) 48 | ) { 49 | throw new TypeError( 50 | "Cannot read private member from an object whose class did not declare it", 51 | ); 52 | } 53 | return kind === "m" 54 | ? f 55 | : kind === "a" 56 | ? f.call(receiver) 57 | : f 58 | ? f.value 59 | : state.get(receiver); 60 | }; 61 | var _TaskQueue_chain; 62 | /** 63 | * @internal 64 | */ 65 | export class TaskQueue { 66 | constructor() { 67 | _TaskQueue_chain.set(this, void 0); 68 | __classPrivateFieldSet(this, _TaskQueue_chain, Promise.resolve(), "f"); 69 | } 70 | postTask(task) { 71 | const result = __classPrivateFieldGet(this, _TaskQueue_chain, "f").then( 72 | task, 73 | ); 74 | __classPrivateFieldSet( 75 | this, 76 | _TaskQueue_chain, 77 | result.then(() => { 78 | return undefined; 79 | }, () => { 80 | return undefined; 81 | }), 82 | "f", 83 | ); 84 | return result; 85 | } 86 | } 87 | _TaskQueue_chain = new WeakMap(); 88 | //# sourceMappingURL=TaskQueue.js.map 89 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/TimeoutSettings.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * @internal 18 | */ 19 | export declare class TimeoutSettings { 20 | #private; 21 | constructor(); 22 | setDefaultTimeout(timeout: number): void; 23 | setDefaultNavigationTimeout(timeout: number): void; 24 | navigationTimeout(): number; 25 | timeout(): number; 26 | } 27 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/TimeoutSettings.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2019 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || 18 | function (receiver, state, value, kind, f) { 19 | if (kind === "m") throw new TypeError("Private method is not writable"); 20 | if (kind === "a" && !f) { 21 | throw new TypeError("Private accessor was defined without a setter"); 22 | } 23 | if ( 24 | typeof state === "function" 25 | ? receiver !== state || !f 26 | : !state.has(receiver) 27 | ) { 28 | throw new TypeError( 29 | "Cannot write private member to an object whose class did not declare it", 30 | ); 31 | } 32 | return (kind === "a" 33 | ? f.call(receiver, value) 34 | : f 35 | ? f.value = value 36 | : state.set(receiver, value)), 37 | value; 38 | }; 39 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || 40 | function (receiver, state, kind, f) { 41 | if (kind === "a" && !f) { 42 | throw new TypeError("Private accessor was defined without a getter"); 43 | } 44 | if ( 45 | typeof state === "function" 46 | ? receiver !== state || !f 47 | : !state.has(receiver) 48 | ) { 49 | throw new TypeError( 50 | "Cannot read private member from an object whose class did not declare it", 51 | ); 52 | } 53 | return kind === "m" 54 | ? f 55 | : kind === "a" 56 | ? f.call(receiver) 57 | : f 58 | ? f.value 59 | : state.get(receiver); 60 | }; 61 | var _TimeoutSettings_defaultTimeout, _TimeoutSettings_defaultNavigationTimeout; 62 | const DEFAULT_TIMEOUT = 30000; 63 | /** 64 | * @internal 65 | */ 66 | export class TimeoutSettings { 67 | constructor() { 68 | _TimeoutSettings_defaultTimeout.set(this, void 0); 69 | _TimeoutSettings_defaultNavigationTimeout.set(this, void 0); 70 | __classPrivateFieldSet(this, _TimeoutSettings_defaultTimeout, null, "f"); 71 | __classPrivateFieldSet( 72 | this, 73 | _TimeoutSettings_defaultNavigationTimeout, 74 | null, 75 | "f", 76 | ); 77 | } 78 | setDefaultTimeout(timeout) { 79 | __classPrivateFieldSet(this, _TimeoutSettings_defaultTimeout, timeout, "f"); 80 | } 81 | setDefaultNavigationTimeout(timeout) { 82 | __classPrivateFieldSet( 83 | this, 84 | _TimeoutSettings_defaultNavigationTimeout, 85 | timeout, 86 | "f", 87 | ); 88 | } 89 | navigationTimeout() { 90 | if ( 91 | __classPrivateFieldGet( 92 | this, 93 | _TimeoutSettings_defaultNavigationTimeout, 94 | "f", 95 | ) !== null 96 | ) { 97 | return __classPrivateFieldGet( 98 | this, 99 | _TimeoutSettings_defaultNavigationTimeout, 100 | "f", 101 | ); 102 | } 103 | if ( 104 | __classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f") !== 105 | null 106 | ) { 107 | return __classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f"); 108 | } 109 | return DEFAULT_TIMEOUT; 110 | } 111 | timeout() { 112 | if ( 113 | __classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f") !== 114 | null 115 | ) { 116 | return __classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f"); 117 | } 118 | return DEFAULT_TIMEOUT; 119 | } 120 | } 121 | _TimeoutSettings_defaultTimeout = new WeakMap(), 122 | _TimeoutSettings_defaultNavigationTimeout = new WeakMap(); 123 | //# sourceMappingURL=TimeoutSettings.js.map 124 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/Tracing.d.ts: -------------------------------------------------------------------------------- 1 | import { CDPSession } from "./Connection.js"; 2 | /** 3 | * @public 4 | */ 5 | export interface TracingOptions { 6 | path?: string; 7 | screenshots?: boolean; 8 | categories?: string[]; 9 | } 10 | /** 11 | * The Tracing class exposes the tracing audit interface. 12 | * @remarks 13 | * You can use `tracing.start` and `tracing.stop` to create a trace file 14 | * which can be opened in Chrome DevTools or {@link https://chromedevtools.github.io/timeline-viewer/ | timeline viewer}. 15 | * 16 | * @example 17 | * 18 | * ```ts 19 | * await page.tracing.start({path: 'trace.json'}); 20 | * await page.goto('https://www.google.com'); 21 | * await page.tracing.stop(); 22 | * ``` 23 | * 24 | * @public 25 | */ 26 | export declare class Tracing { 27 | #private; 28 | /** 29 | * @internal 30 | */ 31 | constructor(client: CDPSession); 32 | /** 33 | * Starts a trace for the current page. 34 | * @remarks 35 | * Only one trace can be active at a time per browser. 36 | * 37 | * @param options - Optional `TracingOptions`. 38 | */ 39 | start(options?: TracingOptions): Promise; 40 | /** 41 | * Stops a trace started with the `start` method. 42 | * @returns Promise which resolves to buffer with trace data. 43 | */ 44 | stop(): Promise; 45 | } 46 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/USKeyboardLayout.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the 'License'); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an 'AS IS' BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * @internal 18 | */ 19 | export interface KeyDefinition { 20 | keyCode?: number; 21 | shiftKeyCode?: number; 22 | key?: string; 23 | shiftKey?: string; 24 | code?: string; 25 | text?: string; 26 | shiftText?: string; 27 | location?: number; 28 | } 29 | /** 30 | * All the valid keys that can be passed to functions that take user input, such 31 | * as {@link Keyboard.press | keyboard.press } 32 | * 33 | * @public 34 | */ 35 | export declare type KeyInput = 36 | | "0" 37 | | "1" 38 | | "2" 39 | | "3" 40 | | "4" 41 | | "5" 42 | | "6" 43 | | "7" 44 | | "8" 45 | | "9" 46 | | "Power" 47 | | "Eject" 48 | | "Abort" 49 | | "Help" 50 | | "Backspace" 51 | | "Tab" 52 | | "Numpad5" 53 | | "NumpadEnter" 54 | | "Enter" 55 | | "\r" 56 | | "\n" 57 | | "ShiftLeft" 58 | | "ShiftRight" 59 | | "ControlLeft" 60 | | "ControlRight" 61 | | "AltLeft" 62 | | "AltRight" 63 | | "Pause" 64 | | "CapsLock" 65 | | "Escape" 66 | | "Convert" 67 | | "NonConvert" 68 | | "Space" 69 | | "Numpad9" 70 | | "PageUp" 71 | | "Numpad3" 72 | | "PageDown" 73 | | "End" 74 | | "Numpad1" 75 | | "Home" 76 | | "Numpad7" 77 | | "ArrowLeft" 78 | | "Numpad4" 79 | | "Numpad8" 80 | | "ArrowUp" 81 | | "ArrowRight" 82 | | "Numpad6" 83 | | "Numpad2" 84 | | "ArrowDown" 85 | | "Select" 86 | | "Open" 87 | | "PrintScreen" 88 | | "Insert" 89 | | "Numpad0" 90 | | "Delete" 91 | | "NumpadDecimal" 92 | | "Digit0" 93 | | "Digit1" 94 | | "Digit2" 95 | | "Digit3" 96 | | "Digit4" 97 | | "Digit5" 98 | | "Digit6" 99 | | "Digit7" 100 | | "Digit8" 101 | | "Digit9" 102 | | "KeyA" 103 | | "KeyB" 104 | | "KeyC" 105 | | "KeyD" 106 | | "KeyE" 107 | | "KeyF" 108 | | "KeyG" 109 | | "KeyH" 110 | | "KeyI" 111 | | "KeyJ" 112 | | "KeyK" 113 | | "KeyL" 114 | | "KeyM" 115 | | "KeyN" 116 | | "KeyO" 117 | | "KeyP" 118 | | "KeyQ" 119 | | "KeyR" 120 | | "KeyS" 121 | | "KeyT" 122 | | "KeyU" 123 | | "KeyV" 124 | | "KeyW" 125 | | "KeyX" 126 | | "KeyY" 127 | | "KeyZ" 128 | | "MetaLeft" 129 | | "MetaRight" 130 | | "ContextMenu" 131 | | "NumpadMultiply" 132 | | "NumpadAdd" 133 | | "NumpadSubtract" 134 | | "NumpadDivide" 135 | | "F1" 136 | | "F2" 137 | | "F3" 138 | | "F4" 139 | | "F5" 140 | | "F6" 141 | | "F7" 142 | | "F8" 143 | | "F9" 144 | | "F10" 145 | | "F11" 146 | | "F12" 147 | | "F13" 148 | | "F14" 149 | | "F15" 150 | | "F16" 151 | | "F17" 152 | | "F18" 153 | | "F19" 154 | | "F20" 155 | | "F21" 156 | | "F22" 157 | | "F23" 158 | | "F24" 159 | | "NumLock" 160 | | "ScrollLock" 161 | | "AudioVolumeMute" 162 | | "AudioVolumeDown" 163 | | "AudioVolumeUp" 164 | | "MediaTrackNext" 165 | | "MediaTrackPrevious" 166 | | "MediaStop" 167 | | "MediaPlayPause" 168 | | "Semicolon" 169 | | "Equal" 170 | | "NumpadEqual" 171 | | "Comma" 172 | | "Minus" 173 | | "Period" 174 | | "Slash" 175 | | "Backquote" 176 | | "BracketLeft" 177 | | "Backslash" 178 | | "BracketRight" 179 | | "Quote" 180 | | "AltGraph" 181 | | "Props" 182 | | "Cancel" 183 | | "Clear" 184 | | "Shift" 185 | | "Control" 186 | | "Alt" 187 | | "Accept" 188 | | "ModeChange" 189 | | " " 190 | | "Print" 191 | | "Execute" 192 | | "\u0000" 193 | | "a" 194 | | "b" 195 | | "c" 196 | | "d" 197 | | "e" 198 | | "f" 199 | | "g" 200 | | "h" 201 | | "i" 202 | | "j" 203 | | "k" 204 | | "l" 205 | | "m" 206 | | "n" 207 | | "o" 208 | | "p" 209 | | "q" 210 | | "r" 211 | | "s" 212 | | "t" 213 | | "u" 214 | | "v" 215 | | "w" 216 | | "x" 217 | | "y" 218 | | "z" 219 | | "Meta" 220 | | "*" 221 | | "+" 222 | | "-" 223 | | "/" 224 | | ";" 225 | | "=" 226 | | "," 227 | | "." 228 | | "`" 229 | | "[" 230 | | "\\" 231 | | "]" 232 | | "'" 233 | | "Attn" 234 | | "CrSel" 235 | | "ExSel" 236 | | "EraseEof" 237 | | "Play" 238 | | "ZoomOut" 239 | | ")" 240 | | "!" 241 | | "@" 242 | | "#" 243 | | "$" 244 | | "%" 245 | | "^" 246 | | "&" 247 | | "(" 248 | | "A" 249 | | "B" 250 | | "C" 251 | | "D" 252 | | "E" 253 | | "F" 254 | | "G" 255 | | "H" 256 | | "I" 257 | | "J" 258 | | "K" 259 | | "L" 260 | | "M" 261 | | "N" 262 | | "O" 263 | | "P" 264 | | "Q" 265 | | "R" 266 | | "S" 267 | | "T" 268 | | "U" 269 | | "V" 270 | | "W" 271 | | "X" 272 | | "Y" 273 | | "Z" 274 | | ":" 275 | | "<" 276 | | "_" 277 | | ">" 278 | | "?" 279 | | "~" 280 | | "{" 281 | | "|" 282 | | "}" 283 | | '"' 284 | | "SoftLeft" 285 | | "SoftRight" 286 | | "Camera" 287 | | "Call" 288 | | "EndCall" 289 | | "VolumeDown" 290 | | "VolumeUp"; 291 | /** 292 | * @internal 293 | */ 294 | export declare const _keyDefinitions: Readonly>; 295 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/WebWorker.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 17 | import { CDPSession } from "./Connection.js"; 18 | import { ConsoleMessageType } from "./ConsoleMessage.js"; 19 | import { EvaluateFunc, HandleFor } from "./types.js"; 20 | import { EventEmitter } from "./EventEmitter.js"; 21 | import { ExecutionContext } from "./ExecutionContext.js"; 22 | import { JSHandle } from "./JSHandle.js"; 23 | /** 24 | * @internal 25 | */ 26 | export declare type ConsoleAPICalledCallback = ( 27 | eventType: ConsoleMessageType, 28 | handles: JSHandle[], 29 | trace: Protocol.Runtime.StackTrace, 30 | ) => void; 31 | /** 32 | * @internal 33 | */ 34 | export declare type ExceptionThrownCallback = ( 35 | details: Protocol.Runtime.ExceptionDetails, 36 | ) => void; 37 | /** 38 | * This class represents a 39 | * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker}. 40 | * 41 | * @remarks 42 | * The events `workercreated` and `workerdestroyed` are emitted on the page 43 | * object to signal the worker lifecycle. 44 | * 45 | * @example 46 | * 47 | * ```ts 48 | * page.on('workercreated', worker => 49 | * console.log('Worker created: ' + worker.url()) 50 | * ); 51 | * page.on('workerdestroyed', worker => 52 | * console.log('Worker destroyed: ' + worker.url()) 53 | * ); 54 | * 55 | * console.log('Current workers:'); 56 | * for (const worker of page.workers()) { 57 | * console.log(' ' + worker.url()); 58 | * } 59 | * ``` 60 | * 61 | * @public 62 | */ 63 | export declare class WebWorker extends EventEmitter { 64 | #private; 65 | /** 66 | * @internal 67 | */ 68 | constructor( 69 | client: CDPSession, 70 | url: string, 71 | consoleAPICalled: ConsoleAPICalledCallback, 72 | exceptionThrown: ExceptionThrownCallback, 73 | ); 74 | /** 75 | * @returns The URL of this web worker. 76 | */ 77 | url(): string; 78 | /** 79 | * Returns the ExecutionContext the WebWorker runs in 80 | * @returns The ExecutionContext the web worker runs in. 81 | */ 82 | executionContext(): Promise; 83 | /** 84 | * If the function passed to the `worker.evaluate` returns a Promise, then 85 | * `worker.evaluate` would wait for the promise to resolve and return its 86 | * value. If the function passed to the `worker.evaluate` returns a 87 | * non-serializable value, then `worker.evaluate` resolves to `undefined`. 88 | * DevTools Protocol also supports transferring some additional values that 89 | * are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and 90 | * bigint literals. 91 | * Shortcut for `await worker.executionContext()).evaluate(pageFunction, ...args)`. 92 | * 93 | * @param pageFunction - Function to be evaluated in the worker context. 94 | * @param args - Arguments to pass to `pageFunction`. 95 | * @returns Promise which resolves to the return value of `pageFunction`. 96 | */ 97 | evaluate< 98 | Params extends unknown[], 99 | Func extends EvaluateFunc = EvaluateFunc, 100 | >( 101 | pageFunction: Func | string, 102 | ...args: Params 103 | ): Promise>>; 104 | /** 105 | * The only difference between `worker.evaluate` and `worker.evaluateHandle` 106 | * is that `worker.evaluateHandle` returns in-page object (JSHandle). If the 107 | * function passed to the `worker.evaluateHandle` returns a `Promise`, then 108 | * `worker.evaluateHandle` would wait for the promise to resolve and return 109 | * its value. Shortcut for 110 | * `await worker.executionContext()).evaluateHandle(pageFunction, ...args)` 111 | * 112 | * @param pageFunction - Function to be evaluated in the page context. 113 | * @param args - Arguments to pass to `pageFunction`. 114 | * @returns Promise which resolves to the return value of `pageFunction`. 115 | */ 116 | evaluateHandle< 117 | Params extends unknown[], 118 | Func extends EvaluateFunc = EvaluateFunc, 119 | >( 120 | pageFunction: Func | string, 121 | ...args: Params 122 | ): Promise>>>; 123 | } 124 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/fetch.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const getFetch: () => Promise; 17 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/fetch.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** Use the global version. */ 18 | export const getFetch = async () => { 19 | return globalThis.fetch; 20 | }; 21 | //# sourceMappingURL=fetch.js.map 22 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { JSHandle } from "./JSHandle.js"; 17 | import { ElementHandle } from "./ElementHandle.js"; 18 | /** 19 | * @public 20 | */ 21 | export declare type Awaitable = T | PromiseLike; 22 | /** 23 | * @public 24 | */ 25 | export declare type HandleFor = T extends any ? ElementHandle 26 | : JSHandle; 27 | /** 28 | * @public 29 | */ 30 | export declare type HandleOr = HandleFor | JSHandle | T; 31 | /** 32 | * @public 33 | */ 34 | export declare type FlattenHandle = T extends HandleOr ? U : never; 35 | /** 36 | * @public 37 | */ 38 | export declare type InnerParams = { 39 | [K in keyof T]: FlattenHandle; 40 | }; 41 | /** 42 | * @public 43 | */ 44 | export declare type EvaluateFunc = ( 45 | ...params: InnerParams 46 | ) => Awaitable; 47 | /** 48 | * @public 49 | */ 50 | export declare type NodeFor = Selector extends 51 | keyof any ? any[Selector] 52 | : Selector extends keyof any ? any[Selector] 53 | : any; 54 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/types.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | export {}; 18 | //# sourceMappingURL=types.js.map 19 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/common/util.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { Protocol } from "../../vendor/devtools-protocol/types/protocol.d.ts"; 17 | import { CDPSession } from "./Connection.js"; 18 | import { ElementHandle } from "./ElementHandle.js"; 19 | import { CommonEventEmitter } from "./EventEmitter.js"; 20 | import { ExecutionContext } from "./ExecutionContext.js"; 21 | import { JSHandle } from "./JSHandle.js"; 22 | /** 23 | * @internal 24 | */ 25 | export declare const debugError: (...args: unknown[]) => void; 26 | /** 27 | * @internal 28 | */ 29 | export declare function getExceptionMessage( 30 | exceptionDetails: Protocol.Runtime.ExceptionDetails, 31 | ): string; 32 | /** 33 | * @internal 34 | */ 35 | export declare function valueFromRemoteObject( 36 | remoteObject: Protocol.Runtime.RemoteObject, 37 | ): any; 38 | /** 39 | * @internal 40 | */ 41 | export declare function releaseObject( 42 | client: CDPSession, 43 | remoteObject: Protocol.Runtime.RemoteObject, 44 | ): Promise; 45 | /** 46 | * @internal 47 | */ 48 | export interface PuppeteerEventListener { 49 | emitter: CommonEventEmitter; 50 | eventName: string | symbol; 51 | handler: (...args: any[]) => void; 52 | } 53 | /** 54 | * @internal 55 | */ 56 | export declare function addEventListener( 57 | emitter: CommonEventEmitter, 58 | eventName: string | symbol, 59 | handler: (...args: any[]) => void, 60 | ): PuppeteerEventListener; 61 | /** 62 | * @internal 63 | */ 64 | export declare function removeEventListeners( 65 | listeners: Array<{ 66 | emitter: CommonEventEmitter; 67 | eventName: string | symbol; 68 | handler: (...args: any[]) => void; 69 | }>, 70 | ): void; 71 | /** 72 | * @internal 73 | */ 74 | export declare const isString: (obj: unknown) => obj is string; 75 | /** 76 | * @internal 77 | */ 78 | export declare const isNumber: (obj: unknown) => obj is number; 79 | /** 80 | * @internal 81 | */ 82 | export declare function waitForEvent( 83 | emitter: CommonEventEmitter, 84 | eventName: string | symbol, 85 | predicate: (event: T) => Promise | boolean, 86 | timeout: number, 87 | abortPromise: Promise, 88 | ): Promise; 89 | /** 90 | * @internal 91 | */ 92 | export declare function createJSHandle( 93 | context: ExecutionContext, 94 | remoteObject: Protocol.Runtime.RemoteObject, 95 | ): JSHandle | ElementHandle; 96 | /** 97 | * @internal 98 | */ 99 | export declare function evaluationString( 100 | fun: Function | string, 101 | ...args: unknown[] 102 | ): string; 103 | /** 104 | * @internal 105 | */ 106 | export declare function pageBindingInitString( 107 | type: string, 108 | name: string, 109 | ): string; 110 | /** 111 | * @internal 112 | */ 113 | export declare function pageBindingDeliverResultString( 114 | name: string, 115 | seq: number, 116 | result: unknown, 117 | ): string; 118 | /** 119 | * @internal 120 | */ 121 | export declare function pageBindingDeliverErrorString( 122 | name: string, 123 | seq: number, 124 | message: string, 125 | stack?: string, 126 | ): string; 127 | /** 128 | * @internal 129 | */ 130 | export declare function pageBindingDeliverErrorValueString( 131 | name: string, 132 | seq: number, 133 | value: unknown, 134 | ): string; 135 | /** 136 | * @internal 137 | */ 138 | export declare function makePredicateString( 139 | predicate: Function, 140 | predicateQueryHandler: Function, 141 | ): string; 142 | /** 143 | * @internal 144 | */ 145 | export declare function waitWithTimeout( 146 | promise: Promise, 147 | taskName: string, 148 | timeout: number, 149 | ): Promise; 150 | /** 151 | * @internal 152 | */ 153 | export declare function getReadableStreamAsUint8Array( 154 | readable: ReadableStream, 155 | path?: string, 156 | ): Promise; 157 | /** 158 | * @internal 159 | */ 160 | export declare function getReadableStreamFromProtocolStream( 161 | client: CDPSession, 162 | handle: string, 163 | ): Promise; 164 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/generated/version.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @internal 3 | */ 4 | export declare const packageVersion = "16.2.0"; 5 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/generated/version.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * @internal 4 | */ 5 | export const packageVersion = "16.2.0"; 6 | //# sourceMappingURL=version.js.map 7 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/injected/Poller.d.ts: -------------------------------------------------------------------------------- 1 | interface Poller { 2 | start(): Promise; 3 | stop(): Promise; 4 | result(): Promise; 5 | } 6 | export declare class MutationPoller implements Poller { 7 | #private; 8 | constructor(fn: () => Promise, root: Node); 9 | start(): Promise; 10 | stop(): Promise; 11 | result(): Promise; 12 | } 13 | export declare class RAFPoller implements Poller { 14 | #private; 15 | constructor(fn: () => Promise); 16 | start(): Promise; 17 | stop(): Promise; 18 | result(): Promise; 19 | } 20 | export declare class IntervalPoller implements Poller { 21 | #private; 22 | constructor(fn: () => Promise, ms: number); 23 | start(): Promise; 24 | stop(): Promise; 25 | result(): Promise; 26 | } 27 | export {}; 28 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/injected/injected.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./Poller.js"; 2 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/injected/injected.js: -------------------------------------------------------------------------------- 1 | /// 2 | export * from "./Poller.js"; 3 | //# sourceMappingURL=injected.js.map 4 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/puppeteer-core.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export * from "./common/NetworkConditions.js"; 17 | export * from "./common/QueryHandler.js"; 18 | export * from "./common/DeviceDescriptors.js"; 19 | export * from "./common/Errors.js"; 20 | declare const puppeteer: import("./types.js").PuppeteerNode; 21 | export declare const connect: ( 22 | options: import("./types.js").ConnectOptions, 23 | ) => Promise, 24 | createBrowserFetcher: ( 25 | options: import("./types.js").BrowserFetcherOptions, 26 | ) => import("./types.js").BrowserFetcher, 27 | defaultArgs: ( 28 | options?: import("./types.js").BrowserLaunchArgumentOptions, 29 | ) => string[], 30 | executablePath: (channel?: string | undefined) => string, 31 | launch: ( 32 | options?: import("./types.js").PuppeteerLaunchOptions, 33 | ) => Promise; 34 | export default puppeteer; 35 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/puppeteer-core.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2017 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { initializePuppeteer } from "./initializePuppeteer.js"; 18 | export * from "./common/NetworkConditions.js"; 19 | export * from "./common/QueryHandler.js"; 20 | export * from "./common/DeviceDescriptors.js"; 21 | export * from "./common/Errors.js"; 22 | const puppeteer = initializePuppeteer("puppeteer-core"); 23 | export const { 24 | connect, 25 | createBrowserFetcher, 26 | defaultArgs, 27 | executablePath, 28 | launch, 29 | } = puppeteer; 30 | export default puppeteer; 31 | //# sourceMappingURL=puppeteer-core.js.map 32 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/revisions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * @internal 18 | */ 19 | export declare const PUPPETEER_REVISIONS: Readonly<{ 20 | chromium: "1022525"; 21 | firefox: "latest"; 22 | }>; 23 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/revisions.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * @internal 19 | */ 20 | export const PUPPETEER_REVISIONS = Object.freeze({ 21 | chromium: "1022525", 22 | firefox: "latest", 23 | }); 24 | //# sourceMappingURL=revisions.js.map 25 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/types.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./revisions.js"; 2 | export * from "./common/Accessibility.js"; 3 | export * from "./common/AriaQueryHandler.js"; 4 | export * from "./common/Browser.js"; 5 | export * from "./common/BrowserConnector.js"; 6 | export * from "./common/BrowserWebSocketTransport.js"; 7 | export * from "./common/ChromeTargetManager.js"; 8 | export * from "./common/Connection.js"; 9 | export * from "./common/ConnectionTransport.js"; 10 | export * from "./common/ConsoleMessage.js"; 11 | export * from "./common/Coverage.js"; 12 | export * from "./common/Debug.js"; 13 | export * from "./common/DeviceDescriptors.js"; 14 | export * from "./common/Dialog.js"; 15 | export * from "./common/ElementHandle.js"; 16 | export * from "./common/EmulationManager.js"; 17 | export * from "./common/Errors.js"; 18 | export * from "./common/EventEmitter.js"; 19 | export * from "./common/ExecutionContext.js"; 20 | export * from "./common/FileChooser.js"; 21 | export * from "./common/FirefoxTargetManager.js"; 22 | export * from "./common/Frame.js"; 23 | export * from "./common/FrameManager.js"; 24 | export * from "./common/HTTPRequest.js"; 25 | export * from "./common/HTTPResponse.js"; 26 | export * from "./common/Input.js"; 27 | export * from "./common/IsolatedWorld.js"; 28 | export * from "./common/JSHandle.js"; 29 | export * from "./common/LifecycleWatcher.js"; 30 | export * from "./common/NetworkConditions.js"; 31 | export * from "./common/NetworkEventManager.js"; 32 | export * from "./common/NetworkManager.js"; 33 | export * from "./common/PDFOptions.js"; 34 | export * from "./common/Page.js"; 35 | export * from "./common/Product.js"; 36 | export * from "./common/Puppeteer.js"; 37 | export * from "./common/PuppeteerViewport.js"; 38 | export * from "./common/QueryHandler.js"; 39 | export * from "./common/SecurityDetails.js"; 40 | export * from "./common/Target.js"; 41 | export * from "./common/TargetManager.js"; 42 | export * from "./common/TaskQueue.js"; 43 | export * from "./common/TimeoutSettings.js"; 44 | export * from "./common/Tracing.js"; 45 | export * from "./common/USKeyboardLayout.js"; 46 | export * from "./common/WebWorker.js"; 47 | export * from "./common/fetch.js"; 48 | export * from "./common/types.js"; 49 | export * from "./common/util.js"; 50 | export * from "./generated/injected.js"; 51 | export * from "./generated/version.js"; 52 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/types.js: -------------------------------------------------------------------------------- 1 | /// 2 | // AUTOGENERATED - Use `utils/export_all.js` to regenerate. 3 | export * from "./revisions.js"; 4 | // Exports from `common` 5 | export * from "./common/Accessibility.js"; 6 | export * from "./common/AriaQueryHandler.js"; 7 | export * from "./common/Browser.js"; 8 | export * from "./common/BrowserConnector.js"; 9 | export * from "./common/BrowserWebSocketTransport.js"; 10 | export * from "./common/ChromeTargetManager.js"; 11 | export * from "./common/Connection.js"; 12 | export * from "./common/ConnectionTransport.js"; 13 | export * from "./common/ConsoleMessage.js"; 14 | export * from "./common/Coverage.js"; 15 | export * from "./common/Debug.js"; 16 | export * from "./common/DeviceDescriptors.js"; 17 | export * from "./common/Dialog.js"; 18 | export * from "./common/ElementHandle.js"; 19 | export * from "./common/EmulationManager.js"; 20 | export * from "./common/Errors.js"; 21 | export * from "./common/EventEmitter.js"; 22 | export * from "./common/ExecutionContext.js"; 23 | export * from "./common/FileChooser.js"; 24 | export * from "./common/FirefoxTargetManager.js"; 25 | export * from "./common/Frame.js"; 26 | export * from "./common/FrameManager.js"; 27 | export * from "./common/HTTPRequest.js"; 28 | export * from "./common/HTTPResponse.js"; 29 | export * from "./common/Input.js"; 30 | export * from "./common/IsolatedWorld.js"; 31 | export * from "./common/JSHandle.js"; 32 | export * from "./common/LifecycleWatcher.js"; 33 | export * from "./common/NetworkConditions.js"; 34 | export * from "./common/NetworkEventManager.js"; 35 | export * from "./common/NetworkManager.js"; 36 | export * from "./common/PDFOptions.js"; 37 | export * from "./common/Page.js"; 38 | export * from "./common/Product.js"; 39 | export * from "./common/Puppeteer.js"; 40 | export * from "./common/PuppeteerViewport.js"; 41 | export * from "./common/QueryHandler.js"; 42 | export * from "./common/SecurityDetails.js"; 43 | export * from "./common/Target.js"; 44 | export * from "./common/TargetManager.js"; 45 | export * from "./common/TaskQueue.js"; 46 | export * from "./common/TimeoutSettings.js"; 47 | export * from "./common/Tracing.js"; 48 | export * from "./common/USKeyboardLayout.js"; 49 | export * from "./common/WebWorker.js"; 50 | export * from "./common/fetch.js"; 51 | export * from "./common/types.js"; 52 | export * from "./common/util.js"; 53 | // Exports from `generated` 54 | export * from "./generated/injected.js"; 55 | export * from "./generated/version.js"; 56 | //# sourceMappingURL=types.js.map 57 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/util/DeferredPromise.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @internal 3 | */ 4 | export interface DeferredPromise extends Promise { 5 | finished: () => boolean; 6 | resolved: () => boolean; 7 | resolve: (_: T) => void; 8 | reject: (_: Error) => void; 9 | } 10 | /** 11 | * Creates an returns a promise along with the resolve/reject functions. 12 | * 13 | * If the promise has not been resolved/rejected withing the `timeout` period, 14 | * the promise gets rejected with a timeout error. 15 | * 16 | * @internal 17 | */ 18 | export declare function createDeferredPromiseWithTimer( 19 | timeoutMessage: string, 20 | timeout?: number, 21 | ): DeferredPromise; 22 | /** 23 | * Creates an returns a promise along with the resolve/reject functions. 24 | * 25 | * @internal 26 | */ 27 | export declare function createDeferredPromise(): DeferredPromise; 28 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/util/DeferredPromise.js: -------------------------------------------------------------------------------- 1 | /// 2 | import { TimeoutError } from "../common/Errors.js"; 3 | /** 4 | * Creates an returns a promise along with the resolve/reject functions. 5 | * 6 | * If the promise has not been resolved/rejected withing the `timeout` period, 7 | * the promise gets rejected with a timeout error. 8 | * 9 | * @internal 10 | */ 11 | export function createDeferredPromiseWithTimer(timeoutMessage, timeout = 5000) { 12 | let isResolved = false; 13 | let isRejected = false; 14 | let resolver = (_) => {}; 15 | let rejector = (_) => {}; 16 | const taskPromise = new Promise((resolve, reject) => { 17 | resolver = resolve; 18 | rejector = reject; 19 | }); 20 | const timeoutId = setTimeout(() => { 21 | isRejected = true; 22 | rejector(new TimeoutError(timeoutMessage)); 23 | }, timeout); 24 | return Object.assign(taskPromise, { 25 | resolved: () => { 26 | return isResolved; 27 | }, 28 | finished: () => { 29 | return isResolved || isRejected; 30 | }, 31 | resolve: (value) => { 32 | clearTimeout(timeoutId); 33 | isResolved = true; 34 | resolver(value); 35 | }, 36 | reject: (err) => { 37 | clearTimeout(timeoutId); 38 | isRejected = true; 39 | rejector(err); 40 | }, 41 | }); 42 | } 43 | /** 44 | * Creates an returns a promise along with the resolve/reject functions. 45 | * 46 | * @internal 47 | */ 48 | export function createDeferredPromise() { 49 | let isResolved = false; 50 | let isRejected = false; 51 | let resolver = (_) => {}; 52 | let rejector = (_) => {}; 53 | const taskPromise = new Promise((resolve, reject) => { 54 | resolver = resolve; 55 | rejector = reject; 56 | }); 57 | return Object.assign(taskPromise, { 58 | resolved: () => { 59 | return isResolved; 60 | }, 61 | finished: () => { 62 | return isResolved || isRejected; 63 | }, 64 | resolve: (value) => { 65 | isResolved = true; 66 | resolver(value); 67 | }, 68 | reject: (err) => { 69 | isRejected = true; 70 | rejector(err); 71 | }, 72 | }); 73 | } 74 | //# sourceMappingURL=DeferredPromise.js.map 75 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/util/ErrorLike.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @internal 3 | */ 4 | export interface ErrorLike extends Error { 5 | name: string; 6 | message: string; 7 | } 8 | /** 9 | * @internal 10 | */ 11 | export declare function isErrorLike(obj: unknown): obj is ErrorLike; -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/util/ErrorLike.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * @internal 4 | */ 5 | /** 6 | * @internal 7 | */ 8 | export function isErrorLike(obj) { 9 | return (typeof obj === "object" && obj !== null && "name" in obj && 10 | "message" in obj); 11 | } 12 | //# sourceMappingURL=ErrorLike.js.map 13 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/util/assert.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2020 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Asserts that the given value is truthy. 18 | * @param value - some conditional statement 19 | * @param message - the error message to throw if the value is not truthy. 20 | * 21 | * @internal 22 | */ 23 | export declare const assert: ( 24 | value: unknown, 25 | message?: string, 26 | ) => asserts value; 27 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/puppeteer/util/assert.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Copyright 2020 Google Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * Asserts that the given value is truthy. 19 | * @param value - some conditional statement 20 | * @param message - the error message to throw if the value is not truthy. 21 | * 22 | * @internal 23 | */ 24 | export const assert = (value, message) => { 25 | if (!value) { 26 | throw new Error(message); 27 | } 28 | }; 29 | //# sourceMappingURL=assert.js.map 30 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/vendor/cache.ts: -------------------------------------------------------------------------------- 1 | export { cachedir } from "https://deno.land/x/cache@0.2.12/directories.ts"; 2 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/vendor/mitt/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @public 3 | */ 4 | export declare type EventType = string | symbol; 5 | /** 6 | * @public 7 | */ 8 | export declare type Handler = (event?: T) => void; 9 | export declare type WildcardHandler = (type: EventType, event?: any) => void; 10 | export declare type EventHandlerList = Array; 11 | export declare type WildCardEventHandlerList = Array; 12 | export declare type EventHandlerMap = Map< 13 | EventType, 14 | EventHandlerList | WildCardEventHandlerList 15 | >; 16 | export interface Emitter { 17 | all: EventHandlerMap; 18 | on(type: EventType, handler: Handler): void; 19 | on(type: "*", handler: WildcardHandler): void; 20 | off(type: EventType, handler: Handler): void; 21 | off(type: "*", handler: WildcardHandler): void; 22 | emit(type: EventType, event?: T): void; 23 | emit(type: "*", event?: any): void; 24 | } 25 | /** 26 | * Mitt: Tiny (~200b) functional event emitter / pubsub. 27 | * @name mitt 28 | * @returns {Mitt} 29 | */ 30 | export default function mitt(all?: EventHandlerMap): Emitter; 31 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/vendor/mitt/src/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | /** 3 | * Mitt: Tiny (~200b) functional event emitter / pubsub. 4 | * @name mitt 5 | * @returns {Mitt} 6 | */ 7 | export default function mitt(all) { 8 | all = all || new Map(); 9 | return { 10 | /** 11 | * A Map of event names to registered handler functions. 12 | */ 13 | all: all, 14 | /** 15 | * Register an event handler for the given type. 16 | * @param {string|symbol} type Type of event to listen for, or `"*"` for all events 17 | * @param {Function} handler Function to call in response to given event 18 | * @memberOf mitt 19 | */ 20 | on: function (type, handler) { 21 | var handlers = all.get(type); 22 | var added = handlers && handlers.push(handler); 23 | if (!added) { 24 | all.set(type, [handler]); 25 | } 26 | }, 27 | /** 28 | * Remove an event handler for the given type. 29 | * @param {string|symbol} type Type of event to unregister `handler` from, or `"*"` 30 | * @param {Function} handler Handler function to remove 31 | * @memberOf mitt 32 | */ 33 | off: function (type, handler) { 34 | var handlers = all.get(type); 35 | if (handlers) { 36 | handlers.splice(handlers.indexOf(handler) >>> 0, 1); 37 | } 38 | }, 39 | /** 40 | * Invoke all handlers for the given type. 41 | * If present, `"*"` handlers are invoked after type-matched handlers. 42 | * 43 | * Note: Manually firing "*" handlers is not supported. 44 | * 45 | * @param {string|symbol} type The event type to invoke 46 | * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler 47 | * @memberOf mitt 48 | */ 49 | emit: function (type, evt) { 50 | (all.get(type) || []).slice().map(function (handler) { 51 | handler(evt); 52 | }); 53 | (all.get("*") || []).slice().map(function (handler) { 54 | handler(type, evt); 55 | }); 56 | }, 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/vendor/std.ts: -------------------------------------------------------------------------------- 1 | export { 2 | decode as base64Decode, 3 | encode as base64Encode, 4 | } from "https://deno.land/std@0.93.0/encoding/base64.ts"; 5 | export { concat as concatUint8Array } from "https://deno.land/std@0.93.0/bytes/mod.ts"; 6 | export { 7 | join as pathJoin, 8 | resolve as pathResolve, 9 | } from "https://deno.land/std@0.93.0/path/mod.ts"; 10 | export { readLines } from "https://deno.land/std@0.93.0/io/mod.ts"; 11 | export { exists, existsSync } from "https://deno.land/std@0.93.0/fs/exists.ts"; 12 | export { copy as copyDir } from "https://deno.land/std@0.93.0/fs/copy.ts"; 13 | export { sprintf } from "https://deno.land/std@0.93.0/fmt/printf.ts"; 14 | -------------------------------------------------------------------------------- /vendor/puppeteer-core/vendor/zip/types.ts: -------------------------------------------------------------------------------- 1 | // modified for deno compatibility 2 | // (node specific types commented out.) 3 | 4 | // https://www.npmjs.com/package/@types/jszip 5 | // https://unpkg.com/@types/jszip@3.1.7/index.d.ts 6 | 7 | // Type definitions for JSZip 3.1 8 | // Project: http://stuk.github.com/jszip/, https://github.com/stuk/jszip 9 | // Definitions by: mzeiher 10 | // forabi 11 | // Florian Keller 12 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 13 | // TypeScript Version: 2.3 14 | 15 | export type Compression = "STORE" | "DEFLATE"; 16 | 17 | export interface InputByType { 18 | base64: string; 19 | string: string; 20 | text: string; 21 | binarystring: string; 22 | array: number[]; 23 | uint8array: Uint8Array; 24 | arraybuffer: ArrayBuffer; 25 | blob: Blob; 26 | // stream: NodeJS.ReadableStream; 27 | } 28 | 29 | export type InputFileFormat = InputByType[keyof InputByType]; 30 | 31 | export interface JSZipFileOptions { 32 | /** Set to `true` if the data is `base64` encoded. For example image data from a `` element. Plain text and HTML do not need this option. */ 33 | base64?: boolean; 34 | /** 35 | * Set to `true` if the data should be treated as raw content, `false` if this is a text. If `base64` is used, 36 | * this defaults to `true`, if the data is not a `string`, this will be set to `true`. 37 | */ 38 | binary?: boolean; 39 | /** 40 | * The last modification date, defaults to the current date. 41 | */ 42 | date?: Date; 43 | compression?: string; 44 | comment?: string; 45 | /** Set to `true` if (and only if) the input is a "binary string" and has already been prepared with a `0xFF` mask. */ 46 | optimizedBinaryString?: boolean; 47 | /** Set to `true` if folders in the file path should be automatically created, otherwise there will only be virtual folders that represent the path to the file. */ 48 | createFolders?: boolean; 49 | /** Set to `true` if this is a directory and content should be ignored. */ 50 | dir?: boolean; 51 | 52 | /** 6 bits number. The DOS permissions of the file, if any. */ 53 | dosPermissions?: number | null; 54 | /** 55 | * 16 bits number. The UNIX permissions of the file, if any. 56 | * Also accepts a `string` representing the octal value: `"644"`, `"755"`, etc. 57 | */ 58 | unixPermissions?: number | string | null; 59 | } 60 | 61 | export interface JSZipGeneratorOptions { 62 | compression?: Compression; 63 | compressionOptions?: null | { 64 | level: number; 65 | }; 66 | type?: T; 67 | comment?: string; 68 | /** 69 | * mime-type for the generated file. 70 | * Useful when you need to generate a file with a different extension, ie: “.ods”. 71 | * @default 'application/zip' 72 | */ 73 | mimeType?: string; 74 | encodeFileName?(filename: string): string; 75 | /** Stream the files and create file descriptors */ 76 | streamFiles?: boolean; 77 | /** DOS (default) or UNIX */ 78 | platform?: "DOS" | "UNIX"; 79 | } 80 | 81 | export interface JSZipLoadOptions { 82 | base64?: boolean; 83 | checkCRC32?: boolean; 84 | optimizedBinaryString?: boolean; 85 | createFolders?: boolean; 86 | decodeFileName?(filenameBytes: Uint8Array): string; 87 | } 88 | 89 | export interface JSZipObject { 90 | name: string; 91 | dir: boolean; 92 | date: Date; 93 | comment: string; 94 | /** The UNIX permissions of the file, if any. */ 95 | unixPermissions: number | string | null; 96 | /** The UNIX permissions of the file, if any. */ 97 | dosPermissions: number | null; 98 | options: JSZipObjectOptions; 99 | 100 | /** 101 | * Prepare the content in the asked type. 102 | * @param type the type of the result. 103 | * @param onUpdate a function to call on each internal update. 104 | * @return Promise the promise of the result. 105 | */ 106 | async( 107 | type: T, 108 | onUpdate?: OnUpdateCallback, 109 | ): Promise; 110 | 111 | // nodeStream( 112 | // type?: "nodestream", 113 | // onUpdate?: OnUpdateCallback 114 | // ): NodeJS.ReadableStream; 115 | } 116 | 117 | export interface JSZipObjectOptions { 118 | compression: Compression; 119 | } 120 | 121 | export interface Metadata { 122 | percent: number; 123 | currentFile: string; 124 | } 125 | 126 | export type OnUpdateCallback = (metadata: Metadata) => void; 127 | 128 | export interface OutputByType { 129 | base64: string; 130 | text: string; 131 | string: string; 132 | binarystring: string; 133 | array: number[]; 134 | uint8array: Uint8Array; 135 | arraybuffer: ArrayBuffer; 136 | blob: Blob; 137 | // nodebuffer: Buffer; 138 | } 139 | 140 | export type OutputType = keyof OutputByType; 141 | --------------------------------------------------------------------------------