Skip to content

Commit bd0dd9d

Browse files
committed
Revert "feat: support .md overrides for content collections"
This reverts commit c06f83e.
1 parent 5b9a1f3 commit bd0dd9d

15 files changed

Lines changed: 40 additions & 94 deletions

File tree

examples/with-markdoc/src/content/docs/intro.md renamed to examples/with-markdoc/src/content/docs/intro.mdoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Welcome to Markdoc 👋
33
---
44

5-
This simple starter showcases Markdoc's features with Content Collections. All Markdoc features are supported, including this nifty built-in `{% table %}` tag:
5+
This simple starter showcases Markdoc with Content Collections. All Markdoc features are supported, including this nifty built-in `{% table %}` tag:
66

77
{% table %}
88
* Feature
99
* Supported
1010
---
11-
* `.mdoc` + `.md` in Content Collections
11+
* `.mdoc` in Content Collections
1212
* ✅
1313
---
1414
* Markdoc transform configuration

packages/astro/src/@types/astro.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,6 @@ export interface AstroConfig extends z.output<typeof AstroConfigSchema> {
978978
}
979979

980980
export interface ContentEntryType {
981-
name: string;
982981
extensions: string[];
983982
getEntryInfo(params: { fileUrl: URL; contents: string }): Promise<{
984983
data: Record<string, unknown>;

packages/astro/src/content/consts.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ export const STYLES_PLACEHOLDER = '@@ASTRO-STYLES@@';
66
export const SCRIPTS_PLACEHOLDER = '@@ASTRO-SCRIPTS@@';
77

88
export const CONTENT_TYPES_FILE = 'types.d.ts';
9-
export const MARKDOWN_CONTENT_ENTRY_TYPE_NAME = 'astro:markdown';
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
export { attachContentServerListeners } from './server-listeners.js';
22
export { createContentTypesGenerator } from './types-generator.js';
3-
export {
4-
contentObservable,
5-
getContentPaths,
6-
getDotAstroTypeReference,
7-
hasMdContentEntryTypeOverride,
8-
} from './utils.js';
9-
export { getMarkdownContentEntryType } from './markdown.js';
3+
export { contentObservable, getContentPaths, getDotAstroTypeReference } from './utils.js';
104
export { astroContentAssetPropagationPlugin } from './vite-plugin-content-assets.js';
115
export { astroContentImportPlugin } from './vite-plugin-content-imports.js';
126
export { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';

packages/astro/src/content/markdown.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

packages/astro/src/content/template/markdown-types.d.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/astro/src/content/template/types.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
declare module 'astro:content' {
2+
interface Render {
3+
'.md': Promise<{
4+
Content: import('astro').MarkdownInstance<{}>['Content'];
5+
headings: import('astro').MarkdownHeading[];
6+
remarkPluginFrontmatter: Record<string, any>;
7+
}>;
8+
}
9+
}
10+
111
declare module 'astro:content' {
212
export { z } from 'astro/zod';
313
export type CollectionEntry<C extends keyof typeof entryMap> =

packages/astro/src/content/utils.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ErrorPayload as ViteErrorPayload, normalizePath, ViteDevServer } from '
77
import { z } from 'zod';
88
import { AstroConfig, AstroSettings } from '../@types/astro.js';
99
import { AstroError, AstroErrorData } from '../core/errors/index.js';
10-
import { CONTENT_TYPES_FILE, MARKDOWN_CONTENT_ENTRY_TYPE_NAME } from './consts.js';
10+
import { CONTENT_TYPES_FILE } from './consts.js';
1111

1212
export const collectionConfigParser = z.object({
1313
schema: z.any().optional(),
@@ -312,7 +312,6 @@ export function contentObservable(initialCtx: ContentCtx): ContentObservable {
312312
}
313313

314314
export type ContentPaths = {
315-
templateDir: URL;
316315
contentDir: URL;
317316
cacheDir: URL;
318317
typesTemplate: URL;
@@ -330,7 +329,6 @@ export function getContentPaths(
330329
const configStats = search(fs, srcDir);
331330
const templateDir = new URL('../../src/content/template/', import.meta.url);
332331
return {
333-
templateDir,
334332
cacheDir: new URL('.astro/', root),
335333
contentDir: new URL('./content/', srcDir),
336334
typesTemplate: new URL('types.d.ts', templateDir),
@@ -349,11 +347,3 @@ function search(fs: typeof fsMod, srcDir: URL) {
349347
}
350348
return { exists: false, url: paths[0] };
351349
}
352-
353-
export function hasMdContentEntryTypeOverride(settings: Pick<AstroSettings, 'contentEntryTypes'>) {
354-
return settings.contentEntryTypes.some(
355-
(contentEntryType) =>
356-
contentEntryType.name !== MARKDOWN_CONTENT_ENTRY_TYPE_NAME &&
357-
contentEntryType.extensions.includes('.md')
358-
);
359-
}

packages/astro/src/core/config/settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { fileURLToPath, pathToFileURL } from 'url';
55
import jsxRenderer from '../../jsx/renderer.js';
66
import { createDefaultDevConfig } from './config.js';
77
import { loadTSConfig } from './tsconfig.js';
8+
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
89

910
export function createBaseSettings(config: AstroConfig): AstroSettings {
1011
return {
@@ -15,7 +16,7 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
1516
adapter: undefined,
1617
injectedRoutes: [],
1718
pageExtensions: ['.astro', '.html', ...SUPPORTED_MARKDOWN_FILE_EXTENSIONS],
18-
contentEntryTypes: [],
19+
contentEntryTypes: [markdownContentEntryType],
1920
renderers: [jsxRenderer],
2021
scripts: [],
2122
watchFiles: [],

packages/astro/src/integrations/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ import {
1212
HookParameters,
1313
RouteData,
1414
} from '../@types/astro.js';
15-
import { hasMdContentEntryTypeOverride } from '../content/utils.js';
1615
import type { SerializedSSRManifest } from '../core/app/types';
1716
import type { PageBuildData } from '../core/build/types';
1817
import { mergeConfig } from '../core/config/config.js';
1918
import { info, LogOptions } from '../core/logger/core.js';
20-
import { getMarkdownContentEntryType } from '../content/index.js';
2119

2220
async function withTakingALongTimeMsg<T>({
2321
name,
@@ -128,12 +126,6 @@ export async function runHookConfigSetup({
128126
}
129127

130128
updatedSettings.config = updatedConfig;
131-
if (!hasMdContentEntryTypeOverride(updatedSettings)) {
132-
updatedSettings.contentEntryTypes.push(
133-
await getMarkdownContentEntryType(updatedSettings.config, fs)
134-
);
135-
}
136-
137129
return updatedSettings;
138130
}
139131

0 commit comments

Comments
 (0)