withastro / roadmap

Ideas, suggestions, and formal RFC proposals for the Astro project.
290 stars 29 forks source link

Integration hooks for middleware #709

Closed matthewp closed 9 months ago

matthewp commented 11 months ago

Summary

A brief, one or two sentence explanation of the proposal.

Add an API to integrations which allows them to define middleware so that users do not need to go through the boilerplate of creating a middleware file and importing the functionality.

Background & Motivation

When we built the middleware API we anticipated a need for integrations to hook into it, but we decided not to make that a goal for v1 due to the complexity of ordering. Yet the need keeps coming up for the same reasons as before, integrations want to transparently add middleware.

Goals

Non-Goals

jlarmstrongiv commented 11 months ago

Great! I currently generate the middleware file if it doesn’t exist. It would mean users no longer have to set up their own middleware and sequence either. Looking forward to this update 👍

florian-lefebvre commented 9 months ago

@matthewp can this issue be closed?

matthewp commented 9 months ago

Yes it can, thanks for the reminder!

jlarmstrongiv commented 9 months ago

Thank you @matthewp I just updated astro-i18n-aut to use the new integration hooks—it works great 🎉