plugin

package
v0.0.1-alpha.22 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginInstallStart            = "plugin/install_start"
	PluginDevInstallEventStart    = "plugin/dev_install_start"
	PluginDevInstallEventError    = "plugin/dev_install_error"
	PluginDevInstallEventComplete = "plugin/dev_install_complete"
	PluginReloadEventStart        = "plugin/dev_reload_start"
	PluginReloadEventError        = "plugin/dev_reload_error"
	PluginReloadEventComplete     = "plugin/dev_reload_complete"
)
View Source
const (
	MaxPluginSize              = 1024 * 1024 * 1024 // 1GB
	PluginUpdateStartedEvent   = "plugin/update_started"
	PluginInstallStartedEvent  = "plugin/install_started"
	PluginInstallFinishedEvent = "plugin/install_finished"
	PluginInstallErrorEvent    = "plugin/install_error"
)
View Source
const (
	DedupInterval = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

func Copy

func Copy(srcFile, dstFile string) error

func CopyDir

func CopyDir(dst, src string) error

CopyDir copies the content of src to dst. src should be a full path.

func CopyDirectory

func CopyDirectory(scrDir, dest string) error
func CopySymLink(source, dest string) error

func CreateIfNotExists

func CreateIfNotExists(dir string, perm os.FileMode) error

func Exists

func Exists(filePath string) bool

func FindGoBinary

func FindGoBinary() (string, error)

FindGoBinary looks for the Go binary in a number of well-known paths in case it's not available in the PATH.

func FindNodeBinary

func FindNodeBinary() (string, error)

FindNodeBinary tries to locate the Node.js binary across common install paths.

func FindPnpmBinary

func FindPnpmBinary() (string, error)

FindPnpmBinary looks for the Pnpm binary in a number of well-known paths in case it's not available in the PATH.

func HydrateBuildOpts

func HydrateBuildOpts(opts *types.BuildOpts) error

HydrateBuildOpts adds the additional build options if they are not specified

func PrepareCommandWithBinaries

func PrepareCommandWithBinaries(
	command string,
	args []string,
	binaries ...string,
) (*exec.Cmd, error)

PrepareCommandWithBinaries returns an exec.Cmd with extended PATH to include the directories of provided binary paths.

Types

type LoadPluginOptions

type LoadPluginOptions struct {
	DevMode       bool
	DevModePath   string
	ExistingState *plugintypes.PluginState
}

type Manager

type Manager interface {
	// Initialize discovers and loads all plugins that are currently installed in the plugin directory,
	// and initializes them with the appropriate controllers.
	Initialize(ctx context.Context) error

	// Run starts until the the passed in context is cancelled
	Run(ctx context.Context)

	// Shutdown stops the plugin manager and all plugins.
	Shutdown()

	// InstallInDevMode installs a plugin from the given path, and sets up a watcher to recompile and reload the plugin
	// when changes are detected. Will prompt the user for a path.
	InstallInDevMode() (*config.PluginMeta, error)

	// InstallFromPathPrompt installs a plugin from the given path, prompting the user for the location
	// with a window dialog.
	InstallFromPathPrompt() (*config.PluginMeta, error)

	// InstallPluginFromPath installs a plugin from the given path. It will validate the plugin
	// and then load it into the manager.
	InstallPluginFromPath(path string) (*config.PluginMeta, error)

	// InstallPluginVersion installs a plugin with a specified version from the plugin registry.
	// It returns an error if it does not exist.
	InstallPluginVersion(pluginID string, version string) (*config.PluginMeta, error)

	// LoadPlugin loads a plugin at the given path. It will validate the plugin
	// and then load it into the manager.
	LoadPlugin(id string, opts *LoadPluginOptions) (types.Plugin, error)

	// ReloadPlugin reloads a plugin at the given path. It will validate the plugin
	// and then load it into the manager.
	ReloadPlugin(id string) (types.Plugin, error)

	// UninstallPlugin uninstalls a plugin from the manager, and removes it from the filesystem.
	UninstallPlugin(id string) (types.Plugin, error)

	// GetPlugin returns the plugin with the given plugin ID.
	GetPlugin(id string) (types.Plugin, error)

	// ListPlugins returns a list of all plugins that are currently registered with the manager.
	ListPlugins() []types.Plugin

	// ListAvailablePlugins returns a list of all plugins that are available and suppported for the
	// users IDE environment.
	ListAvailablePlugins() ([]registry.Plugin, error)

	// GetPluginMeta returns the plugin metadata for the given plugin ID.
	GetPluginMeta(id string) (config.PluginMeta, error)

	// ListPlugins returns a list of all plugins that are currently registered with the manager.
	ListPluginMetas() []config.PluginMeta
}

Manager manages the lifecycle and registration of plugins. It is responsible for registering and unregistering plugins, and communicating with the plugin controllers to handle the lifecycle of the plugins.

func NewManager

func NewManager(
	logger *zap.SugaredLogger,
	resourceController resource.Controller,
	settingsController settings.Controller,
	execController pluginexec.Controller,
	networkerController networker.Controller,
	managers map[string]plugintypes.PluginManager,
	settingsProvider pkgsettings.Provider,
	registryClient *registry.RegistryClient,
) Manager

NewManager returns a new plugin manager for the IDE to use to manager installed plugins.

type PluginBuilder

type PluginBuilder struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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