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

fix(deps): update dependency astro to v4 #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented May 2, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
astro (source) ^3.0.8 -> ^4.0.0 age adoption passing confidence

Release Notes

withastro/astro (astro)

v4.14.6

Compare Source

Patch Changes

v4.14.5

Compare Source

Patch Changes

v4.14.4

Compare Source

Patch Changes
  • #​11794 3691a62 Thanks @​bholmesdev! - Fixes unexpected warning log when using Actions on "hybrid" rendered projects.

  • #​11801 9f943c1 Thanks @​delucis! - Fixes a bug where the filePath property was not available on content collection entries when using the content layer file() loader with a JSON file that contained an object instead of an array. This was breaking use of the image() schema utility among other things.

v4.14.3

Compare Source

Patch Changes

v4.14.2

Compare Source

Patch Changes

v4.14.1

Compare Source

Patch Changes
  • #​11725 6c1560f Thanks @​ascorbic! - Prevents content layer importing node builtins in runtime

  • #​11692 35af73a Thanks @​matthewp! - Prevent errant HTML from crashing server islands

    When an HTML minifier strips away the server island comment, the script can't correctly know where the end of the fallback content is. This makes it so that it simply doesn't remove any DOM in that scenario. This means the fallback isn't removed, but it also doesn't crash the browser.

  • #​11727 3c2f93b Thanks @​florian-lefebvre! - Fixes a type issue when using the Content Layer in dev

v4.14.0

Compare Source

Minor Changes
  • #​11657 a23c69d Thanks @​bluwy! - Deprecates the option for route-generating files to export a dynamic value for prerender. Only static values are now supported (e.g. export const prerender = true or = false). This allows for better treeshaking and bundling configuration in the future.

    Adds a new "astro:route:setup" hook to the Integrations API to allow you to dynamically set options for a route at build or request time through an integration, such as enabling on-demand server rendering.

    To migrate from a dynamic export to the new hook, update or remove any dynamic prerender exports from individual routing files:

    // src/pages/blog/[slug].astro
    - export const prerender = import.meta.env.PRERENDER

    Instead, create an integration with the "astro:route:setup" hook and update the route's prerender option:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { loadEnv } from 'vite';
    
    export default defineConfig({
      integrations: [setPrerender()],
    });
    
    function setPrerender() {
      const { PRERENDER } = loadEnv(process.env.NODE_ENV, process.cwd(), '');
    
      return {
        name: 'set-prerender',
        hooks: {
          'astro:route:setup': ({ route }) => {
            if (route.component.endsWith('/blog/[slug].astro')) {
              route.prerender = PRERENDER;
            }
          },
        },
      };
    }
  • #​11360 a79a8b0 Thanks @​ascorbic! - Adds a new injectTypes() utility to the Integration API and refactors how type generation works

    Use injectTypes() in the astro:config:done hook to inject types into your user's project by adding a new a *.d.ts file.

    The filename property will be used to generate a file at /.astro/integrations/<normalized_integration_name>/<normalized_filename>.d.ts and must end with ".d.ts".

    The content property will create the body of the file, and must be valid TypeScript.

    Additionally, injectTypes() returns a URL to the normalized path so you can overwrite its content later on, or manipulate it in any way you want.

    // my-integration/index.js
    export default {
      name: 'my-integration',
      'astro:config:done': ({ injectTypes }) => {
        injectTypes({
          filename: 'types.d.ts',
          content: "declare module 'virtual:my-integration' {}",
        });
      },
    };

    Codegen has been refactored. Although src/env.d.ts will continue to work as is, we recommend you update it:

    - /// <reference types="astro/client" />
    + /// <reference path="../.astro/types.d.ts" />
    - /// <reference path="../.astro/env.d.ts" />
    - /// <reference path="../.astro/actions.d.ts" />
  • #​11605 d3d99fb Thanks @​jcayzac! - Adds a new property meta to Astro's built-in <Code /> component.

    This allows you to provide a value for Shiki's meta attribute to pass options to transformers.

    The following example passes an option to highlight lines 1 and 3 to Shiki's tranformerMetaHighlight:

v4.13.4

Compare Source

