Open krmax44 opened 1 year ago
This looks interesting. I like the idea of being able to use tree shaking, and getting rid of the postinstall script. It would also make the code a lot simpler.
I can see two drawbacks/tricky problems right now:
I think this is definitely worth looking into. Thanks for the suggestion!
I'm interested in hearing what others think so please add your thoughts if you're reading this.
Any update or further thoughts on this? I would love the library to move in this direction, since I'm using it in a pnpm monorepo and I haven't been able to get the postinstall rebuild to work reliably / at all. And regardless of that issue, relying on a flexible architecture vs a custom build is a no brainer imo.
I'd advocate that the drawbacks listed are non-issues:
No update but I do think about it now and then.
For saving bytes I think it's a common use case that the only thing you're interested in is e.g. date or GPS location. Then this new architecture could probably make the bundle 5+ times bigger. (I don't think it's manageable to have each Exif tag as a plugin, and the other types of metadata don't even have specific tags like that.) That doesn't mean it's a big enough reason not to make the change though.
Anyway, I've mostly been waiting for more thoughts on and interest in this (except for finding the time). Also, are there good examples of other libraries that do this type of thing? I can't think of any myself that has this kind of plugin architecture. All the ones that have good tree shaking behavior that I come to think of have a very different setup with more stand-alone modules.
I'd like to propose using ESM imports and a plugin system as an addition (or replacement) for custom builds. To me, this has the following advantages:
The API could look something like this:
Since we only import some modules, the build processor can exclude the unused ones.