Documentation
¶
Overview ¶
Package gwdkast defines the typed syntax tree for .gwdk source files.
Index ¶
- type APIStatement
- type ActionStatement
- type AssetRef
- type AssetScope
- type Block
- type BuildCall
- type CacheDecl
- type ComponentDecl
- type Emit
- type EmitParam
- type Endpoint
- type ErrorPageDecl
- type Export
- type File
- type FragmentEndpoint
- type GoFuncRef
- type GoTypeRef
- type GuardRef
- type Import
- type LayoutDecl
- type LayoutRef
- type LiteralRecord
- type MetadataDecl
- type Package
- type PageDecl
- type Prop
- type RevalidateDecl
- type RouteDecl
- type RouteParam
- type StateContract
- type Store
- type Use
- type WASMContract
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIStatement ¶
type APIStatement struct {
Method string
Route string
Span source.SourceSpan
}
APIStatement is one supported statement inside legacy api {} parsing.
type ActionStatement ¶
type ActionStatement struct {
Kind string
Name string
InputName string
InputType string
Target string
Redirect string
Body string
Span source.SourceSpan
}
ActionStatement is one supported statement inside legacy act {} parsing.
type AssetRef ¶
type AssetRef struct {
Kind string
Path string
Inline string
Scope AssetScope
Span source.SourceSpan
}
AssetRef is one source-selected asset reference.
type AssetScope ¶
type AssetScope struct {
OwnerKind string
OwnerID string
Package string
ScopeID string
HashKey string
}
AssetScope records deterministic owner metadata for scoped CSS and future content-hashed component assets.
type Block ¶
type Block struct {
Kind string
Name string
Body string
Span source.SourceSpan
BodyStart source.SourcePosition
View []view.Node
StyleBody string
Records []LiteralRecord
Call *BuildCall
Props []Prop
Exports []Export
Emits []Emit
Actions []ActionStatement
APIs []APIStatement
}
Block is one parsed top-level block.
type BuildCall ¶
type BuildCall struct {
Alias string
Function string
Span source.SourceSpan
}
BuildCall is a first-slice imported build data function call.
type CacheDecl ¶
type CacheDecl struct {
Policy string
Span source.SourceSpan
}
CacheDecl is an cache route response policy declaration.
type ComponentDecl ¶
type ComponentDecl struct {
Name string
Span source.SourceSpan
}
ComponentDecl is an component declaration.
type Emit ¶
type Emit struct {
Name string
Params []EmitParam
Span source.SourceSpan
}
Emit is one component event declaration inside emits {}.
type EmitParam ¶
type EmitParam struct {
Name string
Type string
Span source.SourceSpan
}
EmitParam is one typed event payload field.
type Endpoint ¶
type Endpoint struct {
Kind string
Name string
Method string
Route string
ErrorPage string
Span source.SourceSpan
ErrorPageSpan source.SourceSpan
}
Endpoint is one exact action or API endpoint declaration.
type ErrorPageDecl ¶
type ErrorPageDecl struct {
Path string
Span source.SourceSpan
}
ErrorPageDecl is a route-local generated error page path.
type Export ¶
type Export struct {
Name string
Type string
Span source.SourceSpan
}
Export is one typed public component export inside exports {}.
type File ¶
type File struct {
Package *Package
Metadata []MetadataDecl
Page *PageDecl
Route *RouteDecl
Cache *CacheDecl
Revalidate *RevalidateDecl
ErrorPage *ErrorPageDecl
Layouts []LayoutRef
Guards []GuardRef
CSS []AssetRef
JS []AssetRef
Assets []AssetRef
Component *ComponentDecl
Layout *LayoutDecl
Imports []Import
Uses []Use
Stores []Store
PropsType *GoTypeRef
State *StateContract
WASM *WASMContract
Blocks []Block
Actions []Endpoint
APIs []Endpoint
Fragments []FragmentEndpoint
}
File is the typed AST for the currently supported .gwdk syntax subset.
type FragmentEndpoint ¶
type FragmentEndpoint struct {
Name string
Method string
Route string
Target string
Body string
Span source.SourceSpan
RouteSpan source.SourceSpan
TargetSpan source.SourceSpan
}
FragmentEndpoint is one generated server fragment route declaration.
type GoFuncRef ¶
type GoFuncRef struct {
Alias string
Name string
Span source.SourceSpan
}
GoFuncRef references a Go function through a .gwdk import alias.
type GoTypeRef ¶
type GoTypeRef struct {
Alias string
Name string
Span source.SourceSpan
}
GoTypeRef references a Go type through a .gwdk import alias.
type GuardRef ¶
type GuardRef struct {
Name string
Span source.SourceSpan
}
GuardRef is one guard reference on a page.
type Import ¶
type Import struct {
Alias string
Path string
Span source.SourceSpan
}
Import is one top-level Go import declaration.
type LayoutDecl ¶
type LayoutDecl struct {
ID string
Span source.SourceSpan
}
LayoutDecl is an layout declaration in a layout file.
type LayoutRef ¶
type LayoutRef struct {
ID string
Span source.SourceSpan
}
LayoutRef is one layout reference on a page.
type LiteralRecord ¶
type LiteralRecord struct {
Fields map[string]string
Span source.SourceSpan
}
LiteralRecord is a first-slice paths/build return record.
type MetadataDecl ¶ added in v0.3.0
type MetadataDecl struct {
Name string
Value string
Span source.SourceSpan
}
MetadataDecl is one top-level keyword metadata declaration.
type Package ¶
type Package struct {
Name string
Span source.SourceSpan
}
Package is the top-level Go package declaration.
type PageDecl ¶
type PageDecl struct {
ID string
Span source.SourceSpan
}
PageDecl is an page declaration.
type Prop ¶
type Prop struct {
Name string
Type string
Span source.SourceSpan
}
Prop is one scalar prop declaration inside props {}.
type RevalidateDecl ¶
type RevalidateDecl struct {
Seconds string
Span source.SourceSpan
}
RevalidateDecl is an revalidate stale-while-revalidate declaration.
type RouteDecl ¶
type RouteDecl struct {
Path string
Params []RouteParam
Span source.SourceSpan
}
RouteDecl is an route declaration.
type RouteParam ¶
type RouteParam struct {
Name string
Type string
Span source.SourceSpan
}
RouteParam is one dynamic route segment declared by route.
type StateContract ¶
type StateContract struct {
Type GoTypeRef
Init GoFuncRef
Span source.SourceSpan
}
StateContract describes a component state type and initializer.
type Store ¶
type Store struct {
Name string
Type GoTypeRef
Init GoFuncRef
Span source.SourceSpan
}
Store is one top-level page-scoped store declaration.
type Use ¶
type Use struct {
Alias string
Package string
Span source.SourceSpan
}
Use is one top-level GOWDK package import declaration.
type WASMContract ¶
type WASMContract struct {
Package string
Span source.SourceSpan
}
WASMContract points an explicit browser-side Go package at a component.