Skip to content

feat: add support for GOARCH=wasm and GOOS=js | wasip1#1693

Open
neomantra wants to merge 8 commits into
charmbracelet:mainfrom
neomantra:nm-wasm
Open

feat: add support for GOARCH=wasm and GOOS=js | wasip1#1693
neomantra wants to merge 8 commits into
charmbracelet:mainfrom
neomantra:nm-wasm

Conversation

@neomantra
Copy link
Copy Markdown

These changes add support for compiling BubbleTea under GOARCH=wasm and under GOOS=js or GOOS=wasip1.

I have been experimenting with this for go-booba which helps bridge BubbleTea with the libghostty. I started experimenting with a go tool for monkey-patching BubbleTea for this. That way others could adopt it without changing their code.

But, it makes much more sense to include these upstream.

You can see some browser-base demos I've pretty easily created:

Since all the changes are guarded by build tags, this should not affect any other architectures. Thank you for BubbleTea.

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

neomantra added 8 commits May 6, 2026 11:26
Add platform-specific stubs for WASM builds (js/wasm) to enable BubbleTea
to compile and run on WebAssembly without OS-level dependencies:

  - tty_wasm.go: stub initInput() and suspendProcess() (no TTY on WASM)
  - signals_wasm.go: stub listenForResize() (window events via JS)
  - termios_wasm.go: stub checkOptimizedMovements() (no terminal modes)
  - termios_other.go: exclude WASM from generic fallback

BubbleTea now works with WASM frameworks that provide custom
I/O and window management via JavaScript.

Signed-off-by: Evan Wies <[email protected]>
We have an exclude list due to dependencies that are
incompatible with WASM, eg. clipboard

Signed-off-by: Evan Wies <[email protected]>
Brings examples/go.mod in sync with the root ultraviolet bump from
fdcd0cf so the build-examples job's git diff --exit-code check passes
on this branch instead of waiting for the master auto-tidy workflow.
@neomantra
Copy link
Copy Markdown
Author

I added unit tests to the CI/CD. Note there is machinery to omit examples that depend on clipboard, directly or indirectly (e.g. via bubbles.TextArea/TextInput).

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