Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.2.1
12 changes: 8 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "rules_go", version = "0.59.0")

# MoonBit language support for WebAssembly components
# dev_dependency because rules_moonbit is not yet in BCR - users who want
# MoonBit support must add their own bazel_dep + git_override for rules_moonbit
bazel_dep(name = "rules_moonbit", version = "0.1.0", dev_dependency = True)
# Required for moonbit_wasm_cli and moonbit_wasm_binary rules
# Note: rules_moonbit is not yet in BCR - uses git_override
bazel_dep(name = "rules_moonbit", version = "0.1.0")
git_override(
module_name = "rules_moonbit",
remote = "https://github.com/pulseengine/rules_moonbit.git",
commit = "be9d90fe4acffd9b913d3097e64aff8a203ef4de",
commit = "b5bbfe8ef1f87b42c77f168640817f67ed8758a3",
)

# OCI image signing capabilities
bazel_dep(name = "rules_oci", version = "2.2.6")

# Override aspect_bazel_lib for Bazel 9.0 compatibility
# rules_oci@2.2.6 depends on aspect_bazel_lib@2.7.2 which has toolchains visibility issues
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")

# Hermetic toolchain management with pre-built binaries

# Development dependencies
Expand Down
11,283 changes: 451 additions & 10,832 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions checksums/tools/componentize-py.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
"tool_name": "componentize-py",
"github_repo": "bytecodealliance/componentize-py",
"latest_version": "canary",
"last_checked": "2026-01-11T00:00:00Z",
"last_checked": "2026-01-23T00:00:00Z",
"versions": {
"canary": {
"release_date": "2026-01-02",
"release_date": "2026-01-23",
"platforms": {
"darwin_arm64": {
"sha256": "ccc92feabd847dbf71852fd8aef7940eb243fc6dca8d61a275fb067030aae3ef",
"sha256": "9c1e8795c2fd9d2e7a23fbb4930c2046c3dcf6f5c1bd6b1d37f812e0db172cbf",
"url_suffix": "macos-aarch64.tar.gz"
},
"darwin_amd64": {
"sha256": "f6eee0ef74c491b694d817f2f4fd36e4c6c53c8a04ac280c1a09d615a8d8443a",
"sha256": "940a1e905b32e8eee672e43488c320cf864eec9e173dc9b3f4d6065de872b1c4",
"url_suffix": "macos-amd64.tar.gz"
},
"linux_arm64": {
"sha256": "be9514228023b9a71879f5277c08469fe3edf24d2dc70b2498b5e61e5fb6315b",
"sha256": "78713230763f358bf783564a505a258036217d95c52554c47e4f3b0ac35ebd55",
"url_suffix": "linux-aarch64.tar.gz"
},
"linux_amd64": {
"sha256": "fd7538ca22357ee579f7f97c7cd62ad7230ec3d2a3b4ecedd93f5103975e9040",
"sha256": "cc06500c6c1b48003b045126e4e4ee44c8f2b987167d8d50c70917d452dd7b47",
"url_suffix": "linux-amd64.tar.gz"
},
"windows_amd64": {
"sha256": "710a6d533fd06808d424d2157825e1fbc86c2e94bd5f8f93ce52b72b5cb3465e",
"sha256": "ac0a99a280de55aa3fd87b316a9b3b323c88304101c1e5cc777b351fb78a0a4a",
"url_suffix": "windows-amd64.tar.gz"
}
}
Expand Down
29 changes: 27 additions & 2 deletions checksums/tools/wit-bindgen.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
{
"tool_name": "wit-bindgen",
"github_repo": "bytecodealliance/wit-bindgen",
"latest_version": "0.50.0",
"last_checked": "2026-01-01T13:28:37.434115Z",
"latest_version": "0.51.0",
"last_checked": "2026-01-20T12:00:00.000000Z",
"versions": {
"0.51.0": {
"release_date": "2026-01-12",
"platforms": {
"linux_arm64": {
"sha256": "d3c65f0d246b56f333713b3efed3727ea2fdc15d17e8cb488ad4bad30460dee8",
"url_suffix": "aarch64-linux.tar.gz"
},
"darwin_arm64": {
"sha256": "e2298828b1fda363c507ac6f049260741709ed289d6a501e4f506afdf1b77ac2",
"url_suffix": "aarch64-macos.tar.gz"
},
"linux_amd64": {
"sha256": "bbe23eda4f180e456aa218e569f8e4e8a4f4ecf96dbbc10386e4d71c567a5782",
"url_suffix": "x86_64-linux.tar.gz"
},
"darwin_amd64": {
"sha256": "24d07b30cbeafea083b77b3be2d686470243820c6505a846e65cabafe1dcd414",
"url_suffix": "x86_64-macos.tar.gz"
},
"windows_amd64": {
"sha256": "73e0a672e9f17240ac427969f8f27040a7fb1258ae0683effdf48f2afbd7aab5",
"url_suffix": "x86_64-windows.zip"
}
}
},
"0.48.0": {
"release_date": "2025-11-14",
"platforms": {
Expand Down
14 changes: 13 additions & 1 deletion examples/moonbit_component/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Prerequisites:
"""

load("@rules_moonbit//moonbit:defs.bzl", "moonbit_wasm")
load("//moonbit:defs.bzl", "moonbit_wasm_binary", "moonbit_wasm_component")
load("//moonbit:defs.bzl", "moonbit_wasm_binary", "moonbit_wasm_cli", "moonbit_wasm_component")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -64,3 +64,15 @@ moonbit_wasm_binary(
lib = ":hello_core",
tags = ["manual"], # BLOCKED: MoonBit println uses spectest, not WASI
)

# =============================================================================
# WASI CLI with Generated Bindings (NEW - solves spectest issue)
# =============================================================================
# This approach uses wit-bindgen moonbit to generate proper WASI bindings,
# avoiding the spectest dependency entirely.

moonbit_wasm_cli(
name = "hello_wasi",
srcs = ["hello_wasi.mbt"],
tags = ["manual"], # MoonBit toolchain only on darwin_arm64, linux_amd64, windows_amd64
)
32 changes: 32 additions & 0 deletions examples/moonbit_component/hello_wasi.mbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// MoonBit WASI CLI Example
///
/// This example uses wit-bindgen generated WASI bindings for stdout.
/// Unlike hello.mbt which uses MoonBit's println (spectest-based),
/// this uses proper WASI interfaces that work with wasmtime.

/// The run function is exported by wasi:cli/command world
/// Returns Ok(()) for success, Err(()) for failure
pub fn run() -> Result[Unit, Unit] {
// Get stdout handle from generated WASI bindings
let stdout = @stdout.get_stdout()

// Convert message to bytes
let msg = "Hello from MoonBit WASI CLI!\n"
let bytes = string_to_bytes(msg)

// Write to stdout using WASI streams
match stdout.blocking_write_and_flush(bytes) {
Ok(_) => Ok(())
Err(_) => Err(())
}
}

/// Helper function to convert a String to FixedArray[Byte]
fn string_to_bytes(s : String) -> FixedArray[Byte] {
let len = s.length()
let bytes = FixedArray::make(len, b'\x00')
for i = 0; i < len; i = i + 1 {
bytes[i] = s[i].to_int().to_byte()
}
bytes
}
5 changes: 5 additions & 0 deletions moonbit/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ load(
"//moonbit/private:moonbit_wasm_binary.bzl",
_moonbit_wasm_binary = "moonbit_wasm_binary",
)
load(
"//moonbit/private:moonbit_wasm_cli.bzl",
_moonbit_wasm_cli = "moonbit_wasm_cli",
)
load(
"//moonbit/private:moonbit_wasm_component.bzl",
_moonbit_wasm_component = "moonbit_wasm_component",
Expand All @@ -72,3 +76,4 @@ load(
# Re-export public rules
moonbit_wasm_component = _moonbit_wasm_component
moonbit_wasm_binary = _moonbit_wasm_binary
moonbit_wasm_cli = _moonbit_wasm_cli
9 changes: 9 additions & 0 deletions moonbit/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ bzl_library(
"//providers",
],
)

bzl_library(
name = "moonbit_wasm_cli",
srcs = ["moonbit_wasm_cli.bzl"],
visibility = ["//visibility:public"],
deps = [
"//providers",
],
)
Loading
Loading