dukpy icon indicating copy to clipboard operation
dukpy copied to clipboard

Resolving modules paths possible?

Open pykong opened this issue 6 years ago • 1 comments

@amol- First of all thanks so much for putting up this interesting project!

As you have also mentioned webassets in your presentation on EuroPython 2016. https://www.slideshare.net/amol/pyconit7-dukpy-webassets-free-yourself-from-nodejs-chains

I wondered whether it would be possible to use dukpy to resolve paths of all css and js files in a node_modules folder.

Currently the necessary function require.resolve('module_name'); does not work.

We could then feed those paths directly into webassets' Bundle(). If we could simply catch and bundle all packages we have downloaded that way, it would alleviate the need to update our Bundle config every time we add dependencies. Or create an elaborate config in the first place.

Hence we would only need to run dukpy.install_jspackage('bootstrap) and it would be automagically made available in our web templates. Thereby we could indeed dismiss npm.

IMHO. This could be one of the hidden superpowers of dukpy. (Opposed to mere transpilations, because we can do this with webassets already.)

pykong avatar Jan 28 '18 01:01 pykong

I would be glad to accept a PR that implements what you are describing. In the end dukpy goals is to allow an alternative to nodejs for Python users. Just make sure it doesn't allow access outsidem of the modules path provided to the interpreter as it might be source of security issues.

amol- avatar Jun 03 '22 09:06 amol-