Files
astro/packages/integrations/netlify/CHANGELOG.md
Houston (Bot) 09bbdbb1e6 [ci] release (#14845)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-26 11:30:07 +01:00

110 KiB

@astrojs/netlify

6.6.3

Patch Changes

  • #14807 c17767a Thanks @jmgala! - Fixes a case where disabling the local image CDN wasn't possible

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.6.2

Patch Changes

  • #14716 0419985 Thanks @serhalp! - Upgrades the @netlify/functions dependency to v5. This removes 82 MB and 310 dependencies from the dependency tree

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.6.1

Patch Changes

  • Updated dependencies [9e9c528, 0f75f6b]:
    • @astrojs/internal-helpers@0.7.5
    • @astrojs/underscore-redirects@1.0.0

6.6.0

Minor Changes

  • #14543 9b3241d Thanks @matthewp! - Enables Netlify's skew protection feature for Astro sites deployed on Netlify. Skew protection ensures that your site's client and server versions stay synchronized during deployments, preventing issues where users might load assets from a newer deployment while the server is still running the older version.

    When you deploy to Netlify, the deployment ID is now automatically included in both asset requests and API calls, allowing Netlify to serve the correct version to every user. These are set for built-in features (Actions, View Transitions, Server Islands, Prefetch). If you are making your own fetch requests to your site, you can include the header manually using the DEPLOY_ID environment variable:

    const response = await fetch('/api/endpoint', {
      headers: {
        'X-Netlify-Deploy-ID': import.meta.env.DEPLOY_ID,
      },
    });
    

Patch Changes

  • Updated dependencies []:
    • @astrojs/underscore-redirects@1.0.0

6.5.13

Patch Changes

  • #14536 9261996 Thanks @florian-lefebvre! - Fixes a bug that caused too many files to be bundled in SSR

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.5.12

Patch Changes

  • #14473 d9634d3 Thanks @florian-lefebvre! - Fixes a bug that caused too many files to be bundled in SSR

  • Updated dependencies [b8ca69b]:

    • @astrojs/internal-helpers@0.7.4
    • @astrojs/underscore-redirects@1.0.0

6.5.11

Patch Changes

  • Updated dependencies [1e2499e]:
    • @astrojs/internal-helpers@0.7.3
    • @astrojs/underscore-redirects@1.0.0

6.5.10

Patch Changes

  • #14326 c24a8f4 Thanks @jsparkdev! - Updates vite version to fix CVE

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.5.9

Patch Changes

  • #14269 4823c42 Thanks @florian-lefebvre! - Updates context.netlify to implement all its properties

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.5.8

Patch Changes

  • #14240 77b18fb Thanks @delucis! - Increases the minimum supported version of Astro to 5.7.0

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.5.7

Patch Changes

  • Updated dependencies [4d16de7]:
    • @astrojs/internal-helpers@0.7.2
    • @astrojs/underscore-redirects@1.0.0

6.5.6

Patch Changes

  • #14175 1e1cef0 Thanks @ematipico! - Fixes a bug where the adapter would cause a runtime error when calling astro build in CI environments.

6.5.5

Patch Changes

  • Updated dependencies [0567fb7]:
    • @astrojs/internal-helpers@0.7.1
    • @astrojs/underscore-redirects@1.0.0

6.5.4

Patch Changes

  • Updated dependencies [f4e8889]:
    • @astrojs/internal-helpers@0.7.0
    • @astrojs/underscore-redirects@1.0.0

6.5.3

Patch Changes

  • #14120 798b5fa Thanks @ascorbic! - Adds mock feature flags in dev

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.5.2

Patch Changes

  • #14103 69d6871 Thanks @ascorbic! - Upgrades Netlify Vite plugin to fix error in edge functions.

  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.5.1

Patch Changes

  • #14078 38c2255 Thanks @ascorbic! - Fixes a bug that caused remote images to sometimes not display correctly when using the Netlify Image CDN in local dev

  • #14078 38c2255 Thanks @ascorbic! - Adds a new devFeatures configuration option to control some of the behaviors introduced in @astrojs/netlify@6.5.0, which introduced Netlify production features into the dev environment.

    You can now individually configure whether or not to populate your environment with the variables from your linked Netlify site (now disabled by default), and use a local version of the Netlify Image CDN for images (still enabled by default) when running astro dev.

    Additionally, the adapter no longer injects environment variables from Netlify by default when running astro dev.

    @astrojs/netlify@6.5.0 introduced a potentially breaking change that enabled injecting Netlify environment variables in astro dev by default. This could lead to unexpected behavior in Astro projects that do not expect these variables to be present. This now defaults to disabled, and users can enable it by setting the devFeatures.environmentVariables option in their Astro config. Similarly, you can use devFeatures.images to disable using the Netlify Image CDN locally if needed:

    import { defineConfig } from 'astro/config';
    import netlify from '@astrojs/netlify';
    
    export default defineConfig({
      adapter: netlify({
        devFeatures: {
          environmentVariables: true,
          images: false,
        },
      }),
    });
    

    You can also set devFeatures to true or false to enable or disable all configurable dev features:

    import { defineConfig } from 'astro/config';
    import netlify from '@astrojs/netlify';
    export default defineConfig({
      adapter: netlify({
        devFeatures: true,
      }),
    });
    
  • Updated dependencies []:

    • @astrojs/underscore-redirects@1.0.0

6.5.0

Minor Changes

This is an implementation update that does not require any change to your project code, but means that astro dev will run with an environment closer to a production deploy on Netlify. This brings several benefits you'll now notice working in dev mode!

For example, your project running in development mode will now use local versions of the Netlify Image CDN for images, and a local Blobs server for sessions. It will also populate your environment with the variables from your linked Netlify site.

While not required for fully static, prerendered web sites, you may still wish to add this for the additional benefits of now working in a dev environment closer to your Netlify production deploy, as well as to take advantage of Netlify-exclusive features such as the Netlify Image CDN.

Patch Changes

  • Updated dependencies []:
    • @astrojs/underscore-redirects@1.0.0

6.4.1

Patch Changes

  • #13972 db8f8be Thanks @ematipico! - Fixes the internal implementation of the new feature experimentalStaticHeaders, where dynamic routes were mapped to use always the same header.
  • Updated dependencies []:
    • @astrojs/underscore-redirects@1.0.0

6.4.0

Minor Changes

  • #13952 de82ef2 Thanks @ematipico! - Adds support for the experimental static headers Astro feature.

    When the feature is enabled via option experimentalStaticHeaders, and experimental Content Security Policy is enabled, the adapter will generate Response headers for static pages, which allows support for CSP directives that are not supported inside a <meta> tag (e.g. frame-ancestors).

    import { defineConfig } from 'astro/config';
    import netlify from '@astrojs/netlify';
    
    export default defineConfig({
      adapter: netlify({
        experimentalStaticHeaders: true,
      }),
      experimental: {
        cps: true,
      },
    });
    

Patch Changes

6.3.4

Patch Changes

  • #13799 7036b05 Thanks @Lofty-Brambles! - Fixes an issue where the adapter didn't take into consideration the outDir configuration.

  • #13830 9371a67 Thanks @Lofty-Brambles! - Fixes an issue with SVGs not rendering with image-cdn enabled, due to invalid source path parsing.

  • Updated dependencies []:

    • @astrojs/underscore-redirects@0.6.1

6.3.3

Patch Changes

  • #13792 7910fea Thanks @alexeyzimarev! - Unify imported images detection across adapters

  • Updated dependencies []:

    • @astrojs/underscore-redirects@0.6.1

6.3.2

Patch Changes

  • #13731 c3e80c2 Thanks @jsparkdev! - update vite to latest version for fixing CVE

  • Updated dependencies []:

    • @astrojs/underscore-redirects@0.6.1

6.3.1

Patch Changes

6.3.0

Minor Changes

  • #13527 2fd6a6b Thanks @ascorbic! - The experimental session API introduced in Astro 5.1 is now stable and ready for production use.

    Sessions are used to store user state between requests for on-demand rendered pages. You can use them to store user data, such as authentication tokens, shopping cart contents, or any other data that needs to persist across requests:

    ---
    export const prerender = false; // Not needed with 'server' output
    const cart = await Astro.session.get('cart');
    ---
    
    <a href="/checkout">🛒 {cart?.length ?? 0} items</a>
    

    Configuring session storage

    Sessions require a storage driver to store the data. The Node, Cloudflare and Netlify adapters automatically configure a default driver for you, but other adapters currently require you to specify a custom storage driver in your configuration.

    If you are using an adapter that doesn't have a default driver, or if you want to choose a different driver, you can configure it using the session configuration option:

    import { defineConfig } from 'astro/config';
    import vercel from '@astrojs/vercel';
    
    export default defineConfig({
      adapter: vercel(),
      session: {
        driver: 'upstash',
      },
    });
    

    Using sessions

    Sessions are available in on-demand rendered pages, API endpoints, actions and middleware.

    In pages and components, you can access the session using Astro.session:

    ---
    const cart = await Astro.session.get('cart');
    ---
    
    <a href="/checkout">🛒 {cart?.length ?? 0} items</a>
    

    In endpoints, actions, and middleware, you can access the session using context.session:

    export async function GET(context) {
      const cart = await context.session.get('cart');
      return Response.json({ cart });
    }
    

    If you attempt to access the session when there is no storage driver configured, or in a prerendered page, the session object will be undefined and an error will be logged in the console:

    ---
    export const prerender = true;
    const cart = await Astro.session?.get('cart'); // Logs an error. Astro.session is undefined
    ---
    

    Upgrading from Experimental to Stable

    If you were previously using the experimental API, please remove the experimental.session flag from your configuration:

    import { defineConfig } from 'astro/config';
    import node from '@astrojs/node';
    
    export default defineConfig({
       adapter: node({
         mode: "standalone",
       }),
    -  experimental: {
    -    session: true,
    -  },
    });
    

    See the sessions guide for more information.

Patch Changes

  • Updated dependencies []:
    • @astrojs/underscore-redirects@0.6.0

6.2.6

Patch Changes

6.2.5

Patch Changes

  • #13526 ff9d69e Thanks @jsparkdev! - update vite to the latest version

  • Updated dependencies []:

    • @astrojs/underscore-redirects@0.6.0

6.2.4

Patch Changes

  • #13505 a98ae5b Thanks @ematipico! - Updates the dependency vite to the latest.

  • Updated dependencies []:

    • @astrojs/underscore-redirects@0.6.0

6.2.3

Patch Changes

  • Updated dependencies [042d1de]:
    • @astrojs/internal-helpers@0.6.1
    • @astrojs/underscore-redirects@0.6.0

6.2.2

Patch Changes

  • #13323 80926fa Thanks @ematipico! - Updates esbuild and vite to the latest to avoid false positives audits warnings caused by esbuild.

  • Updated dependencies [1e11f5e]:

    • @astrojs/internal-helpers@0.6.0
    • @astrojs/underscore-redirects@0.6.0

6.2.1

Patch Changes

  • #13299 2e1321e Thanks @bluwy! - Uses tinyglobby for globbing files

  • Updated dependencies []:

    • @astrojs/underscore-redirects@0.6.0

6.2.0

Minor Changes

  • #13194 1b5037b Thanks @dfdez! - Adds includedFiles and excludedFiles configuration options to customize SSR function bundle contents.

    The includeFiles property allows you to explicitly specify additional files that should be bundled with your function. This is useful for files that aren't automatically detected as dependencies, such as:

    • Data files loaded using fs operations
    • Configuration files
    • Template files

    Similarly, you can use the excludeFiles property to prevent specific files from being bundled that would otherwise be included. This is helpful for:

    • Reducing bundle size
    • Excluding large binaries
    • Preventing unwanted files from being deployed
    import { defineConfig } from 'astro/config';
    import netlify from '@astrojs/netlify';
    
    export default defineConfig({
      // ...
      output: 'server',
      adapter: netlify({
        includeFiles: ['./my-data.json'],
        excludeFiles: ['./node_modules/package/**/*', './src/**/*.test.js'],
      }),
    });
    

    See the Netlify adapter documentation for detailed usage instructions and examples.

  • #13145 8d4e566 Thanks @ascorbic! - Automatically configures Netlify Blobs storage when experimental session enabled

    If the experimental.session flag is enabled when using the Netlify adapter, Astro will automatically configure the session storage using the Netlify Blobs driver. You can still manually configure the session storage if you need to use a different driver or want to customize the session storage configuration.

    See the experimental session docs for more information on configuring session storage.

Patch Changes

  • Updated dependencies []:
    • @astrojs/underscore-redirects@0.6.0

6.1.0

Minor Changes

Patch Changes

6.0.1

Patch Changes

6.0.0

Major Changes

  • #367 e02b54a Thanks @alexanderniebuhr! - Removed support for the Squoosh image service. As the underlying library libsquoosh is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.

    Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.

    - import { squooshImageService } from "astro/config";
    import { defineConfig } from "astro/config";
    
    export default defineConfig({
    -  image: {
    -    service: squooshImageService()
    -  }
    });
    

    If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh

  • #367 e02b54a Thanks @alexanderniebuhr! - Deprecates the functionPerRoute option

    This option is now deprecated, and will be removed entirely in Astro v5.0. We suggest removing this option from your configuration as soon as you are able to:

    import { defineConfig } from 'astro/config';
    import vercel from '@astrojs/vercel/serverless';
    
    export default defineConfig({
      // ...
      output: 'server',
      adapter: vercel({
    -     functionPerRoute: true,
      }),
    });
    
  • #375 e7881f7 Thanks @Princesseuh! - Updates internal code to works with Astro 5 changes to hybrid rendering. No changes are necessary to your project, apart from using Astro 5

  • #397 776a266 Thanks @Princesseuh! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.

    Starting from this release, no breaking changes will be introduced unless absolutely necessary.

    To learn how to upgrade, check out the Astro v5.0 upgrade guide in our beta docs site.

  • #451 f248546 Thanks @ematipico! - Updates esbuild dependency to v0.24.0

  • #392 3a49eb7 Thanks @Princesseuh! - Updates internal code for Astro 5 changes. No changes is required to your project, apart from using Astro 5

Minor Changes

6.0.0-beta.1

Major Changes

6.0.0-beta.0

Major Changes

  • #367 e02b54a Thanks @alexanderniebuhr! - Removed support for the Squoosh image service. As the underlying library libsquoosh is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.

    Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.

    - import { squooshImageService } from "astro/config";
    import { defineConfig } from "astro/config";
    
    export default defineConfig({
    -  image: {
    -    service: squooshImageService()
    -  }
    });
    

    If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh

  • #367 e02b54a Thanks @alexanderniebuhr! - Deprecates the functionPerRoute option

    This option is now deprecated, and will be removed entirely in Astro v5.0. We suggest removing this option from your configuration as soon as you are able to:

    import { defineConfig } from 'astro/config';
    import vercel from '@astrojs/vercel/serverless';
    
    export default defineConfig({
      // ...
      output: 'server',
      adapter: vercel({
    -     functionPerRoute: true,
      }),
    });
    
  • #375 e7881f7 Thanks @Princesseuh! - Updates internal code to works with Astro 5 changes to hybrid rendering. No changes are necessary to your project, apart from using Astro 5

  • #397 776a266 Thanks @Princesseuh! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.

    Starting from this release, no breaking changes will be introduced unless absolutely necessary.

    To learn how to upgrade, check out the Astro v5.0 upgrade guide in our beta docs site.

  • #392 3a49eb7 Thanks @Princesseuh! - Updates internal code for Astro 5 changes. No changes is required to your project, apart from using Astro 5

Minor Changes

5.5.4

Patch Changes

5.5.3

Patch Changes

5.5.2

Patch Changes

5.5.1

Patch Changes

  • #350 2248bc7 Thanks @matthewp! - Apply polyfills immediately on function execution

    This moves up when the polyfills are applied so that they are present before Astro runs, preventing a race condition that can cause crypto to not be defined early enough in Node 18.

5.5.0

Minor Changes

5.4.0

Minor Changes

Patch Changes

  • #286 e2ecf64 Thanks @theoephraim! - Allows support for node: prefixed imports if using the Adapter with edgeMiddleware: true

5.3.5

Patch Changes

  • #316 d81806a Thanks @ascorbic! - Fixes a regression where edge middleware tried to bundle node builtins

5.3.4

Patch Changes

  • #313 55a3e1a Thanks @ascorbic! - Fixes an issue where files were not included in the SSR function when built in a monorepo

5.3.3

Patch Changes

  • #296 8a00cad Thanks @ascorbic! - Improves performance for serverless function builds by not bundling dependencies

5.3.2

Patch Changes

5.3.1

Patch Changes

5.3.0

Minor Changes

5.2.1

Patch Changes

  • #255 3fa962d Thanks @ascorbic! - Fixes an issue with edge middleware where process.env was not defined, by using a polyfill to shim it

5.2.0

Minor Changes

5.1.3

Patch Changes

5.1.2

Patch Changes

5.1.1

Patch Changes

5.1.0

Minor Changes

  • #152 816bdc42e0665904e418dd0137bd6a7c8c74307f Thanks @lilnasy! - Implements verification for edge middleware. This is a security measure to ensure that your serverless functions are only ever called by your edge middleware and not by a third party.

    When edgeMiddleware is enabled, the serverless function will now respond with 403 Forbidden for requests that are not verified to have come from the generated edge middleware. No user action is necessary.

5.0.1

Patch Changes

5.0.0

Major Changes

4.1.1

Patch Changes

4.1.0

Minor Changes

4.0.2

Patch Changes

4.0.1

Patch Changes

4.0.0

Major Changes

  • #84 ca64544 Thanks @Skn0tt! - # Netlify Adapter v4 simplifies static + SSR deployments

    This update is a complete overhaul of the Netlify adapter. It simplifies the user-facing config, and resolves a number of bugs along the way.

    Here's what changes:

    Netlify Context is automatically available via Locals

    In v3, you could use netlify-edge-middleware.ts to inject data from the Netlify context into your Astro locals. In v4, this file is no longer needed because the Netlify context is automatically made available via Astro.locals.netlify.context. You can use this context to access information about the user (like geolocation or IP address), your Netlify site (like deploy ID) or the request (like its request ID or the CDN region it's served from).

    Action Required: Remove the netlify-edge-middleware.ts or netlify-edge-middleware.js file. In your codebase, change all usage of locals injected through that file to use Astro.locals.netlify.context instead.

    Image CDN

    v4 of this adapter integrates your Astro site with Netlify Image CDN. This allows transforming images on-the-fly without impacting build times. It's implemented using an Astro Image Service, and enabled by default.

    Replacement for On-Demand Builders

    On-Demand Builders (ODB) allows SSR-Rendered pages to be cached using a Time to Live (TTL) strategy. While the Netlify platform continues to support existing pages with ODBs, we now recommend using the much more powerful Fine-Grained Cache Control going forward.

    In v3, you could deploy your SSR-Rendered Astro pages to ODBs by enabling the builders config option, and then specifying the TTL on a per-page basis. In v4, a new cacheOnDemandPages option replaces this config option. Take a look at the README to learn more about this.

    Action Required: Replace the builders config option with cacheOnDemandPages.

    // astro.config.mjs
    export default defineConfig({
      // ...
      adapter: netlify({
    -   builders: true
    +   cacheOnDemandPages: true
      }),
    });
    

    functionPerRoute was removed

    In v3, the functionPerRoute option allowed the SSR routes to be split up into multiple Netlify Functions. This reduced the bundle sizes of each individual function, with the intention of speeding up code parsing, and therefore the time of cold starts. In practice, this benefit is often nullified by the increase in number of cold starts - more handlers means fewer requests per handler, means more cold starts.

    In v4, support for this deployment mode was removed.

    Action Required: Remove the functionPerRoute field from your config.

    binaryMediaTypes was removed

    binaryMediaTypes was a workaround required for some Astro endpoints, because v3 deployed those as "old" Netlify Functions (now referred to as "Lambda Compatibility Mode"). v4 uses the new Netlify Functions 2.0, which simply doesn't need this workaround anymore - so we're removing it 🎉

    Action Required: Remove the binaryMediaTypes field from your config.

3.1.1

Patch Changes

  • #100 1195955 Thanks @Jinksi! - Fixes a typo for the peerDependency range in package.json, which prevents upgrade to Astro 4.0.

3.1.0

Minor Changes

3.0.4

Patch Changes

3.0.3

Patch Changes

3.0.2

Patch Changes

  • #8661 008f7647c Thanks @Skn0tt! - fix build failures because of CJS builds and top-level await

  • Updated dependencies [69fbf95b2]:

    • astro@3.1.4
    • @astrojs/underscore-redirects@0.3.0

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

  • #8188 7511a4980 Thanks @ematipico! - When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits of astro:assets such as enforcing alt, no CLS etc to users

  • #8188 148e61d24 Thanks @ematipico! - Reduced the amount of polyfills provided by Astro. Astro will no longer provide (no-op) polyfills for several web apis such as HTMLElement, Image or Document. If you need access to those APIs on the server, we recommend using more proper polyfills available on npm.

  • #8029 2ee418e06 Thanks @matthewp! - Remove the Netlify Edge adapter

    @astrojs/netlify/functions now supports Edge middleware, so a separate adapter for Edge itself (deploying your entire app to the edge) is no longer necessary. Please update your Astro config to reflect this change:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    - import netlify from '@astrojs/netlify/edge';
    + import netlify from '@astrojs/netlify/functions';
    
    export default defineConfig({
     output: 'server',
     adapter: netlify({
    +    edgeMiddleware: true
     }),
    });
    

    This adapter had several known limitations and compatibility issues that prevented many people from using it in production. To reduce maintenance costs and because we have a better story with Serveless + Edge Middleware, we are removing the Edge adapter.

Minor Changes

  • #8188 cd2d7e769 Thanks @ematipico! - Introduced the concept of feature map. A feature map is a list of features that are built-in in Astro, and an Adapter can tell Astro if it can support it.

    import { AstroIntegration } from './astro';
    
    function myIntegration(): AstroIntegration {
      return {
        name: 'astro-awesome-list',
        // new feature map
        supportedAstroFeatures: {
          hybridOutput: 'experimental',
          staticOutput: 'stable',
          serverOutput: 'stable',
          assets: {
            supportKind: 'stable',
            isSharpCompatible: false,
            isSquooshCompatible: false,
          },
        },
      };
    }
    
  • #8188 80f1494cd Thanks @ematipico! - The build.split and build.excludeMiddleware configuration options are deprecated and have been replaced by options in the adapter config.

    If your config includes the build.excludeMiddleware option, replace it with edgeMiddleware in your adapter options:

    import { defineConfig } from "astro/config";
    import netlify from "@astrojs/netlify/functions";
    
    export default defineConfig({
         build: {
    -        excludeMiddleware: true
         },
         adapter: netlify({
    +        edgeMiddleware: true
         }),
    });
    

    If your config includes the build.split option, replace it with functionPerRoute in your adapter options:

    import { defineConfig } from "astro/config";
    import netlify from "@astrojs/netlify/functions";
    
    export default defineConfig({
         build: {
    -        split: true
         },
         adapter: netlify({
    +        functionPerRoute: true
         }),
    });
    

Patch Changes

3.0.0-rc.2

Major Changes

Patch Changes

3.0.0-beta.1

Major Changes

  • #8029 2ee418e06 Thanks @matthewp! - Remove the Netlify Edge adapter

    @astrojs/netlify/functions now supports Edge middleware, so a separate adapter for Edge itself (deploying your entire app to the edge) is no longer necessary. Please update your Astro config to reflect this change:

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    - import netlify from '@astrojs/netlify/edge';
    + import netlify from '@astrojs/netlify/functions';
    
    export default defineConfig({
     output: 'server',
     adapter: netlify({
    +    edgeMiddleware: true
     }),
    });
    

    This adapter had several known limitations and compatibility issues that prevented many people from using it in production. To reduce maintenance costs and because we have a better story with Serveless + Edge Middleware, we are removing the Edge adapter.

Patch Changes

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.

  • c022a4217 Thanks @Princesseuh! - When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits of astro:assets such as enforcing alt, no CLS etc to users

  • 3dc1ca2fa Thanks @Princesseuh! - Reduced the amount of polyfills provided by Astro. Astro will no longer provide (no-op) polyfills for several web apis such as HTMLElement, Image or Document. If you need access to those APIs on the server, we recommend using more proper polyfills available on npm.

Minor Changes

  • 9b4f70a62 Thanks @ematipico! - Introduced the concept of feature map. A feature map is a list of features that are built-in in Astro, and an Adapter can tell Astro if it can support it.

    import { AstroIntegration } from './astro';
    
    function myIntegration(): AstroIntegration {
      return {
        name: 'astro-awesome-list',
        // new feature map
        supportedAstroFeatures: {
          hybridOutput: 'experimental',
          staticOutput: 'stable',
          serverOutput: 'stable',
          assets: {
            supportKind: 'stable',
            isSharpCompatible: false,
            isSquooshCompatible: false,
          },
        },
      };
    }
    
  • 3fdf509b2 Thanks @ematipico! - The build.split and build.excludeMiddleware configuration options are deprecated and have been replaced by options in the adapter config.

    If your config includes the build.excludeMiddleware option, replace it with edgeMiddleware in your adapter options:

    import { defineConfig } from "astro/config";
    import netlify from "@astrojs/netlify/functions";
    
    export default defineConfig({
         build: {
    -        excludeMiddleware: true
         },
         adapter: netlify({
    +        edgeMiddleware: true
         }),
    });
    

    If your config includes the build.split option, replace it with functionPerRoute in your adapter options:

    import { defineConfig } from "astro/config";
    import netlify from "@astrojs/netlify/functions";
    
    export default defineConfig({
         build: {
    -        split: true
         },
         adapter: netlify({
    +        functionPerRoute: true
         }),
    });
    

Patch Changes

2.6.0

Minor Changes

  • #7975 f974c95a2 Thanks @lilnasy! - If you are using Netlify's On-demand Builders, you can now specify how long your pages should remain cached. By default, all pages will be rendered on first visit and reused on every subsequent visit until a redeploy. To set a custom revalidation time, call the runtime.setBuildersTtl() local in either your frontmatter or middleware.

    ---
    import Layout from '../components/Layout.astro';
    
    if (import.meta.env.PROD) {
      // revalidates every 45 seconds
      Astro.locals.runtime.setBuildersTtl(45);
    }
    ---
    
    <Layout title="Astro on Netlify">
      {new Date(Date.now())}
    </Layout>
    

Patch Changes

2.5.2

Patch Changes

2.5.1

Patch Changes

2.5.0

Minor Changes

Patch Changes

2.4.0

Minor Changes

  • #7615 f21357b69 Thanks @ematipico! - The Netlify adapter builds to a single function by default. Astro 2.7 added support for splitting your build into separate entry points per page. If you use this configuration, the Netlify adapter will generate a separate function for each page. This can help reduce the size of each function so they are only bundling code used on that page.

    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import netlify from '@astrojs/netlify/functions';
    
    export default defineConfig({
      output: 'server',
      adapter: netlify(),
      build: {
        split: true,
      },
    });
    

Patch Changes

  • Updated dependencies [f21357b69, 86e19c7cf]:
    • @astrojs/underscore-redirects@0.2.0
    • astro@2.8.2

2.3.0

Minor Changes

  • #7067 57f8d14c0 Thanks @matthewp! - Support for experimental redirects

    This adds support for the redirects RFC in the Netlify adapter, including a new @astrojs/netlify/static adapter for static sites.

    No changes are necessary when using SSR. Simply use configured redirects and the adapter will update your _redirects file.

Patch Changes

2.2.3

Patch Changes

2.2.2

Patch Changes

2.2.1

Patch Changes

2.2.0

Minor Changes

Patch Changes

2.1.3

Patch Changes

2.1.2

Patch Changes

2.1.1

Patch Changes

2.1.0

Minor Changes

Patch Changes

2.0.0

Major Changes

  • #5584 9963c6e4d & #5842 c4b0cb8bf Thanks @wulinsheng123 and @natemoo-re! - Breaking Change: client assets are built to an _astro directory in the build output directory. Previously these were built to various locations, including assets/, chunks/ and the root of build output.

    You can control this location with the new build configuration option named assets.

  • #5707 5eba34fcc Thanks @bluwy! - Remove astro:build:start backwards compatibility code

  • #5806 7572f7402 Thanks @matthewp! - Make astro a peerDependency of integrations

    This marks astro as a peerDependency of several packages that are already getting major version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.

Patch Changes

2.0.0-beta.4

Patch Changes

2.0.0-beta.3

Patch Changes

2.0.0-beta.2

Major Changes

  • #5842 c4b0cb8bf Thanks @natemoo-re! - Breaking Change: client assets are built to an _astro directory in the build output directory. Previously these were built to various locations, including assets/, chunks/ and the root of build output.

    You can control this location with the new build configuration option named assets.

  • #5806 7572f7402 Thanks @matthewp! - Make astro a peerDependency of integrations

    This marks astro as a peerDependency of several packages that are already getting major version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.

Patch Changes

2.0.0-beta.1

Patch Changes

2.0.0-beta.0

Major Changes

1.3.0

Minor Changes

  • #5297 d2960984c Thanks @natemoo-re! - Introduces the experimental Prerender API.

    Note

    This API is not yet stable and is subject to possible breaking changes!

    • Deploy an Astro server without sacrificing the speed or cacheability of static HTML.
    • The Prerender API allows you to statically prerender specific pages/ at build time.

    Usage

    • First, run astro build --experimental-prerender or enable experimental: { prerender: true } in your astro.config.mjs file.
    • Then, include export const prerender = true in any file in the pages/ directory that you wish to prerender.

1.2.2

Patch Changes

1.2.1

Patch Changes

1.2.0

Minor Changes

  • #5056 e55af8a23 Thanks @matthewp! - # New build configuration

    The ability to customize SSR build configuration more granularly is now available in Astro. You can now customize the output folder for server (the server code for SSR), client (your client-side JavaScript and assets), and serverEntry (the name of the entrypoint server module). Here are the defaults:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      output: 'server',
      build: {
        server: './dist/server/',
        client: './dist/client/',
        serverEntry: 'entry.mjs',
      },
    });
    

    These new configuration options are only supported in SSR mode and are ignored when building to SSG (a static site).

    Integration hook change

    The integration hook astro:build:start includes a param buildConfig which includes all of these same options. You can continue to use this param in Astro 1.x, but it is deprecated in favor of the new build.config options. All of the built-in adapters have been updated to the new format. If you have an integration that depends on this param we suggest upgrading to do this instead:

    export default function myIntegration() {
      return {
        name: 'my-integration',
        hooks: {
          'astro:config:setup': ({ updateConfig }) => {
            updateConfig({
              build: {
                server: '...',
              },
            });
          },
        },
      };
    }
    

