pdf.js/external/dist
Jonas Jenwald 710704508c Fail early, in modern GENERIC builds, if certain required browser functionality is missing (issue 11762)
With two kind of builds now being produced, with/without translation/polyfills, it's unfortunately somewhat easy for users to accidentally pick the wrong one.

In the case where a user would attempt to use a modern build of PDF.js in an older browser, such as e.g. IE11, the failure would be immediate when the code is loaded (given the use of unsupported ECMAScript features).
However in some browsers/environments, in particular Node.js, a modern PDF.js build may load correctly and thus *appear* to function, only to fail for e.g. certain API calls. To hopefully lessen the support burden, and to try and improve things overall, this patch adds checks to ensure that a modern build of PDF.js cannot be used in browsers/environments which lack native support for critical functionality (such as e.g. `ReadableStream`). Hence we'll fail early, with an error message telling users to pick an ES5-compatible build instead.

To ensure that we actually test things better especially w.r.t. usage of the PDF.js library in Node.js environments, the `gulp npm-test` task as used by Node.js/Travis was changed (back) to test an ES5-compatible build.
(Since the bots still test the code as-is, without transpilation/polyfills, this shouldn't really be a problem as far as I can tell.)
As part of these changes there's now both `gulp lib` and `gulp lib-es5` build targets, similar to e.g. the generic builds, which thanks to some re-factoring only required adding a small amount of code.

*Please note:* While it's probably too early to tell if this will be a widespread issue, it's possible that this is the sort of patch that *may* warrant being `git cherry-pick`ed onto the current beta version (v2.4.456).
2020-04-01 19:42:48 +02:00
..
lib Fail early, in modern GENERIC builds, if certain required browser functionality is missing (issue 11762) 2020-04-01 19:42:48 +02:00
CODE_OF_CONDUCT.md Include the code of conduct for pdfjs-dist too 2019-03-30 19:00:57 +01:00
README.md [api-minor] Produce non-translated/non-polyfilled builds by default 2020-02-14 18:12:07 +01:00
webpack.js Merge pull request #11474 from Snuffleupagus/pdfjs-dist-rm-dependencies 2020-01-06 23:07:53 +01:00

PDF.js

PDF.js is a Portable Document Format (PDF) library that is built with HTML5. Our goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs.

This is a pre-built version of the PDF.js source code. It is automatically generated by the build scripts.

For usage with older browsers/environments, without support for modern features such as e.g. async/await, Promise, and ReadableStream, please refer to the es5 folder.

See https://github.com/mozilla/pdf.js for learning and contributing.