Skip to content

Conversation

@florian-lefebvre
Copy link
Member

Changes

  • There was a regression in feat(fonts): resolve config todos #13401 that made impossible to provide an object without a provider for a family
  • This PR moves some things around to have types working properly

Testing

Updates the types tests

Docs

N/A

@florian-lefebvre florian-lefebvre self-assigned this Mar 20, 2025
@changeset-bot
Copy link

changeset-bot bot commented Mar 20, 2025

⚠️ No Changeset found

Latest commit: 206febb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 20, 2025
Comment on lines +624 to +627
commonFontFamilySchema.transform((family) => ({
provider: GOOGLE_PROVIDER_NAME,
...family,
})),
Copy link
Member

Choose a reason for hiding this comment

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

I would avoid a transform inside for our configuration. I used .transform in the past, which is the side effect of passing the transformed configuration to the integrations. This means they will have incorrect types, and they might be able to delete our defaults.

I experienced this inconvenience when I implemented i18n. I suggest injecting these defaults after the integrations run their hooks.

Copy link
Member Author

@florian-lefebvre florian-lefebvre Mar 20, 2025

Choose a reason for hiding this comment

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

Does that also mean the transforms don't run after updateConfig() is called? That would be bad indeed

Copy link
Member

Choose a reason for hiding this comment

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

Yes. For v5, I wanted to break this, provide the unparsed/unvalidated configuration to the integrations, and eventually run Zod parsing afterward.

Unfortunately the architecture of Astro doesn't allow it, Astro requires the transformed/parsed values before it could run the integration hooks.

@florian-lefebvre florian-lefebvre marked this pull request as draft March 21, 2025 12:10
@florian-lefebvre florian-lefebvre marked this pull request as ready for review March 26, 2025 07:53
@florian-lefebvre
Copy link
Member Author

I'm going to merge this anyways, because the issue is about how Astro validates some things currently. #13482 will address this problem

@florian-lefebvre florian-lefebvre merged commit 3fcdba0 into feat/fonts Mar 26, 2025
14 checks passed
@florian-lefebvre florian-lefebvre deleted the fix/fonts-family-with-inferred-provider branch March 26, 2025 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants