fix(deps): update dependency astro to ^4.9.1
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| astro (source) | ^4.8.4 -> ^4.9.1 |
Release Notes
withastro/astro (astro)
v4.9.1
Patch Changes
- #11129
4bb9269Thanks @matthewp! - Prevent errors from adapters when i18n domains is not used
v4.9.0
Minor Changes
-
#11051
12a1bccThanks @ematipico! - Introduces an experimental Container API to render.astrocomponents in isolation.This API introduces three new functions to allow you to create a new container and render an Astro component returning either a string or a Response:
create(): creates a new instance of the container.renderToString(): renders a component and return a string.renderToResponse(): renders a component and returns theResponseemitted by the rendering phase.
The first supported use of this new API is to enable unit testing. For example, with
vitest, you can create a container to render your component with test data and check the result:import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import { expect, test } from 'vitest'; import Card from '../src/components/Card.astro'; test('Card with slots', async () => { const container = await AstroContainer.create(); const result = await container.renderToString(Card, { slots: { default: 'Card content', }, }); expect(result).toContain('This is a card'); expect(result).toContain('Card content'); });For a complete reference, see the Container API docs.
For a feature overview, and to give feedback on this experimental API, see the Container API roadmap discussion.
-
#11021
2d4c8faThanks @ematipico! - The CSRF protection feature that was introduced behind a flag in v4.6.0 is no longer experimental and is available for general use.To enable the stable version, add the new top-level
securityoption inastro.config.mjs. If you were previously using the experimental version of this feature, also delete the experimental flag:export default defineConfig({ - experimental: { - security: { - csrfProtection: { - origin: true - } - } - }, + security: { + checkOrigin: true + } })Enabling this setting performs a check that the
"origin"header, automatically passed by all modern browsers, matches the URL sent by each Request.This check is executed only for pages rendered on demand, and only for the requests
POST,PATCH,DELETEandPUTwith one of the following"content-type"headers:'application/x-www-form-urlencoded','multipart/form-data','text/plain'.If the
"origin"header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page.For more information, see the
securityconfiguration docs. -
#11022
be68ab4Thanks @ematipico! - Thei18nDomainsrouting feature introduced behind a flag in v3.4.0 is no longer experimental and is available for general use.This routing option allows you to configure different domains for individual locales in entirely server-rendered projects using the @astrojs/node or @astrojs/vercel adapter with a
siteconfigured.If you were using this feature, please remove the experimental flag from your Astro config:
import { defineConfig } from 'astro' export default defineConfig({ - experimental: { - i18nDomains: true, - } })If you have been waiting for stabilization before using this routing option, you can now do so.
Please see the internationalization docs for more about this feature.
-
#11071
8ca7c73Thanks @bholmesdev! - Adds two new functionsexperimental_getActionState()andexperimental_withState()to support the React 19useActionState()hook when using Astro Actions. This introduces progressive enhancement when calling an Action with thewithState()utility.This example calls a
likeaction that accepts apostIdand returns the number of likes. Pass this action to theexperimental_withState()function to apply progressive enhancement info, and apply touseActionState()to track the result:import { actions } from 'astro:actions'; import { experimental_withState } from '@​astrojs/react/actions'; export function Like({ postId }: { postId: string }) { const [state, action, pending] = useActionState( experimental_withState(actions.like), 0 // initial likes ); return ( <form action={action}> <input type="hidden" name="postId" value={postId} /> <button disabled={pending}>{state} ❤️</button> </form> ); }You can also access the state stored by
useActionState()from your actionhandler. Callexperimental_getActionState()with the API context, and optionally apply a type to the result:import { defineAction, z } from 'astro:actions'; import { experimental_getActionState } from '@​astrojs/react/actions'; export const server = { like: defineAction({ input: z.object({ postId: z.string(), }), handler: async ({ postId }, ctx) => { const currentLikes = experimental_getActionState<number>(ctx); // write to database return currentLikes + 1; }, }), }; -
#11101
a6916e4Thanks @linguofeng! - Updates Astro's code for adapters to use the headerx-forwarded-forto initialize theclientAddress.To take advantage of the new change, integration authors must upgrade the version of Astro in their adapter
peerDependenciesto4.9.0. -
#11071
8ca7c73Thanks @bholmesdev! - Adds compatibility for Astro Actions in the React 19 beta. Actions can be passed to aform actionprop directly, and Astro will automatically add metadata for progressive enhancement.import { actions } from 'astro:actions'; function Like() { return ( <form action={actions.like}> {/* auto-inserts hidden input for progressive enhancement */} <button type="submit">Like</button> </form> ); }
Patch Changes
-
#11088
9566fa0Thanks @bholmesdev! - Allow actions to be called on the server. This allows you to call actions as utility functions in your Astro frontmatter, endpoints, and server-side UI components.Import and call directly from
astro:actionsas you would for client actions:
v4.8.7
Patch Changes
-
#11073
f5c8feeThanks @matthewp! - Prevent cache content from being left in dist folderWhen
contentCollectionsCacheis enabled temporary cached content is copied into theoutDirfor processing. This fixes it so that this content is cleaned out, along with the rest of the temporary build JS. -
#11054
f6b171eThanks @bholmesdev! - Respect error status when handling Actions with a progressive fallback. -
#11092
bfe9c73Thanks @duckycoding-dev! - Changeslotattribute ofIntrinsicAttributesto match the definition ofHTMLAttributes's ownslotattribute of typestring | undefined | null -
#10875
b5f95b2Thanks @W1M0R! - Fixes a typo in a JSDoc annotation -
#11111
a5d79ddThanks @bholmesdev! - Fix unexpectedheaderswarning on prerendered routes when using Astro Actions. -
#11081
af42e05Thanks @V3RON! - Correctly position inspection tooltip in RTL modeWhen RTL mode is turned on, the inspection tooltip tend to overflow the window on the left side. Additional check has been added to prevent that.
v4.8.6
Patch Changes
- #11084
9637014Thanks @bluwy! - Fixes regression when handling hoisted scripts from content collections
v4.8.5
Patch Changes
-
#11065
1f988edThanks @ematipico! - Fixes a bug in the Astro rewrite logic, where rewriting the index with parameters -next("/?foo=bar")- didn't work as expected. -
#10924
3a0c02aThanks @Its-Just-Nans! - Handle image-size errors by displaying a clearer message -
#11058
749a7acThanks @matthewp! - Fix streaming in Node.js fast path -
#11052
a05ca38Thanks @florian-lefebvre! - Fixes a case where rewriting would conflict with the actions internal middleware -
#11062
16f12e4Thanks @ematipico! - Fixes a bug whereastro builddidn't create custom404.htmland500.htmlwhen a certain combination of i18n options was applied -
#10965
a8f0372Thanks @Elias-Chairi! - Update generator.ts to allow %23 (#) in dynamic urls -
#11069
240a70aThanks @ematipico! - Improves debug logging for on-demand pages
Configuration
📅 Schedule: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
- [ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.