Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
88af417
docs: document Environment API breaking changes
matthewp Nov 28, 2025
f77b490
Update src/content/docs/en/guides/upgrade-to/v6.mdx
matthewp Nov 29, 2025
52f9cf8
Update src/content/docs/en/guides/upgrade-to/v6.mdx
matthewp Nov 29, 2025
0ca67aa
Update src/content/docs/en/guides/upgrade-to/v6.mdx
matthewp Nov 29, 2025
0457ca4
Update src/content/docs/en/guides/upgrade-to/v6.mdx
matthewp Nov 29, 2025
6b46739
Update src/content/docs/en/guides/upgrade-to/v6.mdx
matthewp Nov 29, 2025
6fb050d
reorganize content
sarah11918 Dec 1, 2025
a938dd7
typo in anchor link
sarah11918 Dec 1, 2025
68308eb
snagged some good info from the implementation PR changeset
sarah11918 Dec 1, 2025
2bb0e1d
Merge branch 'v6' into v6-env
sarah11918 Dec 2, 2025
4d7a2ce
Update src/content/docs/en/guides/upgrade-to/v6.mdx
matthewp Dec 2, 2025
a94934a
remove code comment
sarah11918 Dec 3, 2025
18ed085
remove documentation for `target`
sarah11918 Dec 3, 2025
df74419
update entry for manifest updates
sarah11918 Dec 3, 2025
c267678
remove blank line
sarah11918 Dec 3, 2025
b49329a
warn that other stuff changed too
sarah11918 Dec 3, 2025
e83f317
RouteData change associated with Adapter API instead of Integration
sarah11918 Dec 3, 2025
d1c447f
link to adapter API instead of routing guide
sarah11918 Dec 3, 2025
d097704
update line numbers in link to source code
sarah11918 Dec 3, 2025
6e41928
remove blank line
sarah11918 Dec 3, 2025
2f9ee90
Merge branch 'v6' into v6-env
sarah11918 Dec 3, 2025
b0fad87
polishing nits
sarah11918 Dec 3, 2025
3401d6d
fix missing function notation
sarah11918 Dec 3, 2025
b0b4b49
Yan final boss review
sarah11918 Dec 4, 2025
5efead1
Merge branch 'v6' into v6-env
sarah11918 Dec 4, 2025
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
139 changes: 139 additions & 0 deletions src/content/docs/en/guides/upgrade-to/v6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ Astro v6.0 upgrades to Vite v7.0 as the development server and production bundle

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

### Vite Environment API

<SourcePR number="14306" title="feat: integrate vite environments"/>

Astro v6.0 introduces significant changes to how Astro manages different runtime environments (client, server, and prerender) after an internal refactor to use [Vite's new Environments API](https://vite.dev/guide/api-environment).

Integration and adapter maintainers should pay special attention to changes affecting these parts of the Integration API and Adapter API (full details included below with other breaking changes to these APIs):

- [integration hooks and HMR access patterns](#changed-integration-hooks-and-hmr-access-patterns-integration-api)
- [`SSRManifest` structure](#changed-ssrmanifest-interface-structure-adapter-api)
- [generating routes with `RouteData`](#removed-routedatagenerate-adapter-api)
- [routes with percent-encoded percent signs (e.g. `%25`)](#removed-percent-encoding-in-routes)
- [`astro:ssr-manifest` virtual module](#removed-astrossr-manifest-virtual-module-integration-api)

## Legacy

The following features are now considered legacy features. They should function normally but are no longer recommended and are in maintenance mode. They will see no future improvements and documentation will not be updated. These features will eventually be deprecated, and then removed entirely.
Expand Down Expand Up @@ -452,6 +466,61 @@ import {

<ReadMore>Learn more about all utilities available in the [Actions API Reference](/en/reference/modules/astro-actions/).</ReadMore>

### Removed: Percent-Encoding in routes

<SourcePR number="14306" title="feat: integrate vite environments"/>

In Astro 5.x, it was possible to include a percent-encoded percent sign (`%25`) in filenames.

Astro 6.0 removes support for the characters `%25` in filenames for security reasons. This restriction prevents encoding-based security bypasses where `%25` decodes to `%`, potentially leading to ambiguous or invalid encoding sequences.

#### What should I do?

If you have route files with `%25` in the filename, rename them to use a different character:

```bash del={1} ins={2}
src/pages/test%25file.astro
src/pages/test-file.astro
```

### Removed: `astro:ssr-manifest` virtual module (Integration API)

<SourcePR number="14306" title="feat: integrate vite environments"/>

In Astro 5.x, the deprecated `astro:ssr-manifest` virtual module could still be used to access configuration values.

Astro 6.0 removes the `astro:ssr-manifest` virtual module entirely. It is no longer used by integrations or internally by Astro. The manifest is now passed directly through integration hooks and adapter APIs rather than through a virtual module. For build-specific manifest data, use the `astro:build:ssr` integration hook, which receives the manifest as a parameter.

#### What should I do?

If your integration or code imports from `astro:ssr-manifest`, use `astro:config/server` instead to access configuration values:

```ts del={1} ins={2,3}
import { manifest } from 'astro:ssr-manifest';
import { srcDir, outDir, root } from 'astro:config/server';
// Use srcDir, outDir, root, etc. for configuration values
```

<ReadMore>Learn more about [the `astro:config` virtual module](/en/reference/modules/astro-config/).</ReadMore>

### Removed: `RouteData.generate()` (Adapter API)

<SourcePR number="14306" title="feat: integrate vite environments"/>

In Astro 5.x, routes could be generated using the `generate()` method on `RouteData`.

Astro 6.0 removes `RouteData.generate()` because route generation is now handled internally by Astro.

#### What should I do?

Remove any calls to `route.generate()` in your code. This method is no longer needed:

```ts del={1}
const generated = route.generate(params);
```

<ReadMore>Learn more about [the Adapter API](/en/reference/adapter-reference/).</ReadMore>

### Removed: `routes` on `astro:build:done` hook (Integration API)

<SourcePR number="14446" title="feat: cleanup integration api"/>
Expand Down Expand Up @@ -1051,6 +1120,76 @@ export function getStaticPaths() {

<ReadMore>Learn more about [dynamic SSG routes with `getStaticPaths()`](/en/guides/routing/#static-ssg-mode).</ReadMore>

### Changed: Integration hooks and HMR access patterns (Integration API)

<SourcePR number="14306" title="feat: integrate vite environments"/>

In Astro 5.x, Astro relied on certain patterns for integration hooks and HMR access that were incompatible with or could be improved by integrating Vite's Environment API.

Astro 6.0 uses Vite's new Environment API for build configuration and dev server interactions. This primarily enables dev mode in runtimes like workerd, but means that some integration hooks and HMR access patterns have changed.

#### What should I do?

**For integrations using `astro:build:setup`:**

The hook is now called once with all environments configured (`ssr`, `client`, `prerender`), instead of being called separately for each build target. Remove the `target` parameter and use `vite.environments` to configure specific environments:

```ts title="my-integration.mjs" del={3-7} ins={8-10}
{
hooks: {
'astro:build:setup': ({ target, vite }) => {
if (target === 'client') {
vite.build.minify = false;
}
}
'astro:build:setup': ({ vite }) => {
vite.environments.client.build.minify = false;
}
}
}
```

**For dev toolbar and integration code accessing HMR:**

Replace `server.hot.send()` with `server.environments.client.hot.send()`:

```ts del={1} ins={2}
server.hot.send(event)
server.environments.client.hot.send(event)
```

<ReadMore>Learn more about the [Vite Environment API](https://vite.dev/guide/api-environment) and Astro [integration hooks](/en/reference/integrations-reference/#astrobuildsetup).</ReadMore>

### Changed: `SSRManifest` interface structure (Adapter API)

<SourcePR number="14306" title="feat: integrate vite environments"/>

In Astro 5.x, path properties of the `SSRManifest` interface like `srcDir`, `outDir`, `cacheDir`, `publicDir`, `buildClientDir`, and `buildServerDir` were URL strings.

Astro 6.0 changes the form of these path properties to `URL` objects instead of URL strings. With this change, several new properties are now available on the manifest, and others have been updated or removed.

#### What should I do?

If you were treating these path properties as strings, you will now need to handle the `URL` object. For example, you will now need to access the `href` property of the `URL` object:

```ts del={2} ins={3}
// To retrieve the same format (e.g., "file:///path/to/src"), make the following change:
const srcPath = manifest.srcDir;
const srcPath = manifest.srcDir.href;
```

If you were accessing the `hrefRoot` property, you will need to remove it, as it is no longer available on the manifest.

Update any use of `serverIslandMappings` and `sessionDriver`. These are now async methods:

```ts del={1,2} ins={3,4}
const mappings = manifest.serverIslandMappings;
const driver = manifest.sessionDriver;
const mappings = await manifest.serverIslandMappings?.();
const driver = await manifest.sessionDriver?.();
```

<ReadMore>Learn more about [the Adapter API](/en/reference/adapter-reference/).</ReadMore>
### Changed: schema types are inferred instead of generated (Content Loader API)

<SourcePR number="14759" title="feat: loader.createSchema()" />
Expand Down
28 changes: 1 addition & 27 deletions src/content/docs/en/reference/integrations-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ interface AstroIntegration {
'astro:build:setup'?: (options: {
vite: vite.InlineConfig;
pages: Map<string, PageBuildData>;
target: 'client' | 'server';
updateConfig: (newConfig: vite.InlineConfig) => void;
logger: AstroIntegrationLogger;
}) => void | Promise<void>;
Expand Down Expand Up @@ -921,7 +920,6 @@ The address, family and port number supplied by the [Node.js Net module](https:/
'astro:build:setup'?: (options: {
vite: vite.InlineConfig;
pages: Map<string, PageBuildData>;
target: 'client' | 'server';
updateConfig: (newConfig: vite.InlineConfig) => void;
logger: AstroIntegrationLogger;
}) => void | Promise<void>;
Expand Down Expand Up @@ -976,30 +974,6 @@ export default {
}
```

#### `target` option

<p>

**Type:** `'client' | 'server'`
</p>

Builds are separated in two distinct phases: `client` and `server`. This option allow you to determine the current build phase.

This can be used to perform an action only in a specific phase:

```js
export default {
name: 'my-integration',
hooks: {
'astro:build:setup': ({ target }) => {
if (target === "server") {
// do something in server build phase
}
},
}
}
```

#### `updateConfig()` option

<p>
Expand Down Expand Up @@ -1049,7 +1023,7 @@ export default {

<p>

**Type:** [`SerializedSSRManifest`](https://github.com/withastro/astro/blob/3b10b97a4fecd1dfd959b160a07b5b8427fe40a7/packages/astro/src/core/app/types.ts#L91-L109)
**Type:** [`SerializedSSRManifest`](https://github.com/withastro/astro/blob/95a1969a05cc9c15f16dcf2177532882bb392581/packages/astro/src/core/app/types.ts#L126-L144)
</p>

Allows you to create a custom build by accessing the SSR manifest.
Expand Down