Features get added and removed, and breaking changes are introduced! This documents how to migrate.
0.16.0
Improved type inference for defineUtility
Previously the defineUtility signature would emit a type that required naming internal Astro types in some cases, which caused error TS2742 about non-portable types. This type was improved to emit small and portable types through a new public HookUtility type exported from astro-integration-kit.
The generic arguments of defineUtility haven’t changed, no action is necessary for you code to benefit from this change.
As an example, an utility defined with the following code:
Was previously emitted as:
Now it is emitted as:
Improved emitted types for defineIntegration
Previously the defineUtility signature would emit a type that required naming internal Astro types in some cases, which caused error TS2742 about non-portable types. This type was improved to not emit the portion of the type that would be discarded by its own construction.
To achieve this with newer versions of TS (>=5.5), the generic parameters had to be updated. If you were passing type parameters explicitly instead of relying on type inference you should either remove the parameters or adapt your types to the new parameter requirements.
As an example, an integration defined with the following code:
Was previously emitted as:
Now it is emitted as:
0.15.0
Native hook types
With the new minimal version of Astro, there is no longer any need for the previous workaround to support non-native hooks, like those from @astrojs/db. The following changes are needed to replace the previous Astro Integration Kit types with the native types:
Hook type extensions
Hook parameters
@astrojs/db hooks:
If you are using @astrojs/db values and types in your project, you can just remove import. Importing anything from the library also loads the types.
0.13.0
Plugin type simplified
The new Plugin signature added back in 0.9.0 returned the need for emitted declarations to include the full type for hook parameters from Astro (which was removed on 0.7.0).
This was added along with support for a plugin to define new utilities for multiple hooks at once.
Now, the Plugin generics have been simplified again to allow for such support without having to replicate Astro’s hook parameters types. Just like in 0.7.0, this should be non-breaking for any plugin relying on type inference but plugins with explicitly declared signatures need to update the following:
0.12.0
addDevToolbarFrameworkApp removed
The addDevToolbarFrameworkApp has been removed in favour of the Astro defineToolbarApp utility
added in Astro v4.7.0.
Previously the return of the setup function passed to defineIntegration was the Astro hooks defined by the integration, and would be set as the hooks property in the final integration object.
Now, the expected return of setup is the properties of the integration object itself:
0.10.0
watchIntegration renamed to watchDirectory
Since watchIntegration is not recommended for dev HMR anymore, it has been renamed according to what it
really does, watching a directory:
0.9.0
New withPlugins utility, plugins removed from defineIntegration
Plugins are no longer passed to defineIntegration. Instead, there’s a new withPlugins utility.
New Plugin signature (and definePlugin)
You should not use the Plugin type manually but if you do, you’ll need to update it:
The definePlugin signature has been updated as well:
0.8.0
Removed plugins
The following plugins have been removed in favor of their standalone utility version:
addDevToolbarFrameworkAppPlugin
addDtsPlugin
addIntegrationPlugin
addVirtualImportsPlugin
addVitePluginPlugin
hasIntegrationPlugin
injectDevRoutePlugin
watchIntegrationPlugin
Only hasVitePluginPlugin remains.
corePlugins removed
corePlugins is no longer exported from astro-integration-kit. Import the plugin you want directly:
Updated utilities
addDevToolbarFrameworkApp
addDts
addIntegration
addVirtualImports
addVitePlugin
hasVitePlugin
hasIntegration
injectDevRoute
watchIntegration
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.
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:
0.6.0
Updated addVitePlugin
The addVitePlugin utility now requires a config and logger parameter to log warnings for duplicate plugins
Or you can turn off warnings for duplicate plugins using warnDuplicate: false
Updated addVirtualImports
The addVirtualImports utility now requires a config parameter
Updated addDevToolbarFrameworkApp
The addDevToolbarFrameworkApp utility now requires a config parameter
0.5.0
Updated addVirtualImport
addVirtualImport was removed in 0.5.0. Here is how to migrate: