Skip to content

Commit a51b1f8

Browse files
shorten changesets and add link to specific v6 upgrade guide entry (#14728)
Co-authored-by: Florian Lefebvre <[email protected]>
1 parent 66d9d24 commit a51b1f8

20 files changed

+20
-461
lines changed

.changeset/beige-clowns-read.md

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,4 @@
22
'astro': major
33
---
44

5-
Removes `entryPoints` on `astro:build:ssr` hook (Integration API)
6-
7-
In Astro 5.0, `functionPerRoute` was deprecated. That meant that `entryPoints` on the `astro:build:ssr` hook was always empty. Astro integrations may have continued to work, even while `entryPoints` was not providing any useful data.
8-
9-
Astro 6.0 removes the `entryPoints` map passed to this hook entirely. Integrations may no longer include `entryPoints`.
10-
11-
#### What should I do?
12-
13-
Remove any instance of `entryPoints` passed to `astro:build:ssr`. This should be safe to remove because this logic was not providing any useful data, but you may need to restructure your code accordingly for its removal:
14-
15-
```diff
16-
// my-integration.mjs
17-
const integration = () => {
18-
return {
19-
name: 'my-integration',
20-
hooks: {
21-
'astro:build:ssr': (params) => {
22-
- someLogic(params.entryPoints)
23-
},
24-
}
25-
}
26-
}
27-
```
5+
Removes `entryPoints` on `astro:build:ssr` hook (Integration API) - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#removed-entrypoints-on-astrobuildssr-hook-integration-api))

.changeset/busy-olives-chew.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,4 @@
22
'astro': major
33
---
44

5-
Removes the deprecated `emitESMImage()` function
6-
7-
In Astro 5.6.2, the `emitESMImage()` function was deprecated in favor of `emitImageMetadata()`, which removes two deprecated arguments that were not meant to be exposed for public use: `_watchMode` and `experimentalSvgEnabled`.
8-
9-
Astro 6.0 removes `emitESMImage()` entirely. Update to `emitImageMetadata()` to keep your current behavior.
10-
11-
#### What should I do?
12-
13-
Replace all occurrences of the `emitESMImage()` with `emitImageMetadata()` and remove unused arguments:
14-
15-
```diff
16-
-import { emitESMImage } from 'astro/assets/utils';
17-
+import { emitImageMetadata } from 'astro/assets/utils';
18-
19-
const imageId = '/images/photo.jpg';
20-
-const result = await emitESMImage(imageId, false, false);
21-
+const result = await emitImageMetadata(imageId);
22-
```
5+
Removes the deprecated `emitESMImage()` function - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#removed-emitesmimage))

.changeset/cuddly-worlds-beam.md

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,4 @@
22
'astro': major
33
---
44

5-
Removes `routes` on `astro:build:done` hook (Integration API)
6-
7-
In Astro 5.0, accessing `routes` on the `astro:build:done` hook was deprecated in favour of a new `astro:routes:resolved` hook. However, Astro integrations may have continued to function using the `routes` array.
8-
9-
Astro 6.0 removes the `routes` array passed to this hook entirely. Instead, the `astro:routes:resolved` hook must be used.
10-
11-
#### What should I do?
12-
13-
Remove any instance of `routes` passed to `astro:build:done` in your Astro integration and replace it with the new `astro:routes:resolved` hook. You can access `distURL` on the newly exposed `assets` map:
14-
15-
```diff
16-
// my-integration.mjs
17-
const integration = () => {
18-
+ let routes
19-
return {
20-
name: 'my-integration',
21-
hooks: {
22-
+ 'astro:routes:resolved': (params) => {
23-
+ routes = params.routes
24-
+ },
25-
'astro:build:done': ({
26-
- routes
27-
+ assets
28-
}) => {
29-
+ for (const route of routes) {
30-
+ const distURL = assets.get(route.pattern)
31-
+ if (distURL) {
32-
+ Object.assign(route, { distURL })
33-
+ }
34-
+ }
35-
console.log(routes)
36-
}
37-
}
38-
}
39-
}
40-
```
5+
Removes `routes` on `astro:build:done` hook (Integration API) - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#removed-routes-on-astrobuilddone-hook-integration-api))

.changeset/cyan-crews-cross.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,4 @@
22
'astro': major
33
---
44

5-
Removes the old `app.render()` signature (Adapter API)
6-
7-
In Astro 4.0, the `app.render()` signature that allowed passing `routeData` and `locals` as optional arguments was deprecated in favor of a single optional `renderOptions` argument.
8-
9-
Astro 6.0 removes this signature entirely. Attempting to pass these separate arguments will now cause an error in your project.
10-
11-
#### What should I do?
12-
13-
Review your `app.render` calls and pass `routeData` and `locals` as properties of an object instead of as multiple independent arguments:
14-
15-
```diff
16-
// my-adapter/entrypoint.ts
17-
-app.render(request, routeData, locals)
18-
+app.render(request, { routeData, locals })
19-
```
5+
Removes the old `app.render()` signature (Adapter API) - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#removed-old-apprender-signature-adapter-api))

.changeset/dull-mangos-travel.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,4 @@
22
'astro': major
33
---
44

5-
Removes `prefetch()` `with` option
6-
7-
In Astro 4.8.4, the `with` option of the programmatic `prefetch()` function was deprecated in favor of a more sensible default behavior that no longer required specifying the priority of prefetching for each page.
8-
9-
Astro 6.0 removes this option entirely and it is no longer possible to configure the priority of prefetching by passing the `with` option. Attempting to do so will now cause errors.
10-
11-
By default, Astro's prefetching now uses an automatic approach that will always try to use `<link rel="prefetch>` if supported, or will fall back to `fetch()`.
12-
13-
#### What should I do?
14-
15-
Review your `prefetch()` calls and remove the `with` option if it still exists:
16-
17-
```diff
18-
-prefetch('/about', { with: 'fetch' });
19-
+prefetch('/about');
20-
```
5+
Removes `prefetch()` `with` option - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#removed-prefetch-with-option))

.changeset/fast-bushes-fall.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,5 @@
22
'astro': major
33
---
44

5-
Deprecates `Astro` in `getStaticPaths()`
6-
7-
In Astro 5.x, it was possible to access an `Astro` object inside `getStaticPaths()`. However, despite being typed the same as the `Astro` object accessible in the frontmatter, this object only had `site` and `generator` properties. This could lead to confusion about which `Astro` object properties were available inside `getStaticPaths()`.
8-
9-
Astro 6.0 deprecates this object for `getStaticPaths()` to avoid confusion and improves error handling when attempting to access `Astro` values that are unavailable. Using `Astro.site` or `Astro.generator` within `getStaticPaths()` will now log a deprecation warning, and accessing any other property will throw a specific error with a helpful message. In a future major version, this object will be removed entirely, and accessing `Astro.site` or `Astro.generator` will also throw an error.
10-
11-
#### What should I do?
12-
13-
Update your `getStaticPaths()` function if you were attempting to access any `Astro` properties inside its scope. Remove `Astro.generator` entirely, and replace all occurrences of `Astro.site()` with `import.meta.env.SITE`:
14-
15-
```diff
16-
---
17-
// src/pages/blog/[slug].astro
18-
import { getPages } from "../../../utils/data";
19-
20-
export async function getStaticPaths() {
21-
- console.log(Astro.generator);
22-
- return getPages(Astro.site);
23-
+ return getPages(import.meta.env.SITE);
24-
}
25-
---
26-
```
5+
Deprecates `Astro` in `getStaticPaths()` - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#deprecated-astro-in-getstaticpaths))
276

.changeset/giant-areas-press.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,4 @@
22
'astro': major
33
---
44

5-
Updates trailing slash behavior of endpoint URLs.
6-
7-
In Astro v5.0, custom endpoints whose URL ended in a file extension (e.g. `/src/pages/sitemap.xml.ts` ) could be accessed with a trailing slash (`/sitemap.xml/`) or without (`/sitemap.xml`), regardless of the value configured for `build.trailingSlash`.
8-
9-
In Astro v6.0, these endpoints can only be accessed without a trailing slash. This is true regardless of your `build.trailingSlash` configuration.
10-
11-
#### What should I do?
12-
13-
Review your links to your custom endpoints that include a file extension in the URL and remove any trailing slashes:
14-
15-
```diff
16-
-<a href="/sitemap.xml/">Sitemap</a>
17-
+<a href="/sitemap.xml">Sitemap</a>
18-
```
5+
Updates trailing slash behavior of endpoint URLs - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#changed-endpoints-with-a-file-extension-cannot-be-accessed-with-a-trailing-slash))

.changeset/good-camels-pull.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,4 @@
55
'astro': major
66
---
77

8-
Updates Markdown heading ID generation
9-
10-
In Astro 5.x, an additional default processing step to Markdown stripped trailing hyphens from the end of IDs for section headings ending in special characters. This provided a cleaner `id` value, but could lead to incompatibilities rendering your Markdown across platforms.
11-
12-
In Astro 5.5, the `experimental.headingIdCompat` flag was introduced to allow you to make the IDs generated by Astro for Markdown headings compatible with common platforms like GitHub and npm, using the popular [`github-slugger`](https://github.com/Flet/github-slugger) package.
13-
14-
Astro 6.0 removes this experimental flag and makes this the new default behavior in Astro: trailing hyphens from the end of IDs for headings ending in special characters are no longer removed.
15-
16-
#### What should I do?
17-
18-
If you have manual links to headings, you may need to update some anchor link values with a new trailing hyphen.
19-
20-
If you were previously using this experimental feature, remove this experimental flag from your configuration.
21-
22-
If you were previously using the `rehypeHeadingIds` plugin directly to enforce compatibility, remove the `headingIdCompat` option as it no longer exists.
23-
24-
See the [Astro 6.0 upgrade guide](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-markdown-heading-id-generation) for upgrade examples, and instructions to create a custom rehype plulgin if you want to keep the old ID generation for backward compatibility reasons.
8+
Updates Markdown heading ID generation - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#changed-markdown-heading-id-generation))

.changeset/green-garlics-heal.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,4 @@
22
'astro': major
33
---
44

5-
Deprecates `import.meta.env.ASSETS_PREFIX`
6-
7-
In Astro 5.x, it was possible to access `build.assetsPrefix` in your Astro config via the built-in environment variable `import.meta.env.ASSETS_PREFIX`. However, Astro v5.7.0 introduced the `astro:config` virtual model to expose a non-exhaustive, serializable, type-safe version of the Astro configuration which included access to `build.assetsPrefix` directly. This became the preferred way to access the prefix for Astro-generated asset links when set, although the environment variable still existed.
8-
9-
Astro 6.0 deprecates this variable in favor of `build.assetsPrefix` from the `astro:config/server` module.
10-
11-
#### What should I do?
12-
13-
Replace any occurances of `import.meta.env.ASSETS_PREFIX` with the `build.assetsPrefix` import from `astro:config/server`. This is a drop-in replacement to provide the existing value, and no other changes to your code should be necessary:
14-
15-
```diff
16-
import { someLogic } from "./utils"
17-
+import { build } from "astro:config/server"
18-
19-
-someLogic(import.meta.env.ASSETS_PREFIX)
20-
+someLogic(build.assetsPrefix)
21-
```
5+
Deprecates `import.meta.env.ASSETS_PREFIX` - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#deprecated-importmetaenvassets_prefix))

.changeset/honest-deer-add.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,4 @@
22
'astro': major
33
---
44

5-
Changes the values allowed in `params` returned by `getStaticPaths()`.
6-
7-
In Astro 5.x, `getStaticPaths()` could return `params` of type number, which would always be stringified by Astro. However, that could be confusing because it conflicted with `Astro.params` types.
8-
9-
Astro 6.0 removes this behavior: `getStaticPaths()` must now return string or undefined `params` values.
10-
11-
#### What should I do?
12-
13-
Review your dynamic routes using `getStaticPaths()` and convert any number params to strings.
14-
15-
For more guidance, see [the v6 upgrade guide entry for this breaking change](https://docs.astro.build/en/guides/upgrade-to/v6/#changed-getstaticpaths-cannot-return-params-of-type-number).
5+
Changes the values allowed in `params` returned by `getStaticPaths()` - ([v6 upgrade guidance](https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#changed-getstaticpaths-cannot-return-params-of-type-number))

0 commit comments

Comments
 (0)