Astro 4.13

作者
Erika

Astro 4.13 现已发布!此版本包括稳定化的实验性功能、日志记录改进等等。

此版本包括以下亮点

要升级现有项目,请使用自动化的 @astrojs/upgrade CLI 工具。或者,通过运行包管理器的升级命令来手动升级

# Recommended:
npx @astrojs/upgrade
# Manual:
npm install astro@latest
pnpm upgrade astro --latest
yarn upgrade astro --latest

稳定版:请求重写

在 Astro 4.8 中,我们增加了对请求重写的实验性支持,这是一个强大的功能,可用于在 Astro 页面和端点中渲染另一个页面而无需更改浏览器 URL。在 Astro 4.13 中,我们很高兴地宣布请求重写现已稳定!

如果您在 Astro 4.13 之前已经在使用请求重写,您现在可以从 Astro 配置中删除 experimental.rewriting 选项。该功能现在已默认启用。

import { defineConfig } from 'astro';
export default defineConfig({
experimental: {
rewriting: true
}
})

有关此功能的更多信息,请查阅Astro 重写文档

稳定版:内容集合 JSON 模式

在 Astro 4.5 中,我们引入了(实验性的)为数据内容集合自动生成 JSON 模式的功能。在 Astro 4.13 中,此功能现已稳定!

如果您在 Astro 4.5 中使用了内容集合 JSON 模式,您现在可以从 Astro 配置中删除 experimental.contentCollectionJsonSchema 选项。该功能现在已默认启用。

import { defineConfig } from 'astro';
export default defineConfig({
experimental: {
contentCollectionJsonSchema: true
}
})

当您在 Astro 项目中定义数据内容集合时,Astro 现在将自动为该集合生成 JSON 模式。然后,此模式可在您的编辑器中使用,为您的数据提供自动补全、验证等功能。

有关此功能的更多信息,请查阅Astro 内容集合模式文档

日志记录改进

作为我们对抗缓慢构建的无尽努力的一部分,Astro 4.13 包含了对构建过程中日志输出的一项小改进。

耗时较长的页面现在将以红色记录其时间,从而更容易发现构建过程中的瓶颈。

A screenshot of the terminal showing the output of a build with two pages. One of the page has the time it took to build (603ms) highlighted in red.

希望未来此类情况会更少!

错误修复和特别鸣谢

一如既往,Astro 4.13 包含了更多未在此帖子中提及的错误修复和较小改进!请查阅完整的发布说明以了解更多信息。

鸣谢

以及为本次发布做出贡献的所有其他人。