Skip to content
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

Merged
merged 29 commits into from
Nov 21, 2024
Merged

feat(next): astro:routes:resolved #12329

merged 29 commits into from
Nov 21, 2024

Conversation

florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Oct 28, 2024

Changes

Testing

Adds a test for dev

Docs

withastro/docs#10077

Copy link

changeset-bot bot commented Oct 28, 2024

🦋 Changeset detected

Latest 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

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) docs pr labels Oct 28, 2024
@github-actions github-actions bot added the semver: minor Change triggers a `minor` release label Oct 29, 2024
Copy link
Contributor

@github-actions github-actions bot left a 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.

@florian-lefebvre florian-lefebvre marked this pull request as ready for review October 29, 2024 14:06
packages/astro/src/types/public/integrations.ts Outdated Show resolved Hide resolved
packages/astro/src/types/public/integrations.ts Outdated Show resolved Hide resolved
packages/astro/src/vite-plugin-astro-server/plugin.ts Outdated Show resolved Hide resolved
packages/astro/src/types/public/integrations.ts Outdated Show resolved Hide resolved
@ematipico
Copy link
Member

@florian-lefebvre

I read the previous PR, and I couldn't find anything regarding origin. Could you please provide a reasoning about why it was added? Maybe in the description PR

packages/astro/src/types/public/internal.ts Outdated Show resolved Hide resolved
packages/astro/src/types/public/internal.ts Show resolved Hide resolved
.changeset/giant-ravens-look.md Outdated Show resolved Hide resolved
packages/astro/src/types/public/integrations.ts Outdated Show resolved Hide resolved
Comment on lines 265 to 268
/**
* Source component URL
*/
entrypoint: RouteData['component'];
Copy link
Member

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.

Copy link
Member

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 from
  • definition: I don't think it really fits with redirect
  • implementation: also doesn't fit with redirect
  • target: seems weird to say an Astro component is the target of a page but could work
  • reference: in the sense of a "reference implementation" for the page or API and the reference link for the redirect

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Fryuni

Copy link
Member

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.

Copy link
Member

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

packages/astro/src/types/public/integrations.ts Outdated Show resolved Hide resolved
packages/astro/src/types/public/integrations.ts Outdated Show resolved Hide resolved
packages/astro/src/types/public/integrations.ts Outdated Show resolved Hide resolved
packages/astro/src/vite-plugin-astro-server/plugin.ts Outdated Show resolved Hide resolved
*/
redirectRoute?: IntegrationRouteData;
};

export interface IntegrationResolvedRoute
Copy link
Member Author

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

Copy link
Member

@bluwy bluwy left a 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 👍

Copy link
Member

@sarah11918 sarah11918 left a 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!

.changeset/giant-ravens-look.md Outdated Show resolved Hide resolved
.changeset/giant-ravens-look.md Outdated Show resolved Hide resolved
Copy link
Contributor

@matthewp matthewp left a 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.

Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@florian-lefebvre florian-lefebvre merged commit 8309c61 into next Nov 21, 2024
14 checks passed
@florian-lefebvre florian-lefebvre deleted the feat/routes-resolved branch November 21, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs pr pkg: astro Related to the core `astro` package (scope) semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants