Skip to content

Commit

Permalink
refactor: move plain md to content entry type
Browse files Browse the repository at this point in the history
  • Loading branch information
bholmesdev committed Feb 16, 2023
1 parent 24df79b commit 534a658
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
1 change: 0 additions & 1 deletion packages/astro/src/content/consts.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
8 changes: 2 additions & 6 deletions packages/astro/src/content/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -119,11 +119,7 @@ export async function getEntryData(
}

export function getContentEntryExts(settings: Pick<AstroSettings, 'contentEntryTypes'>) {
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 {}
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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: [],
Expand Down

0 comments on commit 534a658

Please sign in to comment.