Skip to content

Latest commit

 

History

History
462 lines (273 loc) · 21.6 KB

CHANGELOG.md

File metadata and controls

462 lines (273 loc) · 21.6 KB

@astrojs/preact

3.5.4

Patch Changes

  • #12481 8a46e80 Thanks @marbrex! - Resolve vite peer dependency problem for strict package managers like Yarn in PnP mode.

3.5.3

Patch Changes

3.5.2

Patch Changes

  • #11834 5f2536b Thanks @ph1p! - Preact signals are now serialized correctly in arrays when they are given to components.

3.5.1

Patch Changes

3.5.0

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);
    };

3.4.0

Minor Changes

  • #11144 803dd80 Thanks @ematipico! - The integration now exposes a function called getContainerRenderer, that can be used inside the Container APIs to load the relative renderer.

    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);
    
      expect(result).toContain('Counter');
      expect(result).toContain('Count: <!-- -->5');
    });

3.3.0

Minor Changes

  • #10938 fd508a0 Thanks @florian-lefebvre! - Adds a devtools option

    You can enable Preact devtools in development by setting devtools: true in your preact() integration config:

    import { defineConfig } from 'astro/config';
    import preact from '@astrojs/preact';
    
    export default defineConfig({
      integrations: [preact({ devtools: true })],
    });

3.2.0

Minor Changes

3.1.2

Patch Changes

3.1.1

Patch Changes

3.1.0

Minor Changes

  • #9524 0903ef90494e9c8bd0272347a0cdd51eca7f4648 Thanks @aleksandrjet! - Allows rendering lazy components.

    You can now use lazy components with Suspense:

    import { lazy, Suspense } from 'preact/compat';
    
    const HeavyComponent = lazy(() => import('./HeavyComponent'));
    
    const Component = () => {
      return (
        <Suspense fallback={<p>Loading...</p>}>
          <HeavyComponent foo="bar" />
        </Suspense>
      );
    };

3.0.2

Patch Changes

3.0.1

Patch Changes

3.0.0

Major Changes

  • #8188 d0679a666 Thanks @ematipico! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023.

  • #8179 6011d52d3 Thanks @matthewp! - Astro 3.0 Release Candidate

  • #7924 519a1c4e8 Thanks @matthewp! - New include and exclude config options

    The Preact integration now has new include and exclude config options. Use these if you want to use Preact alongside another JSX framework; include specifies files to be compiled for Preact and exclude does the opposite.

Patch Changes

3.0.0-rc.3

Patch Changes

3.0.0-rc.2

Major Changes

3.0.0-beta.1

Major Changes

  • #7924 519a1c4e8 Thanks @matthewp! - New include and exclude config options

    The Preact integration now has new include and exclude config options. Use these if you want to use Preact alongside another JSX framework; include specifies files to be compiled for Preact and exclude does the opposite.

3.0.0-beta.0

Major Changes

  • 1eae2e3f7 Thanks @Princesseuh! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023.

2.2.2

Patch Changes

2.2.1

Patch Changes

2.2.0

Minor Changes

  • #7093 3d525efc9 Thanks @matthewp! - Prevent removal of nested slots within islands

    This change introduces a new flag that renderers can add called supportsAstroStaticSlot. What this does is let Astro know that the render is sending <astro-static-slot> as placeholder values for static (non-hydrated) slots which Astro will then remove.

    This change is completely backwards compatible, but fixes bugs caused by combining ssr-only and client-side framework components like so:

    <Component>
      <div>
        <Component client:load>
          <span>Nested</span>
        </Component>
      </div>
    </Component>

Patch Changes

2.1.0

Minor Changes

2.0.3

Patch Changes

2.0.2

Patch Changes

2.0.1

Patch Changes

2.0.0

Major Changes

2.0.0-beta.0

See changes in 2.0.0-beta.0

Major Changes

1.2.0

Minor Changes

  • #5015 b1964e9e1 Thanks @matthewp! - Shared state in Preact components with signals

    This makes it possible to share client state between Preact islands via signals.

    For example, you can create a signals in an Astro component and then pass it to multiple islands:

    ---
    // Component Imports
    import Counter from '../components/Counter';
    import { signal } from '@preact/signals';
    const count = signal(0);
    ---
    
    <Count count={count} />
    <Count count={count} />

1.1.1

Patch Changes

  • #4842 812658ad2 Thanks @bluwy! - Add missing dependencies, support strict dependency installation (e.g. pnpm)

1.1.0

Minor Changes

1.0.2

Patch Changes

1.0.1

Patch Changes

1.0.0

Major Changes

0.5.2

Patch Changes

0.5.1

Patch Changes

0.5.0

Minor Changes

0.4.1

Patch Changes

0.4.0

Minor Changes

0.3.2

Patch Changes

0.3.1

Patch Changes

0.3.0

Minor Changes

  • #3712 e3fdc9b4 Thanks @delucis! - Add support for enabling preact/compat to Preact renderer

    To use preact/compat to render React components, users can now set compat to true when using the Preact integration:

    integrations: [
      preact({ compat: true }),
    ],

0.2.0

Minor Changes

  • #3652 7373d61c Thanks @natemoo-re! - Add support for passing named slots from .astro => framework components.

    Each slot is be passed as a top-level prop. For example:

    // From .astro
    <Component>
      <h2 slot="title">Hello world!</h2>
      <h2 slot="slot-with-dash">Dash</h2>
      <div>Default</div>
    </Component>;
    
    // For .jsx
    export default function Component({ title, slotWithDash, children }) {
      return (
        <>
          <div id="title">{title}</div>
          <div id="slot-with-dash">{slotWithDash}</div>
          <div id="main">{children}</div>
        </>
      );
    }

0.1.3

Patch Changes

  • #3455 e9a77d86 Thanks @natemoo-re! - Update client hydration to check for ssr attribute. Requires astro@^1.0.0-beta.36.

0.1.2

Patch Changes

  • #3166 70263cf7 Thanks @natemoo-re! - Fix integration to use updateConfig rather than returning a partial config object

0.1.1

Patch Changes

0.1.0

Minor Changes

0.0.2

Patch Changes

  • #2847 3b621f7a Thanks @tony-sull! - Adds keywords to the official integrations to support discoverability on Astro's Integrations site
  • #2872 098f6f6b Thanks @bholmesdev! - Fix isSelfAccepting errors when using the Preact integration with the Astro dev server

0.0.2-next.1

Patch Changes

  • #2872 098f6f6b Thanks @bholmesdev! - Fix isSelfAccepting errors when using the Preact integration with the Astro dev server

0.0.2-next.0

Patch Changes

  • #2847 3b621f7a Thanks @tony-sull! - Adds keywords to the official integrations to support discoverability on Astro's Integrations site