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

推荐订阅源

H
Help Net Security
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
Visual Studio Blog
G
Google Developers Blog
V
V2EX
The Register - Security
The Register - Security
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
S
SegmentFault 最新的问题
博客园 - Franky
Martin Fowler
Martin Fowler
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
C
Check Point Blog
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
The GitHub Blog
The GitHub Blog
Last Week in AI
Last Week in AI
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
F
Fortinet All Blogs
Jina AI
Jina AI
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
阮一峰的网络日志
阮一峰的网络日志
B
Blog
L
LangChain Blog
月光博客
月光博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
博客园 - 聂微东
Hugging Face - Blog
Hugging Face - Blog
M
MIT News - Artificial intelligence
GbyAI
GbyAI

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 5.7 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.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 4.9
Erika, Emanuele Stoppa, Matthew Phillips, Nate Moore, Bjorn Lu, · 2024-05-23 · via The Astro Blog

Astro 4.9 is out! This release includes the long-awaited Container API, stabilized experimental features, and more. A small but mighty release!

Full release highlights include:

  • Experimental: Container API
  • React 19 support for Astro Actions
  • Stabilized experimental features

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: Container API

Astro 4.9 introduces a first look at the long-awaited Container API. This API allows you to render Astro components outside of an Astro application. This is similar to how you can render React components on the server using libraries like react-dom/server, or Preact components using preact-render-to-string.

Here’s an example of how you can use the Container API to render an Astro component to a string:

import { experimental_AstroContainer as AstroContainer } from 'astro/container';

import Component from './components/Component.astro';

const container = await AstroContainer.create();

console.log(await container.renderToString(Component));

The possibilities that this API adds are endless, but this is just a first step. Our main focus at this stage is to make it easier to render Astro components inside test frameworks powered by Vite, such as Vitest.

import { experimental_AstroContainer as AstroContainer } from 'astro/container';

import { expect, test } from 'vitest';

import Card from '../src/components/Card.astro';

test('Card with slots', async () => {

const container = await AstroContainer.create();

const result = await container.renderToString(Card, {

slots: {

default: 'Card content',

},

});

expect(result).toContain('This is a card');

expect(result).toContain('Card content');

});

To get started testing Astro components with Vitest, we made a new example you can checkout, or create a new project with directly:

npm create astro@latest -- --template container-with-vitest

Our testing guide has also been updated with more information on how to use the Container API for testing. Test everything!

To learn more about the Container API and how to use it, check out the Container API documentation. To give feedback on this experimental and developing feature, visit the Container API RFC.

React 19 support

The first React 19 release candidate is out, and Astro came prepared. We added full support for React 19 to the React integration with some added goodies for Astro Actions.

To use React 19 in your Astro project, follow the React 19 beta installation guide. This unlocks React’s new form actions feature, which lets you call Actions from a <form> and track “pending” and “result” values in your components.

This example uses an Astro Action called like() that accepts a postId and returns the number of likes. With React 19, you can pass this action to the useActionState() hook to track the result. Apply the experimental_withState() function to apply progressive enhancement information automatically:

import { actions } from 'astro:actions';

import { useActionState } from 'react';

import { experimental_withState } from '@astrojs/react/actions';

export function Like({ postId }: { postId: string }) {

const [state, action, pending] = useActionState(

experimental_withState(actions.like),

0, // initial likes

);

return (

<form action={action}>

<input type="hidden" name="postId" value={postId} />

<button disabled={pending}>{state} ❤️</button>

</form>

);

}

You can also access the state stored by useActionState() from your action handler using experimental_getActionState(). See the CHANGELOG for usage examples.

If you don’t need to track the state, you can also apply Astro Actions directly to the action property on any React <form>. This will also apply progressive enhancement information:

import { actions } from 'astro:actions';

export function SignOut() {

return (

<form action={actions.signOut}>

<button>Sign Out</button>

</form>

);

}

To learn more about Astro Actions, and to offer feedback on this experimental API, check out the Astro Actions RFC.

Stabilized experimental features

This release stabilizes the CSRF protection (introduced in Astro 4.6) and i18n domains support (introduced in Astro 4.3) features. It is no longer necessary to enable the experimental.csrfProtection and experimental.i18nDomains options in your Astro config to use these features.

The experimental.security.csrfProtection option has been removed in favor of a new security.checkOrigin option. To enable cross-site request forgery protection, set security.checkOrigin to true in your Astro config and remove the experimental.security.csrfProtection option if you have it enabled:

import { defineConfig } from "astro/config";

export default defineConfig({

security: {

checkOrigin: true

}

experimental: {

security: {

csrfProtection: {

origin: true

}

}

},

});

As for i18n domains, you can keep your configuration as is, just without the experimental.i18nDomains option:

import { defineConfig } from "astro/config";

export default defineConfig({

site: "https://example.com",

output: "server",

adapter: node({

mode: 'standalone',

}),

i18n: {

defaultLocale: "en",

locales: ["en", "fr", "pt-br", "es"],

prefixDefaultLocale: false,

domains: {

fr: "https://fr.example.com",

es: "https://example.es",

},

},

experimental: {

i18nDomains: true,

},

});

For more information on these features, see the security and i18n domains sections of the Astro documentation respectively.

Bug Fixes

As it do be, Astro 4.9 includes more bug fixes and smaller improvements that couldn’t make it into this post! Check out the full release notes to learn more!