diff options
author | 2025-02-12 14:57:03 +0000 | |
---|---|---|
committer | 2025-02-12 14:57:03 +0000 | |
commit | 8d4e566f5420c8a5406e1e40e8bae1c1f87cbe37 (patch) | |
tree | ad8cf069f784b7e739f4ce29ce53c4c368dd167f /packages/integrations/node/src | |
parent | 3b669555d7ab9da5427e7b7037699d4f905d3536 (diff) | |
download | astro-8d4e566f5420c8a5406e1e40e8bae1c1f87cbe37.tar.gz astro-8d4e566f5420c8a5406e1e40e8bae1c1f87cbe37.tar.zst astro-8d4e566f5420c8a5406e1e40e8bae1c1f87cbe37.zip |
feat: add support for automatic session driver config (#13145)
* feat: add support for automatic session driver config
* chore: fix error logic
* Lint test
* Add node support
* Add node test fixture
* Lock
* Add Netlify support
* Use workspace Astro version
* Format
* Changeset
* Add tests
* Add dep for tests
* chore: fix repo URL
* temp log
* Fix module resoltuion
* [skip ci] Update changeset
* chore: bump peer dependencies
* Changes from review
* Changeset changes from review
* Apply suggestions from code review
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
* More changeset detail
* Lock
---------
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/node/src')
-rw-r--r-- | packages/integrations/node/src/index.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/integrations/node/src/index.ts b/packages/integrations/node/src/index.ts index e91ed171b..a5dccc0c3 100644 --- a/packages/integrations/node/src/index.ts +++ b/packages/integrations/node/src/index.ts @@ -1,3 +1,4 @@ +import { fileURLToPath } from 'node:url'; import type { AstroAdapter, AstroIntegration } from 'astro'; import { AstroError } from 'astro/errors'; import type { Options, UserOptions } from './types.js'; @@ -33,11 +34,25 @@ export default function createIntegration(userOptions: UserOptions): AstroIntegr return { name: '@astrojs/node', hooks: { - 'astro:config:setup': async ({ updateConfig, config }) => { + 'astro:config:setup': async ({ updateConfig, config, logger }) => { + let session = config.session; + + if (config.experimental.session && !session?.driver) { + logger.info('Configuring experimental session support using filesystem storage'); + session = { + ...session, + driver: 'fs-lite', + options: { + base: fileURLToPath(new URL('sessions', config.cacheDir)), + }, + }; + } + updateConfig({ image: { endpoint: config.image.endpoint ?? 'astro/assets/endpoint/node', }, + session, vite: { ssr: { noExternal: ['@astrojs/node'], |