1.1.0

Minor Changes

  • #4876 d3091f89e Thanks @matthewp! - Adds the Astro.cookies API

    Astro.cookies is a new API for manipulating cookies in Astro components and API routes.

    In Astro components, the new Astro.cookies object is a map-like object that allows you to get, set, delete, and check for a cookie's existence (has):

    ---
    type Prefs = {
      darkMode: boolean;
    };
    
    Astro.cookies.set<Prefs>(
      'prefs',
      { darkMode: true },
      {
        expires: '1 month',
      },
    );
    
    const prefs = Astro.cookies.get<Prefs>('prefs').json();
    ---
    
    <body data-theme={prefs.darkMode ? 'dark' : 'light'}></body>
    

    Once you've set a cookie with Astro.cookies it will automatically be included in the outgoing response.

    This API is also available with the same functionality in API routes:

    export function post({ cookies }) {
      cookies.set('loggedIn', false);
    
      return new Response(null, {
        status: 302,
        headers: {
          Location: '/login',
        },
      });
    }
    

    See the RFC to learn more.

Patch Changes

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

1.0.4

Patch Changes

1.0.3

Patch Changes

1.0.2

Patch Changes

1.0.1

Patch Changes

1.0.0

Major Changes

Patch Changes

  • Updated dependencies [04ad44563]:
    • @astrojs/webapi@1.0.0

