import { generateDocsCodeSnippets } from "./codeSnippets.js";
import { getDocsData } from "./docsData/getDocsData.js";
import { generateContent } from "./mdx/generateContent.js";
import { setSettings } from "./settings.js";
/**
 * Given an OpenAPI spec, generate Markdown pages of the spec. The returned
 * object is a map of page filenames to page contents.
 */
export async function generatePages({ specContents, settings, }) {
    // Save settings to a global location so we can easily access it around the codebase
    setSettings(settings);
    // Get the docs data from the spec
    const data = await getDocsData(specContents);
    // Get code snippets
    let docsCodeSnippets = {};
    if (settings.tryItNow) {
        console.log("Generating Code Snippets");
        docsCodeSnippets = await generateDocsCodeSnippets(data, specContents);
    }
    // Generate the content
    console.log("Generating Markdown Pages");
    return generateContent(data, docsCodeSnippets);
}
//# sourceMappingURL=generatePages.js.map