modules

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 5 Imported by: 0

README

admin/internal/modules

Module ordering and loading for admin features.

Purpose

  • Provide a small module runtime to load manifests in a stable order.
  • Keep module loading logic out of admin.Admin and avoid peer-to-peer feature imports.

Key Files

  • types.go: Module/manifest contracts.
  • load.go: Loader implementation and ordering rules.

Dependencies

  • Should depend only on stdlib and small callback interfaces.
  • Must not import other admin/internal/* packages.

Where To Change X

  • Module ordering rules: load.go.
  • Module contracts/manifests: types.go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context, opts LoadOptions) error

Load registers modules after validating dependencies, feature flags, and ordering.

Types

type DisabledErrorFactory

type DisabledErrorFactory func(feature, moduleID string) error

DisabledErrorFactory builds feature-disabled errors for modules.

type FeatureGates

type FeatureGates = fggate.FeatureGate

FeatureGates evaluates feature enablement.

type IconContributor added in v0.25.0

type IconContributor interface {
	IconLibraries() []IconLibrary
	IconDefinitions() []IconDefinition
}

IconContributor optionally lets a module contribute icon libraries and definitions.

type IconDefinition added in v0.25.0

type IconDefinition struct {
	ID       string
	Name     string
	Label    string
	Type     string
	Library  string
	Content  string
	Keywords []string
	Category string
	Trusted  bool
}

IconDefinition represents a single icon contribution from a module.

type IconDefinitionFunc added in v0.25.0

type IconDefinitionFunc func(icon IconDefinition) error

IconDefinitionFunc forwards contributed icon definitions to the host.

type IconLibrary added in v0.25.0

type IconLibrary struct {
	ID          string
	Name        string
	Description string
	CDN         string
	CSSClass    string
	RenderMode  string
	Priority    int
	Trusted     bool
}

IconLibrary represents an icon library contribution from a module.

type IconLibraryFunc added in v0.25.0

type IconLibraryFunc func(lib IconLibrary) error

IconLibraryFunc forwards contributed icon libraries to the host.

type LoadOptions

type LoadOptions struct {
	Modules           []Module
	Gates             FeatureGates
	DefaultLocale     string
	Translator        Translator
	DisabledError     DisabledErrorFactory
	Register          RegisterFunc
	AddMenuItems      MenuItemsFunc
	AddIconLibrary    IconLibraryFunc
	AddIconDefinition IconDefinitionFunc
	RegisterDefaults  func() error
}

LoadOptions configures module loading.

type Manifest

type Manifest struct {
	ID             string
	NameKey        string
	DescriptionKey string
	Dependencies   []string
	FeatureFlags   []string
}

Manifest captures identifying metadata and dependencies for a module.

type MenuContributor interface {
	MenuItems(locale string) []navinternal.MenuItem
}

MenuContributor optionally lets a module contribute navigation items.

type MenuItemsFunc func(ctx context.Context, items []navinternal.MenuItem) error

MenuItemsFunc forwards contributed menu items to the host.

type Module

type Module interface {
	Manifest() Manifest
}

Module exposes manifest metadata used for ordering and validation.

func Order

func Order(modules []Module) ([]Module, error)

Order performs a deterministic topological sort based on declared dependencies.

type RegisterFunc

type RegisterFunc func(Module) error

RegisterFunc executes module registration using host-provided context.

type Translator

type Translator = helpers.Translator

Translator resolves i18n keys into localized strings.

type TranslatorAware

type TranslatorAware interface {
	WithTranslator(Translator)
}

TranslatorAware receives a translator before registration.

Jump to

Keyboard shortcuts

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