Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .changeset/poor-mangos-fold.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ If you are using the Node.js adapter, you can use the `fs` driver to store sessi
adapter: node({ mode: 'standalone' }),
experimental: {
session: {
// Required: the name of the Unstorage driver
// Required: the name of the unstorage driver
driver: "fs",
},
},
}
```
If you are deploying to a serverless environment, you can use drivers such as `redis` or `netlifyBlobs` or `cloudflareKV` and optionally pass additional configuration options.
If you are deploying to a serverless environment, you can use drivers such as `redis`, `netlify-blobs`, `vercel-kv`, or `cloudflare-kv-binding` and optionally pass additional configuration options.

For more information, including using the session API with other adapters and a full list of supported drivers, see [the docs for experimental session support](https://docs.astro.build/en/reference/experimental-flags/sessions/). For even more details, and to leave feedback and participate in the development of this feature, [the Sessions RFC](https://github.com/withastro/roadmap/pull/1055).
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"tsconfck": "^3.1.4",
"ultrahtml": "^1.5.3",
"unist-util-visit": "^5.0.0",
"unstorage": "^1.12.0",
"unstorage": "^1.14.0",
"vfile": "^6.0.3",
"vite": "^6.0.1",
"vitefu": "^1.0.4",
Expand Down
10 changes: 5 additions & 5 deletions packages/astro/src/core/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,13 @@ export class AstroSession<TDriver extends SessionDriverName = any> {

if (this.#config.driver === 'test') {
this.#storage = (this.#config as SessionConfig<'test'>).options.mockStorage;
return this.#storage;
return this.#storage!;
}
// Use fsLite rather than fs, because fs can't be bundled. Add a default base path if not provided.
if (this.#config.driver === 'fs' || this.#config.driver === 'fsLite') {
// Use fs-lite rather than fs, because fs can't be bundled. Add a default base path if not provided.
if (this.#config.driver === 'fs' || this.#config.driver === 'fsLite' || this.#config.driver === 'fs-lite') {
this.#config.options ??= {};
this.#config.driver = 'fsLite';
(this.#config.options as BuiltinDriverOptions['fsLite']).base ??= '.astro/session';
this.#config.driver = 'fs-lite';
(this.#config.options as BuiltinDriverOptions['fs-lite']).base ??= '.astro/session';
}

if (!this.#config?.driver) {
Expand Down
1 change: 1 addition & 0 deletions packages/astro/test/fixtures/sessions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@netlify/blobs": "^8.1.0",
"astro": "workspace:*"
}
}
58 changes: 42 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading