1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-18 14:18:23 +02:00
Commit graph

431 commits

Author SHA1 Message Date
Jonas Jenwald
6b961c424f Update Webpack to version 5.99.5 (issue 19808)
In Webpack version `5.99.0` the way that `export` statements are handled was changed slightly, with much less boilerplate code being generated, which unfortunately breaks our `tweakWebpackOutput` function that's used to expose the exported properties globally and that e.g. the viewer depends upon.

Given that we were depending on formatting that should most likely be viewed as nothing more than an internal implementation detail in Webpack, we instead work-around this by manually defining the structures that were previously generated.
Obviously this will lead to a tiny bit more manual work in the future, however we don't change the API-surface often enough that it should be a big issue *and* the relevant unit-tests are updated such that it shouldn't be possible to break this.

*NOTE:* In the future we might want to consider no longer using global properties like this, and instead rely only on proper `export`s throughout the code-base.
However changing this would likely be non-trivial (given edge-cases), and it'd be an `api-major` change, so let's just do the minimal amount of work to unblock Webpack updates for now.
2025-04-13 16:48:19 +02:00
Tim van der Meij
b61d52c6da
Update dependencies to the most recent versions 2025-04-12 19:38:22 +02:00
Jonas Jenwald
18617eb792 Tweak the Node.js version listed in "engines", to ensure that process.getBuiltinModule is available
In order to use the PDF.js library in Node.js environments the `process.getBuiltinModule` functionality must be available, which was released in [version `20.16.0`](https://nodejs.org/en/blog/release/v20.16.0), however we've seen repeated issues filed by users on older `20.x` versions.
2025-04-06 14:32:36 +02:00
Tim van der Meij
bb8fb74b72
Upgrade eslint-plugin-unicorn to version 58.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v58.0.0
doesn't indicate any breaking changes that should impact us.
2025-03-30 15:44:51 +02:00
Tim van der Meij
a6db2d9f47
Update dependencies to the most recent versions 2025-03-30 15:43:55 +02:00
Calixte Denizet
6ff1626cf3 Update @fluent/dom to 0.10.1 2025-03-28 09:39:02 +01:00
Tim van der Meij
4522c6c071
Update dependencies to the most recent versions 2025-03-23 12:46:02 +01:00
Tim van der Meij
85818f404f
Upgrade babel-loader to version 10.0.0
This is a major version bump, but the changelog at
https://github.com/babel/babel-loader/releases/tag/v10.0.0
doesn't indicate any breaking changes that should impact us.
2025-03-15 20:42:08 +01:00
Tim van der Meij
cfe6cc6a7e
Upgrade @metalsmith/layouts to version 3.0.0
This is a major version bump, and the changelog at
https://github.com/metalsmith/layouts/releases/tag/v3.0.0
indicates a breaking change that impacts us, namely that we need to
explicitly define the pattern and transformer that we wish to use.
2025-03-15 20:42:08 +01:00
Tim van der Meij
ef7e0ddae4
Update dependencies to the most recent versions 2025-03-15 20:42:08 +01:00
Tim van der Meij
cd6c5b009f
Upgrade globals to version 16.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/globals/releases/tag/v16.0.0
doesn't indicate any breaking changes that should impact us.
2025-02-23 19:31:20 +01:00
Tim van der Meij
8b0f1641ee
Upgrade eslint-plugin-unicorn to version 57.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v57.0.0
doesn't indicate any breaking changes that should impact us.

However, we do replace the deprecated `no-instanceof-array` rule with
the new `no-instanceof-builtins` rule. Note that the changelog calls
this rule `no-instanceof-builtin-object`, but it got renamed in
https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2537.
2025-02-23 19:28:28 +01:00
Tim van der Meij
08ba910ef0
Update dependencies to the most recent versions 2025-02-23 18:21:50 +01:00
Tim van der Meij
d2a07dcac6
Update dependencies to the most recent versions
Moreover, fix the linting issues (using `npx gulp lint --fix`) that are
found by the new versions of the linting tools.
2025-02-09 18:58:26 +01:00
Tim van der Meij
c0957986b7
Update dependencies to the most recent versions 2025-02-01 18:35:56 +01:00
dependabot[bot]
85a6c1ea6b
Bump undici from 6.19.8 to 6.21.1
Bumps [undici](https://github.com/nodejs/undici) from 6.19.8 to 6.21.1.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.19.8...v6.21.1)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-26 15:37:40 +00:00
Tim van der Meij
615ed67174
Update dependencies to the most recent versions 2025-01-18 18:55:44 +01:00
Tim van der Meij
d7e6d95304
Upgrade Puppeteer to version 24.0.0
This is a major version bump, but the changelog at
https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v24.0.0
doesn't indicate any breaking changes that should impact us.
2025-01-12 19:48:05 +01:00
Tim van der Meij
45d2e808fd
Update dependencies to the most recent versions 2025-01-09 22:48:00 +01:00
Jonas Jenwald
c32d49117c Remove the fuzz tests (issue 19297)
Reasons for removal:

 - These tests never generated any warnings from OSS-Fuzz, in over a year.

 - An error thrown during image decoding will lead to a broken/missing image, not a security problem.

 - These tests rely on the Jazzer.js library, which has a number of problems: It now causes failures in Node.js v23 in the CI tests, it's no longer being maintained upstream, and it lacks support for some (fairly common) CPU architectures.
2025-01-08 15:54:11 +01:00
Tim van der Meij
af0ffd29fa
Fix vulnerability in the nanoid dependency
This patch is generated with `npm audit fix` and fixes GHSA-mwcw-c2x4-8c55.
2024-12-19 21:14:29 +01:00
Tim van der Meij
d70ede4751
Update dependencies to the most recent versions 2024-12-19 21:13:00 +01:00
Calixte Denizet
b7ab5ee018 Update Puppeteer to version 23.10.3 2024-12-10 19:59:54 +01:00
Calixte Denizet
73701ad873 Update Puppeteer to version 23.10.2 2024-12-10 19:55:55 +01:00
Tim van der Meij
129fc66f65
Upgrade eslint-plugin-perfectionist to version 4.2.0
This requires two changes on our side:

- The order of exports in `web/viewer{-geckoview}.js` changes slightly
  because `eslint-plugin-perfectionist` aligned the sorting order with
  the `eslint-plugin-sort-exports` plugin we used before. This restores
  the change from commit 347f155.
- The `eslint-plugin-import` plugin contains a bug that causes the new
  version of `eslint-plugin-perfectionist` to be reported as unresolved.
  This issue is tracked upstream, and since the plugin works fine we
  can simply extend the ignore list we already have to avoid this error
  until the upstream bug is fixed.
2024-12-07 13:44:48 +01:00
Tim van der Meij
7d1ca73acc
Update dependencies to the most recent versions 2024-12-07 13:22:44 +01:00
Tim van der Meij
7784f868fc
Update dependencies to the most recent versions 2024-12-01 14:49:03 +01:00
Calixte Denizet
1c5d93cf2d Update svglint to 3.1.0
The new release contains:
 - https://github.com/simple-icons/svglint/pull/110
 - https://github.com/simple-icons/svglint/pull/111

which allow us to slightly simplify our code.
2024-11-18 15:00:07 +01:00
Tim van der Meij
50d79736f5
Update dependencies to the most recent versions 2024-11-17 19:55:28 +01:00
Tim van der Meij
499fab998e
Upgrade eslint to version 9
This is unblocked now that all dependencies have been updated and the
flat configuration format (compatible with ESLint 8 and 9) was
introduced first. The following deprecation warnings during `npm
install` are resolved by this upgrade:

```
npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
```

Note that according to https://eslint.org/version-support ESLint 8 is
officially EOL now, and ESLint 9 has been released for over seven
months and is the only officially supported version.

Fixes #17928.
2024-11-12 20:35:50 +01:00
Tim van der Meij
cdb32dae45
Update dependencies to the most recent versions 2024-11-12 20:22:27 +01:00
Nicolò Ribaudo
9e6ff979db
Migrate to ESLint flat config
Flat config is the new config system used by ESLint 9.
To make the migration easier, they also added
flat config support to ESLint 8.

This commit migrates the various ESLint configs in the repository to use
the new system, **without** upgrading to ESLint 9 yet.
2024-11-12 16:15:17 +01:00
Jonas Jenwald
86f943ca03 [api-minor] Replace the canvas package with @napi-rs/canvas
The `@napi-rs/canvas` package has fewer dependencies, which should *hopefully* make installing and using it easier for `pdfjs-dist` end-users. (Over the years we've seen, repeatedly, that `canvas` can be difficult to install successfully.)
Furthermore, this package includes more functionality (such as `Path2D`) which reduces the overall number of dependencies in the PDF.js project.

One point to note is that `@napi-rs/canvas` is a fair bit newer than `canvas`, and has a lot fewer users, however looking at the commit history it does seem to be actively maintained.

Note that I've successfully tested the [Node.js examples](https://github.com/mozilla/pdf.js/tree/master/examples/node), in particular the `pdf2png` one, with this patch applied and things appear to work fine.

Please see:
 - https://www.npmjs.com/package/@napi-rs/canvas
 - https://github.com/Brooooooklyn/canvas
2024-11-09 18:51:29 +01:00
Jonas Jenwald
4f01cdef18 [api-minor] Update the minimum supported Node.js version to 20
This patch updates the minimum supported environments as follows:
 - Node.js 20, which was released on 2023-04-18 and has now entered the "Maintenance"-phase; see https://github.com/nodejs/release#release-schedule

Furthermore, note also that Node.js 18 will fairly soon reach EOL.
2024-11-03 16:13:55 +01:00
Tim van der Meij
ccfaf20ee2
Install and use the most recent Node types for the types tests
The types tests run in Node.js and therefore use Node types for e.g.
builtins. However, we didn't explicitly indicate this in
`tsconfig.json` (see [1] for more information and [2] for the PR where
we found this). Moreover, we didn't explicitly install the most recent
version of `@types/node` which implicitly made us fall back to version
14.14.45 (because that was installed as a dependency of other modules)
whereas much newer versions are available and we need those after
changes in Node.js (see [3] for more information and [4] for the PR
where we found this).

This commit fixes both issues by explicitly installing and using the
most recent Node.js types, which should also avoid future issues with
the types tests.

[1] https://github.com/TypeStrong/ts-node/issues/1012
[2] https://github.com/mozilla/pdf.js/pull/18237
[3] https://stackoverflow.com/questions/78790943/in-typescript-5-6-buffer-is-not-assignable-to-arraybufferview-or-uint8arr
[4] https://github.com/mozilla/pdf.js/pull/18959
2024-11-03 13:40:55 +01:00
Tim van der Meij
3cd906829e
Update dependencies to the most recent versions 2024-11-02 20:20:58 +01:00
Tim van der Meij
347f155ebc
Replace eslint-plugin-sort-exports by eslint-plugin-perfectionist
The `eslint-plugin-sort-exports` plugin doesn't support ESLint 9 or has
published plans to do so. The `eslint-plugin-perfectionist` does support
ESLint 9 [1], seems more actively maintained [2, 3] and contains other
rules that could be interesting later on [4]. Note that both plugins
behave the same, except for two cases which are updated here.

[1] https://github.com/azat-io/eslint-plugin-perfectionist/issues/154
[2] https://github.com/azat-io/eslint-plugin-perfectionist/commits/main
[3] https://www.npmjs.com/package/eslint-plugin-perfectionist?activeTab=versions
[4] https://perfectionist.dev/rules
2024-10-20 18:50:35 +02:00
Tim van der Meij
b4651390bb
Update dependencies to the most recent versions 2024-10-20 15:58:59 +02:00
Tim van der Meij
6def1c8453
Remove the eslint-config-prettier dependency
The `eslint-plugin-prettier` dependency already installs this dependency
by default nowadays, so we don't have to specify it ourselves anymore.
2024-10-20 15:38:22 +02:00
Tim van der Meij
760dd24ea0
Remove the eslint-plugin-{fetch-options,html} dependencies
The plugins have originally been introduced in commit d63da81 for the
`eslint-plugin-mozilla` dependency, but the `eslint-plugin-mozilla`
plugin got removed in commit be93d53 and we also don't use the plugins
ourselves in e.g. our `.eslintrc` files (as evidenced by `npx gulp lint`
not failing while it does fail if we remove any of the other plugins).
2024-10-20 15:38:22 +02:00
Jonas Jenwald
6ae13fac9b [api-minor] Update the canvas package to version 3
This allows us to run the Node.js unit-tests in version 22, which is good since it'll very soon become the active LTS release; see https://github.com/nodejs/release#release-schedule.
2024-10-20 12:39:08 +02:00
Tim van der Meij
dcc46ceafa
Upgrade eslint-plugin-unicorn to version 56.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v56.0.0
doesn't indicate any breaking changes that should impact us.
2024-10-06 12:43:07 +02:00
Tim van der Meij
78bf5287d1
Update dependencies to the most recent versions
Note that the new version of `eslint-plugin-import` contains support
for ESLint 9.

Moreover, the new version of Babel removed the leading space for import
comments (see https://github.com/babel/babel/pull/16780), so we update
the corresponding test expectation to match this.

Fixes a part of #17928.
2024-10-06 12:43:07 +02:00
Tim van der Meij
c8af3f14d3
Update typescript to version 5.6.2
This is unblocked because in commit bb302dd the default value for the
constructor got removed, which apparently confused TypeScript before.

Fixes #18770.
2024-09-23 20:34:35 +02:00
Tim van der Meij
3753387e9d
Update dependencies to the most recent versions 2024-09-22 20:27:10 +02:00
dependabot[bot]
edd1dfb699
Bump dset from 3.1.3 to 3.1.4
Bumps [dset](https://github.com/lukeed/dset) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/lukeed/dset/releases)
- [Commits](https://github.com/lukeed/dset/compare/v3.1.3...v3.1.4)

---
updated-dependencies:
- dependency-name: dset
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-11 23:53:47 +00:00
Tim van der Meij
ae13b4a015
Update dependencies to the most recent versions 2024-09-09 19:51:21 +02:00
Tim van der Meij
ec7d0f6860
Update dependencies to the most recent versions 2024-09-01 19:58:26 +02:00
Calixte Denizet
36c5d192c7 [Editor] Update the loading icon when wait for ML to take into account prefered-reduced-motion setting
* The icon has been updated in https://bugzilla.mozilla.org/show_bug.cgi?id=1908920;
 * Add a linter to check that a svg element doesn't have fill="context-fill" attribute.
2024-08-30 15:48:51 +02:00
Tim van der Meij
54eead78ab
Upgrade Puppeteer to version 23.1.1
This major version contains three breaking changes that impact us:

- The `product` option has been renamed to the more suitable `browser`.
- The `page.screenshot()` API returns a `Uint8Array` instead of a
  `Buffer`, but since `pngjs` requires a `Buffer` object we need to do
  the conversion using `Buffer.from()` before passing data to `pngjs`.
- The browser configuration should be set using a configuration file
  instead of environment variables. Note that as a bonus this allows us
  to remove the `cross-env` dependency since that was only used to set
  the Puppeteer environment variable equally for all operating systems.

For more information about the changes between the old and new Puppeteer
versions refer to https://github.com/puppeteer/puppeteer/releases.
2024-08-25 12:49:20 +02:00