Drop Node 14 support
Node 14 is EOL April 2023. (The package should still work on Node 14 at this point)
This commit is contained in:
parent
af1b06318d
commit
4cd1bf5eac
|
|
@ -13,7 +13,7 @@
|
||||||
"build"
|
"build"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 14.18.0"
|
"node": ">= 16"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "make clean && make && make pretest && make test",
|
"test": "make clean && make && make pretest && make test",
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
"preversion": "npm run build"
|
"preversion": "npm run build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@tsconfig/node16-strictest": "^1.0.4",
|
||||||
"@types/node": "^18.11.18",
|
"@types/node": "^18.11.18",
|
||||||
"@types/tar-fs": "^2.0.1",
|
"@types/tar-fs": "^2.0.1",
|
||||||
"clean-modules": "^2.0.6",
|
"clean-modules": "^2.0.6",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { access, createWriteStream, existsSync, mkdirSync, symlink } from 'node:fs';
|
import { access, createWriteStream, existsSync, mkdirSync, symlink } from 'node:fs';
|
||||||
import { IncomingMessage } from 'node:http';
|
import type { IncomingMessage } from 'node:http';
|
||||||
import LambdaFS from './lambdafs';
|
import LambdaFS from './lambdafs';
|
||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
import { URL } from 'node:url';
|
import { URL } from 'node:url';
|
||||||
|
|
@ -38,15 +38,15 @@ interface Viewport {
|
||||||
hasTouch?: boolean;
|
hasTouch?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( process.env.AWS_EXECUTION_ENV !== undefined && /^AWS_Lambda_nodejs(?:14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
|
if ( process.env['AWS_EXECUTION_ENV'] !== undefined && /^AWS_Lambda_nodejs(?:14|16|18)[.]x$/.test(process.env['AWS_EXECUTION_ENV']) === true) {
|
||||||
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'].startsWith('/tmp/aws/lib') !== true) {
|
||||||
process.env.LD_LIBRARY_PATH = [...new Set(['/tmp/aws/lib', ...process.env.LD_LIBRARY_PATH.split(':')])].join(':');
|
process.env['LD_LIBRARY_PATH'] = [...new Set(['/tmp/aws/lib', ...process.env['LD_LIBRARY_PATH'].split(':')])].join(':');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,12 +62,12 @@ class Chromium {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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) => {
|
||||||
|
|
@ -76,7 +76,7 @@ class Chromium {
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = new URL(input);
|
const url = new URL(input);
|
||||||
const output = `${process.env.HOME}/.fonts/${url.pathname.split('/').pop()}`;
|
const output = `${process.env['HOME']}/.fonts/${url.pathname.split('/').pop()}`;
|
||||||
|
|
||||||
if (existsSync(output) === true) {
|
if (existsSync(output) === true) {
|
||||||
return resolve(output.split('/').pop() as string);
|
return resolve(output.split('/').pop() as string);
|
||||||
|
|
@ -213,7 +213,7 @@ class Chromium {
|
||||||
LambdaFS.inflate(`${input}/swiftshader.tar.br`),
|
LambdaFS.inflate(`${input}/swiftshader.tar.br`),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (process.env.AWS_EXECUTION_ENV !== undefined && /^AWS_Lambda_nodejs(?:14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
|
if (process.env['AWS_EXECUTION_ENV'] !== undefined && /^AWS_Lambda_nodejs(?:14|16|18)[.]x$/.test(process.env['AWS_EXECUTION_ENV']) === true) {
|
||||||
promises.push(LambdaFS.inflate(`${input}/aws.tar.br`));
|
promises.push(LambdaFS.inflate(`${input}/aws.tar.br`));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -227,10 +227,10 @@ class Chromium {
|
||||||
* False is returned if Serverless environment variables `IS_LOCAL` or `IS_OFFLINE` are set.
|
* False is returned if Serverless environment variables `IS_LOCAL` or `IS_OFFLINE` are set.
|
||||||
*/
|
*/
|
||||||
static get headless() {
|
static get headless() {
|
||||||
if (process.env.IS_LOCAL !== undefined || process.env.IS_OFFLINE !== undefined) {
|
if (process.env['IS_LOCAL'] !== undefined || process.env['IS_OFFLINE'] !== undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (process.env.NODE_ENV === "test") {
|
if (process.env['NODE_ENV'] === "test") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const environments = [
|
const environments = [
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,9 @@
|
||||||
{
|
{
|
||||||
|
"extends": "@tsconfig/node16-strictest/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "build",
|
"lib": ["dom"],
|
||||||
"esModuleInterop": true,
|
"outDir": "build"
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"lib": ["dom", "es2020"],
|
|
||||||
"module": "commonjs",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"outDir": "build",
|
|
||||||
"pretty": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"strict": true,
|
|
||||||
"target": "es2020",
|
|
||||||
},
|
},
|
||||||
"exclude": ["build", "node_modules", "tmp"],
|
|
||||||
"include": ["source"]
|
"include": ["source"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue