Astro: @astrojs/[email protected] Release

Release date:
June 17, 2024
Previous version:
@astrojs/[email protected] (released June 6, 2024)
Magnitude:
1,346 Diff Delta
Contributors:
4 total committers
Data confidence:
Commits:

25 Commits in this Release

Ordered by the degree to which they evolved the repo in this version.

Authored June 14, 2024
Authored June 11, 2024
Authored June 13, 2024
Authored June 14, 2024
Authored June 14, 2024
Authored June 14, 2024
Authored June 17, 2024
Authored June 14, 2024
Authored June 11, 2024
Authored June 14, 2024
Authored June 12, 2024
Authored June 12, 2024
Authored June 14, 2024
Authored June 11, 2024

Top Contributors in @astrojs/[email protected]

ematipico
V3RON
liruifengv
nibble0101

Directory Browser for @astrojs/[email protected]

All files are compared to previous version, @astrojs/[email protected]. Click here to browse diffs between other versions.

Loading File Browser...

Release Notes Published

Minor Changes

  • #11234 4385bf7 Thanks @ematipico! - Adds a new function called addServerRenderer to the Container API. Use this function to manually store renderers inside the instance of your container.

    This new function should be preferred when using the Container API in environments like on-demand pages:

    import type { APIRoute } from 'astro';
    import { experimental_AstroContainer } from 'astro/container';
    import reactRenderer from '@astrojs/react/server.js';
    import vueRenderer from '@astrojs/vue/server.js';
    import ReactComponent from '../components/button.jsx';
    import VueComponent from '../components/button.vue';
    
    // MDX runtime is contained inside the Astro core
    import mdxRenderer from 'astro/jsx/server.js';
    
    // In case you need to import a custom renderer
    import customRenderer from '../renderers/customRenderer.js';
    
    export const GET: APIRoute = async (ctx) => {
      const container = await experimental_AstroContainer.create();
      container.addServerRenderer({ renderer: reactRenderer });
      container.addServerRenderer({ renderer: vueRenderer });
      container.addServerRenderer({ renderer: customRenderer });
      // You can pass a custom name too
      container.addServerRenderer({
        name: 'customRenderer',
        renderer: customRenderer,
      });
      const vueComponent = await container.renderToString(VueComponent);
      return await container.renderToResponse(Component);
    };