diff --git a/Makefile b/Makefile index 6762e17..ebc9b14 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ test: %.zip: npm install --no-fund --no-package-lock --no-shrinkwrap mkdir -p nodejs/ - npm install --prefix nodejs/ tar-fs@2.1.1 puppeteer-core@14.4.1 --no-bin-links --no-fund --no-optional --no-package-lock --no-save --no-shrinkwrap + npm install --prefix nodejs/ tar-fs@2.1.1 puppeteer-core@15.5.0 --no-bin-links --no-fund --no-optional --no-package-lock --no-save --no-shrinkwrap npm pack mkdir -p nodejs/node_modules/@sparticuz/chrome-aws-lambda/ tar --directory nodejs/node_modules/@sparticuz/chrome-aws-lambda/ --extract --file sparticuz-chrome-aws-lambda-*.tgz --strip-components=1 diff --git a/README.md b/README.md index a2fec1e..878bb59 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,7 @@ This package is versioned based on the underlying `puppeteer` minor version: | `puppeteer` Version | `chrome-aws-lambda` Version | Chromium Revision | | ------------------- | --------------------------------------------- | ------------------------------------------------------- | +| `15.4.*` | `npm i @sparticuz/chrome-aws-lambda@~15.5.0` | [`1022525`](https://crrev.com/1011831) (`105.0.5173.0`) | | `14.4.*` | `npm i @sparticuz/chrome-aws-lambda@~14.4.1` | [`1002410`](https://crrev.com/1002410) (`103.0.5058.0`) | | `14.3.*` | `npm i @sparticuz/chrome-aws-lambda@~14.3.0` | [`1002410`](https://crrev.com/1002410) (`103.0.5058.0`) | | `14.2.*` | `npm i @sparticuz/chrome-aws-lambda@~14.2.0` | [`1002410`](https://crrev.com/1002410) (`103.0.5058.0`) | diff --git a/_/ansible/Makefile b/_/ansible/Makefile index de7d122..de52552 100755 --- a/_/ansible/Makefile +++ b/_/ansible/Makefile @@ -1,7 +1,7 @@ .PHONY: ansible chromium ansible: - sudo pip3 install ansible boto boto3 + pip install ansible boto boto3 chromium: ansible-playbook plays/chromium.yml -i inventory.ini diff --git a/_/ansible/inventory.ini b/_/ansible/inventory.ini index bfbd531..957c9db 100644 --- a/_/ansible/inventory.ini +++ b/_/ansible/inventory.ini @@ -4,7 +4,7 @@ [localhost:vars] ansible_connection=local ansible_python_interpreter=python -image=ami-03425aeb2f345b9a9 +image=ami-0e7375e22561b4d0a region=us-east-1 [aws] @@ -13,4 +13,4 @@ region=us-east-1 ansible_connection=ssh ansible_python_interpreter=auto_silent ansible_ssh_private_key_file=ansible.pem -puppeteer_version=v14.4.1 +puppeteer_version=v15.5.0 diff --git a/_/ansible/plays/chromium.yml b/_/ansible/plays/chromium.yml index 2707352..b97f4ed 100644 --- a/_/ansible/plays/chromium.yml +++ b/_/ansible/plays/chromium.yml @@ -83,6 +83,12 @@ PATH: "{{ ansible_env.PATH }}:/srv/source/depot_tools" tasks: + - name: Update system + become: true + become_user: root + shell: | + dnf update --releasever=2022.0.20220719 -y + - name: Installing Packages become: true become_user: root @@ -93,7 +99,7 @@ - atk-devel - bc - bluez-libs-devel - - brlapi-devel +# - brlapi-devel - bzip2-devel - cairo-devel - cmake @@ -102,16 +108,16 @@ - dbus-glib-devel - dbus-x11 - expat-devel - - glibc.i686 + - glibc - glibc-langpack-en - gperf - gtk3-devel - httpd - - java-11-openjdk-devel + - java-latest-openjdk-devel - libatomic - libcap-devel - libjpeg-devel - - libstdc++.i686 + - libstdc++ - libXScrnSaver-devel - libxkbcommon-x11-devel - mod_ssl @@ -129,7 +135,7 @@ - python-setuptools - ruby - xorg-x11-server-Xvfb - - zlib.i686 + - zlib state: latest update_cache: true @@ -300,6 +306,7 @@ symbol_level = 0 target_cpu = "x64" target_os = "linux" + use_brlapi = 0 use_sysroot = true v8_symbol_level = 0 v8_target_cpu = "x64" diff --git a/bin/chromium.br b/bin/chromium.br index 18cfac2..70eec45 100755 Binary files a/bin/chromium.br and b/bin/chromium.br differ diff --git a/bin/swiftshader.tar.br b/bin/swiftshader.tar.br index 5b4e2c1..9c3252e 100755 Binary files a/bin/swiftshader.tar.br and b/bin/swiftshader.tar.br differ diff --git a/package.json b/package.json index 8276f2c..7d722b1 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,13 @@ "preversion": "npm run build" }, "devDependencies": { - "@types/node": "^16.11.40", + "@types/node": "^16.11.45", "@types/tar-fs": "^2.0.1", - "puppeteer-core": "14.4.1", + "puppeteer-core": "15.5.0", "typescript": "^4.6.4" }, "peerDependencies": { - "puppeteer-core": "14.4.1" + "puppeteer-core": "15.5.0" }, "bugs": { "url": "https://github.com/Sparticuz/chrome-aws-lambda/issues" diff --git a/source/puppeteer/lib/ElementHandle.ts b/source/puppeteer/lib/ElementHandle.ts index 071a0fb..aa75fcf 100644 --- a/source/puppeteer/lib/ElementHandle.ts +++ b/source/puppeteer/lib/ElementHandle.ts @@ -1,12 +1,12 @@ -import { ElementHandle, EvaluateFn, HTTPRequest, HTTPResponse, Page, WaitForOptions, WaitTimeoutOptions } from 'puppeteer-core'; -import { KeysOfType, Prototype } from '../../../typings/chrome-aws-lambda'; +import { ElementHandle, EvaluateFunc, HTTPRequest, HTTPResponse, Page, WaitForOptions, WaitTimeoutOptions } from 'puppeteer-core'; +import { Prototype } from '../../../typings/chrome-aws-lambda'; let Super: Prototype = null; try { - Super = require('puppeteer/lib/cjs/puppeteer/common/JSHandle.js').ElementHandle; + Super = require('puppeteer/lib/cjs/puppeteer/common/ElementHandle.js').ElementHandle; } catch (error) { - Super = require('puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js').ElementHandle; + Super = require('puppeteer-core/lib/cjs/puppeteer/common/ElementHandle.js').ElementHandle; } Super.prototype.clear = function () { @@ -171,7 +171,7 @@ Super.prototype.fillFormByLabel = function , data) as any; + return this.evaluate(callback as unknown as EvaluateFunc<[ElementHandle, T]>, data) as any; }; Super.prototype.fillFormByName = function >(data: T) { @@ -262,7 +262,7 @@ Super.prototype.fillFormByName = function , data) as any; + return this.evaluate(callback as unknown as EvaluateFunc<[ElementHandle, T]>, data) as any; }; Super.prototype.fillFormBySelector = function >(data: T) { @@ -353,7 +353,7 @@ Super.prototype.fillFormBySelector = function , data) as any; + return this.evaluate(callback as unknown as EvaluateFunc<[ElementHandle, T]>, data) as any; }; Super.prototype.fillFormByXPath = function >(data: T) { @@ -450,7 +450,7 @@ Super.prototype.fillFormByXPath = function , data) as any; + return this.evaluate(callback as unknown as EvaluateFunc<[ElementHandle, T]>, data) as any; }; Super.prototype.getInnerHTML = function () { @@ -465,8 +465,8 @@ Super.prototype.getInnerText = function () { }); }; -Super.prototype.number = function (decimal: string = '.', property: KeysOfType = 'textContent' as any) { - let callback = (node: T, decimal: string, property: KeysOfType) => { +Super.prototype.number = function (decimal: string = '.', property: any) { + let callback = (node: any, decimal: string, property: any) => { let data = (node[property] as unknown) as string; if (typeof data === 'string') { @@ -486,7 +486,7 @@ Super.prototype.number = function (decimal: string = '.', prope return null; }; - return this.evaluate(callback as unknown as EvaluateFn, decimal, property as any); + return this.evaluate(callback, decimal, property as any); }; Super.prototype.selectByLabel = function (...values: string[]) { @@ -523,11 +523,11 @@ Super.prototype.selectByLabel = function (...values: string[]) { return result; }; - return this.evaluate(callback as unknown as EvaluateFn, values); + return this.evaluate(callback as any, values); }; -Super.prototype.string = function (property: KeysOfType = 'textContent' as any) { - let callback = (node: T, property: KeysOfType) => { +Super.prototype.string = function (property: any) { + let callback = (node: any, property: any) => { let data = (node[property] as unknown) as string; if (typeof data === 'string') { @@ -553,5 +553,5 @@ Super.prototype.string = function (property: KeysOfType, property as any); + return this.evaluate(callback, property as any); }; diff --git a/source/puppeteer/lib/FrameManager.ts b/source/puppeteer/lib/FrameManager.ts index ea8c530..bd1a381 100644 --- a/source/puppeteer/lib/FrameManager.ts +++ b/source/puppeteer/lib/FrameManager.ts @@ -1,4 +1,4 @@ -import { Frame, HTTPRequest, HTTPResponse, Page, WaitForOptions, WaitTimeoutOptions } from 'puppeteer-core'; +import { Frame, HTTPRequest, HTTPResponse, WaitForOptions, WaitTimeoutOptions } from 'puppeteer-core'; import { KeysOfType, Prototype } from '../../../typings/chrome-aws-lambda'; let Super: Prototype = null; @@ -44,7 +44,7 @@ Super.prototype.clickAndWaitForRequest = function (selector: string, predicate: }; let promises: [Promise, Promise] = [ - ((this._frameManager as any)._page as Page).waitForRequest((typeof predicate === 'function') ? predicate : callback, options), + this.page().waitForRequest((typeof predicate === 'function') ? predicate : callback, options), this.click(selector), ]; @@ -67,7 +67,7 @@ Super.prototype.clickAndWaitForResponse = function (selector: string, predicate: }; let promises: [Promise, Promise] = [ - ((this._frameManager as any)._page as Page).waitForResponse((typeof predicate === 'function') ? predicate : callback, options), + this.page().waitForResponse((typeof predicate === 'function') ? predicate : callback, options), this.click(selector), ]; diff --git a/typings/chrome-aws-lambda.d.ts b/typings/chrome-aws-lambda.d.ts index de4cee7..cbd8b92 100644 --- a/typings/chrome-aws-lambda.d.ts +++ b/typings/chrome-aws-lambda.d.ts @@ -127,7 +127,7 @@ declare module 'puppeteer-core' { * @param decimal - Decimal separator to use, defaults to `.`. * @param property - Element property to extract content from, defaults to `textContent`. */ - number(decimal?: string, property?: KeysOfType): Promise; + number(decimal?: string, property?: any): Promise; /** * Selects multiple `select` options by label and returns the values of the actual selection. @@ -141,7 +141,7 @@ declare module 'puppeteer-core' { * * @param property - Element property to extract content from, defaults to `textContent`. */ - string(property?: KeysOfType): Promise; + string(property?: any): Promise; } interface Frame { @@ -273,7 +273,7 @@ declare module 'puppeteer-core' { * @param predicate - String to wait for. * @param options - Optional waiting parameters. */ - waitForText(predicate: string, options?: WaitTimeoutOptions): Promise; + waitForText(predicate: string, options?: WaitTimeoutOptions): Promise>; /** * Waits for element to be present in DOM and to be visible. @@ -281,7 +281,7 @@ declare module 'puppeteer-core' { * @param selector - Selector to query for. * @param options - Optional waiting parameters. */ - waitUntilVisible(selector: string, options?: WaitTimeoutOptions): Promise; + waitUntilVisible(selector: string, options?: WaitTimeoutOptions): Promise>; /** * Waits for element to not be found in the DOM or to be hidden. @@ -289,7 +289,7 @@ declare module 'puppeteer-core' { * @param selector - Selector to query for. * @param options - Optional waiting parameters. */ - waitWhileVisible(selector: string, options?: WaitTimeoutOptions): Promise; + waitWhileVisible(selector: string, options?: WaitTimeoutOptions): Promise>; } interface Page { @@ -442,7 +442,7 @@ declare module 'puppeteer-core' { * @param predicate - String to wait for. * @param options - Optional waiting parameters. */ - waitForText(predicate: string, options?: WaitTimeoutOptions): Promise; + waitForText(predicate: string, options?: WaitTimeoutOptions): Promise>; /** * Waits for element to be present in DOM and to be visible. @@ -450,7 +450,7 @@ declare module 'puppeteer-core' { * @param selector - Selector to query for. * @param options - Optional waiting parameters. */ - waitUntilVisible(selector: string, options?: WaitTimeoutOptions): Promise; + waitUntilVisible(selector: string, options?: WaitTimeoutOptions): Promise>; /** * Waits for element to not be found in the DOM or to be hidden. @@ -458,7 +458,7 @@ declare module 'puppeteer-core' { * @param selector - Selector to query for. * @param options - Optional waiting parameters. */ - waitWhileVisible(selector: string, options?: WaitTimeoutOptions): Promise; + waitWhileVisible(selector: string, options?: WaitTimeoutOptions): Promise>; /** * Encapsulates the callback execution in a tracing session.