Commit Graph

320 Commits

Author SHA1 Message Date
Jonas Jenwald
689e5c54a7 Update the es-module-shims package to the latest version 2021-07-11 12:16:47 +02:00
Jonas Jenwald
a926976e4d Update npm packages 2021-07-11 12:14:47 +02:00
Jonas Jenwald
e4adde3462 Remove the version field from the package.json file
According to https://docs.npmjs.com/cli/v7/configuring-npm/package-json#version, the "version" field is not required[1]:
> If you don't plan to publish your package, the name and version fields are optional.

Hence it shouldn't be necessary to have a "dummy" `version` field in the `package.json` file, and it seems quite unfortunate to have an essentially meaningless entry in that file.[2]
Furthermore, I'd even go as far as suggesting that it's actually doing more harm than good in practice, since it's not uncommon for people to open issues where they simply quote the `package.json`-entry when filling out the ISSUE_TEMPLATE thus causing confusion as to which *exact* version is actually used.

Unless I'm misremembering, I believe that the only reason for adding the `version` field was that is was necessary in order for things to work back when testing was run on Travis.
Now we're using GitHub Actions instead, where things seem to work just find even without a `version` field; hence why I think it makes sense to remove this.

---
[1] Please note that this patch doesn't affect the `pdfjs-dist` package, since the `package.json` file used there is created in `gulpfile.js` during building.

[2] Trying to, automatically, update the `version` field on *every* commit really doesn't seem worth it to me.
2021-07-03 16:46:28 +02:00
Jonas Jenwald
e79ed27f2f Update the es-module-shims package to the latest version 2021-06-27 10:27:02 +02:00
Jonas Jenwald
f03d5b3ee7 Update npm packages 2021-06-27 10:25:40 +02:00
Jonas Jenwald
1cfaf07b82 Add basic linting of JSON files using eslint-plugin-json
By adding basic linting of JSON files, we can ensure that they're actually valid and prevent e.g. test-failures caused by *accidental* errors when editing the `test/test_manifest.json` file (something that I've done *many* times myself).

For now this simply uses the `recommended` configuration, but we can obviously tweak this later if/when needed. Please find additional information at https://github.com/azeemba/eslint-plugin-json
2021-06-15 12:19:01 +02:00
Jonas Jenwald
014148b28a Update the eslint-plugin-unicorn package to the latest version 2021-06-13 10:35:58 +02:00
Jonas Jenwald
99dc7af590 Update npm packages 2021-06-13 09:59:44 +02:00
Jonas Jenwald
26011c65f4 Add a DOMMatrix polyfill for Node.js environments (PR 13361 follow-up)
Given that `DOMMatrix` is, unsurprisingly, not supported in Node.js the `createMatrix` helper function in `src/display/pattern_helper.js` is most likely broken in Node.js environments. It will obviously try to fallback to the `DOMSVGFactory`, however that isn't intended for Node.js usage and errors will be thrown.

Rather than trying to implement a `NodeSVGFactory`, this patch takes the easier route of just adding a `DOMMatrix` polyfill using: https://www.npmjs.com/package/dommatrix
This isn't done only for simplicity, but it'll become necessary anyway since the `createMatrix` helper function is only temporary and will be removed in the future.
2021-06-10 21:08:23 +02:00
Jonas Jenwald
bc17ac5a2f Update Puppeteer to version 10
Hopefully the updated Chromium-version might help reduce the number of intermittent test failures.

