diff --git a/next.config.mjs b/next.config.mjs index aa49369c..5c88deed 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -7,6 +7,7 @@ const config = { reactStrictMode: true, output: "export", images: { unoptimized: true }, + experimental: { turbopackScopeHoisting: false }, }; export default withMDX(config); diff --git a/scripts/link-validation.ts b/scripts/link-validation.ts index 756bdfaa..8f063a67 100644 --- a/scripts/link-validation.ts +++ b/scripts/link-validation.ts @@ -86,8 +86,9 @@ async function checkLinks() { async function getHeadings({ data, }: InferPageType): Promise { - const pageData = await data.load(); - const tocHeadings = pageData.toc.map((item) => item.url.slice(1)); + //const pageData = await data.load(); + //const tocHeadings = pageData.toc.map((item) => item.url.slice(1)); + const tocHeadings = data.toc.map((item) => item.url.slice(1)); // Also extract actual anchor IDs from the content for API reference pages const content = await data.getText("raw"); diff --git a/source.config.ts b/source.config.ts index a1a011b8..0ab597a7 100644 --- a/source.config.ts +++ b/source.config.ts @@ -10,9 +10,9 @@ import { REPLACEMENTS as cairoContractReplacements } from "content/contracts-cai export const docs = defineDocs({ dir: "content", // Async mode - enables runtime compilation for faster dev server startup - docs: { - async: true, - }, + // docs: { + // async: true, + // }, // To switch back to sync mode (pre-compilation), comment out the docs config above and uncomment below: // (sync mode - pre-compiles all content at build time) // No additional config needed for sync mode - just remove the docs config @@ -27,13 +27,10 @@ export default defineConfig({ dark: "github-dark", }, }, - remarkPlugins: [remarkMath, remarkMdxMermaid, - [ - remarkReplace, - [ - cairoContractReplacements, - ] - ], + remarkPlugins: [ + remarkMath, + remarkMdxMermaid, + [remarkReplace, [cairoContractReplacements]], ], rehypePlugins: (v) => [rehypeKatex, ...v], }, diff --git a/src/app/(docs)/[...slug]/page.tsx b/src/app/(docs)/[...slug]/page.tsx index c731afe9..5d350e88 100644 --- a/src/app/(docs)/[...slug]/page.tsx +++ b/src/app/(docs)/[...slug]/page.tsx @@ -20,11 +20,11 @@ export default async function Page(props: { if (!page) notFound(); // Async mode - load the compiled content at runtime - const { body: MDXContent, toc } = await page.data.load(); + //const { body: MDXContent, toc } = await page.data.load(); // To switch back to sync mode, comment out the line above and uncomment below: - // const MDXContent = page.data.body; - // const toc = page.data.toc; + const MDXContent = page.data.body; + const toc = page.data.toc; return ( diff --git a/src/components/oz-wizard.tsx b/src/components/oz-wizard.tsx index 94d33901..fa91c6d0 100644 --- a/src/components/oz-wizard.tsx +++ b/src/components/oz-wizard.tsx @@ -1,92 +1,23 @@ -"use client"; - -import dynamic from "next/dynamic"; -import { useEffect, useRef } from "react"; - -// Declare the custom element type -declare global { - namespace JSX { - interface IntrinsicElements { - "oz-wizard": React.DetailedHTMLProps< - React.HTMLAttributes, - HTMLElement - > & { - style?: React.CSSProperties; - "data-tab"?: string; - "data-lang"?: string; - version?: string; - }; - } - } -} - interface OZWizardProps { tab?: string; lang?: string; version?: string; } -// Global flag to prevent multiple script loads -let wizardScriptLoaded = false; - -function OZWizardComponent({ tab, lang, version }: OZWizardProps) { - const wizardRef = useRef(null); - - useEffect(() => { - if (!wizardScriptLoaded) { - // Check if script is already in DOM - const existingScript = document.querySelector( - 'script[src="https://wizard.openzeppelin.com/build/embed.js"]', - ); - - if (!existingScript) { - wizardScriptLoaded = true; - - // Dynamically load the wizard script - const script = document.createElement("script"); - script.src = "https://wizard.openzeppelin.com/build/embed.js"; - script.async = true; - - // Add script to head - document.head.appendChild(script); - } - } - }, []); - +export default function OZWizard({ tab, lang, version }: OZWizardProps) { return ( - //@ts-expect-error - + + `, }} /> ); } - -// Export with SSR disabled to prevent hydration issues -const OZWizard = dynamic(() => Promise.resolve(OZWizardComponent), { - ssr: false, - loading: () => ( -
- Loading OpenZeppelin Contracts Wizard... -
- ), -}); - -export default OZWizard; diff --git a/src/lib/export-search-indexes.ts b/src/lib/export-search-indexes.ts index 9d35f72e..cbea1417 100644 --- a/src/lib/export-search-indexes.ts +++ b/src/lib/export-search-indexes.ts @@ -23,7 +23,8 @@ export async function exportSearchIndexes() { ); for (const page of filteredPages) { - const data = await page.data.load(); + //const data = await page.data.load(); + const data = page.data; results.push({ _id: page.url, structured: data.structuredData,