fix: reject unsupported wasm targets at the package boundary - #24
Merged
Conversation
Delete mocket.wasm.mbt (panic stubs for serve_ffi/listen_ffi) and remove its target entries from moon.pkg. Declare supported_targets = "+js+native" at the package boundary so wasm/wasm-gc consumers are rejected at build time instead of trapping at runtime. Also declare supported_targets on cors and static_file sub-packages to keep the dependency graph consistent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
At
main@c545db2, the README states Mocket supports the JS and native backends, butmoon.pkgstill selectsmocket.wasm.mbtandserve.mbtforwasm/wasm-gc. As a result, server code usingMocket::listentype-checks for those targets and then traps at runtime:Fix
Two complementary changes:
Delete
mocket.wasm.mbt— the file that contained panic stubs (serve_ffi,listen_ffi, and all ws_* stubs that always panic). Remove its target entries frommoon.pkg.Declare the package's actual backend support at the top level of
moon.pkg:This makes
moon check/moon buildrejectwasmandwasm-gcconsumers at the package boundary, matching the README and avoiding runtime-only panic stubs.The
corsandstatic_filesub-packages depend onoboard/mocketand are likewise js/native-only, so they now declaresupported_targetsexplicitly (this also removes the "does not declare supported_targets" warnings they would otherwise emit once the parent package declares its targets).Files changed
mocket.wasm.mbtmoon.pkgsupported_targets = "+js+native"cors/moon.pkgsupported_targets = "+js+native"static_file/moon.pkgsupported_targets = "+js+native"Verification
moon check --target wasmon a wasm consumer that callsMocket::listen→ fails at build time:moon check --target wasm-gc→ same rejectionmoon check --target jsand--target native→ pass cleanlymoon check --target all→ finishes with no warnings🤖 Generated with Claude Code