withastro / roadmap

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

Integration hooks for middleware #735

Closed matthewp closed 9 months ago

matthewp commented 10 months ago

Summary

Add the ability for integrations to define middleware on behalf of the application developer.

Links

natemoo-re commented 10 months ago

Very excited for this one! Proposed API looks good. Any thoughts on using enforce instead of order to match Vite's existing naming convention?

matthewp commented 10 months ago

@natemoo-re Yeah, could do that. I went with order to match Rollup actually: https://rollupjs.org/plugin-development/#build-hooks but I'm fine with either one. ccing @bluwy the naming expert. Will also put this in the alternatives section.

natemoo-re commented 10 months ago

Ah good call. I wasn't aware that Rollup went with a different name. Does Vite plan to move towards order?

ematipico commented 10 months ago

Overall, this is a good addition, and I like it very much. Some concerns that I voiced already in private, it would be great if we could at least add some logging when an integration attempts to add a middleware. This can be a logger.debug (no need to flood the console).

bluwy commented 10 months ago

Ah good call. I wasn't aware that Rollup went with a different name. Does Vite plan to move towards order?

Yeah Vite would move towards order eventually, but it's a big breaking change at the moment. I'd also recommend following Rollup's convention.

And the proposal looks good to me 👍

matthewp commented 10 months ago

I'm moving for a call for consensus on this RFC. This will be the final comment period (3 days); if there are no objections this will be merged and the feature can be released in a future release (likely 3.5)