Skip to content

Commit 4f9a60b

Browse files
committedSep 19, 2023
feat: allow passing fast glob options to createContentLoader
closes #2985
1 parent 5bb6bb0 commit 4f9a60b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎src/node/contentLoader.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ export interface ContentOptions<T = ContentData[]> {
4949
* bundle if imported from components or markdown files.
5050
*/
5151
transform?: (data: ContentData[]) => T | Promise<T>
52+
53+
/**
54+
* Options to pass to `fast-glob`.
55+
* You'll need to manually specify `node_modules` and `dist` in
56+
* `globOptions.ignore` if you've overridden it.
57+
*/
58+
globOptions?: glob.Options
5259
}
5360

5461
export interface ContentData {
@@ -72,7 +79,8 @@ export function createContentLoader<T = ContentData[]>(
7279
includeSrc,
7380
render,
7481
excerpt: renderExcerpt,
75-
transform
82+
transform,
83+
globOptions
7684
}: ContentOptions<T> = {}
7785
): {
7886
watch: string | string[]
@@ -106,7 +114,8 @@ export function createContentLoader<T = ContentData[]>(
106114
// the loader is being called directly, do a fresh glob
107115
files = (
108116
await glob(pattern, {
109-
ignore: ['**/node_modules/**', '**/dist/**']
117+
ignore: ['**/node_modules/**', '**/dist/**'],
118+
...globOptions
110119
})
111120
).sort()
112121
}

0 commit comments

Comments
 (0)
Please sign in to comment.