Commit Graph

298 Commits

Author SHA1 Message Date
Jonas Jenwald
07ba352903 Update npm packages 2023-01-28 08:13:13 +01:00
Jonas Jenwald
32357e3d17 Update rimraf to version 4
The primary change is that the `rimraf` function now returns a Promise instead of taking a callback; please see https://github.com/isaacs/rimraf#major-changes-from-v3-to-v4
2023-01-15 15:38:30 +01:00
Jonas Jenwald
d527bd0d92 Update npm packages 2023-01-15 10:34:56 +01:00
Jonas Jenwald
492ce090bd Update npm packages 2022-12-25 12:59:34 +01:00
Jonas Jenwald
69a2e6d3ea Update npm packages 2022-11-27 10:18:30 +01:00
Jonas Jenwald
fbcc20adb7 Update npm packages 2022-11-13 21:28:21 +01:00
Jonas Jenwald
f6746854ac Update npm packages 2022-10-29 11:34:43 +02:00
Jonas Jenwald
7bd484ebd3 Update npm packages 2022-10-16 09:38:58 +02:00
Tim van der Meij
b0725e75c6
Update dependencies to the most recent versions 2022-10-01 18:04:29 +02:00
Jonas Jenwald
c894be92fb Replace the DOMMatrix polyfill, used with Node.js, with the one from node-canvas
Fewer dependencies shouldn't be a bad idea in general, and given that the `node-canvas` package already include a `DOMMatrix` polyfill we can simply use that one instead.
2022-09-27 12:12:50 +02:00
Jonas Jenwald
6a9e584215 Update npm packages 2022-09-18 10:31:32 +02:00
Jonas Jenwald
21042371e6 Update npm packages 2022-09-04 10:16:40 +02:00
Tim van der Meij
81a700079f
Merge pull request #15332 from Snuffleupagus/Babel-targets
[api-minor] Add the Babel `targets`-option to avoid transpiling code for unsupported browsers
2022-08-21 12:06:43 +02:00
Jonas Jenwald
1001ae5474 Update npm packages 2022-08-21 10:04:47 +02:00
Jonas Jenwald
6e31799948 [api-minor] Add the Babel targets-option to avoid transpiling code for unsupported browsers
Currently we simply use the Babel `preset-env` in the `legacy`-builds of the PDF.js library. This has the side-effect of transpiling the code for *very old* browsers/environments, including ones that we (since many years) no longer support which unnecessarily bloats the size of the `legacy`-builds.

For the CSS files we're only targeting *the supported browsers*, and it's thus possible to extend that to also apply to Babel.
One of the most significant changes, with this patch, is that we'll no longer polyfill `async`/`await` in the `legacy`-builds. However, this shouldn't be an issue given the browsers that we currently support in PDF.js; please refer to:
 - https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function#browser_compatibility