0.5.0

Minor Changes

  • #4015 6fd161d76 Thanks @matthewp! - New output configuration option

    This change introduces a new "output target" configuration option (output). Setting the output target lets you decide the format of your final build, either:

    • "static" (default): A static site. Your final build will be a collection of static assets (HTML, CSS, JS) that you can deploy to any static site host.
    • "server": A dynamic server application. Your final build will be an application that will run in a hosted server environment, generating HTML dynamically for different requests.

    If output is omitted from your config, the default value "static" will be used.

    When using the "server" output target, you must also include a runtime adapter via the adapter configuration. An adapter will adapt your final build to run on the deployed platform of your choice (Netlify, Vercel, Node.js, Deno, etc).

    To migrate: No action is required for most users. If you currently define an adapter, you will need to also add output: 'server' to your config file to make it explicit that you are building a server. Here is an example of what that change would look like for someone deploying to Netlify:

    import { defineConfig } from 'astro/config';
    import netlify from '@astrojs/netlify/functions';
    
    export default defineConfig({
      adapter: netlify(),
    + output: 'server',
    });
    
  • #3973 5a23483ef Thanks @matthewp! - Adds support for Astro.clientAddress

    The new Astro.clientAddress property allows you to get the IP address of the requested user.

    
    

    This property is only available when building for SSR, and only if the adapter you are using supports providing the IP address. If you attempt to access the property in a SSG app it will throw an error.

