import "github.com/vugu/vugu/gen"
comp-hasher.go merge.go missing-fixer.go parser-compact.go parser-go-pkg.go parser-go.go parser-util.go
func Run(pkgPath string, opts *ParserGoPkgOpts) error
Run will create a new ParserGoPkg and call Run on it.
func RunRecursive(pkgPath string, opts *ParserGoPkgOpts) error
RunRecursive will create a new ParserGoPkg and call Run on it recursively for each directory under pkgPath. The opts will be modified for subfolders to disable go.mod and main.go logic. If pkgPath does not contain a .vugu file this function will return an error.
type ParserGo struct { PackageName string // name of package to use at top of files StructType string // just the struct name, no "*" (replaces ComponentType and DataType) // ComponentType string // just the struct name, no "*" // DataType string // just the struct name, no "*" OutDir string // output dir OutFile string // output file name with ".go" suffix NoOptimizeStatic bool // set to true to disable optimization of static blocks of HTML into vg-html expressions TinyGo bool // set to true to enable TinyGo compatability changes to the generated code }
ParserGo is a template parser that emits Go source code that will construct the appropriately wired VGNodes.
Parse is an experiment... r is the actual input, fname is only used to emit line directives
type ParserGoPkg struct {
// contains filtered or unexported fields
}
ParserGoPkg knows how to perform source file generation in relation to a package folder. Whereas ParserGo handles converting a single template, ParserGoPkg is a higher level interface and provides the functionality of the vugugen command line tool. It will scan a package folder for .vugu files and convert them to .go, with the appropriate defaults and logic.
func NewParserGoPkg(pkgPath string, opts *ParserGoPkgOpts) *ParserGoPkg
NewParserGoPkg returns a new ParserGoPkg with the specified options or default if nil. The pkgPath is required and must be an absolute path.
func (p *ParserGoPkg) Opts() ParserGoPkgOpts
Opts returns the options.
func (p *ParserGoPkg) Run() error
Run does the work and generates the appropriate .go files from .vugu files. It will also create a go.mod file if not present and not SkipGoMod. Same for main.go and SkipMainGo (will also skip if package already has file with package name something other than main). Per-file code generation is performed by ParserGo.
type ParserGoPkgOpts struct { SkipGoMod bool // do not try and create go.mod if it doesn't exist SkipMainGo bool // do not try and create main_wasm.go if it doesn't exist in a main package TinyGo bool // emit code intended for TinyGo compilation GoFileNameAppend *string // suffix to append to file names, after base name plus .go, if nil then "_vgen" is used MergeSingle bool // merge all output files into a single one MergeSingleName string // name of merged output file, only used if MergeSingle is true, defaults to "0_components_vgen.go" }
ParserGoPkgOpts is the options for ParserGoPkg.
Package gen imports 26 packages (graph) and is imported by 2 packages. Updated 2021-01-07. Refresh now. Tools for package owners.