@luna-oss/plugin-sdk
v5.0.0
Published
Typed plugin contract for extending the Moon Design System with custom components and tokens.
Readme
@luna-oss/plugin-sdk
Typed plugin contract for the Moon Design System. Plugins extend Moon with custom components, tokens, and recipes that load at runtime and pass through the same registry pipeline as core components.
Plugin shape
import { definePlugin, defineComponent, defineToken } from "@luna-oss/plugin-sdk";
export default definePlugin({
id: "acme.controls",
name: "Acme Controls",
version: "1.0.0",
components: [
defineComponent({
name: "acme.Slider",
title: "Slider",
category: "Inputs",
render: (props) => ({ type: "acme-slider", props })
})
],
tokens: [
defineToken({
id: "acme.color.brand",
category: "color",
value: "#5b6cff"
})
]
});Lifecycle
setup(context)runs when the host loads the plugin.teardown(context)runs when the host unloads the plugin.
The host provides a PluginContext with the active environment (web,
figma, mcp, node) and a logger.
Contributions
components— array ofComponentDefinitionentries. Each contributes a catalog-visible component with an optional props schema.tokens— array ofTokenDefinitionentries. Tokens are merged into the active token graph and override built-ins when ids collide.
Stability
The plugin contract is versioned alongside the design system. Breaking changes
will only land at major versions and ship with a codemod in
@luna-oss/codemod.
