@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
25 lines (23 loc) • 748 B
JavaScript
import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { parseTypesMarkdown } from "./parseTypesMarkdown.mjs";
/**
* Common data returned by both syncTypes and loadServerTypesText.
* This is the shared contract consumed by loadServerTypes.
*/
/**
* Load and parse a types.md file into TypesMeta[].
*
* @param fileUrl - file:// URL to the types.md file
* @returns Parsed types and external types
*/
export async function loadServerTypesText(fileUrl, ordering) {
// Read the file
const filePath = fileURLToPath(fileUrl);
const content = await readFile(filePath, 'utf-8');
return {
...(await parseTypesMarkdown(content, ordering)),
allDependencies: [filePath],
updated: false
};
}