summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Bjorn Lu <bjornlu.dev@gmail.com> 2023-01-04 03:06:33 +0800
committerGravatar GitHub <noreply@github.com> 2023-01-03 14:06:33 -0500
commitdd56c19411b126439b8bc42d681b6fa8c06e8c61 (patch)
tree0d3704e6580c33499a33412ba553ec709d3b3f67
parent5eba34fcc663def20bdf6e0daad02a6a5472776b (diff)
downloadastro-dd56c19411b126439b8bc42d681b6fa8c06e8c61.tar.gz
astro-dd56c19411b126439b8bc42d681b6fa8c06e8c61.tar.zst
astro-dd56c19411b126439b8bc42d681b6fa8c06e8c61.zip
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>
-rw-r--r--.changeset/lovely-terms-drive.md5
-rw-r--r--packages/astro/src/core/render/core.ts10
2 files changed, 6 insertions, 9 deletions
diff --git a/.changeset/lovely-terms-drive.md b/.changeset/lovely-terms-drive.md
new file mode 100644
index 000000000..1a84e0bbd
--- /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 0516a4d8f..6c486ae34 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,