Klenodexempel

Docs

Plugin Reference

Built-in plugins cover Ruby, Haml, Markdown, CSS, JavaScript, assets, data imports, routing, and Google Fonts.

Default Plugin Set

Klenod::Build::Context.default_plugins includes RubyPlugin, IntlPlugin, HamlPlugin, MarkdownPlugin, CSSPlugin, JavaScriptPlugin, SvgPlugin, ImagePlugin, JsonPlugin, YamlPlugin, TomlPlugin, and TextPlugin.

RouterPlugin and GoogleFontsPlugin are built in but opt-in. Applications can configure either one explicitly when they need routing or Google Fonts imports.

Hook Phases

Plugins can implement:

  • resolve(dependency, context) to map an import specifier to a module id.
  • load(module_id, context) to provide source for virtual or custom modules.
  • transform(module_id, code, context) to rewrite source and record dependencies, assets, metadata, source maps, and watched patterns.
  • finalize(module_id, result, resolved_dependencies, dependency_records, context) to adjust a transform after eager dependency records are collected.
  • import_value(resolved_dependency, record, context) to provide development-time import values.
  • runtime_import_value(resolved_dependency, record, context) to provide serialized bundle import values.

resolve, load, transform, and finalize are collection-time hooks. They must not depend on evaluated app exports. runtime_import_value must return serializable values or runtime instructions.

Core Plugins

Opt-In Plugins