hmr

package
v0.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModuleInfo

type ModuleInfo struct {
	Name        string   // e.g., "shell", "page_about", "page_blog_slug"
	EntryFile   string   // main Go file for this module
	OutputPath  string   // where to write the WASM binary
	IsShell     bool     // true for the shell module
	RoutePath   string   // URL path this page handles (empty for shell)
	SourceFiles []string // Go files that belong to this module
}

ModuleInfo represents a compilable WASM module

type ModuleSplitter

type ModuleSplitter struct {
	// contains filtered or unexported fields
}

ModuleSplitter analyzes the app structure and determines module boundaries

func NewModuleSplitter

func NewModuleSplitter(appDir, outputDir, moduleName string) *ModuleSplitter

NewModuleSplitter creates a new ModuleSplitter. appDir is the path to the app source directory (e.g., "src/app"). outputDir is where WASM binaries will be written. moduleName is the Go module name (e.g., "github.com/example/myapp").

func (*ModuleSplitter) Analyze

func (s *ModuleSplitter) Analyze() ([]ModuleInfo, error)

Analyze determines what modules to build by scanning the app directory for page.go files and constructing module boundaries. It returns a slice of ModuleInfo: one shell module plus one module per page.

func (*ModuleSplitter) DetermineAffectedModules

func (s *ModuleSplitter) DetermineAffectedModules(changedFiles []string, allModules []ModuleInfo) []ModuleInfo

DetermineAffectedModules returns which modules need rebuilding given a set of changed files. If a page.go changed, only that page module is affected. If a layout, component, or other shared file changed, the shell module is affected.

func (*ModuleSplitter) GeneratePageEntry

func (s *ModuleSplitter) GeneratePageEntry(module ModuleInfo) (string, error)

GeneratePageEntry generates a page module's main.go with //go:wasmexport. The generated file imports the page's package and exports a RenderPage function.

func (*ModuleSplitter) GenerateShellEntry

func (s *ModuleSplitter) GenerateShellEntry(modules []ModuleInfo) (string, error)

GenerateShellEntry generates the shell module's main.go that contains the router, layout system, and module loader.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL