Breaking changes
Features get added and removed, and breaking changes are introduced! This documents how to migrate.
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:
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 })}` }) } } }})
import type { AstroIntegration } from "astro";import { addVirtualImport } from "astro-integration-kit/utilities";import { addVirtualImports } from "astro-integration-kit/utilities";
export default function myIntegration(): AstroIntegration { return { name: "my-integration", hooks: { "astro:config:setup": ({ config, updateConfig }) => { addVirtualImport({ updateConfig, config, name: 'virtual:my-integration/config', content: `export default ${JSON.stringify({ foo: "bar" })}`, }) addVirtualImport({ updateConfig, config, name: 'virtual:my-integration/context', content: `export default ${JSON.stringify({ entrypoint: import.meta.url })}`, }) addVirtualImports({ updateConfig, config, name: 'my-integration', imports: { '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:
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"), }),})