惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog
S
Secure Thoughts
S
Security @ Cisco Blogs
S
Security Affairs
Forbes - Security
Forbes - Security
W
WeLiveSecurity
H
Hacker News: Front Page
T
Threatpost
Google Online Security Blog
Google Online Security Blog
S
Schneier on Security
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - Franky
腾讯CDC
IT之家
IT之家
博客园 - 聂微东
L
LINUX DO - 最新话题
罗磊的独立博客
Hacker News - Newest:
Hacker News - Newest: "LLM"
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 三生石上(FineUI控件)
Hacker News: Ask HN
Hacker News: Ask HN
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
C
CERT Recently Published Vulnerability Notes
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园_首页
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cisco Talos Blog
Cisco Talos Blog
S
SegmentFault 最新的问题
酷 壳 – CoolShell
酷 壳 – CoolShell
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
美团技术团队
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
AI
AI
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Jina AI
Jina AI
Help Net Security
Help Net Security
N
News | PayPal Newsroom
月光博客
月光博客
Spread Privacy
Spread Privacy
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
N
News and Events Feed by Topic

The Astro Blog

Astro 6.4 Astro 6.3 Starlight 0.39 Astro 6.2 What's new in Astro - April 2026 What's new in Astro - March 2026 Astro 6.1 CloudCannon Joins Astro as an Official CMS Partner Astro 6.0 What's new in Astro - February 2026 What's new in Astro - January 2026 Astro 5.17 Supporting the future of Astro The Astro Technology Company joins Cloudflare Astro 6 Beta What's new in Astro - December 2025 What's new in Astro - November 2025 Astro 5.16 Stainless Sponsors Astro, Launches Astro-Powered Docs Platform What's new in Astro - October 2025 Astro 5.15 Spirit of Astro: meet the winning designs What's new in Astro - September 2025 Astro 5.14 Cloudflare Donates $150,000 to Support Astro's Open Source Mission Webflow Donates $150,000 to Support Astro's Open Source Mission Mux: Our Official Video Partner Unleashing creativity: How CodeTV built a video streaming platform with Astro and Mux | Astro What's new in Astro - August 2025 Astro 5.13 What's new in Astro - July 2025 Astro 5.12 Starlight 0.35 Astro 5.11 What's new in Astro - June 2025 Live Content Collections: A Deep Dive Introducing… Astro Mart Astro Solstice Festival Astro 5.10 Astro 5.9 What's new in Astro - May 2025 Astro 5.8 What's new in Astro - April 2025 2025 Technical Steering Committee Starlight April Update Astro Agency Partner Program Astro 5.6 What's new in Astro - March 2025 Astro 5.5 What's new in Astro - February 2025 Astro 5.4 Starlight 0.32 Astro 5.3 What's new in Astro - January 2025 Astro 5.2 2024 year in review What's new in Astro - December 2024 Astro 5.1 Astro 5.0 Google IDX: Our Official Online Editor Partner What's new in Astro - November 2024 What's new in Astro - October 2024 Astro x Cloudinary SDK What's new in Astro - September 2024 Community Loaders for Astro Content Layer Astro x Hygraph: Content Loader Astro x Cloudinary: Content Loader Astro x Storyblok: Content Loader Content Layer: A Deep Dive Starlight 0.28 Astro 5.0 Beta Release The $100,000 Astro Ecosystem Fund Fall Update Goodbye Studio, Hello DB What's new in Astro - August 2024 Astro 4.15 Astro 4.14 Astro 4.13 What's new in Astro - July 2024 Astro 4.12: Server Islands Netlify: Our Official Deployment Partner What's new in Astro - June 2024 Astro 4.11 Astro Together 2024 Server Islands The Astro Content Layer Zero-JavaScript View Transitions Astro 4.10 Starlight turns one year old! What's new in Astro - May 2024 Astro 4.9 Astro 4.8 What's new in Astro - April 2024 Astro 4.7 Astro 4.6 What's new in Astro - March 2024 Migrating 500+ tests from Mocha to Node.js Astro DB: A Deep Dive The Astro Developer Portal Astro DB Astro 4.5
Astro 5.7
Matt Kane, Florian Lefebvre, Emanuele Stoppa, Nate Moore · 2025-04-15 · via The Astro Blog

