-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(next): astro:routes:resolved #12329
Conversation
🦋 Changeset detectedLatest commit: cd62268 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
I read the previous PR, and I couldn't find anything regarding |
/** | ||
* Source component URL | ||
*/ | ||
entrypoint: RouteData['component']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we change the internal naming? Wouldn't it create fragmentation? Also, we shifted into a pattern where "entrypoint" is URL
or string
, where the string
is an absolute file path. In this case, these are string
, and they are relative paths. I think we should keep component
, so they are not misunderstood like the other "entrypoints" we have in other APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I proposed changing the "component" name for the new public API because the value here is not necessarily a component. This is already true of RouteData['component']
, the name is misleading.
I'm not sure whether entrypoint
is the best name either. It can be:
- A relative path when the route is a redirect
- The absolute path to an Astro component when the route is a page
- The import path (before resolving dependencies) of an Astro component when the route is a page
- The absolute path to a JS file when the route is an API
- The import path (before resolving dependencies) of a JS file when the route is an API
It is quite an overloaded field, so I think it needs a more generic name than "component".
Some options and my thoughts about them:
source
: would be misleading for redirect since it is where it redirects to and not fromdefinition
: I don't think it really fits with redirectimplementation
: also doesn't fit with redirecttarget
: seems weird to say an Astro component is the target of a page but could workreference
: in the sense of a "reference implementation" for the page or API and the reference link for the redirect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about origin
or creator
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @Fryuni
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, they feel weird for redirects because it is where you'd redirect to not from. Both would imply from to me.
I don't have any particularly strong feelings against any of the names Ema and I proposed, nor with component
. I don't think this is worth blocking progress if it comes to it. It is just that none of them matches all 3 cases that can exist for this field. component
is just worse than the alternatives for me since it directly implies one of the options when there are another 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we can agree there isn't a perfect name, so we need to be good at documenting :)
I also don't have particularly strong feelings about a particular name
Co-authored-by: Luiz Ferraz <[email protected]>
*/ | ||
redirectRoute?: IntegrationRouteData; | ||
}; | ||
|
||
export interface IntegrationResolvedRoute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The discussion was marked as resolved because of commits, but we need to figure out the renaming of some fields
Co-authored-by: Emanuele Stoppa <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the idea looks good to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay @florian-lefebvre , what a kick-butt changeset! 💪
Just the tiniest of language edits for your consideration!
Co-authored-by: Sarah Rainsberger <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary block to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Changes
astro:routes:resolved
hook, that runs beforeastro:config:done
and on any route change on devIntegrationRouteData
to integrations #11864, we talked about bigger refactorings but left the shape similar for backward compatibility. With this PR, we can do whatever we want with the shape!Testing
Adds a test for dev
Docs
withastro/docs#10077