feat: Enable WASM compilation
Summary
This PR adds support for compiling async-kit to wasm using the Swift SDK for WebAssembly.
This PR is part of a larger effort by a company called PassiveLogic to enable broad support for Swift WebAssembly.
Details
- Enables WASM compilation
- Adds configuration to compile WASM in CI
- Introduces conditional dependency on DispatchAsync for WASI platforms only, to work around the missing
Dispatchsupport in the Swift SDK for WebAssembly - Removes all imports for
NIOEmbeddedandNIOPosixfrom theAsyncKittarget. These imports are only used in the test target. - Update swift-nio dependency to a version that supports the WASI platform.
Testing done
- [x] Verified unit tests still pass
- [x] Verified no new warnings are created
- [x] Verified
swift build --swift-sdk swift-6.3-DEVELOPMENT-SNAPSHOT-2025-12-07-a_wasm --target AsyncKitcompletes without errors. This is the latest daily snapshot of the swift toolchain. - [x] Verified a third-party executable can build this library as part of a larger wasm executable, and run sqlite in the browser.
- [x] Verified these changes compile in CI. See https://github.com/PassiveLogic/async-kit/actions/runs/20180458445/job/57939351648?pr=1.
Usage notes
The current Swift 6.2.x breaks certain wasm executors that make testing wasm executables like this impossible. To fully test this running in the browser, recommend using Swift 6.3.x or later.
Impact Risk
If anyone depends solely on the removed exports for their documentation, their builds may break. But since NIOPosix and NIOEmbedded aren't used in the target anymore, it makes sense to remove those exports from the AsyncKit target.
@scottmarchant as mentioned in the other PR, we can't consider adding any dependencies until they hit at least a 1.0
@scottmarchant as mentioned in the other PR, we can't consider adding any dependencies until they hit at least a 1.0
@0xTim If the new wasm-only dependencies were released as version 1.0 or later, would there be any other issues regarding adding the new dependencies?