@vercel/geistdocs 1.11.3 → 1.11.4
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/page-breadcrumb.d.ts +16 -0
- package/dist/internal/page-breadcrumb.d.ts.map +1 -0
- package/dist/internal/page-breadcrumb.js +23 -0
- package/dist/internal/sidebar.d.ts.map +1 -1
- package/dist/internal/sidebar.js +63 -8
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +4 -1
- package/docs/agents.md +2 -1
- package/docs/llms.txt +29 -1
- package/docs/manifest.json +9 -1
- package/docs/pages/guides/nested-navigation.md +23 -0
- package/docs/sitemap.md +1 -0
- package/package.json +1 -1
- package/template/content/docs/guides/meta.json +4 -0
- package/template/content/docs/guides/nested-navigation.mdx +19 -0
- package/template/content/docs/meta.json +1 -0
- package/template/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{program as T}from"commander";import{access as ce,copyFile as le}from"fs/promises";import{join as pe}from"path";import{cancel as de,intro as ge,isCancel as ue,log as fe,outro as me,spinner as he,text as we}from"@clack/prompts";import{spawn as te}from"child_process";import{readFileSync as se}from"fs";import{cp as ne,readFile as ae,rename as re,writeFile as ie}from"fs/promises";import{join as $}from"path";import{fileURLToPath as oe}from"url";var g="@vercel/geistdocs",m=(e,t=[],s={})=>new Promise((n,a)=>{let r=te(e,t,{stdio:"inherit",...s});r.on("error",a),r.on("close",i=>{if(i===0){n();return}a(new Error(`Command failed with exit code ${i}: ${[e,...t].join(" ")}`))})}),A=["dependencies","devDependencies","optionalDependencies","peerDependencies"],_=()=>JSON.parse(se(new URL("../../package.json",import.meta.url),"utf8")).version,P=async e=>{let t=$(e,"package.json"),s=await ae(t,"utf8");return JSON.parse(s)},x=async(e,t)=>{let s=$(e,"package.json");await ie(s,`${JSON.stringify(t,null,2)}
|
|
3
|
-
`,"utf8")},R=(e,t)=>{for(let s of A){let n=e[s];if(n&&t in n)return n[t]}},V=(e,t)=>!!R(e,t),b=(e,t,s)=>{let n=!1;for(let a of A){let r=e[a];r&&t in r&&(r[t]=s,n=!0)}return n},j=()=>oe(new URL("../../template",import.meta.url)),F=async e=>{await ne(j(),e,{recursive:!0});let t=$(e,".gitignore"),s=$(e,"_gitignore");try{await re(s,t)}catch{}};var ye=async e=>{await F(e)},Pe=async e=>{try{return await ce(e),!0}catch{return!1}},ve=async()=>{await Pe(".env.example")&&await le(".env.example",".env.local")},Te=async e=>{let t=await P(e),s=_();return b(t,g,s)?(await x(e,t),!0):!1},ke=async e=>{await m("pnpm",["install"],{cwd:e,env:process.env,stdio:"inherit"})},$e=async e=>{await m("git",["init"],{cwd:e,env:process.env,stdio:"inherit"}),await m("git",["add","."],{cwd:e,env:process.env,stdio:"inherit"}),await m("git",["commit","-m","\u2728 Initial commit"],{cwd:e,env:process.env,stdio:"inherit"})},xe=async()=>{let e=await we({message:"What is your project named?",placeholder:"my-app",validate(t){if(t.length===0)return"Please enter a project name."}});return ue(e)&&(de("Operation cancelled."),process.exit(0)),e.toString()},G=async e=>{try{ge("Let's start a Geistdocs project!");let t=process.cwd(),s=e.name||await xe(),n=he(),a=pe(t,s);n.start("Copying bundled template..."),await ye(s),n.message("Setting up environment variables..."),process.chdir(a),await ve(),n.message("Rewriting package dependency versions..."),await Te(a),n.message("Installing dependencies..."),await ke(a),e.disableGit||(n.message("Initializing Git repository..."),await $e(a)),n.stop("Project initialized successfully!"),me("Run `pnpm dev` to start the development server.")}catch(t){let s=t instanceof Error?t.message:`Failed to initialize project: ${t}`;fe.error(s),process.exit(1)}};import{readFileSync as be,writeFileSync as Fe}from"fs";import{mkdir as De,readFile as N,writeFile as Se}from"fs/promises";import{dirname as Ce,extname as Re,relative as M,resolve as S}from"path";import{intro as je,isCancel as Ee,log as h,multiselect as Ne,outro as D,spinner as Ue}from"@clack/prompts";import{glob as Oe}from"glob";import{Node as v,Project as Ie,SyntaxKind as Je}from"ts-morph";var Le="geistdocs.tsx",Ae="content/docs/**/*.mdx",U=".translation-cache.json",E=8,B=()=>({version:1,entries:{}}),_e=async e=>{let t=await N(e),{createHash:s}=await import("crypto");return s("sha256").update(t).digest("hex")},Ve=e=>{let t=S(process.cwd(),e);return be(t,"utf8")},z=e=>v.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(v.isPropertyAssignment(t)){let s=t.getNameNode();if(v.isIdentifier(s)||v.isStringLiteral(s))return[s.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],Ge=e=>{try{let t=new Ie({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),s=Ve(e),r=t.createSourceFile(e,s,{overwrite:!0}).getVariableDeclarations().find(l=>l.getName()==="translations")?.getInitializer();if(!r)return[];if(v.isObjectLiteralExpression(r))return z(r);let i=r.getFirstDescendantByKind(Je.ObjectLiteralExpression);return i?z(i):[]}catch(t){let s=t instanceof Error?t.message:`${t}`;return h.warn(`Failed to read locales from ${e}: ${s}`),[]}},Be=async()=>{let e=await Ne({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 Ee(e)&&(D("Translation cancelled"),process.exit(0)),e},ze=async e=>(await Oe(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),He=async()=>{let e=S(process.cwd(),U);try{let t=await N(e,"utf8"),s=JSON.parse(t);return s.version!==1||!s.entries?B():{version:1,entries:s.entries}}catch{return B()}},H=e=>{let t=S(process.cwd(),U),s=JSON.stringify(e,null,2);Fe(t,s,"utf8")},Me=async e=>{let t=await Promise.all(e.map(async s=>[s,await _e(s)]));return Object.fromEntries(t)},Ke=(e,t)=>{let s=Re(e);return`${e.slice(0,-s.length)}.${t}${s}`},K=(e,t)=>`${M(process.cwd(),e)}::${t}`,qe=(e,t,s,n,a=!1)=>{let r=[],i=0;for(let l of t){let c=s[l];for(let o of e){let d=Ke(l,o),u=K(l,o),f=n.entries[u];if(!a&&f?.hash===c){i+=1;continue}r.push({locale:o,sourceFile:l,sourceHash:c,targetFile:d})}}return{tasks:r,skippedCount:i}},Xe=async e=>{await De(Ce(e),{recursive:!0})},We=async(e,t,s)=>{let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:s})});if(!n.ok){let r=await n.text();throw new Error(`API request failed (${n.status}): ${r}`)}let a=await n.json();if(!a.translation)throw new Error("API response did not include a translation");return a.translation},Ye=async(e,t,s)=>{let n=await N(e.sourceFile,"utf8"),a=await We(t,n,e.locale);await Xe(e.targetFile),await Se(e.targetFile,a,"utf8"),s.entries[K(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},q=async(e,t)=>{je("Translate MDX content");let s=e??Ae,n=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",a=Ge(t.config??Le),r=await ze(s);r.length===0&&(h.error(`No MDX files found matching pattern: ${s}`),D("Translation cancelled"),process.exit(1)),h.info(`Found ${r.length} MDX file(s) matching pattern`),a.length===0&&(a=await Be());let i=S(process.cwd(),U),l=await He();await H(l),h.info(`Using cache: ${i}`);let c=await Me(r),{tasks:o,skippedCount:d}=qe(a,r,c,l,t.force);if(o.length===0){h.success("All translations are up to date!"),D(`Skipped ${d} file(s) (unchanged)`);return}let u=[];for(let y=0;y<o.length;y+=E)u.push(o.slice(y,y+E));h.info(`Processing ${o.length} translation(s) in ${u.length} batch(es) of up to ${E}`),d>0&&h.info(`Skipped ${d} translation(s) (unchanged)`);let f=Ue();f.start("Translating content...");let k=0;for(let y of u)await Promise.all(y.map(async L=>{await Ye(L,n,l),k+=1,f.message(`Translated ${k}/${o.length}: ${M(process.cwd(),L.targetFile)}`)})),await H(l);f.stop("Translation complete!"),D(`Created/updated ${o.length} file(s)`)};import{access as Ze,copyFile as Qe,mkdir as Z,rm as J}from"fs/promises";import{dirname as et,join as w}from"path";import{intro as tt,log as p,outro as C,spinner as Q}from"@clack/prompts";import{glob as st}from"glob";var nt=["**/*"],at=["content/docs/**"],O=".geistdocs-tmp",rt=async(e,t)=>{let s=w(e,t);await J(s,{recursive:!0,force:!0}),await Z(s,{recursive:!0})},I=async e=>await J(e,{recursive:!0,force:!0}),X=async(e,t,s)=>(await st(e,{cwd:s,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),it=async e=>{try{return await Ze(e),!0}catch{return!1}},ot=async(e,t,s)=>{let n=w(t,e),a=w(s,e);return await it(n)?(await Qe(n,a),{success:!0}):{success:!1,error:`Source file not found: ${n}`}},ct=async(e,t)=>{let s=w(t,e);return await J(s,{force:!0}),{success:!0}},W=20,Y=async(e,t,s)=>{let n=[];for(let a=0;a<e.length;a+=s){let r=e.slice(a,a+s),i=await Promise.all(r.map(t));n.push(...i)}return n},lt=async(e,t,s,n,a)=>{let r={success:[],deleted:[],failed:[]},i=[...new Set(e.map(c=>et(w(n,c))))];a.message(`Creating ${i.length} directories...`),await Promise.all(i.map(c=>Z(c,{recursive:!0}))),a.message(`Updating ${e.length} files...`);let l=await Y(e,async c=>{let o=await ot(c,s,n);return{file:c,...o}},W);for(let{file:c,success:o,error:d}of l)o?r.success.push(c):r.failed.push({file:c,error:d??"Unknown error"});if(t.length>0){a.message(`Deleting ${t.length} files...`);let c=await Y(t,async o=>{try{return await ct(o,n),{file:o,success:!0}}catch(d){let u=d instanceof Error?d.message:`${d}`;return{file:o,success:!1,error:u}}},W);for(let o of c)o.success?r.deleted.push(o.file):r.failed.push({file:o.file,error:o.error})}return r},pt=e=>{if(e.success.length>0){p.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)p.info(` \u2713 ${t}`)}if(e.deleted.length>0){p.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)p.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){p.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:s}of e.failed)p.error(` \u2717 ${t}: ${s}`)}},dt=e=>e.includes("canary")?"canary":"latest",gt=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(g)}`);if(!t.ok)throw new Error(`Failed to resolve ${g}@${e}`);let n=(await t.json())["dist-tags"]?.[e];if(!n)throw new Error(`Could not find dist-tag ${e} for ${g}`);return n},ut=async e=>{let t=await P(e),s=R(t,g);if(!s)return{currentVersion:s,nextVersion:void 0,updated:!1};let n=dt(s),a=await gt(n);return s===a?{currentVersion:s,nextVersion:a,updateTag:n,updated:!1}:(b(t,g,a),await x(e,t),{currentVersion:s,nextVersion:a,updateTag:n,updated:!0})},ft=async(e,t,s)=>{let n=await P(e);if(!V(n,g))return!1;t&&t.length>0&&p.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),s?.sync&&p.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:a,nextVersion:r,updateTag:i,updated:l}=await ut(e);if(!l)return p.success(a?`@vercel/geistdocs is already at ${r} (${i}).`:"No package version update was needed."),C("Package-based site is already up to date."),!0;p.info(`Bumping ${g} from ${a} to ${r} (${i})`);let c=Q();return c.start("Installing updated package version..."),await m("pnpm",["install"],{cwd:e}),c.stop("Package update complete!"),C("Please review and test the upgraded package version."),!0},mt=async(e,t,s,n,a)=>{let r=w(e,O),i=Q(),l=a?.sync?r:t;i.start("Preparing template snapshot..."),a?.sync&&(await rt(e,O),await F(r)),i.message("Scanning for files...");let c=await X(s,n,l),o=[];if(a?.sync){i.message("Comparing with local files...");let u=await X(s,n,e),f=new Set(c);o=u.filter(k=>!f.has(k))}if(i.stop(`Found ${c.length} files to update`),c.length===0&&o.length===0){p.warn("No files matched the patterns. Nothing to update."),a?.sync&&await I(r),C("Update cancelled.");return}p.info(`Patterns: ${s.length}`),p.info(`Files to update: ${c.length}`),a?.sync&&p.info(`Files to delete: ${o.length}`),i.start("Updating files...");let d=await lt(c,o,l,e,i);a?.sync&&(i.message("Cleaning up..."),await I(r)),i.stop("Update complete!"),pt(d),C("Please review and test the changes carefully.")},ee=async(e,t)=>{let s=process.cwd(),n=j(),a=e&&e.length>0?e:nt,r=e&&e.length>0?[]:at;try{if(tt("Let's update your Geistdocs project!"),await ft(s,e,t))return;p.info("Template source: bundled package snapshot"),e&&e.length>0&&p.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&p.info("Sync mode enabled: will delete files removed from template"),await mt(s,n,a,r,t)}catch(i){let l=i instanceof Error?i.message:`${i}`;try{await I(w(s,O))}catch{}p.error(`Failed to update project: ${l}`),process.exit(1)}};T.name("geistdocs").description("CLI for Geistdocs projects").version("1.11.3","-v, --version","Output the current version");T.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(G);T.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(ee);T.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(q);T.parse(process.argv);
|
|
3
|
+
`,"utf8")},R=(e,t)=>{for(let s of A){let n=e[s];if(n&&t in n)return n[t]}},V=(e,t)=>!!R(e,t),b=(e,t,s)=>{let n=!1;for(let a of A){let r=e[a];r&&t in r&&(r[t]=s,n=!0)}return n},j=()=>oe(new URL("../../template",import.meta.url)),F=async e=>{await ne(j(),e,{recursive:!0});let t=$(e,".gitignore"),s=$(e,"_gitignore");try{await re(s,t)}catch{}};var ye=async e=>{await F(e)},Pe=async e=>{try{return await ce(e),!0}catch{return!1}},ve=async()=>{await Pe(".env.example")&&await le(".env.example",".env.local")},Te=async e=>{let t=await P(e),s=_();return b(t,g,s)?(await x(e,t),!0):!1},ke=async e=>{await m("pnpm",["install"],{cwd:e,env:process.env,stdio:"inherit"})},$e=async e=>{await m("git",["init"],{cwd:e,env:process.env,stdio:"inherit"}),await m("git",["add","."],{cwd:e,env:process.env,stdio:"inherit"}),await m("git",["commit","-m","\u2728 Initial commit"],{cwd:e,env:process.env,stdio:"inherit"})},xe=async()=>{let e=await we({message:"What is your project named?",placeholder:"my-app",validate(t){if(t.length===0)return"Please enter a project name."}});return ue(e)&&(de("Operation cancelled."),process.exit(0)),e.toString()},G=async e=>{try{ge("Let's start a Geistdocs project!");let t=process.cwd(),s=e.name||await xe(),n=he(),a=pe(t,s);n.start("Copying bundled template..."),await ye(s),n.message("Setting up environment variables..."),process.chdir(a),await ve(),n.message("Rewriting package dependency versions..."),await Te(a),n.message("Installing dependencies..."),await ke(a),e.disableGit||(n.message("Initializing Git repository..."),await $e(a)),n.stop("Project initialized successfully!"),me("Run `pnpm dev` to start the development server.")}catch(t){let s=t instanceof Error?t.message:`Failed to initialize project: ${t}`;fe.error(s),process.exit(1)}};import{readFileSync as be,writeFileSync as Fe}from"fs";import{mkdir as De,readFile as N,writeFile as Se}from"fs/promises";import{dirname as Ce,extname as Re,relative as M,resolve as S}from"path";import{intro as je,isCancel as Ee,log as h,multiselect as Ne,outro as D,spinner as Ue}from"@clack/prompts";import{glob as Oe}from"glob";import{Node as v,Project as Ie,SyntaxKind as Je}from"ts-morph";var Le="geistdocs.tsx",Ae="content/docs/**/*.mdx",U=".translation-cache.json",E=8,B=()=>({version:1,entries:{}}),_e=async e=>{let t=await N(e),{createHash:s}=await import("crypto");return s("sha256").update(t).digest("hex")},Ve=e=>{let t=S(process.cwd(),e);return be(t,"utf8")},z=e=>v.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(v.isPropertyAssignment(t)){let s=t.getNameNode();if(v.isIdentifier(s)||v.isStringLiteral(s))return[s.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],Ge=e=>{try{let t=new Ie({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),s=Ve(e),r=t.createSourceFile(e,s,{overwrite:!0}).getVariableDeclarations().find(l=>l.getName()==="translations")?.getInitializer();if(!r)return[];if(v.isObjectLiteralExpression(r))return z(r);let i=r.getFirstDescendantByKind(Je.ObjectLiteralExpression);return i?z(i):[]}catch(t){let s=t instanceof Error?t.message:`${t}`;return h.warn(`Failed to read locales from ${e}: ${s}`),[]}},Be=async()=>{let e=await Ne({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 Ee(e)&&(D("Translation cancelled"),process.exit(0)),e},ze=async e=>(await Oe(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),He=async()=>{let e=S(process.cwd(),U);try{let t=await N(e,"utf8"),s=JSON.parse(t);return s.version!==1||!s.entries?B():{version:1,entries:s.entries}}catch{return B()}},H=e=>{let t=S(process.cwd(),U),s=JSON.stringify(e,null,2);Fe(t,s,"utf8")},Me=async e=>{let t=await Promise.all(e.map(async s=>[s,await _e(s)]));return Object.fromEntries(t)},Ke=(e,t)=>{let s=Re(e);return`${e.slice(0,-s.length)}.${t}${s}`},K=(e,t)=>`${M(process.cwd(),e)}::${t}`,qe=(e,t,s,n,a=!1)=>{let r=[],i=0;for(let l of t){let c=s[l];for(let o of e){let d=Ke(l,o),u=K(l,o),f=n.entries[u];if(!a&&f?.hash===c){i+=1;continue}r.push({locale:o,sourceFile:l,sourceHash:c,targetFile:d})}}return{tasks:r,skippedCount:i}},Xe=async e=>{await De(Ce(e),{recursive:!0})},We=async(e,t,s)=>{let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:s})});if(!n.ok){let r=await n.text();throw new Error(`API request failed (${n.status}): ${r}`)}let a=await n.json();if(!a.translation)throw new Error("API response did not include a translation");return a.translation},Ye=async(e,t,s)=>{let n=await N(e.sourceFile,"utf8"),a=await We(t,n,e.locale);await Xe(e.targetFile),await Se(e.targetFile,a,"utf8"),s.entries[K(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},q=async(e,t)=>{je("Translate MDX content");let s=e??Ae,n=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",a=Ge(t.config??Le),r=await ze(s);r.length===0&&(h.error(`No MDX files found matching pattern: ${s}`),D("Translation cancelled"),process.exit(1)),h.info(`Found ${r.length} MDX file(s) matching pattern`),a.length===0&&(a=await Be());let i=S(process.cwd(),U),l=await He();await H(l),h.info(`Using cache: ${i}`);let c=await Me(r),{tasks:o,skippedCount:d}=qe(a,r,c,l,t.force);if(o.length===0){h.success("All translations are up to date!"),D(`Skipped ${d} file(s) (unchanged)`);return}let u=[];for(let y=0;y<o.length;y+=E)u.push(o.slice(y,y+E));h.info(`Processing ${o.length} translation(s) in ${u.length} batch(es) of up to ${E}`),d>0&&h.info(`Skipped ${d} translation(s) (unchanged)`);let f=Ue();f.start("Translating content...");let k=0;for(let y of u)await Promise.all(y.map(async L=>{await Ye(L,n,l),k+=1,f.message(`Translated ${k}/${o.length}: ${M(process.cwd(),L.targetFile)}`)})),await H(l);f.stop("Translation complete!"),D(`Created/updated ${o.length} file(s)`)};import{access as Ze,copyFile as Qe,mkdir as Z,rm as J}from"fs/promises";import{dirname as et,join as w}from"path";import{intro as tt,log as p,outro as C,spinner as Q}from"@clack/prompts";import{glob as st}from"glob";var nt=["**/*"],at=["content/docs/**"],O=".geistdocs-tmp",rt=async(e,t)=>{let s=w(e,t);await J(s,{recursive:!0,force:!0}),await Z(s,{recursive:!0})},I=async e=>await J(e,{recursive:!0,force:!0}),X=async(e,t,s)=>(await st(e,{cwd:s,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),it=async e=>{try{return await Ze(e),!0}catch{return!1}},ot=async(e,t,s)=>{let n=w(t,e),a=w(s,e);return await it(n)?(await Qe(n,a),{success:!0}):{success:!1,error:`Source file not found: ${n}`}},ct=async(e,t)=>{let s=w(t,e);return await J(s,{force:!0}),{success:!0}},W=20,Y=async(e,t,s)=>{let n=[];for(let a=0;a<e.length;a+=s){let r=e.slice(a,a+s),i=await Promise.all(r.map(t));n.push(...i)}return n},lt=async(e,t,s,n,a)=>{let r={success:[],deleted:[],failed:[]},i=[...new Set(e.map(c=>et(w(n,c))))];a.message(`Creating ${i.length} directories...`),await Promise.all(i.map(c=>Z(c,{recursive:!0}))),a.message(`Updating ${e.length} files...`);let l=await Y(e,async c=>{let o=await ot(c,s,n);return{file:c,...o}},W);for(let{file:c,success:o,error:d}of l)o?r.success.push(c):r.failed.push({file:c,error:d??"Unknown error"});if(t.length>0){a.message(`Deleting ${t.length} files...`);let c=await Y(t,async o=>{try{return await ct(o,n),{file:o,success:!0}}catch(d){let u=d instanceof Error?d.message:`${d}`;return{file:o,success:!1,error:u}}},W);for(let o of c)o.success?r.deleted.push(o.file):r.failed.push({file:o.file,error:o.error})}return r},pt=e=>{if(e.success.length>0){p.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)p.info(` \u2713 ${t}`)}if(e.deleted.length>0){p.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)p.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){p.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:s}of e.failed)p.error(` \u2717 ${t}: ${s}`)}},dt=e=>e.includes("canary")?"canary":"latest",gt=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(g)}`);if(!t.ok)throw new Error(`Failed to resolve ${g}@${e}`);let n=(await t.json())["dist-tags"]?.[e];if(!n)throw new Error(`Could not find dist-tag ${e} for ${g}`);return n},ut=async e=>{let t=await P(e),s=R(t,g);if(!s)return{currentVersion:s,nextVersion:void 0,updated:!1};let n=dt(s),a=await gt(n);return s===a?{currentVersion:s,nextVersion:a,updateTag:n,updated:!1}:(b(t,g,a),await x(e,t),{currentVersion:s,nextVersion:a,updateTag:n,updated:!0})},ft=async(e,t,s)=>{let n=await P(e);if(!V(n,g))return!1;t&&t.length>0&&p.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),s?.sync&&p.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:a,nextVersion:r,updateTag:i,updated:l}=await ut(e);if(!l)return p.success(a?`@vercel/geistdocs is already at ${r} (${i}).`:"No package version update was needed."),C("Package-based site is already up to date."),!0;p.info(`Bumping ${g} from ${a} to ${r} (${i})`);let c=Q();return c.start("Installing updated package version..."),await m("pnpm",["install"],{cwd:e}),c.stop("Package update complete!"),C("Please review and test the upgraded package version."),!0},mt=async(e,t,s,n,a)=>{let r=w(e,O),i=Q(),l=a?.sync?r:t;i.start("Preparing template snapshot..."),a?.sync&&(await rt(e,O),await F(r)),i.message("Scanning for files...");let c=await X(s,n,l),o=[];if(a?.sync){i.message("Comparing with local files...");let u=await X(s,n,e),f=new Set(c);o=u.filter(k=>!f.has(k))}if(i.stop(`Found ${c.length} files to update`),c.length===0&&o.length===0){p.warn("No files matched the patterns. Nothing to update."),a?.sync&&await I(r),C("Update cancelled.");return}p.info(`Patterns: ${s.length}`),p.info(`Files to update: ${c.length}`),a?.sync&&p.info(`Files to delete: ${o.length}`),i.start("Updating files...");let d=await lt(c,o,l,e,i);a?.sync&&(i.message("Cleaning up..."),await I(r)),i.stop("Update complete!"),pt(d),C("Please review and test the changes carefully.")},ee=async(e,t)=>{let s=process.cwd(),n=j(),a=e&&e.length>0?e:nt,r=e&&e.length>0?[]:at;try{if(tt("Let's update your Geistdocs project!"),await ft(s,e,t))return;p.info("Template source: bundled package snapshot"),e&&e.length>0&&p.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&p.info("Sync mode enabled: will delete files removed from template"),await mt(s,n,a,r,t)}catch(i){let l=i instanceof Error?i.message:`${i}`;try{await I(w(s,O))}catch{}p.error(`Failed to update project: ${l}`),process.exit(1)}};T.name("geistdocs").description("CLI for Geistdocs projects").version("1.11.4","-v, --version","Output the current version");T.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(G);T.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(ee);T.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(q);T.parse(process.argv);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getBreadcrumbItems } from "fumadocs-core/breadcrumb";
|
|
2
|
+
type PageTreeRoot = Parameters<typeof getBreadcrumbItems>[1];
|
|
3
|
+
interface PageBreadcrumbProps {
|
|
4
|
+
tree: PageTreeRoot;
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Server-rendered breadcrumb. fumadocs' `<PageBreadcrumb>` derives items from
|
|
9
|
+
* `usePathname()`, which is empty during static prerender, so it mounts only on
|
|
10
|
+
* hydration and drops the title. Computing items from the page URL keeps it in
|
|
11
|
+
* the static HTML. Markup mirrors fumadocs' default options, so output is
|
|
12
|
+
* unchanged.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PageBreadcrumb: ({ tree, url }: PageBreadcrumbProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=page-breadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-breadcrumb.d.ts","sourceRoot":"","sources":["../../src/internal/page-breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAM9D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7D,UAAU,mBAAmB;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,eAAe,mBAAmB,mDAiChE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getBreadcrumbItems } from "fumadocs-core/breadcrumb";
|
|
3
|
+
import Link from "fumadocs-core/link";
|
|
4
|
+
import { ChevronRight } from "lucide-react";
|
|
5
|
+
import { Fragment } from "react";
|
|
6
|
+
import { cn } from "./cn";
|
|
7
|
+
/**
|
|
8
|
+
* Server-rendered breadcrumb. fumadocs' `<PageBreadcrumb>` derives items from
|
|
9
|
+
* `usePathname()`, which is empty during static prerender, so it mounts only on
|
|
10
|
+
* hydration and drops the title. Computing items from the page URL keeps it in
|
|
11
|
+
* the static HTML. Markup mirrors fumadocs' default options, so output is
|
|
12
|
+
* unchanged.
|
|
13
|
+
*/
|
|
14
|
+
export const PageBreadcrumb = ({ tree, url }) => {
|
|
15
|
+
const items = getBreadcrumbItems(url, tree, {});
|
|
16
|
+
if (items.length === 0) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return (_jsx("div", { className: "flex items-center gap-1.5 text-fd-muted-foreground text-sm", children: items.map((item, index) => {
|
|
20
|
+
const className = cn("truncate", index === items.length - 1 && "font-medium text-fd-primary");
|
|
21
|
+
return (_jsxs(Fragment, { children: [index !== 0 && _jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? (_jsx(Link, { className: cn(className, "transition-opacity hover:opacity-80"), href: item.url, children: item.name })) : (_jsx("span", { className: className, children: item.name }))] }, item.url ?? String(item.name)));
|
|
22
|
+
}) }));
|
|
23
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAG1F,OAAO,EAGL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAuDf,eAAO,MAAM,gBAAgB,GAAI,SAAS;IAAE,GAAG,CAAC,EAAE,SAAS,CAAA;CAAE,4CAmE5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,yBAAyB,CAAC,QAAQ,CA2BtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAAC,MAAM,CAoBlE,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,yBAAyB,CAAC,WAAW,CAM1E,CAAC"}
|
package/dist/internal/sidebar.js
CHANGED
|
@@ -1,17 +1,65 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { searchPath } from "fumadocs-core/breadcrumb";
|
|
3
4
|
import { SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, SidebarSeparator, } from "fumadocs-ui/components/sidebar/base";
|
|
4
|
-
import { useTreeContext
|
|
5
|
-
import { usePathname } from "next/navigation";
|
|
6
|
-
import { Fragment, useEffect, useRef } from "react";
|
|
5
|
+
import { useTreeContext } from "fumadocs-ui/contexts/tree";
|
|
6
|
+
import { useParams, usePathname } from "next/navigation";
|
|
7
|
+
import { createContext, Fragment, useContext, useEffect, useMemo, useRef, } from "react";
|
|
7
8
|
import { SearchButton } from "../controls";
|
|
8
9
|
import { useGeistdocsSidebar } from "../sidebar";
|
|
9
10
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "./ui/sheet";
|
|
11
|
+
/**
|
|
12
|
+
* Ancestors of the active page, from route params instead of `usePathname()`
|
|
13
|
+
* (empty during static prerender, so fumadocs' `useTreePath()` leaves the
|
|
14
|
+
* active folder collapsed until hydration — shifting the sidebar). Params
|
|
15
|
+
* resolve at prerender, keeping the active section open in the initial HTML.
|
|
16
|
+
*/
|
|
17
|
+
const SidebarActivePathContext = createContext([]);
|
|
18
|
+
const collectPageUrls = (nodes) => {
|
|
19
|
+
const urls = [];
|
|
20
|
+
for (const node of nodes) {
|
|
21
|
+
if (node.type === "page") {
|
|
22
|
+
urls.push(node.url);
|
|
23
|
+
}
|
|
24
|
+
else if (node.type === "folder") {
|
|
25
|
+
if (node.index) {
|
|
26
|
+
urls.push(node.index.url);
|
|
27
|
+
}
|
|
28
|
+
urls.push(...collectPageUrls(node.children));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return urls;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The active page's URL, found by matching the slug as a URL suffix rather than
|
|
35
|
+
* rebuilding it from a mount base — the base isn't reliably derivable from the
|
|
36
|
+
* tree (a site with all pages under one folder has no shared top-level prefix).
|
|
37
|
+
* The shallowest suffix match is the active page: any deeper match belongs to a
|
|
38
|
+
* page with a longer slug, so it can't be the one these params point to.
|
|
39
|
+
*/
|
|
40
|
+
const findActiveUrl = (nodes, slug) => {
|
|
41
|
+
if (!slug) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const suffix = `/${slug}`;
|
|
45
|
+
return collectPageUrls(nodes)
|
|
46
|
+
.filter((url) => url.endsWith(suffix))
|
|
47
|
+
.sort((a, b) => a.split("/").length - b.split("/").length)
|
|
48
|
+
.at(0);
|
|
49
|
+
};
|
|
10
50
|
export const GeistdocsSidebar = ({ top }) => {
|
|
11
|
-
const { root } = useTreeContext();
|
|
51
|
+
const { root, full } = useTreeContext();
|
|
12
52
|
const { isOpen, setIsOpen } = useGeistdocsSidebar();
|
|
13
53
|
const pathname = usePathname();
|
|
14
54
|
const previousPathname = useRef(pathname);
|
|
55
|
+
const params = useParams();
|
|
56
|
+
const slugKey = Array.isArray(params.slug)
|
|
57
|
+
? params.slug.join("/")
|
|
58
|
+
: (params.slug ?? "");
|
|
59
|
+
const activePath = useMemo(() => {
|
|
60
|
+
const activeUrl = findActiveUrl(full.children, slugKey);
|
|
61
|
+
return activeUrl ? (searchPath(full.children, activeUrl) ?? []) : [];
|
|
62
|
+
}, [full, slugKey]);
|
|
15
63
|
useEffect(() => {
|
|
16
64
|
if (pathname !== previousPathname.current) {
|
|
17
65
|
setIsOpen(false);
|
|
@@ -27,12 +75,19 @@ export const GeistdocsSidebar = ({ top }) => {
|
|
|
27
75
|
}
|
|
28
76
|
return _jsx(GeistdocsSidebarItem, { item: item }, item.$id);
|
|
29
77
|
});
|
|
30
|
-
return (_jsxs("div", { className: "pointer-events-none sticky top-(--fd-docs-row-1) z-20 h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] [grid-area:sidebar] *:pointer-events-auto max-md:hidden md:layout:[--fd-sidebar-width:268px]", "data-sidebar-placeholder": true, children: [_jsxs("div", { className: "h-full overflow-y-auto px-4 pt-12 pb-4", children: [top ? _jsx("div", { className: "mb-4", children: top }) : null, _jsx(Fragment, { children: renderSidebarList(root.children) }, root.$id)] }), _jsx(Sheet, { onOpenChange: setIsOpen, open: isOpen, children: _jsxs(SheetContent, { className: "gap-0", side: "left", children: [_jsxs(SheetHeader, { className: "mt-8", children: [_jsx(SheetTitle, { className: "sr-only", children: "Mobile Menu" }), _jsx(SheetDescription, { className: "sr-only", children: "Navigation for the documentation." }), _jsx(SearchButton, { onClick: () => setIsOpen(false) })] }), _jsxs("div", { className: "flex-1 overflow-y-auto px-4 pb-4", children: [top ? _jsx("div", { className: "mb-4", children: top }) : null, renderSidebarList(root.children)] })] }) })] }));
|
|
78
|
+
return (_jsx(SidebarActivePathContext.Provider, { value: activePath, children: _jsxs("div", { className: "pointer-events-none sticky top-(--fd-docs-row-1) z-20 h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] [grid-area:sidebar] *:pointer-events-auto max-md:hidden md:layout:[--fd-sidebar-width:268px]", "data-sidebar-placeholder": true, children: [_jsxs("div", { className: "h-full overflow-y-auto px-4 pt-12 pb-4", children: [top ? _jsx("div", { className: "mb-4", children: top }) : null, _jsx(Fragment, { children: renderSidebarList(root.children) }, root.$id)] }), _jsx(Sheet, { onOpenChange: setIsOpen, open: isOpen, children: _jsxs(SheetContent, { className: "gap-0", side: "left", children: [_jsxs(SheetHeader, { className: "mt-8", children: [_jsx(SheetTitle, { className: "sr-only", children: "Mobile Menu" }), _jsx(SheetDescription, { className: "sr-only", children: "Navigation for the documentation." }), _jsx(SearchButton, { onClick: () => setIsOpen(false) })] }), _jsxs("div", { className: "flex-1 overflow-y-auto px-4 pb-4", children: [top ? _jsx("div", { className: "mb-4", children: top }) : null, renderSidebarList(root.children)] })] }) })] }) }));
|
|
31
79
|
};
|
|
32
80
|
export const GeistdocsSidebarFolder = ({ children, item, }) => {
|
|
33
|
-
const
|
|
34
|
-
const defaultOpen = item.defaultOpen ??
|
|
81
|
+
const activePath = useContext(SidebarActivePathContext);
|
|
82
|
+
const defaultOpen = item.defaultOpen ?? activePath.includes(item);
|
|
35
83
|
return (_jsxs(SidebarFolder, { defaultOpen: defaultOpen, children: [item.index ? (_jsxs(SidebarFolderLink, { className: "flex items-center gap-2 text-pretty py-1.5 text-gray-800 text-sm transition-colors hover:text-gray-1000 data-[active=true]:text-gray-1000 [&_svg]:size-3.5", external: item.index.external, href: item.index.url, children: [item.icon, item.name] })) : (_jsxs(SidebarFolderTrigger, { className: "flex items-center gap-2 text-pretty py-1.5 text-gray-800 text-sm transition-colors hover:text-gray-1000 [&_svg]:size-3.5", children: [item.icon, item.name] })), _jsx(SidebarFolderContent, { className: "ml-2", children: children })] }));
|
|
36
84
|
};
|
|
37
|
-
export const GeistdocsSidebarItem = ({ item, }) =>
|
|
85
|
+
export const GeistdocsSidebarItem = ({ item, }) => {
|
|
86
|
+
const activePath = useContext(SidebarActivePathContext);
|
|
87
|
+
// fumadocs' SidebarItem marks active from usePathname() (empty at prerender),
|
|
88
|
+
// so derive it from the params path (active page is its last node) to keep the
|
|
89
|
+
// marker in the static HTML. Overrides fumadocs' value, which is spread last.
|
|
90
|
+
const active = activePath.at(-1) === item;
|
|
91
|
+
return (_jsx(SidebarItem, { className: "block w-full truncate text-pretty py-1.5 text-gray-800 text-sm transition-colors hover:text-gray-1000 data-[active=true]:text-gray-1000", "data-active": active, external: item.external, href: item.url, icon: item.icon, children: item.name }));
|
|
92
|
+
};
|
|
38
93
|
export const GeistdocsSidebarSeparator = ({ item }) => (_jsxs(SidebarSeparator, { className: "mt-4 mb-2 flex items-center gap-2 px-0 font-medium text-sm first-child:mt-0", children: [item.icon, item.name] }));
|
package/dist/pages/docs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAMjD,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAChF,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,KAAK,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AACvC,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,KAAK,WAAW,GACZ,aAAa,GACb,CAAC,CAAC,OAAO,EAAE;IACT,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;CACtB,KAAK,aAAa,CAAC,CAAC;AAEzB,KAAK,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEpE,UAAU,wBAAwB;IAChC,MAAM,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;CACpC;AAED,UAAU,YAAa,SAAQ,2BAA2B;IACxD,IAAI,EAAE,aAAa,CAAC;QAAE,UAAU,CAAC,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC;CACrD;AAED,UAAU,qBAAqB;IAC7B,MAAM,EAAE,IAAI,CACV,eAAe,EACf,IAAI,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CACxD,CAAC;IACF,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC;IACzD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QACrB,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,cAAc,CAAC;KACxB,KAAK,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;QACnB,QAAQ,EAAE,QAAQ,CAAC;QACnB,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,cAAc,CAAC;KACxB,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE;QACpB,IAAI,EAAE,YAAY,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,aAAa,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACjB,KAAK,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE;QACtB,IAAI,EAAE,YAAY,CAAC;QACnB,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,YAAY,CAAC;KACtB,KAAK,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,qBAAqB,CAAC,EAAE,cAAc,CACpC,OAAO,gBAAgB,CACxB,CAAC,uBAAuB,CAAC,CAAC;CAC5B;AAuBD,eAAO,MAAM,cAAc,GAAI,2IAY5B,qBAAqB;wBAGnB;QACD,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAC;KACpD;;oCA0HE;QACD,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAC;KACpD,KAAG,OAAO,CAAC,QAAQ,CAAC;CA2CtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
|
package/dist/pages/docs.js
CHANGED
|
@@ -5,6 +5,7 @@ import { notFound } from "next/navigation";
|
|
|
5
5
|
import { cn } from "../internal/cn";
|
|
6
6
|
import { createPageActions as createInternalPageActions } from "../internal/page-actions";
|
|
7
7
|
import { GeistdocsPageActions } from "../internal/page-actions-client";
|
|
8
|
+
import { PageBreadcrumb } from "../internal/page-breadcrumb";
|
|
8
9
|
import { getPageFooterItems, PageFooter } from "../internal/page-footer";
|
|
9
10
|
import { getPageRobots, } from "../internal/page-visibility";
|
|
10
11
|
import { GeistdocsTableOfContents } from "../internal/table-of-contents";
|
|
@@ -68,7 +69,9 @@ export const createDocsPage = ({ config, source, mdx, pageActions = createIntern
|
|
|
68
69
|
path: page.path,
|
|
69
70
|
url: pageUrl,
|
|
70
71
|
} }) }) }));
|
|
71
|
-
return (_jsxs(FumadocsDocsPage, {
|
|
72
|
+
return (_jsxs(FumadocsDocsPage, { breadcrumb: {
|
|
73
|
+
component: (_jsx(PageBreadcrumb, { tree: source.source.getPageTree(lang), url: page.url })),
|
|
74
|
+
}, footer: { component: _jsx(PageFooter, { ...resolvedFooterItems }) }, full: data.full, tableOfContent: {
|
|
72
75
|
enabled: true,
|
|
73
76
|
single: true,
|
|
74
77
|
component: (_jsx(GeistdocsTableOfContents, { footer: tocFooter, toc: data.toc ?? [] })),
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 1.11.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 1.11.4 so agents can understand the installed package without web access.
|
|
4
4
|
They are generated from `apps/template/content/docs` during the package build.
|
|
5
5
|
|
|
6
6
|
## How to use these files
|
|
@@ -39,6 +39,7 @@ They are generated from `apps/template/content/docs` during the package build.
|
|
|
39
39
|
- [Feedback](pages/feedback.md): An interactive feedback widget that collects user sentiment and creates structured GitHub Issues automatically.
|
|
40
40
|
- [Internationalization](pages/internationalization.md): Serve documentation in multiple languages with automatic translation via the Geistdocs CLI and Fumadocs routing.
|
|
41
41
|
- [llms.txt](pages/llms-txt.md): A single endpoint that returns all documentation as plain Markdown text following the llms.txt standard.
|
|
42
|
+
- [Nested navigation](pages/guides/nested-navigation.md): How Geistdocs builds breadcrumbs from your page tree.
|
|
42
43
|
- [Open in Chat](pages/open-in-chat.md): Transfer documentation context to AI chat platforms like ChatGPT, Claude, Cursor, and v0 with a single click.
|
|
43
44
|
- [RSS](pages/rss.md): An automatically generated RSS 2.0 feed that keeps users informed when documentation is published or updated.
|
|
44
45
|
- [Theme-Aware Image](pages/theme-aware-image.md): A component that swaps images based on the active theme, built on top of Next.js Image.
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Documentation
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 1.11.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 1.11.4.
|
|
4
4
|
They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
|
|
5
5
|
|
|
6
6
|
## Documentation Index
|
|
@@ -22,6 +22,7 @@ They describe how to build package-backed Geistdocs sites and how to use the pac
|
|
|
22
22
|
- [Feedback](pages/feedback.md): An interactive feedback widget that collects user sentiment and creates structured GitHub Issues automatically.
|
|
23
23
|
- [Internationalization](pages/internationalization.md): Serve documentation in multiple languages with automatic translation via the Geistdocs CLI and Fumadocs routing.
|
|
24
24
|
- [llms.txt](pages/llms-txt.md): A single endpoint that returns all documentation as plain Markdown text following the llms.txt standard.
|
|
25
|
+
- [Nested navigation](pages/guides/nested-navigation.md): How Geistdocs builds breadcrumbs from your page tree.
|
|
25
26
|
- [Open in Chat](pages/open-in-chat.md): Transfer documentation context to AI chat platforms like ChatGPT, Claude, Cursor, and v0 with a single click.
|
|
26
27
|
- [RSS](pages/rss.md): An automatically generated RSS 2.0 feed that keeps users informed when documentation is published or updated.
|
|
27
28
|
- [Theme-Aware Image](pages/theme-aware-image.md): A component that swaps images based on the active theme, built on top of Next.js Image.
|
|
@@ -2745,6 +2746,33 @@ The llms.txt standard is a simple convention that makes documentation more acces
|
|
|
2745
2746
|
Learn more at [llmstxt.org](https://llmstxt.org/)
|
|
2746
2747
|
|
|
2747
2748
|
|
|
2749
|
+
---
|
|
2750
|
+
|
|
2751
|
+
---
|
|
2752
|
+
title: Nested navigation
|
|
2753
|
+
description: How Geistdocs builds breadcrumbs from your page tree.
|
|
2754
|
+
type: guide
|
|
2755
|
+
url: /docs/guides/nested-navigation
|
|
2756
|
+
source: apps/template/content/docs/guides/nested-navigation.mdx
|
|
2757
|
+
---
|
|
2758
|
+
|
|
2759
|
+
# Nested navigation
|
|
2760
|
+
|
|
2761
|
+
Any page nested inside a folder shows a breadcrumb above its title, built
|
|
2762
|
+
automatically from the page tree. This page lives under the **Guides** folder,
|
|
2763
|
+
so the breadcrumb above reads _Guides_.
|
|
2764
|
+
|
|
2765
|
+
## How it works
|
|
2766
|
+
|
|
2767
|
+
The breadcrumb lists the folder ancestors of the current page, in order. It is
|
|
2768
|
+
rendered on the server from the page's URL and the sidebar tree, so it is
|
|
2769
|
+
present in the initial HTML — the page title never shifts once the page
|
|
2770
|
+
hydrates.
|
|
2771
|
+
|
|
2772
|
+
Top-level pages (those not inside a folder) have no ancestors, so no breadcrumb
|
|
2773
|
+
is shown.
|
|
2774
|
+
|
|
2775
|
+
|
|
2748
2776
|
---
|
|
2749
2777
|
|
|
2750
2778
|
---
|
package/docs/manifest.json
CHANGED
|
@@ -161,6 +161,14 @@
|
|
|
161
161
|
"type": "conceptual",
|
|
162
162
|
"url": "/docs/llms-txt"
|
|
163
163
|
},
|
|
164
|
+
{
|
|
165
|
+
"description": "How Geistdocs builds breadcrumbs from your page tree.",
|
|
166
|
+
"path": "pages/guides/nested-navigation.md",
|
|
167
|
+
"source": "apps/template/content/docs/guides/nested-navigation.mdx",
|
|
168
|
+
"title": "Nested navigation",
|
|
169
|
+
"type": "guide",
|
|
170
|
+
"url": "/docs/guides/nested-navigation"
|
|
171
|
+
},
|
|
164
172
|
{
|
|
165
173
|
"description": "Allow users to continue conversations in their preferred AI chat platform with a single click",
|
|
166
174
|
"path": "pages/open-in-chat.md",
|
|
@@ -190,5 +198,5 @@
|
|
|
190
198
|
}
|
|
191
199
|
],
|
|
192
200
|
"source": "apps/template/content/docs",
|
|
193
|
-
"version": "1.11.
|
|
201
|
+
"version": "1.11.4"
|
|
194
202
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Nested navigation
|
|
3
|
+
description: How Geistdocs builds breadcrumbs from your page tree.
|
|
4
|
+
type: guide
|
|
5
|
+
url: /docs/guides/nested-navigation
|
|
6
|
+
source: apps/template/content/docs/guides/nested-navigation.mdx
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Nested navigation
|
|
10
|
+
|
|
11
|
+
Any page nested inside a folder shows a breadcrumb above its title, built
|
|
12
|
+
automatically from the page tree. This page lives under the **Guides** folder,
|
|
13
|
+
so the breadcrumb above reads _Guides_.
|
|
14
|
+
|
|
15
|
+
## How it works
|
|
16
|
+
|
|
17
|
+
The breadcrumb lists the folder ancestors of the current page, in order. It is
|
|
18
|
+
rendered on the server from the page's URL and the sidebar tree, so it is
|
|
19
|
+
present in the initial HTML — the page title never shifts once the page
|
|
20
|
+
hydrates.
|
|
21
|
+
|
|
22
|
+
Top-level pages (those not inside a folder) have no ancestors, so no breadcrumb
|
|
23
|
+
is shown.
|
package/docs/sitemap.md
CHANGED
|
@@ -20,6 +20,7 @@ Use it to choose focused page files from `docs/pages/` before reading the full `
|
|
|
20
20
|
- [Feedback](pages/feedback.md) | URL: /docs/feedback | Type: integration | Summary: An interactive feedback widget that collects user sentiment and creates structured GitHub Issues automatically.
|
|
21
21
|
- [Internationalization](pages/internationalization.md) | URL: /docs/internationalization | Type: guide | Summary: Serve documentation in multiple languages with automatic translation via the Geistdocs CLI and Fumadocs routing.
|
|
22
22
|
- [llms.txt](pages/llms-txt.md) | URL: /docs/llms-txt | Type: conceptual | Summary: A single endpoint that returns all documentation as plain Markdown text following the llms.txt standard.
|
|
23
|
+
- [Nested navigation](pages/guides/nested-navigation.md) | URL: /docs/guides/nested-navigation | Type: guide
|
|
23
24
|
- [Open in Chat](pages/open-in-chat.md) | URL: /docs/open-in-chat | Type: conceptual | Summary: Transfer documentation context to AI chat platforms like ChatGPT, Claude, Cursor, and v0 with a single click.
|
|
24
25
|
- [RSS](pages/rss.md) | URL: /docs/rss | Type: conceptual | Summary: An automatically generated RSS 2.0 feed that keeps users informed when documentation is published or updated.
|
|
25
26
|
- [Theme-Aware Image](pages/theme-aware-image.md) | URL: /docs/theme-aware-image | Type: reference | Summary: A component that swaps images based on the active theme, built on top of Next.js Image.
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Nested navigation
|
|
3
|
+
description: How Geistdocs builds breadcrumbs from your page tree.
|
|
4
|
+
type: guide
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Any page nested inside a folder shows a breadcrumb above its title, built
|
|
8
|
+
automatically from the page tree. This page lives under the **Guides** folder,
|
|
9
|
+
so the breadcrumb above reads _Guides_.
|
|
10
|
+
|
|
11
|
+
## How it works
|
|
12
|
+
|
|
13
|
+
The breadcrumb lists the folder ancestors of the current page, in order. It is
|
|
14
|
+
rendered on the server from the page's URL and the sidebar tree, so it is
|
|
15
|
+
present in the initial HTML — the page title never shifts once the page
|
|
16
|
+
hydrates.
|
|
17
|
+
|
|
18
|
+
Top-level pages (those not inside a folder) have no ancestors, so no breadcrumb
|
|
19
|
+
is shown.
|
package/template/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@streamdown/code": "^1.0.1",
|
|
19
19
|
"@vercel/agent-readability": "^0.2.1",
|
|
20
20
|
"@vercel/analytics": "^1.6.1",
|
|
21
|
-
"@vercel/geistdocs": "1.11.
|
|
21
|
+
"@vercel/geistdocs": "1.11.4",
|
|
22
22
|
"@vercel/speed-insights": "^1.3.1",
|
|
23
23
|
"ai": "^6.0.132",
|
|
24
24
|
"class-variance-authority": "^0.7.1",
|