-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump pdfjs-dist from 3.8.162 to 4.0.269 (#6281)
* Bump pdfjs-dist from 3.8.162 to 4.0.269 Bumps [pdfjs-dist](https://github.com/mozilla/pdfjs-dist) from 3.8.162 to 4.0.269. - [Commits](https://github.com/mozilla/pdfjs-dist/commits) --- updated-dependencies: - dependency-name: pdfjs-dist dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * enable top level awaits * await pdfjslib * top level awaits in ts files * use webpack bundled for prod * ignore unnecesary types * upgrade pdfjs-dist * update yarn lock * use correct eslint channel * fix type error * fixed e2e --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Santiago <[email protected]> Co-authored-by: Santiago <[email protected]>
- Loading branch information
1 parent
5116804
commit c63662c
Showing
8 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
/* eslint-disable import/no-mutable-exports, global-require, prefer-destructuring */ | ||
import * as pdfjs from 'pdfjs-dist'; | ||
import { EventBus } from 'pdfjs-dist/web/pdf_viewer.mjs'; | ||
import { isClient } from 'app/utils'; | ||
import { EventBus } from 'pdfjs-dist/web/pdf_viewer'; | ||
|
||
let PDFJS = {}; | ||
let pdfjsLib = {}; | ||
|
||
if (isClient) { | ||
require('../../../node_modules/pdfjs-dist/web/pdf_viewer.css'); | ||
PDFJS = require('../../../node_modules/pdfjs-dist/web/pdf_viewer.js'); | ||
const pdfjsLoader = async () => { | ||
if (isClient) { | ||
import('pdfjs-dist/web/pdf_viewer.css'); | ||
PDFJS = await import('pdfjs-dist/web/pdf_viewer.mjs'); | ||
|
||
if (process.env.HOT || process.env.NODE_ENV === 'test') { | ||
pdfjsLib = require('pdfjs-dist'); | ||
} else { | ||
pdfjsLib = require('pdfjs-dist/webpack'); | ||
if (process.env.HOT || process.env.NODE_ENV === 'test') { | ||
pdfjsLib = pdfjs; | ||
pdfjsLib.GlobalWorkerOptions.workerSrc = await import('pdfjs-dist/build/pdf.worker.min.mjs'); | ||
} else { | ||
pdfjsLib = await import('pdfjs-dist/webpack.mjs'); | ||
} | ||
} | ||
}; | ||
|
||
pdfjsLib.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.entry'); | ||
} | ||
await pdfjsLoader(); | ||
|
||
export default { ...PDFJS, ...pdfjsLib }; | ||
|
||
export { EventBus }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
/* eslint-disable global-require */ | ||
import * as pdfJsDist from 'pdfjs-dist'; | ||
import * as viewer from 'pdfjs-dist/web/pdf_viewer'; | ||
import * as viewer from 'pdfjs-dist/web/pdf_viewer.mjs'; | ||
import 'pdfjs-dist/web/pdf_viewer.css'; | ||
|
||
let pdfjs; | ||
let pdfjs = pdfJsDist; | ||
const PDFJSViewer = viewer; | ||
const { EventBus } = viewer; | ||
const CMAP_URL = 'legacy_character_maps'; | ||
|
||
if (process.env.HOT || process.env.NODE_ENV === 'test') { | ||
//this is to trigger pdfjs-dist fake worker instantiation in non production environments | ||
const fakeWorker = require('pdfjs-dist//build/pdf.worker.entry.js'); | ||
pdfjs = pdfJsDist; | ||
pdfjs.GlobalWorkerOptions.workerSrc = fakeWorker; | ||
} else { | ||
pdfjs = require('pdfjs-dist/webpack'); | ||
} | ||
const pdfjsLoader = async () => { | ||
if (process.env.HOT || process.env.NODE_ENV === 'test') { | ||
//@ts-ignore | ||
//this is to trigger pdfjs-dist fake worker instantiation in non production environments | ||
const fakeWorker = await import('pdfjs-dist/build/pdf.worker.min.mjs'); | ||
pdfjs.GlobalWorkerOptions.workerSrc = fakeWorker; | ||
} else { | ||
//@ts-ignore | ||
//webpack bundled version for production, types are not needed. | ||
pdfjs = await import('pdfjs-dist/webpack.mjs'); | ||
} | ||
}; | ||
|
||
const PDFJS: typeof pdfjs = pdfjs; | ||
await pdfjsLoader(); | ||
|
||
const PDFJS = pdfjs; | ||
|
||
export { PDFJS, PDFJSViewer, EventBus, CMAP_URL }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters