UI plugin dependencies (#4307)

* Add requires field to UI plugin config
* Use defer instead of async for useScript
* Load plugins based on dependency
* Document new field
This commit is contained in:
WithoutPants
2023-11-27 13:41:04 +11:00
committed by GitHub
parent 910ff27730
commit 11be56cc42
8 changed files with 94 additions and 11 deletions

View File

@@ -72,6 +72,10 @@ type PluginCSP struct {
}
type UIConfig struct {
// Requires is a list of plugin IDs that this plugin depends on.
// These plugins will be loaded before this plugin.
Requires []string `yaml:"requires"`
// Content Security Policy configuration for the plugin.
CSP PluginCSP `yaml:"csp"`
@@ -239,6 +243,7 @@ func (c Config) toPlugin() *Plugin {
Tasks: c.getPluginTasks(false),
Hooks: c.getPluginHooks(false),
UI: PluginUI{
Requires: c.UI.Requires,
ExternalScript: c.UI.getExternalScripts(),
ExternalCSS: c.UI.getExternalCSS(),
Javascript: c.UI.getJavascriptFiles(c),

View File

@@ -42,6 +42,10 @@ type Plugin struct {
}
type PluginUI struct {
// Requires is a list of plugin IDs that this plugin depends on.
// These plugins will be loaded before this plugin.
Requires []string `json:"requires"`
// Content Security Policy configuration for the plugin.
CSP PluginCSP `json:"csp"`