Getting Started
Most projects should start from the official template:
vdl-plugin-template
If you are setting up from scratch:
npm install --save-dev --save-exact @varavel/vdl-plugin-sdk@latest
Quick start
Create src/index.ts:
import { definePlugin } from "@varavel/vdl-plugin-sdk";
export const generate = definePlugin((input) => {
// Useful input fields:
console.log(input.version); // VDL version (without the "v" prefix)
console.log(input.options); // Plugin options from vdl.config.vdl
console.log(input.ir); // Typed VDL intermediate representation
return {
files: [
{
path: "hello.txt",
content: "Hello from VDL Plugin SDK",
},
],
};
});
Run:
npx vdl-plugin check
npx vdl-plugin build
check: type-checks plugin code.build: bundlessrc/index.tsintodist/index.js.
Typical plugin workflow
- Implement your plugin in
src/index.tswith@varavel/vdl-plugin-sdk. - Use helpers from
@varavel/vdl-plugin-sdk/utils/<category>as needed. - Add unit tests using
@varavel/vdl-plugin-sdk/testing. - Run
vdl-plugin checkduring development to ensure type safety. - Run
vdl-plugin buildto producedist/index.js. - Commit
dist/index.jsand publish a new release tag.
VDL consumes the built dist/index.js artifact, not your TypeScript source.
Example package.json scripts:
{
"scripts": {
"check": "vdl-plugin check",
"build": "vdl-plugin build"
}
}
Next steps
- Learn the entry points for runtime, utils, and testing imports.
- Learn the CLI options for custom entry and output paths.
- Browse the API reference when you need exact types and helpers.