serve

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMode

type AppMode struct {
	// contains filtered or unexported fields
}

func NewAppMode

func NewAppMode(s *Server) (*AppMode, error)

func (*AppMode) HandleFileChange

func (am *AppMode) HandleFileChange(path string)

func (*AppMode) Restart

func (am *AppMode) Restart() error

func (*AppMode) ServeHTTP

func (am *AppMode) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*AppMode) Stop

func (am *AppMode) Stop()

func (*AppMode) WaitForReady

func (am *AppMode) WaitForReady(ctx context.Context) error

type Client

type Client struct {
	ID string
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close()

func (*Client) Send

func (c *Client) Send(data interface{}) error

type ComponentManifest

type ComponentManifest struct {
	Name        string   `yaml:"name"`
	Version     string   `yaml:"version"`
	Description string   `yaml:"description"`
	Category    string   `yaml:"category"`
	Kit         string   `yaml:"kit"`
	Tags        []string `yaml:"tags"`
	Templates   []string `yaml:"templates"`
}

type ComponentMode

type ComponentMode struct {
	// contains filtered or unexported fields
}

func NewComponentMode

func NewComponentMode(s *Server) (*ComponentMode, error)

func (*ComponentMode) ServeHTTP

func (cm *ComponentMode) ServeHTTP(w http.ResponseWriter, r *http.Request)

type FileChangeHandler

type FileChangeHandler func(path string)

type KitMode

type KitMode struct {
	// contains filtered or unexported fields
}

func NewKitMode

func NewKitMode(s *Server) (*KitMode, error)

func (*KitMode) Reload

func (km *KitMode) Reload() error

func (*KitMode) ServeHTTP

func (km *KitMode) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ModeDetector

type ModeDetector struct {
	// contains filtered or unexported fields
}

func NewModeDetector

func NewModeDetector(dir string) *ModeDetector

func (*ModeDetector) DetectMode

func (d *ModeDetector) DetectMode() (ServeMode, error)

func (*ModeDetector) GetModeInfo

func (d *ModeDetector) GetModeInfo(mode ServeMode) string

func (*ModeDetector) ValidateMode

func (d *ModeDetector) ValidateMode(mode ServeMode) error

type ServeMode

type ServeMode string
const (
	ModeComponent ServeMode = "component"
	ModeKit       ServeMode = "kit"
	ModeApp       ServeMode = "app"
)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(config *ServerConfig) (*Server, error)

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

type ServerConfig

type ServerConfig struct {
	Port            int
	Host            string
	Dir             string
	Mode            ServeMode
	AutoDetect      bool
	OpenBrowser     bool
	LiveReload      bool
	WebSocketPath   string
	ShutdownTimeout time.Duration
}

func DefaultConfig

func DefaultConfig() *ServerConfig

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(dir string, handler FileChangeHandler) (*Watcher, error)

func (*Watcher) AddIgnorePattern

func (w *Watcher) AddIgnorePattern(pattern string)

func (*Watcher) GetWatchedFiles

func (w *Watcher) GetWatchedFiles() []string

func (*Watcher) SetDebounce

func (w *Watcher) SetDebounce(duration time.Duration)

func (*Watcher) Start

func (w *Watcher) Start() error

func (*Watcher) Stop

func (w *Watcher) Stop()

type WebSocketManager

type WebSocketManager struct {
	// contains filtered or unexported fields
}

func NewWebSocketManager

func NewWebSocketManager() *WebSocketManager

func (*WebSocketManager) ClientCount

func (wsm *WebSocketManager) ClientCount() int

func (*WebSocketManager) Close

func (wsm *WebSocketManager) Close()

func (*WebSocketManager) HandleWebSocket

func (wsm *WebSocketManager) HandleWebSocket(w http.ResponseWriter, r *http.Request)

func (*WebSocketManager) ReloadClients added in v0.1.7

func (wsm *WebSocketManager) ReloadClients(data interface{})

ReloadClients fans out a dev-mode reload payload to all connected clients.

Jump to

Keyboard shortcuts

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