cantoo-scribe / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
119 stars 24 forks source link

Update pako dependency to version ^2.0.2 for better tree shaking #24

Open andreaslarssen opened 1 year ago

andreaslarssen commented 1 year ago

Describe your idea

From https://github.com/Hopding/pdf-lib/issues/689:

Angular11 generates warnings for pdf-lib because of the old module format of pako

Warning: C:\Users*****\node_modules\pdf-lib\es\core\PDFContext.js depends on 'pako'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: C:\Users*****\node_modules@pdf-lib\upng\UPNG.js depends on 'pako'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Recently pako switched with version 2.0.0 to es6. Would it be possible to update the dependency? Thank you!

How could this be implemented?

See above

What problem are you trying to solve?

See above

Why does this matter to you?

Optimization bailouts, and prevents us from upgrading to Angular 16 (?)

Would others find this helpful?

Yes

Are you interested in implementing your proposal?

No

Why are you submitting a proposal?

To keep the lib alive

Additional Notes

No response

Sharcoux commented 1 year ago

Hey there!

We can do that, but pdf-lib relies on:

andreaslarssen commented 1 year ago

Right... and both https://github.com/Hopding/standard-fonts/pull/2 and https://github.com/Hopding/upng/pull/1 are dead in the water...

How about forking the dependencies as well?

Sharcoux commented 1 year ago

Ok, let's do that:

andreaslarssen commented 1 year ago

I'm currently working for a client that uses this package, so I would have to ask them about spending my time on the upng-package. As for the standard-fonts package, I would not be able to maintain this over time, so it seems like a bad idea for me to fork it. Maybe someone who's more invested in the package could do it?

Sharcoux commented 1 year ago

Would your client be able to maintain it?

andreaslarssen commented 1 year ago

I really doubt that's going to happen

DineshSolanki commented 1 year ago

I just published a standard-fonts package with updated dependency, mind trying it out https://www.npmjs.com/package/@dineshsolanki/standard-fonts

Sharcoux commented 1 year ago

@andreaslarssen @DineshSolanki Can someone open a PR on UPNG.js to upgrade pako, or at least open an issue explaining the problem? This way we don't need to open and maintain yet another fork.