florian-lefebvre / astro-integration-kit

A package that contains utilities to help you build Astro integrations.
https://astro-integration-kit.netlify.app
MIT License
56 stars 8 forks source link

fix: Allow plugins to initalize themselves on unused hooks #114

Closed Fryuni closed 3 months ago

Fryuni commented 3 months ago

If a plugin requires information from one specific hook to work (like requiring the ssr manifest from astro:build:ssr to provide an API for astro:build:done) but the integration using the plugin doesn't use that hook, the plugin would not be properly initialized as it would never be called for that hook.

This change makes withPlugins such that it defines hooks for all plugin hooks that just call the plugins to create the API and immediately return.

The added tests are for the other behaviors that haven't been tested till now. The last test of the file is for this fix.

netlify[bot] commented 3 months ago

Deploy Preview for astro-integration-kit ready!

Name Link
Latest commit 1cafd8087e96e779f2c0b906720cac1365b895c0
Latest deploy log https://app.netlify.com/sites/astro-integration-kit/deploys/6674ad61608119000816ddb5
Deploy Preview https://deploy-preview-114--astro-integration-kit.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.