Skip to content

Breaking changes

Features get added and removed, and breaking changes are introduced! This documents how to migrate.

0.7.0

Updated options and optionsSchema

They’re not optional by default, you need to manually add .optional() at the end of your zod schema. If it’s optional, users can still pass nothing or undefined.

defineIntegration({
// ...
optionsSchema: z.object({ foo: z.string() }),
optionsSchema: z.object({ foo: z.string() }).optional(),
})

Plugins types

Plugin generics have been simplified, allowing simpler plugin builds. This should be non-breaking for plugin relying on type inference, plugins with explicitly declared signature should update the following:

type SomePlugin = Plugin<
"utilityName",
"astro:config:setup",
(p: HookParams) => (params: UtilityParams) => UtilityOutput
(params: UtilityParams) => UtilityOutput
>;
export const somePlugin: SomePlugin = definePlugin();

0.6.0


Updated addVitePlugin

The addVitePlugin utility now requires a config and logger parameter to log warnings for duplicate plugins

"astro:config:setup": ({ config, updateConfig }) => {
addVitePlugin({
plugin,
config,
logger
updateConfig
})
}

Or you can turn off warnings for duplicate plugins using warnDuplicate: false

addVitePlugin({
warnDuplicate: false,
plugin,
updateConfig
})

Updated addVirtualImports

The addVirtualImports utility now requires a config parameter

"astro:config:setup": ({ config, updateConfig }) => {
addVirtualImports({
updateConfig,
config
name: 'my-integration',
imports: {
'virtual:my-integration/config': `export default ${JSON.stringify({ foo: "bar" })}`,
},
})
}

Updated addDevToolbarFrameworkApp

The addDevToolbarFrameworkApp utility now requires a config parameter

"astro:config:setup": ({ config, updateConfig }) => {
addDevToolbarFrameworkApp({
config,
framework: "vue",
name: "Test Vue Plugin",
id: "my-vue-plugin",
icon: `<svg>...</svg>`,
src: resolve("./my-plugin.vue"),
style: `
h1 {
font-family: Inter;
}
`,
})
}

0.5.0


Updated addVirtualImport

addVirtualImport was removed in 0.5.0. Here is how to migrate:

my-integration/index.ts
import { defineIntegration } from "astro-integration-kit";
import { addVirtualImportPlugin } from "astro-integration-kit/plugins";
import { addVirtualImportsPlugin } from "astro-integration-kit/plugins";
export default defineIntegration({
name: "my-integration",
plugins: [addVirtualImportPlugin],
plugins: [addVirtualImportsPlugin],
setup() {
return {
"astro:config:setup": ({ addVirtualImport }) => {
"astro:config:setup": ({ addVirtualImports }) => {
addVirtualImport({
name: 'virtual:my-integration/config',
content: `export default ${JSON.stringify({ foo: "bar" })}`,
})
addVirtualImport({
name: 'virtual:my-integration/context',
content: `export default ${JSON.stringify({ entrypoint: import.meta.url })}`,
})
addVirtualImports({
'virtual:my-integration/config': `export default ${JSON.stringify({ foo: "bar" })}`,
'virtual:my-integration/context': `export default ${JSON.stringify({ entrypoint: import.meta.url })}`
})
}
}
}
})

0.2.0


Removed defineOptions

defineOptions has been removed in 0.2.0. Here is how to migrate:

my-integration/index.ts
import { defineIntegration, defineOptions } from "astro-integration-kit";
import { defineIntegration } from "astro-integration-kit";
import { z } from "astro/zod";
type Options = {
/**
* A comment
*
* @default `"bar"`
*/
foo?: string | undefined;
}
export default defineIntegration({
// ...
options: defineOptions<Options>({ foo: "bar" }),
optionsSchema: z.object({
/**
* A comment
*
* @default `"bar"`
*/
foo: z.string().optional().default("bar"),
}),
})