@vercel/geistdocs 2.1.0 → 2.2.1
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/components/link.d.ts +5 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +4 -0
- package/dist/internal/docs-link-class-name.d.ts +2 -0
- package/dist/internal/docs-link-class-name.d.ts.map +1 -0
- package/dist/internal/docs-link-class-name.js +3 -0
- package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
- package/dist/internal/navbar/mobile-menu.js +2 -4
- package/dist/pages/docs.d.ts +2 -0
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +9 -2
- package/docs/agents.md +1 -1
- package/docs/llms.txt +41 -3
- package/docs/manifest.json +1 -1
- package/docs/pages/getting-started.md +8 -0
- package/docs/pages/packages.md +6 -2
- package/docs/pages/syntax.md +26 -0
- package/package.json +5 -1
- package/template/app/styles/geistdocs.css +2 -2
- package/template/content/docs/getting-started.mdx +9 -0
- package/template/content/docs/packages.mdx +6 -2
- package/template/content/docs/syntax.mdx +26 -0
- package/template/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4,4 +4,4 @@ import{program as A}from"commander";import{access as Xe,copyFile as Ke,readdir a
|
|
|
4
4
|
`);throw new AggregateError(s,`Mixedbread search sync did not complete:
|
|
5
5
|
${a}`)}return r},Mt=async({client:e,file:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:s})=>{let i=t,o=Date.now()+r;for(;i.status==="pending"||i.status==="in_progress";){if(Date.now()>=o)throw new Error(`Mixedbread timed out while indexing file ${t.id}.`);await s(n),i=await e.retrieveStoreFile(t.id)}if(i.status!=="completed")throw new Error(`Mixedbread failed to index file ${t.id} (${i.status}).`);return i},Rt=async({client:e,desired:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:s})=>{let i=await e.uploadFile({content:t.document.content,filename:`${L(t.document.id).slice(0,32)}.md`}),o;try{o=await e.createStoreFile({externalId:t.externalId,fileId:i,metadata:{...t.metadata,[g.rawFileId]:i}})}catch(a){try{await e.deleteFile(i)}catch(d){throw new AggregateError([a,d],`Mixedbread failed to attach and clean up raw file ${i}.`)}throw a}return Mt({client:e,file:o,pollIntervalMs:n,pollTimeoutMs:r,sleep:s})},Te=async({client:e,concurrency:t=Et,manifest:n,pollIntervalMs:r=St,pollTimeoutMs:s=bt,revision:i,revisionAncestors:o=[],revisionTimestamp:a,sleep:d=At})=>{let c=be(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=>Pt(p,u,i,o,a)),m=new Map(l.map(p=>[p.document.id,p])),h=(await xe(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),x=new Map,v=new Set;for(let p of h){W(p.metadata,i,a)&&v.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)||v.has(p.document.id)));await Ee(_,t,p=>Rt({client:e,desired:p,pollIntervalMs:r,pollTimeoutMs:s,sleep:d}));let E=(await xe(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),D=new Set(E.filter(({metadata:p})=>W(p,i,a)).map(({metadata:p})=>p.documentId)),ie=new Set;for(let p of l){if(D.has(p.document.id))continue;let ae=E.filter(({file:B,metadata:k})=>B.status==="completed"&&k.documentId===p.document.id&&k.contentHash===p.hash).sort((B,k)=>B.file.id.localeCompare(k.file.id))[0];ae&&ie.add(ae.file.id)}let oe=E.filter(({file:p,metadata:y})=>p.status!=="pending"&&p.status!=="in_progress"&&!W(y,i,a)&&vt({currentRevision:i,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 kt=50,Ct=e=>`vercel integration add mixedbread --name docs-${e||"your-site-id"} --environment production`,Ie=(e,t)=>Ft("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),Ot=e=>{let t=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),n=[];try{n=Ie(e,["rev-list",`--max-count=${kt+1}`,t||"HEAD"]).split(`
|
|
6
6
|
`).filter(Boolean)}catch{n=[]}let r=t||n[0],s;for(let i of Array.from(new Set([r,"HEAD"].filter(Boolean))))try{let o=Number(Ie(e,["show","-s","--format=%ct",i]));if(Number.isFinite(o)){s=o;break}}catch{}return{revision:r,revisionAncestors:n.filter(i=>i!==r),revisionTimestamp:s}},Pe=async({allowNonProduction:e=!1,dir:t=".next"}={})=>{let n=process.cwd();Dt.loadEnvConfig(n,!1);let r=process.env.MXBAI_API_KEY?.trim(),s=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!=!!s)throw new Error("Mixedbread is partially configured. Set both MXBAI_API_KEY and MXBAI_STORE_ID.");let i;try{i=await _e({cwd:n,outputDirectory:t})}catch(a){if(!(r||s)){console.log("Geistdocs search sync skipped: no Mixedbread credentials or static search export were found.");return}throw a}if(i.provider!=="mixedbread"){console.log("Geistdocs search sync skipped: Ask AI uses local retrieval.");return}if(!(r&&s))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:",Ct(i.siteId)].join(`
|
|
7
|
-
`));let o=await Te({client:he({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:s}),manifest:i,...Ot(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as $t,writeFileSync as Nt}from"fs";import{mkdir as Ut,readFile as Z,writeFile as Lt}from"fs/promises";import{dirname as Gt,extname as jt,relative as Re,resolve as j}from"path";import{intro as Vt,isCancel as Bt,log as I,multiselect as Jt,outro as G,spinner as Ht}from"@clack/prompts";import{glob as Xt}from"glob";import{Node as F,Project as Kt,SyntaxKind as Yt}from"ts-morph";var qt="geistdocs.tsx",zt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,ve=()=>({version:1,entries:{}}),Wt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},Qt=e=>{let t=j(process.cwd(),e);return $t(t,"utf8")},Ae=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):[],Zt=e=>{try{let t=new Kt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=Qt(e),i=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!i)return[];if(F.isObjectLiteralExpression(i))return Ae(i);let o=i.getFirstDescendantByKind(Yt.ObjectLiteralExpression);return o?Ae(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},en=async()=>{let e=await Jt({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 Bt(e)&&(G("Translation cancelled"),process.exit(0)),e},tn=async e=>(await Xt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),nn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?ve():{version:1,entries:n.entries}}catch{return ve()}},Me=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Nt(t,n,"utf8")},rn=async e=>{let t=await Promise.all(e.map(async n=>[n,await Wt(n)]));return Object.fromEntries(t)},sn=(e,t)=>{let n=jt(e);return`${e.slice(0,-n.length)}.${t}${n}`},Fe=(e,t)=>`${Re(process.cwd(),e)}::${t}`,on=(e,t,n,r,s=!1)=>{let i=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=sn(a,c),l=Fe(a,c),m=r.entries[l];if(!s&&m?.hash===d){o+=1;continue}i.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:i,skippedCount:o}},an=async e=>{await Ut(Gt(e),{recursive:!0})},cn=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 i=await r.text();throw new Error(`API request failed (${r.status}): ${i}`)}let s=await r.json();if(!s.translation)throw new Error("API response did not include a translation");return s.translation},dn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),s=await cn(t,r,e.locale);await an(e.targetFile),await Lt(e.targetFile,s,"utf8"),n.entries[Fe(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},De=async(e,t)=>{Vt("Translate MDX content");let n=e??zt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",s=Zt(t.config??qt),i=await tn(n);i.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),G("Translation cancelled"),process.exit(1)),I.info(`Found ${i.length} MDX file(s) matching pattern`),s.length===0&&(s=await en());let o=j(process.cwd(),ee),a=await nn();await Me(a),I.info(`Using cache: ${o}`);let d=await rn(i),{tasks:c,skippedCount:u}=on(s,i,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),G(`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=Ht();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await dn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Re(process.cwd(),x.targetFile)}`)})),await Me(a);m.stop("Translation complete!"),G(`Created/updated ${c.length} file(s)`)};import{access as ln,copyFile as pn,mkdir as $e,rm as re}from"fs/promises";import{dirname as un,join as P}from"path";import{intro as gn,log as w,outro as V,spinner as Ne}from"@clack/prompts";import{glob as mn}from"glob";var fn=["**/*"],hn=["content/docs/**"],te=".geistdocs-tmp",wn=async(e,t)=>{let n=P(e,t);await re(n,{recursive:!0,force:!0}),await $e(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),ke=async(e,t,n)=>(await mn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),yn=async e=>{try{return await ln(e),!0}catch{return!1}},xn=async(e,t,n)=>{let r=P(t,e),s=P(n,e);return await yn(r)?(await pn(r,s),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},En=async(e,t)=>{let n=P(t,e);return await re(n,{force:!0}),{success:!0}},Ce=20,Oe=async(e,t,n)=>{let r=[];for(let s=0;s<e.length;s+=n){let i=e.slice(s,s+n),o=await Promise.all(i.map(t));r.push(...o)}return r},Sn=async(e,t,n,r,s)=>{let i={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>un(P(r,d))))];s.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>$e(d,{recursive:!0}))),s.message(`Updating ${e.length} files...`);let a=await Oe(e,async d=>{let c=await xn(d,n,r);return{file:d,...c}},Ce);for(let{file:d,success:c,error:u}of a)c?i.success.push(d):i.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){s.message(`Deleting ${t.length} files...`);let d=await Oe(t,async c=>{try{return await En(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Ce);for(let c of d)c.success?i.deleted.push(c.file):i.failed.push({file:c.file,error:c.error})}return i},bn=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}`)}},_n=e=>e.includes("canary")?"canary":"latest",Tn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(b)}`);if(!t.ok)throw new Error(`Failed to resolve ${b}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${b}`);return r},In=async e=>{let t=await M(e),n=J(t,b);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=_n(n),s=await Tn(r);return n===s?{currentVersion:n,nextVersion:s,updateTag:r,updated:!1}:($(t,b,s),await O(e,t),{currentVersion:n,nextVersion:s,updateTag:r,updated:!0})},Pn=async(e,t,n)=>{let r=await M(e);if(!le(r,b))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:s,nextVersion:i,updateTag:o,updated:a}=await In(e);if(!a)return w.success(s?`@vercel/geistdocs is already at ${i} (${o}).`:"No package version update was needed."),V("Package-based site is already up to date."),!0;w.info(`Bumping ${b} from ${s} to ${i} (${o})`);let d=Ne();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),V("Please review and test the upgraded package version."),!0},vn=async(e,t,n,r,s)=>{let i=P(e,te),o=Ne(),a=s?.sync?i:t;o.start("Preparing template snapshot..."),s?.sync&&(await wn(e,te),await N(i)),o.message("Scanning for files...");let d=await ke(n,r,a),c=[];if(s?.sync){o.message("Comparing with local files...");let l=await ke(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."),s?.sync&&await ne(i),V("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),s?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await Sn(d,c,a,e,o);s?.sync&&(o.message("Cleaning up..."),await ne(i)),o.stop("Update complete!"),bn(u),V("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),s=e&&e.length>0?e:fn,i=e&&e.length>0?[]:hn;try{if(gn("Let's update your Geistdocs project!"),await Pn(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 vn(n,r,s,i,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(P(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.1.0","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(fe);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(De);var An=A.command("search").description("Manage the external search index used by Ask AI");An.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 Te({client:he({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:s}),manifest:i,...Ot(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as $t,writeFileSync as Nt}from"fs";import{mkdir as Ut,readFile as Z,writeFile as Lt}from"fs/promises";import{dirname as Gt,extname as jt,relative as Re,resolve as j}from"path";import{intro as Vt,isCancel as Bt,log as I,multiselect as Jt,outro as G,spinner as Ht}from"@clack/prompts";import{glob as Xt}from"glob";import{Node as F,Project as Kt,SyntaxKind as Yt}from"ts-morph";var qt="geistdocs.tsx",zt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,ve=()=>({version:1,entries:{}}),Wt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},Qt=e=>{let t=j(process.cwd(),e);return $t(t,"utf8")},Ae=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):[],Zt=e=>{try{let t=new Kt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=Qt(e),i=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!i)return[];if(F.isObjectLiteralExpression(i))return Ae(i);let o=i.getFirstDescendantByKind(Yt.ObjectLiteralExpression);return o?Ae(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},en=async()=>{let e=await Jt({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 Bt(e)&&(G("Translation cancelled"),process.exit(0)),e},tn=async e=>(await Xt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),nn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?ve():{version:1,entries:n.entries}}catch{return ve()}},Me=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Nt(t,n,"utf8")},rn=async e=>{let t=await Promise.all(e.map(async n=>[n,await Wt(n)]));return Object.fromEntries(t)},sn=(e,t)=>{let n=jt(e);return`${e.slice(0,-n.length)}.${t}${n}`},Fe=(e,t)=>`${Re(process.cwd(),e)}::${t}`,on=(e,t,n,r,s=!1)=>{let i=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=sn(a,c),l=Fe(a,c),m=r.entries[l];if(!s&&m?.hash===d){o+=1;continue}i.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:i,skippedCount:o}},an=async e=>{await Ut(Gt(e),{recursive:!0})},cn=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 i=await r.text();throw new Error(`API request failed (${r.status}): ${i}`)}let s=await r.json();if(!s.translation)throw new Error("API response did not include a translation");return s.translation},dn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),s=await cn(t,r,e.locale);await an(e.targetFile),await Lt(e.targetFile,s,"utf8"),n.entries[Fe(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},De=async(e,t)=>{Vt("Translate MDX content");let n=e??zt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",s=Zt(t.config??qt),i=await tn(n);i.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),G("Translation cancelled"),process.exit(1)),I.info(`Found ${i.length} MDX file(s) matching pattern`),s.length===0&&(s=await en());let o=j(process.cwd(),ee),a=await nn();await Me(a),I.info(`Using cache: ${o}`);let d=await rn(i),{tasks:c,skippedCount:u}=on(s,i,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),G(`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=Ht();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await dn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Re(process.cwd(),x.targetFile)}`)})),await Me(a);m.stop("Translation complete!"),G(`Created/updated ${c.length} file(s)`)};import{access as ln,copyFile as pn,mkdir as $e,rm as re}from"fs/promises";import{dirname as un,join as P}from"path";import{intro as gn,log as w,outro as V,spinner as Ne}from"@clack/prompts";import{glob as mn}from"glob";var fn=["**/*"],hn=["content/docs/**"],te=".geistdocs-tmp",wn=async(e,t)=>{let n=P(e,t);await re(n,{recursive:!0,force:!0}),await $e(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),ke=async(e,t,n)=>(await mn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),yn=async e=>{try{return await ln(e),!0}catch{return!1}},xn=async(e,t,n)=>{let r=P(t,e),s=P(n,e);return await yn(r)?(await pn(r,s),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},En=async(e,t)=>{let n=P(t,e);return await re(n,{force:!0}),{success:!0}},Ce=20,Oe=async(e,t,n)=>{let r=[];for(let s=0;s<e.length;s+=n){let i=e.slice(s,s+n),o=await Promise.all(i.map(t));r.push(...o)}return r},Sn=async(e,t,n,r,s)=>{let i={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>un(P(r,d))))];s.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>$e(d,{recursive:!0}))),s.message(`Updating ${e.length} files...`);let a=await Oe(e,async d=>{let c=await xn(d,n,r);return{file:d,...c}},Ce);for(let{file:d,success:c,error:u}of a)c?i.success.push(d):i.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){s.message(`Deleting ${t.length} files...`);let d=await Oe(t,async c=>{try{return await En(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Ce);for(let c of d)c.success?i.deleted.push(c.file):i.failed.push({file:c.file,error:c.error})}return i},bn=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}`)}},_n=e=>e.includes("canary")?"canary":"latest",Tn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(b)}`);if(!t.ok)throw new Error(`Failed to resolve ${b}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${b}`);return r},In=async e=>{let t=await M(e),n=J(t,b);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=_n(n),s=await Tn(r);return n===s?{currentVersion:n,nextVersion:s,updateTag:r,updated:!1}:($(t,b,s),await O(e,t),{currentVersion:n,nextVersion:s,updateTag:r,updated:!0})},Pn=async(e,t,n)=>{let r=await M(e);if(!le(r,b))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:s,nextVersion:i,updateTag:o,updated:a}=await In(e);if(!a)return w.success(s?`@vercel/geistdocs is already at ${i} (${o}).`:"No package version update was needed."),V("Package-based site is already up to date."),!0;w.info(`Bumping ${b} from ${s} to ${i} (${o})`);let d=Ne();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),V("Please review and test the upgraded package version."),!0},vn=async(e,t,n,r,s)=>{let i=P(e,te),o=Ne(),a=s?.sync?i:t;o.start("Preparing template snapshot..."),s?.sync&&(await wn(e,te),await N(i)),o.message("Scanning for files...");let d=await ke(n,r,a),c=[];if(s?.sync){o.message("Comparing with local files...");let l=await ke(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."),s?.sync&&await ne(i),V("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),s?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await Sn(d,c,a,e,o);s?.sync&&(o.message("Cleaning up..."),await ne(i)),o.stop("Update complete!"),bn(u),V("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),s=e&&e.length>0?e:fn,i=e&&e.length>0?[]:hn;try{if(gn("Let's update your Geistdocs project!"),await Pn(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 vn(n,r,s,i,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(P(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.2.1","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(fe);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(De);var An=A.command("search").description("Manage the external search index used by Ask AI");An.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});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
export type NativeDocsLinkProps = ComponentProps<"a">;
|
|
3
|
+
/** A styled anchor for links that must use browser-native navigation. */
|
|
4
|
+
export declare const NativeDocsLink: ({ className, ...props }: NativeDocsLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAEtD,yEAAyE;AACzE,eAAO,MAAM,cAAc,GAAI,yBAG5B,mBAAmB,4CAErB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getDocsLinkClassName } from "../internal/docs-link-class-name.js";
|
|
3
|
+
/** A styled anchor for links that must use browser-native navigation. */
|
|
4
|
+
export const NativeDocsLink = ({ className, ...props }) => (_jsx("a", { ...props, className: getDocsLinkClassName(className) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-link-class-name.d.ts","sourceRoot":"","sources":["../../src/internal/docs-link-class-name.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,GAAI,YAAY,MAAM,WAClB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { cn } from "#geistdocs-ui/utils";
|
|
2
|
+
const DOCS_LINK_CLASS_NAME = "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!";
|
|
3
|
+
export const getDocsLinkClassName = (className) => cn(DOCS_LINK_CLASS_NAME, className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,yBAAyB,EAEzB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAQtB,UAAU,eAAe;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,gBAAgB,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA6PD,eAAO,MAAM,UAAU,GAAI,0DAMxB,eAAe,
|
|
1
|
+
{"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,yBAAyB,EAEzB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAQtB,UAAU,eAAe;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,gBAAgB,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA6PD,eAAO,MAAM,UAAU,GAAI,0DAMxB,eAAe,4CA0HjB,CAAC"}
|
|
@@ -106,9 +106,7 @@ export const MobileMenu = ({ activeProduct, githubUrl, nav, ossProducts, showOss
|
|
|
106
106
|
};
|
|
107
107
|
}, [show]);
|
|
108
108
|
const close = () => setShow(false);
|
|
109
|
-
return (_jsxs(_Fragment, { children: [_jsx(MobileMenuButton, { expanded: show, onClick: () => setShow(!show) }), _jsx("div", { className: cn("fixed inset-0 top-16 z-40 @min-[1024px]:hidden bg-background-200
|
|
109
|
+
return (_jsxs(_Fragment, { children: [_jsx(MobileMenuButton, { expanded: show, onClick: () => setShow(!show) }), _jsx("div", { className: cn("fixed inset-0 top-16 z-40 @min-[1024px]:hidden bg-background-200", show
|
|
110
110
|
? "pointer-events-auto opacity-100"
|
|
111
|
-
: "pointer-events-none opacity-0"), onClick: close }), _jsxs("div", { className: cn("fixed inset-x-0 top-16 bottom-0 z-40 @min-[1024px]:hidden overflow-y-auto bg-background-200 px-2
|
|
112
|
-
? "translate-y-0 opacity-100"
|
|
113
|
-
: "pointer-events-none -translate-y-2 opacity-0"), children: [_jsx("div", { className: "p-4", children: _jsx(SearchButton, { className: "w-full py-4.5", onClick: close }) }), _jsxs("nav", { className: "flex flex-col px-1", children: [nav.map((item) => "items" in item ? (_jsx(NavDropdownCollapsible, { dropdown: item, onLinkClick: close }, item.label)) : (_jsx(NavLink, { active: isActive(item.href), external: item.href.startsWith("http"), href: item.href, onClick: close, children: item.label }, item.href))), githubUrl ? (_jsx(NavLink, { external: true, href: githubUrl, onClick: close, children: "GitHub" })) : null, _jsx(OssCollapsible, { onLinkClick: close, sections: ossSections })] }), _jsx("div", { className: "mt-2 flex justify-end px-4 py-4", children: _jsx(ThemeSwitcher, { small: true }) })] })] }));
|
|
111
|
+
: "pointer-events-none opacity-0"), onClick: close }), _jsxs("div", { className: cn("fixed inset-x-0 top-16 bottom-0 z-40 @min-[1024px]:hidden overflow-y-auto bg-background-200 px-2", show ? "opacity-100" : "pointer-events-none opacity-0"), children: [_jsx("div", { className: "p-4", children: _jsx(SearchButton, { className: "w-full py-4.5", onClick: close }) }), _jsxs("nav", { className: "flex flex-col px-1", children: [nav.map((item) => "items" in item ? (_jsx(NavDropdownCollapsible, { dropdown: item, onLinkClick: close }, item.label)) : (_jsx(NavLink, { active: isActive(item.href), external: item.href.startsWith("http"), href: item.href, onClick: close, children: item.label }, item.href))), githubUrl ? (_jsx(NavLink, { external: true, href: githubUrl, onClick: close, children: "GitHub" })) : null, _jsx(OssCollapsible, { onLinkClick: close, sections: ossSections })] }), _jsx("div", { className: "mt-2 flex justify-end px-4 py-4", children: _jsx(ThemeSwitcher, { small: true }) })] })] }));
|
|
114
112
|
};
|
package/dist/pages/docs.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { DocsPage as FumadocsDocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
|
2
2
|
import type { MDXComponents } from "mdx/types";
|
|
3
3
|
import type { Metadata } from "next";
|
|
4
4
|
import { type ComponentProps, type ComponentType, type ReactNode } from "react";
|
|
5
|
+
import { NativeDocsLink } from "../components/link";
|
|
5
6
|
import { type GeistdocsConfig } from "../config";
|
|
6
7
|
import { type GeistdocsPageVisibilityData } from "../page-visibility";
|
|
7
8
|
import type { GeistdocsSourceBundle } from "../source";
|
|
@@ -80,6 +81,7 @@ export interface CreateDocsPageOptions<Params extends DocsPageParams = DocsPageP
|
|
|
80
81
|
}) => ReactNode;
|
|
81
82
|
resolveLink?: (context: {
|
|
82
83
|
link: DocsPageLink;
|
|
84
|
+
nativeLink: typeof NativeDocsLink;
|
|
83
85
|
page: GeistdocsPage;
|
|
84
86
|
source: SourceBundle;
|
|
85
87
|
}) => DocsPageLink;
|
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":"AACA,OAAO,EAGL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,O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AM,CAAC;KAChB,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,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,aAAa,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;KACvB,KAAK,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE;QACtB,IAAI,EAAE,YAAY,CAAC;QACnB,UAAU,EAAE,OAAO,cAAc,CAAC;QAClC,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,YAAY,CAAC;KACtB,KAAK,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,qBAAqB,CAAC,EAAE,cAAc,CACpC,OAAO,gBAAgB,CACxB,CAAC,uBAAuB,CAAC,CAAC;CAC5B;AAgDD,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,cAAc,GAAG,cAAc,EAAE,0MAgB5E,qBAAqB,CAAC,MAAM,CAAC;uBAsOJ;QAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE;0BAtKlB,MAAM;;oCAoLtC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,KAAG,OAAO,CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
|
package/dist/pages/docs.js
CHANGED
|
@@ -5,7 +5,9 @@ import { createRelativeLink } from "fumadocs-ui/mdx";
|
|
|
5
5
|
import { notFound } from "next/navigation";
|
|
6
6
|
import { cache, } from "react";
|
|
7
7
|
import { cn } from "#geistdocs-ui/utils";
|
|
8
|
+
import { NativeDocsLink } from "../components/link";
|
|
8
9
|
import { getPublicPath, withBasePath } from "../config";
|
|
10
|
+
import { getDocsLinkClassName } from "../internal/docs-link-class-name";
|
|
9
11
|
import { DocsPageErrorBoundary } from "../internal/docs-page-error-boundary";
|
|
10
12
|
import { resolveDocumentTitle } from "../internal/document-title";
|
|
11
13
|
import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
|
|
@@ -24,7 +26,7 @@ const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href
|
|
|
24
26
|
const linkHref = resolved.href === originalHref
|
|
25
27
|
? resolved.href
|
|
26
28
|
: stripBasePathFromHref(resolved.href, basePath);
|
|
27
|
-
return (_jsx(Link, { ...props, className:
|
|
29
|
+
return (_jsx(Link, { ...props, className: getDocsLinkClassName(className), href: linkHref, prefetch: !resolved.external, rel: resolved.external ? rel : undefined, target: resolved.external ? target : undefined, children: children }));
|
|
28
30
|
};
|
|
29
31
|
export const resolvePageMarkdownUrl = (options) => resolveInternalPageMarkdownUrl(options);
|
|
30
32
|
const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { className: cn("mb-4 text-balance", className), ...props }));
|
|
@@ -90,7 +92,12 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
|
|
|
90
92
|
const MDX = data.body;
|
|
91
93
|
const defaultLink = createRelativeLink(source.source, page, DocsLink);
|
|
92
94
|
const link = resolveLink
|
|
93
|
-
? resolveLink({
|
|
95
|
+
? resolveLink({
|
|
96
|
+
link: defaultLink,
|
|
97
|
+
nativeLink: NativeDocsLink,
|
|
98
|
+
page,
|
|
99
|
+
source,
|
|
100
|
+
})
|
|
94
101
|
: defaultLink;
|
|
95
102
|
const resolvedMdx = typeof mdx === "function" ? mdx({ link, page, source }) : mdx;
|
|
96
103
|
const { markdownUrl, pageUrl, publicPageUrl } = resolvePageUrls(page, resolvedParams);
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.1
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.2.1 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
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Documentation
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.1.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.2.1.
|
|
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
|
|
@@ -156,6 +156,14 @@ related:
|
|
|
156
156
|
|
|
157
157
|
Create a new Geistdocs site with the package CLI, then customize its identity, content, and navigation. If you already have a documentation site, use [Migrate to Geistdocs](/docs/migration). Read [Choose a Geistdocs package](/docs/packages) before using the private package.
|
|
158
158
|
|
|
159
|
+
> Note:
|
|
160
|
+
Use `@vercel/geistdocs-private` only for Vercel-internal applications that
|
|
161
|
+
are not open source and already restrict npm access to authorized Vercel
|
|
162
|
+
users, such as `next-site` or `vercel-docs`. Vercel-owned OSS repositories,
|
|
163
|
+
repositories with external contributors, and all other projects must use the
|
|
164
|
+
public `@vercel/geistdocs` package. See
|
|
165
|
+
[Choose a Geistdocs package](/docs/packages) for the full comparison.
|
|
166
|
+
|
|
159
167
|
Create a new Geistdocs project with `pnpm dlx @vercel/geistdocs@latest init --name my-docs`. Confirm the prerequisites, run `pnpm dev`, and help me customize `geistdocs.tsx`, `content/docs/index.mdx`, and `content/docs/meta.json`. Keep the generated integrations package-backed.
|
|
160
168
|
|
|
161
169
|
## Prerequisites
|
|
@@ -1020,7 +1028,11 @@ related:
|
|
|
1020
1028
|
Geistdocs ships as two packages built from the same runtime and template. They expose the same API and intentionally share the same visual design, layout, interactions, and product behavior. A site should look and work the same with either package; only the underlying primitive and asset provider differs.
|
|
1021
1029
|
|
|
1022
1030
|
> Note:
|
|
1023
|
-
`@vercel/geistdocs-private`
|
|
1031
|
+
`@vercel/geistdocs-private` uses restricted Geistcn components and assets
|
|
1032
|
+
intended only for internal, non-OSS applications. Vercel-owned OSS
|
|
1033
|
+
repositories and projects with external contributors must use
|
|
1034
|
+
`@vercel/geistdocs`. Do not expose the private package, its dependencies,
|
|
1035
|
+
credentials, or downloaded assets outside authorized internal environments.
|
|
1024
1036
|
|
|
1025
1037
|
| Package | Access | UI provider | Recommended use |
|
|
1026
1038
|
| --- | --- | --- | --- |
|
|
@@ -1047,7 +1059,7 @@ pnpm dlx @vercel/geistdocs-private@latest init --name my-docs
|
|
|
1047
1059
|
|
|
1048
1060
|
The private initializer asks whether the generated template will be used in a public repository. Answer **Yes** to generate the public `@vercel/geistdocs` variant without restricted dependencies. Answer **No** to keep `@vercel/geistdocs-private`.
|
|
1049
1061
|
|
|
1050
|
-
The private
|
|
1062
|
+
The generated private template installs `@vercel/geistcn` and `@vercel/geistcn-assets` directly. Both local development and deployment must be authenticated to Vercel's private npm registry. This makes it suitable only for internal environments such as `front`, where that access already exists and remains limited to authorized Vercel users.
|
|
1051
1063
|
|
|
1052
1064
|
Do not use the private package in a public repository or provide its registry access to external contributors. Use the public package whenever anyone outside Vercel needs to install, build, or contribute to the project—even if the site itself is deployed on Vercel.
|
|
1053
1065
|
|
|
@@ -1704,6 +1716,32 @@ This renders as:
|
|
|
1704
1716
|
|
|
1705
1717
|
Run independent requests in parallel with [`Promise.all`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise/all).
|
|
1706
1718
|
|
|
1719
|
+
#### Force browser-native navigation
|
|
1720
|
+
|
|
1721
|
+
Normal internal links use Next.js navigation, while external links disable
|
|
1722
|
+
prefetching automatically. A custom `createDocsPage` link resolver also
|
|
1723
|
+
receives `nativeLink` for URLs that must always use a regular `<a>`, such as a
|
|
1724
|
+
raw Markdown file or a production URL that should not be localized into a
|
|
1725
|
+
preview deployment. It keeps the same Geistdocs link styling:
|
|
1726
|
+
|
|
1727
|
+
```tsx
|
|
1728
|
+
const docsPage = createDocsPage({
|
|
1729
|
+
config,
|
|
1730
|
+
source,
|
|
1731
|
+
resolveLink: ({ link: Link, nativeLink: NativeLink }) =>
|
|
1732
|
+
function ResolvedLink(props) {
|
|
1733
|
+
const native =
|
|
1734
|
+
props.href?.endsWith(".md") ||
|
|
1735
|
+
props.href?.startsWith("https://example.com");
|
|
1736
|
+
|
|
1737
|
+
return native ? <NativeLink {...props} /> : <Link {...props} />;
|
|
1738
|
+
},
|
|
1739
|
+
});
|
|
1740
|
+
```
|
|
1741
|
+
|
|
1742
|
+
`NativeDocsLink` is also exported from the selected package's
|
|
1743
|
+
`components/link` subpath for use outside `createDocsPage`.
|
|
1744
|
+
|
|
1707
1745
|
### Images
|
|
1708
1746
|
|
|
1709
1747
|
Add images with ``:
|
package/docs/manifest.json
CHANGED
|
@@ -16,6 +16,14 @@ related:
|
|
|
16
16
|
|
|
17
17
|
Create a new Geistdocs site with the package CLI, then customize its identity, content, and navigation. If you already have a documentation site, use [Migrate to Geistdocs](/docs/migration). Read [Choose a Geistdocs package](/docs/packages) before using the private package.
|
|
18
18
|
|
|
19
|
+
> Note:
|
|
20
|
+
Use `@vercel/geistdocs-private` only for Vercel-internal applications that
|
|
21
|
+
are not open source and already restrict npm access to authorized Vercel
|
|
22
|
+
users, such as `next-site` or `vercel-docs`. Vercel-owned OSS repositories,
|
|
23
|
+
repositories with external contributors, and all other projects must use the
|
|
24
|
+
public `@vercel/geistdocs` package. See
|
|
25
|
+
[Choose a Geistdocs package](/docs/packages) for the full comparison.
|
|
26
|
+
|
|
19
27
|
Create a new Geistdocs project with `pnpm dlx @vercel/geistdocs@latest init --name my-docs`. Confirm the prerequisites, run `pnpm dev`, and help me customize `geistdocs.tsx`, `content/docs/index.mdx`, and `content/docs/meta.json`. Keep the generated integrations package-backed.
|
|
20
28
|
|
|
21
29
|
## Prerequisites
|
package/docs/pages/packages.md
CHANGED
|
@@ -16,7 +16,11 @@ related:
|
|
|
16
16
|
Geistdocs ships as two packages built from the same runtime and template. They expose the same API and intentionally share the same visual design, layout, interactions, and product behavior. A site should look and work the same with either package; only the underlying primitive and asset provider differs.
|
|
17
17
|
|
|
18
18
|
> Note:
|
|
19
|
-
`@vercel/geistdocs-private`
|
|
19
|
+
`@vercel/geistdocs-private` uses restricted Geistcn components and assets
|
|
20
|
+
intended only for internal, non-OSS applications. Vercel-owned OSS
|
|
21
|
+
repositories and projects with external contributors must use
|
|
22
|
+
`@vercel/geistdocs`. Do not expose the private package, its dependencies,
|
|
23
|
+
credentials, or downloaded assets outside authorized internal environments.
|
|
20
24
|
|
|
21
25
|
| Package | Access | UI provider | Recommended use |
|
|
22
26
|
| --- | --- | --- | --- |
|
|
@@ -43,7 +47,7 @@ pnpm dlx @vercel/geistdocs-private@latest init --name my-docs
|
|
|
43
47
|
|
|
44
48
|
The private initializer asks whether the generated template will be used in a public repository. Answer **Yes** to generate the public `@vercel/geistdocs` variant without restricted dependencies. Answer **No** to keep `@vercel/geistdocs-private`.
|
|
45
49
|
|
|
46
|
-
The private
|
|
50
|
+
The generated private template installs `@vercel/geistcn` and `@vercel/geistcn-assets` directly. Both local development and deployment must be authenticated to Vercel's private npm registry. This makes it suitable only for internal environments such as `front`, where that access already exists and remains limited to authorized Vercel users.
|
|
47
51
|
|
|
48
52
|
Do not use the private package in a public repository or provide its registry access to external contributors. Use the public package whenever anyone outside Vercel needs to install, build, or contribute to the project—even if the site itself is deployed on Vercel.
|
|
49
53
|
|
package/docs/pages/syntax.md
CHANGED
|
@@ -207,6 +207,32 @@ This renders as:
|
|
|
207
207
|
|
|
208
208
|
Run independent requests in parallel with [`Promise.all`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise/all).
|
|
209
209
|
|
|
210
|
+
#### Force browser-native navigation
|
|
211
|
+
|
|
212
|
+
Normal internal links use Next.js navigation, while external links disable
|
|
213
|
+
prefetching automatically. A custom `createDocsPage` link resolver also
|
|
214
|
+
receives `nativeLink` for URLs that must always use a regular `<a>`, such as a
|
|
215
|
+
raw Markdown file or a production URL that should not be localized into a
|
|
216
|
+
preview deployment. It keeps the same Geistdocs link styling:
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
const docsPage = createDocsPage({
|
|
220
|
+
config,
|
|
221
|
+
source,
|
|
222
|
+
resolveLink: ({ link: Link, nativeLink: NativeLink }) =>
|
|
223
|
+
function ResolvedLink(props) {
|
|
224
|
+
const native =
|
|
225
|
+
props.href?.endsWith(".md") ||
|
|
226
|
+
props.href?.startsWith("https://example.com");
|
|
227
|
+
|
|
228
|
+
return native ? <NativeLink {...props} /> : <Link {...props} />;
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
`NativeDocsLink` is also exported from the selected package's
|
|
234
|
+
`components/link` subpath for use outside `createDocsPage`.
|
|
235
|
+
|
|
210
236
|
### Images
|
|
211
237
|
|
|
212
238
|
Add images with ``:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/geistdocs",
|
|
3
3
|
"description": "Runtime and CLI for Geistdocs projects.",
|
|
4
|
-
"version": "2.1
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -202,6 +202,10 @@
|
|
|
202
202
|
"types": "./dist/components/image.d.ts",
|
|
203
203
|
"default": "./dist/components/image.js"
|
|
204
204
|
},
|
|
205
|
+
"./components/link": {
|
|
206
|
+
"types": "./dist/components/link.d.ts",
|
|
207
|
+
"default": "./dist/components/link.js"
|
|
208
|
+
},
|
|
205
209
|
"./components/dropdown-menu": {
|
|
206
210
|
"types": "./dist/components/dropdown-menu.d.ts",
|
|
207
211
|
"default": "./dist/components/dropdown-menu.js"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* Provider foundation
|
|
2
|
-
|
|
1
|
+
/* Provider foundation and Geistdocs theme rules are package-owned. The private
|
|
2
|
+
package build adds its consumer-source registration after this import. */
|
|
3
3
|
@import "@vercel/geistdocs/styles.css";
|
|
4
4
|
|
|
5
5
|
:root {
|
|
@@ -12,6 +12,15 @@ related:
|
|
|
12
12
|
|
|
13
13
|
Create a new Geistdocs site with the package CLI, then customize its identity, content, and navigation. If you already have a documentation site, use [Migrate to Geistdocs](/docs/migration). Read [Choose a Geistdocs package](/docs/packages) before using the private package.
|
|
14
14
|
|
|
15
|
+
<Callout title="Use Geistdocs Private only for internal, non-OSS apps">
|
|
16
|
+
Use `@vercel/geistdocs-private` only for Vercel-internal applications that
|
|
17
|
+
are not open source and already restrict npm access to authorized Vercel
|
|
18
|
+
users, such as `next-site` or `vercel-docs`. Vercel-owned OSS repositories,
|
|
19
|
+
repositories with external contributors, and all other projects must use the
|
|
20
|
+
public `@vercel/geistdocs` package. See
|
|
21
|
+
[Choose a Geistdocs package](/docs/packages) for the full comparison.
|
|
22
|
+
</Callout>
|
|
23
|
+
|
|
15
24
|
<CopyPrompt text="Create a new Geistdocs project with pnpm dlx @vercel/geistdocs@latest init --name my-docs. Confirm Node.js 20.9 or later, pnpm, and Git are available first. Then run pnpm dev and help me customize geistdocs.tsx, content/docs/index.mdx, and content/docs/meta.json. Keep the generated route, source, UI provider, and Next.js integrations package-backed.">
|
|
16
25
|
Create a new Geistdocs project with `pnpm dlx @vercel/geistdocs@latest init --name my-docs`. Confirm the prerequisites, run `pnpm dev`, and help me customize `geistdocs.tsx`, `content/docs/index.mdx`, and `content/docs/meta.json`. Keep the generated integrations package-backed.
|
|
17
26
|
</CopyPrompt>
|
|
@@ -14,7 +14,11 @@ related:
|
|
|
14
14
|
Geistdocs ships as two packages built from the same runtime and template. They expose the same API and intentionally share the same visual design, layout, interactions, and product behavior. A site should look and work the same with either package; only the underlying primitive and asset provider differs.
|
|
15
15
|
|
|
16
16
|
<Callout title="Geistdocs Private uses restricted packages">
|
|
17
|
-
`@vercel/geistdocs-private`
|
|
17
|
+
`@vercel/geistdocs-private` uses restricted Geistcn components and assets
|
|
18
|
+
intended only for internal, non-OSS applications. Vercel-owned OSS
|
|
19
|
+
repositories and projects with external contributors must use
|
|
20
|
+
`@vercel/geistdocs`. Do not expose the private package, its dependencies,
|
|
21
|
+
credentials, or downloaded assets outside authorized internal environments.
|
|
18
22
|
</Callout>
|
|
19
23
|
|
|
20
24
|
| Package | Access | UI provider | Recommended use |
|
|
@@ -42,7 +46,7 @@ pnpm dlx @vercel/geistdocs-private@latest init --name my-docs
|
|
|
42
46
|
|
|
43
47
|
The private initializer asks whether the generated template will be used in a public repository. Answer **Yes** to generate the public `@vercel/geistdocs` variant without restricted dependencies. Answer **No** to keep `@vercel/geistdocs-private`.
|
|
44
48
|
|
|
45
|
-
The private
|
|
49
|
+
The generated private template installs `@vercel/geistcn` and `@vercel/geistcn-assets` directly. Both local development and deployment must be authenticated to Vercel's private npm registry. This makes it suitable only for internal environments such as `front`, where that access already exists and remains limited to authorized Vercel users.
|
|
46
50
|
|
|
47
51
|
Do not use the private package in a public repository or provide its registry access to external contributors. Use the public package whenever anyone outside Vercel needs to install, build, or contribute to the project—even if the site itself is deployed on Vercel.
|
|
48
52
|
|
|
@@ -211,6 +211,32 @@ This renders as:
|
|
|
211
211
|
|
|
212
212
|
Run independent requests in parallel with [`Promise.all`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise/all).
|
|
213
213
|
|
|
214
|
+
#### Force browser-native navigation
|
|
215
|
+
|
|
216
|
+
Normal internal links use Next.js navigation, while external links disable
|
|
217
|
+
prefetching automatically. A custom `createDocsPage` link resolver also
|
|
218
|
+
receives `nativeLink` for URLs that must always use a regular `<a>`, such as a
|
|
219
|
+
raw Markdown file or a production URL that should not be localized into a
|
|
220
|
+
preview deployment. It keeps the same Geistdocs link styling:
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
const docsPage = createDocsPage({
|
|
224
|
+
config,
|
|
225
|
+
source,
|
|
226
|
+
resolveLink: ({ link: Link, nativeLink: NativeLink }) =>
|
|
227
|
+
function ResolvedLink(props) {
|
|
228
|
+
const native =
|
|
229
|
+
props.href?.endsWith(".md") ||
|
|
230
|
+
props.href?.startsWith("https://example.com");
|
|
231
|
+
|
|
232
|
+
return native ? <NativeLink {...props} /> : <Link {...props} />;
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
`NativeDocsLink` is also exported from the selected package's
|
|
238
|
+
`components/link` subpath for use outside `createDocsPage`.
|
|
239
|
+
|
|
214
240
|
### Images
|
|
215
241
|
|
|
216
242
|
Add images with ``:
|
package/template/package.json
CHANGED