Skip to content
Draft

Astro v7 #13872

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
LABEL: ci
PR_BRANCH: ci/docgen
PR_TITLE: 'ci: update configuration reference docs'
# Custom options for running with Astro v6 beta code
# - SOURCE_BRANCH: main
# TARGET_BRANCH: v6
# LABEL: 6.0,ci
# PR_BRANCH: ci/docgen-beta
# PR_TITLE: '[BETA] ci: update reference docs'
# Custom options for running with Astro v7 beta code
- SOURCE_BRANCH: next
TARGET_BRANCH: v7
LABEL: 7.0,ci
PR_BRANCH: ci/docgen-beta
PR_TITLE: '[BETA] ci: update reference docs'
steps:
- name: Check out code using Git
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -66,12 +66,12 @@ jobs:
LABEL: ci
PR_BRANCH: ci/docgen-errors
PR_TITLE: 'ci: update error reference docs'
# Custom options for running with Astro v6 beta code
# - SOURCE_BRANCH: main
# TARGET_BRANCH: v6
# LABEL: 6.0,ci
# PR_BRANCH: ci/docgen-errors-beta
# PR_TITLE: '[BETA] ci: update error reference docs'
# Custom options for running with Astro v7 beta code
- SOURCE_BRANCH: next
TARGET_BRANCH: v7
LABEL: 7.0,ci
PR_BRANCH: ci/docgen-errors-beta
PR_TITLE: '[BETA] ci: update error reference docs'
steps:
- name: Check out code using Git
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down
2 changes: 1 addition & 1 deletion astro.sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const sidebar = [
group('guides.upgrade.major', {
collapsed: true,
items: [
'guides/upgrade-to/v7',
'guides/upgrade-to/v6',
'guides/upgrade-to/v5',
'guides/upgrade-to/v4',
Expand Down Expand Up @@ -160,7 +161,6 @@ export const sidebar = [
'reference/experimental-flags/chrome-devtools-workspace',
'reference/experimental-flags/svg-optimization',
'reference/experimental-flags/queued-rendering',
'reference/experimental-flags/rust-compiler',
'reference/experimental-flags/advanced-routing',
'reference/experimental-flags/logger',
],
Expand Down
4 changes: 4 additions & 0 deletions public/_headers
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# TODO: Remove this before merging to main
/*
x-robots-tag: no-index
/*
cache-control: max-age=60
cache-control: public
/_astro/*
cache-control: max-age=31536000
cache-control: immutable
cache-control: public

2 changes: 1 addition & 1 deletion src/content/docs/en/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ editUrl: false
next: false
banner:
content: |
Astro v6 is here! <a href="/en/guides/upgrade-to/v6/">Learn how to upgrade your site</a>
Astro v7 is here! <a href="/en/guides/upgrade-to/v7/">Learn how to upgrade your site</a>
hero:
title: Astro Docs
tagline: Guides, resources, and API references to help you build with Astro.
Expand Down
101 changes: 101 additions & 0 deletions src/content/docs/en/guides/upgrade-to/v7.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: Upgrade to Astro v7
description: How to upgrade your project to Astro v7.0.
sidebar:
label: v7.0
i18nReady: false
---
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'
import { Steps } from '@astrojs/starlight/components';
import ReadMore from '~/components/ReadMore.astro'
import SourcePR from '~/components/SourcePR.astro'

:::tip[Using a coding agent?]
Copy this prompt to upgrade your project:

```
Upgrade my Astro project to v7. Follow the migration guide at
https://v7.docs.astro.build/en/guides/upgrade-to/v7/
```
:::

This guide will help you migrate from Astro v6 to Astro v7.

Need to upgrade an older project to v6 first? See our [older migration guide](/en/guides/upgrade-to/v6/).

Need to see the v6 docs? Visit this [older version of the docs site (unmaintained v6 snapshot)](https://v6.docs.astro.build/).

## Upgrade Astro

Update your project's version of Astro to the latest version using your package manager:

<PackageManagerTabs>
<Fragment slot="npm">
```shell
# Upgrade Astro and official integrations together
npx @astrojs/upgrade alpha
```
</Fragment>
<Fragment slot="pnpm">
```shell
# Upgrade Astro and official integrations together
pnpm dlx @astrojs/upgrade alpha
```
</Fragment>
<Fragment slot="yarn">
```shell
# Upgrade Astro and official integrations together
yarn dlx @astrojs/upgrade alpha
```
</Fragment>
</PackageManagerTabs>

You can also [upgrade your Astro integrations manually](/en/guides/integrations/#manual-upgrading) if needed, and you may also need to upgrade other dependencies in your project.

:::note[Need to continue?]
After upgrading Astro, you may not need to make any changes to your project at all!

But, if you notice errors or unexpected behavior, please check below for what has changed that might need updating in your project.
:::

Astro v7.0 includes [potentially breaking changes](#breaking-changes), as well as the removal of some previously deprecated features.

If your project doesn't work as expected after upgrading to v7.0, check this guide for an overview of all breaking changes and instructions on how to update your codebase.

See [the Astro changelog](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md) for full release notes.

## Breaking Changes

### Dependency Upgrades

#### Vite 8

Astro v7.0 upgrades to [Vite 8](https://vite.dev/blog/announcing-vite-8) as the development server and production bundler.

##### What should I do?

If you are using Vite-specific plugins, configuration, or APIs, check the [Vite 8 migration guide](https://vite.dev/guide/migration) for their breaking changes and upgrade your project as needed.

Most Astro users should be able to upgrade without any changes to their project code. This is primarily a breaking change for Astro integrations and plugins that depend on Vite internals.

### Rust Compiler

The Rust-based Astro compiler, previously available as an experimental flag (`experimental.rustCompiler`), is now the default and only compiler in Astro 7. The Rust compiler delivers significantly faster build times compared to the previous Go-based compiler.

##### What should I do?

No action is required for most projects. The Rust compiler is a drop-in replacement for the Go-based compiler.

If you had previously opted in to the Rust compiler via the experimental flag, you can now remove it from your configuration:

```js title="astro.config.mjs" del={4-6}
import { defineConfig } from 'astro/config';

export default defineConfig({
experimental: {
rustCompiler: true,
},
});
```

If you encounter any issues with the Rust compiler, please report them on [GitHub](https://github.com/withastro/astro/issues).
71 changes: 0 additions & 71 deletions src/content/docs/en/reference/experimental-flags/rust-compiler.mdx

This file was deleted.

1 change: 1 addition & 0 deletions src/content/docs/en/upgrade-astro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ The main Astro documentation pages are always **accurate for the latest released

See the upgrade guides below for an explanation of changes, comparing the new version to the old. The upgrade guides include everything that could require you to change your own code: breaking changes, deprecations, feature removals and replacements as well as updated usage guidance. Each change to Astro includes a "What should I do?" section to help you successfully update your project code.

- [Upgrade to v7](/en/guides/upgrade-to/v7/)
- [Upgrade to v6](/en/guides/upgrade-to/v6/)
- [Upgrade to v5](/en/guides/upgrade-to/v5/)
- [Upgrade to v4](/en/guides/upgrade-to/v4/)
Expand Down
71 changes: 0 additions & 71 deletions src/content/docs/es/reference/experimental-flags/rust-compiler.mdx

This file was deleted.

Loading
Loading