Replies: 1 comment 1 reply
-
Hi David, Thanks.. I'm not sure my project will compile to wasm, haven't had the time to look at it yet.. i guess my main 'competitor' in that respect would be this project Kind regards |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Overall, liking the library so far, there doesn't seem to be a "top" choice for embedding QuickJS into Rust projects that is being actively maintained/used so you have an opportunity here especially if it compiles to WASM as a target too (I read there were some issues compiling QuickJS to WASM - is that the case?), and I think the abstractions you've used make sense as well separating out additional features such as fetch/console into a different library which is optional. Be good to get the TS parser library added to Cargo too instead of using the Git URL so I can lock a version too.
The use case I'm trying to implement, which I suspect will be the most common for embedding QuickJS in Rust, is providing a js/ts sandbox for running plugin extensions in my Rust project, which can also provide some custom APIs to QuickJS the plugins can use to securely access data/features of the main app.
The plugin would either be a single file with a function to call, or an object/module with defined method names that can be called as needed, and there could be multiple plugins loaded on startup, which can also call a secure JS api to access the main app data/features as needed.
This would require being able to add custom APIs to the QuickJS context which all plugins can access (i.e. api.getCurrentUser()), loading plugins which ideally could be introspected to see which methods (hooks) are implemented, then being able to call those hooks in the Rust main application as needed, to run all the plugins that support that hook and handle the results if any. If that could also be done using WASM and using ts/js to configure the sandbox, then you also open up the possibility of securely running 3rd party plugins in the browser!
It would be great to have an example that shows this use case as a minimum, or ideally provide another library (i.e. js_plugins) that used your QuickJS runtime to achieve this with some high level functions to:
If I end up building something generalized I may be able to help with this effort, putting it on the backlog now!
Beta Was this translation helpful? Give feedback.
All reactions