From 534a658325cbddbb153bea1c1338d13011eb0e4f 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 c034a2fdb65e..1f0470d5a026 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 580e764dbe39..81aab319e121 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 d522a1c09ab1..0560519ba73b 100644 --- a/packages/astro/src/core/config/settings.ts +++ b/packages/astro/src/core/config/settings.ts @@ -5,6 +5,7 @@ import { fileURLToPath, pathToFileURL } from 'url'; import jsxRenderer from '../../jsx/renderer.js'; import { createDefaultDevConfig } from './config.js'; import { loadTSConfig } from './tsconfig.js'; +import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js'; export function createBaseSettings(config: AstroConfig): AstroSettings { return { @@ -15,8 +16,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: [],