diff options
Diffstat (limited to 'packages/integrations')
-rw-r--r-- | packages/integrations/cloudflare/CHANGELOG.md | 92 | ||||
-rw-r--r-- | packages/integrations/cloudflare/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/markdoc/CHANGELOG.md | 36 | ||||
-rw-r--r-- | packages/integrations/markdoc/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/netlify/CHANGELOG.md | 92 | ||||
-rw-r--r-- | packages/integrations/netlify/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/node/CHANGELOG.md | 87 | ||||
-rw-r--r-- | packages/integrations/node/package.json | 2 |
8 files changed, 311 insertions, 4 deletions
diff --git a/packages/integrations/cloudflare/CHANGELOG.md b/packages/integrations/cloudflare/CHANGELOG.md index f4bfcaf9e..153e65388 100644 --- a/packages/integrations/cloudflare/CHANGELOG.md +++ b/packages/integrations/cloudflare/CHANGELOG.md @@ -1,5 +1,97 @@ # @astrojs/cloudflare +## 12.5.0 + +### Minor Changes + +- [#13527](https://github.com/withastro/astro/pull/13527) [`2fd6a6b`](https://github.com/withastro/astro/commit/2fd6a6b7aa51a4713af7fac37d5dfd824543c1bc) Thanks [@ascorbic](https://github.com/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](https://astro.build/en/guides/on-demand-rendering/). 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: + + ```astro + --- + 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: + + ```js + 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`: + + ```astro + --- + 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`: + + ```js + 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: + + ```astro + --- + 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: + + ```diff + import { defineConfig } from 'astro/config'; + import node from '@astrojs/node'; + + export default defineConfig({ + adapter: node({ + mode: "standalone", + }), + - experimental: { + - session: true, + - }, + }); + ``` + + See [the sessions guide](https://docs.astro.build/en/guides/sessions/) for more information. + +### Patch Changes + +- Updated dependencies []: + - @astrojs/underscore-redirects@0.6.0 + ## 12.4.1 ### Patch Changes diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index 3f5c6350f..650bf801a 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/cloudflare", "description": "Deploy your site to Cloudflare Workers/Pages", - "version": "12.4.1", + "version": "12.5.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/markdoc/CHANGELOG.md b/packages/integrations/markdoc/CHANGELOG.md index b60c3c796..a699cce73 100644 --- a/packages/integrations/markdoc/CHANGELOG.md +++ b/packages/integrations/markdoc/CHANGELOG.md @@ -1,5 +1,41 @@ # @astrojs/markdoc +## 0.14.0 + +### Minor Changes + +- [#13578](https://github.com/withastro/astro/pull/13578) [`406501a`](https://github.com/withastro/astro/commit/406501aeb7f314ae5c31f31a373c270e3b9ec715) Thanks [@stramel](https://github.com/stramel)! - The SVG import feature introduced behind a flag in [v5.0.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#500) is no longer experimental and is available for general use. + + This feature allows you to import SVG files directly into your Astro project as components and inline them into your HTML. + + To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component. + + ```astro + --- + import Logo from './path/to/svg/file.svg'; + --- + + <Logo <Logo width={64} height={64} fill="currentColor" /> + ``` + + If you have been waiting for stabilization before using the SVG Components feature, you can now do so. + + If you were previously using this feature, please remove the experimental flag from your Astro config: + + ```diff + import { defineConfig } from 'astro' + + export default defineConfig({ + - experimental: { + - svg: true, + - } + }) + ``` + + Additionally, a few features that were available during the experimental stage were removed in a previous release. Please see [the v5.6.0 changelog](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#560) for details if you have not yet already updated your project code for the experimental feature accordingly. + + Please see the [SVG Components guide in docs](https://docs.astro.build/en/guides/images/#svg-components) for more about this feature. + ## 0.13.4 ### Patch Changes diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 6f07eaf98..9566b4c41 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/markdoc", "description": "Add support for Markdoc in your Astro site", - "version": "0.13.4", + "version": "0.14.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/netlify/CHANGELOG.md b/packages/integrations/netlify/CHANGELOG.md index faadc2dff..635d1610a 100644 --- a/packages/integrations/netlify/CHANGELOG.md +++ b/packages/integrations/netlify/CHANGELOG.md @@ -1,5 +1,97 @@ # @astrojs/netlify +## 6.3.0 + +### Minor Changes + +- [#13527](https://github.com/withastro/astro/pull/13527) [`2fd6a6b`](https://github.com/withastro/astro/commit/2fd6a6b7aa51a4713af7fac37d5dfd824543c1bc) Thanks [@ascorbic](https://github.com/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](https://astro.build/en/guides/on-demand-rendering/). 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: + + ```astro + --- + 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: + + ```js + 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`: + + ```astro + --- + 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`: + + ```js + 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: + + ```astro + --- + 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: + + ```diff + import { defineConfig } from 'astro/config'; + import node from '@astrojs/node'; + + export default defineConfig({ + adapter: node({ + mode: "standalone", + }), + - experimental: { + - session: true, + - }, + }); + ``` + + See [the sessions guide](https://docs.astro.build/en/guides/sessions/) for more information. + +### Patch Changes + +- Updated dependencies []: + - @astrojs/underscore-redirects@0.6.0 + ## 6.2.6 ### Patch Changes diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index eec86017a..4a0860647 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/netlify", "description": "Deploy your site to Netlify", - "version": "6.2.6", + "version": "6.3.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md index 5b86cca17..b4df5833b 100644 --- a/packages/integrations/node/CHANGELOG.md +++ b/packages/integrations/node/CHANGELOG.md @@ -1,5 +1,92 @@ # @astrojs/node +## 9.2.0 + +### Minor Changes + +- [#13527](https://github.com/withastro/astro/pull/13527) [`2fd6a6b`](https://github.com/withastro/astro/commit/2fd6a6b7aa51a4713af7fac37d5dfd824543c1bc) Thanks [@ascorbic](https://github.com/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](https://astro.build/en/guides/on-demand-rendering/). 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: + + ```astro + --- + 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: + + ```js + 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`: + + ```astro + --- + 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`: + + ```js + 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: + + ```astro + --- + 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: + + ```diff + import { defineConfig } from 'astro/config'; + import node from '@astrojs/node'; + + export default defineConfig({ + adapter: node({ + mode: "standalone", + }), + - experimental: { + - session: true, + - }, + }); + ``` + + See [the sessions guide](https://docs.astro.build/en/guides/sessions/) for more information. + ## 9.1.3 ### Patch Changes diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 62530c276..f928d52a8 100644 --- a/packages/integrations/node/package.json +++ b/packages/integrations/node/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/node", "description": "Deploy your site to a Node.js server", - "version": "9.1.3", + "version": "9.2.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", |