thheller / thheller/shadow-cljs
loading web assembly files (.wasm)
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 2.4k
- Forks
- 192
- Avg merge
- 3h 11m
- Merged PRs (30d)
- 1
Description
I saw a question on #clojurescript about this.
Maybe we want to load a Web Assembly module in cljs like this:
(ns my.example
(:require ["./foo.wasm" as foo])) ;; <-- hypothetical wasm loader needed
There is work happening to integrate wasm into the normal ecmascript module loading system via:
import "./foo.wasm"; // <-- (hypothetical static import)
import("./foo.wasm"); // <-- (hypothetical dynamic import)
In the meantime, cljs core will probably wait to load these until google closure does, but maybe shadow-cljs can add a loader that does the following (source):
- Get the .wasm bytes into a typed array or
ArrayBuffer - Compile the bytes into a
WebAssembly.Module - Instantiate the
WebAssembly.Modulewith imports to get the callable exports
For reference—how folks are doing it in the webpack world:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked WebAssembly JavaScript API and compare webpack’s wasm-simple example with the third-party wasm-loader. Done means determining how the proposed ClojureScript require form can load .wasm bytes, compile and instantiate the module with imports, and expose callable exports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, wasm
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100