Skip to content

feat(fonts)!: fontData instead of getFontData()#15200

Merged
florian-lefebvre merged 7 commits intomainfrom
feat/fonts-data-object
Jan 21, 2026
Merged

feat(fonts)!: fontData instead of getFontData()#15200
florian-lefebvre merged 7 commits intomainfrom
feat/fonts-data-object

Conversation

@florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Jan 14, 2026

Changes

Testing

Updated

Docs

@florian-lefebvre florian-lefebvre self-assigned this Jan 14, 2026
@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: 5dc87d2

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 Jan 14, 2026
@florian-lefebvre florian-lefebvre changed the title refactor(fonts): use runtime as entrypoint feat(fonts)!: fontData instead of getFontData() Jan 14, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

⚠️ Dependency Count

This PR adds 44 new dependencies (2042 → 2086), which exceeds the threshold of 10.

📊 Dependency Size Changes

Warning

This PR adds 7.2 MB of new dependencies, which exceeds the threshold of 100 kB.

📦 Package 📏 Size
[email protected] 2.7 MB
[email protected] 649.4 kB
[email protected] 448.9 kB
[email protected] 446.4 kB
@fastify/[email protected] 424.5 kB
[email protected] 399 kB
[email protected] 380.1 kB
[email protected] 181.1 kB
[email protected] 150.7 kB
@fastify/[email protected] 131.5 kB
@fastify/[email protected] 102.3 kB
@pinojs/[email protected] 97.4 kB
[email protected] 85.2 kB
[email protected] 73.4 kB
@fastify/[email protected] 71.9 kB
[email protected] 69.2 kB
[email protected] 63 kB
[email protected] 58.8 kB
@fastify/[email protected] 57.1 kB
[email protected] 56.8 kB
[email protected] 56.3 kB
[email protected] 54 kB
[email protected] 50.3 kB
[email protected] 49.6 kB
[email protected] 42.5 kB
[email protected] 39.7 kB
@fastify/[email protected] 37.8 kB
@fastify/[email protected] 36.9 kB
[email protected] 24.6 kB
@fastify/[email protected] 24.3 kB
[email protected] 23 kB
[email protected] 19.2 kB
[email protected] 19.1 kB
[email protected] 17.4 kB
[email protected] 16.5 kB
[email protected] 12.8 kB
@lukeed/[email protected] 9.4 kB
[email protected] 9.2 kB
[email protected] 9.2 kB
[email protected] 9.2 kB
[email protected] 6.6 kB
@fastify/[email protected] 5.7 kB
[email protected] 4.8 kB
[email protected] 2.3 kB

Total size change: 7.2 MB

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.

Changeset looks great @florian-lefebvre !

Base automatically changed from refactor/fonts-runtime-entrypoint-only to main January 19, 2026 13:12
@florian-lefebvre florian-lefebvre marked this pull request as ready for review January 19, 2026 13:28
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 19, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing feat/fonts-data-object (5dc87d2) with main (c390fb7)1

Summary

✅ 9 untouched benchmarks

Footnotes

  1. No successful run was found on main (8cbc86c) during the generation of this report, so c390fb7 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Was the RFC updated?

@florian-lefebvre
Copy link
Member Author

florian-lefebvre commented Jan 20, 2026

Good point, updating now. EDIT: Done

