viewanalysis

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonical

func Canonical(source string) (string, error)

Canonical returns a deterministic AST-backed representation of a view body.

func CanonicalNodes added in v0.13.0

func CanonicalNodes(nodes []viewmodel.Node) string

CanonicalNodes returns the deterministic representation of an already lowered view tree. Compiler passes use this form so raw view source is not reparsed after analysis.

func ComponentReferences

func ComponentReferences(source string) ([]string, error)

ComponentReferences returns unique component names directly referenced by a view markup fragment.

func ComponentReferencesFromNodes

func ComponentReferencesFromNodes(nodes []viewmodel.Node) []string

ComponentReferencesFromNodes returns unique component names directly referenced by an already-parsed view fragment.

func ParamReferences

func ParamReferences(source string) ([]string, error)

ParamReferences returns unique param("name") route-param references directly visible in the current view markup subset.

func ParamReferencesFromNodes

func ParamReferencesFromNodes(nodes []viewmodel.Node) []string

ParamReferencesFromNodes returns unique param("name") route-param references directly referenced by an already-parsed view fragment.

Types

type CommandReference

type CommandReference struct {
	Command string
	Method  string
	Path    string
	Start   int
	End     int
}

CommandReference records one form-local backend command intent.

func CommandReferences

func CommandReferences(source string) ([]CommandReference, error)

CommandReferences returns package-qualified command references declared by g:command on direct form elements in a view fragment.

func CommandReferencesFromNodes

func CommandReferencesFromNodes(nodes []viewmodel.Node) ([]CommandReference, error)

CommandReferencesFromNodes returns package-qualified command references declared by g:command on direct form elements in an already-parsed view fragment.

type ComponentCallUsage

type ComponentCallUsage struct {
	Component     string
	Island        string
	ReactiveProps bool
}

ComponentCallUsage records one component call and its optional island mode.

func ComponentCallUsages

func ComponentCallUsages(source string) ([]ComponentCallUsage, error)

ComponentCallUsages returns component calls with optional g:island metadata.

func ComponentCallUsagesFromNodes

func ComponentCallUsagesFromNodes(nodes []viewmodel.Node) ([]ComponentCallUsage, error)

ComponentCallUsagesFromNodes returns component calls with optional g:island metadata from an already-parsed view fragment.

type ComponentIslandUsage

type ComponentIslandUsage struct {
	Component string
	Mode      string
}

ComponentIslandUsage records one component call that explicitly selects an island runtime.

func ComponentIslandUsages

func ComponentIslandUsages(source string) ([]ComponentIslandUsage, error)

ComponentIslandUsages returns component calls that explicitly set g:island.

func ComponentIslandUsagesFromNodes

func ComponentIslandUsagesFromNodes(nodes []viewmodel.Node) ([]ComponentIslandUsage, error)

ComponentIslandUsagesFromNodes returns component calls that explicitly set g:island in an already-parsed view fragment.

type ComponentReference

type ComponentReference struct {
	Name  string
	Start int
	End   int
}

ComponentReference records one component call with source offsets.

func ComponentReferenceSpans

func ComponentReferenceSpans(source string) ([]ComponentReference, error)

ComponentReferenceSpans returns component calls directly referenced by a view markup fragment, preserving source offsets for diagnostics.

func ComponentReferenceSpansFromNodes

func ComponentReferenceSpansFromNodes(nodes []viewmodel.Node) []ComponentReference

ComponentReferenceSpansFromNodes returns component calls from an already- parsed view fragment, preserving source offsets for diagnostics.

type ContractReference

type ContractReference struct {
	Kind   ContractReferenceKind
	Name   string
	Method string
	Path   string
	Start  int
	End    int
}

ContractReference records one template-local backend contract intent.

func ContractReferences

func ContractReferences(source string) ([]ContractReference, error)

ContractReferences returns package-qualified command and query references declared by GOWDK view directives.

func ContractReferencesFromNodes

func ContractReferencesFromNodes(nodes []viewmodel.Node) ([]ContractReference, error)

ContractReferencesFromNodes returns package-qualified command and query references declared by GOWDK view directives in an already-parsed view fragment.

type ContractReferenceKind

type ContractReferenceKind string
const (
	ContractReferenceCommand ContractReferenceKind = "command"
	ContractReferenceQuery   ContractReferenceKind = "query"
)

type Dependencies

type Dependencies struct {
	Assets          []string
	CSSClasses      []string
	StyleAttributes []string
}

Dependencies records source dependencies visible in the first view subset.

func ViewDependencies

func ViewDependencies(source string) (Dependencies, error)

ViewDependencies returns direct literal asset and style references from a view markup fragment. Interpolated and external URLs are not reported.

func ViewDependenciesFromNodes

func ViewDependenciesFromNodes(nodes []viewmodel.Node) Dependencies

ViewDependenciesFromNodes returns direct literal asset and style references from an already-parsed view fragment.

type QueryReference

type QueryReference struct {
	Query string
	Start int
	End   int
}

QueryReference records one template-local backend query intent.

func QueryReferences

func QueryReferences(source string) ([]QueryReference, error)

QueryReferences returns package-qualified query references declared by g:query on direct HTML elements in a view fragment.

func QueryReferencesFromNodes

func QueryReferencesFromNodes(nodes []viewmodel.Node) ([]QueryReference, error)

QueryReferencesFromNodes returns package-qualified query references declared by g:query on direct HTML elements in an already-parsed view fragment.

type SubscriptionReference

type SubscriptionReference struct {
	Query      string
	QueryStart int
	QueryEnd   int
	Event      string
	EventStart int
	EventEnd   int
}

SubscriptionReference records one query-bounded presentation-event subscription intent.

func SubscriptionReferences

func SubscriptionReferences(source string) ([]SubscriptionReference, error)

SubscriptionReferences returns package-qualified presentation-event references declared by g:subscribe on query-owned elements.

func SubscriptionReferencesFromNodes

func SubscriptionReferencesFromNodes(nodes []viewmodel.Node) ([]SubscriptionReference, error)

SubscriptionReferencesFromNodes returns package-qualified presentation-event references declared by g:subscribe on query-owned elements in an already-parsed view fragment.

Jump to

Keyboard shortcuts

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