Skip to content

Commit dd56c19

Browse files
bluwydelucis
andauthored
Remove MDX Fragment hack (#5716)
* Remove MDX Fragment hack * Update .changeset/lovely-terms-drive.md Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
1 parent 5eba34f commit dd56c19

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

.changeset/lovely-terms-drive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': major
3+
---
4+
5+
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.

packages/astro/src/core/render/core.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { LogOptions } from '../logger/core.js';
33
import type { RenderContext } from './context.js';
44
import type { Environment } from './environment.js';
55

6-
import { Fragment, renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
6+
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
77
import { attachToResponse } from '../cookies/index.js';
88
import { AstroError, AstroErrorData } from '../errors/index.js';
99
import { getParams } from '../routing/params.js';
@@ -113,14 +113,6 @@ export async function renderPage(mod: ComponentInstance, ctx: RenderContext, env
113113
Object.assign(pageProps, { components: (mod as any).components });
114114
}
115115

116-
// HACK: expose `Fragment` for all MDX components
117-
// TODO: Remove in Astro v2 — redundant as of @astrojs/mdx@>0.12.0
118-
if (typeof mod.default === 'function' && mod.default.name.startsWith('MDX')) {
119-
Object.assign(pageProps, {
120-
components: Object.assign((pageProps?.components as any) ?? {}, { Fragment }),
121-
});
122-
}
123-
124116
const response = await runtimeRenderPage(
125117
result,
126118
Component,

0 commit comments

Comments
 (0)