Update dependency astro to v4.9.2 #107

Merged
jahanson merged 1 commit from renovate/astro-monorepo into main 2024-05-27 07:35:41 -05:00
Collaborator

This PR contains the following updates:

Package Type Update Change
astro (source) dependencies minor 4.8.6 -> 4.9.2

Release Notes

withastro/astro (astro)

v4.9.2

Compare Source

Patch Changes
  • #​11138 98e0372 Thanks @​ematipico! - You can now pass props when rendering a component using the Container APIs:

    import { experimental_AstroContainer as AstroContainer } from 'astro/contaienr';
    import Card from '../src/components/Card.astro';
    
    const container = await AstroContainer.create();
    const result = await container.renderToString(Card, {
      props: {
        someState: true,
      },
    });
    

v4.9.1

Compare Source

Patch Changes

v4.9.0

Compare Source

Minor Changes
  • #​11051 12a1bcc Thanks @​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:

    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 2d4c8fa Thanks @​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 security option in astro.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, 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.

  • #​11022 be68ab4 Thanks @​ematipico! - The i18nDomains routing 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 site configured.

    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 8ca7c73 Thanks @​bholmesdev! - Adds two new functions experimental_getActionState() and experimental_withState() to support the React 19 useActionState() hook 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:

    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:

    import { defineAction, z } from 'astro:actions';
    import { experimental_getActionState } from '@&#8203;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 a6916e4 Thanks @​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 8ca7c73 Thanks @​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.

    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 9566fa0 Thanks @​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:

v4.8.7

Compare Source

Patch Changes
  • #​11073 f5c8fee Thanks @​matthewp! - Prevent cache content from being left in dist folder

    When contentCollectionsCache is enabled temporary cached content is copied into the outDir for processing. This fixes it so that this content is cleaned out, along with the rest of the temporary build JS.

  • #​11054 f6b171e Thanks @​bholmesdev! - Respect error status when handling Actions with a progressive fallback.

  • #​11092 bfe9c73 Thanks @​duckycoding-dev! - Change slot attribute of IntrinsicAttributes to match the definition of HTMLAttributes's own slot attribute of type string | undefined | null

  • #​10875 b5f95b2 Thanks @​W1M0R! - Fixes a typo in a JSDoc annotation

  • #​11111 a5d79dd Thanks @​bholmesdev! - Fix unexpected headers warning on prerendered routes when using Astro Actions.

  • #​11081 af42e05 Thanks @​V3RON! - Correctly position inspection tooltip in RTL mode

    When 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.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), 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 Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | dependencies | minor | [`4.8.6` -> `4.9.2`](https://renovatebot.com/diffs/npm/astro/4.8.6/4.9.2) | --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v4.9.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#492) [Compare Source](https://github.com/withastro/astro/compare/astro@4.9.1...astro@4.9.2) ##### Patch Changes - [#&#8203;11138](https://github.com/withastro/astro/pull/11138) [`98e0372`](https://github.com/withastro/astro/commit/98e0372cfd47a3e025be2ac68d1e9ebf06cf548b) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - You can now pass `props` when rendering a component using the Container APIs: ```js import { experimental_AstroContainer as AstroContainer } from 'astro/contaienr'; import Card from '../src/components/Card.astro'; const container = await AstroContainer.create(); const result = await container.renderToString(Card, { props: { someState: true, }, }); ``` ### [`v4.9.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#491) [Compare Source](https://github.com/withastro/astro/compare/astro@4.9.0...astro@4.9.1) ##### Patch Changes - [#&#8203;11129](https://github.com/withastro/astro/pull/11129) [`4bb9269`](https://github.com/withastro/astro/commit/4bb926908d9a7ee134701c3e5a1b5e6ea688f843) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent errors from adapters when i18n domains is not used ### [`v4.9.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#490) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.7...astro@4.9.0) ##### Minor Changes - [#&#8203;11051](https://github.com/withastro/astro/pull/11051) [`12a1bcc`](https://github.com/withastro/astro/commit/12a1bccc818af292cdd2a8ed0f3e3c042b9819b4) Thanks [@&#8203;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). - [#&#8203;11021](https://github.com/withastro/astro/pull/11021) [`2d4c8fa`](https://github.com/withastro/astro/commit/2d4c8faa56a64d963fe7847b5be2d7a59e12ed5b) Thanks [@&#8203;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). - [#&#8203;11022](https://github.com/withastro/astro/pull/11022) [`be68ab4`](https://github.com/withastro/astro/commit/be68ab47e236476ba980cbf74daf85f27cd866f4) Thanks [@&#8203;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 [@&#8203;astrojs/node](https://docs.astro.build/en/guides/integrations-guide/node/) or [@&#8203;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. - [#&#8203;11071](https://github.com/withastro/astro/pull/11071) [`8ca7c73`](https://github.com/withastro/astro/commit/8ca7c731dea894e77f84b314ebe3a141d5daa918) Thanks [@&#8203;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 '@&#8203;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 '@&#8203;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; }, }), }; ``` - [#&#8203;11101](https://github.com/withastro/astro/pull/11101) [`a6916e4`](https://github.com/withastro/astro/commit/a6916e4402bf5b7d74bab784a54eba63fd1d1179) Thanks [@&#8203;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`. - [#&#8203;11071](https://github.com/withastro/astro/pull/11071) [`8ca7c73`](https://github.com/withastro/astro/commit/8ca7c731dea894e77f84b314ebe3a141d5daa918) Thanks [@&#8203;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 - [#&#8203;11088](https://github.com/withastro/astro/pull/11088) [`9566fa0`](https://github.com/withastro/astro/commit/9566fa08608be766df355be17d72a39ea7b99ed0) Thanks [@&#8203;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: ### [`v4.8.7`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#487) [Compare Source](https://github.com/withastro/astro/compare/astro@4.8.6...astro@4.8.7) ##### Patch Changes - [#&#8203;11073](https://github.com/withastro/astro/pull/11073) [`f5c8fee`](https://github.com/withastro/astro/commit/f5c8fee76c5e688ef23c18be79705b18f1750415) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Prevent cache content from being left in dist folder When `contentCollectionsCache` is enabled temporary cached content is copied into the `outDir` for processing. This fixes it so that this content is cleaned out, along with the rest of the temporary build JS. - [#&#8203;11054](https://github.com/withastro/astro/pull/11054) [`f6b171e`](https://github.com/withastro/astro/commit/f6b171ed50eed253b8ac005bd5e9d1841a8003dd) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Respect error status when handling Actions with a progressive fallback. - [#&#8203;11092](https://github.com/withastro/astro/pull/11092) [`bfe9c73`](https://github.com/withastro/astro/commit/bfe9c73536f0794e4f5ede5040adabbe0e705984) Thanks [@&#8203;duckycoding-dev](https://github.com/duckycoding-dev)! - Change `slot` attribute of `IntrinsicAttributes` to match the definition of `HTMLAttributes`'s own `slot` attribute of type `string | undefined | null` - [#&#8203;10875](https://github.com/withastro/astro/pull/10875) [`b5f95b2`](https://github.com/withastro/astro/commit/b5f95b2fb156152fabf2a22e150037a8255006f9) Thanks [@&#8203;W1M0R](https://github.com/W1M0R)! - Fixes a typo in a JSDoc annotation - [#&#8203;11111](https://github.com/withastro/astro/pull/11111) [`a5d79dd`](https://github.com/withastro/astro/commit/a5d79ddeb2d592de9eb2468471fdcf3eea5ef730) Thanks [@&#8203;bholmesdev](https://github.com/bholmesdev)! - Fix unexpected `headers` warning on prerendered routes when using Astro Actions. - [#&#8203;11081](https://github.com/withastro/astro/pull/11081) [`af42e05`](https://github.com/withastro/astro/commit/af42e0552054b3b4ac784ed78c60f80bfc38d8ca) Thanks [@&#8203;V3RON](https://github.com/V3RON)! - Correctly position inspection tooltip in RTL mode When 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. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), 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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzEuMSIsInVwZGF0ZWRJblZlciI6IjM3LjM3Ny43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
smeagol-help added 1 commit 2024-05-22 03:03:14 -05:00
smeagol-help force-pushed renovate/astro-monorepo from e07e85feaf to 7ce8afd670 2024-05-23 05:33:55 -05:00 Compare
smeagol-help changed title from Update dependency astro to v4.8.7 to Update dependency astro to v4.9.0 2024-05-23 05:34:15 -05:00
smeagol-help force-pushed renovate/astro-monorepo from 7ce8afd670 to be7d89a504 2024-05-23 11:33:09 -05:00 Compare
smeagol-help changed title from Update dependency astro to v4.9.0 to Update dependency astro to v4.9.1 2024-05-23 11:33:30 -05:00
smeagol-help force-pushed renovate/astro-monorepo from be7d89a504 to 27ebc68698 2024-05-24 22:08:19 -05:00 Compare
smeagol-help force-pushed renovate/astro-monorepo from 27ebc68698 to 3e9ed9f345 2024-05-27 06:06:55 -05:00 Compare
smeagol-help changed title from Update dependency astro to v4.9.1 to Update dependency astro to v4.9.2 2024-05-27 06:07:14 -05:00
jahanson merged commit f4fa3f548d into main 2024-05-27 07:35:41 -05:00
jahanson deleted branch renovate/astro-monorepo 2024-05-27 07:35:41 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: jahanson/joehanson-dev#107
No description provided.