charmbracelet / charmbracelet/bubbletea

WASM version

Open
#1,410 0 comments 18 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
44.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

There is a fork of bubbletea that runs as wasm: https://github.com/BigJk/bubbletea-in-wasm

But its old and not supported.

The changes are essentially just clipboard and fs overrides with compiler tags.

It would be so useful if this could be part of offical bubbletea :)

Testing is reasonably easy these days with Taskfile like:

```yaml

test:wasm:
desc: go test wasm
cmds:
# see: https://go.dev/wiki/WebAssembly#running-tests-in-the-browser
# https://github.com/agnivade/wasmbrowsertest
- go install github.com/agnivade/wasmbrowsertest@latest
- mv {{.GO_ENV_BIN_PATH}}/wasmbrowsertest{{.BASE_BINARY_EXTENSION}} $GOPATH/bin/go_js_wasm_exec{{.BASE_BINARY_EXTENSION}}
- cd {{.GO_VAR_SRC_MAIN_PATH}} && GOOS=js GOARCH=wasm {{.GO_BIN_NAME}} test
silent: false

dev:wasm:chrome:
desc: go dev wasm in chrome with .CLI_ARGS support.
cmds:
- echo ''
- echo 'dev wasm in chrome'
- cd {{.GO_VAR_SRC_MAIN_PATH}} && WASM_HEADLESS=off GOOS=js GOARCH=wasm {{.GO_BIN_NAME}} run . {{.CLI_ARGS}}

```

On a simple bubbletea app i get

```sh
# github.com/charmbracelet/bubbletea
/Users/apple/workspace/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.5/tea.go:324:8: p.listenForResize undefined (type *Program has no field or method listenForResize)
/Users/apple/workspace/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.5/tea.go:410:8: undefined: suspendSupported
/Users/apple/workspace/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.5/tea.go:571:13: undefined: openInputTTY
/Users/apple/workspace/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.5/tea.go:580:13: undefined: openInputTTY
/Users/apple/workspace/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.5/tty.go:19:2: undefined: suspendProcess
/Users/apple/workspace/go/pkg/mod/github.com/charmbracelet/bubbletea@v1.3.5/tty.go:31:14: p.initInput undefined (type *Program has no field or method initInput)
exit status 1
```

Contributor guide

Open the contributing guide

Research direction

Read the existing build paths around tea.go and tty.go, then compare the compiler-tagged clipboard and filesystem changes in the linked bubbletea-in-wasm fork. Reproduce the reported GOOS=js GOARCH=wasm test command with wasmbrowsertest and use the Taskfile examples as a validation path; done means the missing symbols are resolved and WASM tests run.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, wasm
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.