|
|
|
@ -49,6 +49,13 @@ export interface ContentOptions<T = ContentData[]> {
|
|
|
|
|
* bundle if imported from components or markdown files.
|
|
|
|
|
*/
|
|
|
|
|
transform?: (data: ContentData[]) => T | Promise<T>
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Options to pass to `fast-glob`.
|
|
|
|
|
* You'll need to manually specify `node_modules` and `dist` in
|
|
|
|
|
* `globOptions.ignore` if you've overridden it.
|
|
|
|
|
*/
|
|
|
|
|
globOptions?: glob.Options
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ContentData {
|
|
|
|
@ -72,7 +79,8 @@ export function createContentLoader<T = ContentData[]>(
|
|
|
|
|
includeSrc,
|
|
|
|
|
render,
|
|
|
|
|
excerpt: renderExcerpt,
|
|
|
|
|
transform
|
|
|
|
|
transform,
|
|
|
|
|
globOptions
|
|
|
|
|
}: ContentOptions<T> = {}
|
|
|
|
|
): {
|
|
|
|
|
watch: string | string[]
|
|
|
|
@ -106,7 +114,8 @@ export function createContentLoader<T = ContentData[]>(
|
|
|
|
|
// the loader is being called directly, do a fresh glob
|
|
|
|
|
files = (
|
|
|
|
|
await glob(pattern, {
|
|
|
|
|
ignore: ['**/node_modules/**', '**/dist/**']
|
|
|
|
|
ignore: ['**/node_modules/**', '**/dist/**'],
|
|
|
|
|
...globOptions
|
|
|
|
|
})
|
|
|
|
|
).sort()
|
|
|
|
|
}
|
|
|
|
|