Documentation
¶
Index ¶
- Constants
- func CachePolicyWithRevalidate(cache string, revalidate string) string
- func ErrorPagePath(value string) (string, error)
- func InlineScriptName(index int) string
- type API
- type Action
- type BackendBinding
- type BackendBindingStatus
- type BackendInputField
- type BackendSignatureKind
- type BlockSpans
- type Blocks
- type Component
- type ComponentSpans
- type Emit
- type EmitParam
- type EndpointDeclaration
- type EndpointSource
- type Export
- type Fragment
- type FragmentEndpoint
- type GoBlock
- type GoFuncRef
- type GoTypeRef
- type Import
- type InlineScript
- type Layout
- type Manifest
- type NamedSpan
- type Page
- type PageMetadata
- type PageSpans
- type Prop
- type RouteParam
- type SourcePosition
- type SourceSpan
- type StateContract
- type Store
- type Use
- type WASMContract
Constants ¶
const PublicSchemaVersion = 1
PublicSchemaVersion is the current gowdk manifest JSON schema version.
Variables ¶
This section is empty.
Functions ¶
func CachePolicyWithRevalidate ¶ added in v0.1.5
CachePolicyWithRevalidate appends the page revalidation directive to an explicit Cache-Control policy.
func ErrorPagePath ¶ added in v0.1.5
ErrorPagePath returns a clean generated-output-relative error page path.
func InlineScriptName ¶ added in v0.2.3
InlineScriptName returns the deterministic generated filename for the zero-based inline browser script declaration index in one source owner.
Types ¶
type API ¶
type API struct {
Name string
Method string
Route string
ErrorPage string
Span SourceSpan
RouteSpan SourceSpan
RouteParams []NamedSpan
ErrorPageSpan SourceSpan
}
API describes an API endpoint declaration.
type Action ¶
type Action struct {
Name string
Method string
Route string
Body string
InputName string
InputType string
ValidatesInput bool
Redirect string
Fragments []Fragment
ErrorPage string
Span SourceSpan
RouteSpan SourceSpan
RouteParams []NamedSpan
InputSpan SourceSpan
ValidationSpan SourceSpan
RedirectSpan SourceSpan
ErrorPageSpan SourceSpan
}
Action describes an action endpoint declaration.
type BackendBinding ¶ added in v0.1.5
type BackendBinding struct {
Kind string
PageID string
Source string
BlockName string
Method string
Route string
ImportPath string
PackageName string
FunctionName string
Signature BackendSignatureKind
InputType string
InputPointer bool
InputFields []BackendInputField
Status BackendBindingStatus
Message string
}
BackendBinding describes the Go handler selected for an act or api block.
type BackendBindingStatus ¶ added in v0.1.5
type BackendBindingStatus string
BackendBindingStatus describes whether a .gwdk backend block has a matching same-package Go handler.
const ( BackendBindingBound BackendBindingStatus = "bound" BackendBindingMissing BackendBindingStatus = "missing" BackendBindingUnsupportedSignature BackendBindingStatus = "unsupported_signature" )
type BackendInputField ¶ added in v0.1.5
BackendInputField describes one form field decoded into a Go action input struct from compile-time Go AST metadata.
type BackendSignatureKind ¶ added in v0.1.5
type BackendSignatureKind string
BackendSignatureKind describes the supported Go handler shape.
const ( BackendSignatureAction0 BackendSignatureKind = "action0" BackendSignatureActionValues BackendSignatureKind = "action_values" BackendSignatureActionForm BackendSignatureKind = "action_form" BackendSignatureActionFormPtr BackendSignatureKind = "action_form_ptr" BackendSignatureAPI BackendSignatureKind = "api" BackendSignatureFragment BackendSignatureKind = "fragment" BackendSignatureLoad BackendSignatureKind = "load" BackendSignatureLoadError BackendSignatureKind = "load_error" )
type BlockSpans ¶
type BlockSpans struct {
Paths SourceSpan
Build SourceSpan
Load SourceSpan
Client SourceSpan
GoBlocks []NamedSpan
View SourceSpan
ViewBodyStart SourcePosition
Actions []NamedSpan
APIs []NamedSpan
Fragments []NamedSpan
Exports SourceSpan
Emits SourceSpan
}
BlockSpans records source ranges for page, component, or layout blocks.
type Blocks ¶
type Blocks struct {
PathsBody string
Build bool
BuildBody string
Load bool
LoadBody string
Client bool
ClientBody string
GoBlocks []GoBlock
View bool
ViewBody string
Style bool
StyleBody string
Actions []Action
APIs []API
Fragments []FragmentEndpoint
Spans BlockSpans
}
Blocks records the source blocks declared by a page.
type Component ¶
type Component struct {
Source string
Package string
Name string
Imports []Import
Uses []Use
CSS []string
JS []string
InlineJS []InlineScript
Assets []string
Props []Prop
PropsType GoTypeRef
State StateContract
WASM WASMContract
Exports []Export
Emits []Emit
Blocks Blocks
Span SourceSpan
PackageSpan SourceSpan
Spans ComponentSpans
}
Component describes a .cmp.gwdk component after parsing and normalization.
type ComponentSpans ¶ added in v0.1.5
type ComponentSpans struct {
CSS []NamedSpan
JS []NamedSpan
InlineJS []NamedSpan
Assets []NamedSpan
}
ComponentSpans records source ranges for component annotations.
type Emit ¶
type Emit struct {
Name string
Params []EmitParam
Span SourceSpan
}
Emit describes one component event emitted by a browser island.
type EmitParam ¶
type EmitParam struct {
Name string
Type string
Span SourceSpan
}
EmitParam describes one scalar field in a component event payload.
type EndpointDeclaration ¶ added in v0.1.5
type EndpointDeclaration struct {
Kind string
SourceKind EndpointSource
Package string
Source string
Name string
Method string
Route string
ErrorPage string
Span SourceSpan
RouteSpan SourceSpan
RouteParams []NamedSpan
ErrorPageSpan SourceSpan
}
EndpointDeclaration describes a standalone backend endpoint declaration. Page-owned declarations stay on Page.Blocks so page forms/fragments can still attach page-local behavior.
type EndpointSource ¶ added in v0.1.5
type EndpointSource string
EndpointSource identifies where an endpoint declaration came from.
const ( EndpointSourceGOWDK EndpointSource = "gwdk" EndpointSourceGo EndpointSource = "go" )
type Export ¶ added in v0.1.5
type Export struct {
Name string
Type string
Span SourceSpan
}
Export describes one typed public component export.
type Fragment ¶
type Fragment struct {
Target string
Body string
Span SourceSpan
}
Fragment describes a server fragment declared inside an action.
type FragmentEndpoint ¶ added in v0.1.5
type FragmentEndpoint struct {
Name string
Method string
Route string
Target string
Body string
Span SourceSpan
RouteSpan SourceSpan
TargetSpan SourceSpan
RouteParams []NamedSpan
}
FragmentEndpoint describes a generated server fragment endpoint declaration.
type GoBlock ¶ added in v0.1.5
type GoBlock struct {
Target string
Body string
Span SourceSpan
}
GoBlock records one optional inline Go authoring block. Target is empty for general package Go, or a lane/addon target such as "client", "ssr", or "addon.contracts".
type GoFuncRef ¶
type GoFuncRef struct {
Alias string
Name string
Span SourceSpan
}
GoFuncRef references a Go function through an import alias declared in a .gwdk source file.
type GoTypeRef ¶
type GoTypeRef struct {
Alias string
Name string
Span SourceSpan
}
GoTypeRef references a Go type through an import alias declared in a .gwdk source file.
type Import ¶
type Import struct {
Alias string
Path string
Span SourceSpan
}
Import records a Go import declared by a .gwdk page.
type InlineScript ¶ added in v0.2.3
type InlineScript struct {
Name string
Body string
Span SourceSpan
}
InlineScript records browser module code declared directly inside a .gwdk source file. Path-based script declarations should remain preferred.
type Layout ¶
type Layout struct {
Source string
Package string
ID string
Uses []Use
Blocks Blocks
Span SourceSpan
PackageSpan SourceSpan
}
Layout describes a .layout.gwdk layout after parsing and normalization.
type Manifest ¶
type Manifest struct {
Pages []Page
Components []Component
Layouts []Layout
Endpoints []EndpointDeclaration
BackendBindings []BackendBinding
}
Manifest is the compiler's normalized view of discovered .gwdk files.
func (Manifest) MarshalJSON ¶
MarshalJSON emits the route manifest shape consumed by generated binaries.
type NamedSpan ¶
type NamedSpan struct {
Name string
Span SourceSpan
}
NamedSpan records the source range for a named declaration or reference.
type Page ¶
type Page struct {
Source string
Package string
ID string
Route string
RouteParams []RouteParam
Render gowdk.RenderMode
Cache string
Revalidate string
ErrorPage string
Metadata PageMetadata
Layouts []string
Guard []string
CSS []string
JS []string
InlineJS []InlineScript
Imports []Import
Uses []Use
Stores []Store
Paths bool
Blocks Blocks
LoadBinding BackendBinding
Spans PageSpans
}
Page describes a .gwdk page after parsing and normalization.
func (Page) CachePolicy ¶ added in v0.1.5
CachePolicy returns the concrete Cache-Control policy generated for the page.
func (Page) DynamicParams ¶
DynamicParams returns route parameters declared with /path/{param} syntax.
func (Page) HasGoBlock ¶ added in v0.2.0
HasGoBlock reports whether the page declares a go block for target.
func (Page) RenderMode ¶
func (page Page) RenderMode(defaultMode gowdk.RenderMode) gowdk.RenderMode
RenderMode returns the effective render mode for a page.
func (Page) TypedRouteParams ¶ added in v0.1.5
func (page Page) TypedRouteParams() []RouteParam
TypedRouteParams returns route params with explicit type metadata. Untyped params are reported as string.
type PageMetadata ¶ added in v0.1.5
PageMetadata describes HTML document metadata declared by a page.
type PageSpans ¶
type PageSpans struct {
Package SourceSpan
Page SourceSpan
Route SourceSpan
Render SourceSpan
Cache SourceSpan
Revalidate SourceSpan
ErrorPage SourceSpan
Title SourceSpan
Description SourceSpan
Canonical SourceSpan
Image SourceSpan
Layouts []NamedSpan
Guard []NamedSpan
CSS []NamedSpan
JS []NamedSpan
InlineJS []NamedSpan
RouteParams []NamedSpan
}
PageSpans records source ranges for page annotations and declarations.
type Prop ¶
type Prop struct {
Name string
Type string
Span SourceSpan
}
Prop describes one component prop declaration.
type RouteParam ¶ added in v0.1.5
type RouteParam struct {
Name string
Type string
Span SourceSpan
}
RouteParam describes one dynamic route parameter and its declared scalar type. Empty Type means string for compatibility with legacy {name} syntax.
func RouteParamsFromPath ¶ added in v0.2.3
func RouteParamsFromPath(route string) []RouteParam
RouteParamsFromPath scans a route path for `{name}` and `{name:type}` segments. Invalid brace contents are ignored here; route validation owns reporting malformed route syntax.
type SourcePosition ¶
SourcePosition is a 1-based source location in a parsed .gwdk file.
type SourceSpan ¶
type SourceSpan struct {
Start SourcePosition
End SourcePosition
}
SourceSpan is a 1-based source range. End is exclusive.
type StateContract ¶
type StateContract struct {
Type GoTypeRef
Init GoFuncRef
Span SourceSpan
}
StateContract describes a local component state type and build-time initializer.
type Store ¶
type Store struct {
Name string
Type GoTypeRef
Init GoFuncRef
Span SourceSpan
}
Store describes one page-scoped shared state declaration.
type Use ¶ added in v0.1.5
type Use struct {
Alias string
Package string
Span SourceSpan
}
Use records a GOWDK source package import declared by a .gwdk file. Go imports still use Import; Use is for package-peer .gwdk pages, components, layouts, stores, and assets selected by the GOWDK compiler.
type WASMContract ¶
type WASMContract struct {
Package string
Span SourceSpan
}
WASMContract points an explicit browser-side Go package at a component.