Documentation
¶
Index ¶
- Constants
- Variables
- func IsJSONRequest(r *http.Request) bool
- func PrettyPrintFS(fsys fs.FS) error
- type ActionReqData
- type Actions
- type ActionsRouter
- type ActionsRouterOptions
- type AdHocType
- type BuildOptions
- type FormData
- type GetDefaultHeadElsFunc
- type GetHeadElUniqueRulesFunc
- type GetRootTemplateDataFunc
- type GetSSRInnerHTMLOutput
- type LoaderReqData
- type Loaders
- type LoadersRouter
- type LoadersRouterOptions
- type NodeScriptResult
- type NodeScriptResultItem
- type Path
- type PathsFile
- type Route
- type RouteCall
- type RouteType
- type SSRInnerHTMLInput
- type SplatValues
- type TaskHandler
- type UIVariant
- type Vorma
- func (v *Vorma) Actions() *Actions
- func (v *Vorma) ActionsRouter() *ActionsRouter
- func (v *Vorma) Build(o ...BuildOptions)
- func (v *Vorma) GetActionsHandler(router *mux.Router) mux.TasksCtxRequirerFunc
- func (v *Vorma) GetCurrentBuildID() string
- func (v *Vorma) GetLoadersHandler(nestedRouter *mux.NestedRouter) mux.TasksCtxRequirerFunc
- func (v *Vorma) GetUIHandler(nestedRouter *mux.NestedRouter) mux.TasksCtxRequirerFuncdeprecated
- func (v *Vorma) Init()
- func (v *Vorma) InitWithDefaultRouter() *mux.Router
- func (v *Vorma) IsCurrentBuildJSONRequest(r *http.Request) bool
- func (v *Vorma) Loaders() *Loaders
- func (v *Vorma) LoadersRouter() *LoadersRouter
- func (v *Vorma) ServeStatic() func(http.Handler) http.Handler
- func (v *Vorma) ServerAddr() string
- type VormaAppConfig
Constants ¶
View Source
const ( VormaPathsStageOneJSONFileName = "vorma_paths_stage_1.json" VormaPathsStageTwoJSONFileName = "vorma_paths_stage_2.json" )
View Source
const VormaBuildIDHeaderKey = "X-Vorma-Build-Id"
View Source
const VormaJSONQueryKey = "vorma_json"
View Source
const (
VormaSymbolStr = "__vorma_internal__"
)
Variables ¶
View Source
var Log = colorlog.New("vorma")
View Source
var RouteTypes = struct { Loader RouteType Query RouteType Mutation RouteType NotFound RouteType }{ Loader: "loader", Query: "query", Mutation: "mutation", NotFound: "not-found", }
View Source
var UIVariants = struct { React UIVariant Preact UIVariant Solid UIVariant }{ React: "react", Preact: "preact", Solid: "solid", }
Functions ¶
func IsJSONRequest ¶
If true, is JSON, but may or may not be from an up-to-date client.
func PrettyPrintFS ¶
Types ¶
type ActionReqData ¶
type Actions ¶
type Actions struct {
// contains filtered or unexported fields
}
func (*Actions) HandlerMountPattern ¶
func (*Actions) SupportedMethods ¶
type ActionsRouter ¶
type ActionsRouterOptions ¶
type BuildOptions ¶
type GetDefaultHeadElsFunc ¶
type GetRootTemplateDataFunc ¶
type GetSSRInnerHTMLOutput ¶
type LoaderReqData ¶
type LoaderReqData = mux.NestedReqData
type Loaders ¶
type Loaders struct {
// contains filtered or unexported fields
}
func (*Loaders) HandlerMountPattern ¶
type LoadersRouter ¶
type LoadersRouter struct {
*mux.NestedRouter
}
type LoadersRouterOptions ¶
type NodeScriptResult ¶
type NodeScriptResult []NodeScriptResultItem
type NodeScriptResultItem ¶
type Path ¶
type Path struct {
NestedRoute mux.AnyNestedRoute `json:"-"`
// both stages one and two
OriginalPattern string `json:"originalPattern"`
SrcPath string `json:"srcPath"`
ExportKey string `json:"exportKey"`
ErrorExportKey string `json:"errorExportKey,omitempty"`
// stage two only
OutPath string `json:"outPath,omitempty"`
Deps []string `json:"deps,omitempty"`
}
type PathsFile ¶
type PathsFile struct {
// both stages one and two
Stage string `json:"stage"`
BuildID string `json:"buildID,omitempty"`
ClientEntrySrc string `json:"clientEntrySrc"`
Paths map[string]*Path `json:"paths"`
RouteManifestFile string `json:"routeManifestFile"`
// stage two only
ClientEntryOut string `json:"clientEntryOut,omitempty"`
ClientEntryDeps []string `json:"clientEntryDeps,omitempty"`
DepToCSSBundleMap map[string]string `json:"depToCSSBundleMap,omitempty"`
}
type SSRInnerHTMLInput ¶
type SplatValues ¶
type SplatValues []string
type TaskHandler ¶
type TaskHandler[I any, O any] = mux.TaskHandler[I, O]
type Vorma ¶
func NewVormaApp ¶
func NewVormaApp(o VormaAppConfig) *Vorma
func (*Vorma) ActionsRouter ¶
func (v *Vorma) ActionsRouter() *ActionsRouter
func (*Vorma) Build ¶
func (v *Vorma) Build(o ...BuildOptions)
func (*Vorma) GetActionsHandler ¶
func (v *Vorma) GetActionsHandler(router *mux.Router) mux.TasksCtxRequirerFunc
func (*Vorma) GetCurrentBuildID ¶
GetCurrentBuildID returns the current build ID of the Vorma instance.
func (*Vorma) GetLoadersHandler ¶
func (v *Vorma) GetLoadersHandler(nestedRouter *mux.NestedRouter) mux.TasksCtxRequirerFunc
func (*Vorma) GetUIHandler
deprecated
func (v *Vorma) GetUIHandler(nestedRouter *mux.NestedRouter) mux.TasksCtxRequirerFunc
Deprecated: use GetLoadersHandler instead.
func (*Vorma) Init ¶
func (v *Vorma) Init()
Inits Vorma. Panics on error in production; logs error in dev mode.
func (*Vorma) InitWithDefaultRouter ¶ added in v0.83.0
Inits Vorma and returns a default mux.Router with all loaders and actions registered. To use a different router, call Vorma.Init() and then register the handlers manually with whatever third-party router you may want to use (see the implementation of this function for reference on how to do that).
func (*Vorma) IsCurrentBuildJSONRequest ¶
If true, is both (1) JSON and (2) guaranteed to be from a client that has knowledge of the latest build ID.
func (*Vorma) LoadersRouter ¶
func (v *Vorma) LoadersRouter() *LoadersRouter
func (*Vorma) ServerAddr ¶
type VormaAppConfig ¶
type VormaAppConfig struct {
Wave *wave.Wave
GetDefaultHeadEls GetDefaultHeadElsFunc
GetHeadElUniqueRules GetHeadElUniqueRulesFunc
GetRootTemplateData GetRootTemplateDataFunc
LoadersRouterOptions LoadersRouterOptions
ActionsRouterOptions ActionsRouterOptions
}
Click to show internal directories.
Click to hide internal directories.