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

推荐订阅源

V2EX - 技术
V2EX - 技术
P
Privacy International News Feed
Security Latest
Security Latest
H
Hacker News: Front Page
T
Tenable Blog
The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Security @ Cisco Blogs
Project Zero
Project Zero
O
OpenAI News
AI
AI
Spread Privacy
Spread Privacy
C
CERT Recently Published Vulnerability Notes
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Scott Helme
Scott Helme
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
CXSECURITY Database RSS Feed - CXSecurity.com
NISL@THU
NISL@THU
A
Arctic Wolf
T
Threat Research - Cisco Blogs
PCI Perspectives
PCI Perspectives
N
News and Events Feed by Topic
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
Simon Willison's Weblog
Simon Willison's Weblog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Google Online Security Blog
Google Online Security Blog
罗磊的独立博客
L
LINUX DO - 最新话题
U
Unit 42
S
Security Affairs
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 【当耐特】
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
月光博客
月光博客
Engineering at Meta
Engineering at Meta
腾讯CDC
F
Full Disclosure
Cyberwarzone
Cyberwarzone
S
SegmentFault 最新的问题
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 司徒正美
The Cloudflare Blog

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

Astro 4.8 is out now! This release includes experimental support for Astro actions and request rewriting, performance improvements, and more.

Full release highlights include:

  • Experimental: Astro Actions
  • Experimental: Request Rewriting
  • Performance improvements
  • Ability to define multiple routes with the same entrypoint

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: Astro Actions

This release includes the first preview for a long awaited feature: Astro actions! Actions make it easy to define and call backend functions with full type-safety from your client code.

To use this feature, add a server build output and enable the experimental.actions option in your Astro config:

import { defineConfig } from "astro/config";

export default defineConfig({

output: "hybrid", // or 'server'

experimental: {

actions: true,

},

});

Then, define actions in a src/actions/index.ts file using defineAction(). You can define actions that accept JSON or form requests, and the handler function will be called with your type-safe input.

Plus, no more casting formData.get() results. Astro will automatically parse form requests to objects using your Zod schema. Here’s an example of a newsletter signup action:

import { defineAction, z } from "astro:actions";

export const server = {

newsletter: defineAction({

accept: "form",

input: z.object({

email: z.string().email(),

receivePromo: z.boolean(),

}),

handler: async ({ email, receivePromo }) => {

// call a mailing service, or store to a database

return { success: true };

},

}),

};

You can call actions from any client component using the actions object from astro:actions. You can pass a type-safe object when using JSON, or a FormData object when using accept: 'form'. You can also add getActionProps() for progressive enhancement:

import { actions, getActionProps } from "astro:actions";

export function Newsletter() {

return (

<form

method="POST"

onSubmit={async (e) => {

e.preventDefault();

const formData = new FormData(e.target as HTMLFormElement);

const result = await actions.newsletter(formData);

}}

>

<input {...getActionProps(actions.newsletter)} />

<label htmlFor="email">Email</label>

<input name="email" type="email" id="email" />

<label htmlFor="receivePromo">Receive promotional emails</label>

<input name="receivePromo" type="checkbox" id="receivePromo" checked />

<button type="submit">Sign Up</button>

</form>

);

}

For more information on Astro actions, visit the experimental actions docs.

Experimental: Request Rewriting

Astro 4.8 introduces experimental support for request rewriting. Rewriting is a routing feature that allows you to show the content of a different page from the current URL. This can be useful for customizing content based on the user’s location, device, or other conditions without needing multiple, different URLs. This feature is sometimes also called “rerouting” in other frameworks.

To enable this feature, configure the experimental.rewriting option in your Astro config:

import { defineConfig } from "astro/config";

export default defineConfig({

experimental: {

rewriting: true,

},

});

From your pages and endpoints, you can then access a rewrite() method on the Astro global or context object:

---

if (!Astro.props.allowed) {

return Astro.rewrite("/")

}

---

export function GET(ctx) {

if (!ctx.locals.allowed) {

return ctx.rewrite("/");

}

}

This feature can also be used inside middlewares, by passing a parameter to the next() method with the same type as the rewrite method.

export function onRequest(ctx, next) {

if (!ctx.cookies.get("allowed")) {

return next("/");

}

return next();

}

For more information on rewriting, visit the experimental rewriting docs.

Performance improvements

Thanks to the recent hard work from @bluwy both across the JavaScript ecosystem and in Astro itself, Astro is faster than ever! This release includes a number of performance improvements, cutting build and rendering times across the board.

In our own benchmarks, we’ve observed build times improve by up to 20% in specific cases. No changes are needed to take advantage of these improvements—just upgrade to Astro 4.8 and enjoy the faster builds!

Ability to define multiple routes with the same entrypoint

Astro integration authors discovered that trying to inject multiple routes with the same entrypoint using the injectRoute function would result in an unintended behavior at build time where the last injected route would override the previous ones.

This issue has existed since the introduction of the injectRoute function, almost two years ago (in Astro 1.0), but thanks to a contribution by @goulvenclech, it is now finally fixed in Astro 4.8!

With our thriving developer community and so many new integrations being built all the time, it’s important to us that Astro is a great platform to build for and we are pleased that this paves the way for even more integrations in the future!

Bug Fixes

You know it, Astro 4.8 includes more bug fixes and smaller improvements that couldn’t make it into this post! Check out the full release notes to learn more.