diff --git a/.changeset/silly-beds-hammer.md b/.changeset/silly-beds-hammer.md new file mode 100644 index 000000000000..a8d44aaf76bc --- /dev/null +++ b/.changeset/silly-beds-hammer.md @@ -0,0 +1,7 @@ +--- +'astro': patch +--- + +**BREAKING CHANGE to the experimental `astro:env` feature only** + +Updates the adapter `astro:env` entrypoint from `astro:env/setup` to `astro/env/setup` diff --git a/packages/astro/client.d.ts b/packages/astro/client.d.ts index 8a277f5aaafe..0870d3dcc566 100644 --- a/packages/astro/client.d.ts +++ b/packages/astro/client.d.ts @@ -164,10 +164,6 @@ declare module 'astro:components' { export * from 'astro/components'; } -declare module 'astro:env/setup' { - export * from 'astro/virtual-modules/env-setup.js'; -} - type MD = import('./dist/@types/astro.js').MarkdownInstance>; interface ExportedMarkdownModuleEntities { frontmatter: MD['frontmatter']; diff --git a/packages/astro/package.json b/packages/astro/package.json index fca84cc51bd5..a167fc1bce34 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -33,6 +33,7 @@ }, "./env": "./env.d.ts", "./env/runtime": "./dist/env/runtime.js", + "./env/setup": "./dist/env/setup.js", "./types": "./types.d.ts", "./client": "./client.d.ts", "./astro-jsx": "./astro-jsx.d.ts", diff --git a/packages/astro/src/env/constants.ts b/packages/astro/src/env/constants.ts index 7a1e651553cf..19ea17c64ff0 100644 --- a/packages/astro/src/env/constants.ts +++ b/packages/astro/src/env/constants.ts @@ -4,7 +4,6 @@ export const VIRTUAL_MODULES_IDS = { internal: 'virtual:astro:env/internal', }; export const VIRTUAL_MODULES_IDS_VALUES = new Set(Object.values(VIRTUAL_MODULES_IDS)); -export const VIRTUAL_MODULE_SETUP_ID = 'astro:env/setup'; export const PUBLIC_PREFIX = 'PUBLIC_'; export const ENV_TYPES_FILE = 'env.d.ts'; diff --git a/packages/astro/src/env/setup.ts b/packages/astro/src/env/setup.ts new file mode 100644 index 000000000000..179067b10b24 --- /dev/null +++ b/packages/astro/src/env/setup.ts @@ -0,0 +1 @@ +export { setGetEnv, type GetEnv } from './runtime.js'; diff --git a/packages/astro/src/env/vite-plugin-env.ts b/packages/astro/src/env/vite-plugin-env.ts index 0a53ecd2fc0c..2f6a0708f181 100644 --- a/packages/astro/src/env/vite-plugin-env.ts +++ b/packages/astro/src/env/vite-plugin-env.ts @@ -9,7 +9,6 @@ import { TYPES_TEMPLATE_URL, VIRTUAL_MODULES_IDS, VIRTUAL_MODULES_IDS_VALUES, - VIRTUAL_MODULE_SETUP_ID, } from './constants.js'; import type { EnvSchema } from './schema.js'; import { getEnvFieldType, validateEnvVariable } from './validators.js'; @@ -81,9 +80,6 @@ export function astroEnv({ if (VIRTUAL_MODULES_IDS_VALUES.has(id)) { return resolveVirtualModuleId(id); } - if (id === VIRTUAL_MODULE_SETUP_ID) { - return this.resolve('astro/virtual-modules/env-setup.js'); - } }, load(id, options) { if (id === resolveVirtualModuleId(VIRTUAL_MODULES_IDS.client)) { diff --git a/packages/astro/src/virtual-modules/env-setup.ts b/packages/astro/src/virtual-modules/env-setup.ts deleted file mode 100644 index c86452975c60..000000000000 --- a/packages/astro/src/virtual-modules/env-setup.ts +++ /dev/null @@ -1 +0,0 @@ -export { setGetEnv, type GetEnv } from '../env/runtime.js'; diff --git a/packages/astro/test/test-adapter.js b/packages/astro/test/test-adapter.js index ab05d8811267..880b5fe6462a 100644 --- a/packages/astro/test/test-adapter.js +++ b/packages/astro/test/test-adapter.js @@ -53,7 +53,7 @@ export default function ({ ${ env ? ` - await import('astro:env/setup') + await import('astro/env/setup') .then(mod => mod.setGetEnv((key) => { const data = ${JSON.stringify(env)}; return data[key];