Commit Graph

12 Commits

Author SHA1 Message Date
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