Commit Graph

76 Commits

Author SHA1 Message Date
Jonas Jenwald
8158628a90 [api-minor] Stop building a minified default viewer
The minified default viewer has never been distributed in either official releases or through pdfjs-dist, which means that it's most likely unused, and it's has never been tested nor actively maintained.
2023-10-06 12:12:30 +02:00
Jonas Jenwald
3ced0dec1b [api-major] Remove the SVG back-end (PR 15173 follow-up)
This has been deprecated since version `2.15.349`, which is a year ago.
Removing this will also simplify some upcoming changes, specifically outputting of JavaScript modules in the builds.
2023-10-01 23:14:29 +02:00
Calixte Denizet
0d9aef1a5e Add alt-text svg images to the dist (issue #17044) 2023-10-01 16:47:34 +02:00
Jonas Jenwald
7413546e16 Remove comments from the *built* CSS files
The old pre-processor used for CSS, and HTML, files leaves comments intact which unnecessarily contributes to the overall size of the *built* CSS files (note that the built JavaScript files don't include comments).
Rather than trying to "hack" comment removal into the pre-processor it seems easier to use a PostCSS plugin instead. The one potential issue is that it also affects *some* whitespaces, and it's not clear to me if this'll work with the various CSS-related tests that run in mozilla-central.

Please refer to https://www.npmjs.com/package/postcss-discard-comments for additional information.
2023-09-26 13:38:26 +02:00
Jonas Jenwald
5711d0f95d [GeckoView] Exclude annotation_editor_layer_builder.css in the build (issue 16994)
Given the limitations of the old pre-processor that's used for CSS/HTML files, this unfortunately isn't as "easy" to implement as it is for JavaScript code.
Since this is the first case where we've wanted to do conditional CSS imports, rather than trying to completely re-write the pre-processor, this patch settles for handling it explicitly in the `expandCssImports` function.
2023-09-21 15:51:33 +02:00
Jonas Jenwald
e2b7896826 [GeckoView] Avoid bundling the AltTextManager class, since it's unused 2023-09-21 12:51:34 +02:00
Tim van der Meij
f42d70a24e
Update packages 2023-09-09 17:53:43 +02:00
Christophe Coevoet
46f2c5893d Revert "Temporarily stop running gulp typestest in GitHub Actions"
This reverts commit d9350c3899.
2023-09-01 09:48:39 +02:00
Christophe Coevoet
d0f14b1ce3 Add support for the import map in the type generator
The typescript compiler is now configured to know about the import map
to be able to resolve those imports and find the associated types.
As tsc outputs declaration files using the original module identifiers
and not the resolved ones, tsc-alias is used to post-process the
declaration files by resolving those paths.
2023-09-01 09:48:39 +02:00
Christophe Coevoet
bbf11a5783 Migrate the typescript options to a config file
Some configurations settings like `paths` cannot be provided through CLI
arguments but only in a configuration file. And when using a
configuration file, only a few options (like `--outDir` can still be
provided) through the CLI.
2023-09-01 09:48:34 +02:00
Jonas Jenwald
c5ebfa51a7 Update npm packages 2023-08-19 09:08:11 +02:00
Jonas Jenwald
6669a99299 Remove the "no-babel-preset" comment used with the LIB build-target (PR 16829 follow-up)
Similar to the changes in PR 16829, this no longer seems necessary now.
2023-08-13 08:55:58 +02:00
Jonas Jenwald
1810191be2 Remove the src/core/ Babel excludes, since they no longer seem necessary
- The `src/core/unicode.js` exclude ought to have become unnecessary already with PR 16200, which significantly shortened and simplified that file.
 - The `src/core/glyphlist.js` exclude no longer seems necessary in practice either, possibly because of improvements in Babel.
2023-08-12 10:09:03 +02:00
Calixte Denizet
aa71619c2d [Editor] Fix the resizing of an editor when it's rotated (bug 1847268)
There are 2 rotation we've to deal with: the viewer one and the editor one.
The previous implementation was a bit complex and having to deal with these
rotation would have potentially increase it.
So this patch aims to simplify the implementation and deal with all the possible
cases.
The main idea is to transform the mouse deltas according to the rotations and then
apply the resizing in the page coordinates system.
2023-08-08 12:54:12 +02:00
Tim van der Meij
b67c60922f
Merge pull request #16790 from Snuffleupagus/addGlobalExports
Attempt to expose e.g. `pdfjsLib` globally regardless of how the library is imported (issue 16778)
2023-08-06 12:58:58 +02:00
Jonas Jenwald
d50237da3c Update npm packages 2023-08-06 09:25:30 +02:00
Jonas Jenwald
42e6243ebf Attempt to expose e.g. pdfjsLib globally regardless of how the library is imported (issue 16778)
We obviously don't want to re-introduce any `require` usage in e.g. the viewer, since we should strive to only use native `import` statements wherever possible.[1]
Hopefully exposing e.g. the library globally in more cases won't break anything, however it's somewhat difficult for me to imagine all the ways in which third-party users may be accessing the PDF.js library. (Given the lack of a runnable test-case in the issue, I also cannot guarantee that this is enough to fully address the problem.)

---
[1] Ideally we should probably not rely on e.g. `pdfjsLib` being globally available in the *built* viewer, and rather always `import` the library instead.
Unfortunately this would require larger (possibly breaking) changes in the builds that we provide, however note that Firefox only recently got support for `import` in workers and that Webpack still only have *experimental* support for outputting "proper" modules.
2023-08-03 12:53:27 +02:00
Jonas Jenwald
e77c7f336d [GeckoView] Bundle the Firefox printing code in the viewer (bug 1810111)
This may not be enough, on its own, to completely fix [bug 1810111](https://bugzilla.mozilla.org/show_bug.cgi?id=1810111) however it's impossible for printing to work in GeckoView without this patch.
2023-07-28 14:10:40 +02:00
Tim van der Meij
b7b3636ec2
Remove the vinyl-fs dependency
In Gulp 4, which we use for years now, the `gulp.src()` function
supports the `removeBOM` option to disable the default BOM stripping,
so this commit uses that to get rid of our `vinyl-fs` dependency.

Note that this actually makes disabling BOM stripping work again. It's
currently broken because in `vinyl-fs` 3, that we already use since 2018
in commit 95de23e, the `stripBOM` option was renamed to `removeBOM`, so
the current code doesn't actually disable BOM stripping which we now
confirmed and sadly broke for years without anyone noticing. Most likely
this is because the BOM is not required for UTF-8 documents, but while
not necessary it also can't hurt to have it for tools that use it to
determine if a document is UTF-8.
2023-07-23 18:33:20 +02:00
Jonas Jenwald
198f89ffce Update Stylelint to the latest version
Trying to update Stylelint to version `15.10.1`, and beyond, broke linting. Looking at the changes the issue appears to be that the `bin/stylelint.js` file was replaced with `bin/stylelint.mjs` instead, which our `gulp lint` runner wasn't able to automatically find; see https://github.com/stylelint/stylelint/compare/15.10.0...15.10.1
2023-07-22 11:34:14 +02:00
Jonas Jenwald
d9350c3899 Temporarily stop running gulp typestest in GitHub Actions
This is necessary to unblock the previous patch, which removes more build-time `require`-calls from the `src/display/` folder.
2023-07-18 09:07:32 +02:00
Jonas Jenwald
d022912719 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.
2023-07-17 19:47:13 +02:00
Jonas Jenwald
67303b16f1 [api-minor] Let Babel handle the necessary core-js polyfills automatically
In the last couple of years we've been quicker to remove support for older browsers/environments, which means that at this point in time we don't bundle that many polyfills. (The polyfills are also generally simpler nowadays, ever since we removed support for e.g. Internet Explorer.)
Rather than having to *manually* handle the polyfills, we can actually let Babel take care of bundling the necessary polyfills for us; please refer to https://babeljs.io/docs/babel-preset-env

The only exception here is the Node.js-specific compatibility-code, which is moved into the `src/display/node_utils.js` file. This ought to be fine since workers are not available/used in Node.js-environments.

*Please note:* For the `legacy`-builds this will increase the size of the *built* files, however that seems like a very small price to pay in order to simplify maintenance of the general PDF.js library.
2023-07-17 16:42:08 +02:00
Jonas Jenwald
337cba736e [ESM] Remove the remaining require from the gulpfile 2023-07-16 08:51:46 +02:00
Jonas Jenwald
5174232326 [ESM] Convert the external/builder/-folder to use standard modules 2023-07-11 11:38:59 +02:00
Jonas Jenwald
0bc9012b8f [ESM] Convert the gulpfile to use standard modules
This is a necessary intermediate step to allow converting files in the `external/builder/` folder.
2023-07-09 15:58:19 +02:00