Drop node 14 support
This commit is contained in:
parent
ffc8ec4c1d
commit
0786301a85
|
|
@ -12,10 +12,11 @@ For Playwright-specific bugs, please refer to: https://github.com/microsoft/play
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## Environment
|
## Environment
|
||||||
* `chromium` Version:
|
|
||||||
* `puppeteer` / `puppeteer-core` Version:
|
- `chromium` Version:
|
||||||
* Node.js Version: <!-- 14.x | 16.x -->
|
- `puppeteer` / `puppeteer-core` Version:
|
||||||
* Lambda / GCF Runtime: <!-- `nodejs8.10` | `nodejs10.x` | `nodejs12.x` -->
|
- Node.js Version: <!-- 16.x | 18.x -->
|
||||||
|
- Lambda / GCF Runtime: <!-- `nodejs16` | `nodejs18.x` -->
|
||||||
|
|
||||||
## Expected Behavior
|
## Expected Behavior
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,21 +12,9 @@ Resources:
|
||||||
LayerName: sparticuz-chromium
|
LayerName: sparticuz-chromium
|
||||||
ContentUri: code/
|
ContentUri: code/
|
||||||
CompatibleRuntimes:
|
CompatibleRuntimes:
|
||||||
- nodejs14.x
|
|
||||||
- nodejs16.x
|
- nodejs16.x
|
||||||
- nodejs18.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:
|
node16:
|
||||||
Type: AWS::Serverless::Function
|
Type: AWS::Serverless::Function
|
||||||
Properties:
|
Properties:
|
||||||
|
|
|
||||||
|
|
@ -13,21 +13,28 @@
|
||||||
"tar-fs": "^2.1.1"
|
"tar-fs": "^2.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node14": "^1.0.3",
|
"@tsconfig/node16": "^1.0.3",
|
||||||
|
"@tsconfig/strictest": "^2.0.1",
|
||||||
"@types/follow-redirects": "^1.14.1",
|
"@types/follow-redirects": "^1.14.1",
|
||||||
"@types/node": "^18.15.7",
|
"@types/node": "^18.16.3",
|
||||||
"@types/tar-fs": "^2.0.1",
|
"@types/tar-fs": "^2.0.1",
|
||||||
"clean-modules": "^2.0.6",
|
"clean-modules": "^2.0.6",
|
||||||
"typescript": "^5.0.2"
|
"typescript": "^5.0.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 14.18.0"
|
"node": ">= 16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tsconfig/node14": {
|
"node_modules/@tsconfig/node16": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
||||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
"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
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/follow-redirects": {
|
"node_modules/@types/follow-redirects": {
|
||||||
|
|
@ -40,9 +47,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "18.15.7",
|
"version": "18.16.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz",
|
||||||
"integrity": "sha512-LFmUbFunqmBn26wJZgZPYZPrDR1RwGOu2v79Mgcka1ndO6V0/cwjivPTc4yoK6n9kmw4/ls1r8cLrvh2iMibFA==",
|
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/tar-fs": {
|
"node_modules/@types/tar-fs": {
|
||||||
|
|
@ -488,9 +495,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.0.2",
|
"version": "5.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
||||||
"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
|
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
|
|
@ -537,9 +544,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/yargs": {
|
"node_modules/yargs": {
|
||||||
"version": "17.6.2",
|
"version": "17.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz",
|
||||||
"integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==",
|
"integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cliui": "^8.0.1",
|
"cliui": "^8.0.1",
|
||||||
|
|
|
||||||
|
|
@ -40,14 +40,15 @@
|
||||||
"tar-fs": "^2.1.1"
|
"tar-fs": "^2.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node14": "^1.0.3",
|
"@tsconfig/node16": "^1.0.3",
|
||||||
|
"@tsconfig/strictest": "^2.0.1",
|
||||||
"@types/follow-redirects": "^1.14.1",
|
"@types/follow-redirects": "^1.14.1",
|
||||||
"@types/node": "^18.15.7",
|
"@types/node": "^18.16.3",
|
||||||
"@types/tar-fs": "^2.0.1",
|
"@types/tar-fs": "^2.0.1",
|
||||||
"clean-modules": "^2.0.6",
|
"clean-modules": "^2.0.6",
|
||||||
"typescript": "^5.0.2"
|
"typescript": "^5.0.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 14.18.0"
|
"node": ">= 16"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ export const isValidUrl = (input: string) => {
|
||||||
*/
|
*/
|
||||||
export const isRunningInAwsLambda = () => {
|
export const isRunningInAwsLambda = () => {
|
||||||
if (
|
if (
|
||||||
process.env.AWS_EXECUTION_ENV &&
|
process.env["AWS_EXECUTION_ENV"] &&
|
||||||
/^AWS_Lambda_nodejs/.test(process.env.AWS_EXECUTION_ENV) === true
|
/^AWS_Lambda_nodejs/.test(process.env["AWS_EXECUTION_ENV"]) === true
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,15 +45,20 @@ interface Viewport {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRunningInAwsLambda()) {
|
if (isRunningInAwsLambda()) {
|
||||||
if (process.env.FONTCONFIG_PATH === undefined) {
|
if (process.env["FONTCONFIG_PATH"] === undefined) {
|
||||||
process.env.FONTCONFIG_PATH = "/tmp/aws";
|
process.env["FONTCONFIG_PATH"] = "/tmp/aws";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.LD_LIBRARY_PATH === undefined) {
|
if (process.env["LD_LIBRARY_PATH"] === undefined) {
|
||||||
process.env.LD_LIBRARY_PATH = "/tmp/aws/lib";
|
process.env["LD_LIBRARY_PATH"] = "/tmp/aws/lib";
|
||||||
} else if (process.env.LD_LIBRARY_PATH.startsWith("/tmp/aws/lib") !== true) {
|
} else if (
|
||||||
process.env.LD_LIBRARY_PATH = [
|
process.env["LD_LIBRARY_PATH"].startsWith("/tmp/aws/lib") !== true
|
||||||
...new Set(["/tmp/aws/lib", ...process.env.LD_LIBRARY_PATH.split(":")]),
|
) {
|
||||||
|
process.env["LD_LIBRARY_PATH"] = [
|
||||||
|
...new Set([
|
||||||
|
"/tmp/aws/lib",
|
||||||
|
...process.env["LD_LIBRARY_PATH"].split(":"),
|
||||||
|
]),
|
||||||
].join(":");
|
].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.
|
* Downloads or symlinks a custom font and returns its basename, patching the environment so that Chromium can find it.
|
||||||
*/
|
*/
|
||||||
static font(input: string): Promise<string> {
|
static font(input: string): Promise<string> {
|
||||||
if (process.env.HOME === undefined) {
|
if (process.env["HOME"] === undefined) {
|
||||||
process.env.HOME = "/tmp";
|
process.env["HOME"] = "/tmp";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existsSync(`${process.env.HOME}/.fonts`) !== true) {
|
if (existsSync(`${process.env["HOME"]}/.fonts`) !== true) {
|
||||||
mkdirSync(`${process.env.HOME}/.fonts`);
|
mkdirSync(`${process.env["HOME"]}/.fonts`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
@ -91,7 +96,7 @@ class Chromium {
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = new URL(input);
|
const url = new URL(input);
|
||||||
const output = `${process.env.HOME}/.fonts/${url.pathname
|
const output = `${process.env["HOME"]}/.fonts/${url.pathname
|
||||||
.split("/")
|
.split("/")
|
||||||
.pop()}`;
|
.pop()}`;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
"extends": [
|
||||||
|
"@tsconfig/node16/tsconfig",
|
||||||
|
"@tsconfig/strictest"
|
||||||
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"lib": [
|
"lib": [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue