diff --git a/.changeset/six-keys-cheat.md b/.changeset/six-keys-cheat.md new file mode 100644 index 000000000..cf0c9bae5 --- /dev/null +++ b/.changeset/six-keys-cheat.md @@ -0,0 +1,5 @@ +--- +'astro': minor +--- + +Remove legacy handling for MDX content collections. Ensure you are using `@astrojs/mdx` v0.18 or above. diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 6e27920eb..f0abd1576 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -19,7 +19,6 @@ import { buildClientDirectiveEntrypoint } from '../core/client-directive/index.j import { mergeConfig } from '../core/config/config.js'; import { info, type LogOptions } from '../core/logger/core.js'; import { isServerLikeOutput } from '../prerender/utils.js'; -import { mdxContentEntryType } from '../vite-plugin-markdown/content-entry-type.js'; async function withTakingALongTimeMsg({ name, @@ -150,15 +149,6 @@ export async function runHookConfigSetup({ logging, }); - // Add MDX content entry type to support older `@astrojs/mdx` versions - // TODO: remove in next Astro minor release - if ( - integration.name === '@astrojs/mdx' && - !updatedSettings.contentEntryTypes.find((c) => c.extensions.includes('.mdx')) - ) { - addContentEntryType(mdxContentEntryType); - } - // Add custom client directives to settings, waiting for compiled code by esbuild for (const [name, compiled] of addedClientDirectives) { updatedSettings.clientDirectives.set(name, await compiled); diff --git a/packages/astro/src/vite-plugin-markdown/content-entry-type.ts b/packages/astro/src/vite-plugin-markdown/content-entry-type.ts index a3489c940..92bb118d4 100644 --- a/packages/astro/src/vite-plugin-markdown/content-entry-type.ts +++ b/packages/astro/src/vite-plugin-markdown/content-entry-type.ts @@ -16,32 +16,3 @@ export const markdownContentEntryType: ContentEntryType = { // We need to handle propagation for Markdown because they support layouts which will bring in styles. handlePropagation: true, }; - -/** - * MDX content type for compatibility with older `@astrojs/mdx` versions - * TODO: remove in next Astro minor release - */ -export const mdxContentEntryType: ContentEntryType = { - extensions: ['.mdx'], - async getEntryInfo({ fileUrl, contents }: { fileUrl: URL; contents: string }) { - const parsed = parseFrontmatter(contents, fileURLToPath(fileUrl)); - return { - data: parsed.data, - body: parsed.content, - slug: parsed.data.slug, - rawData: parsed.matter, - }; - }, - // MDX can import scripts and styles, - // so wrap all MDX files with script / style propagation checks - handlePropagation: true, - contentModuleTypes: `declare module 'astro:content' { - interface Render { - '.mdx': Promise<{ - Content: import('astro').MarkdownInstance<{}>['Content']; - headings: import('astro').MarkdownHeading[]; - remarkPluginFrontmatter: Record; - }>; - } -}`, -};