@jcbhmr/bun-build-compile-target-starlingmonkey-wasip2-wasm32
v0.1.0
Published
<table align=center><td>
Readme
bun build --compile for StarlingMonkey
bunx bun-build-compile-target-starlingmonkey-wasip2-wasm32 \
./index.ts \
--starlingmonkey-wit-path ./package.wit \
--outfile ./app.wasm⚛️ Embeds JavaScript code into StarlingMonkey WebAssembly component
📦 Bundles everything using Bun.build()/bun build
🔌 Designed to extend the Bun.build()/bun build that you're used to
Installation
You can install this package from npm using Bun.
bun add @jcbhmr/bun-build-compile-target-starlingmonkey-wasip2-wasm32[!WARNING] This package only works with Bun. It does not work with Node.js, Deno, or the browser.
Usage
Similar to Bun.build()/bun build, you can use this package either via CLI or programmatically as a library. The recommended way is to start with the CLI in your package.json scripts section and later use the library via bun ./build.ts if you need plugins or other dynamic functionality.
CLI
package octocat:[email protected];
interface greetings {
greeting-for: func(name: string) -> string;
}
world hello-world {
export greetings;
}export const greetings = {
greetingFor(name: string): string {
return `Hi ${name}! How are you today?`;
},
}bunx bun-build-compile-target-starlingmonkey-wasip2-wasm32 \
./index.ts \
--starlingmonkey-wit-path ./package.wit \
--outfile ./app.wasmwasmtime --invoke 'greeting-for("Alan Turing")' ./app.wasm"Hi Alan Turing! How are you today?"Library
const output = await bunBuildCompileTargetStarlingMonkeyWasiP2Wasm32({
entrypoints: ['./index.ts'],
compile: {
starlingmonkey: {
witPath: './package.wit',
},
outfile: './app.wasm',
},
});Development
TODO
