summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2023-06-21 19:51:15 -0400
committerGravatar GitHub <noreply@github.com> 2023-06-21 19:51:15 -0400
commit76fcdb84dd828ac373b2dc739e57fadf650820fd (patch)
tree577d1de7d4c263af1881f5833576f1e45249612b
parent3f9f5c117e4e9e4a0c0a648cb6db9a3073cd5727 (diff)
downloadastro-76fcdb84dd828ac373b2dc739e57fadf650820fd.tar.gz
astro-76fcdb84dd828ac373b2dc739e57fadf650820fd.tar.zst
astro-76fcdb84dd828ac373b2dc739e57fadf650820fd.zip
Chore: remove legacy mdx content collections handler (#7353)
* chore: remove legacy mdx mapping * chore: changeset * chore: remove dead mdxEntryType * nit: comments on mdx pkg name Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> * smol smol smol nit: and vs or --------- Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
-rw-r--r--.changeset/six-keys-cheat.md5
-rw-r--r--packages/astro/src/integrations/index.ts10
-rw-r--r--packages/astro/src/vite-plugin-markdown/content-entry-type.ts29
3 files changed, 5 insertions, 39 deletions
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<T>({
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<string, any>;
- }>;
- }
-}`,
-};