Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] release #10944

Merged
merged 1 commit into from May 9, 2024
Merged

[ci] release #10944

merged 1 commit into from May 9, 2024

Conversation

astrobot-houston
Copy link
Contributor

@astrobot-houston astrobot-houston commented May 3, 2024

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@astrojs/[email protected]

Major Changes

  • #10935 ddd8e49 Thanks @bluwy! - Refactors the MDX transformation to rely only on the unified pipeline. Babel and esbuild transformations are removed, which should result in faster build times. The refactor requires using Astro v4.8.0 but no other changes are necessary.

  • #10935 ddd8e49 Thanks @bluwy! - Allows integrations after the MDX integration to update markdown.remarkPlugins and markdown.rehypePlugins, and have the plugins work in MDX too.

    If your integration relies on Astro's previous behavior that prevents integrations from adding remark/rehype plugins for MDX, you will now need to configure @astrojs/mdx with extendMarkdownConfig: false and explicitly specify any remarkPlugins and rehypePlugins options instead.

  • #10935 ddd8e49 Thanks @bluwy! - Renames the optimize.customComponentNames option to optimize.ignoreElementNames to better reflect its usecase. Its behaviour is not changed and should continue to work as before.

  • #10935 ddd8e49 Thanks @bluwy! - Replaces the internal remark-images-to-component plugin with rehype-images-to-component to let users use additional rehype plugins for images

Patch Changes

  • #10935 ddd8e49 Thanks @bluwy! - Simplifies plain MDX components as hast element nodes to further improve HTML string inlining for the optimize option

  • #10935 ddd8e49 Thanks @bluwy! - Allows Vite plugins to transform .mdx files before the MDX plugin transforms it

  • #10935 ddd8e49 Thanks @bluwy! - Updates the optimize option to group static sibling nodes as a <Fragment />. This reduces the number of AST nodes and simplifies runtime rendering of MDX pages.

  • #10935 ddd8e49 Thanks @bluwy! - Tags the MDX component export for quicker component checks while rendering

  • #10935 ddd8e49 Thanks @bluwy! - Fixes export const components keys detection for the optimize option

  • #10935 ddd8e49 Thanks @bluwy! - Improves optimize handling for MDX components with attributes and inline MDX components

[email protected]

Minor Changes

  • #10935 ddd8e49 Thanks @bluwy! - Exports astro/jsx/rehype.js with utilities to generate an Astro metadata object

  • #10625 698c2d9 Thanks @goulvenclech! - Adds the ability for multiple pages to use the same component as an entrypoint when building an Astro integration. This change is purely internal, and aligns the build process with the behaviour in the development server.

  • #10906 7bbd664 Thanks @Princesseuh! - Adds a new radio checkbox component to the dev toolbar UI library (astro-dev-toolbar-radio-checkbox)

  • #10963 61f47a6 Thanks @delucis! - Adds support for passing an inline Astro configuration object to getViteConfig()

    If you are using getViteConfig() to configure the Vitest test runner, you can now pass a second argument to control how Astro is configured. This makes it possible to configure unit tests with different Astro options when using Vitest’s workspaces feature.

    // vitest.config.ts
    import { getViteConfig } from 'astro/config';
    
    export default getViteConfig(
      /* Vite configuration */
      { test: {} },
      /* Astro configuration */
      {
        site: 'https://example.com',
        trailingSlash: 'never',
      }
    );
  • #10867 47877a7 Thanks @ematipico! - Adds experimental rewriting in Astro with a new rewrite() function and the middleware next() function.

    The feature is available via an experimental flag in astro.config.mjs:

    export default defineConfig({
      experimental: {
        rewriting: true,
      },
    });

    When enabled, you can use rewrite() to render another page without changing the URL of the browser in Astro pages and endpoints.

    ---
    // src/pages/dashboard.astro
    if (!Astro.props.allowed) {
      return Astro.rewrite('/');
    }
    ---
    // src/pages/api.js
    export function GET(ctx) {
      if (!ctx.locals.allowed) {
        return ctx.rewrite('/');
      }
    }

    The middleware next() function now accepts a parameter with the same type as the rewrite() function. For example, with next("/"), you can call the next middleware function with a new Request.

    // src/middleware.js
    export function onRequest(ctx, next) {
      if (!ctx.cookies.get('allowed')) {
        return next('/'); // new signature
      }
      return next();
    }

    NOTE: please read the RFC to understand the current expectations of the new APIs.

  • #10858 c0c509b Thanks @z.string(),! - Adds experimental support for the Actions API. Actions let you define type-safe endpoints you can query from client components with progressive enhancement built in.

    Actions help you write type-safe backend functions you can call from anywhere. Enable server rendering using the output property and add the actions flag to the experimental object:

    {
      output: 'hybrid', // or 'server'
      experimental: {
        actions: true,
      },
    }

    Declare all your actions in src/actions/index.ts. This file is the global actions handler.

    Define an action using the defineAction() utility from the astro:actions module. These accept the handler property to define your server-side request handler. If your action accepts arguments, apply the input property to validate parameters with Zod.

    This example defines two actions: like and comment. The like action accepts a JSON object with a postId string, while the comment action accepts FormData with postId, author, and body strings. Each handler updates your database and return a type-safe response.

    // src/actions/index.ts
    import { defineAction, z } from 'astro:actions';
    
    export const server = {
      like: defineAction({
        input: z.object({ postId: z.string() }),
        handler: async ({ postId }, context) => {
          // update likes in db
    
          return likes;
        },
      }),
      comment: defineAction({
        accept: 'form',
        input: z.object({
          postId: z.string(),
    
          body: z.string(),
        }),
        handler: async ({ postId }, context) => {
          // insert comments in db
    
          return comment;
        },
      }),
    };

    Then, call an action from your client components using the actions object from astro:actions. You can pass a type-safe object when using JSON, or a FormData object when using accept: 'form' in your action definition:

    // src/components/blog.tsx
    import { actions } from 'astro:actions';
    import { useState } from 'preact/hooks';
    
    export function Like({ postId }: { postId: string }) {
      const [likes, setLikes] = useState(0);
      return (
        <button
          onClick={async () => {
            const newLikes = await actions.like({ postId });
            setLikes(newLikes);
          }}
        >
          {likes} likes
        </button>
      );
    }
    
    export function Comment({ postId }: { postId: string }) {
      return (
        <form
          onSubmit={async (e) => {
            e.preventDefault();
            const formData = new FormData(e.target);
            const result = await actions.blog.comment(formData);
            // handle result
          }}
        >
          <input type="hidden" name="postId" value={postId} />
          <label for="author">Author</label>
          <input id="author" type="text" name="author" />
          <textarea rows={10} name="body"></textarea>
          <button type="submit">Post</button>
        </form>
      );
    }

    For a complete overview, and to give feedback on this experimental API, see the Actions RFC.

  • #10906 7bbd664 Thanks @Princesseuh! - Adds a new buttonBorderRadius property to the astro-dev-toolbar-button component for the dev toolbar component library. This property can be useful to make a fully rounded button with an icon in the center.