Please find additional information at https://github.com/puppeteer/puppeteer/releases/tag/v10.0.0
2021-06-01 15:11:02 +02:00
Jonas Jenwald
4ef538b19a Update the yargs package to the latest version 2021-05-30 07:51:30 +02:00
Jonas Jenwald
e7ab2d6eb5 Update the eslint-plugin-unicorn package to the latest version 2021-05-30 07:50:12 +02:00
Jonas Jenwald
fd6d60935b Update npm packages 2021-05-30 07:43:13 +02:00
Jonas Jenwald
c93958f901 Update npm packages 2021-05-16 10:05:58 +02:00
Jonas Jenwald
01e01e6389 Update the eslint-plugin-unicorn package to the latest version 2021-05-02 09:31:44 +02:00
Jonas Jenwald
d1a18e84ea Update npm packages 2021-05-02 09:30:09 +02:00
Jonas Jenwald
8538cdf845
Update Puppeteer to version 9 (#13282)
* Update Puppeteer to version 9

Hopefully the updated Chromium-version might help reduce the number of intermittent test failures.

Please find additional information at https://github.com/puppeteer/puppeteer/releases/tag/v9.0.0

* Update the `eslint-plugin-sort-exports`/`eslint-plugin-unicorn"` packages to their latest versions

Both of these ESLint plugins have increased their version numbers, however `npm update` doesn't handle this automatically.

https://www.npmjs.com/package/eslint-plugin-sort-exports
https://www.npmjs.com/package/eslint-plugin-unicorn
2021-04-22 11:35:16 +02:00
Jonas Jenwald
fc007028a2 Update npm packages 2021-04-18 11:02:42 +02:00
Jonas Jenwald
c988712bc5 Update the yargs package to the latest version
While I wasn't able to figure out *exactly* why the old format didn't work, re-factoring the `parseOptions` function to use `yargs` differently "just worked" so that's hopefully good enough here.
With these changes everything related to a *particular* option now appears in one place, rather than being spread out, which aids readability in my opinion. Also, the options are now sorted alphabetically, to make it easier to find a particular one.

https://www.npmjs.com/package/yargs
2021-04-16 12:04:35 +02:00
Tim van der Meij
eddb9087a1
Merge pull request #13240 from Snuffleupagus/update-eslint-helpers
Update `eslint-config-prettier`/`eslint-plugin-unicorn` packages to their latest versions
2021-04-14 20:36:45 +02:00
Tim van der Meij
b9d87b8c0d
Merge pull request #13244 from Snuffleupagus/update-postcss-calc
Update the `postcss-calc` package to the latest version
2021-04-14 20:35:51 +02:00
Jonas Jenwald
3e113cd38f Update the es-module-shims package to the latest version
Beside the unit/font-test suites, this is primarily used in the development viewer (i.e. `gulp server`).

https://www.npmjs.com/package/es-module-shims
2021-04-14 15:40:41 +02:00
Jonas Jenwald
da93bd18cc Update the postcss-calc package to the latest version
I've successfully run `gulp mozcentral` and `gulp generic` locally, with/without this patch and diff-ed the *built* `web/viewer.css` files. There were no changes, in the build-output, caused by this update.

https://www.npmjs.com/package/postcss-calc
2021-04-14 15:32:38 +02:00
Jonas Jenwald
f2156fc0cf Update eslint-config-prettier/eslint-plugin-unicorn packages to their latest versions
Both of these ESLint "helpers" has increased their *major* version numbers, which `npm update` doesn't handle automatically (since that could cause errors), hence this patch which updates them manually.

https://www.npmjs.com/package/eslint-config-prettier
https://www.npmjs.com/package/eslint-plugin-unicorn
2021-04-14 12:46:57 +02:00
Jonas Jenwald
f4727f0fec Update npm packages 2021-04-04 10:53:29 +02:00
Jonas Jenwald
3eb7a6b66f Update npm packages 2021-03-21 11:00:02 +01:00
Jonas Jenwald
75eb2aedaa Update npm packages 2021-03-07 12:00:57 +01:00
Jonas Jenwald
bb155cea5d Update Puppeteer to version 8
Hopefully the updated Chromium-version might help reduce the number of intermittent test failures.

Please find additional information at https://github.com/puppeteer/puppeteer/releases/tag/v8.0.0
2021-02-26 12:08:02 +01:00
Tim van der Meij
62d5b15a24
Allow minor and patch versions for the webpack-stream dependency again
Fixes #11996.
2021-02-21 15:13:41 +01:00
Jonas Jenwald
385bf67bc9 Update npm packages 2021-02-21 11:52:55 +01:00
Jonas Jenwald
70b62eec82 Update npm packages 2021-02-07 12:04:22 +01:00
Jonas Jenwald
fd4e76a7e3 Update Puppeteer to version 7
Please see:
 - https://github.com/puppeteer/puppeteer/releases/tag/v7.0.1
 - https://github.com/puppeteer/puppeteer/releases/tag/v7.0.0
2021-02-04 18:03:11 +01:00
Jonas Jenwald
003965e1e8 Update Puppeteer to version 6 (issue 12945)
Please see https://github.com/puppeteer/puppeteer/releases/tag/v6.0.0
2021-02-02 13:18:22 +01:00
Jonas Jenwald
619e1d8bcf Stop polyfilling CSS variables in GENERIC builds
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/Using_CSS_custom_properties#browser_compatibility and 9af8501e6c/gulpfile.js (L79-L91)

This reduces the size of the *built* `viewer.css` file, in GENERIC builds, from `93 814` to `55 285` bytes (~41 percent).
2021-01-30 15:38:07 +01:00
Jonas Jenwald
bc32515507 Update the eslint-plugin-unicorn package to the latest version
Please see https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v27.0.0 for additional details.
2021-01-24 08:38:38 +01:00
Jonas Jenwald
fea6d2fd34 Update npm packages 2021-01-24 08:34:00 +01:00
Jonas Jenwald
0e23b8b6ce Update the eslint-plugin-unicorn package to the latest version
Please see https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v25.0.0 for additional details.
2021-01-10 13:34:49 +01:00
Jonas Jenwald
e14db97740 Update npm packages 2021-01-10 13:34:35 +01:00
Jonas Jenwald
81525fd446 Use ESLint to ensure that exports are sorted alphabetically
There's built-in ESLint rule, see `sort-imports`, to ensure that all `import`-statements are sorted alphabetically, since that often helps with readability.
Unfortunately there's no corresponding rule to sort `export`-statements alphabetically, however there's an ESLint plugin which does this; please see https://www.npmjs.com/package/eslint-plugin-sort-exports

The only downside here is that it's not automatically fixable, but the re-ordering is a one-time "cost" and the plugin will help maintain a *consistent* ordering of `export`-statements in the future.
*Note:* To reduce the possibility of introducing any errors here, the re-ordering was done by simply selecting the relevant lines and then using the built-in sort-functionality of my editor.
2021-01-09 20:37:51 +01:00
Jonas Jenwald
94dfb46091 Update npm packages 2020-12-27 11:11:18 +01:00
Jonas Jenwald
e09f2a462d Update npm packages 2020-12-13 11:38:37 +01:00
Jonas Jenwald
1f29d27474 Change how we're passing pdf.sandbox.js-specific options to createWebpackConfig in gulpfile.js
Given the somewhat "specialized" nature of the `pdf.sandbox.js` building, it ought to be possible to re-factor how some of the options are handled.
Note in particular that the `gulp-strip-comments` dependency seems somewhat unncessary, since the *main* source of comments are just the default license header. Hence I seems much more reasonable to simply not include that to begin with, rather than removing it after the fact (the few remaining Webpack-related should be few/small enough to not really matter much in practice).

This way we're able to further reduce the special-casing related to the `pdf.sandbox.js`-building, which will make future changes/maintenance easier by bringing this code more in-line with existing patterns in `gulpfile.js`.

(If we really want to reduce the filesize, we might want to consider always minifying the `GENERIC`-build of the `pdf.sandbox.js` file.)
2020-12-05 22:44:48 +01:00
Jonas Jenwald
e15c63abc7 Update npm packages 2020-11-29 09:43:20 +01:00
Tim van der Meij
a936f1f70c
Update Puppeteer to version 5.5.0 2020-11-22 14:26:49 +01:00
Calixte Denizet
c7974e9996 JS -- Add a sandbox based on quickjs
* quickjs-eval.js has been generated using https://github.com/mozilla/pdf.js.quickjs/
 * lazy load of sandbox code
 * Rewrite tests to use the sandbox
 * Add a task `watch-sandbox` which update bundle pdf.sandbox.js on change in the sandbox code
2020-11-19 13:40:46 +01:00
Jonas Jenwald
e1f43907d2 Update npm packages 2020-11-15 13:57:28 +01:00
Jonas Jenwald
de628cec59 Some hasJSActions, and general annotation-code, related cleanup in the viewer and API
- Add support for logical assignment operators, i.e. `&&=`, `||=`, and `??=`, with a Babel-plugin. Given that these required incrementing the ECMAScript version in the ESLint and Acorn configurations, and that platform/browser support is still fairly limited, always transpiling them seems appropriate for now.

 - Cache the `hasJSActions` promise in the API, similar to the existing `getAnnotations` caching. With this implemented, the lookup should now be cheap enough that it can be called unconditionally in the viewer.

 - Slightly improve cleanup of resources when destroying the `WorkerTransport`.

 - Remove the `annotationStorage`-property from the `PDFPageView` constructor, since it's not necessary and also brings it more inline with the `BaseViewer`.

 - Update the `BaseViewer.createAnnotationLayerBuilder` method to actaually agree with the `IPDFAnnotationLayerFactory` interface.[1]

 - Slightly tweak a couple of JSDoc comments.

---
[1] We probably ought to re-factor both the `IPDFTextLayerFactory` and `IPDFAnnotationLayerFactory` interfaces to take parameter objects instead, since especially the `IPDFAnnotationLayerFactory` one is becoming quite unwieldy. Given that that would likely be a breaking change for any custom viewer-components implementation, this probably requires careful deprecation.
2020-11-14 13:58:35 +01:00
Jonas Jenwald
75af932b79 Update npm packages 2020-11-01 10:04:57 +01:00
Jonas Jenwald
641ad1c3a0 Update npm packages 2020-10-18 10:57:52 +02:00
Jonas Jenwald
666dd73ce8 Upgrade webpack to version 5
The only noticeable changes are that the built files are now *slightly* smaller, and that Webpack now supports optional chaining and nullish coalescing without the need for Babel plugins.
2020-10-11 10:23:38 +02:00
Jonas Jenwald
3461eac7b8 Upgrade terser to version 5
The only significant change is that the `minify` command is now asynchronous, which we can handle easily by simply making the containing functions `async`.
Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function#Browser_compatibility, using `async`/`await` in the gulpfile should no longer be an issue as far as I can tell.
2020-10-07 14:38:17 +02:00
Jonas Jenwald
bc036c05bd Upgrade acorn to version 8
I've run `gulp mozcentral`, `gulp generic`, and `gulp generic-es5` with `master` respectively this patch and then diffed the build output. With the (obvious) exception of increased version/build numbers, there were no actual changes from the updated Acorn version.
2020-10-06 13:53:08 +02:00
Tim van der Meij
505f14e816
Upgrade minor/major versions of dependencies that don't require code changes
The changelogs of those dependencies showed no breaking changes for us.
Most of the time the major version bump was done to remove compatibility
with very outdated Node.js versions.

Only for `autoprefixer` and `gulp-postcss` a change was required, which
is including `postcss` in our `package.json` explicitly since it's now
a peer dependency of those packages.

Now only `acorn`,`systemjs`, `terser` and `yargs` are not the latest
versions because they require more work.
2020-10-04 20:26:59 +02:00
Tim van der Meij
e0c80a3556
Remove the fancy-log dependency
This dependency hasn't been updated in two years and the only place that
uses it is the `externaltest` target in the Gulpfile. We can simply
replace `fancy-log` usage there with `console.log` like we do in all
other places in the Gulpfile because we're not interested in the
timestamps here. Gulp already prints timestamps and these tests finish
within a second anyway.

Note that it remains in `package-lock.json` because other Gulp-related
packages have it as a dependency, but at least we're no longer depending
on it directly anymore now.
2020-10-04 17:30:39 +02:00
Jonas Jenwald
522c93b916 Update npm packages 2020-10-04 15:30:23 +02:00
Tim van der Meij
c10aac9a1d
Upgrade Puppeteer to version 5.3.1 2020-10-03 23:06:31 +02:00
Jonas Jenwald
db4cefbac3 Add basic support for the optional chaining operator ?.
For now we need to use a Babel-plugin, since part of our build system doesn't support this fully (e.g. Babel-loader, Webpack 4.x, and SystemJS).

While the `?.` operator will thus always be transpiled by Babel, even in modern builds, simply supporting it for development purposes seems like a step in the right direction.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
2020-09-29 15:56:34 +02:00
Jonas Jenwald
5107259176 Update escodegen to version 2.0
This release contains support for additional modern ECMAScript features, such as e.g. the nullish coalescing operator `??` and the optional chaining operator `?.`.
2020-09-29 15:56:24 +02:00
Jonas Jenwald
3e9c489b8b Update the webpack-stream dependency (issue 11996)
Given that the long-standing `webpack-stream` issue 201 was recently fixed in PR 207, and a new version released, we should now finally be able to update the dependency.
However, depending on if/when `webpack-stream` gets support for Webpack 5 (which is currently in beta) we may still want remove our `webpack-stream` dependency.
2020-09-20 15:35:56 +02:00
Jonas Jenwald
36b8d5e72d Update npm packages 2020-09-20 11:34:24 +02:00
Jonas Jenwald
0aef40f897 Update npm packages 2020-09-06 11:49:49 +02:00
Jonas Jenwald
7b5a540a52 Add (basic) support for Stylelint, to allow linting of CSS files
This is *similar* to the existing linting for JavaScript files, but covers CSS files instead.
While there's a lot of rules that could potentially be used, the main advantage of using Stylelint is that it has Prettier integration which means that we can automatically enforce a *consistent* style for our CSS files as well.

As a proof of concept, this patch is purposely limited to:
 - Adding a simple rule, here `block-no-empty` is chosen; see https://stylelint.io/user-guide/rules/block-no-empty
 - Adding Prettier integration, to unify the style of our CSS files.

Please find additional information at https://stylelint.io/
2020-08-30 21:48:35 +02:00
Jonas Jenwald
cb27999681 Update npm packages 2020-08-23 10:08:45 +02:00
Jonas Jenwald
c1253fd2d9 Update npm packages 2020-08-09 11:03:07 +02:00
Tim van der Meij
00a8b42e67
Merge pull request #12102 from ineiti/add_types_annotations
Add types annotations
2020-08-02 16:45:37 +02:00
Tim van der Meij
c53e403049
Update Jasmine to version 3.6.1
This is possible now that most intermittent unit test failures have been
resolved by other patches. There is only one remaining, but it's very
rare and doesn't have to block this update anymore.
2020-08-01 21:12:26 +02:00
Linus Gasser
f1bbfdc16d Add typescript definitions
This PR adds typescript definitions from the JSDoc already present.
It adds a new gulp-target 'types' that calls 'tsc', the typescript
compiler, to create the definitions.

To use the definitions, users can simply do the following:

```
import {getDocument, GlobalWorkerOptions} from "pdfjs-dist";
import pdfjsWorker from "pdfjs-dist/build/pdf.worker.entry";
GlobalWorkerOptions.workerSrc = pdfjsWorker;

const pdf = await getDocument("file:///some.pdf").promise;
```

Co-authored-by: @oBusk
Co-authored-by: @tamuratak
2020-07-30 11:10:37 +02:00
Tim van der Meij
c7c6c90062
Limit the allowed versions for Jasmine and Puppeteer
Jasmine >= 3.6.0 causes intermittent test failures because of random
task abortions.

Puppeteer >= 4.0.0 causes ENOTEMPTY/EBUSY errors during shutdown on the
Windows bot.

Moreover, `jasmine-core` is a dependency of `jasmine` so it doesn't have
to be required separately.
2020-07-26 20:40:55 +02:00
Jonas Jenwald
47ab676225 Update npm packages 2020-07-26 11:18:41 +02:00
Jonas Jenwald
fac5b5ff0c Update npm packages 2020-07-13 11:05:50 +02:00
Jonas Jenwald
1d6d1c78ae Update npm packages 2020-06-27 11:30:30 +02:00
Dylan Lacey
f2b295882f Update Needle to 2.5.0 or greater.
Versions of `needle` prior to `2.5.0` cannot cope with redirects (as documented: https://github.com/tomas/needle/issues/312).

This prevents prebuilt `canvas` binaries from being downloaded on MacOS,
requiring the global install of its dependencies.

Updating Needle restores it to functionality, addressing this.  It also avoids
the need to add `request` to `package.json`; it also obsoletes https://github.com/mozilla/pdf.js/pull/12018.
2020-06-25 13:54:54 +10:00
Jonas Jenwald
603a9e3ea3 Update npm packages 2020-06-13 10:36:11 +02:00
Jonas Jenwald
b4ae958ca4 Add basic support for the nullish coalescing operator ??
For now we need to use a Babel-plugin, since Webpack 4.x doesn't seem to support it yet. (Most likely we'll have to update to Webpack 5, once that becomes available, in order for this to be directly supported. This is thus also blocked on removing the `webpack-stream` package.)

While the `??` operator will thus always be transpiled by Babel, even in modern builds, simply supporting it for development purposes seems like a step in the right direction.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator
2020-06-12 15:16:54 +02:00
Jonas Jenwald
da482310ee Update npm packages 2020-05-30 10:58:10 +02:00
Jonas Jenwald
6a1490faa7 Update Acorn to version 7
By updating to the new major version of Acorn, we'll get support for newer ECMAScript features as they become available (although some features are currently also blocked by ESLint support and/or SystemJS usage).

Please see https://github.com/acornjs/acorn/releases/tag/7.2.0 for details.
2020-05-27 11:54:27 +02:00
Jonas Jenwald
8d56a69e74 Reduce usage of SystemJS, in the development viewer, even further
With these changes SystemJS is now only used, during development, on the worker-thread and in the unit/font-tests, since Firefox is currently missing support for worker modules; please see https://bugzilla.mozilla.org/show_bug.cgi?id=1247687

Hence all the JavaScript files in the `web/` and `src/display/` folders are now loaded *natively* by the browser (during development) using standard `import` statements/calls, thanks to a nice `import-maps` polyfill.

*Please note:* As soon as https://bugzilla.mozilla.org/show_bug.cgi?id=1247687 is fixed in Firefox, we should be able to remove all traces of SystemJS and thus finally be able to use every possible modern JavaScript feature.
2020-05-20 13:36:52 +02:00
Jonas Jenwald
4f6664f3f5 Update npm packages 2020-05-16 11:44:41 +02:00
Jonas Jenwald
887d2f2948 Update the eslint-plugin-unicorn package 2020-05-16 11:43:21 +02:00
Jonas Jenwald
f8bff283f3 Update ESLint to version 7
Please see https://eslint.org/blog/2020/05/eslint-v7.0.0-released for a list of notable changes.
2020-05-10 11:32:46 +02:00
Jonas Jenwald
8fac59de96 Update npm packages 2020-05-02 13:23:41 +02:00
Tim van der Meij
4834a276fd
Introduce Puppeteer for handling browsers during tests
This commit replaces our own infrastructure for handling browsers during
tests with Puppeteer. Using our own infrastructure for this had a few
downsides:

- It has proven to not always be reliable, especially when closing the
  browser, causing failures on the bots because browsers were still
  running even though they should have been stopped. Puppeteer should do
  a better job with this because it uses the browser's test built-in
  instrumentation tools for this (the devtools protocol) which our code
  didn't. This also means that we don't have to pass
  parameters/preferences to tweak browser behavior anymore.
- It requires the browsers under test to be installed on the system,
  whereas Puppeteer downloads the browsers before the test. This means
  that setup is much easier (no more manual installations and browser
  manifest files) as well as testing with different browser versions
  (since they can be provisioned on demand). Moreover, this ensures that
  contributors always run the tests in both Firefox and Chrome,
  regardless of which browsers they have installed locally.
- It's all code we have to maintain, so Puppeteer abstracts away how the
  browsers start/stop for us so we don't have to keep that code.

By default, Puppeteer only installs one browser during installation,
hence the need for a post-install script to install the second browser.
This requires `cross-env` to make passing the environment variable work
on both Linux and Windows.
2020-04-27 13:03:12 +02:00
Jonas Jenwald
d67c1899b5 Update npm packages 2020-04-18 11:08:46 +02:00
Jonas Jenwald
426945b480 Update Prettier to version 2.0
Please note that these changes were done automatically, using `gulp lint --fix`.

Given that the major version number was increased, there's a fair number of (primarily whitespace) changes; please see https://prettier.io/blog/2020/03/21/2.0.0.html
In order to reduce the size of these changes somewhat, this patch maintains the old "arrowParens" style for now (once mozilla-central updates Prettier we can simply choose the same formatting, assuming it will differ here).
2020-04-14 12:28:14 +02:00
Jonas Jenwald
7b7fe60210 Update the mkdirp package, since its major version was increased 2020-04-02 12:22:13 +02:00
Jonas Jenwald
412fec1545 Update npm packages 2020-04-02 12:13:14 +02:00
Jonas Jenwald
b02be3b268 Update the eslint-plugin-no-unsanitized package to the latest version 2020-03-20 11:25:39 +01:00
Jonas Jenwald
577ada48d0 Update npm packages 2020-03-19 09:55:14 +01:00
dependabot[bot]
977839c046
Bump acorn from 6.4.0 to 6.4.1
Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-13 22:13:33 +00:00
Jonas Jenwald
824e5c8156 Update npm packages 2020-03-06 13:06:21 +01:00
Jonas Jenwald
e7242e69c4 Update npm packages 2020-02-21 17:38:22 +01:00
Jonas Jenwald
c97c778f8f [api-minor] Produce non-translated/non-polyfilled builds by default 2020-02-14 18:12:07 +01:00
Jonas Jenwald
102142537f Update the left/right CSS calculation for the sidebarContainer HTML element to enable IE11 compatibility
As gross as this hack is, it nonetheless seem necessary to allow using CSS variables; see also https://github.com/mozilla/pdf.js/pull/11567#issuecomment-582166160
2020-02-05 20:13:21 +01:00
Jonas Jenwald
cb61bdee34 Add support for CSS variables using the PostCSS CSS Variables package (issue 11462)
Having thought *briefly* about using `css-vars-ponyfill`, I'm no longer convinced that it'd be a good idea. The reason is that if we actually want to properly support CSS variables, then that functionality should be available in *all* of our CSS files.
Note in particular the `pdf_viewer.css` file that's built as part of the `COMPONENTS` target, in which case I really cannot see how a rewrite-at-the-client solution would ever be guaranteed to always work correctly and without accidentally touching other CSS in the surrounding application.

All-in-all, simply re-writing the CSS variables at build-time seems much easier and is thus the approach taken in this patch; courtesy of https://github.com/MadLittleMods/postcss-css-variables
By using its `preserve` option, the built files will thus include *both* a fallback and a modern `var(...)` format[1]. As a proof-of-concept this patch removes a couple of manually added fallback values, and converts an additional sidebar related property to use a CSS variable.

---
[1] Comparing the `master` branch with this patch, when using `gulp generic`, produces the following diff for the built `web/viewer.css` file:
```diff
@@ -408,6 +408,7 @@

 :root {
   --sidebar-width: 200px;
+  --sidebar-transition-duration: 200ms;
 }

 * {
@@ -550,27 +551,28 @@
   position: absolute;
   top: 32px;
   bottom: 0;
-  width: 200px; /* Here, and elsewhere below, keep the constant value for compatibility
-                   with older browsers that lack support for CSS variables. */
+  width: 200px;
   width: var(--sidebar-width);
   visibility: hidden;
   z-index: 100;
   border-top: 1px solid rgba(51, 51, 51, 1);
   -webkit-transition-duration: 200ms;
           transition-duration: 200ms;
+  -webkit-transition-duration: var(--sidebar-transition-duration);
+          transition-duration: var(--sidebar-transition-duration);
   -webkit-transition-timing-function: ease;
           transition-timing-function: ease;
 }
 html[dir='ltr'] #sidebarContainer {
   -webkit-transition-property: left;
   transition-property: left;
-  left: -200px;
+  left: calc(-1 * 200px);
   left: calc(-1 * var(--sidebar-width));
 }
 html[dir='rtl'] #sidebarContainer {
   -webkit-transition-property: right;
   transition-property: right;
-  right: -200px;
+  right: calc(-1 * 200px);
   right: calc(-1 * var(--sidebar-width));
 }

@@ -640,6 +642,8 @@
 #viewerContainer:not(.pdfPresentationMode) {
   -webkit-transition-duration: 200ms;
           transition-duration: 200ms;
+  -webkit-transition-duration: var(--sidebar-transition-duration);
+          transition-duration: var(--sidebar-transition-duration);
   -webkit-transition-timing-function: ease;
           transition-timing-function: ease;
 }
```
2020-02-05 20:13:19 +01:00
Jonas Jenwald
763f1425d5 Update npm packages 2020-01-31 14:04:49 +01:00
Jonas Jenwald
05129deb00 Update npm packages 2019-12-28 19:57:25 +01:00
Wojciech Maj
0330d1d286
Update webpack-stream to fix vulnerabiliy reported by npm
https://npmjs.com/advisories/1084

webpack-stream between 4.0.3 and 5.0.0 added official support for Webpack 4. Which is nice since we ARE using Webpack 4... Also, dropped support for Node.js 4 which shouldn't be a big deal for us since we are already using packages that are incompatible with Node.js 4 (Webpack 4.x supports Node.js 6 and up).
2019-12-23 09:00:45 +01:00
Jonas Jenwald
aab0f91740 [api-minor] Simplify the *fallback* fake worker loader code in src/display/api.js
For performance reasons, and to avoid hanging the browser UI, the PDF.js library should *always* be used with web workers enabled.
At this point in time all of the supported browsers should have proper worker support, and Node.js is thus the only environment where workers aren't supported. Hence it no longer seems relevant/necessary to provide, by default, fake worker loaders for various JS builders/bundlers/frameworks in the PDF.js code itself.[1]

In order to simplify things, the fake worker loader code is thus simplified to now *only* support Node.js usage respectively "normal" browser usage out-of-the-box.[2]

*Please note:* The officially intended way of using the PDF.js library is with workers enabled, which can be done by setting `GlobalWorkerOptions.workerSrc`, `GlobalWorkerOptions.workerPort`, or manually providing a `PDFWorker` instance when calling `getDocument`.

---
[1] Note that it's still possible to *manually* disable workers, simply my manually loading the built `pdf.worker.js` file into the (current) global scope, however this's mostly intended for testing/debugging purposes.

[2] Unfortunately some bundlers such as Webpack, when used with third-party deployments of the PDF.js library, will start to print `Critical dependency: ...` warnings when run against the built `pdf.js` file from this patch. The reason is that despite the `require` calls being protected by *runtime* `isNodeJS` checks, it's not possible to simply tell Webpack to just ignore the `require`; please see [Webpack issue 8826](https://github.com/webpack/webpack) and libraries such as [require-fool-webpack](https://github.com/sindresorhus/require-fool-webpack).
2019-12-20 17:36:08 +01:00
Jonas Jenwald
be43001b29 Update npm packages 2019-12-19 11:28:13 +01:00
Jonas Jenwald
f406263fc2 Re-factor the npm test command, used by Travis, to avoid running the 'default_preferences' tasks concurrently (issue 10732)
*Please note:* This patch does *not* prevent the 'default_preferences' task from running more than once during `npm test`, but it does ensure that the tasks won't run *concurrently* by running the relevant tests in *series*.

While it would obviously still make sense to re-factor the gulpfile to account for changes in `gulp` version 4, by at least tweaking the `npm test` command the intermittent failures on Travis should at least go away.
2019-12-18 21:43:09 +01:00
Jonas Jenwald
b8f0cf0bc0 Update npm packages 2019-11-23 11:25:24 +01:00
smohtadi
fe6d86fb52 added transform function
added depedencies

removed gulp-transform dependency

removed dependencies

removed gulptransform dependency
2019-11-14 14:45:00 -08:00
Jonas Jenwald
ae4af9ab58 Update npm packages 2019-11-11 11:22:03 +01:00
Jonas Jenwald
c0c5a8282d Update packages 2019-10-18 16:42:02 +02:00
Jonas Jenwald
0ee373f9cc Replace the bundled ReadableStream polyfill with the web-streams-polyfill npm package (issue 11157)
Compared to the recently replaced `URL` polyfill, the new `ReadableStream` polyfill isn't being exported globally for two reasons:
 - We're currently checking for the existence of a global `ReadableStream` implementation when determining if the Fetch API will be used; please see `isFetchSupported` in the src/display/display_utils.js file.
 - Given that it's much newer functionality (compared to `URL`) and that not all browsers may implement all parts of the specification yet, not exposing the `ReadableStream` globally seems safer for now.
2019-09-23 22:16:59 +02:00
Tim van der Meij
27dee5e911
Update translations and packages 2019-09-21 13:42:27 +02:00
Tim van der Meij
c71a291317
Upgrade core-js to version 3.2.1
This only required changing the import paths. The `es` folder contains
all polyfills we need now. If we want to import everything, we need to
explicitly require the `index` file.
2019-09-19 13:58:36 +02:00
Tim van der Meij
8c53b67ec8
Update packages 2019-09-15 15:35:32 +02:00
Jonas Jenwald
d63da81e7c Update the eslint-plugin-mozilla to the latest version (PR 10905 follow-up)
This required adding a number of additional dependencies, based on https://dxr.mozilla.org/mozilla-central/rev/4aed8e10318f38571712350856bf9e61c5f84e1f/tools/lint/eslint/eslint-plugin-mozilla/package.json#32-37

Since this, implicitly, enabled "prettier"[1] for the `extensions/firefox` directory a couple of small code changes were necessary as well.

---
[1] Generally speaking I'm wondering if that name is deliberately ironic, since the style it enforces is often times extremely weird and ugly :-P
2019-09-07 12:52:37 +02:00
Tim van der Meij
215c546fd5
Upgrade to eslint version 6
This major version bump required two changes:

- The global line in the mobile viewer example should be removed because
  the `.eslintrc` file already defines these globals and with the new
  `eslint` version we otherwise get an error saying "'pdfjsLib' is already
  defined as a built-in global variable".
- The ECMA version for the examples must be set to 6 since we're using
  modules, otherwise we get an error saying "sourceType 'module' is not
  supported when ecmaVersion < 2015". It turns out that the previous
  version of `eslint` already used ECMA version 6 silently even though
  we set 5, see https://github.com/eslint/eslint/issues/9687#issuecomment-432413384,
  so in terms of our code nothing really changes.
2019-08-24 20:21:10 +02:00
Tim van der Meij
d9cd890228
Update packages 2019-08-24 20:08:09 +02:00
Tim van der Meij
57c6cf7835
Update packages 2019-06-29 12:35:45 +02:00
Jonas Jenwald
562e4ea14c Pin the version of eslint-plugin-mozilla to prevent failures on Travis (issue 10901)
It appears that the changes in `eslint-plugin-mozilla` version `1.3.0`, see https://bugzilla.mozilla.org/show_bug.cgi?id=1556013, causes dependency issues on Travis.
2019-06-15 14:02:28 +02:00
Tim van der Meij
18aef39b33
Update packages
This includes a major upgrade of `terser`.
2019-05-25 16:36:42 +02:00
Jonas Jenwald
a8dd00876a Update the canvas npm package to fix Travis CI builds (issue 10790) 2019-05-08 09:55:26 +02:00
Tim van der Meij
e113516a03
Update packages 2019-04-13 17:25:41 +02:00
Tim van der Meij
7cfa05078d
Update packages 2019-03-30 18:59:52 +01:00
Tim van der Meij
b607ef4b65
Update packages 2019-03-02 14:23:47 +01:00
Jonas Jenwald
5750a7e557 Update Webpack to the latest stable version (4.29.6) 2019-02-28 14:27:43 +01:00
Jonas Jenwald
c67ad32554 Update Webpack to the latest stable version (4.29.5) 2019-02-23 21:34:12 +01:00
Tim van der Meij
a4fd6aa947
Update packages 2019-02-17 17:26:35 +01:00
Tim van der Meij
7c91e94b19
Implement the NodeCanvasFactory class to execute more unit tests in Node.js 2019-02-10 19:37:34 +01:00
Tim van der Meij
810dbeb4e5
Update packages 2019-01-20 16:34:24 +01:00
Tim van der Meij
ca04a397bb
Update packages 2019-01-05 14:27:47 +01:00
Tim van der Meij
18bac1b4fc
Update packages 2018-12-22 16:35:34 +01:00
Tim van der Meij
fa85f86298
Upgrade to Gulp 4
This required the following changes in the Gulpfile:

- Defining a series of tasks is no longer done with arrays, but with the
  `gulp.series` function. The `web` target is refactored to use a
  smaller number of tasks to prevent tasks from running multiple times.
- Getting all tasks must now be done through the task registry.
- Tasks that don't return anything must call `done` upon completion.

Moreover, this upgrade allows us to use the latest Node.js on Travis CI
again.
2018-12-17 16:20:13 +01:00
Wojciech Maj
e70a22a854 Update eslint-plugin-mozilla to ^1.0.1 2018-12-11 12:14:06 +01:00
Jonas Jenwald
08584efdfe Test the code as-is, in Node.js/Travis, rather than its Babel translated version
This patch does three things:

 - Updates the `gulp unittestcli` command, using `gulp lint` as a guide, such that it can be run locally on Windows without any modifications.

 - Updates the `gulp lib` command to support disabling of Babel through the `SKIP_BABEL` environment variable. Note that all other build targets support this mode, and there's no good reason for `lib` to be any different here.

 - Updates the `npm test` command, used in Node.js/Travis, to test the code as-is test. Since modern Node.js versions seem to have no problems with ES6 compatible code in general, we should just test the source code as-is instead (similar to the tests running on the regular bots).
2018-12-02 10:15:27 +01:00
Tim van der Meij
e15a9797e3
Include forgotten changes after Wintersmith update
This should have been part of the previous commit that updated the
Wintersmith dependency. Markdown support is no longer included in Pug
itself and should be done by a transformer instead.
2018-11-24 21:39:54 +01:00
Tim van der Meij
498eaadcfb
Update packages 2018-11-24 21:00:22 +01:00
Tim van der Meij
b9b8cef04b
Merge pull request #10293 from wojtekmaj/babel-7
Upgrade to Babel 7
2018-11-23 23:36:58 +01:00
Tim van der Meij
33fa33ec75
Merge pull request #10292 from wojtekmaj/replace-uglify-es-with-terser
Replace uglify-es with Terser
2018-11-23 23:14:47 +01:00
Wojciech Maj
b46ec5195f Update Babel to 7.x
Update configuration to work with Babel 7
Explicitly require globals - eslint-plugin-mozilla needs it, but doesn't require it on its own.
Fix Regexp to match Babel 7's inlined _interopRequireDefault
2018-11-23 14:32:17 +01:00
Wojciech Maj
9921f92a36 Enable eslint-plugin-import to prevent unresolved paths 2018-11-23 13:50:28 +01:00
Wojciech Maj
01727e0fcc Replace UglifyJS with Terser 2018-11-23 12:18:36 +01:00
Tim van der Meij
fd3b780a74
Update packages 2018-11-17 21:37:52 +01:00
Tim van der Meij
0abddde2c7
Update packages
Webpack is pinned because versions higher than this cause the viewer not
to work (see https://github.com/mozilla/pdf.js/pull/10170#issuecomment-431697032).

Node.js is pinned for Travis CI because version 11 requires that we
update to Gulp 4.
2018-10-24 00:09:39 +02:00
Tim van der Meij
b187480b3f
Update packages 2018-09-30 15:45:10 +02:00
Tim van der Meij
2c710eda3e
Update packages 2018-09-21 15:16:30 +02:00
Tim van der Meij
4471353b97
Update packages 2018-09-09 17:54:24 +02:00
Tim van der Meij
fb8695d481
Update packages 2018-08-25 16:22:24 +02:00
Jonas Jenwald
099ed08852 Add support for async/await using Babel
For proof-of-concept, this patch converts a couple of `Promise` returning methods to use `async` instead.
Please note that the `generic` build, based on this patch, has been successfully testing in IE11 (i.e. the viewer loads and nothing is obviously broken).

Being able to use modern JavaScript features like `async`/`await` is a huge plus, but there's one (obvious) side-effect: The size of the built files will increase slightly (unless `SKIP_BABEL == true`). That's unavoidable, but seems like a small price to pay in the grand scheme of things.

Finally, note that the `chromium` build target was changed to no longer skip Babel translation, since the Chrome extension still supports version `49` of the browser (where native `async` support isn't available).
2018-08-19 16:54:11 +02:00
Tim van der Meij
d43c8bafca
Update packages 2018-08-19 16:17:23 +02:00
Tim van der Meij
0a2ec871b6
Update packages 2018-08-05 21:20:37 +02:00
Jonas Jenwald
61186698c3 Replace the remaining occurences of instanceof Array with Array.isArray()
*Follow-up to PRs 8864 and 8813.*

As explained in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray, `instanceof Array` can have inconsistent behavior. To ensure that only `Array.isArray` is used, an ESLint plugin/rule is added to enforce this.
2018-07-09 13:17:41 +02:00
Jonas Jenwald
200e3d6bd8 Update the various ESLint packages to their latest versions 2018-07-09 12:52:55 +02:00
Tim van der Meij
ac401c65a0
Update packages 2018-06-30 20:41:17 +02:00
Tim van der Meij
a816ee5c25
Upgrade to Webpack 4 2018-06-02 20:28:36 +02:00
Tim van der Meij
e3f635ce01
Update packages 2018-06-02 20:28:36 +02:00
Tim van der Meij
e0b63cc7af
Update packages and translations 2018-04-08 15:49:17 +02:00