@florian-lefebvre florian-lefebvre merged commit c0595b3 into main Jan 21, 2026
25 of 26 checks passed
@florian-lefebvre florian-lefebvre deleted the feat/fonts-data-object branch January 21, 2026 12:59
@astrobot-houston astrobot-houston mentioned this pull request Jan 21, 2026
dadezzz pushed a commit to dadezzz/ice-notes that referenced this pull request Jan 25, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`5.16.11` → `5.16.12`](https://renovatebot.com/diffs/npm/astro/5.16.11/5.16.12) | ![age](https://developer.mend.io/api/mc/badges/age/npm/astro/5.16.12?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/astro/5.16.11/5.16.12?slim=true) |

---

### Release Notes

<details>
<summary>withastro/astro (astro)</summary>

### [`v5.16.12`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#51612)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.16.12)

##### Patch Changes

- [#&#8203;15175](withastro/astro#15175) [`47ae148`](withastro/astro@47ae148) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - Allows experimental Font providers to specify family options

  Previously, an Astro `FontProvider` could only accept options at the provider level when called. That could result in weird data structures for family-specific options.

  Astro `FontProvider`s can now declare family-specific options, by specifying a generic:

  ```diff
  // font-provider.ts
  import type { FontProvider } from "astro";
  import { retrieveFonts, type Fonts } from "./utils.js",

  interface Config {
    token: string;
  }

  +interface FamilyOptions {
  +    minimal?: boolean;
  +}

  -export function registryFontProvider(config: Config): FontProvider {
  +export function registryFontProvider(config: Config): FontProvider<FamilyOptions> {
    let data: Fonts = {}

    return {
      name: "registry",
      config,
      init: async () => {
        data = await retrieveFonts(token);
      },
      listFonts: () => {
        return Object.keys(data);
      },
  -    resolveFont: ({ familyName, ...rest }) => {
  +    // options is typed as FamilyOptions
  +    resolveFont: ({ familyName, options, ...rest }) => {
        const fonts = data[familyName];
        if (fonts) {
          return { fonts };
        }
        return undefined;
      },
    };
  }
  ```

  Once the font provider is registered in the Astro config, types are automatically inferred:

  ```diff
  // astro.config.ts
  import { defineConfig } from "astro/config";
  import { registryFontProvider } from "./font-provider";

  export default defineConfig({
      experimental: {
          fonts: [{
              provider: registryFontProvider({
                token: "..."
              }),
              name: "Custom",
              cssVariable: "--font-custom",
  +            options: {
  +                minimal: true
  +            }
          }]
      }
  });
  ```

- [#&#8203;15175](withastro/astro#15175) [`47ae148`](withastro/astro@47ae148) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only**

  Updates how options are passed to the Google and Google Icons font providers when using the experimental Fonts API

  Previously, the Google and Google Icons font providers accepted options that were specific to given font families.

  These options must now be set using the `options` property instead. For example using the Google provider:

  ```diff
  import { defineConfig, fontProviders } from "astro/config";

  export default defineConfig({
      experimental: {
          fonts: [{
              name: 'Inter',
              cssVariable: '--astro-font-inter',
              weights: ['300 900'],
  -            provider: fontProviders.google({
  -                experimental: {
  -                    variableAxis: {
  -                        Inter: { opsz: ['14..32'] }
  -                    }
  -                }
  -            }),
  +            provider: fontProviders.google(),
  +            options: {
  +                experimental: {
  +                    variableAxis: { opsz: ['14..32'] }
  +                }
  +            }
          }]
      }
  })
  ```

- [#&#8203;15200](withastro/astro#15200) [`c0595b3`](withastro/astro@c0595b3) Thanks [@&#8203;florian-lefebvre](https://github.com/florian-lefebvre)! - **BREAKING CHANGE to the experimental Fonts API only**

  Removes `getFontData()` exported from `astro:assets` with `fontData` when using the experimental Fonts API

  Accessing font data can be useful for advanced use cases, such as generating meta tags or Open Graph images. Before, we exposed a `getFontData()` helper function to retrieve the font data for a given `cssVariable`. That was however limiting for programmatic usages that need to access all font data.

  The `getFontData()` helper function is removed and replaced by a new `fontData` object:

  ```diff
  -import { getFontData } from "astro:assets";
  -const data = getFontData("--font-roboto")

  +import { fontData } from "astro:assets";
  +const data = fontData["--font-roboto"]
  ```

  We may reintroduce `getFontData()` later on for a more friendly DX, based on your feedback.

- [#&#8203;15254](withastro/astro#15254) [`8d84b30`](withastro/astro@8d84b30) Thanks [@&#8203;lamalex](https://github.com/lamalex)! - Fixes CSS `assetsPrefix` with remote URLs incorrectly prepending a forward slash

  When using `build.assetsPrefix` with a remote URL (e.g., `https://cdn.example.com`) for CSS assets, the generated `<link>` elements were incorrectly getting a `/` prepended to the full URL, resulting in invalid URLs like `/https://cdn.example.com/assets/style.css`.

  This fix checks if the stylesheet link is a remote URL before prepending the forward slash.

- [#&#8203;15178](withastro/astro#15178) [`731f52d`](withastro/astro@731f52d) Thanks [@&#8203;kedarvartak](https://github.com/kedarvartak)! - Fixes an issue where stopping the dev server with `q+enter` incorrectly created a `dist` folder and copied font files when using the experimental Fonts API

- [#&#8203;15230](withastro/astro#15230) [`3da6272`](withastro/astro@3da6272) Thanks [@&#8203;rahuld109](https://github.com/rahuld109)! - Fixes greedy regex in error message markdown rendering that caused link syntax examples to capture extra characters

- [#&#8203;15253](withastro/astro#15253) [`2a6315a`](withastro/astro@2a6315a) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes hydration for React components nested inside HTML elements in MDX files

- [#&#8203;15227](withastro/astro#15227) [`9a609f4`](withastro/astro@9a609f4) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes styles not being included for conditionally rendered Svelte 5 components in production builds

- [#&#8203;14607](withastro/astro#14607) [`ee52160`](withastro/astro@ee52160) Thanks [@&#8203;simensfo](https://github.com/simensfo)! - Reintroduces css deduplication for hydrated client components. Ensures assets already added to a client chunk are not flagged as orphaned

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Mi4zIiwidXBkYXRlZEluVmVyIjoiNDIuOTIuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants