From 50775925f9b2b50c3259dfd3d6f687d9af454884 Mon Sep 17 00:00:00 2001 From: "Houston (Bot)" <108291165+astrobot-houston@users.noreply.github.com> Date: Thu, 23 May 2024 03:06:20 -0700 Subject: [PATCH] [ci] release (#11116) Co-authored-by: github-actions[bot] --- .changeset/brave-colts-cover.md | 35 ---- .changeset/chatty-experts-smell.md | 30 --- .changeset/eighty-taxis-wait.md | 16 -- .changeset/five-crabs-rhyme.md | 23 --- .changeset/gentle-windows-enjoy.md | 46 ----- .changeset/healthy-planets-dream.md | 7 - .changeset/six-icons-pump.md | 24 --- .changeset/sweet-needles-juggle.md | 21 -- .changeset/three-bikes-stare.md | 5 - .changeset/twenty-cycles-bathe.md | 18 -- examples/basics/package.json | 2 +- examples/blog/package.json | 2 +- examples/component/package.json | 2 +- examples/container-with-vitest/package.json | 4 +- examples/framework-alpine/package.json | 2 +- examples/framework-lit/package.json | 2 +- examples/framework-multiple/package.json | 6 +- examples/framework-preact/package.json | 2 +- examples/framework-react/package.json | 4 +- examples/framework-solid/package.json | 2 +- examples/framework-svelte/package.json | 2 +- examples/framework-vue/package.json | 4 +- examples/hackernews/package.json | 2 +- examples/integration/package.json | 2 +- examples/middleware/package.json | 2 +- examples/minimal/package.json | 2 +- examples/non-html-pages/package.json | 2 +- examples/portfolio/package.json | 2 +- examples/ssr/package.json | 2 +- examples/starlog/package.json | 2 +- examples/toolbar-app/package.json | 2 +- examples/view-transitions/package.json | 2 +- examples/with-markdoc/package.json | 2 +- examples/with-markdown-plugins/package.json | 2 +- examples/with-markdown-shiki/package.json | 2 +- examples/with-mdx/package.json | 2 +- examples/with-nanostores/package.json | 2 +- examples/with-tailwindcss/package.json | 2 +- examples/with-vitest/package.json | 2 +- packages/astro/CHANGELOG.md | 181 ++++++++++++++++++ packages/astro/package.json | 2 +- packages/integrations/react/CHANGELOG.md | 47 +++++ packages/integrations/react/package.json | 2 +- packages/integrations/vue/CHANGELOG.md | 22 +++ packages/integrations/vue/package.json | 2 +- packages/integrations/web-vitals/CHANGELOG.md | 6 + packages/integrations/web-vitals/package.json | 2 +- pnpm-lock.yaml | 68 +++---- 48 files changed, 328 insertions(+), 297 deletions(-) delete mode 100644 .changeset/brave-colts-cover.md delete mode 100644 .changeset/chatty-experts-smell.md delete mode 100644 .changeset/eighty-taxis-wait.md delete mode 100644 .changeset/five-crabs-rhyme.md delete mode 100644 .changeset/gentle-windows-enjoy.md delete mode 100644 .changeset/healthy-planets-dream.md delete mode 100644 .changeset/six-icons-pump.md delete mode 100644 .changeset/sweet-needles-juggle.md delete mode 100644 .changeset/three-bikes-stare.md delete mode 100644 .changeset/twenty-cycles-bathe.md diff --git a/.changeset/brave-colts-cover.md b/.changeset/brave-colts-cover.md deleted file mode 100644 index 1819588021..0000000000 --- a/.changeset/brave-colts-cover.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -"astro": minor ---- - -Introduces an experimental Container API to render `.astro` components 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 the `Response` emitted 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: - -```js -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](/en/reference/container-reference/). - -For a feature overview, and to give feedback on this experimental API, see the [Container API roadmap discussion](https://github.com/withastro/roadmap/pull/916). diff --git a/.changeset/chatty-experts-smell.md b/.changeset/chatty-experts-smell.md deleted file mode 100644 index c9ac56f374..0000000000 --- a/.changeset/chatty-experts-smell.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -"astro": minor ---- - -The CSRF protection feature that was introduced behind a flag in [v4.6.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#460) is no longer experimental and is available for general use. - -To enable the stable version, add the new top-level `security` option in `astro.config.mjs`. If you were previously using the experimental version of this feature, also delete the experimental flag: - -```diff -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`, `DELETE` and `PUT` with 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 [`security` configuration docs](https://docs.astro.build/en/reference/configuration-reference/#security). diff --git a/.changeset/eighty-taxis-wait.md b/.changeset/eighty-taxis-wait.md deleted file mode 100644 index 889df38309..0000000000 --- a/.changeset/eighty-taxis-wait.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -"astro": patch ---- - -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:actions` as you would for client actions: - -```astro ---- -// src/pages/blog/[postId].astro -import { actions } from 'astro:actions'; - -await actions.like({ postId: Astro.params.postId }); ---- -``` diff --git a/.changeset/five-crabs-rhyme.md b/.changeset/five-crabs-rhyme.md deleted file mode 100644 index 49ba58aa5c..0000000000 --- a/.changeset/five-crabs-rhyme.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -"astro": minor ---- - -The `i18nDomains` routing feature introduced behind a flag in [v3.4.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#430) 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](https://docs.astro.build/en/guides/integrations-guide/node/) or [@astrojs/vercel](https://docs.astro.build/en/guides/integrations-guide/vercel/) adapter with a `site` configured. - -If you were using this feature, please remove the experimental flag from your Astro config: - -```diff -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](https://docs.astro.build/en/guides/internationalization/#domains) for more about this feature. diff --git a/.changeset/gentle-windows-enjoy.md b/.changeset/gentle-windows-enjoy.md deleted file mode 100644 index 6087cd3248..0000000000 --- a/.changeset/gentle-windows-enjoy.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -"@astrojs/react": minor -"astro": minor ---- - -Adds two new functions `experimental_getActionState()` and `experimental_withState()` to support [the React 19 `useActionState()` hook](https://react.dev/reference/react/useActionState) when using Astro Actions. This introduces progressive enhancement when calling an Action with the `withState()` utility. - -This example calls a `like` action that accepts a `postId` and returns the number of likes. Pass this action to the `experimental_withState()` function to apply progressive enhancement info, and apply to `useActionState()` to track the result: - -```tsx -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 ( -
- - -
- ); -} -``` - -You can also access the state stored by `useActionState()` from your action `handler`. Call `experimental_getActionState()` with the API context, and optionally apply a type to the result: - -```ts -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(ctx); - // write to database - return currentLikes + 1; - } - }) -} diff --git a/.changeset/healthy-planets-dream.md b/.changeset/healthy-planets-dream.md deleted file mode 100644 index 52f42fc5e9..0000000000 --- a/.changeset/healthy-planets-dream.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"astro": minor ---- - -Updates Astro's code for adapters to use the header `x-forwarded-for` to initialize the `clientAddress`. - -To take advantage of the new change, integration authors must upgrade the version of Astro in their adapter `peerDependencies` to `4.9.0`. diff --git a/.changeset/six-icons-pump.md b/.changeset/six-icons-pump.md deleted file mode 100644 index c3246c3443..0000000000 --- a/.changeset/six-icons-pump.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -"astro": patch ---- - -Deprecate the `getApiContext()` function. API Context can now be accessed from the second parameter to your Action `handler()`: - -```diff -// src/actions/index.ts -import { - defineAction, - z, -- getApiContext, -} from 'astro:actions'; - -export const server = { - login: defineAction({ - input: z.object({ id: z.string }), -+ handler(input, context) { - const user = context.locals.auth(input.id); - return user; - } - }), -} -``` diff --git a/.changeset/sweet-needles-juggle.md b/.changeset/sweet-needles-juggle.md deleted file mode 100644 index 5588483e3b..0000000000 --- a/.changeset/sweet-needles-juggle.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -"@astrojs/vue": minor ---- - -Updates the `devtools` type to allow passing `VueDevToolsOptions` - -For more customization, you can pass options that the [Vue DevTools Vite Plugin](https://devtools-next.vuejs.org/guide/vite-plugin#options) supports. (Note: `appendTo` is not supported.) For example, you can set `launchEditor` to your preferred editor if you are not using Visual Studio Code: - -```js title="astro.config.mjs" -import { defineConfig } from "astro/config"; -import vue from "@astrojs/vue"; - -export default defineConfig({ - // ... - integrations: [ - vue({ - devtools: { launchEditor: "webstorm" }, - }), - ], -}); -``` diff --git a/.changeset/three-bikes-stare.md b/.changeset/three-bikes-stare.md deleted file mode 100644 index bc5915b92f..0000000000 --- a/.changeset/three-bikes-stare.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@astrojs/web-vitals": patch ---- - -Fixes requests to the web vitals endpoint in setups like Vercel’s `trailingSlash: true` that redirect from `/web-vitals` to `/web-vitals/` diff --git a/.changeset/twenty-cycles-bathe.md b/.changeset/twenty-cycles-bathe.md deleted file mode 100644 index 208d4cf499..0000000000 --- a/.changeset/twenty-cycles-bathe.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -"astro": minor ---- - -Adds compatibility for Astro Actions in the React 19 beta. Actions can be passed to a `form action` prop directly, and Astro will automatically add metadata for progressive enhancement. - -```tsx -import { actions } from 'astro:actions'; - -function Like() { - return ( -
- {/* auto-inserts hidden input for progressive enhancement */} - -
- ) -} -``` diff --git a/examples/basics/package.json b/examples/basics/package.json index 042be16549..2f341c81a6 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 7e9e13b099..1cc66e9ef9 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -14,6 +14,6 @@ "@astrojs/mdx": "^3.0.1", "@astrojs/rss": "^4.0.6", "@astrojs/sitemap": "^3.1.5", - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/component/package.json b/examples/component/package.json index c51e8398d5..4c7f73deb5 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.8.7" + "astro": "^4.9.0" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index 9885ba7182..46f66ebfa2 100644 --- a/examples/container-with-vitest/package.json +++ b/examples/container-with-vitest/package.json @@ -12,8 +12,8 @@ "test": "vitest run" }, "dependencies": { - "astro": "experimental--container", - "@astrojs/react": "^3.3.4", + "astro": "^4.9.0", + "@astrojs/react": "^3.4.0", "react": "^18.3.1", "react-dom": "^18.3.1", "vitest": "^1.6.0" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index fcdd504ee7..61f30548fa 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -14,6 +14,6 @@ "@astrojs/alpinejs": "^0.4.0", "@types/alpinejs": "^3.13.10", "alpinejs": "^3.13.10", - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index d6e6829a3c..f7a9079035 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/lit": "^4.0.1", "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "^4.8.7", + "astro": "^4.9.0", "lit": "^3.1.3" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 408a1aa8ce..949398fe70 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -12,13 +12,13 @@ }, "dependencies": { "@astrojs/preact": "^3.3.0", - "@astrojs/react": "^3.3.4", + "@astrojs/react": "^3.4.0", "@astrojs/solid-js": "^4.2.0", "@astrojs/svelte": "^5.4.0", - "@astrojs/vue": "^4.2.0", + "@astrojs/vue": "^4.3.0", "@types/react": "^18.3.2", "@types/react-dom": "^18.3.0", - "astro": "^4.8.7", + "astro": "^4.9.0", "preact": "^10.21.0", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 2688cd3430..ecec1c45d2 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.3.0", "@preact/signals": "^1.2.3", - "astro": "^4.8.7", + "astro": "^4.9.0", "preact": "^10.21.0" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index d549ccd278..5ca885f285 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -11,10 +11,10 @@ "astro": "astro" }, "dependencies": { - "@astrojs/react": "^3.3.4", + "@astrojs/react": "^3.4.0", "@types/react": "^18.3.2", "@types/react-dom": "^18.3.0", - "astro": "^4.8.7", + "astro": "^4.9.0", "react": "^18.3.1", "react-dom": "^18.3.1" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 3accbd2a61..5bef221c62 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/solid-js": "^4.2.0", - "astro": "^4.8.7", + "astro": "^4.9.0", "solid-js": "^1.8.17" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index b70c80ff39..e8e648959d 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/svelte": "^5.4.0", - "astro": "^4.8.7", + "astro": "^4.9.0", "svelte": "^4.2.16" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index f7503e770e..b678578f8f 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -11,8 +11,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/vue": "^4.2.0", - "astro": "^4.8.7", + "@astrojs/vue": "^4.3.0", + "astro": "^4.9.0", "vue": "^3.4.27" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index b1582ae2ae..366d2f5d6b 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/node": "^8.2.5", - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index 16759616ab..e1b210bd1f 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.8.7" + "astro": "^4.9.0" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index d385096384..b641f082d1 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@astrojs/node": "^8.2.5", - "astro": "^4.8.7", + "astro": "^4.9.0", "html-minifier": "^4.0.0" }, "devDependencies": { diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 1bd2b91d72..5aee6d1750 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index 3141f491ac..53939464db 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index aea146403e..c42351a18f 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 4e53b466e3..10e738e0cc 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -14,7 +14,7 @@ "dependencies": { "@astrojs/node": "^8.2.5", "@astrojs/svelte": "^5.4.0", - "astro": "^4.8.7", + "astro": "^4.9.0", "svelte": "^4.2.16" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index 84ba09182f..90360ec31f 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.8.7", + "astro": "^4.9.0", "sass": "^1.77.1", "sharp": "^0.33.3" } diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json index b39e7240e5..1e9317c331 100644 --- a/examples/toolbar-app/package.json +++ b/examples/toolbar-app/package.json @@ -15,6 +15,6 @@ "./app": "./dist/app.js" }, "devDependencies": { - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index c0e3969917..367c7c6c80 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -12,6 +12,6 @@ "devDependencies": { "@astrojs/tailwind": "^5.1.0", "@astrojs/node": "^8.2.5", - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 39853c3d88..e87db4b1db 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/markdoc": "^0.11.0", - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index dba2e0e02a..c3361b9d59 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^5.1.0", - "astro": "^4.8.7", + "astro": "^4.9.0", "hast-util-select": "^6.0.2", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 82676c5422..1bba70b667 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.8.7" + "astro": "^4.9.0" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index bfcf90777d..47931d8422 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/mdx": "^3.0.1", "@astrojs/preact": "^3.3.0", - "astro": "^4.8.7", + "astro": "^4.9.0", "preact": "^10.21.0" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 145be7afca..b912ea9ed2 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.3.0", "@nanostores/preact": "^0.5.1", - "astro": "^4.8.7", + "astro": "^4.9.0", "nanostores": "^0.10.3", "preact": "^10.21.0" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 9ee34bee43..8f5ffc8f50 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@astrojs/mdx": "^3.0.1", "@astrojs/tailwind": "^5.1.0", "@types/canvas-confetti": "^1.6.4", - "astro": "^4.8.7", + "astro": "^4.9.0", "autoprefixer": "^10.4.19", "canvas-confetti": "^1.9.3", "postcss": "^8.4.38", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 5a7ffb4c70..fd4993811f 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^4.8.7", + "astro": "^4.9.0", "vitest": "^1.6.0" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 1ebd0be0af..3666a72edc 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,186 @@ # astro +## 4.9.0 + +### Minor Changes + +- [#11051](https://github.com/withastro/astro/pull/11051) [`12a1bcc`](https://github.com/withastro/astro/commit/12a1bccc818af292cdd2a8ed0f3e3c042b9819b4) Thanks [@ematipico](https://github.com/ematipico)! - Introduces an experimental Container API to render `.astro` components 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 the `Response` emitted 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: + + ```js + 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](/en/reference/container-reference/). + + For a feature overview, and to give feedback on this experimental API, see the [Container API roadmap discussion](https://github.com/withastro/roadmap/pull/916). + +- [#11021](https://github.com/withastro/astro/pull/11021) [`2d4c8fa`](https://github.com/withastro/astro/commit/2d4c8faa56a64d963fe7847b5be2d7a59e12ed5b) Thanks [@ematipico](https://github.com/ematipico)! - The CSRF protection feature that was introduced behind a flag in [v4.6.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#460) is no longer experimental and is available for general use. + + To enable the stable version, add the new top-level `security` option in `astro.config.mjs`. If you were previously using the experimental version of this feature, also delete the experimental flag: + + ```diff + 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`, `DELETE` and `PUT` with 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 [`security` configuration docs](https://docs.astro.build/en/reference/configuration-reference/#security). + +- [#11022](https://github.com/withastro/astro/pull/11022) [`be68ab4`](https://github.com/withastro/astro/commit/be68ab47e236476ba980cbf74daf85f27cd866f4) Thanks [@ematipico](https://github.com/ematipico)! - The `i18nDomains` routing feature introduced behind a flag in [v3.4.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#430) 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](https://docs.astro.build/en/guides/integrations-guide/node/) or [@astrojs/vercel](https://docs.astro.build/en/guides/integrations-guide/vercel/) adapter with a `site` configured. + + If you were using this feature, please remove the experimental flag from your Astro config: + + ```diff + 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](https://docs.astro.build/en/guides/internationalization/#domains) for more about this feature. + +- [#11071](https://github.com/withastro/astro/pull/11071) [`8ca7c73`](https://github.com/withastro/astro/commit/8ca7c731dea894e77f84b314ebe3a141d5daa918) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Adds two new functions `experimental_getActionState()` and `experimental_withState()` to support [the React 19 `useActionState()` hook](https://react.dev/reference/react/useActionState) when using Astro Actions. This introduces progressive enhancement when calling an Action with the `withState()` utility. + + This example calls a `like` action that accepts a `postId` and returns the number of likes. Pass this action to the `experimental_withState()` function to apply progressive enhancement info, and apply to `useActionState()` to track the result: + + ```tsx + 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 ( +
+ + +
+ ); + } + ``` + + You can also access the state stored by `useActionState()` from your action `handler`. Call `experimental_getActionState()` with the API context, and optionally apply a type to the result: + + ```ts + 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(ctx); + // write to database + return currentLikes + 1; + }, + }), + }; + ``` + +- [#11101](https://github.com/withastro/astro/pull/11101) [`a6916e4`](https://github.com/withastro/astro/commit/a6916e4402bf5b7d74bab784a54eba63fd1d1179) Thanks [@linguofeng](https://github.com/linguofeng)! - Updates Astro's code for adapters to use the header `x-forwarded-for` to initialize the `clientAddress`. + + To take advantage of the new change, integration authors must upgrade the version of Astro in their adapter `peerDependencies` to `4.9.0`. + +- [#11071](https://github.com/withastro/astro/pull/11071) [`8ca7c73`](https://github.com/withastro/astro/commit/8ca7c731dea894e77f84b314ebe3a141d5daa918) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Adds compatibility for Astro Actions in the React 19 beta. Actions can be passed to a `form action` prop directly, and Astro will automatically add metadata for progressive enhancement. + + ```tsx + import { actions } from 'astro:actions'; + + function Like() { + return ( +
+ {/* auto-inserts hidden input for progressive enhancement */} + +
+ ); + } + ``` + +### Patch Changes + +- [#11088](https://github.com/withastro/astro/pull/11088) [`9566fa0`](https://github.com/withastro/astro/commit/9566fa08608be766df355be17d72a39ea7b99ed0) Thanks [@bholmesdev](https://github.com/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:actions` as you would for client actions: + + ```astro + --- + // src/pages/blog/[postId].astro + import { actions } from 'astro:actions'; + + await actions.like({ postId: Astro.params.postId }); + --- + ``` + +- [#11112](https://github.com/withastro/astro/pull/11112) [`29a8650`](https://github.com/withastro/astro/commit/29a8650375053cd5690a32bed4140f0fef11c705) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Deprecate the `getApiContext()` function. API Context can now be accessed from the second parameter to your Action `handler()`: + + ```diff + // src/actions/index.ts + import { + defineAction, + z, + - getApiContext, + } from 'astro:actions'; + + export const server = { + login: defineAction({ + input: z.object({ id: z.string }), + + handler(input, context) { + const user = context.locals.auth(input.id); + return user; + } + }), + } + ``` + ## 4.8.7 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 8d276aa8a2..c4751b3ed4 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.8.7", + "version": "4.9.0", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/packages/integrations/react/CHANGELOG.md b/packages/integrations/react/CHANGELOG.md index 8b12f15e95..707cbe033e 100644 --- a/packages/integrations/react/CHANGELOG.md +++ b/packages/integrations/react/CHANGELOG.md @@ -1,5 +1,52 @@ # @astrojs/react +## 3.4.0 + +### Minor Changes + +- [#11071](https://github.com/withastro/astro/pull/11071) [`8ca7c73`](https://github.com/withastro/astro/commit/8ca7c731dea894e77f84b314ebe3a141d5daa918) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Adds two new functions `experimental_getActionState()` and `experimental_withState()` to support [the React 19 `useActionState()` hook](https://react.dev/reference/react/useActionState) when using Astro Actions. This introduces progressive enhancement when calling an Action with the `withState()` utility. + + This example calls a `like` action that accepts a `postId` and returns the number of likes. Pass this action to the `experimental_withState()` function to apply progressive enhancement info, and apply to `useActionState()` to track the result: + + ```tsx + 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 ( +
+ + +
+ ); + } + ``` + + You can also access the state stored by `useActionState()` from your action `handler`. Call `experimental_getActionState()` with the API context, and optionally apply a type to the result: + + ```ts + 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(ctx); + // write to database + return currentLikes + 1; + }, + }), + }; + ``` + ## 3.3.4 ### Patch Changes diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 373e8f8489..3a5b6b6bf9 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/react", "description": "Use React components within Astro", - "version": "3.3.4", + "version": "3.4.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/vue/CHANGELOG.md b/packages/integrations/vue/CHANGELOG.md index b1f95541d2..acef2a55e9 100644 --- a/packages/integrations/vue/CHANGELOG.md +++ b/packages/integrations/vue/CHANGELOG.md @@ -1,5 +1,27 @@ # @astrojs/vue +## 4.3.0 + +### Minor Changes + +- [#11055](https://github.com/withastro/astro/pull/11055) [`b92de22`](https://github.com/withastro/astro/commit/b92de22d2853efc4da4270a3812b9db120d06d3a) Thanks [@niklas-wortmann](https://github.com/niklas-wortmann)! - Updates the `devtools` type to allow passing `VueDevToolsOptions` + + For more customization, you can pass options that the [Vue DevTools Vite Plugin](https://devtools-next.vuejs.org/guide/vite-plugin#options) supports. (Note: `appendTo` is not supported.) For example, you can set `launchEditor` to your preferred editor if you are not using Visual Studio Code: + + ```js title="astro.config.mjs" + import { defineConfig } from 'astro/config'; + import vue from '@astrojs/vue'; + + export default defineConfig({ + // ... + integrations: [ + vue({ + devtools: { launchEditor: 'webstorm' }, + }), + ], + }); + ``` + ## 4.2.0 ### Minor Changes diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 4540e3eace..2381f9a867 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/vue", - "version": "4.2.0", + "version": "4.3.0", "description": "Use Vue components within Astro", "type": "module", "types": "./dist/index.d.ts", diff --git a/packages/integrations/web-vitals/CHANGELOG.md b/packages/integrations/web-vitals/CHANGELOG.md index 26f4cd1a69..38b9bc1f63 100644 --- a/packages/integrations/web-vitals/CHANGELOG.md +++ b/packages/integrations/web-vitals/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/web-vitals +## 0.2.1 + +### Patch Changes + +- [#11120](https://github.com/withastro/astro/pull/11120) [`9a0e94b`](https://github.com/withastro/astro/commit/9a0e94b2e6bc41b370d8a0518004c6f3cb1b833e) Thanks [@delucis](https://github.com/delucis)! - Fixes requests to the web vitals endpoint in setups like Vercel’s `trailingSlash: true` that redirect from `/web-vitals` to `/web-vitals/` + ## 0.2.0 ### Minor Changes diff --git a/packages/integrations/web-vitals/package.json b/packages/integrations/web-vitals/package.json index f867cf182f..a4ef90ede7 100644 --- a/packages/integrations/web-vitals/package.json +++ b/packages/integrations/web-vitals/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/web-vitals", "description": "Track your website’s performance with Astro DB", - "version": "0.2.0", + "version": "0.2.1", "type": "module", "author": "withastro", "license": "MIT", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8f21c0af8..31811dc338 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,7 +128,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/blog: @@ -143,22 +143,22 @@ importers: specifier: ^3.1.5 version: link:../../packages/integrations/sitemap astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/container-with-vitest: dependencies: '@astrojs/react': - specifier: ^3.3.4 + specifier: ^3.4.0 version: link:../../packages/integrations/react astro: - specifier: experimental--container + specifier: ^4.9.0 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -189,7 +189,7 @@ importers: specifier: ^3.13.10 version: 3.13.10 astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/framework-lit: @@ -201,7 +201,7 @@ importers: specifier: ^0.2.1 version: 0.2.1 astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro lit: specifier: ^3.1.3 @@ -213,7 +213,7 @@ importers: specifier: ^3.3.0 version: link:../../packages/integrations/preact '@astrojs/react': - specifier: ^3.3.4 + specifier: ^3.4.0 version: link:../../packages/integrations/react '@astrojs/solid-js': specifier: ^4.2.0 @@ -222,7 +222,7 @@ importers: specifier: ^5.4.0 version: link:../../packages/integrations/svelte '@astrojs/vue': - specifier: ^4.2.0 + specifier: ^4.3.0 version: link:../../packages/integrations/vue '@types/react': specifier: ^18.3.2 @@ -231,7 +231,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro preact: specifier: ^10.21.0 @@ -261,7 +261,7 @@ importers: specifier: ^1.2.3 version: 1.2.3(preact@10.21.0) astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro preact: specifier: ^10.21.0 @@ -270,7 +270,7 @@ importers: examples/framework-react: dependencies: '@astrojs/react': - specifier: ^3.3.4 + specifier: ^3.4.0 version: link:../../packages/integrations/react '@types/react': specifier: ^18.3.2 @@ -279,7 +279,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -294,7 +294,7 @@ importers: specifier: ^4.2.0 version: link:../../packages/integrations/solid astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro solid-js: specifier: ^1.8.17 @@ -306,7 +306,7 @@ importers: specifier: ^5.4.0 version: link:../../packages/integrations/svelte astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro svelte: specifier: ^4.2.16 @@ -315,10 +315,10 @@ importers: examples/framework-vue: dependencies: '@astrojs/vue': - specifier: ^4.2.0 + specifier: ^4.3.0 version: link:../../packages/integrations/vue astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro vue: specifier: ^3.4.27 @@ -330,13 +330,13 @@ importers: specifier: ^8.2.5 version: link:../../packages/integrations/node astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/middleware: @@ -345,7 +345,7 @@ importers: specifier: ^8.2.5 version: link:../../packages/integrations/node astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro html-minifier: specifier: ^4.0.0 @@ -358,19 +358,19 @@ importers: examples/minimal: dependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/non-html-pages: dependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/ssr: @@ -382,7 +382,7 @@ importers: specifier: ^5.4.0 version: link:../../packages/integrations/svelte astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro svelte: specifier: ^4.2.16 @@ -391,7 +391,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro sass: specifier: ^1.77.1 @@ -403,7 +403,7 @@ importers: examples/toolbar-app: devDependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/view-transitions: @@ -415,7 +415,7 @@ importers: specifier: ^5.1.0 version: link:../../packages/integrations/tailwind astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/with-markdoc: @@ -424,7 +424,7 @@ importers: specifier: ^0.11.0 version: link:../../packages/integrations/markdoc astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/with-markdown-plugins: @@ -433,7 +433,7 @@ importers: specifier: ^5.1.0 version: link:../../packages/markdown/remark astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro hast-util-select: specifier: ^6.0.2 @@ -454,7 +454,7 @@ importers: examples/with-markdown-shiki: dependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro examples/with-mdx: @@ -466,7 +466,7 @@ importers: specifier: ^3.3.0 version: link:../../packages/integrations/preact astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro preact: specifier: ^10.21.0 @@ -481,7 +481,7 @@ importers: specifier: ^0.5.1 version: 0.5.1(nanostores@0.10.3)(preact@10.21.0) astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro nanostores: specifier: ^0.10.3 @@ -502,7 +502,7 @@ importers: specifier: ^1.6.4 version: 1.6.4 astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro autoprefixer: specifier: ^10.4.19 @@ -520,7 +520,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^4.8.7 + specifier: ^4.9.0 version: link:../../packages/astro vitest: specifier: ^1.6.0