diff --git a/.changeset/lovely-terms-drive.md b/.changeset/lovely-terms-drive.md new file mode 100644 index 000000000000..1a84e0bbdb9e --- /dev/null +++ b/.changeset/lovely-terms-drive.md @@ -0,0 +1,5 @@ +--- +'astro': major +--- + +Remove MDX Fragment hack. This was used by `@astrojs/mdx` to access the `Fragment` component, but isn't require anymore since `@astrojs/mdx` v0.12.1. diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts index 0516a4d8ff97..6c486ae346b9 100644 --- a/packages/astro/src/core/render/core.ts +++ b/packages/astro/src/core/render/core.ts @@ -3,7 +3,7 @@ import type { LogOptions } from '../logger/core.js'; import type { RenderContext } from './context.js'; import type { Environment } from './environment.js'; -import { Fragment, renderPage as runtimeRenderPage } from '../../runtime/server/index.js'; +import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js'; import { attachToResponse } from '../cookies/index.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; import { getParams } from '../routing/params.js'; @@ -113,14 +113,6 @@ export async function renderPage(mod: ComponentInstance, ctx: RenderContext, env Object.assign(pageProps, { components: (mod as any).components }); } - // HACK: expose `Fragment` for all MDX components - // TODO: Remove in Astro v2 — redundant as of @astrojs/mdx@>0.12.0 - if (typeof mod.default === 'function' && mod.default.name.startsWith('MDX')) { - Object.assign(pageProps, { - components: Object.assign((pageProps?.components as any) ?? {}, { Fragment }), - }); - } - const response = await runtimeRenderPage( result, Component,