PetterS / quickjs

Thin Python wrapper of https://bellard.org/quickjs/
https://github.com/bellard/QuickJS
MIT License
179 stars 19 forks source link

Module Access #51

Open justin0mcateer opened 3 years ago

justin0mcateer commented 3 years ago

What is the current expectation around module functionality? I don't seem to be able to utilize the in-build QuickJS modules like 'console' or 'std'. Am I doing something wrong, are these expected to be available?

If I try to load external modules, I get the following error: _quickjs.JSException: ReferenceError: could not load module

PetterS commented 3 years ago

No they are not available at all.

PetterS commented 3 years ago

I have a couple of PRs (#21, #22) that have experimented with adding support for modules in different ways.

What you can do now is to expose Python functions to the JS code.

justin0mcateer commented 3 years ago

I saw those PRs. Are they usable at all? One approach appears to primarily lean on additional C code from the QuickJS project. Can you comment on which approach might be the best way forward and what remains to be done to make it useful?

PetterS commented 3 years ago

21 should make built-in QuickJS modules available.

But I don't really want to make them available. I am more interested in being able to parse and import JS modules.