go-html/cmd/wasm/register.go
Snider c525437ed6
Some checks failed
Security Scan / security (pull_request) Successful in 9s
Test / test (pull_request) Failing after 20s
refactor(module): migrate module path from forge.lthn.ai to dappco.re
Update module path from forge.lthn.ai/core/go-html to dappco.re/go/core/html.
Migrate all .go import paths, update dependency versions (core v0.5.0,
log v0.1.0, io v0.2.0), and add replace directives for local development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 01:28:30 +00:00

26 lines
736 B
Go

//go:build !js
package main
import (
"encoding/json"
"dappco.re/go/core/html/codegen"
log "dappco.re/go/core/log"
)
// buildComponentJS takes a JSON slot map and returns the WC bundle JS string.
// This is the pure-Go part testable without WASM.
// Excluded from WASM builds — encoding/json and text/template are too heavy.
// Use cmd/codegen/ CLI instead for build-time generation.
func buildComponentJS(slotsJSON string) (string, error) {
var slots map[string]string
if err := json.Unmarshal([]byte(slotsJSON), &slots); err != nil {
return "", log.E("buildComponentJS", "unmarshal JSON", err)
}
return codegen.GenerateBundle(slots)
}
func main() {
log.Info("go-html WASM module — build with GOOS=js GOARCH=wasm")
}