From ba846225b72514304304766d152ec9b9e2a8e782 Mon Sep 17 00:00:00 2001 From: make-github-pseudonymous-again <5165674+make-github-pseudonymous-again@users.noreply.github.com> Date: Sat, 11 May 2024 22:10:42 +0200 Subject: [PATCH] :arrow_up: deps: Upgrade pdfjs-dist to v4. --- imports/lib/pdf/pdf.ts | 8 ++++---- package-lock.json | 16 ++++++++-------- package.json | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/imports/lib/pdf/pdf.ts b/imports/lib/pdf/pdf.ts index b2f0bbd01..0496f75fc 100644 --- a/imports/lib/pdf/pdf.ts +++ b/imports/lib/pdf/pdf.ts @@ -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/'; @@ -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({ diff --git a/package-lock.json b/package-lock.json index af22be97f..3e9c5ee12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13737,10 +13737,10 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" }, - "path2d-polyfill": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path2d-polyfill/-/path2d-polyfill-2.0.1.tgz", - "integrity": "sha512-ad/3bsalbbWhmBo0D6FZ4RNMwsLsPpL6gnvhuSaU5Vm7b06Kr5ubSltQQ0T7YKsiJQO+g22zJ4dJKNTXIyOXtA==", + "path2d": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/path2d/-/path2d-0.2.0.tgz", + "integrity": "sha512-KdPAykQX6kmLSOO6Jpu2KNcCED7CKjmaBNGGNuctOsG0hgYO1OdYQaan6cYXJiG0WmXOwZZPILPBimu5QAIw3A==", "optional": true }, "pathval": { @@ -13750,12 +13750,12 @@ "dev": true }, "pdfjs-dist": { - "version": "3.11.174", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz", - "integrity": "sha512-TdTZPf1trZ8/UFu5Cx/GXB7GZM30LT+wWUNfsi6Bq8ePLnb+woNKtDymI2mxZYBpMbonNFqKmiz684DIfnd8dA==", + "version": "4.2.67", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.2.67.tgz", + "integrity": "sha512-rJmuBDFpD7cqC8WIkQUEClyB4UAH05K4AsyewToMTp2gSy3Rrx8c1ydAVqlJlGv3yZSOrhEERQU/4ScQQFlLHA==", "requires": { "canvas": "^2.11.2", - "path2d-polyfill": "^2.0.1" + "path2d": "^0.2.0" } }, "pend": { diff --git a/package.json b/package.json index 85b2ea20a..36da96ee8 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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",