From d23e386f9916846bc7e4647f02f626fd401a4095 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 4 Jun 2024 13:44:46 +0100 Subject: [PATCH] fix diff --- .changeset/fair-singers-reflect.md | 23 ++++++++--------------- .changeset/gold-mayflies-beam.md | 23 +++++++++++++++-------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.changeset/fair-singers-reflect.md b/.changeset/fair-singers-reflect.md index fcb4131be21f4..e18ec42f9cf8d 100644 --- a/.changeset/fair-singers-reflect.md +++ b/.changeset/fair-singers-reflect.md @@ -11,27 +11,20 @@ The integration now exposes a function called `getContainerRenderer`, that can be used inside the Container APIs to load the relative renderer. -```diff +```js import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from "astro:container"; import { getContainerRenderer } from "@astrojs/react"; test('ReactWrapper with react renderer', async () => { -+ const renderers = await loadRenderers([getContainerRenderer()]) -- const renderers = [ -- { -- name: '@astrojs/react', -- clientEntrypoint: '@astrojs/react/client.js', -- serverEntrypoint: '@astrojs/react/server.js', -- }, -- ]; - const container = await AstroContainer.create({ - renderers, - }); - const result = await container.renderToString(ReactWrapper); + const renderers = await loadRenderers([getContainerRenderer()]) + const container = await AstroContainer.create({ + renderers, + }); + const result = await container.renderToString(ReactWrapper); - expect(result).toContain('Counter'); - expect(result).toContain('Count: 5'); + expect(result).toContain('Counter'); + expect(result).toContain('Count: 5'); }); ``` diff --git a/.changeset/gold-mayflies-beam.md b/.changeset/gold-mayflies-beam.md index 125c6498c3a62..d500b30b41c66 100644 --- a/.changeset/gold-mayflies-beam.md +++ b/.changeset/gold-mayflies-beam.md @@ -8,21 +8,28 @@ Changes the **type** of the `renderers` option of the `AstroContainer::create` f You no longer need to know the individual, direct file paths to the client and server rendering scripts for each renderer integration package. Now, there is a dedicated function to load the renderer from each package, which is available from `getContainerRenderer()`: -```js +```diff import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from "astro:container"; import { getContainerRenderer } from "@astrojs/react"; test('ReactWrapper with react renderer', async () => { - const renderers = await loadRenderers([getContainerRenderer()]) - const container = await AstroContainer.create({ - renderers, - }); - const result = await container.renderToString(ReactWrapper); ++ const renderers = await loadRenderers([getContainerRenderer()]) +- const renderers = [ +- { +- name: '@astrojs/react', +- clientEntrypoint: '@astrojs/react/client.js', +- serverEntrypoint: '@astrojs/react/server.js', +- }, +- ]; + const container = await AstroContainer.create({ + renderers, + }); + const result = await container.renderToString(ReactWrapper); - expect(result).toContain('Counter'); - expect(result).toContain('Count: 5'); + expect(result).toContain('Counter'); + expect(result).toContain('Count: 5'); }); ```