Open ste26054 opened 1 week ago
For imports to work, you need to call jrsonnet_apply_static_import_callback() once. This method sets the import callback, which will use JS to read the files.
Without it, OS file importer will be used, and while it should work in theory with WASI, as I can see, you need some setup to make it work, is there something like _start export of wasm?..
https://github.com/bytecodealliance/wasmtime/issues/2902
I'll check why the bindings won't build with interop feature, thanks!
Thanks for the quick reply!
I see, I had commented out this call in my code.
Now I am getting error tried to import ./test.jsonnet, but absolute imports are not supported
Which may be due to wrong attempts I made to make the build pass, and logging from js env callbacks doesn't do much.
Regarding WASI, yes I can see a _start
exported function from the WASM file
Ok, I have found that CallbackImportResolver
does not implement resolve
function which is the reason for the above error (adding a print statement in ImportResolver
shows that it is indeed called).
Now I am clueless on how to actually implement it ^^
Hi!
I am trying to figure out how make
make test-js
work from thebindings
folder (running Node21.6.0
). My goal is being able to evaluate vanilla jsonnet files with imports working through WASI.I managed to get
vm.evaluateSnippet
to work on tagv0.5.0-pre96-test
, but I cannot getvm.evaluateFile
to work. It seems there was a refacto done at some point and bindings got broken 🤔. I now need to enableinterop
feature, butJsonnetImportCallback
type got changed.Here is my progress to make it work, though without much success for now: https://github.com/CertainLach/jrsonnet/compare/v0.5.0-pre96-test...ste26054:wasm-bindings?expand=1
Any help would be much appreciated 🙂