2022-08-19 22:19:43 +02:00
Jonas Jenwald
887e893fc8 Update npm packages 2022-08-07 10:20:21 +02:00
Jonas Jenwald
878e2f726a Update npm packages 2022-07-24 08:54:23 +02:00
dependabot[bot]
a5b50d06bd
Bump terser from 5.14.1 to 5.14.2
Bumps [terser](https://github.com/terser/terser) from 5.14.1 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-21 06:01:41 +00:00
Jonas Jenwald
dd10f6397f Update npm packages 2022-07-10 10:43:08 +02:00
Jonas Jenwald
345bb18575 [editor] Use the fit-curve package (issue 15004)
Rather than including all of this external code in the PDF.js repository, we should be using the npm package instead.
Unfortunately this is slightly more complicated than you'd hope, since the `fit-curve` package (which is older) isn't directly compatible with modern JavaScript modules.
In particular, the following cases needed to be considered:
 - For the development viewer (i.e. `gulp server`) and the unit-tests, we thus need to build a fitCurve-bundle that can be directly `import`ed.
 - For the actual PDF.js build-targets, we can slightly reduce the sizes by depending on the "raw" `fit-curve` source-code.
 - For the Node.js unit-tests, the `fit-curve` package can be used as-is.
2022-07-07 10:43:43 +02:00
Tim van der Meij
38daef065a
Update dependencies to the most recent versions
Note that even though Puppeteer got a major version bump the changelog
doesn't include compatibility changes that are relevant to us; please
see https://github.com/puppeteer/puppeteer/releases.
2022-06-25 16:28:44 +02:00
Jonas Jenwald
f052a12968 Update npm packages 2022-06-12 14:02:31 +02:00
Jonas Jenwald
a7d2d8d929 Update npm packages 2022-05-29 09:37:24 +02:00
Jonas Jenwald
5320316f73 Update npm packages 2022-05-15 09:07:35 +02:00
Tim van der Meij
3af52dacb5
Pin the es-module-shims dependency to version 1.4.7
Unfortunately newer versions either caused breakage when running the
unit tests manually in a browser or when serving the development viewer.
Given that we hope to use native import maps soon and this dependency
will then be removed anyway, let's pin it for the time being.
2022-05-01 14:05:30 +02:00
Tim van der Meij
dacd61fede
Update dependencies to the most recent versions
There are two notable changes here:

- `dommatrix` is a major version upgrade, but looking through the commit
  history of their `package.json` file at https://github.com/thednp/dommatrix/commits/master/package.json
  (due to the lack of a changelog) I couldn't find any breaking changes.
- `es-module-shims` is a regular update, but it was previously pinned
  for causing intermittent breakage when running the unit tests in a
  browser manually. Fortunately this cannot be reproduced anymore with
  the most recent version, so we can also put the caret back now.
2022-05-01 13:08:00 +02:00
Jonas Jenwald
49d1121f3c Update npm packages 2022-04-17 10:15:10 +02:00
Jonas Jenwald
b996e107c3 Update core-js to allow removing a structuredClone work-around
Because of a bug in previous `core-js` versions, which caused an Error to be thrown if its `structuredClone` polyfill was called with an *explicit* `null`/`undefined` transfer-parameter, the `LoopbackPort`-class contained a work-around.
In the latest `core-js` version this has been fixed, and we can thus simplify our code ever so slightly; please see https://github.com/zloirock/core-js/releases/tag/v3.22.0
2022-04-15 22:12:02 +02:00
Tim van der Meij
c04373dda2
Update dependencies to the most recent versions 2022-04-02 19:43:34 +02:00
Jonas Jenwald
c9f262c480 Add a <dialog> polyfill for the generic-legacy build
Please note that this patch is purposely quite basic, e.g. it doesn't add the polyfill-CSS in order to simplify the build process, and things such as `::backdrop` thus isn't working.
However, this patch does ensure that older browsers can at least still *access* all of the previous overlays and that things like e.g. opening of password-protected documents respectively printing still works.
2022-03-28 11:36:31 +02:00
Jonas Jenwald
73d2ddac0d Update npm packages
Note that the Prettier update made it possible to move a couple of comments after `default:`-cases back to their original/intended positions, please see https://prettier.io/blog/2022/03/16/2.6.0.html
2022-03-20 10:59:13 +01:00
Jonas Jenwald
502fd7c80d Stop polyfilling the CSS calc functionality
At this point in time, all browsers that we support have native support for CSS variables; please see https://developer.mozilla.org/en-US/docs/Web/CSS/calc()#browser_compatibility and https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support

We can also remove the hack introduced back in PR 11567, which was only necessary to work-around an IE 11 specific bug.
2022-03-19 14:03:19 +01:00
Jonas Jenwald
c99d558646 Replace dir-dependent margin/margin-left/margin-right with logical properties
*Please note:* This is another step in what will, time permitting, become a series of patches to simplify/modernize the viewer CSS.

Rather than having to manually specify ltr/rtl-specific margin-values in the CSS, we can use logical margin instead (and similar for some related left/right occurrences).
These logical properties depend on, among other things, the direction of the HTML document which we *always* specify in the viewer.

Given that most of these logical CSS properties are fairly new, and that cross-browser support is thus somewhat limited (see below), we need to use a couple of PostCSS plugins (see below) in order to support this in the GENERIC viewer.

 - https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-start#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-end#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-start#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-end#browser_compatibility

---

 - https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-logical
 - https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-dir-pseudo-class
2022-03-19 13:35:24 +01:00
Jonas Jenwald
6f600befdd Update TypeScript to version 4.6.2 and work-around stricter type checks
I'm guessing that we're now running into the class-related improvements mentioned in https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/#target-es2022
To unblock this update, and any future ones, this patch simply tweaks the JSDocs to get `gulp typestest` to run without errors.
2022-03-07 11:55:17 +01:00
Jonas Jenwald
b875f13b4f Update npm packages 2022-03-06 10:45:23 +01:00
Jonas Jenwald
896255e7bf Add the caniuse-lite package
Since the Autoprefixer plugin indirectly depends on this, it seems like a good idea to add this as a direct dependency in the PDF.js project to hopefully avoid having to manually update `caniuse-lite` in the future; see https://github.com/browserslist/browserslist#browsers-data-updating

Also, slightly tweaks the Autoprefixer config for GENERIC-builds of the PDF.js library; note that this change doesn't affect the contents of the *built* `web/viewer.js` file.
2022-02-27 11:39:33 +01:00
Jonas Jenwald
55b78bb240 Update npm packages 2022-02-20 10:08:23 +01:00
Jonas Jenwald
38f6e675bc Update the @javascript-obfuscator/escodegen package to the latest version
The only changes are support for [Class static initialization blocks](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Class_static_initialization_blocks), and the diff for the `node_modules\@javascript-obfuscator\escodegen\escodegen.js` file contains only:
```diff
@@ -1506,6 +1506,13 @@
             return result;
         },

+        StaticBlock: function (stmt, flags) {
+            return [
+                'static' + space,
+                this.BlockStatement(stmt, flags)
+            ];
+        },
+
         ThrowStatement: function (stmt, flags) {
             return [join(
                 'throw',
```
2022-02-06 11:26:07 +01:00
Jonas Jenwald
5f7b96c957 Update npm packages 2022-02-06 11:24:14 +01:00
Jonas Jenwald
7cc761a8c0 Polyfill structuredClone with core-js (PR 13948 follow-up)
This allows us to remove the manually implemented `structuredClone` polyfill, thus reducing the maintenance burden for the `LoopbackPort` class; refer to https://github.com/zloirock/core-js#structuredclone

*Please note:* While `structuredClone` support landed already in Firefox 94, Google Chrome only added it in version 98 (currently in Beta). However, given that the `LoopbackPort` will only be used together with *fake workers* in browsers this shouldn't be too much of a problem.[1]
For Node.js environments, where *fake workers* are unfortunately necessary, using a `legacy/`-build is already required which thus guarantees that the `structuredClone` polyfill is available.

Also, the patch updates core-js to the latest version since that one includes `structuredClone` improvements; please see https://github.com/zloirock/core-js/releases/tag/v3.20.3

---
[1] Given that we only support browsers with proper worker support, if *fake workers* are being used that essentially indicates a configuration problem/error.
2022-01-27 21:11:42 +01:00
Jonas Jenwald
2fcd07f400 Update Puppeteer to version 13.1.2
Note in particular https://github.com/puppeteer/puppeteer/releases/tag/v13.1.0 which includes an update to Chromium 98, which adds support for `structuredClone` in the browser.
2022-01-27 21:10:46 +01:00
Jonas Jenwald
1ed27965d1 Update npm packages 2022-01-23 10:58:15 +01:00
Jonas Jenwald
457ff0d54a Update Jasmine to version 4
For the unit-tests that were updated in this patch, note that I settled on simply using `toEqual` comparisons rather than updating the custom matchers (since those don't seem necessary any more).

Please refer to the following resources for additional information:
 - https://github.com/jasmine/jasmine/blob/main/release_notes/4.0.0.md
 - https://github.com/jasmine/jasmine-npm/blob/main/release_notes/4.0.0.md
 - https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0
2022-01-09 11:32:34 +01:00
Jonas Jenwald
38e574f1d5 Update npm packages 2022-01-09 10:49:21 +01:00
Jonas Jenwald
69f14b1ee9 Update npm packages 2021-12-26 11:09:29 +01:00
Jonas Jenwald
e0dba504d2 Fix broken/missing JSDocs and typedefs, to allow updating TypeScript to the latest version (issue 14342)
This patch circumvents the issues seen when trying to update TypeScript to version `4.5`, by "simply" fixing the broken/missing JSDocs and `typedef`s such that `gulp typestest` now passes.
As always, given that I don't really know anything about TypeScript, I cannot tell if this is a "correct" and/or proper way of doing things; we'll need TypeScript users to help out with testing!

*Please note:* I'm sorry about the size of this patch, but given how intertwined all of this unfortunately is it just didn't seem easy to split this into smaller parts.
However, one good thing about this TypeScript update is that it helped uncover a number of pre-existing bugs in our JSDocs comments.
2021-12-15 23:14:25 +01:00
Tim van der Meij
da2b3dd3be
Upgrade to Puppeteer 13.0.0 2021-12-12 19:52:11 +01:00
Tim van der Meij
d3d8141372
Update packages to the most recent versions 2021-12-11 19:44:48 +01:00
Tim van der Meij
d5b5b665e4
Upgrade to Puppeteer 12 2021-11-28 19:24:11 +01:00
Jonas Jenwald
d62f847db2 Update Stylelint to version 14 (along with related packages)
Based on https://github.com/stylelint/stylelint/blob/14.0.0/docs/migration-guide/to-14.md none of the changes look directly relevant for us.
2021-11-28 12:36:16 +01:00