Skip to content

Publish a wasmJs target so the library works on the web - #321

Merged
smelfungus merged 1 commit into
masterfrom
feat/wasm-target
Sep 1, 2026
Merged

smelfungus merged 1 commit into
masterfrom
feat/wasm-target

Conversation

@smelfungus

Copy link
Copy Markdown
Member

The library needed no wasm-specific source. jvmMain and iosMain are empty directories and androidMain holds only a manifest, so everything already lives in commonMain, and every dependency — Compose ui/foundation/material3, coroutines, collections-immutable — publishes wasm-js variants.

One test blocked it. HueFractionMappingTest used kotlin.math.nextDown, which wasmJs does not provide; the production code had already hit this and works around it via the bit pattern, with a comment saying so. The test now computes the value itself rather than reusing the implementation's constant, which would have made the assertion circular.

binaries.executable() is required even for a library: without it webpack does not bundle the Skiko runtime and the browser test target cannot load Compose. See CMP-4906.

The klib API dump gains wasmJs, and releases now produce six publications instead of five.

Verified: 329 commonTest tests execute in a real browser under wasmJsBrowserTest with zero failures, alongside 332 on JVM and 329 on the Android host. The conversion maths is now checked on a third platform rather than assumed to port.

The library needed no wasm-specific source. jvmMain and iosMain are empty directories and androidMain holds only a manifest, so everything already lives in commonMain, and every dependency — Compose ui/foundation/material3, coroutines, collections-immutable — publishes wasm-js variants.

One test blocked it. HueFractionMappingTest used kotlin.math.nextDown, which wasmJs does not provide; the production code had already hit this and works around it via the bit pattern, with a comment saying so. The test now computes the value itself rather than reusing the implementation's constant, which would have made the assertion circular.

binaries.executable() is required even for a library: without it webpack does not bundle the Skiko runtime and the browser test target cannot load Compose. See CMP-4906.

The klib API dump gains wasmJs, and releases now produce six publications instead of five.

Verified: 329 commonTest tests execute in a real browser under wasmJsBrowserTest with zero failures, alongside 332 on JVM and 329 on the Android host. The conversion maths is now checked on a third platform rather than assumed to port.
@smelfungus smelfungus self-assigned this Sep 1, 2026
@smelfungus
smelfungus merged commit 4a58dd8 into master Sep 1, 2026
2 checks passed
@smelfungus
smelfungus deleted the feat/wasm-target branch September 1, 2026 20:30
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