Originally I really aimed to solve this issue is at the packaging level - I want to be able to have the standard
python setup.py bdist_wheel command to also extract the require bits from the
node_modules directory and put everything into the right place so the final Python wheel will include it, along with option to build/bundle the artifact(s) into the wheel, specifically the package's metadata sections (i.e. package's
dist-info directory). Given that Plone package doesn't do this to aid zcml declarations, I will need to do this when I get around to do the Plone support/integration bit.
If that part is done, and say if we can have entry points defined like this as per your use case:
'plone.bundle.node_modules': [ # or maybe collective.bundle.node_modules
'lazysizes/lazysizes-umd.js = collective.lazysizes.static',
'lazysizes/lazysizes-umd.min.js = collective.lazysizes.static',
'lazysizes/plugins/twitter/ls.twitter.js = collective.lazysizes.static',
'lazysizes/plugins/twitter/ls.twitter.min.js = collective.lazysizes.static',
And a command can be created to put them into the right places - this is something I had considered doing, but I need to put that new registry together and the functionality together. While it might not address all your issues this might help with building the wheels a bit easier (i.e. without having to manually copy those four JS files every time a new release is made), and users of the package will basically get the copy from the wheel.
For development and situations where a user want complete control over the artifact generation (i.e. using
calmjs.rjs), the other declaration will be needed so that, so that their generated artifact for use with
Thank you for your question, it is giving me ideas on how I can make this better for everyone, even though right now it can't quite be used for what you want to do.