Hey there! I want to share a simple key-value interface and a wasm component demo using the latest "component-model" feature from wasmtime
, thewit-bindgen
tool and wasm-tools
. I did this primarily for my own learning and keeping track of the progress on wasm component tool-chains. I thought it would be beneficial for the community to see an example of running something similar to real-world scenario that involves in a in-memory keyvalue store.
Check it out here https://github.com/Mossaka/keyvalue-component-model-demo!
That all looks pretty good to me! I'm curious though if you found this flag to be necessary or if it's copied from elsewhere?
You might also be interested in getting the wasi_snapshot_preview1.wasm from here and seeing how that works out. That will require copying some *.wit
into your repo though, but in theory you can slim down the wit to just what your one module needs rather than implementing all of preview2
I'm curious though if you found this flag to be necessary or if it's copied from elsewhere?
It is copied from wit-bindgen https://github.com/bytecodealliance/wit-bindgen/blob/main/crates/test-helpers/macros/build.rs#L136
Thanks for providing the link to "wasi_snapshot_preview1.wasm"!
Hey! Do you have any insights into this error? The wasi_snapshot_preview1.wasm
was built from preview2-prototyping repo.
wasm-tools component new ./guest/target/wasm32-wasi/debug/guest.wasm --adapt ../preview2-prototyping/target/wasm32-unknown-unknown/release/wasi_snapshot_preview1.wasm
Error: failed to encode a component from module
Caused by:
0: failed to reduce input adapter module to its minimal size
1: locally-defined memories are not allowed define a local memory
Nevermind, once I updated wasm-tools to the latest version from the main
branch. This problem went away.
However, I still have the same issue with using wit-component
as a crate.
Updated the repo to use wasi_snapshot_preview1.wasm from the preview2-prototyping repo! https://github.com/Mossaka/keyvalue-component-model-demo
Last updated: Dec 23 2024 at 13:07 UTC