moonbit-js-binding
Installation
SKILL.md
MoonBit JS Binding Guide
Step-by-step workflow for binding JavaScript APIs (browser DOM, Node built-ins, npm packages) to MoonBit through the js backend.
When To Use
Use this skill when:
- Adding
extern "js" fndeclarations for a JS API - Embedding inline JS (
#| (x) => ...) or importing by module+name (= "Math" "max") - Configuring
moon.pkgwithlink.jsexports andformat: esm/cjs/iife - Wrapping JS objects with
#external pub typeand%identitycasts - Bridging Promises with
async fn+%async.suspend+%async.run - Mapping
undefined/nulldistinctly into MoonBitOption - Consuming npm packages via
require(...)or ESM imports - Generating
.d.tsfor TypeScript consumers