Improve how the PDF.js version/commit information is exposed in the *built* files #19956
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To make it easier to tell which PDF.js version/commit that the built files correspond to, they have (since many years) included
pdfjsVersion
andpdfjsBuild
constants with that information.As currently implemented this has a few shortcomings:
It requires manually adding the code, with its preprocessor statements, in all relevant files.
It requires ESLint disable statements, since it's obviously unused code.
Being unused, this code is removed in the minified builds.
This information would be more appropriate as comments, however Babel discards all comments during building.
It would be helpful to have this information at the top of the built files, however it's being moved during building.
To address all of these issues, we'll instead utilize Webpack to insert the version/commit information as a comment placed just after the license header.