Documentation
¶
Index ¶
- func GetModuleName(filePath string) (string, error)
- type Config
- type TinyWasm
- func (w *TinyWasm) Change(newValue any) (string, error)
- func (t *TinyWasm) GetTinyGoVersion() (string, error)
- func (w *TinyWasm) IsFrontendFile(filename string) bool
- func (h *TinyWasm) JavascriptForInitializing() (js string, err error)
- func (w *TinyWasm) Label() string
- func (w *TinyWasm) MainFilePath() string
- func (w *TinyWasm) Name() string
- func (w *TinyWasm) NewFileEvent(fileName, extension, filePath, event string) error
- func (w *TinyWasm) ShouldCompileToWasm(fileName, filePath string) bool
- func (w *TinyWasm) TinyGoCompiler() bool
- func (w *TinyWasm) UnobservedFiles() []string
- func (w *TinyWasm) Value() string
- func (t *TinyWasm) VerifyTinyGoInstallation() error
- func (w *TinyWasm) VerifyTinyGoProjectCompatibility()
- func (w *TinyWasm) VisualStudioCodeWasmEnvConfig()
- func (w *TinyWasm) WasmProjectTinyGoJsUse() (bool, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetModuleName ¶
GetModuleName extracts module name from file path
Types ¶
type Config ¶ added in v0.0.7
type Config struct { // WebFilesFolder returns root web folder and subfolder eg: "web","public" WebFilesFolder func() (string, string) Logger io.Writer // For logging output to external systems (e.g., TUI, console) FrontendPrefix []string // Prefixes used to identify frontend files (e.g., "f.", "front.") TinyGoCompiler bool // Enable TinyGo compiler (default: false for faster development) // NEW: Shortcut configuration (default: "c", "d", "p") CodingShortcut string // default "c" DebuggingShortcut string // default "d" ProductionShortcut string // default "p" // gobuild integration fields Callback func(error) // Optional callback for async compilation CompilingArguments func() []string // Build arguments for compilation (e.g., ldflags) }
Config holds configuration for WASM compilation
type TinyWasm ¶
type TinyWasm struct { *Config ModulesFolder string // default "modules". for test change eg: "test/modules" // contains filtered or unexported fields }
TinyWasm provides WebAssembly compilation capabilities with 3-mode compiler selection
func New ¶
New creates a new TinyWasm instance with the provided configuration Timeout is set to 40 seconds maximum as TinyGo compilation can be slow Default values: ModulesFolder="modules", mainInputFile="main.wasm.go"
func (*TinyWasm) Change ¶ added in v0.0.11
RENAME: SetTinyGoCompiler -> Change (implements DevTUI FieldHandler interface)
func (*TinyWasm) GetTinyGoVersion ¶
GetTinyGoVersion returns the installed TinyGo version
func (*TinyWasm) IsFrontendFile ¶ added in v0.0.4
IsFrontendFile checks if a file should trigger WASM compilation based on frontend prefixes
func (*TinyWasm) JavascriptForInitializing ¶
JavascriptForInitializing returns the JavaScript code needed to initialize WASM
func (*TinyWasm) MainFilePath ¶ added in v0.0.15
MainFilePath returns the complete path to the main WASM output file
func (*TinyWasm) NewFileEvent ¶
NewFileEvent handles file events for WASM compilation with automatic project detection fileName: name of the file (e.g., main.wasm.go) extension: file extension (e.g., .go) filePath: full path to the file (e.g., web/public/wasm/main.wasm.go, modules/users/wasm/users.wasm.go, modules/auth/f.logout.go) event: type of file event (e.g., create, remove, write, rename)
func (*TinyWasm) ShouldCompileToWasm ¶ added in v0.0.4
ShouldCompileToWasm determines if a file should trigger WASM compilation
func (*TinyWasm) TinyGoCompiler ¶
TinyGoCompiler returns if TinyGo compiler should be used (dynamic based on configuration)
func (*TinyWasm) UnobservedFiles ¶
UnobservedFiles returns files that should not be watched for changes e.g: main.wasm
func (*TinyWasm) Value ¶ added in v0.0.11
Value returns the current compiler mode shortcut (c, d, or p)
func (*TinyWasm) VerifyTinyGoInstallation ¶
VerifyTinyGoInstallation checks if TinyGo is properly installed
func (*TinyWasm) VerifyTinyGoProjectCompatibility ¶
func (w *TinyWasm) VerifyTinyGoProjectCompatibility()
VerifyTinyGoProjectCompatibility checks if the project is compatible with TinyGo compilation
func (*TinyWasm) VisualStudioCodeWasmEnvConfig ¶ added in v0.0.7
func (w *TinyWasm) VisualStudioCodeWasmEnvConfig()
VisualStudioCodeWasmEnvConfig automatically creates and configures VS Code settings for WASM development. This method resolves the "could not import syscall/js" error by setting proper environment variables in .vscode/settings.json file. On Windows, the .vscode directory is made hidden for a cleaner project view. This configuration enables VS Code's Go extension to properly recognize WASM imports and provide accurate IntelliSense, error detection, and code completion for syscall/js and other WASM-specific packages.
func (*TinyWasm) WasmProjectTinyGoJsUse ¶
WasmProjectTinyGoJsUse returns dynamic state based on current configuration