WIT package, MoonBit components, Node host and tests (WIP)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
SpriteandClaude Sonnet 5.5 committed 2026-11-24 23:36:35 +00:00
1 parent e5548fc067
commit e0bde1d150
125 files changed
+8681

No files matched your search

@@ -0,0 +1,36 @@
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
///|
fn wasmImportLaunch(p0 : Int, p1 : Int, p2 : Int) = "moonplasma:desktop/app-launch@0.1.0" "launch"
///|
#owned(str)
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
#|(func (param i32) (result i32) local.get 0)
///|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
#|(func (param i32) (result i32) local.get 0 i32.load)
///|
extern "wasm" fn mbt_ffi_free(position : Int) =
#|(func (param i32) local.get 0 call $moonbit.decref)
///|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#|(func (param i32) (result i32) (local i32)
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
#| local.tee 1 i32.const 0 call $moonbit.init_array8
#| local.get 1)
///|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
#|(func (param i32) (param i32) (result i32)
#| local.get 0
#| local.get 1 call $moonbit.init_array16
#| local.get 0)
///|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
@@ -0,0 +1 @@
warnings = "-44"
@@ -0,0 +1,13 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonplasma/desktop/interface/moonplasma/desktop/app-launch"
// Values
pub fn launch(String) -> Result[Unit, String]
// Errors
// Types and methods
// Type aliases
// Traits
@@ -0,0 +1,29 @@
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
///|
/// Ask the host to start an application by catalog id.
pub fn launch(id : String) -> Result[Unit, String] {
let ptr = mbt_ffi_str2ptr(id)
let return_area = mbt_ffi_malloc(12)
wasmImportLaunch(ptr, id.length(), return_area);
let lifted = match (mbt_ffi_load8_u((return_area) + 0)) {
0 => {
Result::Ok(())
}
1 => {
let result = mbt_ffi_ptr2str(mbt_ffi_load32((return_area) + 4), mbt_ffi_load32((return_area) + 8))
Result::Err(result)
}
_ => panic()
}
let ret = lifted
mbt_ffi_free(ptr)
mbt_ffi_free(return_area)
return ret
}