Skip to content

Latest commit

 

History

History
1140 lines (699 loc) · 81.1 KB

CHANGELOG.md

File metadata and controls

1140 lines (699 loc) · 81.1 KB

@astrojs/netlify

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

  • Updated dependencies [4de53ecc]:
    • @astrojs/webapi@0.12.0

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