[GeckoView] Reduce the size of the *built* viewer

Given that the GV-viewer isn't using most of the UI-related components of the default-viewer, we can avoid including them in the *built* viewer to save space.[1]
The least "invasive" way of implementing this, at least that I could come up with, is to leverage import maps with suitable stubs for the GV-viewer.

The one slightly annoying thing is that we now have larger import maps across multiple html-files, and you'll need to remember to update all of them when making future changes.

---
[1] With this patch, the built `viewer.js` size is 391 kB and `viewer-geckoview.js` is 285 kB.
This commit is contained in:
Jonas Jenwald 2023-02-04 13:55:12 +01:00
parent 05d821e680
commit a98e80c4ff
10 changed files with 150 additions and 34 deletions

View file

@ -74,6 +74,12 @@ const SpreadMode = {
EVEN: 2,
};
const CursorTool = {
SELECT: 0, // The default value.
HAND: 1,
ZOOM: 2,
};
// Used by `PDFViewerApplication`, and by the API unit-tests.
const AutoPrintRegExp = /\bprint\s*\(/;
@ -852,6 +858,7 @@ export {
AutoPrintRegExp,
backtrackBeforeAllVisibleElements, // only exported for testing
binarySearchFirstItem,
CursorTool,
DEFAULT_SCALE,
DEFAULT_SCALE_DELTA,
DEFAULT_SCALE_VALUE,