Documentation
¶
Index ¶
- Constants
- func CheckFiles(config gowdk.Config, paths []string) (CheckResult, Diagnostics)
- func Format(source []byte) []byte
- func Lex(source string) ([]Token, Diagnostics)
- func RedactMessage(message string) string
- type CheckResult
- type Completion
- type Diagnostic
- type DiagnosticReport
- type Diagnostics
- func CheckJSON(config gowdk.Config, paths []string) ([]byte, Diagnostics)
- func CheckSource(config gowdk.Config, path string, source []byte) (gwdkir.Page, Diagnostics)
- func ManifestJSON(config gowdk.Config, paths []string) ([]byte, Diagnostics)
- func ParseBuildFiles(paths []string) (gwdkanalysis.Sources, Diagnostics)
- func ParseComponentSource(path string, source []byte) (gwdkir.Component, Diagnostics)
- func ParseFile(path string) (gwdkir.Page, Diagnostics)
- func ParseFiles(paths []string) (gwdkanalysis.Sources, Diagnostics)
- func ParseLayoutSource(path string, source []byte) (gwdkir.Layout, Diagnostics)
- func ParseSource(path string, source []byte) (gwdkir.Page, Diagnostics)
- func SiteMapJSON(config gowdk.Config, paths []string) ([]byte, Diagnostics)
- type FileKind
- type Position
- type Range
- type SiteMap
- type SiteMapBlocks
- type SiteMapEndpoint
- type SiteMapPage
- type SiteMapRoute
- type Token
- type TokenKind
Constants ¶
const ManifestSchemaVersion = 1
ManifestSchemaVersion is the current gowdk manifest JSON schema version.
Variables ¶
This section is empty.
Functions ¶
func CheckFiles ¶
func CheckFiles(config gowdk.Config, paths []string) (CheckResult, Diagnostics)
CheckFiles parses and validates .gwdk files.
func Lex ¶
func Lex(source string) ([]Token, Diagnostics)
Lex tokenizes .gwdk source for editor and CLI tooling.
func RedactMessage ¶ added in v0.2.7
RedactMessage masks values that commonly carry credentials so a diagnostic quoting .gwdk source content (attribute values, expressions, route or store literals) does not echo a hardcoded secret into terminal output, check --json payloads, or LSP diagnostics.
It is deliberately conservative and mirrors the runtime panic-log policy: it favours over-masking a suspicious token over letting a real secret through.
Types ¶
type CheckResult ¶ added in v0.2.8
type CheckResult struct {
IR gwdkir.Program
Bindings []source.BackendBinding
}
CheckResult is the validated program produced by CheckFiles: the IR with discovered standalone Go endpoints and backend handler bindings attached, plus the flat binding record list for the manifest JSON report.
type Completion ¶
Completion describes one language completion shared by editor integrations.
func Completions ¶
func Completions() []Completion
Completions returns the core .gwdk language keywords known to editor tools.
type Diagnostic ¶
type Diagnostic struct {
File string `json:"file"`
Code string `json:"code,omitempty"`
Pos Position `json:"pos"`
Range *Range `json:"range,omitempty"`
Severity string `json:"severity"`
Message string `json:"message"`
Suggestion string `json:"suggestion,omitempty"`
}
Diagnostic describes a language-tool finding.
func (Diagnostic) MarshalJSON ¶ added in v0.2.7
func (diagnostic Diagnostic) MarshalJSON() ([]byte, error)
MarshalJSON redacts secret-bearing source content from the message and suggestion before serialization so check --json and other JSON sinks never emit a hardcoded secret quoted from .gwdk source.
func (Diagnostic) String ¶
func (diagnostic Diagnostic) String() string
type DiagnosticReport ¶
type DiagnosticReport struct {
Diagnostics Diagnostics `json:"diagnostics"`
}
DiagnosticReport is the JSON shape consumed by editor integrations.
type Diagnostics ¶
type Diagnostics []Diagnostic
Diagnostics is a collection that implements error.
func CheckJSON ¶
func CheckJSON(config gowdk.Config, paths []string) ([]byte, Diagnostics)
CheckJSON returns editor-friendly JSON diagnostics for parsed files.
func CheckSource ¶
CheckSource parses and validates one in-memory .gwdk source buffer.
func ManifestJSON ¶
func ManifestJSON(config gowdk.Config, paths []string) ([]byte, Diagnostics)
ManifestJSON returns the manifest JSON report for parsed and validated files. The report shape is derived from the compiler IR.
func ParseBuildFiles ¶
func ParseBuildFiles(paths []string) (gwdkanalysis.Sources, Diagnostics)
ParseBuildFiles parses explicit page and component files for build commands.
func ParseComponentSource ¶
func ParseComponentSource(path string, source []byte) (gwdkir.Component, Diagnostics)
ParseComponentSource parses one in-memory .cmp.gwdk source buffer.
func ParseFile ¶
func ParseFile(path string) (gwdkir.Page, Diagnostics)
ParseFile reads and parses one .gwdk file.
func ParseFiles ¶
func ParseFiles(paths []string) (gwdkanalysis.Sources, Diagnostics)
ParseFiles parses multiple .gwdk files into IR source records.
func ParseLayoutSource ¶
func ParseLayoutSource(path string, source []byte) (gwdkir.Layout, Diagnostics)
ParseLayoutSource parses one in-memory .layout.gwdk source buffer.
func ParseSource ¶
func ParseSource(path string, source []byte) (gwdkir.Page, Diagnostics)
ParseSource parses one .gwdk source buffer.
func SiteMapJSON ¶
func SiteMapJSON(config gowdk.Config, paths []string) ([]byte, Diagnostics)
SiteMapJSON returns the JSON site map for parsed and validated files.
func (Diagnostics) Error ¶
func (diagnostics Diagnostics) Error() string
func (Diagnostics) HasErrors ¶
func (diagnostics Diagnostics) HasErrors() bool
HasErrors reports whether any diagnostic is an error.
type FileKind ¶
type FileKind string
FileKind identifies the current source file category.
func ClassifySource ¶
ClassifySource classifies a .gwdk source file using current file-kind rules.
type SiteMap ¶
type SiteMap struct {
Pages []SiteMapPage `json:"pages"`
Routes []SiteMapRoute `json:"routes,omitempty"`
Endpoints []SiteMapEndpoint `json:"endpoints,omitempty"`
}
SiteMap is an editor-facing route and file map.
type SiteMapBlocks ¶
type SiteMapBlocks struct {
Paths bool `json:"paths"`
Build bool `json:"build"`
Load bool `json:"load"`
View bool `json:"view"`
Actions []string `json:"actions,omitempty"`
APIs []string `json:"apis,omitempty"`
}
SiteMapBlocks records which top-level source blocks are present.
type SiteMapEndpoint ¶ added in v0.1.5
type SiteMapEndpoint struct {
Kind compiler.EndpointKind `json:"kind"`
Method string `json:"method"`
Route string `json:"route"`
PageID string `json:"pageId"`
Symbol string `json:"symbol,omitempty"`
Package string `json:"package,omitempty"`
BindingStatus source.BackendBindingStatus `json:"bindingStatus,omitempty"`
Signature source.BackendSignatureKind `json:"signature,omitempty"`
InputType string `json:"inputType,omitempty"`
}
SiteMapEndpoint describes one generated action/API endpoint graph entry.
type SiteMapPage ¶
type SiteMapPage struct {
ID string `json:"id"`
Route string `json:"route"`
Source string `json:"source"`
Render gowdk.RenderMode `json:"render"`
Layouts []string `json:"layouts,omitempty"`
Guard []string `json:"guard,omitempty"`
DynamicParams []string `json:"dynamicParams,omitempty"`
Blocks SiteMapBlocks `json:"blocks"`
}
SiteMapPage describes one movable page file and its route identity.
type SiteMapRoute ¶ added in v0.1.5
type SiteMapRoute struct {
Kind compiler.RouteKind `json:"kind"`
Method string `json:"method"`
Route string `json:"route"`
PageID string `json:"pageId"`
Handler string `json:"handler,omitempty"`
}
SiteMapRoute describes one generated route graph entry.
type TokenKind ¶
type TokenKind string
TokenKind identifies one lexical token.
const ( TokenIllegal TokenKind = "illegal" TokenEOF TokenKind = "eof" TokenNewline TokenKind = "newline" TokenAnnotation TokenKind = "annotation" TokenIdentifier TokenKind = "identifier" TokenString TokenKind = "string" TokenLBrace TokenKind = "lbrace" TokenRBrace TokenKind = "rbrace" TokenComma TokenKind = "comma" TokenColon TokenKind = "colon" TokenQuestion TokenKind = "question" TokenArrow TokenKind = "arrow" TokenText TokenKind = "text" )