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

推荐订阅源

B
Blog RSS Feed
J
Java Code Geeks
H
Help Net Security
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
U
Unit 42
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 叶小钗
D
Docker
量子位
P
Proofpoint News Feed
博客园_首页
T
Tailwind CSS Blog
F
Fortinet All Blogs

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
Astro 1.5.0 Release
Matthew Phillips · 2022-10-13 · via The Astro Blog

Astro 1.5.0 just went out and it features:

  • Adapter support for astro preview: Adapters can now support astro preview.
  • Standalone mode in Node.js adapter: The Node.js adapter now can build to a standalone server.
  • HMR for Tailwind and TypeScript config: The dev server will now automatically reload on Tailwind config and tsconfig changes.
  • API Endpoint improvements: The API route APIContext object now matches the Astro global more closely.
  • Astro.redirect status code: You can now optionally pass a status code when using Astro.redirect.

You can update your projects by running npm install astro@latest.

Adapter support for astro preview

We are rolling out support for the astro preview command in adapters via a new integration option, starting with the Node.js adapter @astrojs/node. If you are using @astrojs/node, you can now preview your SSR app by running:

Adapter API

We will be updating the other first party Astro adapters to support preview over time. Adapters can opt-in to this feature by providing the previewEntrypoint via the setAdapter function in astro:config:done hook. The Node.js adapter’s code looks like this:

export default function() {

return {

name: '@astrojs/node',

hooks: {

'astro:config:done': ({ setAdapter, config }) => {

setAdapter({

name: '@astrojs/node',

serverEntrypoint: '@astrojs/node/server.js',

previewEntrypoint: '@astrojs/node/preview.js',

exports: ['handler'],

});

// more here

}

}

};

}

Standalone mode in Node.js adapter

New in @astrojs/node is support for standalone mode. With standalone mode, you can start your production server without needing to write any server JavaScript logic yourself. The server starts simply by running the script like so:

node ./dist/server/entry.mjs

To enable standalone mode, set the new mode option to 'standalone' in your Astro config:

import { defineConfig } from "astro/config"

import nodejs from "@astrojs/node"

export default defineConfig({

output: "server",

adapter: nodejs({

mode: "standalone",

}),

})

See the @astrojs/node documentation for all of the options available in standalone mode.

Existing @astrojs/node users who are using their own HTTP server framework such as Express can upgrade by setting the mode option to 'middleware' in order to build to a middleware mode, which is the same behavior and API as before.

import { defineConfig } from "astro/config"

import nodejs from "@astrojs/node"

export default defineConfig({

output: "server",

adapter: nodejs({

mode: "middleware",

}),

})

HMR for Tailwind and TypeScript config

HMR is vitally important even at the beginning stages of a project. In a recent Astro release we ensured that changes to your astro.config.mjs file resulted in an automatic server restart. Today we are expanding our support for HMR with other configuration files.

Now, editing your tsconfig.json settings (for example, to add an alias) results in an HMR update.

Similarly, Tailwind configuration file changes now update as well. Just edit your tailwind.config.(js|cjs|mjs) file and the changes will reflect without the need to restart your dev server.

We’re continuing to focus on HMR and the dev experience in upcoming releases.

API Endpoint improvements

In API routes, you can now get the site, generator, url, clientAddress, props, and redirect fields on the APIContext, which is the first parameter passed to an API route. This was done to make the APIContext more closely align with the Astro global in .astro pages.

For example, here’s how you might use the clientAddress, which is the user’s IP address, to selectively allow users.

export function post({ clientAddress, redirect }) {

if (!allowList.has(clientAddress)) {

return redirect("/not-allowed")

}

}

Check out the docs for more information on the newly available fields.

Astro.redirect status code

New in 1.5 is the ability to pass a status code to Astro.redirect. By default it uses 302, but now you can pass another code as the second argument:

/src/pages/old-post.astro

---

// This page was moved, redirect the user to the new permanent page.

return Astro.redirect("/posts/new-post-name", 301)

---


This release also comes with many bug fixes. Thanks to everyone who has contributed to another outstanding release. See the release notes for full details on the changes.