Patch Changes

v4.13.3

Compare Source

Patch Changes
  • #​11653 32be549 Thanks @​florian-lefebvre! - Updates astro:env docs to reflect current developments and usage guidance

  • #​11658 13b912a Thanks @​bholmesdev! - Fixes orThrow() type when calling an Action without an input validator.

  • #​11603 f31d466 Thanks @​bholmesdev! - Improves user experience when render an Action result from a form POST request:

    • Removes "Confirm post resubmission?" dialog when refreshing a result.
    • Removes the ?_astroAction=NAME flag when a result is rendered.

    Also improves the DX of directing to a new route on success. Actions will now redirect to the route specified in your action string on success, and redirect back to the previous page on error. This follows the routing convention of established backend frameworks like Laravel.

    For example, say you want to redirect to a /success route when actions.signup succeeds. You can add /success to your action string like so:

    <form method="POST" action={'/success' + actions.signup}></form>
    • On success, Astro will redirect to /success.
    • On error, Astro will redirect back to the current page.

    You can retrieve the action result from either page using the Astro.getActionResult() function.

Note on security

This uses a temporary cookie to forward the action result to the next page. The cookie will be deleted when that page is rendered.

The action result is not encrypted. In general, we recommend returning minimal data from an action handler to a) avoid leaking sensitive information, and b) avoid unexpected render issues once the temporary cookie is deleted. For example, a login function may return a user's session id to retrieve from your Astro frontmatter, rather than the entire user object.

v4.13.2

Compare Source

Patch Changes

v4.13.1

Compare Source

Patch Changes
  • #​11584 a65ffe3 Thanks @​bholmesdev! - Removes async local storage dependency from Astro Actions. This allows Actions to run in Cloudflare and Stackblitz without opt-in flags or other configuration.

    This also introduces a new convention for calling actions from server code. Instead of calling actions directly, you must wrap function calls with the new Astro.callAction() utility.

    callAction() is meant to trigger an action from server code. getActionResult() usage with form submissions remains unchanged.

v4.13.0

Compare Source

Minor Changes
  • #​11507 a62345f Thanks @​ematipico! - Adds color-coding to the console output during the build to highlight slow pages.

    Pages that take more than 500 milliseconds to render will have their build time logged in red. This change can help you discover pages of your site that are not performant and may need attention.

  • #​11379 e5e2d3e Thanks @​alexanderniebuhr! - The experimental.contentCollectionJsonSchema feature introduced behind a flag in v4.5.0 is no longer experimental and is available for general use.

    If you are working with collections of type data, Astro will now auto-generate JSON schema files for your editor to get IntelliSense and type-checking. A separate file will be created for each data collection in your project based on your collections defined in src/content/config.ts using a library called zod-to-json-schema.

    This feature requires you to manually set your schema's file path as the value for $schema in each data entry file of the collection:

    {
      "$schema": "../../../.astro/collections/authors.schema.json",
      "name": "Armand",
      "skills": ["Astro", "Starlight"]
    }

    Alternatively, you can set this value in your editor settings. For example, to set this value in VSCode's json.schemas setting, provide the path of files to match and the location of your JSON schema:

    {
      "json.schemas": [
        {
          "fileMatch": ["/src/content/authors/**"],
          "url": "./.astro/collections/authors.schema.json"
        }
      ]
    }

    If you were previously using this feature, please remove the experimental flag from your Astro config:

    import { defineConfig } from 'astro'
    
    export default defineConfig({
    -  experimental: {
    -    contentCollectionJsonSchema: true
    -  }
    })

    If you have been waiting for stabilization before using JSON Schema generation for content collections, you can now do so.

    Please see the content collections guide for more about this feature.

  • #​11542 45ad326 Thanks @​ematipico! - The experimental.rewriting feature introduced behind a flag in v4.8.0 is no longer experimental and is available for general use.

    Astro.rewrite() and context.rewrite() allow you to render a different page without changing the URL in the browser. Unlike using a redirect, your visitor is kept on the original page they visited.

    Rewrites can be useful for showing the same content at multiple paths (e.g. /products/shoes/men/ and /products/men/shoes/) without needing to maintain two identical source files.

    Rewrites are supported in Astro pages, endpoints, and middleware.

    Return Astro.rewrite() in the frontmatter of a .astro page component to display a different page's content, such as fallback localized content:

