Vai al contenuto
verdict:

Astro 5.16.13

digest

note: la sintesi e le note di rilascio sono in inglese

note: nessuna sintesi per questa release digest

Le release digest sono elencate senza una sintesi. Le note di rilascio originali di questa versione sono qui sotto.

release-notesgithub.com/withastro/astro · 43 righe
  1. ### Patch Changes
  2. - [#15182](https://github.com/withastro/astro/pull/15182) [`cb60ee1`](https://github.com/withastro/astro/commit/cb60ee16051da258ab140f3bb64ff3fd8e4c9e17) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `getFontBuffer()` method to retrieve font file buffers when using the experimental Fonts API
  3. The `getFontData()` helper function from `astro:assets` was introduced in 5.14.0 to provide access to font family data for use outside of Astro. One of the goals of this API was to be able to retrieve buffers using URLs.
  4. However, it turned out to be impactical and even impossible during prerendering.
  5. Astro now exports a new `getFontBuffer()` helper function from `astro:assets` to retrieve font file buffers from URL returned by `getFontData()`. For example, when using [satori](https://github.com/vercel/satori) to generate OpenGraph images:
  6. ```diff
  7. // src/pages/og.png.ts
  8. import type{ APIRoute } from "astro"
  9. -import { getFontData } from "astro:assets"
  10. +import { getFontData, getFontBuffer } from "astro:assets"
  11. import satori from "satori"
  12. export const GET: APIRoute = (context) => {
  13. const data = getFontData("--font-roboto")
  14. const svg = await satori(
  15. <div style={{ color: "black" }}>hello, world</div>,
  16. {
  17. width: 600,
  18. height: 400,
  19. fonts: [
  20. {
  21. name: "Roboto",
  22. - data: await fetch(new URL(data[0].src[0].url, context.url.origin)).then(res => res.arrayBuffer()),
  23. + data: await getFontBuffer(data[0].src[0].url),
  24. weight: 400,
  25. style: "normal",
  26. },
  27. ],
  28. },
  29. )
  30. // ...
  31. }
  32. ```
  33. See the [experimental Fonts API documentation](https://docs.astro.build/en/reference/experimental-flags/fonts/#accessing-font-data-programmatically) for more information.

vedi su githubimported 2026-09-28 via npm