Patch Changes

  • #10977 59571e8 Thanks @BryceRussell! - Improve error message when accessing clientAddress on prerendered routes

  • #10935 ddd8e49 Thanks @bluwy! - Improves the error message when failed to render MDX components

  • #10917 3412535 Thanks @jakobhellermann! - Fixes a case where the local server would crash when the host also contained the port, eg. with X-Forwarded-Host: hostname:8080 and X-Forwarded-Port: 8080 headers

  • #10959 685fc22 Thanks @bluwy! - Refactors internal handling of styles and scripts for content collections to improve build performance

  • #10889 4d905cc Thanks @matthewp! - Preserve content modules properly in cache

  • #10955 2978287 Thanks @florian-lefebvre! - Handles AstroUserErrors thrown while syncing content collections and exports BaseSchema and CollectionConfig types

@astrojs/[email protected]

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

@astrojs/[email protected]

Minor Changes

  • #10937 7179930 Thanks @florian-lefebvre! - Adds a devtools option

    You can enable the official Solid Devtools while working in development mode by setting devtools: true in your solid() integration config and adding solid-devtools to your project dependencies:

    npm install solid-devtools
    # yarn add solid-devtools
    # pnpm add solid-devtools
    import { defineConfig } from 'astro/config';
    import solid from '@astrojs/solid-js';
    
    export default defineConfig({
      integrations: [solid({ devtools: true })],
    });

@astrojs/[email protected]

Minor Changes

@astrojs/[email protected]

Minor Changes

  • #10929 082abb8 Thanks @florian-lefebvre! - Adds a devtools option

    You can enable the official Vue DevTools while working in development mode by setting devtools:true in your vue() integration config:

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

@astrojs/[email protected]

Patch Changes

@astrojs/[email protected]

Patch Changes

@astrojs/[email protected]

Patch Changes

  • #10947 e63e96b Thanks @delucis! - Fixes a runtime issue where Vite was unintentionally pulled into the server code

@github-actions github-actions bot added pkg: example Related to an example package (scope) pkg: astro Related to the core `astro` package (scope) labels May 3, 2024
@github-actions github-actions bot force-pushed the changeset-release/main branch 23 times, most recently from 34e2ee3 to 1189ed2 Compare May 8, 2024 12:29
@github-actions github-actions bot added pkg: vue Related to Vue (scope) pkg: react Related to React (scope) pkg: preact Related to Preact (scope) pkg: integration Related to any renderer integration (scope) labels May 8, 2024
@github-actions github-actions bot force-pushed the changeset-release/main branch 11 times, most recently from 5eede25 to a7b7ecc Compare May 9, 2024 09:53
@ematipico ematipico merged commit 770b9f0 into main May 9, 2024
@ematipico ematipico deleted the changeset-release/main branch May 9, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) pkg: integration Related to any renderer integration (scope) pkg: preact Related to Preact (scope) pkg: react Related to React (scope) pkg: vue Related to Vue (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants