wavefnd / wavefnd/Wave

Add a standalone WebAssembly host interoperability example

Open
#661 0 comments 0 reactions 0 assignees View on GitHub
documentation good first issue needs testing
Dominant language
Rust
Stars
53
Forks
16
Avg merge
4h 22m
Merged PRs (30d)
46

Description

## Why

`examples/wasm_module.wave` exercises many WebAssembly backend features at once and is used by CI smoke tests. It includes `extern(c)` and `export(c)` host boundaries, but there is no small self-contained example showing how a JavaScript host actually provides and calls those functions.

## Scope

Add a small WebAssembly interoperability example under `examples/` with a Wave module and a minimal JavaScript host, preferably using Node.js and no third-party packages.

The example should demonstrate:

- importing one host function through `extern(c, "...")`;
- exporting one Wave function through `export(c, "...")`;
- instantiating the generated `.wasm` file from JavaScript;
- providing the required `env` import object;
- calling the Wave export and checking a deterministic result.

Keep this separate from the existing WebAssembly smoke module rather than expanding that file further. Missing-host-import diagnostics remain tracked separately by #453.

## Completion criteria

- [ ] The Wave source passes `wavec check` and builds for `wasm32-unknown-unknown`.
- [ ] The JavaScript host runs with the Node.js version already used by CI and requires no npm dependencies.
- [ ] The host supplies the imported function and successfully calls the exported Wave function.
- [ ] A short README or examples index entry includes the exact build and run commands.
- [ ] Existing `wasm_module.wave`, `wasm_run.wave`, and WASI smoke coverage remain unchanged.

Contributor guide

Open the contributing guide

Research direction

Start by reading examples/wasm_module.wave and examples/wasm_run.wave, then inspect the existing CI Node.js version and WebAssembly build commands. Add a separate Wave source, JavaScript host, and short README or examples index entry; done means wavec check and wasm32-unknown-unknown build pass, the host supplies env and gets the deterministic export result, and the existing smoke files remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, wasm
Domain
compilers, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.