@vercel/geistdocs 2.15.3 → 2.15.4-canary.2a54b38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +9 -0
- package/dist/internal/page-actions-client.js +1 -1
- package/dist/internal/page-actions.d.ts +4 -4
- package/dist/internal/page-actions.d.ts.map +1 -1
- package/dist/internal/page-actions.js +6 -1
- package/dist/internal/source-loader.d.ts +28 -0
- package/dist/internal/source-loader.d.ts.map +1 -0
- package/dist/internal/source-loader.js +77 -0
- package/dist/mdx-basic.d.ts +27 -0
- package/dist/mdx-basic.d.ts.map +1 -0
- package/dist/mdx-basic.js +61 -0
- package/dist/mdx.d.ts +3 -25
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +8 -61
- package/dist/mobile-docs-bar.js +1 -1
- package/dist/navigation.d.ts +11 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +8 -0
- package/dist/next.d.ts +11 -1
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +82 -2
- package/dist/pages/docs-custom.d.ts +111 -0
- package/dist/pages/docs-custom.d.ts.map +1 -0
- package/dist/pages/docs-custom.js +250 -0
- package/dist/pages/docs.d.ts +5 -98
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +13 -250
- package/dist/source-config.d.ts +10 -1
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +21 -10
- package/dist/source.d.ts +6 -17
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +2 -75
- package/docs/agents.md +1 -1
- package/docs/llms.txt +27 -1
- package/docs/manifest.json +1 -1
- package/docs/pages/configuration.md +26 -0
- package/native-mdx/LICENSE-mdxjs-rs +22 -0
- package/native-mdx/UPSTREAM.md +16 -0
- package/native-mdx/binaries/darwin-arm64.node +0 -0
- package/native-mdx/binaries/linux-x64-gnu.node +0 -0
- package/native-mdx/data-entry.d.mts +15 -0
- package/native-mdx/data-entry.mjs +97 -0
- package/native-mdx/data-projection.mjs +205 -0
- package/native-mdx/fumadocs-adapter.mjs +36 -0
- package/native-mdx/index-emitter.mjs +34 -0
- package/native-mdx/loader-data.cjs +36 -0
- package/native-mdx/loader-mdx.cjs +9 -0
- package/native-mdx/loader-mdx.mjs +419 -0
- package/native-mdx/native-binding.cjs +27 -0
- package/native-mdx/navigation-entry.d.mts +11 -0
- package/native-mdx/navigation-entry.mjs +136 -0
- package/native-mdx/navigation-title.mjs +53 -0
- package/package.json +43 -15
- package/rehype-code-highlights.d.ts +13 -0
- package/rehype-code-highlights.js +230 -0
- package/shared-theme.css +7 -1
- package/source-config.js +27 -10
- package/template/content/docs/configuration.mdx +26 -0
- package/template/package.json +7 -4
- package/template/pnpm-workspace.yaml +3 -0
package/dist/cli/index.js
CHANGED
|
@@ -4,4 +4,4 @@ import{Option as Rn,program as A}from"commander";import{access as Ke,copyFile as
|
|
|
4
4
|
`);throw new AggregateError(i,`Mixedbread search sync did not complete:
|
|
5
5
|
${a}`)}return r},Ft=async({client:e,file:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=t,o=Date.now()+r;for(;s.status==="pending"||s.status==="in_progress";){if(Date.now()>=o)throw new Error(`Mixedbread timed out while indexing file ${t.id}.`);await i(n),s=await e.retrieveStoreFile(t.id)}if(s.status!=="completed")throw new Error(`Mixedbread failed to index file ${t.id} (${s.status}).`);return s},Dt=async({client:e,desired:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=await e.uploadFile({content:t.document.content,filename:`${U(t.document.id).slice(0,32)}.md`}),o;try{o=await e.createStoreFile({externalId:t.externalId,fileId:s,metadata:{...t.metadata,[g.rawFileId]:s}})}catch(a){try{await e.deleteFile(s)}catch(d){throw new AggregateError([a,d],`Mixedbread failed to attach and clean up raw file ${s}.`)}throw a}return Ft({client:e,file:o,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})},Ie=async({client:e,concurrency:t=St,manifest:n,pollIntervalMs:r=_t,pollTimeoutMs:i=Tt,revision:s,revisionAncestors:o=[],revisionTimestamp:a,sleep:d=Rt})=>{let c=_e(n);if(c.provider!=="mixedbread")return{deleted:0,skipped:c.documents.length,uploaded:0};let u=c.siteId?.trim();if(!u)throw new Error("Mixedbread retrieval requires a non-empty siteId in geistdocs.tsx.");if(c.documents.length===0)throw new Error("The Geistdocs search export is empty. Refusing to remove indexed documents.");let l=c.documents.map(p=>At(p,u,s,o,a)),m=new Map(l.map(p=>[p.document.id,p])),h=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),x=new Map,P=new Set;for(let p of h){W(p.metadata,s,a)&&P.add(p.metadata.documentId);let y=m.get(p.metadata.documentId);y&&p.metadata.contentHash===y.hash&&p.file.status==="completed"&&!x.has(p.metadata.documentId)&&x.set(p.metadata.documentId,p)}let _=l.filter(p=>!(x.has(p.document.id)||P.has(p.document.id)));await Ee(_,t,p=>Dt({client:e,desired:p,pollIntervalMs:r,pollTimeoutMs:i,sleep:d}));let b=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),D=new Set(b.filter(({metadata:p})=>W(p,s,a)).map(({metadata:p})=>p.documentId)),ie=new Set;for(let p of l){if(D.has(p.document.id))continue;let ae=b.filter(({file:V,metadata:k})=>V.status==="completed"&&k.documentId===p.document.id&&k.contentHash===p.hash).sort((V,k)=>V.file.id.localeCompare(k.file.id))[0];ae&&ie.add(ae.file.id)}let oe=b.filter(({file:p,metadata:y})=>p.status!=="pending"&&p.status!=="in_progress"&&!W(y,s,a)&&Mt({currentRevision:s,currentRevisionAncestors:o,currentRevisionTimestamp:a,desired:m.get(y.documentId),metadata:y})&&!ie.has(p.id));return await Ee(oe,t,async({file:p,metadata:y})=>{await e.deleteFile(y.rawFileId??p.id),await e.deleteStoreFile(p.id)}),{deleted:oe.length,skipped:l.length-_.length,uploaded:_.length}};var Ot=50,$t=e=>`vercel integration add mixedbread --name docs-${e||"your-site-id"} --environment production`,ve=(e,t)=>kt("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),Nt=e=>{let t=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),n=[];try{n=ve(e,["rev-list",`--max-count=${Ot+1}`,t||"HEAD"]).split(`
|
|
6
6
|
`).filter(Boolean)}catch{n=[]}let r=t||n[0],i;for(let s of Array.from(new Set([r,"HEAD"].filter(Boolean))))try{let o=Number(ve(e,["show","-s","--format=%ct",s]));if(Number.isFinite(o)){i=o;break}}catch{}return{revision:r,revisionAncestors:n.filter(s=>s!==r),revisionTimestamp:i}},Pe=async({allowNonProduction:e=!1,dir:t=".next"}={})=>{let n=process.cwd();Ct.loadEnvConfig(n,!1);let r=process.env.MXBAI_API_KEY?.trim(),i=process.env.MXBAI_STORE_ID?.trim();if(process.env.VERCEL_ENV!=="production"&&!e){console.log("Geistdocs search sync skipped: this is not a production Vercel build.");return}if(!!r!=!!i)throw new Error("Mixedbread is partially configured. Set both MXBAI_API_KEY and MXBAI_STORE_ID.");let s;try{s=await Te({cwd:n,outputDirectory:t})}catch(a){if(!(r||i)){console.log("Geistdocs search sync skipped: no Mixedbread credentials or static search export were found.");return}throw a}if(s.provider!=="mixedbread"){console.log("Geistdocs search sync skipped: Ask AI uses local retrieval.");return}if(!(r&&i))throw new Error(["Mixedbread retrieval is enabled, but MXBAI_API_KEY or MXBAI_STORE_ID is missing.","From the root of this site's repository, linked to the correct Vercel project, run:",$t(s.siteId)].join(`
|
|
7
|
-
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.15.3","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
7
|
+
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.15.4-canary.2a54b38","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAA2B,MAAM,SAAS,CAAC;AAkCtE,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,IAAI,GACJ,MAAM,GACN,MAAM,GACN,iBAAiB,EAAE,GACnB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;AAEzC,8DAA8D;AAC9D,MAAM,WAAW,wBAAwB;IACvC,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,MAAM,EAAE,OAAO,CAAC;IAChB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,MAAM,MAAM,2BAA2B,CAAC,OAAO,GAAG,OAAO,IAAI,CAC3D,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,OAAO,KACb,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAEpE,MAAM,WAAW,oBAAoB,CAAC,OAAO,GAAG,OAAO;IACrD,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;IAClE,iFAAiF;IACjF,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;
|
|
1
|
+
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAA2B,MAAM,SAAS,CAAC;AAkCtE,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,IAAI,GACJ,MAAM,GACN,MAAM,GACN,iBAAiB,EAAE,GACnB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;AAEzC,8DAA8D;AAC9D,MAAM,WAAW,wBAAwB;IACvC,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,MAAM,EAAE,OAAO,CAAC;IAChB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,MAAM,MAAM,2BAA2B,CAAC,OAAO,GAAG,OAAO,IAAI,CAC3D,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,OAAO,KACb,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAEpE,MAAM,WAAW,oBAAoB,CAAC,OAAO,GAAG,OAAO;IACrD,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;IAClE,iFAAiF;IACjF,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAwpDD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,GAAG,SAAS,EACrD,UAAU,aAAa,GAAG,oBAAoB,CAAC,OAAO,CAAC,MAUzC,QAAQ,MAAM,EAAE,UAAU,OAAO,oBAgBhD,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,aAAa,WAnBF,MAAM,yCAmBoB,CAAC"}
|
|
@@ -1220,6 +1220,11 @@ const staticProps = (node) => {
|
|
|
1220
1220
|
const serializerFor = (node, components) => isJsxElement(node) && node.name && Object.hasOwn(components, node.name)
|
|
1221
1221
|
? components[node.name]
|
|
1222
1222
|
: undefined;
|
|
1223
|
+
// A site-wide registry does not mean every page needs an async serializer walk.
|
|
1224
|
+
// Inspect the current tree and registry on each call, after syntax plugins run.
|
|
1225
|
+
const hasComponentSerializer = (node, components) => Boolean(isJsxElement(node) && node.name && Object.hasOwn(components, node.name)) ||
|
|
1226
|
+
(node.children?.some((child) => hasComponentSerializer(child, components)) ??
|
|
1227
|
+
false);
|
|
1223
1228
|
const childrenMarkdown = (node, state) => {
|
|
1224
1229
|
// Convert a copy: when the serializer defers to the built-in conversion,
|
|
1225
1230
|
// the original children must still be intact for it.
|
|
@@ -1290,6 +1295,10 @@ function cleanMdx(options) {
|
|
|
1290
1295
|
.use(remarkGfm)
|
|
1291
1296
|
.use(options.remarkPlugins);
|
|
1292
1297
|
return async (tree, file) => {
|
|
1298
|
+
if (!hasComponentSerializer(tree, components)) {
|
|
1299
|
+
cleanChildren(tree);
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1293
1302
|
await serializeComponents(tree, {
|
|
1294
1303
|
components,
|
|
1295
1304
|
context: file.data.geistdocsMarkdownContext,
|
|
@@ -156,6 +156,6 @@ export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
|
156
156
|
// rendered below the title and left-aligned.
|
|
157
157
|
const rootClassName = only === "mobile"
|
|
158
158
|
? "@min-[961px]:hidden"
|
|
159
|
-
: "mb-2 self-end @max-[
|
|
159
|
+
: "mb-2 self-end @max-[961px]:hidden";
|
|
160
160
|
return (_jsxs("div", { className: rootClassName, onFocusCapture: preloadChat, onPointerEnter: preloadChat, children: [showDesktop ? (_jsx(DesktopPageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, editSourceEnabled: editSourceEnabled, editSourceUrl: editSourceUrl, isMobile: isMobile, menuView: menuView, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, providersBackRef: providersBackRef, query: query, setMenuView: setMenuView, v0Provider: v0Provider })) : null, showMobile && (copyEnabled || askAIEnabled) ? (_jsx(InlinePageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown })) : null, _jsx("span", { "aria-live": "polite", className: "sr-only", children: checked ? "Page copied" : "" })] }));
|
|
161
161
|
};
|
|
@@ -9,10 +9,10 @@ export interface PageActionRenderContext {
|
|
|
9
9
|
}
|
|
10
10
|
export interface CreatePageActionsOptions {
|
|
11
11
|
config: Pick<GeistdocsConfig, "ai" | "feedback" | "github" | "pageActions" | "siteId">;
|
|
12
|
+
/** Actions that do not need the page's converted Markdown. */
|
|
13
|
+
extraActions?: ReactNode[];
|
|
12
14
|
getExtraActions?: (context: PageActionRenderContext) => ReactNode[];
|
|
13
15
|
}
|
|
14
|
-
export declare const createPageActions: ({ config, getExtraActions, }: CreatePageActionsOptions) =>
|
|
15
|
-
|
|
16
|
-
getExtraActions: ((context: PageActionRenderContext) => ReactNode[]) | undefined;
|
|
17
|
-
};
|
|
16
|
+
export declare const createPageActions: ({ config, extraActions, getExtraActions, }: CreatePageActionsOptions) => CreatePageActionsOptions;
|
|
17
|
+
export declare const resolveExtraPageActions: (actions: CreatePageActionsOptions, context: PageActionRenderContext) => ReactNode[];
|
|
18
18
|
//# sourceMappingURL=page-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-actions.d.ts","sourceRoot":"","sources":["../../src/internal/page-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE;QACJ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,IAAI,CACV,eAAe,EACf,IAAI,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CACxD,CAAC;IACF,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,SAAS,EAAE,CAAC;CACrE;AAED,eAAO,MAAM,iBAAiB,GAAI,
|
|
1
|
+
{"version":3,"file":"page-actions.d.ts","sourceRoot":"","sources":["../../src/internal/page-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE;QACJ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,IAAI,CACV,eAAe,EACf,IAAI,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CACxD,CAAC;IACF,8DAA8D;IAC9D,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,SAAS,EAAE,CAAC;CACrE;AAED,eAAO,MAAM,iBAAiB,GAAI,4CAI/B,wBAAwB,KAAG,wBAI5B,CAAC;AAEH,eAAO,MAAM,uBAAuB,GAClC,SAAS,wBAAwB,EACjC,SAAS,uBAAuB,KAC/B,SAAS,EAGX,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export const createPageActions = ({ config, getExtraActions, }) => ({
|
|
1
|
+
export const createPageActions = ({ config, extraActions, getExtraActions, }) => ({
|
|
2
2
|
config,
|
|
3
|
+
extraActions,
|
|
3
4
|
getExtraActions,
|
|
4
5
|
});
|
|
6
|
+
export const resolveExtraPageActions = (actions, context) => [
|
|
7
|
+
...(actions.extraActions ?? []),
|
|
8
|
+
...(context.markdown ? (actions.getExtraActions?.(context) ?? []) : []),
|
|
9
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { loader } from "fumadocs-core/source";
|
|
2
|
+
import type { GeistdocsConfig } from "../config.js";
|
|
3
|
+
type LoaderOptions = Parameters<typeof loader>[0];
|
|
4
|
+
export interface FumadocsCollection {
|
|
5
|
+
toFumadocsSource(): LoaderOptions["source"];
|
|
6
|
+
}
|
|
7
|
+
export interface GeistdocsSlugsContext {
|
|
8
|
+
/** Content file path relative to the content directory, including any language suffix, such as `errors/NOT_FOUND.mdx` or `guide.cn.mdx`. */
|
|
9
|
+
path: string;
|
|
10
|
+
/** Default slugs derived from the path, without folder groups or a trailing `index`. */
|
|
11
|
+
slugs: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface CreateNavigationOptions {
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
config: Pick<GeistdocsConfig, "agent" | "basePath" | "defaultLanguage" | "singleLanguage" | "siteUrl" | "translations"> & Partial<Pick<GeistdocsConfig, "title">>;
|
|
16
|
+
docs: FumadocsCollection;
|
|
17
|
+
/**
|
|
18
|
+
* Transform each page's URL slugs. Use the same transform for navigation
|
|
19
|
+
* and createSource so tree links match page routes.
|
|
20
|
+
*/
|
|
21
|
+
slugs?: (context: GeistdocsSlugsContext) => string[];
|
|
22
|
+
}
|
|
23
|
+
export declare const createSourceLoader: ({ docs, config, baseUrl, slugs, }: CreateNavigationOptions) => import("fumadocs-core/source").LoaderOutput<{
|
|
24
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
25
|
+
i18n: import("fumadocs-core/i18n").I18nConfig<string>;
|
|
26
|
+
}>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=source-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-loader.d.ts","sourceRoot":"","sources":["../../src/internal/source-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,MAAM,EAEP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,qBAAqB;IACpC,4IAA4I;IAC5I,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,IAAI,CACV,eAAe,EACb,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,gBAAgB,GAChB,SAAS,GACT,cAAc,CACjB,GACC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,IAAI,EAAE,kBAAkB,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,MAAM,EAAE,CAAC;CACtD;AA6ED,eAAO,MAAM,kBAAkB,GAAI,mCAKhC,uBAAuB;;;EAiBzB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { defineI18n } from "fumadocs-core/i18n";
|
|
2
|
+
import { loader, } from "fumadocs-core/source";
|
|
3
|
+
const createSlugsPlugin = (transform) => {
|
|
4
|
+
// Each locale's storage inherits fallback pages from the default locale by
|
|
5
|
+
// reference, so transform every page object once.
|
|
6
|
+
const transformed = new WeakSet();
|
|
7
|
+
return {
|
|
8
|
+
name: "geistdocs:slugs",
|
|
9
|
+
// Runs after Fumadocs assigns the default slugs, so `index` pages and
|
|
10
|
+
// folder groups resolve before the transform sees them.
|
|
11
|
+
enforce: "post",
|
|
12
|
+
transformStorage({ storage }) {
|
|
13
|
+
const pathsByUrl = new Map();
|
|
14
|
+
for (const key of storage.getFiles()) {
|
|
15
|
+
const file = storage.read(key);
|
|
16
|
+
if (file?.format !== "page") {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (!transformed.has(file)) {
|
|
20
|
+
// Storage keys drop the locale; `file.path` is the content file path.
|
|
21
|
+
file.slugs = transform({ path: file.path, slugs: [...file.slugs] });
|
|
22
|
+
transformed.add(file);
|
|
23
|
+
}
|
|
24
|
+
const url = file.slugs.join("/");
|
|
25
|
+
const existing = pathsByUrl.get(url);
|
|
26
|
+
if (existing) {
|
|
27
|
+
throw new Error(`Geistdocs slugs: ${existing} and ${file.path} both resolve to "/${url}".`);
|
|
28
|
+
}
|
|
29
|
+
pathsByUrl.set(url, file.path);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const getLanguages = (config) => {
|
|
35
|
+
const defaultLanguage = config.defaultLanguage ?? "en";
|
|
36
|
+
const languages = Object.keys(config.translations ?? {});
|
|
37
|
+
return {
|
|
38
|
+
defaultLanguage,
|
|
39
|
+
languages: Array.from(new Set([defaultLanguage, ...languages])),
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const pageTreeTransformer = {
|
|
43
|
+
file(node, filePath) {
|
|
44
|
+
if (!filePath) {
|
|
45
|
+
return node;
|
|
46
|
+
}
|
|
47
|
+
const file = this.storage.read(filePath);
|
|
48
|
+
if (file?.format !== "page") {
|
|
49
|
+
return node;
|
|
50
|
+
}
|
|
51
|
+
const { badge, navTitle } = file.data;
|
|
52
|
+
return {
|
|
53
|
+
...node,
|
|
54
|
+
...(typeof badge === "string" && badge.length > 0 ? { badge } : {}),
|
|
55
|
+
...(typeof navTitle === "string" && navTitle.length > 0
|
|
56
|
+
? { name: navTitle }
|
|
57
|
+
: {}),
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const createSourceLoader = ({ docs, config, baseUrl = "/docs", slugs, }) => {
|
|
62
|
+
const { defaultLanguage, languages } = getLanguages(config);
|
|
63
|
+
const i18n = defineI18n({
|
|
64
|
+
defaultLanguage,
|
|
65
|
+
languages,
|
|
66
|
+
hideLocale: "default-locale",
|
|
67
|
+
});
|
|
68
|
+
return loader({
|
|
69
|
+
i18n,
|
|
70
|
+
baseUrl,
|
|
71
|
+
pageTree: {
|
|
72
|
+
transformers: [pageTreeTransformer],
|
|
73
|
+
},
|
|
74
|
+
plugins: slugs ? [createSlugsPlugin(slugs)] : undefined,
|
|
75
|
+
source: docs.toFumadocsSource(),
|
|
76
|
+
});
|
|
77
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MDXComponents } from "mdx/types";
|
|
2
|
+
import type { GeistdocsSourceConfigOptions as SourceConfigOptions } from "./source-config";
|
|
3
|
+
export declare const geistShikiTheme: {
|
|
4
|
+
name: string;
|
|
5
|
+
type: "dark";
|
|
6
|
+
colors: {
|
|
7
|
+
"editor.foreground": string;
|
|
8
|
+
"editor.background": string;
|
|
9
|
+
};
|
|
10
|
+
tokenColors: ({
|
|
11
|
+
scope: string[];
|
|
12
|
+
settings: {
|
|
13
|
+
foreground: string;
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
scope: string;
|
|
17
|
+
settings: {
|
|
18
|
+
foreground: string;
|
|
19
|
+
};
|
|
20
|
+
})[];
|
|
21
|
+
};
|
|
22
|
+
export type GeistdocsSourceConfigOptions = SourceConfigOptions;
|
|
23
|
+
export type GeistdocsMDXComponents = MDXComponents;
|
|
24
|
+
export declare const getGeistdocsMDXComponents: (components?: GeistdocsMDXComponents) => GeistdocsMDXComponents;
|
|
25
|
+
export declare const createMdxComponents: (components?: GeistdocsMDXComponents) => GeistdocsMDXComponents;
|
|
26
|
+
export declare const mergeGeistdocsMDXComponents: (...componentSets: Array<GeistdocsMDXComponents | undefined>) => GeistdocsMDXComponents;
|
|
27
|
+
//# sourceMappingURL=mdx-basic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-basic.d.ts","sourceRoot":"","sources":["../src/mdx-basic.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAoB/C,OAAO,KAAK,EAAE,4BAA4B,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAK3F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAC1C,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,eAAO,MAAM,yBAAyB,GACpC,aAAa,sBAAsB,KAClC,sBA2DD,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,sBAAsB,KAClC,sBAA+D,CAAC;AAEnE,eAAO,MAAM,2BAA2B,GACtC,GAAG,eAAe,KAAK,CAAC,sBAAsB,GAAG,SAAS,CAAC,KAC1D,sBACkD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Image as FrameworkImage } from "fumadocs-core/framework";
|
|
3
|
+
import { Card, Cards } from "fumadocs-ui/components/card";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import { cn } from "#geistdocs-ui/utils";
|
|
6
|
+
import { Blockquote } from "./components/blockquote";
|
|
7
|
+
import { Button } from "./components/button";
|
|
8
|
+
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle, } from "./components/callout";
|
|
9
|
+
import { CodeBlock } from "./components/code-block";
|
|
10
|
+
import { Details, Summary } from "./components/details";
|
|
11
|
+
import { Heading } from "./components/heading";
|
|
12
|
+
import { Image } from "./components/image";
|
|
13
|
+
import { Step, Steps } from "./components/steps";
|
|
14
|
+
import { Table } from "./components/table";
|
|
15
|
+
import { TypeTable } from "./components/type-table";
|
|
16
|
+
import { LocalizedLink } from "./internal/localized-link";
|
|
17
|
+
import { geistShikiTheme as shikiTheme } from "./shiki-theme";
|
|
18
|
+
// The source-config exports live on @vercel/geistdocs/source-config. Importing
|
|
19
|
+
// them here would pull fumadocs-mdx/config, and through it Shiki with every
|
|
20
|
+
// language grammar, into every server function that renders MDX.
|
|
21
|
+
export const geistShikiTheme = shikiTheme;
|
|
22
|
+
export const getGeistdocsMDXComponents = (components) => ({
|
|
23
|
+
Card,
|
|
24
|
+
Cards,
|
|
25
|
+
img: (props) => (_jsx(FrameworkImage, { sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px", ...props, className: cn("rounded-lg", props.className), src: props.src })),
|
|
26
|
+
h1: (props) => _jsx(Heading, { as: "h1", ...props }),
|
|
27
|
+
h2: (props) => _jsx(Heading, { as: "h2", ...props }),
|
|
28
|
+
h3: (props) => _jsx(Heading, { as: "h3", ...props }),
|
|
29
|
+
h4: (props) => _jsx(Heading, { as: "h4", ...props }),
|
|
30
|
+
h5: (props) => _jsx(Heading, { as: "h5", ...props }),
|
|
31
|
+
h6: (props) => _jsx(Heading, { as: "h6", ...props }),
|
|
32
|
+
pre: CodeBlock,
|
|
33
|
+
blockquote: Blockquote,
|
|
34
|
+
table: Table,
|
|
35
|
+
Table,
|
|
36
|
+
a: ({ children, className, href, ...props }) => {
|
|
37
|
+
const linkClassName = cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className);
|
|
38
|
+
if (typeof href === "string" && href.startsWith("/")) {
|
|
39
|
+
return (_jsx(LocalizedLink, { className: linkClassName, href: href, ...props, children: children }));
|
|
40
|
+
}
|
|
41
|
+
// next/link keeps same-page fragment entries restorable by the App Router.
|
|
42
|
+
if (typeof href === "string" && href.startsWith("#")) {
|
|
43
|
+
return (_jsx(Link, { className: linkClassName, href: href, prefetch: false, ...props, children: children }));
|
|
44
|
+
}
|
|
45
|
+
return (_jsx("a", { className: linkClassName, href: href, ...props, children: children }));
|
|
46
|
+
},
|
|
47
|
+
Button,
|
|
48
|
+
TypeTable,
|
|
49
|
+
Callout,
|
|
50
|
+
CalloutContainer,
|
|
51
|
+
CalloutTitle,
|
|
52
|
+
CalloutDescription,
|
|
53
|
+
Details,
|
|
54
|
+
Summary,
|
|
55
|
+
Image,
|
|
56
|
+
Steps,
|
|
57
|
+
Step,
|
|
58
|
+
...components,
|
|
59
|
+
});
|
|
60
|
+
export const createMdxComponents = (components) => getGeistdocsMDXComponents(components);
|
|
61
|
+
export const mergeGeistdocsMDXComponents = (...componentSets) => Object.assign({}, ...componentSets.filter(Boolean));
|
package/dist/mdx.d.ts
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
import type { MDXComponents } from "mdx/types";
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
type: "dark";
|
|
6
|
-
colors: {
|
|
7
|
-
"editor.foreground": string;
|
|
8
|
-
"editor.background": string;
|
|
9
|
-
};
|
|
10
|
-
tokenColors: ({
|
|
11
|
-
scope: string[];
|
|
12
|
-
settings: {
|
|
13
|
-
foreground: string;
|
|
14
|
-
};
|
|
15
|
-
} | {
|
|
16
|
-
scope: string;
|
|
17
|
-
settings: {
|
|
18
|
-
foreground: string;
|
|
19
|
-
};
|
|
20
|
-
})[];
|
|
21
|
-
};
|
|
22
|
-
export type GeistdocsSourceConfigOptions = SourceConfigOptions;
|
|
23
|
-
export type GeistdocsMDXComponents = MDXComponents;
|
|
24
|
-
export declare const getGeistdocsMDXComponents: (components?: GeistdocsMDXComponents) => GeistdocsMDXComponents;
|
|
25
|
-
export declare const createMdxComponents: (components?: GeistdocsMDXComponents) => GeistdocsMDXComponents;
|
|
26
|
-
export declare const mergeGeistdocsMDXComponents: (...componentSets: Array<GeistdocsMDXComponents | undefined>) => GeistdocsMDXComponents;
|
|
2
|
+
export { type GeistdocsMDXComponents, type GeistdocsSourceConfigOptions, geistShikiTheme, mergeGeistdocsMDXComponents, } from "./mdx-basic";
|
|
3
|
+
export declare const getGeistdocsMDXComponents: (components?: MDXComponents) => MDXComponents;
|
|
4
|
+
export declare const createMdxComponents: (components?: MDXComponents) => MDXComponents;
|
|
27
5
|
//# sourceMappingURL=mdx.d.ts.map
|
package/dist/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAiB/C,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,eAAe,EACf,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,yBAAyB,GACpC,aAAa,aAAa,KACzB,aAcD,CAAC;AAEH,eAAO,MAAM,mBAAmB,gBAjBjB,aAAa,KACzB,aAgByD,CAAC"}
|
package/dist/mdx.js
CHANGED
|
@@ -1,74 +1,21 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Image as FrameworkImage } from "fumadocs-core/framework";
|
|
3
|
-
import { Card, Cards } from "fumadocs-ui/components/card";
|
|
4
|
-
import Link from "next/link";
|
|
5
|
-
import { cn } from "#geistdocs-ui/utils";
|
|
6
|
-
import { Blockquote } from "./components/blockquote";
|
|
7
|
-
import { Button } from "./components/button";
|
|
8
|
-
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle, } from "./components/callout";
|
|
9
|
-
import { CodeBlock } from "./components/code-block";
|
|
10
|
-
import { Details, Summary } from "./components/details";
|
|
11
|
-
import { Heading } from "./components/heading";
|
|
12
|
-
import { Image } from "./components/image";
|
|
13
|
-
import { Step, Steps } from "./components/steps";
|
|
14
|
-
import { Table } from "./components/table";
|
|
15
|
-
import { TypeTable } from "./components/type-table";
|
|
16
1
|
import { Video } from "./components/video";
|
|
17
2
|
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CompactCodeBlockTabs, CopyPrompt, Mermaid, TabContent, Tabs, TabsWithChildren, } from "./internal/lazy-mdx-components";
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// them here would pull fumadocs-mdx/config, and through it Shiki with every
|
|
22
|
-
// language grammar, into every server function that renders MDX.
|
|
23
|
-
export const geistShikiTheme = shikiTheme;
|
|
3
|
+
import { createMdxComponents as createBasicMdxComponents } from "./mdx-basic";
|
|
4
|
+
// biome-ignore lint/performance/noBarrelFile: This compatibility entry point intentionally includes the full registry.
|
|
5
|
+
export { geistShikiTheme, mergeGeistdocsMDXComponents, } from "./mdx-basic";
|
|
24
6
|
export const getGeistdocsMDXComponents = (components) => ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
img: (props) => (_jsx(FrameworkImage, { sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px", ...props, className: cn("rounded-lg", props.className), src: props.src })),
|
|
28
|
-
h1: (props) => _jsx(Heading, { as: "h1", ...props }),
|
|
29
|
-
h2: (props) => _jsx(Heading, { as: "h2", ...props }),
|
|
30
|
-
h3: (props) => _jsx(Heading, { as: "h3", ...props }),
|
|
31
|
-
h4: (props) => _jsx(Heading, { as: "h4", ...props }),
|
|
32
|
-
h5: (props) => _jsx(Heading, { as: "h5", ...props }),
|
|
33
|
-
h6: (props) => _jsx(Heading, { as: "h6", ...props }),
|
|
34
|
-
pre: CodeBlock,
|
|
35
|
-
blockquote: Blockquote,
|
|
36
|
-
table: Table,
|
|
37
|
-
Table,
|
|
38
|
-
a: ({ children, className, href, ...props }) => {
|
|
39
|
-
const linkClassName = cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className);
|
|
40
|
-
if (typeof href === "string" && href.startsWith("/")) {
|
|
41
|
-
return (_jsx(LocalizedLink, { className: linkClassName, href: href, ...props, children: children }));
|
|
42
|
-
}
|
|
43
|
-
// next/link keeps same-page fragment entries restorable by the App Router.
|
|
44
|
-
if (typeof href === "string" && href.startsWith("#")) {
|
|
45
|
-
return (_jsx(Link, { className: linkClassName, href: href, prefetch: false, ...props, children: children }));
|
|
46
|
-
}
|
|
47
|
-
return (_jsx("a", { className: linkClassName, href: href, ...props, children: children }));
|
|
48
|
-
},
|
|
49
|
-
Button,
|
|
7
|
+
...createBasicMdxComponents(),
|
|
8
|
+
CodeBlockTab,
|
|
50
9
|
CodeBlockTabs,
|
|
51
|
-
CompactCodeBlockTabs,
|
|
52
10
|
CodeBlockTabsList,
|
|
53
11
|
CodeBlockTabsTrigger,
|
|
54
|
-
|
|
55
|
-
TypeTable,
|
|
56
|
-
Callout,
|
|
57
|
-
CalloutContainer,
|
|
58
|
-
CalloutTitle,
|
|
59
|
-
CalloutDescription,
|
|
12
|
+
CompactCodeBlockTabs,
|
|
60
13
|
CopyPrompt,
|
|
61
|
-
Details,
|
|
62
|
-
Summary,
|
|
63
|
-
Image,
|
|
64
14
|
Mermaid,
|
|
65
|
-
|
|
66
|
-
Step,
|
|
15
|
+
TabContent,
|
|
67
16
|
Tabs,
|
|
68
17
|
TabsWithChildren,
|
|
69
|
-
TabContent,
|
|
70
18
|
Video,
|
|
71
19
|
...components,
|
|
72
20
|
});
|
|
73
|
-
export const createMdxComponents =
|
|
74
|
-
export const mergeGeistdocsMDXComponents = (...componentSets) => Object.assign({}, ...componentSets.filter(Boolean));
|
|
21
|
+
export const createMdxComponents = getGeistdocsMDXComponents;
|
package/dist/mobile-docs-bar.js
CHANGED
|
@@ -22,7 +22,7 @@ export const MobileDocsBar = ({ toc }) => {
|
|
|
22
22
|
const [tocOpen, setTocOpen] = useState(false);
|
|
23
23
|
const activeAnchors = useActiveAnchors();
|
|
24
24
|
const hasToc = Boolean(toc && toc.length > 0);
|
|
25
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "sticky top-16 z-30 -mx-6 -mt-6 mb-6 flex @min-[961px]:hidden h-[54px] items-center border-b bg-background-200 px-6", "data-mobile-docs-bar": true, children: _jsxs("button", { "aria-expanded": sidebarOpen, "aria-haspopup": "dialog", className: "-ml-2 flex min-h-8 touch-manipulation items-center gap-3 rounded-md px-2 text-gray-1000 text-label-16 transition-colors hover:bg-gray-alpha-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300 motion-reduce:transition-none", onClick: () => setSidebarOpen(true), type: "button", children: [_jsx(IconMenuAlt, { size: 16 }), "Menu"] }) }), hasToc ? (_jsx("div", { className: "pointer-events-none sticky top-[calc(4rem+70px)] z-30 -mb-12 flex @min-[961px]:hidden justify-end", children: _jsxs(Popover, { onOpenChange: setTocOpen, open: tocOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { "aria-label": "Table of contents", className: "pointer-events-auto flex size-8 touch-manipulation items-center justify-center rounded-md bg-background-100 text-gray-900 shadow-[var(--ds-shadow-border)] transition-colors hover:border-gray-alpha-500 hover:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:border-gray-alpha-600 data-[state=open]:border-gray-alpha-600 data-[state=open]:text-gray-1000 motion-reduce:transition-none", "data-mobile-toc-trigger": true, type: "button", children: _jsx(IconFileText, { size: 16 }) }) }), _jsx(PopoverContent, { align: "end", className: "w-64 overflow-hidden p-0", "data-geistdocs-mobile-toc": true, sideOffset: 8, children: _jsxs("div", { className: "max-h-[min(50vh,20rem)] overflow-y-auto overscroll-contain p-4", children: [_jsx("p", { className: "mb-2 font-medium text-gray-1000 text-xs uppercase tracking-wider", children: "On this page" }), _jsx("nav", { className: "flex flex-col", children: toc?.map((item) => {
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "sticky top-16 z-30 -mx-6 -mt-6 mb-6 flex @min-[961px]:hidden h-[54px] items-center border-b bg-background-200 px-6 md:-mt-8 xl:-mt-14", "data-mobile-docs-bar": true, children: _jsxs("button", { "aria-expanded": sidebarOpen, "aria-haspopup": "dialog", className: "-ml-2 flex min-h-8 touch-manipulation items-center gap-3 rounded-md px-2 text-gray-1000 text-label-16 transition-colors hover:bg-gray-alpha-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300 motion-reduce:transition-none", onClick: () => setSidebarOpen(true), type: "button", children: [_jsx(IconMenuAlt, { size: 16 }), "Menu"] }) }), hasToc ? (_jsx("div", { className: "pointer-events-none sticky top-[calc(4rem+70px)] z-30 -mb-12 flex @min-[961px]:hidden justify-end", children: _jsxs(Popover, { onOpenChange: setTocOpen, open: tocOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { "aria-label": "Table of contents", className: "pointer-events-auto flex size-8 touch-manipulation items-center justify-center rounded-md bg-background-100 text-gray-900 shadow-[var(--ds-shadow-border)] transition-colors hover:border-gray-alpha-500 hover:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:border-gray-alpha-600 data-[state=open]:border-gray-alpha-600 data-[state=open]:text-gray-1000 motion-reduce:transition-none", "data-mobile-toc-trigger": true, type: "button", children: _jsx(IconFileText, { size: 16 }) }) }), _jsx(PopoverContent, { align: "end", className: "w-64 overflow-hidden p-0", "data-geistdocs-mobile-toc": true, sideOffset: 8, children: _jsxs("div", { className: "max-h-[min(50vh,20rem)] overflow-y-auto overscroll-contain p-4", children: [_jsx("p", { className: "mb-2 font-medium text-gray-1000 text-xs uppercase tracking-wider", children: "On this page" }), _jsx("nav", { className: "flex flex-col", children: toc?.map((item) => {
|
|
26
26
|
const id = item.url.slice(1);
|
|
27
27
|
const active = activeAnchors.includes(id);
|
|
28
28
|
return (_jsx(Link, { className: "wrap-anywhere block py-1.5 text-gray-900 text-sm transition-colors first:pt-0 last:pb-0 hover:text-fd-accent-foreground focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none data-[active=true]:text-fd-primary motion-reduce:transition-none", "data-active": active ? "true" : undefined, href: item.url, onClick: () => setTocOpen(false), prefetch: false, style: {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CreateNavigationOptions } from "./internal/source-loader.js";
|
|
2
|
+
export type { CreateNavigationOptions, FumadocsCollection, GeistdocsSlugsContext, } from "./internal/source-loader.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create navigation from a Fumadocs collection without Markdown conversion.
|
|
5
|
+
* Pass a metadata-only collection to keep MDX bodies out of the import graph.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createNavigation: (options: CreateNavigationOptions) => {
|
|
8
|
+
pageTree: Record<string, import("fumadocs-core/page-tree").Root>;
|
|
9
|
+
};
|
|
10
|
+
export type GeistdocsNavigationBundle = ReturnType<typeof createNavigation>;
|
|
11
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,6BAA6B,CAAC;AAErC,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AAErC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,uBAAuB;;CAE/D,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createSourceLoader, } from "./internal/source-loader.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create navigation from a Fumadocs collection without Markdown conversion.
|
|
4
|
+
* Pass a metadata-only collection to keep MDX bodies out of the import graph.
|
|
5
|
+
*/
|
|
6
|
+
export const createNavigation = (options) => ({
|
|
7
|
+
pageTree: createSourceLoader(options).pageTree,
|
|
8
|
+
});
|
package/dist/next.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { type CreateMDXOptions } from "fumadocs-mdx/next";
|
|
2
2
|
import type { NextConfig } from "next";
|
|
3
|
-
export type CreateGeistdocsOptions = CreateMDXOptions
|
|
3
|
+
export type CreateGeistdocsOptions = CreateMDXOptions & {
|
|
4
|
+
/** Native where compatible by default; native rejects fallback, js opts out. */
|
|
5
|
+
mdxCompiler?: "auto" | "native" | "js";
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Prefer mdxCompiler. Absolute path of a loader that replaces
|
|
8
|
+
* `fumadocs-mdx/loader-mdx` for `.md`/`.mdx` files, such as
|
|
9
|
+
* the native loader in `@vercel/fumadocs-mdx-rs`. Defaults to the
|
|
10
|
+
* `GEISTDOCS_MDX_LOADER` environment variable.
|
|
11
|
+
*/
|
|
12
|
+
experimentalMdxLoader?: string;
|
|
13
|
+
};
|
|
4
14
|
/** Compose Fumadocs MDX with Geistdocs App Router discovery. */
|
|
5
15
|
export declare const createGeistdocs: (options?: CreateGeistdocsOptions) => (nextConfig?: NextConfig | Promise<NextConfig>) => Promise<NextConfig>;
|
|
6
16
|
//# sourceMappingURL=next.d.ts.map
|
package/dist/next.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAUvC,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACtD,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACvC;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAiHF,gEAAgE;AAChE,eAAO,MAAM,eAAe,GAAI,UAAS,sBAA2B,MAgBhE,aAAY,UAAU,GAAG,OAAO,CAAC,UAAU,CAAM,KAChD,OAAO,CAAC,UAAU,CAqCtB,CAAC"}
|