0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

feat: do not use TLA

This commit is contained in:
Florian Lefebvre 2024-08-13 14:24:55 +02:00
parent 9d6dd211a8
commit 0962b38dc5
3 changed files with 7 additions and 14 deletions

View file

@ -1,6 +1,6 @@
---
'@astrojs/vercel': minor
'@astrojs/node': minor
'@astrojs/vercel': major
'@astrojs/node': major
---
Adds stable support for `astro:env`

View file

@ -1,17 +1,14 @@
import type { SSRManifest } from 'astro';
import { NodeApp, applyPolyfills } from 'astro/app/node';
import { setGetEnv } from 'astro/env/setup';
import createMiddleware from './middleware.js';
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(() => {});
setGetEnv((key) => process.env[key]);
applyPolyfills();
export function createExports(manifest: SSRManifest, options: Options) {
const app = new NodeApp(manifest);
options.trailingSlash = manifest.trailingSlash;

View file

@ -1,6 +1,7 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { SSRManifest } from 'astro';
import { NodeApp, applyPolyfills } from 'astro/app/node';
import { setGetEnv } from 'astro/env/setup';
import {
ASTRO_LOCALS_HEADER,
ASTRO_MIDDLEWARE_SECRET_HEADER,
@ -8,12 +9,7 @@ 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(() => {});
setGetEnv((key) => process.env[key]);
applyPolyfills();
export const createExports = (