WIP: WASM port - switch to ncruces/go-sqlite3, add WASM stubs

- Switched from modernc.org/sqlite to ncruces/go-sqlite3 for WASM support
- Added WASM-specific stubs for daemon process management
- Created wasm/ directory with build.sh and Node.js runner
- WASM build succeeds (32MB bd.wasm)
- Node.js can load and execute the WASM module
- Next: Need to bridge Go file I/O to Node.js fs module

Related: bd-44d0, bd-8534, bd-c7eb
This commit is contained in:
Steve Yegge
2025-11-02 22:17:08 -08:00
parent d5dde7c753
commit 9ce1d6c7a5
15 changed files with 697 additions and 6 deletions
+20
View File
@@ -0,0 +1,20 @@
//go:build js && wasm
package daemon
import "fmt"
// WASM doesn't support process management, so these are stubs
// Daemon mode is not supported in WASM environments
func killProcess(pid int) error {
return fmt.Errorf("daemon operations not supported in WASM")
}
func forceKillProcess(pid int) error {
return fmt.Errorf("daemon operations not supported in WASM")
}
func isProcessAlive(pid int) bool {
return false
}
+3 -2
View File
@@ -14,7 +14,8 @@ import (
// Import SQLite driver
"github.com/steveyegge/beads/internal/types"
_ "modernc.org/sqlite"
_ "github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
)
// SQLiteStorage implements the Storage interface using SQLite
@@ -56,7 +57,7 @@ func New(path string) (*SQLiteStorage, error) {
connStr += "?_pragma=journal_mode(WAL)&_pragma=foreign_keys(ON)&_pragma=busy_timeout(30000)&_time_format=sqlite"
}
db, err := sql.Open("sqlite", connStr)
db, err := sql.Open("sqlite3", connStr)
if err != nil {
return nil, fmt.Errorf("failed to open database: %w", err)
}
+2 -1
View File
@@ -8,7 +8,8 @@ import (
"time"
"github.com/steveyegge/beads/internal/types"
_ "modernc.org/sqlite"
_ "github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
)
func setupTestDB(t *testing.T) (*SQLiteStorage, func()) {