From c01f72e741bc79889d069c281bf9f6c32a305dab Mon Sep 17 00:00:00 2001 From: Sparticuz Date: Tue, 27 Sep 2022 12:57:25 -0400 Subject: [PATCH] cleanup --- .editorconfig | 1 - .gitignore | 1 - .npmignore | 2 - typings/chrome-aws-lambda.d.ts | 471 --------------------------------- 4 files changed, 475 deletions(-) delete mode 100644 typings/chrome-aws-lambda.d.ts diff --git a/.editorconfig b/.editorconfig index a0bd1fb..ed81f04 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,7 +8,6 @@ end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true -trim_trailing_whitespace = true [*.json] indent_size = 2 diff --git a/.gitignore b/.gitignore index f8e4017..fc2af73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .fonts -.idea *.log *.pem *.pem.pub diff --git a/.npmignore b/.npmignore index 24117c6..f8fb191 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,3 @@ _ .fonts -.idea *.zip -Dockerfile diff --git a/typings/chrome-aws-lambda.d.ts b/typings/chrome-aws-lambda.d.ts deleted file mode 100644 index cbd8b92..0000000 --- a/typings/chrome-aws-lambda.d.ts +++ /dev/null @@ -1,471 +0,0 @@ -import { Page } from 'puppeteer-core'; - -export type Hook = (page: Page) => Promise; -export type KeysOfType = { [K in keyof T]: T[K] extends V ? K : never }[keyof T] -export type Prototype = T & { prototype: T }; -export type Writeable = { -readonly [P in keyof T]: T[P] }; - -declare module 'puppeteer-core' { - interface Browser { - /** - * Returns the browser default page. - * - * @param hooks - Optional hooks to apply on the page. - */ - defaultPage(...hooks: Hook[]): Promise; - - /** - * Returns a new page overloaded with browser-context methods. - * - * @param hooks - Optional hooks to apply on the new page. - */ - newPage(...hooks: Hook[]): Promise; - } - - interface BrowserContext { - /** - * Returns the browser context default page. - * - * @param hooks - Optional hooks to apply on the page. - */ - defaultPage(...hooks: Hook[]): Promise; - - /** - * Returns a new page overloaded with browser-context methods. - * - * @param hooks - Optional hooks to apply on the new page. - */ - newPage(...hooks: Hook[]): Promise; - } - - interface ElementHandle { - /** - * Selects all text in a editable element and clears it. - */ - clear(): Promise; - - /** - * Clicks an element and waits for navigation to finish. - * - * @param options - Options to configure when the navigation is consided finished. - */ - clickAndWaitForNavigation(options?: WaitForOptions): Promise; - - /** - * Clicks an element and waits for a request to be initiated. - * - * @param predicate - URL pattern to wait for, wildcards `*` are allowed. - * @param options - Optional waiting parameters. - */ - clickAndWaitForRequest(predicate: string | RegExp, options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be initiated. - * - * @param predicate - Predicate to wait for. - * @param options - Optional waiting parameters. - */ - clickAndWaitForRequest(predicate: ((request: HTTPRequest) => boolean | Promise), options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be finalized. - * - * @param predicate - URL pattern to wait for, wildcards `*` are allowed. - * @param options - Optional waiting parameters. - */ - clickAndWaitForResponse(predicate: string | RegExp, options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be finalized. - * - * @param predicate - Predicate to wait for. - * @param options - Optional waiting parameters. - */ - clickAndWaitForResponse(predicate: ((request: HTTPResponse) => boolean | Promise), options?: WaitTimeoutOptions): Promise; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param data - Data to fill the form, as a label-value[s] map. - */ - fillFormByLabel>(data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param data - Data to fill the form, as a name-value[s] map. - */ - fillFormByName>(data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param data - Data to fill the form, as a selector-value[s] map. - */ - fillFormBySelector>(data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param data - Data to fill the form, as a XPath selector-value[s] map. - */ - fillFormByXPath>(data: T): Promise>; - - /** - * Returns the `innerHTML` property of the element. - */ - getInnerHTML(): Promise; - - /** - * Returns the `innerText` property of the element. - */ - getInnerText(): Promise; - - /** - * Returns normalized number(s) found in the given element. - * - * @param decimal - Decimal separator to use, defaults to `.`. - * @param property - Element property to extract content from, defaults to `textContent`. - */ - number(decimal?: string, property?: any): Promise; - - /** - * Selects multiple `select` options by label and returns the values of the actual selection. - * - * @param values - Option labels to select. - */ - selectByLabel(...values: string[]): Promise; - - /** - * Returns normalized text found in the given element. - * - * @param property - Element property to extract content from, defaults to `textContent`. - */ - string(property?: any): Promise; - } - - interface Frame { - /** - * Selects all text in a editable element and clears it. - * - * @param selector - Selector to query for. - */ - clear(selector: string): Promise; - - /** - * Clicks an element and waits for navigation to finish. - * - * @param selector - Selector to query for. - * @param options - Options to configure when the navigation is consided finished. - */ - clickAndWaitForNavigation(selector: string, options?: WaitForOptions): Promise; - - /** - * Clicks an element and waits for a request to be initiated. - * - * @param selector - Selector to query for. - * @param pattern - URL pattern to wait for, wildcards `*` are allowed. - * @param options - Optional waiting parameters. - */ - clickAndWaitForRequest(selector: string, predicate: string | RegExp, options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be initiated. - * - * @param selector - Selector to query for. - * @param pattern - Predicate to wait for. - * @param options - Optional waiting parameters. - */ - clickAndWaitForRequest(selector: string, predicate: ((request: HTTPRequest) => boolean | Promise), options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be finalized. - * - * @param selector - Selector to query for. - * @param predicate - URL pattern to wait for, wildcards `*` are allowed. - * @param options - Optional waiting parameters. - */ - clickAndWaitForResponse(selector: string, predicate: string | RegExp, options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be finalized. - * - * @param selector - Selector to query for. - * @param predicate - Predicate to wait for. - * @param options - Optional waiting parameters. - */ - clickAndWaitForResponse(selector: string, predicate: ((request: HTTPResponse) => boolean | Promise), options?: WaitTimeoutOptions): Promise; - - /** - * Returns the total number of elements that match the selector. - * - * @param selector - Selector to query for. - */ - count(selector: string): Promise; - - /** - * Checks whether at least one element matching the selector exists. - * - * @param selector - Selector to query for. - */ - exists(selector: string): Promise; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param selector - Selector to query the `form` element for. - * @param data - Data to fill the form, as a label-value[s] map. - */ - fillFormByLabel>(selector: string, data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param selector - Selector to query the `form` element for. - * @param data - Data to fill the form, as a name-value[s] map. - */ - fillFormByName>(selector: string, data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param selector - Selector to query the `form` element for. - * @param data - Data to fill the form, as a selector-value[s] map. - */ - fillFormBySelector>(selector: string, data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param selector - Selector to query the `form` element for. - * @param data - Data to fill the form, as a XPath selector-value[s] map. - */ - fillFormByXPath>(selector: string, data: T): Promise>; - - /** - * Returns normalized number(s) found in the given element. - * - * @param selector - Selector to query for. - * @param decimal - Decimal separator to use, defaults to `.`. - * @param property - Element property to extract content from, defaults to `textContent`. - */ - number(selector: string, decimal?: string, property?: KeysOfType): Promise; - - /** - * Selects multiple `select` options by label and returns the values of the actual selection. - * - * @param selector - Selector to query the `select` element for. - * @param values - Option labels to select. - */ - selectByLabel(selector: string, ...values: string[]): Promise; - - /** - * Returns normalized text found in the given selector. - * - * @param selector - Selector to query for. - * @param property - Element property to extract content from, defaults to `textContent`. - */ - string(selector: string, property?: KeysOfType): Promise; - - /** - * Wait for a string to be present and visible. - * - * @param predicate - String to wait for. - * @param options - Optional waiting parameters. - */ - waitForText(predicate: string, options?: WaitTimeoutOptions): Promise>; - - /** - * Waits for element to be present in DOM and to be visible. - * - * @param selector - Selector to query for. - * @param options - Optional waiting parameters. - */ - waitUntilVisible(selector: string, options?: WaitTimeoutOptions): Promise>; - - /** - * Waits for element to not be found in the DOM or to be hidden. - * - * @param selector - Selector to query for. - * @param options - Optional waiting parameters. - */ - waitWhileVisible(selector: string, options?: WaitTimeoutOptions): Promise>; - } - - interface Page { - /** - * Blocks URLs from loading without initializing request interception. - * Experimental: https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setBlockedURLs - * - * @param patterns - URL patterns to block, wildcards `*` are allowed. - */ - block(patterns: string[]): Promise; - - /** - * Selects all text in a editable element and clears it. - * - * @param selector - Selector to query for. - */ - clear(selector: string): Promise; - - /** - * Clicks an element and waits for navigation to finish. - * - * @param selector - Selector to query for. - * @param options - Options to configure when the navigation is consided finished. - */ - clickAndWaitForNavigation(selector: string, options?: WaitForOptions): Promise; - - /** - * Clicks an element and waits for a request to be initiated. - * - * @param selector - Selector to query for. - * @param predicate - URL pattern to wait for, wildcards `*` are allowed. - * @param options - Optional waiting parameters. - */ - clickAndWaitForRequest(selector: string, predicate: string | RegExp, options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be initiated. - * - * @param selector - Selector to query for. - * @param predicate - Predicate to wait for. - * @param options - Optional waiting parameters. - */ - clickAndWaitForRequest(selector: string, predicate: ((request: HTTPRequest) => boolean | Promise), options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be finalized. - * - * @param selector - Selector to query for. - * @param predicate - URL pattern to wait for, wildcards `*` are allowed. - * @param options - Optional waiting parameters. - */ - clickAndWaitForResponse(selector: string, predicate: string | RegExp, options?: WaitTimeoutOptions): Promise; - - /** - * Clicks an element and waits for a request to be finalized. - * - * @param selector - Selector to query for. - * @param predicate - Predicate to wait for. - * @param options - Optional waiting parameters. - */ - clickAndWaitForResponse(selector: string, predicate: ((request: HTTPResponse) => boolean | Promise), options?: WaitTimeoutOptions): Promise; - - /** - * Returns the total number of elements that match the selector. - * - * @param selector - Selector to query for. - */ - count(selector: string): Promise; - - /** - * Checks whether at least one element matching the selector exists. - * - * @param selector - Selector to query for. - */ - exists(selector: string): Promise; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param selector - Selector to query the `form` element for. - * @param data - Data to fill the form, as a label-value[s] map. - */ - fillFormByLabel>(selector: string, data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param selector - Selector to query the `form` element for. - * @param data - Data to fill the form, as a name-value[s] map. - */ - fillFormByName>(selector: string, data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param selector - Selector to query the `form` element for. - * @param data - Data to fill the form, as a selector-value[s] map. - */ - fillFormBySelector>(selector: string, data: T): Promise>; - - /** - * Fills a `form` with a variable number of inputs and returns its actual filled state. - * - * @param selector - Selector to query the `form` element for. - * @param data - Data to fill the form, as a XPath selector-value[s] map. - */ - fillFormByXPath>(selector: string, data: T): Promise>; - - /** - * Returns normalized number(s) found in the given element. - * - * @param selector - Selector to query for. - * @param decimal - Decimal separator to use, defaults to `.`. - * @param property - Element property to extract content from, defaults to `textContent`. - */ - number(selector: string, decimal?: string, property?: KeysOfType): Promise; - - /** - * Selects multiple `select` options by label and returns the values of the actual selection. - * - * @param selector - Selector to query the `select` element for. - * @param values - Option labels to select. - */ - selectByLabel(selector: string, ...values: string[]): Promise; - - /** - * Returns normalized text found in the given selector. - * - * @param selector - Selector to query for. - * @param property - Element property to extract content from, defaults to `textContent`. - */ - string(selector: string, property?: KeysOfType): Promise; - - /** - * Wait for the total number of inflight requests to not exceed a specific threshold. - * - * @param requests Maximum number of inflight requests, defaults to 0. - * @param alpha The number of milliseconds to wait for any requests to be issued, defaults to `500` ms. - * @param omega The number of milliseconds to wait for any outstanding inflight requests to settle, defaults to `500` ms. - * @param options Optional waiting parameters. Defaults to the navigation timeout, pass 0 to disable. - * - * @author [mifi](https://github.com/puppeteer/puppeteer/issues/1353#issuecomment-629271737) - * @author [DevBrent](https://github.com/puppeteer/puppeteer/issues/1353#issuecomment-648299486) - */ - waitForInflightRequests(requests?: number, alpha?: number, omega?: number, options?: WaitTimeoutOptions): Promise; - - /** - * Wait for a string to be present and visible. - * - * @param predicate - String to wait for. - * @param options - Optional waiting parameters. - */ - waitForText(predicate: string, options?: WaitTimeoutOptions): Promise>; - - /** - * Waits for element to be present in DOM and to be visible. - * - * @param selector - Selector to query for. - * @param options - Optional waiting parameters. - */ - waitUntilVisible(selector: string, options?: WaitTimeoutOptions): Promise>; - - /** - * Waits for element to not be found in the DOM or to be hidden. - * - * @param selector - Selector to query for. - * @param options - Optional waiting parameters. - */ - waitWhileVisible(selector: string, options?: WaitTimeoutOptions): Promise>; - - /** - * Encapsulates the callback execution in a tracing session. - * - * @param options Tracing options. - * @param callback Callback to execute. - */ - withTracing(options: TracingOptions, callback: (page: Page) => Promise): Promise; - } -}