[Debian-science-sagemath] <DKIM> Re: <DKIM> Re: widgetsnbextension situation

Ximin Luo infinity0 at debian.org
Tue Nov 15 16:04:00 UTC 2016


Julien Puydt:
> Hi,
> 
> On 15/11/2016 11:26, Ximin Luo wrote:
>> Julien Puydt:
>>> On 15/11/2016 02:51, Ximin Luo wrote:
>>>
>>>> Perhaps we can use this information to regenerate extension.js without using webpack itself. Julien, have you seen anything approximating this approach before?
>>>>
>>>
>>> Yes.
>>>
>>> I would try using the compile-modules command from my package node-es6-module-transpiler -- and that might not even be necessary.
>>>
>>> As I already mentioned (did I really?), webpack is mostly used to put together various chunks of javascript code and "compress" them so they're smaller for web use -- so there's a chance we can get away by not compressing anything and just installing the files as-is. That would mean just writing a debian/install file putting the un-modified source files at a right place so they find each other at runtime!
>>>
>>
>> I'm not sure if runtime-linking would be easy to make work. Do you have an example of this somewhere?
> 
> Well, as far as I know, you just have to "foo=require('foo');" and you can then use module foo... or did I miss something?
> 

require() is for "commonjs" javascript modules run through nodejs. But if I understand correctly, widgetsnbextension is meant to be used client-side from a browser, where "require" doesn't exist in that form. This is why there are like 1000 different "packagers" for javascript to process NPM modules and their dependencies and wrap them with all this extra nonsense.

To get runtime-linking to work in the way that you're thinking, the server (ipywidgets) would also have to know about all of the filesystem paths where these modules exist, and map them to web url paths, and serve them to the client. I don't think this is something that we should try to add to ipywidgets...

I'll try the other tools you mentioned, node-ast-util sounds like it has some potential.

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git



More information about the Debian-science-sagemath mailing list