1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

[api-minor] Update the minimum supported Node.js version to 18

This patch updates the minimum supported environments as follows:
 - Node.js 18, which was released on 2022-04-19; see https://en.wikipedia.org/wiki/Node.js#Releases

Note also that Node.js 16 will soon reach EOL, and thus no longer receive any security updates.
This commit is contained in:
Jonas Jenwald 2023-04-05 10:40:19 +02:00
parent eca40773b8
commit ed8be6f882
5 changed files with 9 additions and 41 deletions

View file

@ -133,14 +133,10 @@ class WorkerMessageHandler {
// Ensure that (primarily) Node.js users won't accidentally attempt to use
// a non-translated/non-polyfilled build of the library, since that would
// quickly fail anyway because of missing functionality.
if (
(isNodeJS && typeof Path2D === "undefined") ||
typeof ReadableStream === "undefined"
) {
if (isNodeJS && typeof Path2D === "undefined") {
const partialMsg =
"The browser/environment lacks native support for critical " +
"functionality used by the PDF.js library " +
"(e.g. `Path2D` and/or `ReadableStream`); ";
"functionality used by the PDF.js library (e.g. `Path2D`); ";
if (isNodeJS) {
throw new Error(partialMsg + "please use a `legacy`-build instead.");

View file

@ -36,17 +36,7 @@ import { isNodeJS } from "./is_node.js";
polyfillPath2D(globalThis);
})();
// Support: Node.js<18.0.0
(function checkReadableStream() {
if (globalThis.ReadableStream || !isNodeJS) {
return;
}
globalThis.ReadableStream = __non_webpack_require__(
"web-streams-polyfill/dist/ponyfill.js"
).ReadableStream;
})();
// Support: Firefox<90, Chrome<92, Safari<15.4, Node.js<16.6.0
// Support: Chrome<92, Safari<15.4
(function checkArrayAt() {
if (Array.prototype.at) {
return;
@ -54,7 +44,7 @@ import { isNodeJS } from "./is_node.js";
require("core-js/es/array/at.js");
})();
// Support: Firefox<90, Chrome<92, Safari<15.4, Node.js<16.6.0
// Support: Chrome<92, Safari<15.4
(function checkTypedArrayAt() {
if (Uint8Array.prototype.at) {
return;
@ -62,7 +52,7 @@ import { isNodeJS } from "./is_node.js";
require("core-js/es/typed-array/at.js");
})();
// Support: Firefox<94, Chrome<98, Safari<15.4, Node.js<17.0.0
// Support: Chrome<98, Safari<15.4
(function checkStructuredClone() {
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
// The current image decoders are synchronous, hence `structuredClone`