view

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveEntityID

func ResolveEntityID(loc core.Location, entityName string, kind ast.EntityKind, overloadIndex *int) string

ResolveEntityID converts resolved entity into view identity.

func ResolveFileID

func ResolveFileID(loc core.Location) string

ResolveFileID converts source location into file ID.

Types

type Component

type Component struct {
	Anchor        SourceAnchor `json:"anchor"`
	ID            string       `json:"id"`
	Name          string       `json:"name"`
	OverloadIndex int          `json:"overloadIndex"`
	TypeArgs      []string     `json:"typeArgs"`
	InPorts       []Port       `json:"inPorts"`
	OutPorts      []Port       `json:"outPorts"`
	Nodes         []Node       `json:"nodes"`
	Connections   []Connection `json:"connections"`
	Public        bool         `json:"public"`
}

Component is a source-level component graph.

type ComponentRef

type ComponentRef struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	OverloadIndex int    `json:"overloadIndex"`
}

ComponentRef references one overload of a component.

type Connection

type Connection struct {
	Sender           ConnectionEndpoint `json:"sender"`
	Receiver         ConnectionEndpoint `json:"receiver"`
	Anchor           SourceAnchor       `json:"anchor"`
	ID               string             `json:"id"`
	ChainDepth       int                `json:"chainDepth"`
	ChainPath        []string           `json:"chainPath"`
	Signature        string             `json:"signature"`
	DuplicateOrdinal int                `json:"duplicateOrdinal"`
}

Connection describes a source-level connection between sender and receiver.

type ConnectionEndpoint

type ConnectionEndpoint struct {
	Index      *uint8       `json:"index,omitempty"`
	Anchor     SourceAnchor `json:"anchor"`
	Kind       string       `json:"kind"`
	Node       string       `json:"node"`
	Port       string       `json:"port"`
	ConstType  string       `json:"constType"`
	ConstValue string       `json:"constValue"`
	Selector   []string     `json:"selector"`
}

ConnectionEndpoint describes one connection endpoint.

type ConstDecl

type ConstDecl struct {
	Anchor SourceAnchor `json:"anchor"`
	ID     string       `json:"id"`
	Name   string       `json:"name"`
	Type   string       `json:"type"`
	Value  string       `json:"value"`
	Public bool         `json:"public"`
}

ConstDecl is a source-level const declaration.

type DINode added in v0.38.0

type DINode struct {
	Anchor SourceAnchor `json:"anchor"`
	ID     string       `json:"id"`
	Name   string       `json:"name"`
	// NodeName is the effective dependency-node alias inside the wrapped component.
	NodeName string `json:"nodeName"`
	// EntityRef keeps original source reference and can point to any entity kind.
	EntityRef     core.EntityRef `json:"entityRef"`
	ResolvedRef   *ResolvedRef   `json:"resolvedRef,omitempty"`
	TypeArgs      []string       `json:"typeArgs"`
	OverloadIndex *int           `json:"overloadIndex,omitempty"`
	ErrGuard      bool           `json:"errGuard"`
}

DINode describes a compile-time dependency injection argument attached to a node.

type EntityRef

type EntityRef struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

EntityRef references a named source entity.

type File

type File struct {
	Anchor     SourceAnchor   `json:"anchor"`
	ID         string         `json:"id"`
	Name       string         `json:"name"`
	Path       string         `json:"path"`
	Location   SourceLocation `json:"location"`
	Imports    []ImportRef    `json:"imports"`
	Consts     []ConstDecl    `json:"consts"`
	Types      []TypeDecl     `json:"types"`
	Interfaces []Interface    `json:"interfaces"`
	Components []Component    `json:"components"`
}

File is a full file payload for readonly visual rendering.

func ProjectFileByID

func ProjectFileByID(build ast.Build, wantedFileID string) (File, bool)

ProjectFileByID projects one file view for the given file ID.

type FileSummary