Astro 5.7 has a basketload of treats, including stable Sessions and SVG components and a new Experimental Fonts API.

🐣 Full of the joys of northern-hemisphere spring, Astro 5.7 is here with goodies galore:

  • Experimental Fonts API
  • Sessions API
  • SVG Components
  • Config Imports

To upgrade an existing project, use the automated @astrojs/upgrade CLI tool. Alternatively, upgrade manually by running the upgrade command for your package manager:

# Recommended:

npx @astrojs/upgrade

# Manual:

npm install astro@latest

pnpm upgrade astro --latest

yarn upgrade astro --latest

Experimental Fonts API

Almost every website these days uses custom fonts. However, it can be surprisingly complicated to get them right: Why do I get a Flash of Unstyled Text? Should I add a preload link? What about preconnect links? Do I self-host or rely on a third-party provider?

Fonts can have significant performance implications on your site, affecting your visitors’ browsing experience and important Core Web Vitals (CWV) metrics. Fortunately, web APIs have greatly improved recently and thanks to amazing initiatives of the open source community (eg. unifont and capsize), we’ve been able to start working on a great way to use fonts in Astro!

This experimental feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including fallback font generation.

To enable this feature, configure an experimental.fonts object with one or more fonts:

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

export default defineConfig({

experimental: {

fonts: [{

provider: fontProviders.google(),

name: "Roboto",

cssVariable: "--font-roboto"

}]

}

});

Then, add a <Font /> component and site-wide styling in your <head>:

---

import { Font } from 'astro:assets'

---

<Font cssVariable='--font-roboto' preload />

<style>

body {

font-family: var(--font-roboto);

}

</style>

There’s so much more to discover! Head over to the experimental Fonts documentation for the full API, how to get started, and even how to build your own custom AstroFontProvider if we don’t yet support your preferred font service.

We’d also appreciate your feedback. Participate in the ongoing development of this feature on the Fonts RFC and help shape its future.

Sessions API

The Astro Sessions API is now stable and ready for production!

Sessions let you securely store data tied to a specific user as they navigate between pages on your site. Unlike cookies, sessions are stored on the server, so you can store larger amounts of data without worrying about size limits or security issues. They are useful for storing things like user data, shopping carts, and form state, and they work without any client-side JavaScript:

---

const cart = await Astro.session.get('cart');

export const prerender = false;

---

<a href="/checkout">🛒 {cart?.length ?? 0} items</a>

They can be used in Astro components, pages, API endpoints, actions, and middleware. The API is the same for all of them:

import { defineAction } from "astro:actions";

import { z } from "astro:schema";

export const server = {

addToCart: defineAction({

input: z.object({

product: z.string(),

}),

async handler({ product }, { session }) {

const cart = await session.get('cart');

session.set('cart', [...cart, product]);

},

}),

};

Type-safety

Of course, as this is Astro, your sessions can be type-safe too. Define an interface and you will get type-checking and auto-completion for all of your session data:

declare namespace App {

interface SessionData {

user: {

id: string;

name: string;

};

cart: string[];

}

}

The session ID is automatically tracked using a cookie, but you can also use the session.load() method to access sessions without cookies. This is useful for things like APIs, where you might want to use a custom header or params to track the session ID:

export async function POST({ session, request }: APIContext) {

const sessionId = request.headers.get('x-session-id');

// If there is an existing session ID, load it. Otherwise, one will be created

if (sessionId) {

await session.load(sessionId);

}

const cart = await session.get('cart');

const data = await request.json<{ item: string }>();

if (!data?.item) {

return new Response('Item is required', { status: 400 });

}

session.set('cart', [...cart, data.item]);

// Return the cart and session ID

return Response.json({ cart, sessionId: session.sessionId });

}

Storage drivers

Astro sessions use storage drivers to persist the data, and these are either zero-config or require minimal setup for all official Astro adapters. Alternatively, you can use any unstorage driver, which supports dozens of storage backends such as Redis and MongoDB.

  • Node: zero-config filesystem driver
  • Netlify: zero-config Netlify Blobs driver
  • Cloudflare: minimal-config Workers KV driver
  • Vercel: minimal-config Redis/Upstash driver

