mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 06:38:07 +02:00
Move the various DOM-factories into their own files
- Over time the number and size of these factories have increased, especially the `DOMFilterFactory` class, and this split should thus aid readability/maintainability of the code. - By introducing a couple of new import maps we can avoid bundling the `DOMCMapReaderFactory`/`DOMStandardFontDataFactory` classes in the Firefox PDF Viewer, since they are dead code there given that worker-thread fetching is always being used. - This patch has been successfully tested, by running `$ ./mach test toolkit/components/pdfjs/`, in a local Firefox artifact-build. *Note:* This patch reduces the size of the `gulp mozcentral` output by `1.3` kilo-bytes, which isn't a lot but still cannot hurt.
This commit is contained in:
parent
06f3b2d0a6
commit
4e12906061
24 changed files with 1038 additions and 919 deletions
12
gulpfile.mjs
12
gulpfile.mjs
|
@ -191,6 +191,8 @@ function createWebpackAlias(defines) {
|
|||
"fluent-dom": "node_modules/@fluent/dom/esm/index.js",
|
||||
};
|
||||
const libraryAlias = {
|
||||
"display-cmap_reader_factory": "src/display/stubs.js",
|
||||
"display-standard_fontdata_factory": "src/display/stubs.js",
|
||||
"display-fetch_stream": "src/display/stubs.js",
|
||||
"display-network": "src/display/stubs.js",
|
||||
"display-node_stream": "src/display/stubs.js",
|
||||
|
@ -219,6 +221,10 @@ function createWebpackAlias(defines) {
|
|||
};
|
||||
|
||||
if (defines.CHROME) {
|
||||
libraryAlias["display-cmap_reader_factory"] =
|
||||
"src/display/cmap_reader_factory.js";
|
||||
libraryAlias["display-standard_fontdata_factory"] =
|
||||
"src/display/standard_fontdata_factory.js";
|
||||
libraryAlias["display-fetch_stream"] = "src/display/fetch_stream.js";
|
||||
libraryAlias["display-network"] = "src/display/network.js";
|
||||
|
||||
|
@ -231,6 +237,10 @@ function createWebpackAlias(defines) {
|
|||
// Aliases defined here must also be replicated in the paths section of
|
||||
// the tsconfig.json file for the type generation to work.
|
||||
// In the tsconfig.json files, the .js extension must be omitted.
|
||||
libraryAlias["display-cmap_reader_factory"] =
|
||||
"src/display/cmap_reader_factory.js";
|
||||
libraryAlias["display-standard_fontdata_factory"] =
|
||||
"src/display/standard_fontdata_factory.js";
|
||||
libraryAlias["display-fetch_stream"] = "src/display/fetch_stream.js";
|
||||
libraryAlias["display-network"] = "src/display/network.js";
|
||||
libraryAlias["display-node_stream"] = "src/display/node_stream.js";
|
||||
|
@ -1573,6 +1583,8 @@ function buildLibHelper(bundleDefines, inputStream, outputDir) {
|
|||
defines: bundleDefines,
|
||||
map: {
|
||||
"pdfjs-lib": "../pdf.js",
|
||||
"display-cmap_reader_factory": "./cmap_reader_factory.js",
|
||||
"display-standard_fontdata_factory": "./standard_fontdata_factory.js",
|
||||
"display-fetch_stream": "./fetch_stream.js",
|
||||
"display-network": "./network.js",
|
||||
"display-node_stream": "./node_stream.js",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue