Installation & Usage
Astro Integration Kit provides a suite of useful utilities to help you build your integrations. Some of them are global, others are meant to be used in hooks and plugins are available for more advanced use cases. Each utility is fully documented with examples and options!
Installation
Section titled “Installation”Add astro-integration-kit
using your favorite package manager:
pnpm add astro-integration-kit
npm install astro-integration-kit
yarn add astro-integration-kit
Example
Section titled “Example”Here we are using the addVitePlugin utility to add a TypeScript declaration file to the user’s project! This is useful for typing things like Virtual Modules!
import { z } from "astro/zod";import { defineIntegration, addVitePlugin } from "astro-integration-kit";import vitePlugin from "vite-plugin";
export default defineIntegration({ name: "my-integration", optionsSchema: z.object({ pluginOptions: z.object({}).optional(), }), setup({ options }) { return { hooks: { "astro:config:setup": (params) => { addVitePlugin(params, { plugin: vitePlugin(options.pluginOptions), }); }, }, }; },});