Hi everyone,
With the recent improvements in the SwiftPM Plugin for JavaScriptKit, I think it's time to formally deprecate swiftwasm/carton.
What carton has historically provided
When we first introduced carton, it covered several gaps that existed in the SwiftWasm ecosystem:
- installing the SwiftWasm toolchain,
- a file-watching rebuild loop to speed up feedback iteration,
- packaging SwiftPM build products for the web (JS loader, HTML stub, etc.),
- and a simple test runner for Wasm.
These were all important at a time when SwiftWasm toolchain lived outside the main Swift project.
Why it's no longer needed
Since then, the situation has changed quite a lot.
SwiftWasm compiler is now fully upstream, and ongoing WebAssembly-related work happens directly in Swift itself. There is no longer a separate toolchain package that needs a dedicated installer; tools like swiftly can install official Swift toolchains, and swift sdk command can install Swift SDK for WebAssembly.
The official documentation covers this workflow well:
Editor support has also improved. Thanks to proper Swift SDK support in sourcekit-lsp, cross-compiling to WebAssembly now provides accurate diagnostics directly in the editor. This reduces the need for a build tool to perform full rebuilds just to surface errors. The old auto-rebuild loop was helpful when editor feedback was limited, but its role has largely been replaced by better language server support.
Regarding packaging and testing, the new swift package js SwiftPM Plugin in JavaScriptKit essentially replaces carton's packaging and test-running workflow. You can try it with:
swift package --swift-sdk <SDK_ID> js
For documentation, the following pages cover the new setup:
- https://swiftpackageindex.com/swiftwasm/javascriptkit/main/tutorials/javascriptkit/hello-world
- https://swiftpackageindex.com/swiftwasm/JavaScriptKit/main/documentation/javascriptkit
Going forward
Given all of this, the swiftwasm/carton repository has now been archived and won't receive new features. The SwiftPM plugin approach provides a more straightforward and future-proof way to support WebAssembly development.
Thanks to everyone who used carton or contributed to it over the years. It helped bridge an early gap, and I'm glad the ecosystem has reached a point where most of this can now be handled by Swift's standard tooling more.
Happy to discuss any migration issues or missing pieces.
Yuta