mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-26 13:08:58 +02:00
refactor(mdx-loader): read metadata from memory (loaded content) instead of fs (#10457)
* mdx loader shouldn't read metadata from file system but from memory * comments * refactor: apply lint autofix * apply same for blog * apply same for blog * refactor: apply lint autofix * apply same for pages
This commit is contained in:
parent
2aef92cb9e
commit
a4329d3388
8 changed files with 182 additions and 80 deletions
|
@ -19,9 +19,9 @@ import type {Options} from './loader';
|
|||
* starting with _). That's why it's important to provide the `isMDXPartial`
|
||||
* function in config
|
||||
*/
|
||||
export async function readMetadataPath(metadataPath: string): Promise<string> {
|
||||
export async function readMetadataPath(metadataPath: string): Promise<unknown> {
|
||||
try {
|
||||
return await fs.readFile(metadataPath, 'utf8');
|
||||
return await fs.readJSON(metadataPath, 'utf8');
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
logger.interpolate`MDX loader can't read MDX metadata file path=${metadataPath}. Maybe the isMDXPartial option function was not provided?`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue