diff options
Diffstat (limited to '.changeset')
-rw-r--r-- | .changeset/blue-boats-relax.md | 9 | ||||
-rw-r--r-- | .changeset/chatty-teachers-sit.md | 5 | ||||
-rw-r--r-- | .changeset/config.json | 2 | ||||
-rw-r--r-- | .changeset/eighty-boxes-applaud.md | 48 | ||||
-rw-r--r-- | .changeset/five-jars-hear.md | 11 | ||||
-rw-r--r-- | .changeset/healthy-ads-scream.md | 13 | ||||
-rw-r--r-- | .changeset/itchy-toys-march.md | 17 | ||||
-rw-r--r-- | .changeset/long-months-rule.md | 19 | ||||
-rw-r--r-- | .changeset/many-garlics-lick.md | 14 | ||||
-rw-r--r-- | .changeset/modern-bears-deny.md | 16 | ||||
-rw-r--r-- | .changeset/nasty-crabs-worry.md | 25 | ||||
-rw-r--r-- | .changeset/neat-dots-hear.md | 11 | ||||
-rw-r--r-- | .changeset/perfect-fans-fly.md | 7 | ||||
-rw-r--r-- | .changeset/poor-frogs-dream.md | 7 | ||||
-rw-r--r-- | .changeset/pre.json | 61 | ||||
-rw-r--r-- | .changeset/quick-ads-exercise.md | 10 | ||||
-rw-r--r-- | .changeset/selfish-impalas-grin.md | 6 | ||||
-rw-r--r-- | .changeset/small-ties-sort.md | 50 | ||||
-rw-r--r-- | .changeset/spotty-garlics-cheat.md | 22 | ||||
-rw-r--r-- | .changeset/ten-students-repair.md | 14 | ||||
-rw-r--r-- | .changeset/twenty-cobras-push.md | 32 |
21 files changed, 398 insertions, 1 deletions
diff --git a/.changeset/blue-boats-relax.md b/.changeset/blue-boats-relax.md new file mode 100644 index 000000000..93d9b51ca --- /dev/null +++ b/.changeset/blue-boats-relax.md @@ -0,0 +1,9 @@ +--- +'astro': major +--- + +Unflag globalRoutePriority + +The previously experimental feature `globalRoutePriority` is now the default in Astro 5. + +This was a refactoring of route prioritization in Astro, making it so that injected routes, file-based routes, and redirects are all prioritized using the same logic. This feature has been enabled for all Starlight projects since it was added and should not affect most users. diff --git a/.changeset/chatty-teachers-sit.md b/.changeset/chatty-teachers-sit.md new file mode 100644 index 000000000..9e4fd89b4 --- /dev/null +++ b/.changeset/chatty-teachers-sit.md @@ -0,0 +1,5 @@ +--- +"astro": major +--- + +The lowest version of Node supported by Astro is now Node v18.17.1 and higher. diff --git a/.changeset/config.json b/.changeset/config.json index 030941db2..7920f52b8 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -4,7 +4,7 @@ "commit": false, "linked": [], "access": "public", - "baseBranch": "main", + "baseBranch": "next", "updateInternalDependencies": "patch", "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { "onlyUpdatePeerDependentsWhenOutOfRange": true diff --git a/.changeset/eighty-boxes-applaud.md b/.changeset/eighty-boxes-applaud.md new file mode 100644 index 000000000..a732758cb --- /dev/null +++ b/.changeset/eighty-boxes-applaud.md @@ -0,0 +1,48 @@ +--- +'astro': major +--- + +The `astro:env` feature introduced behind a flag in [v4.10.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#x4100) is no longer experimental and is available for general use. If you have been waiting for stabilization before using `astro:env`, you can now do so. + +This feature lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client. + +To configure a schema, add the `env` option to your Astro config and define your client and server variables. If you were previously using this feature, please remove the experimental flag from your Astro config and move your entire `env` configuration unchanged to a top-level option. + +```js +import { defineConfig, envField } from 'astro/config' + +export default defineConfig({ + env: { + schema: { + API_URL: envField.string({ context: "client", access: "public", optional: true }), + PORT: envField.number({ context: "server", access: "public", default: 4321 }), + API_SECRET: envField.string({ context: "server", access: "secret" }), + } + } +}) +``` + +You can import and use your defined variables from the appropriate `/client` or `/server` module: + +```astro +--- +import { API_URL } from "astro:env/client" +import { API_SECRET_TOKEN } from "astro:env/server" + +const data = await fetch(`${API_URL}/users`, { + method: "GET", + headers: { + "Content-Type": "application/json", + "Authorization": `Bearer ${API_SECRET_TOKEN}` + }, +}) +--- + +<script> +import { API_URL } from "astro:env/client" + +fetch(`${API_URL}/ping`) +</script> +``` + +Please see our [guide to using environment variables](https://docs.astro.build/en/guides/environment-variables/#astroenv) for more about this feature. diff --git a/.changeset/five-jars-hear.md b/.changeset/five-jars-hear.md new file mode 100644 index 000000000..1385c7f03 --- /dev/null +++ b/.changeset/five-jars-hear.md @@ -0,0 +1,11 @@ +--- +'astro': patch +--- + +Updates Astro's default `<script>` rendering strategy and removes the `experimental.directRenderScript` option as this is now the default behavior: scripts are always rendered directly. This new strategy prevents scripts from being executed in pages where they are not used. + +Scripts will directly render as declared in Astro files (including existing features like TypeScript, importing `node_modules`, and deduplicating scripts). You can also now conditionally render scripts in your Astro file. + +However, this means scripts are no longer hoisted to the `<head>`, multiple scripts on a page are no longer bundled together, and the `<script>` tag may interfere with the CSS styling. + +As this is a potentially breaking change to your script behavior, please review your `<script>` tags and ensure that they behave as expected. diff --git a/.changeset/healthy-ads-scream.md b/.changeset/healthy-ads-scream.md new file mode 100644 index 000000000..f78bd6d52 --- /dev/null +++ b/.changeset/healthy-ads-scream.md @@ -0,0 +1,13 @@ +--- +'astro': patch +--- + +Use GET requests with preloading for Server Islands + +Server Island requests include the props used to render the island as well as any slots passed in (excluding the fallback slot). Since browsers have a max 4mb URL length we default to using a POST request to avoid overflowing this length. + +However in reality most usage of Server Islands are fairly isolated and won't exceed this limit, so a GET request is possible by passing this same information via search parameters. + +Using GET means we can also include a `<link rel="preload">` tag to speed up the request. + +This change implements this, with safe fallback to POST. diff --git a/.changeset/itchy-toys-march.md b/.changeset/itchy-toys-march.md new file mode 100644 index 000000000..972923ecf --- /dev/null +++ b/.changeset/itchy-toys-march.md @@ -0,0 +1,17 @@ +--- +'astro': major +--- + +Updates the default value of `security.checkOrigin` to `true`, which enables Cross-Site Request Forgery (CSRF) protection by default for pages rendered on demand. + +If you had previously configured `security.checkOrigin: true`, you no longer need this set in your Astro config. This is now the default and it is safe to remove. + +To disable this behavior and opt out of automatically checking that the “origin” header matches the URL sent by each request, you must explicitly set `security.checkOrigin: false`: + +```diff +export default defineConfig({ ++ security: { ++ checkOrigin: false ++ } +}) +``` diff --git a/.changeset/long-months-rule.md b/.changeset/long-months-rule.md new file mode 100644 index 000000000..2e44f0793 --- /dev/null +++ b/.changeset/long-months-rule.md @@ -0,0 +1,19 @@ +--- +'astro': major +--- + +Deprecate Astro.glob + +The `Astro.glob` function has been deprecated in favor of Content Collections and `import.meta.glob`. + +- If you want to query for markdown and MDX in your project, use Content Collections. +- If you want to query source files in your project, use `import.meta.glob`(https://vitejs.dev/guide/features.html#glob-import). + +Also consider using glob packages from npm, like [fast-glob](https://www.npmjs.com/package/fast-glob), especially if statically generating your site, as it is faster for most use-cases. + +The easiest path is to migrate to `import.meta.glob` like so: + +```diff +- const posts = Astro.glob('./posts/*.md'); ++ const posts = Object.values(import.meta.glob('./posts/*.md', { eager: true })); +``` diff --git a/.changeset/many-garlics-lick.md b/.changeset/many-garlics-lick.md new file mode 100644 index 000000000..12ac2dd7c --- /dev/null +++ b/.changeset/many-garlics-lick.md @@ -0,0 +1,14 @@ +--- +'astro': major +--- + +Removes internal JSX handling and moves the responsibility to the `@astrojs/mdx` package directly. The following exports are also now removed: + +- `astro/jsx/babel.js` +- `astro/jsx/component.js` +- `astro/jsx/index.js` +- `astro/jsx/renderer.js` +- `astro/jsx/server.js` +- `astro/jsx/transform-options.js` + +If your project includes `.mdx` files, you must upgrade `@astrojs/mdx` to the latest version so that it doesn't rely on these entrypoints to handle your JSX. diff --git a/.changeset/modern-bears-deny.md b/.changeset/modern-bears-deny.md new file mode 100644 index 000000000..876535a5c --- /dev/null +++ b/.changeset/modern-bears-deny.md @@ -0,0 +1,16 @@ +--- +'astro': major +--- + +Makes the `compiledContent` property of Markdown content an async function, this change should fix underlying issues where sometimes when using a custom image service and images inside Markdown, Node would exit suddenly without any error message. + +```diff +--- +import * as myPost from "../post.md"; + +- const content = myPost.compiledContent(); ++ const content = await myPost.compiledContent(); +--- + +<Fragment set:html={content} /> +``` diff --git a/.changeset/nasty-crabs-worry.md b/.changeset/nasty-crabs-worry.md new file mode 100644 index 000000000..10ad6ed33 --- /dev/null +++ b/.changeset/nasty-crabs-worry.md @@ -0,0 +1,25 @@ +--- +'astro': minor +--- + +Adds a new property to the globals `Astro` and `APIContext` called `routePattern`. The `routePattern` represents the current route (component) +that is being rendered by Astro. It's usually a path pattern will look like this: `blog/[slug]`: + +```asto +--- +// src/pages/blog/[slug].astro +const route = Astro.routePattern; +console.log(route); // it will log "blog/[slug]" +--- +``` + +```js +// src/pages/index.js + +export const GET = (ctx) => { + console.log(ctx.routePattern) // it will log src/pages/index.js + return new Response.json({ loreum: "ipsum" }) +} +``` + + diff --git a/.changeset/neat-dots-hear.md b/.changeset/neat-dots-hear.md new file mode 100644 index 000000000..567e5c22e --- /dev/null +++ b/.changeset/neat-dots-hear.md @@ -0,0 +1,11 @@ +--- +'astro': major +--- + +Prevent usage of `astro:content` in the client + +Usage of `astro:content` in the client has always been discouraged because it leads to all of your content winding up in your client bundle, and can possibly leaks secrets. + +This formally makes doing so impossible, adding to the previous warning with errors. + +In the future Astro might add APIs for client-usage based on needs. diff --git a/.changeset/perfect-fans-fly.md b/.changeset/perfect-fans-fly.md new file mode 100644 index 000000000..cdecf6fb1 --- /dev/null +++ b/.changeset/perfect-fans-fly.md @@ -0,0 +1,7 @@ +--- +'@astrojs/mdx': minor +--- + +Updates adapter server entrypoint to use `@astrojs/mdx/server.js` + +This is an internal change. Handling JSX in your `.mdx` files has been moved from Astro internals and is now the responsibility of this integration. You should not notice a change in your project, and no update to your code is required. diff --git a/.changeset/poor-frogs-dream.md b/.changeset/poor-frogs-dream.md new file mode 100644 index 000000000..fdb3daa85 --- /dev/null +++ b/.changeset/poor-frogs-dream.md @@ -0,0 +1,7 @@ +--- +'astro': major +--- + +Refactor the exported types from the `astro` module. There should normally be no breaking changes, but if you relied on some previously deprecated types, these might now have been fully removed. + +In most cases, updating your code to move away from previously deprecated APIs in previous versions of Astro should be enough to fix any issues. diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 000000000..9e9ee0ffa --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,61 @@ +{ + "mode": "pre", + "tag": "alpha", + "initialVersions": { + "astro": "4.13.1", + "@astrojs/prism": "3.1.0", + "@astrojs/rss": "4.0.7", + "create-astro": "4.8.1", + "@astrojs/db": "0.12.0", + "@astrojs/alpinejs": "0.4.0", + "@astrojs/cloudflare": "0.0.0", + "@astrojs/lit": "4.3.0", + "@astrojs/markdoc": "0.11.3", + "@astrojs/mdx": "3.1.3", + "@astrojs/netlify": "0.0.0", + "@astrojs/node": "8.3.2", + "@astrojs/partytown": "2.1.1", + "@astrojs/preact": "3.5.1", + "@astrojs/react": "3.6.1", + "@astrojs/sitemap": "3.1.6", + "@astrojs/solid-js": "4.4.0", + "@astrojs/svelte": "5.7.0", + "@astrojs/tailwind": "5.1.0", + "@astrojs/vercel": "7.7.2", + "@astrojs/vue": "4.5.0", + "@astrojs/web-vitals": "1.0.0", + "@astrojs/internal-helpers": "0.4.1", + "@astrojs/markdown-remark": "5.2.0", + "@astrojs/studio": "0.1.1", + "@astrojs/telemetry": "3.1.0", + "@astrojs/underscore-redirects": "0.3.4", + "@astrojs/upgrade": "0.3.1" + }, + "changesets": [ + "blue-boats-relax", + "chatty-teachers-sit", + "eighty-boxes-applaud", + "fair-rats-fail", + "healthy-ads-scream", + "itchy-toys-march", + "long-months-burn", + "many-garlics-lick", + "mighty-trees-teach", + "modern-bears-deny", + "new-pillows-kick", + "odd-donuts-impress", + "perfect-fans-fly", + "poor-frogs-dream", + "quick-ads-exercise", + "selfish-impalas-grin", + "small-ties-sort", + "smart-comics-doubt", + "smooth-melons-cough", + "spicy-houses-fry", + "spotty-garlics-cheat", + "ten-students-repair", + "tiny-lamps-lick", + "weak-dancers-beam", + "weak-masks-do" + ] +} diff --git a/.changeset/quick-ads-exercise.md b/.changeset/quick-ads-exercise.md new file mode 100644 index 000000000..dd4285a4c --- /dev/null +++ b/.changeset/quick-ads-exercise.md @@ -0,0 +1,10 @@ +--- +'@astrojs/markdown-remark': major +--- + +Renames the following CSS variables theme color token names to better align with the Shiki v1 defaults: + +- `--astro-code-color-text` => `--astro-code-foreground` +- `--astro-code-color-background` => `--astro-code-background` + +You can perform a global find and replace in your project to migrate to the new token names. diff --git a/.changeset/selfish-impalas-grin.md b/.changeset/selfish-impalas-grin.md new file mode 100644 index 000000000..d2319c3d8 --- /dev/null +++ b/.changeset/selfish-impalas-grin.md @@ -0,0 +1,6 @@ +--- +'@astrojs/vercel': major +'@astrojs/node': major +--- + +Adds stable support for `astro:env` diff --git a/.changeset/small-ties-sort.md b/.changeset/small-ties-sort.md new file mode 100644 index 000000000..e3f3d67eb --- /dev/null +++ b/.changeset/small-ties-sort.md @@ -0,0 +1,50 @@ +--- +'astro': major +--- + +Fixes attribute rendering for non-[boolean HTML attributes](https://developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML) with boolean values to match proper attribute handling in browsers. + +Previously, non-boolean attributes may not have included their values when rendered to HTML. In Astro v5.0, the values are now explicitly rendered as `="true"` or `="false"` + +In the following `.astro` examples, only `allowfullscreen` is a boolean attribute: + +```astro +<!-- src/pages/index.astro --> +<!-- `allowfullscreen` is a boolean attribute --> +<p allowfullscreen={true}></p> +<p allowfullscreen={false}></p> + +<!-- `inherit` is *not* a boolean attribute --> +<p inherit={true}></p> +<p inherit={false}></p> + +<!-- `data-*` attributes are not boolean attributes --> +<p data-light={true}></p> +<p data-light={false}></p> +``` + +Astro v5.0 now preserves the full data attribute with its value when rendering the HTML of non-boolean attributes: + +```diff + <p allowfullscreen></p> + <p></p> + + <p inherit="true"></p> +- <p inherit></p> ++ <p inherit="false"></p> + +- <p data-light></p> ++ <p data-light="true"></p> +- <p></p> ++ <p data-light="false"></p> +``` + +If you rely on attribute values, for example to locate elements or to conditionally render, update your code to match the new non-boolean attribute values: + +```diff +- el.getAttribute('inherit') === '' ++ el.getAttribute('inherit') === 'false' + +- el.hasAttribute('data-light') ++ el.dataset.light === 'true' +``` diff --git a/.changeset/spotty-garlics-cheat.md b/.changeset/spotty-garlics-cheat.md new file mode 100644 index 000000000..3d9a3cfc1 --- /dev/null +++ b/.changeset/spotty-garlics-cheat.md @@ -0,0 +1,22 @@ +--- +'@astrojs/vercel': major +'@astrojs/node': major +'astro': major +--- + +Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro. + +Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained. + +```diff +- import { squooshImageService } from "astro/config"; +import { defineConfig } from "astro/config"; + +export default defineConfig({ +- image: { +- service: squooshImageService() +- } +}); +``` + +If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh diff --git a/.changeset/ten-students-repair.md b/.changeset/ten-students-repair.md new file mode 100644 index 000000000..bffa74548 --- /dev/null +++ b/.changeset/ten-students-repair.md @@ -0,0 +1,14 @@ +--- +'@astrojs/vercel': major +'astro': major +--- + +Remove support for functionPerRoute + +This change removes support for the `functionPerRoute` option both in Astro and `@astrojs/vercel`. + +This option made it so that each route got built as separate entrypoints so that they could be loaded as separate functions. The hope was that by doing this it would decrease the size of each function. However in practice routes use most of the same code, and increases in function size limitations made the potential upsides less important. + +Additionally there are downsides to functionPerRoute, such as hitting limits on the number of functions per project. The feature also never worked with some Astro features like i18n domains and request rewriting. + +Given this, the feature has been removed from Astro. diff --git a/.changeset/twenty-cobras-push.md b/.changeset/twenty-cobras-push.md new file mode 100644 index 000000000..5555cdc61 --- /dev/null +++ b/.changeset/twenty-cobras-push.md @@ -0,0 +1,32 @@ +--- +'astro': major +--- + +Changes the data returned for `page.url.current`, `page.url.next`, `page.url.prev`, `page.url.first` and `page.url.last` to include the value set for `base` in your Astro config. + +Previously, you had to manually prepend your configured value for `base` to the URL path. Now, Astro automatically includes your `base` value in `next` and `prev` URLs. + +If you are using the `paginate()` function for "previous" and "next" URLs, remove any existing `base` value as it is now added for you: + +```diff +--- +export async function getStaticPaths({ paginate }) { + const astronautPages = [{ + astronaut: 'Neil Armstrong', + }, { + astronaut: 'Buzz Aldrin', + }, { + astronaut: 'Sally Ride', + }, { + astronaut: 'John Glenn', + }]; + return paginate(astronautPages, { pageSize: 1 }); +} +const { page } = Astro.props; +// `base: /'docs'` configured in `astro.config.mjs` +- const prev = "/docs" + page.url.prev; ++ const prev = page.url.prev; +--- +<a id="prev" href={prev}>Back</a> +``` + |