Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for astro:env to node and vercel #11199

Merged
merged 4 commits into from
Jun 10, 2024
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
6 changes: 6 additions & 0 deletions .changeset/wet-chefs-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@astrojs/vercel': minor
'@astrojs/node': minor
---

Adds support for experimental `astro:env` released in Astro 4.10
1 change: 1 addition & 0 deletions packages/integrations/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function getAdapter(options: Options): AstroAdapter {
isSquooshCompatible: true,
},
i18nDomains: 'experimental',
envGetSecret: 'experimental',
},
};
}
Expand Down
6 changes: 6 additions & 0 deletions packages/integrations/node/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { createStandaloneHandler } from './standalone.js';
import startServer from './standalone.js';
import type { Options } from './types.js';

// Won't throw if the virtual module is not available because it's not supported in
// the users's astro version or if astro:env is not enabled in the project
await import('astro/env/setup')
.then((mod) => mod.setGetEnv((key) => process.env[key]))
.catch(() => {});

applyPolyfills();
export function createExports(manifest: SSRManifest, options: Options) {
const app = new NodeApp(manifest);
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function getAdapter({
isSquooshCompatible: true,
},
i18nDomains: 'experimental',
envGetSecret: 'experimental',
},
};
}
Expand Down
6 changes: 6 additions & 0 deletions packages/integrations/vercel/src/serverless/entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import {
ASTRO_PATH_PARAM,
} from './adapter.js';

// Won't throw if the virtual module is not available because it's not supported in
// the users's astro version or if astro:env is not enabled in the project
await import('astro/env/setup')
.then((mod) => mod.setGetEnv((key) => process.env[key]))
.catch(() => {});

applyPolyfills();

export const createExports = (
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/vercel/src/static/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function getAdapter(): AstroAdapter {
staticOutput: 'stable',
serverOutput: 'unsupported',
hybridOutput: 'unsupported',
envGetSecret: 'unsupported',
florian-lefebvre marked this conversation as resolved.
Show resolved Hide resolved
},
adapterFeatures: {
edgeMiddleware: false,
Expand Down
Loading