definePlugin
Import from @varavel/vdl-plugin-sdk.
function definePlugin(handler): VdlPluginHandler;
Wraps a plugin handler so it can be exported as the canonical VDL entry point.
definePlugin wraps your implementation with a global safety net.
Any thrown error is converted into the PluginOutput diagnostic contract,
so VDL can report failures cleanly instead of crashing with a raw stack trace.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | VdlPluginHandler | The plugin implementation to expose as the runtime entry point. |
Returns
A safe handler that always returns PluginOutput.
Example
import { definePlugin } from "@varavel/vdl-plugin-sdk";
export const generate = definePlugin((input) => {
return {
files: [
{
path: "schema-summary.txt",
content: `VDL ${input.version}`,
},
],
};
});