1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

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 {
getDocument,
PDFDataRangeTransport,
PDFWorker,
SVGGraphics,
version,
} from "../../src/display/api.js";
import {
@ -110,10 +111,7 @@ describe("pdfjs_api", function () {
renderTextLayer,
setLayerDimensions,
shadow,
SVGGraphics:
typeof PDFJSDev !== "undefined" && PDFJSDev.test("LIB")
? require("../../display/svg.js").SVGGraphics
: null,
SVGGraphics,
UnexpectedResponseException,
updateTextLayer,
Util,

View file

@ -17,6 +17,13 @@
"pdfjs-web/": "../../web/",
"pdfjs-test/": "../",
"display-fetch_stream": "../../src/display/fetch_stream.js",
"display-l10n_utils": "../../src/display/stubs.js",
"display-network": "../../src/display/network.js",
"display-node_stream": "../../src/display/stubs.js",
"display-node_utils": "../../src/display/stubs.js",
"display-svg": "../../src/display/stubs.js",
"web-annotation_editor_params": "../../web/annotation_editor_params.js",
"web-com": "../../web/genericcom.js",
"web-pdf_attachment_viewer": "../../web/pdf_attachment_viewer.js",