type FileSummary struct {
	Anchor     SourceAnchor   `json:"anchor"`
	ID         string         `json:"id"`
	Name       string         `json:"name"`
	Path       string         `json:"path"`
	PackageID  string         `json:"packageId"`
	Imports    []ImportRef    `json:"imports"`
	Consts     []EntityRef    `json:"consts"`
	Types      []EntityRef    `json:"types"`
	Interfaces []EntityRef    `json:"interfaces"`
	Components []ComponentRef `json:"components"`
}

FileSummary is lightweight metadata for explorer trees.

type ImportRef

type ImportRef struct {
	ID      string       `json:"id"`
	Alias   string       `json:"alias"`
	Module  string       `json:"module"`
	Package string       `json:"package"`
	Anchor  SourceAnchor `json:"anchor"`
}

ImportRef is a source-level import declaration.

type Interface

type Interface struct {
	Anchor   SourceAnchor `json:"anchor"`
	ID       string       `json:"id"`
	Name     string       `json:"name"`
	TypeArgs []string     `json:"typeArgs"`
	InPorts  []Port       `json:"inPorts"`
	OutPorts []Port       `json:"outPorts"`
	Public   bool         `json:"public"`
}

Interface is a source-level interface declaration.

type Module

type Module struct {
	ID       string    `json:"id"`
	Path     string    `json:"path"`
	Packages []Package `json:"packages"`
}

Module groups packages by module reference.

type Node

type Node struct {
	Directives map[string]string `json:"directives"`
	Anchor     SourceAnchor      `json:"anchor"`
	ID         string            `json:"id"`
	Name       string            `json:"name"`
	// EntityRef keeps original source reference and can point to any entity kind.
	EntityRef     core.EntityRef `json:"entityRef"`
	ResolvedRef   *ResolvedRef   `json:"resolvedRef,omitempty"`
	TypeArgs      []string       `json:"typeArgs"`
	DIArgs        []DINode       `json:"diArgs"`
	OverloadIndex *int           `json:"overloadIndex,omitempty"`
	ErrGuard      bool           `json:"errGuard"`
}

Node describes a component node instance.

type Package

type Package struct {
	ID            string        `json:"id"`
	ModuleID      string        `json:"moduleId"`
	Name          string        `json:"name"`
	FileSummaries []FileSummary `json:"fileSummaries"`
}

Package groups files in one package.

type Port

type Port struct {
	Anchor  SourceAnchor `json:"anchor"`
	ID      string       `json:"id"`
	Name    string       `json:"name"`
	Type    string       `json:"type"`
	Order   int          `json:"order"`
	IsArray bool         `json:"isArray"`
}

Port describes one input/output port.

type Program

type Program struct {
	Modules []Module `json:"modules"`
}

Program is the top-level view payload for explorer navigation.

func ProjectProgram

func ProjectProgram(build ast.Build) Program

ProjectProgram projects analyzed AST build into explorer-friendly view payload.

type ResolvedRef

type ResolvedRef struct {
	CanonicalRef string       `json:"canonicalRef"`
	EntityKind   string       `json:"entityKind"`
	FileID       string       `json:"fileId"`
	EntityID     string       `json:"entityId"`
	Anchor       SourceAnchor `json:"anchor"`
}

ResolvedRef is a canonical resolved reference target for entity navigation.

type SourceAnchor

type SourceAnchor struct {
	ModulePath string `json:"modulePath"`
	Package    string `json:"package"`
	File       string `json:"file"`
	Text       string `json:"text"`
	StartLine  int    `json:"startLine"`
	StartCol   int    `json:"startCol"`
	EndLine    int    `json:"endLine"`
	EndCol     int    `json:"endCol"`
}

SourceAnchor maps visual elements back to source ranges.

type SourceLocation

type SourceLocation struct {
	ModulePath string `json:"modulePath"`
	Package    string `json:"package"`
	File       string `json:"file"`
}

SourceLocation identifies a source file in build coordinates.

type TypeDecl

type TypeDecl struct {
	Anchor SourceAnchor `json:"anchor"`
	ID     string       `json:"id"`
	Name   string       `json:"name"`
	Type   string       `json:"type"`
	Public bool         `json:"public"`
}

TypeDecl is a source-level type declaration.

Jump to

Keyboard shortcuts

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