0.4.10

Patch Changes

0.4.9

Patch Changes

0.4.8

Patch Changes

0.4.7

Patch Changes

  • #3734 4acd245d Thanks @bholmesdev! - Fix: append shim to top of built file to avoid "can't read process of undefined" issues

0.4.6

Patch Changes

0.4.5

Patch Changes

0.4.4

Patch Changes

0.4.3

Patch Changes

0.4.2

Patch Changes

  • #3503 207f58d1 Thanks @williamtetlow! - Alias from 'astro' imports to '@astro/types' Update Deno and Netlify integrations to handle vite.resolves.alias as an array

0.4.1

Patch Changes

0.4.0

Minor Changes

0.3.4

Patch Changes

0.3.3

Patch Changes

0.3.2

Patch Changes

0.3.1

Patch Changes

0.3.0

Minor Changes

0.2.3

Patch Changes

0.2.2

Patch Changes

0.2.1

Patch Changes

0.2.0

Minor Changes

  • 732ea388 Thanks @FredKSchott! - Improve the Netlify adapter:
    1. Remove site config requirement
    2. Fix an issue where query params were being stripped
    3. Pass the event body to the request object

Patch Changes

0.1.1-beta.1

Patch Changes

0.1.1-beta.0

Patch Changes

0.1.0

Minor Changes

0.0.2

Patch Changes

  • #2879 80034c6c Thanks @matthewp! - Netlify Adapter

    This change adds a Netlify adapter that uses Netlify Functions. You can use it like so:

    import { defineConfig } from 'astro/config';
    import netlify from '@astrojs/netlify/functions';
    
    export default defineConfig({
      adapter: netlify(),
    });