astro: namespace for middleware and components#8101
Conversation
🦋 Changeset detectedLatest commit: fdbf0c4 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 |
|
It's a side quest not really related to this, but someone (me, probably) should make it so imports starting with |
ematipico
left a comment
There was a problem hiding this comment.
About astro:middleware VS astro/middleware, here's some concerns we should take into account (even in the language tools cc @Princesseuh )
At the moment, astro/middleware exposes the following APIs: createContext, trySerializeLocals, defineMiddleware and sequence.
defineMiddleware and sequence can be part of astro:middleware, but createContext, trySerializeLocals can't be part of astro:middleware, because are runtime APIs that expose code that will be used by integrations for advanced features (e.g. edge middleware).
I wonder:
- is it possible to exclude
createContext,trySerializeLocalsfromastro:middleware? - is it possible to exclude
defineMiddlewareandsequencefromastro/middleware? - is it possible to suggest the correct import based on the context? Probably yes, because the middleware is a known file with fixed location and name.
| --- | ||
|
|
||
|
|
||
| `astro:`namespace aliases for middleware and components |
There was a problem hiding this comment.
| `astro:`namespace aliases for middleware and components | |
| `astro:` namespace aliases for middleware and components |
Couldn't |
|
It's easy enough to create another module to use as the alias so I'll do that. |
As long as the functions are correctly bundled by |
Changes
astro:middlewareandastro:componentsTesting
Docs