From 6d3506548dcd698e44c78cd114276cd4f242267a Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 7 Mar 2023 12:03:45 +0100 Subject: [PATCH] [api-minor] Update the minimum supported Node.js version to 16 This patch updates the minimum supported environments as follows: - Node.js 16, which was released on 2021-04-20; see https://en.wikipedia.org/wiki/Node.js#Releases Note also that Node.js 14 will very soon reach EOL, and thus no longer receive any security updates. --- gulpfile.js | 5 ++++- package-lock.json | 3 +++ package.json | 3 +++ src/shared/compatibility.js | 22 ---------------------- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 4c3a23be8..ac7b5185c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -82,7 +82,7 @@ const ENV_TARGETS = [ "Chrome >= 87", "Firefox ESR", "Safari >= 14.1", - "Node >= 14", + "Node >= 16", "> 1%", "not IE > 0", "not dead", @@ -2220,6 +2220,9 @@ function packageJson() { type: "git", url: DIST_REPO_URL, }, + engines: { + node: ">=16", + }, }; return createStringSource( diff --git a/package-lock.json b/package-lock.json index 9a2386de2..c5366186d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,6 +69,9 @@ "webpack-stream": "^7.0.0", "wintersmith": "^2.5.0", "yargs": "^17.6.2" + }, + "engines": { + "node": ">=16" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index b0ef3d90e..aa448863d 100644 --- a/package.json +++ b/package.json @@ -70,5 +70,8 @@ "type": "git", "url": "git://github.com/mozilla/pdf.js.git" }, + "engines": { + "node": ">=16" + }, "license": "Apache-2.0" } diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index de93497de..ba7787473 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -16,28 +16,6 @@ import { isNodeJS } from "./is_node.js"; -// Support: Node.js<16.0.0 -(function checkNodeBtoa() { - if (globalThis.btoa || !isNodeJS) { - return; - } - globalThis.btoa = function (chars) { - // eslint-disable-next-line no-undef - return Buffer.from(chars, "binary").toString("base64"); - }; -})(); - -// Support: Node.js<16.0.0 -(function checkNodeAtob() { - if (globalThis.atob || !isNodeJS) { - return; - } - globalThis.atob = function (input) { - // eslint-disable-next-line no-undef - return Buffer.from(input, "base64").toString("binary"); - }; -})(); - // Support: Node.js (function checkDOMMatrix() { if (globalThis.DOMMatrix || !isNodeJS) {