Documentation
¶
Index ¶
- Variables
- type BehaviouralDefaults
- type Bundler
- func (b *Bundler) Close()
- func (b *Bundler) FromDisk(key *caching.CacheKey) (*caching.Rendered, bool)
- func (this *Bundler) Prepare(component meta.QualifiedName, props any) RenderCallBuilder
- func (b *Bundler) Registry() *internal.ComponentRegistry
- func (this *Bundler) Render(component meta.QualifiedName, ...) (*caching.Rendered, error)
- type Config
- type RenderCallBuilder
Constants ¶
This section is empty.
Variables ¶
View Source
var NIL_BEHAVIOURAL_DEFAULTS = &BehaviouralDefaults{ HeadSegment: noop.T_o_Void[networking.HTMLHeadSegmentBuilder](), Requests: noop.T_o_Void[networking.RequestBehaviourBuilder](), }
Functions ¶
This section is empty.
Types ¶
type BehaviouralDefaults ¶
type BehaviouralDefaults struct {
// Define the default elements of the <head> tag to be included in every page.
// These defaults can be modified upon any Bundler#Prepare call by using the method: WithHTMLHeadTags
HeadSegment meta.Configurator[networking.HTMLHeadSegmentBuilder] `json:"-"`
// Define the default behaviour of the http request handling. These defaults can be modified upon any Bundler#Prepare call by using the method: SetHTTPBehaviour
Requests meta.Configurator[networking.RequestBehaviourBuilder] `json:"-"`
}
type Bundler ¶
type Bundler struct {
// contains filtered or unexported fields
}
func (*Bundler) Prepare ¶
func (this *Bundler) Prepare(component meta.QualifiedName, props any) RenderCallBuilder
TODO: expand props to varparam, construct props js object from safe-made reflect.Type and let an interface be implemented to enable a props property key overwrite
func (*Bundler) Registry ¶
func (b *Bundler) Registry() *internal.ComponentRegistry
func (*Bundler) Render ¶ added in v0.0.12
func (this *Bundler) Render(component meta.QualifiedName, configurator meta.Configurator[RenderCallBuilder], props any) (*caching.Rendered, error)
type Config ¶
type Config struct {
// The absolute path to the directory containing the solidjs components.
// The registry will scan this and all subdirectories, skipping directories prefixed with a dot (.)
// or with the exact name "node_modules"
Components meta.AbsoluteDirectoryPath
// The absolute path to the directory where go_solid will place its .go_solid workspace directory, which contains the worker script and the disk cache.
// Defaults to Components if not specified.
Workspace meta.AbsoluteDirectoryPath
// LogLevel gates all diagnostic output. Left unset it resolves to
// logging.DEFAULT_LEVEL (errors only); set logging.LEVEL_DEBUG to have the
// normalized config dumped at construction.
//
// The logger is process-global, so the most recent New wins.
LogLevel logging.LogLevel
// DisableCaching bypasses both the in-memory and on-disk caches, so every
// render rebuilds from source.
DisableCaching bool
// Settings for code generation, solidjs transform application, worker pool size, and the like.
//
// Expects node_modules to be located within Config#Components by default. Can be overwritten using this sub-config.
Generation *esbuild.BundlerConfig
// Enable a filewatcher that watches the component dir to trigger registry updates when new component files are added.
// This enables usecases which may attempt to ask for procedural component names, since the registry is constant otherwise.
ReactiveRegistry bool
// If you provide this config, bundle and cache all components in the registry on next boot (may take a moment).
// This is purely a performance measure — every component is pre-built, so no request pays bundling cost.
// With ExpectCompleted set, esbuild is skipped entirely and components are served straight from the cache.
//
// Do be aware that this disables HMR, ReactiveRegistry and DisableCaching (caches are now mandatory).
//
// Enabled by default; set Rasterization.Disabled to opt out.
Rasterization *rasterization.RasterizationConfig
// Types governs how go_solid checks the Go props a template is rendered
// with against the type its component declares for them.
//
// The component is the contract. Shapes extracted from it are cached under
// the workspace whatever this holds; Types.Check only selects when the
// props are held against them.
Types *types.TypesConfig
// !! NOT IMPLEMENTED !! Enable component-integrated static content serving. If provided, any component's props (if any) will gain a "static" property of a type
// that is a 1 to 1 recreation of the structure of the Static.Location directory. This places some limitations upon names of files and sub-directories.
//
// In the resulting graph-like js object at props.static, each file becomes a function that returns a corresponding Promise. I.e. font at:
//
// <StaticConfig.Location>/svg/homeIcon.svg
//
// becomes accessible in a component as:
//
// props.static.svg.homeIcon()
Static *static.StaticConfig
// HMR enables hot browser reload in development. When non-nil and not
// Disabled, go_solid watches the components tree and pushes reloads to the
// tabs viewing an affected template. Requires HMR.Mux so go_solid can mount
// its WebSocket handler itself.
HMR *hmr.HMRConfig
Defaults *BehaviouralDefaults
}
type RenderCallBuilder ¶
type RenderCallBuilder interface {
WithCtx(ctx context.Context) RenderCallBuilder
MountOnRootID(id string) RenderCallBuilder
WithHTMLHeadTags(fn meta.Configurator[networking.HTMLHeadSegmentBuilder]) RenderCallBuilder
// Automatically route the render call to the given request and response writer.
// Includes basic http request handling, status codes and error handling. To
// customize the behaviour, use WithHTTPBehaviour(configurator).
//
// Using this method will automatically set the context for the render call to the request's context.
ForRequest(w http.ResponseWriter, r *http.Request) RenderCallBuilder
// Alter default http request behaviour.
// If a ResponseWriter and Request have been provided previously, these will carry over, but can be overwritten
SetHTTPBehaviour(fn meta.Configurator[networking.RequestBehaviourBuilder]) RenderCallBuilder
Render() (*caching.Rendered, error)
}
Click to show internal directories.
Click to hide internal directories.