Skip to content

fix: reject unsupported wasm targets at the package boundary - #23

Merged
oboard merged 2 commits into
mainfrom
fix/wasm-target-support
Aug 21, 2026
Merged

fix: reject unsupported wasm targets at the package boundary#23
oboard merged 2 commits into
mainfrom
fix/wasm-target-support

Conversation

@oboard

@oboard oboard commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Problem

At main@c545db2, the README states Mocket supports the JS and native backends, but moon.pkg still selects mocket.wasm.mbt and serve.mbt for wasm/wasm-gc. As a result, server code using Mocket::listen type-checks for those targets and then traps at runtime:

moon check <package> --target wasm    # succeeds
moon run <package> --target wasm
# RuntimeError: unreachable
#   at @oboard/mocket.listen_ffi
#   at @oboard/mocket.Mocket::listen

Fix

Declare the package's actual backend support at the top level of moon.pkg:

supported_targets = "+js+native"

This makes moon check/moon build reject wasm and wasm-gc consumers at the package boundary, matching the README and avoiding runtime-only panic stubs.

The cors and static_file sub-packages depend on oboard/mocket and are likewise js/native-only, so they now declare supported_targets explicitly (this also removes the "does not declare supported_targets" warnings they would otherwise emit once the parent package declares its targets).

Verification

  • moon check --target wasm on a wasm consumer that calls Mocket::listen now fails at build time:

    Selected backend 'wasm' is incompatible with the dependency graph. '...' requires 'oboard/mocket' which supports [js, native].
    
  • moon check --target wasm-gc fails the same way.

  • moon check --target js and --target native still pass.

  • moon check --target all finishes cleanly with no warnings.

🤖 Generated with Claude Code

oboard and others added 2 commits August 21, 2026 14:21
The package still selected mocket.wasm.mbt and serve.mbt for wasm/wasm-gc,
so Mocket::listen type-checked for those targets and then trapped at
runtime in the panic stubs. Declare supported_targets at the package
boundary so wasm/wasm-gc consumers are rejected at build/check time,
matching the README.

Also declare supported_targets on the cors and static_file sub-packages,
which depend on mocket and are likewise js+native only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@oboard
oboard merged commit 4d48b47 into main Aug 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant