Remove most build-time require-calls from the src/display/-folder

By leveraging import maps we can get rid of *most* of the remaining `require`-calls in the `src/display/`-folder, since we should strive to use modern `import`-statements wherever possible.
The only remaining cases are Node.js-specific dependencies, since those seem very difficult to convert unless we start producing a bundle *specifically* for Node.js environments.
This commit is contained in:
Jonas Jenwald 2023-07-13 11:58:16 +02:00
parent e81c084a92
commit d022912719
11 changed files with 122 additions and 54 deletions

View file

@ -39,6 +39,7 @@ import {
} from "./display_utils.js";
import { AnnotationStorage } from "./annotation_storage.js";
import { ColorConverters } from "../shared/scripting_utils.js";
import { NullL10n } from "display-l10n_utils";
import { XfaLayer } from "./xfa_layer.js";
const DEFAULT_TAB_INDEX = 1000;
@ -2872,7 +2873,6 @@ class AnnotationLayer {
typeof PDFJSDev !== "undefined" &&
PDFJSDev.test("GENERIC && !TESTING")
) {
const { NullL10n } = require("pdfjs-web/l10n_utils.js");
this.l10n ||= NullL10n;
}
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) {