v4.12.3

Compare Source

Patch Changes
  • #​11509 dfbca06 Thanks @​bluwy! - Excludes hoisted scripts and styles from Astro components imported with ?url or ?raw

  • #​11561 904f1e5 Thanks @​ArmandPhilippot! - Uses the correct pageSize default in page.size JSDoc comment

  • #​11571 1c3265a Thanks @​bholmesdev! - BREAKING CHANGE to the experimental Actions API only. Install the latest @astrojs/react integration as well if you're using React 19 features.

    Make .safe() the default return value for actions. This means { data, error } will be returned when calling an action directly. If you prefer to get the data while allowing errors to throw, chain the .orThrow() modifier.

    import { actions } from 'astro:actions';
    
    // Before
    const { data, error } = await actions.like.safe();
    // After
    const { data, error } = await actions.like();
    
    // Before
    const newLikes = await actions.like();
    // After
    const newLikes = await actions.like.orThrow();

v4.12.2

Compare Source

Patch Changes
  • #​11505 8ff7658 Thanks @​ematipico! - Enhances the dev server logging when rewrites occur during the lifecycle or rendering.

    The dev server will log the status code before and after a rewrite:

    08:16:48 [404] (rewrite) /foo/about 200ms
    08:22:13 [200] (rewrite) /about 23ms
  • #​11506 026e8ba Thanks @​sarah11918! - Fixes typo in documenting the slot="fallback" attribute for Server Islands experimental feature.

  • #​11508 ca335e1 Thanks @​cramforce! - Escapes HTML in serialized props

  • #​11501 4db78ae Thanks @​martrapp! - Adds the missing export for accessing the getFallback() function of the client site router.

v4.12.1

Compare Source

Patch Changes
  • #​11486 9c0c849 Thanks @​ematipico! - Adds a new function called addClientRenderer to the Container API.

    This function should be used when rendering components using the client:* directives. The addClientRenderer API must be used
    after the use of the addServerRenderer:

    const container = await experimental_AstroContainer.create();
    container.addServerRenderer({ renderer });
    container.addClientRenderer({ name: '@&#8203;astrojs/react', entrypoint: '@&#8203;astrojs/react/client.js' });
    const response = await container.renderToResponse(Component);
  • #​11500 4e142d3 Thanks @​Princesseuh! - Fixes inferRemoteSize type not working

  • #​11496 53ccd20 Thanks @​alfawal! - Hide the dev toolbar on window.print() (CTRL + P)

v4.12.0

Compare Source

Minor Changes
  • #​11341 49b5145 Thanks @​madcampos! - Adds support for Shiki's defaultColor option.

    This option allows you to override the values of a theme's inline style, adding only CSS variables to give you more flexibility in applying multiple color themes.

    Configure defaultColor: false in your Shiki config to apply throughout your site, or pass to Astro's built-in <Code> component to style an individual code block.

    import { defineConfig } from 'astro/config';
    export default defineConfig({
      markdown: {
        shikiConfig: {
          themes: {
            light: 'github-light',
            dark: 'github-dark',
          },
          defaultColor: false,
        },
      },
    });

v4.11.6

Compare Source

