Installing the dependency
npm i @inox-tools/aik-mod
yarn add @inox-tools/aik-mod
pnpm add @inox-tools/aik-mod
Getting Started
Add the plugin to your withPlugins
call:
import { defineIntegration, withPlugins } from ' astro-integration-kit ' ;
import aikMod from ' @inox-tools/aik-mod ' ;
export default defineIntegration ({
' astro:config:setup ' : ( { defineMiddleware } ) => {
defineMiddleware ( ' pre ' , ( context , next ) => {
// Your inline middleware
API
The plugin exposes multiple entrypoints, all of them accept normal values, factory wrappers and lazy values as values to be included in the virtual modules.
inlineModule
inlineModule
allows you to define a module inline, returning the name of the defined module.
It receives the definition of the virtual module .
import { defineIntegration, withPlugins } from ' astro-integration-kit ' ;
import aikMod from ' @inox-tools/aik-mod ' ;
export default defineIntegration ({
' astro:config:setup ' : ( { inlineModule } ) => {
const moduleName = inlineModule ( {
defaultExport: ' some value ' ,
defineModule
defineModule
allows you to define a module inline with a given import name.
It receives the definition of the virtual module .
import { defineIntegration, withPlugins } from ' astro-integration-kit ' ;
import aikMod from ' @inox-tools/aik-mod ' ;
export default defineIntegration ({
' astro:config:setup ' : ( { defineModule } ) => {
defineModule ( ' virtual:my-integration/module ' , {
defaultExport: ' some value ' ,
defineMiddleware
defineMiddleware
allows you to define an Astro middleware inline.
import { defineIntegration, withPlugins } from ' astro-integration-kit ' ;
import aikMod from ' @inox-tools/aik-mod ' ;
export default defineIntegration ({
' astro:config:setup ' : ( { defineMiddleware } ) => {
defineMiddleware ( ' pre ' , ( context , next ) => {
// This runs in the Astro middleware