infoderm / patients

:face_with_thermometer: Patients meteor app
GNU Affero General Public License v3.0
5 stars 2 forks source link

Upgrade `pdfjs-dist` to v3.5 #944

Open make-github-pseudonymous-again opened 2 months ago

make-github-pseudonymous-again commented 2 months ago

This is the first version of pdfjs-dist that fails because of SyntaxError: Unexpected token '||=':

I20240514-04:16:20.691(2)?   1) /imports/lib/pdf/pdf.tests.ts
I20240514-04:16:20.692(2)?        should work on the server:
I20240514-04:16:20.692(2)?      /home/runner/work/patients/patients/node_modules/pdfjs-dist/legacy/build/pdf.js:4907
I20240514-04:16:20.692(2)?     (intentState.renderTasks ||= new Set()).add(internalRenderTask);
I20240514-04:16:20.692(2)?                              ^^^
I20240514-04:16:20.693(2)? 
I20240514-04:16:20.693(2)? SyntaxError: Unexpected token '||='
I20240514-04:16:20.693(2)?       at wrapSafe (internal/modules/cjs/loader.js:1031:16)
I20240514-04:16:20.693(2)?       at Module._compile (internal/modules/cjs/loader.js:1080:27)
I20240514-04:16:20.693(2)?       at Module.Mp._compile (runtime.js:77:23)
I20240514-04:16:20.693(2)?       at Object.Module._extensions..js (runtime.js:105:23)
I20240514-04:16:20.694(2)?       at Module.load (internal/modules/cjs/loader.js:981:32)
I20240514-04:16:20.694(2)?       at Module.Mp.load (runtime.js:37:33)
I20240514-04:16:20.694(2)?       at Function.Module._load (internal/modules/cjs/loader.js:821:12)
I20240514-04:16:20.694(2)?       at Module.require (internal/modules/cjs/loader.js:1005:19)
I20240514-04:16:20.694(2)?       at require (internal/modules/cjs/helpers.js:107:18)
I20240514-04:16:20.694(2)?       at npmRequire (npm-require.js:111:12)
I20240514-04:16:20.694(2)?       at Module.useNode (packages/modules-runtime.js:751:18)
I20240514-04:16:20.694(2)?       at module (packages/modules.js:5156:8)
I20240514-04:16:20.694(2)?       at fileEvaluate (packages/modules-runtime.js:336:7)
I20240514-04:16:20.694(2)?       at Module.require (packages/modules-runtime.js:238:14)
I20240514-04:16:20.694(2)?       at Module.moduleLink [as link] (/home/runner/.meteor/packages/modules/.0.19.0.vw5cu9.x68za++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/@meteorjs/reify/lib/runtime/index.js:52:22)
I20240514-04:16:20.695(2)?       at getNamespace (packages/dynamic-import.js:630:10)
I20240514-04:16:20.695(2)?    => awaited here:
I20240514-04:16:20.695(2)?       at Function.Promise.await (/home/runner/.meteor/packages/promise/.0.12.2.qhmebw.8r9v9++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/promise_server.js:56:12)
I20240514-04:16:20.695(2)?       at imports/lib/pdf/pdf.ts:25:31
I20240514-04:16:20.695(2)?       at /home/runner/.meteor/packages/promise/.0.12.2.qhmebw.8r9v9++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
I20240514-04:16:20.695(2)?    => awaited here:
I20240514-04:16:20.695(2)?       at Function.Promise.await (/home/runner/.meteor/packages/promise/.0.12.2.qhmebw.8r9v9++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/promise_server.js:56:12)
I20240514-04:16:20.695(2)?       at imports/lib/pdf/pdf.tests.ts:16:3
I20240514-04:16:20.695(2)?       at /home/runner/.meteor/packages/promise/.0.12.2.qhmebw.8r9v9++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
make-github-pseudonymous-again commented 2 months ago

Should try to see if node module recompilation helps.

make-github-pseudonymous-again commented 2 months ago

With recompilation enabled, it complains about private class methods:

Errors prevented bundling:
While building for os.linux.x86_64:
node_modules/pdfjs-dist/build/pdf.js:
/home/runner/work/patients/patients/node_modules/pdfjs-dist/build/pdf.js: Class
private methods are not enabled. Please add
`@babel/plugin-proposal-private-methods` to your configuration.
   1551 |     return success;
   1552 |   }
 > 1553 |   #tryCleanup(delayed = false) {
        |   ^
   1554 |     this.#abortDelayedCleanup();
   1555 |     if (!this.#pendingCleanup) {
   1556 |       return false;

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! patients@ build: `meteor build "../dist" "--directory" "--server-only" "--architecture" "os.linux.x86_64"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the patients@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2024-05-14T02_59_43_078Z-debug.log