Patch Changes
  • #​11459 bc2e74d Thanks @​mingjunlu! - Fixes false positive audit warnings on elements with the role "tabpanel".

  • #​11472 cb4e6d0 Thanks @​delucis! - Avoids targeting all files in the src/ directory for eager optimization by Vite. After this change, only JSX, Vue, Svelte, and Astro components get scanned for early optimization.

  • #​11387 b498461 Thanks @​bluwy! - Fixes prerendering not removing unused dynamic imported chunks

  • #​11437 6ccb30e Thanks @​NuroDev! - Fixes a case where Astro's config experimental.env.schema keys did not allow numbers. Numbers are still not allowed as the first character to be able to generate valid JavaScript identifiers

  • #​11439 08baf56 Thanks @​bholmesdev! - Expands the isInputError() utility from astro:actions to accept errors of any type. This should now allow type narrowing from a try / catch block.

    // example.ts
    import { actions, isInputError } from 'astro:actions';
    
    try {
      await actions.like(new FormData());
    } catch (error) {
      if (isInputError(error)) {
        console.log(error.fields);
      }
    }
  • #​11452 0e66849 Thanks @​FugiTech! - Fixes an issue where using .nullish() in a formdata Astro action would always parse as a string

  • #​11438 619f07d Thanks @​bholmesdev! - Exposes utility types from astro:actions for the defineAction handler (ActionHandler) and the ActionError code (ActionErrorCode).

  • #​11456 17e048d Thanks @​RickyC0626! - Fixes astro dev --open unexpected behavior that spawns a new tab every time a config file is saved

  • #​11337 0a4b31f Thanks @​florian-lefebvre! - Adds a new property experimental.env.validateSecrets to allow validating private variables on the server.

    By default, this is set to false and only public variables are checked on start. If enabled, secrets will also be checked on start (dev/build modes). This is useful for example in some CIs to make sure all your secrets are correctly set before deploying.

    // astro.config.mjs
    import { defineConfig, envField } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        env: {
          schema: {
            // ...
          },
          validateSecrets: true,
        },
      },
    });
  • #​11443 ea4bc04 Thanks @​bholmesdev! - Expose new ActionReturnType utility from astro:actions. This infers the return type of an action by passing typeof actions.name as a type argument. This example defines a like action that returns likes as an object:

    // actions/index.ts
    import { defineAction } from 'astro:actions';
    
    export const server = {
      like: defineAction({
        handler: () => {
          /* ... */
          return { likes: 42 };
        },
      }),
    };

    In your client code, you can infer this handler return value with ActionReturnType:

    // client.ts
    import { actions, ActionReturnType } from 'astro:actions';
    
    type LikesResult = ActionReturnType<typeof actions.like>;
    // -> { likes: number }
  • #​11436 7dca68f Thanks @​bholmesdev! - Fixes astro:actions autocompletion for the defineAction accept property

  • #​11455 645e128 Thanks @​florian-lefebvre! - Improves astro:env invalid variables errors

v4.11.5

Compare Source

Patch Changes

v4.11.4

Compare Source

Patch Changes

v4.11.3

Compare Source

Patch Changes

v4.11.2

Compare Source

Patch Changes
  • #​11335 4c4741b Thanks @​ematipico! - Reverts #​11292, which caused a regression to the input type

  • #​11326 41121fb Thanks @​florian-lefebvre! - Fixes a case where running astro sync when using the experimental astro:env feature would fail if environment variables were missing

  • #​11338 9752a0b Thanks @​zaaakher! - Fixes svg icon margin in devtool tooltip title to look coherent in rtl and ltr layouts

  • #​11331 f1b78a4 Thanks @​bluwy! - Removes resolve package and simplify internal resolve check

  • #​11339 8fdbf0e Thanks @​matthewp! - Remove non-fatal errors from telemetry

    Previously we tracked non-fatal errors in telemetry to get a good idea of the types of errors that occur in astro dev. However this has become noisy over time and results in a lot of data that isn't particularly useful. This removes those non-fatal errors from being tracked.

v4.11.1

Compare Source

Patch Changes

v4.11.0

Compare Source

Minor Changes
  • #​11197 4b46bd9 Thanks @​braebo! - Adds ShikiTransformer support to the <Code /> component with a new transformers prop.

    Note that transformers only applies classes and you must provide your own CSS rules to target the elements of your code block.

v4.10.3

Compare Source

