-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
42 lines (34 loc) · 1.55 KB
/
Copy pathconfig.go
File metadata and controls
42 lines (34 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package client
// KeyValueDataBase defines the interface for a key-value Storage system
// used to persist the compiler state (e.g. current mode).
type KeyValueDataBase interface {
Get(key string) (string, error)
Set(key, value string) error
}
// Config holds configuration for WASM compilation
type Config struct {
// SourceDir specifies the directory containing the Go source for the webclient (relative to AppRootDir).
// e.g., "web"
SourceDir func() string
// OutputDir specifies the directory for WASM and related assets (relative to AppRootDir).
// e.g., "web/public"
OutputDir func() string
// AssetsURLPrefix is an optional URL prefix/folder for serving the WASM file.
// e.g. "assets" -> serves at "/assets/client.wasm"
// default: "" -> serves at "/client.wasm"
AssetsURLPrefix string
// TinyGoCompiler removed: TinyGoCompilerFlag (private) in WasmClient is used instead to avoid confusion
// gobuild integration fields
Callback func(error) // Optional callback for async compilation
CompilingArguments func() []string // Build arguments for compilation (e.g., ldflags)
Env []string // Environment variables, e.g., []string{"GOOS=js", "TINYGOROOT=/path"}
Database KeyValueDataBase // Key-Value store for state persistence
OnWasmExecChange func() // Callback for runtime/wasm_exec changes
}
// NewConfig creates a WasmClient Config with sensible defaults
func NewConfig() *Config {
return &Config{
SourceDir: func() string { return "web" },
OutputDir: func() string { return "web/public" },
}
}