Skip to content

Commit

Permalink
⬆️ deps: Upgrade pdfjs-dist to v4.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed May 11, 2024
1 parent 788587b commit ba84622
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions imports/lib/pdf/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export {type DocumentInitParameters} from 'pdfjs-dist/types/src/display/api';
export {type PageViewport} from 'pdfjs-dist/types/src/display/display_utils';

export const WORKER_URL = Meteor.isClient
? '/pdfjs-dist/build/pdf.worker.min.js'
: 'pdfjs-dist/legacy/build/pdf.worker.js';
? '/pdfjs-dist/build/pdf.worker.min.mjs'
: 'pdfjs-dist/legacy/build/pdf.worker.mjs';
export const CMAP_URL = Meteor.isClient
? '/pdfjs-dist/cmaps/'
: './npm/node_modules/pdfjs-dist/cmaps/';
Expand All @@ -23,12 +23,12 @@ export async function fetchPDF({
}: DocumentInitParameters) {
const pdfjs = Meteor.isClient
? await import('pdfjs-dist')
: await import('pdfjs-dist/legacy/build/pdf.js');
: await import('pdfjs-dist/legacy/build/pdf.mjs');

if (pdfjs.GlobalWorkerOptions.workerSrc === '') {
pdfjs.GlobalWorkerOptions.workerSrc = WORKER_URL;
// NOTE For CDN delivery
// pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
// pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.mjs`;
}

return pdfjs.getDocument({
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@fontsource/roboto/700.css": "copy public/@fontsource/roboto/",
"@fontsource/roboto/files/*.woff": "copy public/@fontsource/roboto/files/",
"@fontsource/roboto/files/*.woff2": "copy public/@fontsource/roboto/files/",
"pdfjs-dist/build/pdf.worker.min.js": "copy public/pdfjs-dist/build/",
"pdfjs-dist/build/pdf.worker.js.map": "copy public/pdfjs-dist/build/",
"pdfjs-dist/legacy/build/pdf.worker.min.mjs": "copy public/pdfjs-dist/build/",
"pdfjs-dist/legacy/build/pdf.worker.mjs.map": "copy public/pdfjs-dist/build/",
"pdfjs-dist/cmaps/": "copy public/pdfjs-dist/cmaps",
"pdfjs-dist/standard_fonts/": "copy public/pdfjs-dist/standard_fonts"
},
Expand Down Expand Up @@ -115,7 +115,7 @@
"meteor-node-stubs": "^1.2.5",
"notistack": "^3.0.1",
"papaparse": "^5.4.1",
"pdfjs-dist": "~3.11.0",
"pdfjs-dist": "~4.2.67",
"qrcode.react": "^3.1.0",
"rate-limiter-flexible": "^3.0.0",
"react": "^18.2.0",
Expand Down

0 comments on commit ba84622

Please sign in to comment.