Documentation
¶
Index ¶
- func CopyFile(src, dst string) error
- func ExecCommand(command string, args []string) (string, error)
- func ExecCommandWithCallback(command string, args []string, callback func(output string)) error
- func ExecStringCommand(cmdString string) (string, error)
- type Context
- type DependencyConfig
- type EventBus
- type EventType
- type LoadResult
- type Manager
- type Package
- type PackageMeta
- type Plugin
- type PluginBase
- func (p *PluginBase) HandleHotUpdate(file string) error
- func (p *PluginBase) Load(ctx *Context, id string) (*LoadResult, error)
- func (p *PluginBase) Name() string
- func (p *PluginBase) OnStart() error
- func (p *PluginBase) ResolveId(ctx *Context, id, importer string) (*ResolveResult, error)
- func (p *PluginBase) Transform(ctx *Context, code, id string) (*TransformResult, error)
- type PluginContainer
- func (pc *PluginContainer) HandleHotUpdate(file string) error
- func (pc *PluginContainer) Load(ctx *Context, id string) (*LoadResult, error)
- func (pc *PluginContainer) OnStart() error
- func (pc *PluginContainer) ResolveId(ctx *Context, id, importer string) (string, error)
- func (pc *PluginContainer) Transform(ctx *Context, code string, id string) (*TransformResult, error)
- type ResolveResult
- type RpcError
- type RpcErrorCode
- type RpcMethod
- type RpcRequest
- type RpcResponse
- type RpcServer
- type Server
- type ServerConfig
- type TransformResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecCommand ¶
ExecCommand executes a command with arguments and returns the combined output
func ExecCommandWithCallback ¶
ExecCommandWithCallback executes a command and calls the callback with the output
func ExecStringCommand ¶
ExecStringCommand executes a command from a string with space-separated arguments
Types ¶
type DependencyConfig ¶
type LoadResult ¶
type PackageMeta ¶
type PackageMeta struct {
Name string `json:"name"`
Version string `json:"version"`
Main string `json:"main"`
Types string `json:"types"`
TypesVersions map[string]map[string][]string `json:"typesVersions"`
Exports map[string]any `json:"exports"`
Dependencies map[string]string `json:"dependencies"`
PeerDependencies map[string]string `json:"peerDependencies"`
TypeScriptVersion string `json:"typeScriptVersion"`
}
type Plugin ¶
type Plugin interface {
Name() string
OnStart() error
// Called when resolving a module ID (bare imports, aliases, etc.)
ResolveId(ctx *Context, id string, importer string) (*ResolveResult, error)
// Called when loading a module after resolving
Load(ctx *Context, id string) (*LoadResult, error)
// Called to transform file content (e.g., JSX to JS)
Transform(ctx *Context, code string, id string) (*TransformResult, error)
// Called during dev HMR updates
HandleHotUpdate(filePath string) error
}
type PluginBase ¶
type PluginBase struct{}
func (*PluginBase) HandleHotUpdate ¶
func (p *PluginBase) HandleHotUpdate(file string) error
func (*PluginBase) Load ¶
func (p *PluginBase) Load(ctx *Context, id string) (*LoadResult, error)
func (*PluginBase) Name ¶
func (p *PluginBase) Name() string
func (*PluginBase) OnStart ¶
func (p *PluginBase) OnStart() error
func (*PluginBase) ResolveId ¶
func (p *PluginBase) ResolveId(ctx *Context, id, importer string) (*ResolveResult, error)
func (*PluginBase) Transform ¶
func (p *PluginBase) Transform(ctx *Context, code, id string) (*TransformResult, error)
type PluginContainer ¶
type PluginContainer struct {
// contains filtered or unexported fields
}
func NewPluginContainer ¶
func NewPluginContainer(plugins ...Plugin) *PluginContainer
func (*PluginContainer) HandleHotUpdate ¶
func (pc *PluginContainer) HandleHotUpdate(file string) error
func (*PluginContainer) Load ¶
func (pc *PluginContainer) Load(ctx *Context, id string) (*LoadResult, error)
func (*PluginContainer) OnStart ¶
func (pc *PluginContainer) OnStart() error
func (*PluginContainer) ResolveId ¶
func (pc *PluginContainer) ResolveId(ctx *Context, id, importer string) (string, error)
func (*PluginContainer) Transform ¶
func (pc *PluginContainer) Transform(ctx *Context, code string, id string) (*TransformResult, error)
type ResolveResult ¶
type RpcError ¶
type RpcError struct {
Code RpcErrorCode `json:"code"`
Message string `json:"message"`
Data any `json:"data"`
}
type RpcErrorCode ¶
type RpcErrorCode int
const ( RpcErrorCodeParseError RpcErrorCode = -32700 RpcErrorCodeInvalidRequest RpcErrorCode = -32600 RpcErrorCodeMethodNotFound RpcErrorCode = -32601 RpcErrorCodeInvalidParams RpcErrorCode = -32602 RpcErrorCodeInternalError RpcErrorCode = -32603 RpcErrorCodeServerError RpcErrorCode = -32000 )
type RpcMethod ¶
type RpcMethod struct {
Name string
Handler func(RpcRequest) RpcResponse
}
type RpcRequest ¶
type RpcResponse ¶
type ServerConfig ¶
type TransformResult ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.