mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 23:49:51 +00:00
MDX: Drop support for multiple dir in same collection
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-mdx': major
|
||||
---
|
||||
|
||||
Drop support for multiple `dir` in same collection
|
||||
@@ -13,9 +13,9 @@ export type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
||||
|
||||
export interface BaseCollection {
|
||||
/**
|
||||
* Directories to scan
|
||||
* Directory to scan
|
||||
*/
|
||||
dir: string | string[];
|
||||
dir: string;
|
||||
|
||||
/**
|
||||
* what files to include/exclude (glob patterns)
|
||||
|
||||
@@ -149,16 +149,6 @@ export function fromConfig<Config>() {
|
||||
};
|
||||
}
|
||||
|
||||
function mapMetaData<Data>(
|
||||
info: FileInfo,
|
||||
content: Data,
|
||||
): MetaCollectionEntry<Data> {
|
||||
return {
|
||||
info,
|
||||
...content,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
async doc<Name extends keyof Config>(
|
||||
_name: Name,
|
||||
@@ -209,7 +199,10 @@ export function fromConfig<Config>() {
|
||||
Object.entries(glob).map(async ([k, v]) => {
|
||||
const data = typeof v === 'function' ? await v() : v;
|
||||
|
||||
return mapMetaData(fileInfo(k, base), data);
|
||||
return {
|
||||
info: fileInfo(k, base),
|
||||
...data,
|
||||
} satisfies MetaCollectionEntry<unknown>;
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user