Patch Changes
  • #​11213 94ac7ef Thanks @​florian-lefebvre! - Removes the PUBLIC_ prefix constraint for astro:env public variables

  • #​11213 94ac7ef Thanks @​florian-lefebvre! - BREAKING CHANGE to the experimental astro:env feature only

    Server secrets specified in the schema must now be imported from astro:env/server. Using getSecret() is no longer required to use these environment variables in your schema:

    - import { getSecret } from 'astro:env/server'
    - const API_SECRET = getSecret("API_SECRET")
    + import { API_SECRET } from 'astro:env/server'

    Note that using getSecret() with these keys is still possible, but no longer involves any special handling and the raw value will be returned, just like retrieving secrets not specified in your schema.

  • #​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 '@&#8203;astrojs/react/server.js';
    import vueRenderer from '@&#8203;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);
    };
  • #​11249 de60c69 Thanks @​markgaze! - Fixes a performance issue with JSON schema generation

  • #​11242 e4fc2a0 Thanks @​ematipico! - Fixes a case where the virtual module astro:container wasn't resolved

  • #​11236 39bc3a5 Thanks @​ascorbic! - Fixes a case where symlinked content collection directories were not correctly resolved

  • #​11258 d996db6 Thanks @​ascorbic! - Adds a new error RewriteWithBodyUsed that throws when Astro.rewrite is used after the request body has already been read.

  • #​11243 ba2b14c Thanks @​V3RON! - Fixes a prerendering issue for libraries in node_modules when a folder with an underscore is in the path.

  • #​11244 d07d2f7 Thanks @​ematipico! - Improves the developer experience of the custom 500.astro page in development mode.

    Before, in development, an error thrown during the rendering phase would display the default error overlay, even when users had the 500.astro page.

    Now, the development server will display the 500.astro and the original error is logged in the console.

  • #​11240 2851b0a Thanks @​ascorbic! - Ignores query strings in module identifiers when matching ".astro" file extensions in Vite plugin

  • #​11245 e22be22 Thanks @​bluwy! - Refactors prerendering chunk handling to correctly remove unused code during the SSR runtime

v4.10.2

Compare Source

Patch Changes
  • #​11231 58d7dbb Thanks @​ematipico! - Fixes a regression for getViteConfig, where the inline config wasn't merged in the final config.

  • #​11228 1e293a1 Thanks @​ascorbic! - Updates getCollection() to always return a cloned array

  • #​11207 7d9aac3 Thanks @​ematipico! - Fixes an issue in the rewriting logic where old data was not purged during the rewrite flow. This caused some false positives when checking the validity of URL path names during the rendering phase.

  • #​11189 75a8fe7 Thanks @​ematipico! - Improve error message when using getLocaleByPath on path that doesn't contain any locales.

  • #​11195 0a6ab6f Thanks @​florian-lefebvre! - Adds support for enums to astro:env

    You can now call envField.enum:

    import { defineConfig, envField } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        env: {
          schema: {
            API_VERSION: envField.enum({
              context: 'server',
              access: 'secret',
              values: ['v1', 'v2'],
            }),
          },
        },
      },
    });
  • #​11210 66fc028 Thanks @​matthewp! - Close the iterator only after rendering is complete

  • #​11195 0a6ab6f Thanks @​florian-lefebvre! - Adds additional validation options to astro:env

    astro:env schema datatypes string and number now have new optional validation rules:

    import { defineConfig, envField } from 'astro/config';
    
    export default defineConfig({
      experimental: {
        env: {
          schema: {
            FOO: envField.string({
              // ...
              max: 32,
              min: 3,
              length: 12,
              url: true,
              includes: 'foo',
              startsWith: 'bar',
              endsWith: 'baz',
            }),
            BAR: envField.number({
              // ...
              gt: 2,
              min: 3,
              lt: 10,
              max: 9,
              int: true,
            }),
          },
        },
      },
    });
  • #​11211 97724da Thanks @​matthewp! - Let middleware handle the original request URL

  • #​10607 7327c6a Thanks @​frankbits! - Fixes an issue where a leading slash created incorrect conflict resolution between pages generated from static routes and catch-all dynamic routes

v4.10.1

Compare Source

Patch Changes

v4.10.0

Compare Source

Minor Changes
  • #​10974 2668ef9 Thanks @​florian-lefebvre! - Adds experimental support for the astro:env API.

    The astro:env API lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client. Import and use your defined variables from the appropriate /client or /server module:

v4.9.3

Compare Source

Patch Changes

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 was generated by Mend Renovate. View the repository job log.

Copy link

github-actions bot commented May 2, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://red-cliff-0a88f5e0f-9.eastus2.3.azurestaticapps.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants