Closed Fryuni closed 2 months ago
Latest commit: 13e2244f7e53d32c56f4240861abb9ed3e9bd038
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Additionally, there is another change in here to @astrojs/db that will need a corresponding docs update, as this type being removed is currently documented.
It is not documented Sarah, AstroDbIntegration
is nowhere in the docs. The defineDbIntegration
utility is documented and that is why I kept it around.
@Fryuni Sorry, I thought I checked closely, but I was concerned about this example which you're right, is not the type itself. As long as this example doesn't need updating, then no docs are needed, you're correct!
Just pinging @Fryuni to look at my changeset suggestions! The Docs PR has already been approved and is ready for next week, so this is just tiny details now! :raised_hands:
Changes
astro
AstroIntegration['hooks']
type into a globalAstro.IntegrationHooks
interface to allow for third-party extensions.As discussed on Discord, this breaks only a very narrow use case that wasn't documented as being supported and relied on the hooks not being extensible in order to create an extension workaround on top of it. So it is not being considered as a breaking change.
@astrojs/db
AstroDbIntegration
type (BREAKING)defineDbIntegration
just so people don't have to change their code for that, it is no longer neededTesting
This doesn't change any runtime behavior
Docs
We can now document how integrations can add their own hooks 😄
Future scope
This PR only allows integrations to declare the types for their hooks; it doesn't provide any higher-level mechanism to trigger those hooks. Triggering them is already possible with the following code:
In the future, we might provide some way for integrations to trigger their hooks with less boilerplate