mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Add support for modern ECMAScript class
features
With ESLint 8 we should now finally be able to start using modern `class` features, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields However, while both ESLint and Acorn now support this, it unfortunately turns out that Escodegen (which we use during building) still lack the necessary support. Looking at https://github.com/estools/escodegen there's not been any updates since last year, and there's also open PRs adding support for these new `class` features. To avoid blocking usage of these `class` features in the PDF.js code-base, in particular *private* fields/methods, this patch thus proposes that we (hopefully temporarily) switch to an `escodegen` fork that has the necessary support; please see https://www.npmjs.com/package/@javascript-obfuscator/escodegen While I have no reason to doubt the security of the `escodegen` fork, this patch nonetheless pins the version number. Furthermore, I've also diffed the output of the two `.js`-files in this forked package against the original files without finding anything that looks immediately "dangerous".
This commit is contained in:
parent
38e5360533
commit
00f8fab8a5
8 changed files with 35 additions and 35 deletions
4
external/builder/preprocessor2.js
vendored
4
external/builder/preprocessor2.js
vendored
|
@ -1,14 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
const acorn = require("acorn");
|
||||
const escodegen = require("escodegen");
|
||||
const escodegen = require("@javascript-obfuscator/escodegen");
|
||||
const vm = require("vm");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const PDFJS_PREPROCESSOR_NAME = "PDFJSDev";
|
||||
const ROOT_PREFIX = "$ROOT/";
|
||||
const ACORN_ECMA_VERSION = 2021;
|
||||
const ACORN_ECMA_VERSION = 2022;
|
||||
|
||||
function isLiteral(obj, value) {
|
||||
return obj.type === "Literal" && obj.value === value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue