gwdkast

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package gwdkast defines the typed syntax tree for .gwdk source files.

Index

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 AuditApply added in v0.5.0

type AuditApply struct {
	Selector string
	Span     source.SourceSpan
}

AuditApply applies a policy to one selector.

type AuditFile added in v0.5.0

type AuditFile struct {
	Package  *Package
	Policies []AuditPolicy
	Tests    []AuditTest
}

AuditFile is the typed AST for a *.audit.gwdk source.

type AuditPolicy added in v0.5.0

type AuditPolicy struct {
	Name    string
	Extends []string
	Applies []AuditApply
	Rules   []AuditRule
	Span    source.SourceSpan
}

AuditPolicy declares a composable security policy.

type AuditRule added in v0.5.0

type AuditRule struct {
	Kind  string
	Value string
	Code  string
	Attrs map[string]string
	Span  source.SourceSpan
}

AuditRule declares one policy rule. Attrs carries structured arguments for rules that need more than a single value (for example a raw-HTML exception's owner, justification, expiry, and sanitizer contract).

type AuditTest added in v0.5.0

type AuditTest struct {
	Name string
	Body string
	Span source.SourceSpan
}

AuditTest preserves one declared audit integration test block for generated runtime tests.

type Block

type Block struct {
	Kind      string
	Name      string
	Body      string
	Span      source.SourceSpan
	BodyStart source.SourcePosition
	View      []viewmodel.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 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
	Expressions map[string]string
	FieldOrder  []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
	Default    string
	DefaultSet bool
	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
	// Persist is the optional `persist "<scope>"` modifier. It is empty when the
	// store is not persisted, otherwise the raw (unquoted) scope literal. The
	// scope value is validated later so an invalid literal still parses into a
	// store and yields a precise diagnostic rather than a generic parse error.
	Persist string
	// PersistSet reports whether a `persist` clause was present, distinguishing an
	// absent clause from an explicit empty scope (`persist ""`). Without it the
	// latter is indistinguishable from no persistence and would silently parse as
	// unpersisted instead of yielding page_store_persist_scope_invalid.
	PersistSet bool
	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.

Jump to

Keyboard shortcuts

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