Comments (5)
One point of discussion amongst the team was whether we should try to make a universal JS library that switches out the FFI library depending on the platform, or we should just make 1 SDK per runtime (e.g. node, deno, bun). Any input on this decision would be helpful. Has anyone ever created a library that works on all of them and uses FFI?
from extism.
I think the most maintainable way forward would be to have a single Typescript interface implementation that is used by node/deno/bun and wrap the FFI-specific code behind that implementation per host runtime. I haven't done any FFI based implementation though so I'm not sure what this would look like.
from extism.
This is definitely something we want to do. I was planning on starting it tonight actually.
Do you think the API should be mostly the same as the Node.js one? I'm not so familiar with Deno but think there are maybe some other types/patterns that could be used.
EDIT: I have not yet started this, open to PRs or suggestions on implementations!
from extism.
It's also worth considering the possibility of re-using the Extism browser-runtime
, which is an implementation of the rust runtime on top of JavaScript-native WebAssembly APIs. If each of Bun/Deno/Node use the same APIs for WebAssembly, it might be advantageous to instead work on converging the browser runtime to this "universal" JavaScript SDK.
from extism.
For anyone landing on this issue, I was able to get it to work pretty easily by just using the browser runtime as @nilslice mentioned. All you need to do is import it like a normal npm package:
import { ExtismContext } from "npm:@extism/[email protected]"
See some more docs here: https://extism.org/docs/integrate-into-your-codebase/browser-runtime-sdk
I'm going to close this in favor of more focused discussions to come later. Perhaps there is more we can do to better integrate with Deno.
from extism.
Related Issues (20)
- runtime: update `Plugin::function_extists` and `extism_plugin_function_exists` to check the type of the functions too HOT 4
- derive that forwards From/ToBytes to specific encoding HOT 4
- runtime: wasi preview2 HOT 10
- How do I silence debug logs in the extism crate? HOT 1
- discord link in readme is expired HOT 6
- Add support for multiple arguments
- Pass plug-in ID into `set_log_callback` callback function
- Error: http: request body too large (recovered by wazero) HOT 5
- option for a WASM instr limit per call HOT 1
- look into calling `_initialize` on all linked plugins when initializing the guest runtime, not just the main module HOT 1
- Question about plugin return types HOT 3
- Direct disk/filesystem access HOT 4
- Cost of the function call throught host/guest boundary HOT 8
- Synchronizing the content of `wasm` folder HOT 2
- feat: add manifest field to limit the size of Extism vars HOT 1
- Extism gem fails to load on Ruby 3.3.0 on macOS HOT 6
- Async / Await / Generators / Coroutines in Plugins HOT 3
- How to unload a plugin? HOT 3
- Could we get access to the `id` on `CurrentPlugin`
- add a feature to control which wasm backend is enabled? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extism.