mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
[ci] release (#11116)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
9a0e94b2e6
commit
50775925f9
48 changed files with 328 additions and 297 deletions
|
@ -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).
|
|
@ -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).
|
|
@ -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 });
|
||||
---
|
||||
```
|
|
@ -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.
|
|
@ -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 (
|
||||
<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 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<number>(ctx);
|
||||
// write to database
|
||||
return currentLikes + 1;
|
||||
}
|
||||
})
|
||||
}
|
|
@ -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`.
|
|
@ -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;
|
||||
}
|
||||
}),
|
||||
}
|
||||
```
|
|
@ -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" },
|
||||
}),
|
||||
],
|
||||
});
|
||||
```
|
|
@ -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/`
|
|
@ -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 (
|
||||
<form action={actions.like}>
|
||||
{/* auto-inserts hidden input for progressive enhancement */}
|
||||
<button type="submit">Like</button>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
```
|
|
@ -11,6 +11,6 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
],
|
||||
"scripts": {},
|
||||
"devDependencies": {
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"astro": "^4.0.0"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@astrojs/solid-js": "^4.2.0",
|
||||
"astro": "^4.8.7",
|
||||
"astro": "^4.9.0",
|
||||
"solid-js": "^1.8.17"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@astrojs/svelte": "^5.4.0",
|
||||
"astro": "^4.8.7",
|
||||
"astro": "^4.9.0",
|
||||
"svelte": "^4.2.16"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@astrojs/node": "^8.2.5",
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
],
|
||||
"scripts": {},
|
||||
"devDependencies": {
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"astro": "^4.0.0"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@astrojs/node": "^8.2.5",
|
||||
"astro": "^4.8.7",
|
||||
"astro": "^4.9.0",
|
||||
"html-minifier": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^4.8.7",
|
||||
"astro": "^4.9.0",
|
||||
"sass": "^1.77.1",
|
||||
"sharp": "^0.33.3"
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@
|
|||
"./app": "./dist/app.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
"devDependencies": {
|
||||
"@astrojs/tailwind": "^5.1.0",
|
||||
"@astrojs/node": "^8.2.5",
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@astrojs/markdoc": "^0.11.0",
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^4.8.7"
|
||||
"astro": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"test": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^4.8.7",
|
||||
"astro": "^4.9.0",
|
||||
"vitest": "^1.6.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
<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 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<number>(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 (
|
||||
<form action={actions.like}>
|
||||
{/* auto-inserts hidden input for progressive enhancement */}
|
||||
<button type="submit">Like</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### 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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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 (
|
||||
<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 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<number>(ctx);
|
||||
// write to database
|
||||
return currentLikes + 1;
|
||||
},
|
||||
}),
|
||||
};
|
||||
```
|
||||
|
||||
## 3.3.4
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue