move module hash

This commit is contained in:
Will Browne
2026-01-14 15:38:46 +00:00
parent c1a46fdcb5
commit 6a955eb6d1
33 changed files with 668 additions and 123 deletions
+28
View File
@@ -0,0 +1,28 @@
package pluginassets
import (
"path"
"path/filepath"
"github.com/grafana/grafana/pkg/plugins"
)
var _ Provider = (*LocalProvider)(nil)
type LocalProvider struct{}
func NewLocalProvider() *LocalProvider {
return &LocalProvider{}
}
func (s *LocalProvider) Module(plugin PluginInfo) (string, error) {
if plugin.Class == plugins.ClassCore && filepath.Base(plugin.FS.Base()) != "dist" {
return path.Join("core:plugin", filepath.Base(plugin.FS.Base())), nil
}
return s.AssetPath(plugin, "module.js")
}
func (s *LocalProvider) AssetPath(plugin PluginInfo, assetPath ...string) (string, error) {
return path.Join("public/plugins", plugin.JsonData.ID, path.Join(assetPath...)), nil
}