withastro / roadmap

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

Integration hooks for middleware #709

Closed matthewp closed 1 year ago

matthewp commented 1 year 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 1 year 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 1 year ago

@matthewp can this issue be closed?

matthewp commented 1 year ago

Yes it can, thanks for the reminder!

jlarmstrongiv commented 1 year ago

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