From 61723b5269b716238133c6409eea145351b33f82 Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Thu, 9 Feb 2023 12:13:38 -0500 Subject: [PATCH] refactor: move plain md to content entry type --- packages/astro/src/content/consts.ts | 1 - packages/astro/src/content/utils.ts | 8 ++------ packages/astro/src/core/config/settings.ts | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/astro/src/content/consts.ts b/packages/astro/src/content/consts.ts index c034a2fdb..1f0470d5a 100644 --- a/packages/astro/src/content/consts.ts +++ b/packages/astro/src/content/consts.ts @@ -1,4 +1,3 @@ -export const defaultContentEntryExts = ['.md'] as const; export const PROPAGATED_ASSET_FLAG = 'astroPropagatedAssets'; export const CONTENT_FLAG = 'astroContent'; export const VIRTUAL_MODULE_ID = 'astro:content'; diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts index 2eaba6103..ba767c30f 100644 --- a/packages/astro/src/content/utils.ts +++ b/packages/astro/src/content/utils.ts @@ -7,7 +7,7 @@ import { ErrorPayload as ViteErrorPayload, normalizePath, ViteDevServer } from ' import { z } from 'zod'; import { AstroConfig, AstroSettings } from '../@types/astro.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; -import { CONTENT_TYPES_FILE, defaultContentEntryExts } from './consts.js'; +import { CONTENT_TYPES_FILE } from './consts.js'; export const collectionConfigParser = z.object({ schema: z.any().optional(), @@ -119,11 +119,7 @@ export async function getEntryData( } export function getContentEntryExts(settings: Pick) { - return [ - // TODO: roll defaults into settings - ...defaultContentEntryExts, - ...settings.contentEntryTypes.map((t) => t.extensions).flat(), - ]; + return settings.contentEntryTypes.map((t) => t.extensions).flat(); } export class NoCollectionError extends Error {} diff --git a/packages/astro/src/core/config/settings.ts b/packages/astro/src/core/config/settings.ts index 736f964fb..c92222b04 100644 --- a/packages/astro/src/core/config/settings.ts +++ b/packages/astro/src/core/config/settings.ts @@ -6,6 +6,7 @@ import jsxRenderer from '../../jsx/renderer.js'; import { createDefaultDevConfig } from './config.js'; import { AstroTimer } from './timer.js'; import { loadTSConfig } from './tsconfig.js'; +import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js'; export function createBaseSettings(config: AstroConfig): AstroSettings { return { @@ -16,8 +17,7 @@ export function createBaseSettings(config: AstroConfig): AstroSettings { adapter: undefined, injectedRoutes: [], pageExtensions: ['.astro', '.html', ...SUPPORTED_MARKDOWN_FILE_EXTENSIONS], - /** TODO: default Markdown entry type */ - contentEntryTypes: [], + contentEntryTypes: [markdownContentEntryType], renderers: [jsxRenderer], scripts: [], watchFiles: [],