Skip to content

Custom Plugins

You can extend Pencel with custom plugins to add project-specific transformations, code generation, or integration with external tools.

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
}
]
});

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

For advanced plugin development, see the compiler architecture documentation and study the built-in plugins in the Pencel repository.