@astrojs/netlify
π Patch Changes
-
#14078
38c2255Thanks @ascorbic! - Fixes a bug that caused remote images to sometimes not display correctly when using the Netlify Image CDN in local dev -
#14078
38c2255Thanks @ascorbic! - Adds a newdevFeaturesconfiguration 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.0introduced a potentially breaking change that enabled injecting Netlify environment variables inastro devby 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 thedevFeatures.environmentVariablesoption in their Astro config. Similarly, you can usedevFeatures.imagesto 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
devFeaturestotrueorfalseto 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
-
πΏ Minor Changes
- #13768
faa0effThanks @eduardoboucas! - Updates the adapter to use Netlifyβs Vite plugin in development.
This is an implementation update that does not require any change to your project code, but means that
astro devwill 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
- #13768
π Patch Changes
- #13972
db8f8beThanks @ematipico! - Fixes the internal implementation of the new featureexperimentalStaticHeaders, where dynamic routes were mapped to use always the same header. - Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0
- #13972
πΏ Minor Changes
-
#13952
de82ef2Thanks @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 generateResponseheaders 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
-
π Patch Changes
-
#13799
7036b05Thanks @Lofty-Brambles! - Fixes an issue where the adapter didnβt take into consideration theoutDirconfiguration. -
#13830
9371a67Thanks @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
-
π Patch Changes
-
#13792
7910feaThanks @alexeyzimarev! - Unify imported images detection across adapters -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.1
-
π Patch Changes
-
#13731
c3e80c2Thanks @jsparkdev! - update vite to latest version for fixing CVE -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.1
-
π Patch Changes
-
#13591
5dd2d3fThanks @florian-lefebvre! - Removes unused code -
Updated dependencies [
5dd2d3f]:- @astrojs/underscore-redirects@0.6.1
-
πΏ Minor Changes
-
#13527
2fd6a6bThanks @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' outputconst 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
sessionconfiguration 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
undefinedand 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.sessionflag 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
-
π Patch Changes
-
#13596
3752519Thanks @jsparkdev! - update vite to latest version to fix CVE -
#13547
360cb91Thanks @jsparkdev! - Updates vite to the latest version -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.0
-
π Patch Changes
-
#13526
ff9d69eThanks @jsparkdev! - updateviteto the latest version -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.0
-
π Patch Changes
-
#13505
a98ae5bThanks @ematipico! - Updates the dependencyviteto the latest. -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.0
-
π Patch Changes
- Updated dependencies [
042d1de]:- @astrojs/internal-helpers@0.6.1
- @astrojs/underscore-redirects@0.6.0
- Updated dependencies [
π Patch Changes
-
#13323
80926faThanks @ematipico! - Updatesesbuildandviteto the latest to avoid false positives audits warnings caused byesbuild. -
Updated dependencies [
1e11f5e]:- @astrojs/internal-helpers@0.6.0
- @astrojs/underscore-redirects@0.6.0
-
πΏ Minor Changes
-
#13194
1b5037bThanks @dfdez! - AddsincludedFilesandexcludedFilesconfiguration options to customize SSR function bundle contents.The
includeFilesproperty 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
fsoperations - Configuration files
- Template files
Similarly, you can use the
excludeFilesproperty 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.
- Data files loaded using
-
#13145
8d4e566Thanks @ascorbic! - Automatically configures Netlify Blobs storage when experimental session enabledIf the
experimental.sessionflag 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
-