On any of these platforms, you can easily switch out the driver for a different one if you don’t want to use the default.

import { defineConfig } from 'astro/config';

import netlify from '@astrojs/netlify';

export default defineConfig({

// ...

adapter: netlify(),

session: {

driver: 'redis',

options: {

url: process.env.REDIS_URL,

},

},

});

Upgrading from experimental sessions

If you were using the experimental sessions API, you should remove the experimental flag from your astro.config.mjs file:

import { defineConfig } from 'astro/config';

export default defineConfig({

// ...

experimental: {

session: false,

},

});

Check out the sessions guide to learn more about how to use them in your Astro project.

SVG Components

Astro now supports local SVG files as components! Inlining SVGs directly into your HTML had previously required extra steps like manually converting the SVG to an Astro component or installing a third-party integration. Now, Astro supports using the default import of any .svg file as you would use any other .astro component. SVG components automatically inline an <svg> tag directly into your HTML.

You can pass props such as width, height, fill, stroke, and any other attribute accepted by the native <svg> element.

---

import Logo from './path/to/svg/file.svg';

---

<Logo width={64} height={64} fill="currentColor" />

Take a look at the SVG components documentation for more details.

Special thanks to Michael Stramel for his work on this feature!

Upgrading from experimental SVG

If you were previously using the experimental SVG API, you must remove the experimental flag from your astro.config.mjs file.

import { defineConfig } from 'astro/config';

export default defineConfig({

// ...

experimental: {

svg: true,

},

});

Note that Astro 5.6 introduced some breaking changes to this flag. Please check that your code is up-to-date with the latest, stable version of this API.

Config Imports

The new virtual module astro:config is now stable!

The virtual module allows you to import a subset of the Astro configuration, with type-safety in mind. Two sub-paths are exposed for controlled access to your configuration:

  • astro:config/client: exposes config information that is safe to expose to the client.
  • astro:config/server: exposes additional information that is safe to expose to the server, such as file/dir paths.

For example, you can now build your own path utilities without relying on an integration. Properties like base and trailingSlash set in your configuration can be imported and used in a .js file:

export default defineConfig({

base: "store/",

trailingSlash: "always"

});

import { trailingSlash, base } from 'astro:config/client';

// This method adds a forward slash to paths, and prepends the `base`

function addForwardSlashAndBase(path) {

let finalPath;

if (trailingSlash === 'always') {

finalPath = path.endsWith('/') ? path : path + '/';

} else {

finalPath = path;

}

if (base !== "/") {

return base + finalPath

}

return finalPath

}

Use this path utility that depends on your configuration settings throughout your project, for example, for more control over page links:

---

import { addForwardSlashAndBase } from "@src/utils.js";

const cartUrl = addForwardSlashAndBase("cart"); // it will return "store/cart/"

---

<a href={cartUrl}>Cart</a>

We configured you’d enjoy this new ability to access your settings, with Astro’s trademark type safety to help you get it right!

Bug fixes

As always, we’ve been working hard on fixing issues since the 5.6 release. See the changelog for all the details.

The Astro core team is:

Ben Holmes , Caleb Jasik , Chris Swithinbank , Emanuele Stoppa , Erika , Florian Lefebvre , Fuzzy , HiDeoo , Luiz Ferraz , Matt Kane , Matthew Phillips , Nate Moore , Reuben Tier , Sarah Rainsberger , and Yan Thomas .

Thanks to all the other contributors who helped make Astro 5.7 possible, including: Roberto Molina, Junseong Park, ryu, Martin Trapp, Michael Stramel, Armand Philippot, Nin3, viniciusdeliz, Juan Diaz, Marcos Corrochano Arroyo, Paul Valladares, Bugo, liruifengv, Thomas Bonnet, Ming-jun Lu, CHEZ, omoyx, emily-shen, Ariel K, Maciek Palmowski, Matthew Justice, Adam Matthiesen, and Louis Escher.

We look forward to seeing what you build with Astro 5.7! If you have questions, comments, or just want to say hi, drop by the Astro Discord.