Custom Plugins
You can extend Pencel with custom plugins to add project-specific transformations, code generation, or integration with external tools.
Creating a Custom Plugin
Section titled “Creating a Custom Plugin”Custom plugins are configured as objects in your pencel.config.ts:
import { defineConfig } from '@pencel/core';
export default defineConfig({ plugins: [ { name: 'my-custom-plugin', // Plugin implementation goes here } ]});Plugin Lifecycle
Section titled “Plugin Lifecycle”Plugins hook into the compiler at specific points:
- setup – Called when the plugin is initialized
- generate – Called to generate global files from the complete IR
- derive – Called to generate per-source outputs (framework adapters)
- teardown – Called when compilation completes
Next Steps
Section titled “Next Steps”For advanced plugin development, see the compiler architecture documentation and study the built-in plugins in the Pencel repository.