diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 65b8647..d2ad908 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -12,10 +12,11 @@ For Playwright-specific bugs, please refer to: https://github.com/microsoft/play --> ## Environment -* `chromium` Version: -* `puppeteer` / `puppeteer-core` Version: -* Node.js Version: -* Lambda / GCF Runtime: + +- `chromium` Version: +- `puppeteer` / `puppeteer-core` Version: +- Node.js Version: +- Lambda / GCF Runtime: ## Expected Behavior diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml index f736290..2993af5 100644 --- a/.github/workflows/aws.yml +++ b/.github/workflows/aws.yml @@ -43,7 +43,6 @@ jobs: event: - example.com version: - - 14 - 16 - 18 steps: diff --git a/_/amazon/template.yml b/_/amazon/template.yml index 86b6da7..207ed91 100644 --- a/_/amazon/template.yml +++ b/_/amazon/template.yml @@ -12,21 +12,9 @@ Resources: LayerName: sparticuz-chromium ContentUri: code/ CompatibleRuntimes: - - nodejs14.x - nodejs16.x - nodejs18.x - node14: - Type: AWS::Serverless::Function - Properties: - Layers: - - !Ref layer - Handler: handlers/index.handler - Runtime: nodejs14.x - Policies: - - AWSLambdaBasicExecutionRole - - AWSXRayDaemonWriteAccess - Tracing: Active node16: Type: AWS::Serverless::Function Properties: diff --git a/_/ansible/inventory.ini b/_/ansible/inventory.ini index 16a0d84..f00da0f 100644 --- a/_/ansible/inventory.ini +++ b/_/ansible/inventory.ini @@ -14,4 +14,4 @@ instance_size=c6i.12xlarge ansible_connection=ssh ansible_python_interpreter=auto_silent ansible_ssh_private_key_file=ansible.pem -chromium_revision=1108766 +chromium_revision=1121455 diff --git a/bin/aws.tar.br b/bin/aws.tar.br old mode 100755 new mode 100644 diff --git a/bin/chromium.br b/bin/chromium.br old mode 100755 new mode 100644 index 4e500ff..ecbde43 Binary files a/bin/chromium.br and b/bin/chromium.br differ diff --git a/bin/swiftshader.tar.br b/bin/swiftshader.tar.br old mode 100755 new mode 100644 index 2143641..8392a08 Binary files a/bin/swiftshader.tar.br and b/bin/swiftshader.tar.br differ diff --git a/package-lock.json b/package-lock.json index eda0608..4df618d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,21 +13,28 @@ "tar-fs": "^2.1.1" }, "devDependencies": { - "@tsconfig/node14": "^1.0.3", + "@tsconfig/node16": "^1.0.3", + "@tsconfig/strictest": "^2.0.1", "@types/follow-redirects": "^1.14.1", - "@types/node": "^18.15.7", + "@types/node": "^18.16.3", "@types/tar-fs": "^2.0.1", "clean-modules": "^2.0.6", - "typescript": "^5.0.2" + "typescript": "^5.0.4" }, "engines": { - "node": ">= 14.18.0" + "node": ">= 16" } }, - "node_modules/@tsconfig/node14": { + "node_modules/@tsconfig/node16": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true + }, + "node_modules/@tsconfig/strictest": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/strictest/-/strictest-2.0.1.tgz", + "integrity": "sha512-7JHHCbyCsGUxLd0pDbp24yz3zjxw2t673W5oAP6HCEdr/UUhaRhYd3SSnUsGCk+VnPVJVA4mXROzbhI+nyIk+w==", "dev": true }, "node_modules/@types/follow-redirects": { @@ -40,9 +47,9 @@ } }, "node_modules/@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==", + "version": "18.16.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", + "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==", "dev": true }, "node_modules/@types/tar-fs": { @@ -537,9 +544,9 @@ } }, "node_modules/yargs": { - "version": "17.6.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", - "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", "dev": true, "dependencies": { "cliui": "^8.0.1", diff --git a/package.json b/package.json index a13a25f..a71c9dc 100644 --- a/package.json +++ b/package.json @@ -40,14 +40,15 @@ "tar-fs": "^2.1.1" }, "devDependencies": { - "@tsconfig/node14": "^1.0.3", + "@tsconfig/node16": "^1.0.3", + "@tsconfig/strictest": "^2.0.1", "@types/follow-redirects": "^1.14.1", - "@types/node": "^18.15.7", + "@types/node": "^18.16.3", "@types/tar-fs": "^2.0.1", "clean-modules": "^2.0.6", - "typescript": "^5.0.2" + "typescript": "^5.0.4" }, "engines": { - "node": ">= 14.18.0" + "node": ">= 16" } } diff --git a/source/helper.ts b/source/helper.ts index 5d1c673..1e9d2e1 100644 --- a/source/helper.ts +++ b/source/helper.ts @@ -23,8 +23,8 @@ export const isValidUrl = (input: string) => { */ export const isRunningInAwsLambda = () => { if ( - process.env.AWS_EXECUTION_ENV && - /^AWS_Lambda_nodejs/.test(process.env.AWS_EXECUTION_ENV) === true + process.env["AWS_EXECUTION_ENV"] && + /^AWS_Lambda_nodejs/.test(process.env["AWS_EXECUTION_ENV"]) === true ) { return true; } diff --git a/source/index.ts b/source/index.ts index b477168..79a5e63 100644 --- a/source/index.ts +++ b/source/index.ts @@ -45,15 +45,20 @@ interface Viewport { } if (isRunningInAwsLambda()) { - if (process.env.FONTCONFIG_PATH === undefined) { - process.env.FONTCONFIG_PATH = "/tmp/aws"; + if (process.env["FONTCONFIG_PATH"] === undefined) { + process.env["FONTCONFIG_PATH"] = "/tmp/aws"; } - if (process.env.LD_LIBRARY_PATH === undefined) { - process.env.LD_LIBRARY_PATH = "/tmp/aws/lib"; - } else if (process.env.LD_LIBRARY_PATH.startsWith("/tmp/aws/lib") !== true) { - process.env.LD_LIBRARY_PATH = [ - ...new Set(["/tmp/aws/lib", ...process.env.LD_LIBRARY_PATH.split(":")]), + if (process.env["LD_LIBRARY_PATH"] === undefined) { + process.env["LD_LIBRARY_PATH"] = "/tmp/aws/lib"; + } else if ( + process.env["LD_LIBRARY_PATH"].startsWith("/tmp/aws/lib") !== true + ) { + process.env["LD_LIBRARY_PATH"] = [ + ...new Set([ + "/tmp/aws/lib", + ...process.env["LD_LIBRARY_PATH"].split(":"), + ]), ].join(":"); } } @@ -77,12 +82,12 @@ class Chromium { * Downloads or symlinks a custom font and returns its basename, patching the environment so that Chromium can find it. */ static font(input: string): Promise { - if (process.env.HOME === undefined) { - process.env.HOME = "/tmp"; + if (process.env["HOME"] === undefined) { + process.env["HOME"] = "/tmp"; } - if (existsSync(`${process.env.HOME}/.fonts`) !== true) { - mkdirSync(`${process.env.HOME}/.fonts`); + if (existsSync(`${process.env["HOME"]}/.fonts`) !== true) { + mkdirSync(`${process.env["HOME"]}/.fonts`); } return new Promise((resolve, reject) => { @@ -91,7 +96,7 @@ class Chromium { } const url = new URL(input); - const output = `${process.env.HOME}/.fonts/${url.pathname + const output = `${process.env["HOME"]}/.fonts/${url.pathname .split("/") .pop()}`; @@ -143,7 +148,7 @@ class Chromium { */ static get args(): string[] { /** - * These are the default ares in puppeteer. + * These are the default args in puppeteer. * https://github.com/puppeteer/puppeteer/blob/3a31070d054fa3cd8116ca31c578807ed8d6f987/packages/puppeteer-core/src/node/ChromeLauncher.ts#L185 */ const puppeteerFlags = [ diff --git a/tsconfig.json b/tsconfig.json index f4578c8..5f03906 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,8 @@ { - "extends": "@tsconfig/node14/tsconfig.json", + "extends": [ + "@tsconfig/node16/tsconfig", + "@tsconfig/strictest" + ], "compilerOptions": { "declaration": true, "lib": [