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:
14
cmd/bd/daemon_lock_wasm.go
Normal file
14
cmd/bd/daemon_lock_wasm.go
Normal file
@@ -0,0 +1,14 @@
|
||||
//go:build js && wasm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func flockExclusive(f *os.File) error {
|
||||
// WASM doesn't support file locking
|
||||
// In a WASM environment, we're typically single-process anyway
|
||||
return fmt.Errorf("file locking not supported in WASM")
|
||||
}
|
||||
28
cmd/bd/daemon_wasm.go
Normal file
28
cmd/bd/daemon_wasm.go
Normal file
@@ -0,0 +1,28 @@
|
||||
//go:build js && wasm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
// WASM doesn't support signals or process management
|
||||
var daemonSignals = []os.Signal{}
|
||||
|
||||
func configureDaemonProcess(cmd *exec.Cmd) {
|
||||
// No-op in WASM
|
||||
}
|
||||
|
||||
func sendStopSignal(process *os.Process) error {
|
||||
return fmt.Errorf("daemon operations not supported in WASM")
|
||||
}
|
||||
|
||||
func isReloadSignal(sig os.Signal) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func isProcessRunning(pid int) bool {
|
||||
return false
|
||||
}
|
||||
@@ -16,7 +16,8 @@ import (
|
||||
"github.com/steveyegge/beads"
|
||||
"github.com/steveyegge/beads/internal/configfile"
|
||||
"github.com/steveyegge/beads/internal/daemon"
|
||||
_ "modernc.org/sqlite"
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
)
|
||||
|
||||
// Status constants for doctor checks
|
||||
|
||||
@@ -16,7 +16,8 @@ import (
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
"github.com/steveyegge/beads/internal/utils"
|
||||
_ "modernc.org/sqlite"
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
)
|
||||
|
||||
var migrateCmd = &cobra.Command{
|
||||
|
||||
Reference in New Issue
Block a user