FileProvider
Customize the source of the files.
To add a custom file source, for example a database, pass a custom FileProvider
.
return docs({
// other options
fileProvider: (/*options*/) => {
// implementation
},
});
The returned files need to be of type SourceFileType
.
export type SourceFileType =
| { type: SOURCE_FILE_TYPE.LOCAL; name: string }
| {
type: SOURCE_FILE_TYPE.REMOTE;
name: string;
value: string;
};
export type FileProvider<
TFrontmatter extends Record<keyof TFields, string>,
TOptions extends
MDXBundlerServiceBaseOptions<TFrontmatter> = MDXBundlerServiceBaseOptions<TFrontmatter>,
TFields extends FieldDefinitions<TFrontmatter, TOptions> = FieldDefinitions<
TFrontmatter,
TOptions
>,
> = (
options: MDXBundlerServiceOptions<TFrontmatter, TOptions, TFields>
) => Promise<SourceFileType[]>;