boltdocs 1.11.0 → 2.1.0

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +21 -0
  3. package/bin/boltdocs.js +12 -0
  4. package/dist/cache-Q4T6VAUL.mjs +1 -0
  5. package/dist/chunk-52MVMZWS.mjs +1 -0
  6. package/dist/chunk-BVWWKXJH.mjs +1 -0
  7. package/dist/chunk-DVY3RDXD.mjs +1 -0
  8. package/dist/chunk-FUVYCYWC.mjs +1 -0
  9. package/dist/chunk-GBLMDJ2B.mjs +1 -0
  10. package/dist/chunk-ISPX45DF.mjs +1 -0
  11. package/dist/chunk-PNXZMUCO.mjs +1 -0
  12. package/dist/chunk-V2ZHKQSP.mjs +74 -0
  13. package/dist/client/components/mdx/index.d.mts +208 -0
  14. package/dist/client/components/mdx/index.d.ts +208 -0
  15. package/dist/client/components/mdx/index.js +1 -0
  16. package/dist/client/components/mdx/index.mjs +1 -0
  17. package/dist/client/hooks/index.d.mts +132 -0
  18. package/dist/client/hooks/index.d.ts +132 -0
  19. package/dist/client/hooks/index.js +1 -0
  20. package/dist/client/hooks/index.mjs +1 -0
  21. package/dist/client/index.d.mts +210 -0
  22. package/dist/client/index.d.ts +210 -0
  23. package/dist/client/index.js +1 -0
  24. package/dist/client/index.mjs +1 -0
  25. package/dist/client/ssr.d.mts +78 -0
  26. package/dist/client/ssr.d.ts +78 -0
  27. package/dist/client/ssr.js +1 -0
  28. package/dist/client/ssr.mjs +1 -0
  29. package/dist/node/cli-entry.d.mts +1 -0
  30. package/dist/node/cli-entry.d.ts +1 -0
  31. package/dist/node/cli-entry.js +75 -0
  32. package/dist/node/cli-entry.mjs +2 -0
  33. package/dist/node/index.d.mts +298 -0
  34. package/dist/node/index.d.ts +298 -0
  35. package/dist/node/index.js +74 -0
  36. package/dist/node/index.mjs +1 -0
  37. package/dist/search-dialog-TWGYKF2D.mjs +1 -0
  38. package/dist/types-Cp21DHI6.d.mts +355 -0
  39. package/dist/types-Cp21DHI6.d.ts +355 -0
  40. package/dist/use-routes-8Iei6jTp.d.mts +29 -0
  41. package/dist/use-routes-xLhumjbV.d.ts +29 -0
  42. package/package.json +16 -10
  43. package/src/client/app/index.tsx +9 -6
  44. package/src/client/components/ui-base/breadcrumbs.tsx +2 -1
  45. package/src/client/components/ui-base/navbar.tsx +3 -3
  46. package/src/client/components/ui-base/sidebar.tsx +2 -1
  47. package/src/client/hooks/use-navbar.ts +1 -1
  48. package/src/client/types.ts +1 -1
  49. package/src/node/cli-entry.ts +24 -0
  50. package/src/node/cli.ts +59 -0
  51. package/src/node/config.ts +63 -11
  52. package/src/node/index.ts +39 -3
  53. package/src/node/plugin/entry.ts +7 -0
  54. package/src/node/plugin/html.ts +49 -9
  55. package/src/node/plugin/index.ts +42 -4
  56. package/src/node/routes/parser.ts +27 -32
  57. package/src/node/ssg/index.ts +35 -4
  58. package/src/node/ssg/robots.ts +50 -0
  59. package/src/node/utils.ts +23 -0
  60. package/tsup.config.ts +36 -10
@@ -0,0 +1,74 @@
1
+ "use strict";var we=Object.create;var Q=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var gt=(o,t)=>()=>(o&&(t=o(o=0)),t);var Ft=(o,t)=>{for(var e in t)Q(o,e,{get:t[e],enumerable:!0})},It=(o,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Se(t))!Be.call(o,i)&&i!==e&&Q(o,i,{get:()=>t[i],enumerable:!(s=$e(t,i))||s.enumerable});return o};var y=(o,t,e)=>(e=o!=null?we(De(o)):{},It(t||!o||!o.__esModule?Q(e,"default",{value:o,enumerable:!0}):e,o)),Re=o=>It(Q({},"__esModule",{value:!0}),o);var Me,C,g=gt(()=>{"use strict";Me=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,C=Me()});function R(o){return o.replace(/\\/g,"/")}function U(o){return o.replace(/^\d+\./,"")}function Y(o){let t=o.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function jt(o){return/\.mdx?$/.test(o)}function tt(o){try{return ft.default.statSync(o).mtimeMs}catch{return 0}}function Ht(o){let t=ft.default.readFileSync(o,"utf-8"),{data:e,content:s}=(0,Et.default)(t);return{data:e,content:s}}function E(o){return o.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yt(o){return E(o)}function Lt(o){let e=o.split("/").map(U).join("/").replace(/\/$/,"");return e=e.replace(/\.mdx?$/,""),(e==="index"||e.endsWith("/index"))&&(e=e.replace(/index$/,"")),e.startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e}function G(o){return ht.default.sanitize(o)}function xt(o){return ht.default.sanitize(o,{ALLOWED_TAGS:[],KEEP_CONTENT:!0})}function q(o){return o.charAt(0).toUpperCase()+o.slice(1)}var ft,Et,ht,k=gt(()=>{"use strict";g();ft=y(require("fs")),Et=y(require("gray-matter")),ht=y(require("isomorphic-dompurify"))});var $t={};Ft($t,{AssetCache:()=>Pt,FileCache:()=>V,TransformCache:()=>W,flushCache:()=>Ie});async function Ie(){await O.flush()}var w,S,z,L,A,et,ke,ot,Ct,Ze,wt,Te,_e,Oe,Fe,bt,vt,O,V,W,Pt,K=gt(()=>{"use strict";g();w=y(require("fs")),S=y(require("path")),z=y(require("crypto")),L=y(require("zlib")),A=require("util");k();et=(0,A.promisify)(w.default.writeFile),ke=(0,A.promisify)(w.default.readFile),ot=(0,A.promisify)(w.default.mkdir),Ct=(0,A.promisify)(w.default.rename),Ze=(0,A.promisify)(w.default.unlink),wt=process.env.BOLTDOCS_CACHE_DIR||".boltdocs",Te="assets",_e="shards",Oe=parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||"2000",10),Fe=process.env.BOLTDOCS_CACHE_COMPRESS!=="0",bt=class{constructor(t){this.limit=t}cache=new Map;get(t){let e=this.cache.get(t);return e!==void 0&&(this.cache.delete(t),this.cache.set(t,e)),e}set(t,e){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.limit){let s=this.cache.keys().next().value;s!==void 0&&this.cache.delete(s)}this.cache.set(t,e)}get size(){return this.cache.size}clear(){this.cache.clear()}},vt=class{queue=Promise.resolve();pendingCount=0;add(t){this.pendingCount++,this.queue=this.queue.then(t).finally(()=>{this.pendingCount--})}async flush(){await this.queue}get pending(){return this.pendingCount}},O=new vt,V=class{entries=new Map;cachePath=null;compress;constructor(t={}){if(this.compress=t.compress!==void 0?t.compress:Fe,t.name){let e=t.root||process.cwd(),s=this.compress?"json.gz":"json";this.cachePath=S.default.resolve(e,wt,`${t.name}.${s}`)}}load(){if(process.env.BOLTDOCS_NO_CACHE!=="1"&&!(!this.cachePath||!w.default.existsSync(this.cachePath)))try{let t=w.default.readFileSync(this.cachePath);this.cachePath.endsWith(".gz")&&(t=L.default.gunzipSync(t));let e=JSON.parse(t.toString("utf-8"));this.entries=new Map(Object.entries(e))}catch{}}save(){if(process.env.BOLTDOCS_NO_CACHE==="1"||!this.cachePath)return;let t=Object.fromEntries(this.entries),e=JSON.stringify(t),s=this.cachePath,i=this.compress;O.add(async()=>{try{await ot(S.default.dirname(s),{recursive:!0});let r=Buffer.from(e);i&&(r=L.default.gzipSync(r));let a=`${s}.${z.default.randomBytes(4).toString("hex")}.tmp`;await et(a,r),await Ct(a,s)}catch{}})}get(t){let e=this.entries.get(t);return!e||tt(t)!==e.mtime?null:e.data}set(t,e){this.entries.set(t,{data:e,mtime:tt(t)})}isValid(t){let e=this.entries.get(t);return e?tt(t)===e.mtime:!1}invalidate(t){this.entries.delete(t)}invalidateAll(){this.entries.clear()}pruneStale(t){for(let e of this.entries.keys())t.has(e)||this.entries.delete(e)}get size(){return this.entries.size}async flush(){await O.flush()}},W=class{index=new Map;memoryCache=new bt(Oe);baseDir;shardsDir;indexPath;constructor(t,e=process.cwd()){this.baseDir=S.default.resolve(e,wt,`transform-${t}`),this.shardsDir=S.default.resolve(this.baseDir,_e),this.indexPath=S.default.resolve(this.baseDir,"index.json")}load(){if(process.env.BOLTDOCS_NO_CACHE!=="1"&&w.default.existsSync(this.indexPath))try{let t=w.default.readFileSync(this.indexPath,"utf-8");this.index=new Map(Object.entries(JSON.parse(t)))}catch{}}save(){if(process.env.BOLTDOCS_NO_CACHE==="1")return;let t=JSON.stringify(Object.fromEntries(this.index)),e=this.indexPath;O.add(async()=>{await ot(S.default.dirname(e),{recursive:!0}),await et(e,t)})}async getMany(t){let e=new Map,s=[];for(let i of t){let r=this.memoryCache.get(i);r?e.set(i,r):this.index.has(i)&&s.push(i)}if(s.length>0){let i=await Promise.all(s.map(async r=>{let a=this.index.get(r),p=S.default.resolve(this.shardsDir,`${a}.gz`);try{let n=await ke(p),c=L.default.gunzipSync(n).toString("utf-8");return this.memoryCache.set(r,c),{key:r,val:c}}catch{return null}}));for(let r of i)r&&e.set(r.key,r.val)}return e}get(t){let e=this.memoryCache.get(t);if(e)return e;let s=this.index.get(t);if(!s)return null;let i=S.default.resolve(this.shardsDir,`${s}.gz`);if(!w.default.existsSync(i))return null;try{let r=w.default.readFileSync(i),a=L.default.gunzipSync(r).toString("utf-8");return this.memoryCache.set(t,a),a}catch{return null}}set(t,e){let s=z.default.createHash("md5").update(e).digest("hex");this.index.set(t,s),this.memoryCache.set(t,e);let i=S.default.resolve(this.shardsDir,`${s}.gz`);O.add(async()=>{if(w.default.existsSync(i))return;await ot(this.shardsDir,{recursive:!0});let r=L.default.gzipSync(Buffer.from(e)),a=`${i}.${z.default.randomBytes(4).toString("hex")}.tmp`;await et(a,r),await Ct(a,i)})}get size(){return this.index.size}async flush(){await O.flush()}},Pt=class{assetsDir;constructor(t=process.cwd()){this.assetsDir=S.default.resolve(t,wt,Te)}getFileHash(t){return z.default.createHash("md5").update(w.default.readFileSync(t)).digest("hex")}get(t,e){if(!w.default.existsSync(t))return null;let s=this.getFileHash(t),i=this.getCachedPath(t,`${e}-${s}`);return w.default.existsSync(i)?i:null}set(t,e,s){let i=this.getFileHash(t),r=this.getCachedPath(t,`${e}-${i}`);O.add(async()=>{await ot(this.assetsDir,{recursive:!0});let a=`${r}.${z.default.randomBytes(4).toString("hex")}.tmp`;await et(a,s),await Ct(a,r)})}getCachedPath(t,e){let s=S.default.extname(t),i=S.default.basename(t,s),r=e.replace(/[^a-z0-9]/gi,"-").toLowerCase();return S.default.join(this.assetsDir,`${i}.${r}${s}`)}clear(){w.default.existsSync(this.assetsDir)&&w.default.rmSync(this.assetsDir,{recursive:!0,force:!0})}async flush(){await O.flush()}}});var qe={};Ft(qe,{createViteConfig:()=>Ge,default:()=>kt,defineConfig:()=>Wt,generateStaticPages:()=>st,resolveConfig:()=>j});module.exports=Re(qe);g();var fe=y(require("@vitejs/plugin-react")),he=y(require("@tailwindcss/vite"));g();var ie=require("vite");g();var Gt=y(require("fast-glob"));k();g();K();var T=new V({name:"routes"});function St(){T.invalidateAll()}function Dt(o){T.invalidate(o)}g();var N=y(require("path")),zt=y(require("github-slugger"));k();function At(o,t,e,s){let i=decodeURIComponent(o),r=N.default.resolve(i),a=N.default.resolve(t),p=R(N.default.relative(a,r));if(p.startsWith("../")||p===".."||r.includes("\0"))throw new Error(`Security breach: File is outside of docs directory or contains null bytes: ${o}`);let{data:n,content:c}=Ht(o),l=p.split("/"),u,b;if(s?.versions&&l.length>0){let B=l[0];s.versions.versions[B]&&(b=B,l=l.slice(1))}if(s?.i18n&&l.length>0){let B=l[0];s.i18n.locales[B]&&(u=B,l=l.slice(1))}let x;if(l.length>0){let B=l[0].match(/^\((.+)\)$/);B&&(x=B[1].toLowerCase(),l=l.slice(1))}let d=l.join("/"),m;n.permalink?m=n.permalink.startsWith("/")?n.permalink:`/${n.permalink}`:m=Lt(d||"index.md");let h=e;b&&(h+="/"+b),u&&(h+="/"+u),h+=m==="/"?"":m,(!h||h==="")&&(h="/");let f=l[l.length-1],$=U(f),D=U(N.default.basename(o,N.default.extname(o))),P=n.sidebarPosition??Y(f),v=l.length>=2?l[0]:void 0,I=v?U(v):void 0,H=l.length>=2&&/^index\.mdx?$/.test($),mt=new zt.default,Tt=[],ye=/^(#{2,4})\s+(.+)$/gm,pt;for(;(pt=ye.exec(c))!==null;){let B=pt[1].length,Pe=pt[2].replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/[_*`]/g,"").trim(),Ot=G(Pe).trim(),Ce=mt.slug(Ot);Tt.push({level:B,text:Ot,id:Ce})}let xe=n.title?G(String(n.title)):D,ut=n.description?G(String(n.description)):"";!ut&&c&&(ut=xt(c.replace(/^#+.*$/gm,"").replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/[_*`]/g,"").replace(/\s+/g," ")).trim().slice(0,160));let be=n.badge?G(String(n.badge)):void 0,_t=n.icon?String(n.icon):void 0,ve=Ee(c);return{route:{path:h,componentPath:o,filePath:p,title:xe,description:ut,sidebarPosition:P,headings:Tt,locale:u,version:b,badge:be,icon:_t,tab:x,_content:ve,_rawContent:c},relativeDir:I,isGroupIndex:H,inferredTab:x,groupMeta:H?{title:n.groupTitle||n.title||(I?q(I):""),position:n.groupPosition??n.sidebarPosition??(v?Y(v):void 0),icon:_t}:void 0,inferredGroupPosition:v?Y(v):void 0}}function Ee(o){let t=o.replace(/^#+.*$/gm,"").replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/\{[^\}]+\}/g,"").replace(/[_*`]/g,"").replace(/\s+/g," ");return xt(t).trim()}g();function Ut(o){return o.sort((t,e)=>!t.group&&!e.group?Nt(t,e):t.group?e.group?t.group!==e.group?je(t,e):Nt(t,e):1:-1)}function Nt(o,t){return o.sidebarPosition!==void 0&&t.sidebarPosition!==void 0?o.sidebarPosition-t.sidebarPosition:o.sidebarPosition!==void 0?-1:t.sidebarPosition!==void 0?1:o.title.localeCompare(t.title)}function je(o,t){return o.groupPosition!==void 0&&t.groupPosition!==void 0?o.groupPosition-t.groupPosition:o.groupPosition!==void 0?-1:t.groupPosition!==void 0?1:(o.groupTitle||o.group).localeCompare(t.groupTitle||t.group)}var J=new Map;async function X(o,t,e="/docs"){let s=performance.now();T.load(),J.clear(),(process.env.BOLTDOCS_FORCE_REPARSE==="true"||t?.i18n)&&T.invalidateAll();let i=await(0,Gt.default)(["**/*.md","**/*.mdx"],{cwd:o,absolute:!0,suppressErrors:!0,followSymbolicLinks:!1});T.pruneStale(new Set(i));let r=50,a=[],p=0;for(let d=0;d<i.length;d+=r){let m=i.slice(d,d+r),h=await Promise.all(m.map(async f=>{let $=T.get(f);if($)return p++,$;let D=At(f,o,e,t);return T.set(f,D),D}));a.push(...h),d+r<i.length&&await new Promise(f=>setImmediate(f))}T.save();let n=new Map,c=[];for(let d of a)if(d.isGroupIndex&&d.relativeDir&&c.push(d),d.relativeDir){let m=n.get(d.relativeDir);m?(m.position===void 0&&d.inferredGroupPosition!==void 0&&(m.position=d.inferredGroupPosition),!m.icon&&d.route.icon&&(m.icon=d.route.icon)):(m={title:q(d.relativeDir),position:d.inferredGroupPosition,icon:d.route.icon},n.set(d.relativeDir,m))}for(let d of c){let m=n.get(d.relativeDir);d.groupMeta&&(m.title=d.groupMeta.title,d.groupMeta.position!==void 0&&(m.position=d.groupMeta.position),d.groupMeta.icon&&(m.icon=d.groupMeta.icon))}let l=new Array(a.length);for(let d=0;d<a.length;d++){let m=a[d],h=m.relativeDir,f=h?n.get(h):void 0;l[d]={...m.route,group:h,groupTitle:f?.title||(h?q(h):void 0),groupPosition:f?.position,groupIcon:f?.icon}}let u=l;if(t?.i18n){let d=He(l,t,e);u=[...l,...d]}let b=Ut(u),x=performance.now()-s;return console.log(`[boltdocs] Route generation: ${x.toFixed(2)}ms (${i.length} files, ${p} cache hits)`),b}function He(o,t,e){let s=t.i18n.defaultLocale,i=Object.keys(t.i18n.locales),r=[],a=new Map,p=[];for(let n of o){let c=n.locale||s;a.has(c)||a.set(c,new Set),a.get(c).add(n.path),c===s&&p.push(n)}for(let n of i){if(n===s)continue;let c=a.get(n)||new Set;for(let l of p){let u=Le(l.path,s,n,e);c.has(u)||r.push({...l,path:u,locale:n})}}return r}function Le(o,t,e,s){let i=`${o}:${e}`,r=J.get(i);if(r)return r;let a=s,p=o.match(new RegExp(`^${s}/(v[0-9]+)`));p&&(a+="/"+p[1]);let n=o.substring(a.length),c=`/${t}`;if(n.startsWith(c+"/"))n="/"+e+"/"+n.substring(c.length+1);else if(n===c)n="/"+e;else if(n==="/"||n==="")n="/"+e;else{let u=n.startsWith("/")?"":"/";n="/"+e+u+n}let l=a+n;return J.size>2e3&&J.clear(),J.set(i,l),l}var ne=require("vite-plugin-image-optimizer");g();var it=y(require("path")),qt=y(require("fs")),Vt=require("vite");function Wt(o){return o}var nt=["boltdocs.config.js","boltdocs.config.mjs","boltdocs.config.ts"];async function j(o,t=process.cwd()){let e=t,s={docsDir:it.default.resolve(o),theme:{title:"Boltdocs",description:"A Vite documentation framework",navbar:[{label:"Home",href:"/"},{label:"Documentation",href:"/docs"}],codeTheme:{light:"github-light",dark:"github-dark"},poweredBy:!0,breadcrumbs:!0}},i={};for(let n of nt){let c=it.default.resolve(e,n);if(qt.default.existsSync(c))try{let l=await(0,Vt.loadConfigFromFile)({command:"serve",mode:"development"},c,e);if(l){i=l.config;break}}catch(l){console.warn(`[boltdocs] Failed to load config from ${n}:`,l)}}let a={...{title:i.title,description:i.description,logo:i.logo,favicon:i.favicon,ogImage:i.ogImage,navbar:i.navbar,sidebar:i.sidebar,socialLinks:i.socialLinks,footer:i.footer,githubRepo:i.githubRepo,tabs:i.tabs,codeTheme:i.codeTheme,copyMarkdown:i.copyMarkdown,breadcrumbs:i.breadcrumbs,poweredBy:i.poweredBy,communityHelp:i.communityHelp,version:i.version,editLink:i.editLink},...i.themeConfig||{},...i.theme||{}},p=Object.fromEntries(Object.entries(a).filter(([n,c])=>c!==void 0));return p.navbar&&(p.navbar=p.navbar.map(n=>({label:n.label||n.text||"",href:n.href||n.link||n.to||"",items:n.items?.map(c=>({label:c.label||c.text||"",href:c.href||c.link||c.to||""}))}))),{docsDir:it.default.resolve(o),homePage:i.homePage,theme:{...s.theme,...p},i18n:i.i18n,versions:i.versions,siteUrl:i.siteUrl,plugins:i.plugins||[],external:i.external,integrations:i.integrations,robots:i.robots,vite:i.vite}}g();var F=y(require("fs")),_=y(require("path"));k();var Qt=require("url"),Yt=require("module");g();k();function Kt(o,t){let e=E(t.title),s=E(t.description);return o.replace(/<title>.*?<\/title>/,`<title>${e}</title>`).replace(/(<meta name="description" content=")[^"]*(")/,`$1${s}$2`).replace(/(<meta property="og:title" content=")[^"]*(")/,`$1${e}$2`).replace(/(<meta property="og:description" content=")[^"]*(")/,`$1${s}$2`).replace(/(<meta name="twitter:title" content=")[^"]*(")/,`$1${e}$2`).replace(/(<meta name="twitter:description" content=")[^"]*(")/,`$1${s}$2`)}g();k();function Jt(o,t){let e=t?.siteUrl?.replace(/\/$/,"")||"https://example.com",s=new Date().toISOString().split("T")[0],i=[{url:"/",priority:"1.0",changefreq:"daily"}];if(t?.i18n){let a=t.i18n.defaultLocale;for(let p of Object.keys(t.i18n.locales))p!==a&&i.push({url:`/${p}/`,priority:"1.0",changefreq:"daily"})}return`<?xml version="1.0" encoding="UTF-8"?>
2
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
+ ${[...i,...o.map(a=>({url:a,priority:"0.8",changefreq:"weekly"}))].map(a=>` <url>
4
+ <loc>${yt(e)}${yt(a.url)}</loc>
5
+ <lastmod>${s}</lastmod>
6
+ <changefreq>${a.changefreq}</changefreq>
7
+ <priority>${a.priority}</priority>
8
+ </url>`).join(`
9
+ `)}
10
+ </urlset>`}g();function rt(o){if(typeof o.robots=="string")return o.robots;let t=o.siteUrl?.replace(/\/$/,"")||"",e=o.robots||{},s=e.rules||[{userAgent:"*",allow:"/"}],i=e.sitemaps||(t?[`${t}/sitemap.xml`]:[]),r="";for(let a of s){if(r+=`User-agent: ${a.userAgent}
11
+ `,a.disallow){let p=Array.isArray(a.disallow)?a.disallow:[a.disallow];for(let n of p)r+=`Disallow: ${n}
12
+ `}if(a.allow){let p=Array.isArray(a.allow)?a.allow:[a.allow];for(let n of p)r+=`Allow: ${n}
13
+ `}r+=`
14
+ `}for(let a of i)r+=`Sitemap: ${a}
15
+ `;return r.trim()}var ze=(0,Qt.fileURLToPath)(C),Xt=_.default.dirname(ze),Zt=(0,Yt.createRequire)(C);async function st(o){let{docsDir:t,docsDirName:e,outDir:s,config:i}=o,r=await X(t,i),a=i?.themeConfig?.title||"Boltdocs",p=i?.themeConfig?.description||"",n=_.default.resolve(Xt,"../client/ssr.js");if(!F.default.existsSync(n)){console.error("[boltdocs] SSR module not found at",n,"- Did you build the core package?");return}let c=Zt("module"),l=c.prototype.require;c.prototype.require=function(f,...$){return f==="virtual:boltdocs-layout"?{__esModule:!0,default:function(P){try{let I=l.apply(this,[_.default.resolve(Xt,"../client/index.js")]).DefaultLayout||(({children:mt})=>mt);return l.apply(this,["react"]).createElement(I,P)}catch{return P.children}}}:l.apply(this,[f,...$])};let{render:u}=Zt(n);c.prototype.require=l;let b=_.default.join(s,"index.html");if(!F.default.existsSync(b)){console.warn("[boltdocs] No index.html found in outDir, skipping SSG.");return}let x=F.default.readFileSync(b,"utf-8");await Promise.all(r.map(async f=>{let $=`${f.title} | ${a}`,D=f.description||p,P={};P[`/${e}/${f.filePath}`]={default:()=>null};try{let v=await u({path:f.path,routes:r,config:i||{},docsDirName:e,modules:P,homePage:void 0}),I=Kt(x,{title:E($),description:E(D)}).replace("<!--app-html-->",v).replace('<div id="root"></div>',`<div id="root">${v}</div>`),H=_.default.join(s,f.path);await F.default.promises.mkdir(H,{recursive:!0}),await F.default.promises.writeFile(_.default.join(H,"index.html"),I,"utf-8")}catch(v){console.error(`[boltdocs] Error SSR rendering route ${f.path}:`,v&&(v.stack||v))}}));let d=Jt(r.map(f=>f.path),i);F.default.writeFileSync(_.default.join(s,"sitemap.xml"),d,"utf-8");let m=rt(i);F.default.writeFileSync(_.default.join(s,"robots.txt"),m,"utf-8"),console.log(`[boltdocs] Generated ${r.length} static pages + sitemap.xml + robots.txt`);let{flushCache:h}=await Promise.resolve().then(()=>(K(),$t));await h()}k();var M=y(require("path"));g();k();var Bt=y(require("path")),te=y(require("fs"));function ee(o,t){let e=o.homePage?`import HomePage from '${R(o.homePage)}';`:"",s=Bt.default.resolve(process.cwd(),"index.css"),i=te.default.existsSync(s)?"import './index.css';":"",r=o.homePage?"homePage: HomePage,":"",a=t?.plugins?.flatMap(x=>Object.entries(x.components||{}))||[],p=a.map(([x,d])=>`import * as _comp_${x} from '${R(d)}';
16
+ const ${x} = _comp_${x}.default || _comp_${x}['${x}'] || _comp_${x};`).join(`
17
+ `),n=a.map(([x])=>x).join(", "),c=Bt.default.basename(o.docsDir||"docs"),l=Object.entries(t?.external||{}),u=l.map(([x,d],m)=>`import _ext_${m} from '${R(d)}';`).join(`
18
+ `),b=l.length>0?`externalPages: { ${l.map(([x],d)=>`"${x}": _ext_${d}`).join(", ")} },`:"";return`
19
+ import { createBoltdocsApp as _createApp } from 'boltdocs/client';
20
+ import _routes from 'virtual:boltdocs-routes';
21
+ import _config from 'virtual:boltdocs-config';
22
+ import _user_mdx_components from 'virtual:boltdocs-mdx-components';
23
+ ${i}
24
+ ${e}
25
+ ${p}
26
+ ${u}
27
+
28
+ _createApp({
29
+ target: '#root',
30
+ routes: _routes,
31
+ docsDirName: '${c}',
32
+ config: _config,
33
+ modules: import.meta.glob('/${c}/**/*.{md,mdx}'),
34
+ hot: import.meta.hot,
35
+ ${r}
36
+ ${b}
37
+ components: { ${n}${n?", ":""} ...(_user_mdx_components || {}) },
38
+ });
39
+ `}g();function oe(o){return`<!doctype html>
40
+ <html lang="en">
41
+ <head>
42
+ <meta charset="UTF-8" />
43
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
44
+ <title>${o.theme?.title||o.themeConfig?.title||"Boltdocs"}</title>
45
+ </head>
46
+ <body>
47
+ <div id="root"></div>
48
+ </body>
49
+ </html>`}function Rt(o,t){let e=t.theme||t.themeConfig,s=e?.title||"Boltdocs",i=e?.description||"",r=e?.favicon;!r&&e?.logo&&(typeof e.logo=="string"?r=e.logo:r=e.logo.light||e.logo.dark);let a=[r?`<link rel="icon" href="${r}">`:"",`<meta name="description" content="${i}">`,`<meta property="og:title" content="${s}">`,`<meta property="og:description" content="${i}">`,e?.ogImage?`<meta property="og:image" content="${e.ogImage}">`:"",'<meta property="og:type" content="website">','<meta name="twitter:card" content="summary_large_image">',`<meta name="twitter:title" content="${s}">`,`<meta name="twitter:description" content="${i}">`,e?.ogImage?`<meta name="twitter:image" content="${e.ogImage}">`:"",'<meta name="generator" content="Boltdocs">'].filter(Boolean).join(`
50
+ `),p=`
51
+ <script>
52
+ (function() {
53
+ try {
54
+ var stored = localStorage.getItem("boltdocs-theme");
55
+ var theme = stored || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
56
+ if (theme === "light") {
57
+ document.documentElement.classList.add("theme-light");
58
+ document.documentElement.dataset.theme = "light";
59
+ } else {
60
+ document.documentElement.classList.remove("theme-light");
61
+ document.documentElement.dataset.theme = "dark";
62
+ }
63
+ } catch (e) {}
64
+ })();
65
+ </script>
66
+ `;return o.includes("<title>")?o=o.replace(/<title>.*?<\/title>/,`<title>${s}</title>`):o=o.replace("</head>",` <title>${s}</title>
67
+ </head>`),o=o.replace("</head>",` ${a}
68
+ ${p} </head>`),!o.includes("src/main")&&!o.includes("virtual:boltdocs-entry")&&(o=o.replace("</body>",` <script type="module">import "virtual:boltdocs-entry";</script>
69
+ </body>`)),o}var at=y(require("fs"));g();function re(o={},t){let e=M.default.resolve(process.cwd(),o.docsDir||"docs"),s=R(e),i=t,r,a=!1,p=i?.plugins?.flatMap(n=>n.vitePlugins||[])||[];return[{name:"vite-plugin-boltdocs",enforce:"pre",async config(n,c){a=c.command==="build";let l=n.envDir||process.cwd(),u=(0,ie.loadEnv)(c.mode,l,"");return Object.assign(process.env,u),i||(i=await j(e)),{optimizeDeps:{include:["react","react-dom"]}}},configResolved(n){r=n},configureServer(n){n.middlewares.use((m,h,f)=>{if(m.url==="/robots.txt"){let $=rt(i);h.statusCode=200,h.setHeader("Content-Type","text/plain"),h.end($);return}f()}),n.middlewares.use(async(m,h,f)=>{let $=m.url?.split("?")[0]||"/";if((m.headers.accept||"").includes("text/html")&&!$.includes(".")){let P=M.default.resolve(process.cwd(),"index.html");if(!at.default.existsSync(P)){let v=oe(i);v=Rt(v,i),v=await n.transformIndexHtml(m.url||"/",v),h.statusCode=200,h.setHeader("Content-Type","text/html"),h.end(v);return}}f()});let c=nt.map(m=>M.default.resolve(process.cwd(),m)),l=["tsx","jsx"],u=l.map(m=>M.default.resolve(e,`layout.${m}`)),b=["tsx","ts","jsx","js"],x=b.map(m=>M.default.resolve(e,`mdx-components.${m}`));n.watcher.add([...c,...x,...u]);let d=async(m,h)=>{let f=R(m);if(nt.some(P=>f.endsWith(P))){n.restart();return}if(b.some(P=>f.endsWith(`mdx-components.${P}`))){let P=n.moduleGraph.getModuleById("\0virtual:boltdocs-mdx-components");P&&n.moduleGraph.invalidateModule(P),n.ws.send({type:"full-reload"});return}if(l.some(P=>f.endsWith(`layout.${P}`))){let P=n.moduleGraph.getModuleById("\0virtual:boltdocs-layout");P&&n.moduleGraph.invalidateModule(P),n.ws.send({type:"full-reload"});return}if(!f.startsWith(s)||!jt(f))return;h==="add"||h==="unlink"?St():Dt(m);let $=await X(e,i),D=n.moduleGraph.getModuleById("\0virtual:boltdocs-routes");D&&n.moduleGraph.invalidateModule(D),n.ws.send({type:"custom",event:"boltdocs:routes-update",data:$})};n.watcher.on("add",m=>d(m,"add")),n.watcher.on("unlink",m=>d(m,"unlink")),n.watcher.on("change",m=>d(m,"change"))},resolveId(n){if(n==="virtual:boltdocs-routes"||n==="virtual:boltdocs-config"||n==="virtual:boltdocs-entry"||n==="virtual:boltdocs-mdx-components"||n==="virtual:boltdocs-layout")return"\0"+n},async load(n){if(n==="\0virtual:boltdocs-routes"){let c=await X(e,i);return`export default ${JSON.stringify(c,null,2)};`}if(n==="\0virtual:boltdocs-config"){let c={theme:i?.theme,themeConfig:i?.themeConfig,integrations:i?.integrations,i18n:i?.i18n,versions:i?.versions,siteUrl:i?.siteUrl};return`export default ${JSON.stringify(c,null,2)};`}if(n==="\0virtual:boltdocs-entry")return ee(o,i);if(n==="\0virtual:boltdocs-mdx-components"){let c=["tsx","ts","jsx","js"],l=null;for(let u of c){let b=M.default.resolve(e,`mdx-components.${u}`);if(at.default.existsSync(b)){l=b;break}}if(l){let u=R(l);return`import * as components from '${u}';
70
+ const mdxComponents = components.default || components;
71
+ export default mdxComponents;
72
+ export * from '${u}';`}return"export default {};"}if(n==="\0virtual:boltdocs-layout"){let c=["tsx","jsx"],l=null;for(let u of c){let b=M.default.resolve(e,`layout.${u}`);if(at.default.existsSync(b)){l=b;break}}return l?`import UserLayout from '${R(l)}';
73
+ export default UserLayout;`:`import { DefaultLayout } from 'boltdocs/client';
74
+ export default DefaultLayout;`}},transformIndexHtml:{order:"pre",handler(n){return Rt(n,i)}},async closeBundle(){if(!a)return;let n=r?.build?.outDir?M.default.resolve(r.root,r.build.outDir):M.default.resolve(process.cwd(),"dist"),c=M.default.basename(e||"docs");await st({docsDir:e,docsDirName:c,outDir:n,config:i});let{flushCache:l}=await Promise.resolve().then(()=>(K(),$t));await l()}},(0,ne.ViteImageOptimizer)({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:"preset-default"}]}}),...p.filter(n=>!!n)]}g();var ae=y(require("@mdx-js/rollup")),ce=y(require("remark-gfm")),le=y(require("remark-frontmatter")),de=y(require("rehype-slug")),me=y(require("crypto")),Mt=require("unist-util-visit"),pe=require("shiki");K();var ct=null;async function ue(o){if(ct)return ct;let t=typeof o=="object"?[o.light,o.dark]:[o??"github-dark"];return["github-light","github-dark"].forEach(e=>{t.includes(e)||t.push(e)}),ct=await(0,pe.createHighlighter)({themes:t,langs:["tsx","jsx","ts","js","json","md","mdx","css","html","bash","sh","yaml","yml"]}),ct}function Ae(o){return async t=>{let e=o?.themeConfig?.codeTheme??{light:"github-light",dark:"github-dark"},s=await ue(e);(0,Mt.visit)(t,["mdxJsxFlowElement","mdxJsxTextElement"],i=>{if(i.name!=="ComponentPreview")return;let r=i.attributes?.find(c=>c.name==="code"),a="";if(r){if(typeof r.value=="string")a=r.value;else if(r.value?.type==="mdxJsxAttributeValueExpression"){let c=r.value.value??"";a=c.match(/^[`'"](.+)[`'"]$/)?.[1]??c}}if(!a)return;let p=typeof e=="object"?{themes:{light:e.light,dark:e.dark},lang:"tsx"}:{theme:e,lang:"tsx"},n=s.codeToHtml(a,p);i.attributes=(i.attributes??[]).filter(c=>c.name!=="highlightedHtml"),i.attributes.push({type:"mdxJsxAttribute",name:"highlightedHtml",value:n})})}}function Ne(o){return async t=>{let e=o?.themeConfig?.codeTheme||{light:"github-light",dark:"github-dark"},s=await ue(e);(0,Mt.visit)(t,"element",i=>{if(i.tagName==="pre"&&i.children?.[0]?.tagName==="code"){let r=i.children[0],p=(r.properties?.className||[]).find(b=>b.startsWith("language-")),n=p?p.slice(9):"text",c=r.children[0]?.value||"",l={lang:n};typeof e=="object"?l.themes={light:e.light,dark:e.dark}:l.theme=e;let u=s.codeToHtml(c,l);i.properties.dataHighlighted="true",i.properties.highlightedHtml=u,i.children=[]}})}}var Ue="v3",Z=new W("mdx"),se=!1;function ge(o,t=ae.default){let e=o?.plugins?.flatMap(r=>r.remarkPlugins||[])||[],s=o?.plugins?.flatMap(r=>r.rehypePlugins||[])||[],i=t({remarkPlugins:[ce.default,le.default,[Ae,o],...e],rehypePlugins:[de.default,[Ne,o],...s],jsxRuntime:"automatic",providerImportSource:"@mdx-js/react"});return i.isMock&&console.log("MDX PLUGIN IS MOCKED"),{...i,name:"vite-plugin-boltdocs-mdx",async buildStart(){lt=0,dt=0,se||(Z.load(),se=!0),i.buildStart&&await i.buildStart.call(this)},async transform(r,a,p){if(!a.endsWith(".md")&&!a.endsWith(".mdx"))return i.transform?.call(this,r,a,p);console.log(`[boltdocs] Transforming MDX: ${a}`),dt++;let n=me.default.createHash("md5").update(r).digest("hex"),c=`${a}:${n}:${Ue}`,l=Z.get(c);if(l)return lt++,{code:l,map:null};let u=await i.transform.call(this,r,a,p);return u&&typeof u=="object"&&u.code&&Z.set(c,u.code),u},async buildEnd(){console.log(`[boltdocs] MDX Cache Performance: ${lt}/${dt} hits (${Math.round(lt/dt*100)||0}%)`),Z.save(),await Z.flush(),i.buildEnd&&await i.buildEnd.call(this)}}}var lt=0,dt=0;async function kt(o){let t=o?.docsDir||"docs",e=await j(t),s={...o,homePage:o?.homePage||e.homePage};return[...re(s,e),ge(e)]}async function Ge(o,t="development"){let e=await j("docs",o);return{root:o,mode:t,plugins:[(0,fe.default)(),(0,he.default)(),await kt({docsDir:e.docsDir,homePage:e.homePage})],...e.vite}}0&&(module.exports={createViteConfig,defineConfig,generateStaticPages,resolveConfig});
@@ -0,0 +1 @@
1
+ import{a,b,c,f as d,g as e,h as f}from"../chunk-V2ZHKQSP.mjs";import"../chunk-PNXZMUCO.mjs";f();export{e as createViteConfig,d as default,a as defineConfig,c as generateStaticPages,b as resolveConfig};
@@ -0,0 +1 @@
1
+ import{a as f}from"./chunk-ISPX45DF.mjs";import{h as g,i as h,j as u,k as m,l as S,m as d,n as p,o as y,p as D}from"./chunk-BVWWKXJH.mjs";import"./chunk-52MVMZWS.mjs";import{useEffect as K,useCallback as M}from"react";import{useNavigate as R}from"react-router-dom";import{Fragment as T,jsx as o,jsxs as n}from"react/jsx-runtime";function A({routes:v}){let{isOpen:I,setIsOpen:a,query:w,setQuery:k,list:E}=f(v),r=R();K(()=>{let e=t=>{(/Mac/.test(navigator.userAgent)?t.metaKey:t.ctrlKey)&&(t.key==="k"||t.key==="j")&&(t.preventDefault(),a(i=>!i))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]);let l=M(e=>{let t=String(e);if(a(!1),t.includes("#")){let[s,c]=t.split("#");r(s),setTimeout(()=>{let i=document.getElementById(c);i&&i.scrollIntoView({behavior:"smooth"})},100)}else r(t)},[r,a]);return n(T,{children:[o(g.SearchTrigger,{onPress:()=>a(!0)}),o(h,{isOpen:I,onOpenChange:a,children:n(u,{onSelectionChange:l,children:[o(m,{value:w,onChange:e=>k(e.target.value)}),o(S,{items:E,children:e=>n(d,{onPress:()=>l(e.id),textValue:e.title,children:[o(p,{isHeading:e.isHeading}),n("div",{className:"flex flex-col justify-center gap-0.5",children:[o(y,{children:e.title}),o(D,{children:e.groupTitle})]})]},e.id)})]})})]})}export{A as SearchDialog};
@@ -0,0 +1,355 @@
1
+ import React__default from 'react';
2
+ import * as vite from 'vite';
3
+ import { Plugin } from 'vite';
4
+
5
+ /**
6
+ * Represents a single social link in the configuration.
7
+ */
8
+ interface BoltdocsSocialLink {
9
+ /** Identifier for the icon (e.g., 'github') */
10
+ icon: 'discord' | 'x' | 'github' | 'bluesky' | string;
11
+ /** The URL the social link points to */
12
+ link: string;
13
+ }
14
+ /**
15
+ * Configuration for the site footer.
16
+ */
17
+ interface BoltdocsFooterConfig {
18
+ /** Text to display in the footer (HTML is supported) */
19
+ text?: string;
20
+ }
21
+ /**
22
+ * Theme-specific configuration options governing the appearance and navigation of the site.
23
+ */
24
+ interface BoltdocsThemeConfig {
25
+ /** The global title of the documentation site */
26
+ title?: string;
27
+ /** The global description of the site (used for SEO) */
28
+ description?: string;
29
+ /** URL path to the site logo or an object for light/dark versions */
30
+ logo?: string | {
31
+ dark: string;
32
+ light: string;
33
+ alt?: string;
34
+ width?: number;
35
+ height?: number;
36
+ };
37
+ /** Items to display in the top navigation bar */
38
+ navbar?: Array<{
39
+ /** Text to display */
40
+ label: string;
41
+ /** URL path or external link */
42
+ href: string;
43
+ /** Nested items for NavigationMenu */
44
+ items?: Array<{
45
+ label: string;
46
+ href: string;
47
+ }>;
48
+ }>;
49
+ /** Items to display in the sidebar, organized optionally by group URLs */
50
+ sidebar?: Record<string, Array<{
51
+ text: string;
52
+ link: string;
53
+ }>>;
54
+ /** Social links to display in the navigation bar */
55
+ socialLinks?: BoltdocsSocialLink[];
56
+ /** Site footer configuration */
57
+ footer?: BoltdocsFooterConfig;
58
+ /** Whether to show breadcrumbs navigation (default: true) */
59
+ breadcrumbs?: boolean;
60
+ /** URL template for 'Edit this page'. Use :path as a placeholder. */
61
+ editLink?: string;
62
+ /** URL for the 'Community help' link. */
63
+ communityHelp?: string;
64
+ /** The current version of the project (e.g., 'v2.8.9'). Displayed in the Navbar. */
65
+ version?: string;
66
+ /** The GitHub repository in the format 'owner/repo' to fetch and display star count. */
67
+ githubRepo?: string;
68
+ /**
69
+ * URL path to the site favicon.
70
+ * If not specified, the logo will be used if available.
71
+ */
72
+ favicon?: string;
73
+ /**
74
+ * The Open Graph image URL to display when the site is shared on social media.
75
+ */
76
+ ogImage?: string;
77
+ /** Whether to show the 'Powered by LiteDocs' badge in the sidebar (default: true) */
78
+ poweredBy?: boolean;
79
+ /**
80
+ * Top-level tabs for organizing documentation groups.
81
+ * Tab discovery uses the (tab-id) directory syntax.
82
+ */
83
+ tabs?: Array<{
84
+ id: string;
85
+ text: string;
86
+ icon?: string;
87
+ }>;
88
+ /**
89
+ * The syntax highlighting theme for code blocks.
90
+ * Supports any Shiki theme name (e.g., 'github-dark', 'one-dark-pro', 'aurora-x').
91
+ * Can also be an object for multiple themes (e.g., { light: 'github-light', dark: 'github-dark' }).
92
+ * Default: { light: 'github-light', dark: 'one-dark-pro' }
93
+ */
94
+ codeTheme?: string | {
95
+ light: string;
96
+ dark: string;
97
+ };
98
+ /**
99
+ * Configuration for the 'Copy Markdown' button.
100
+ * Can be a boolean or an object with text and icon.
101
+ * Default: true
102
+ */
103
+ copyMarkdown?: boolean | {
104
+ text?: string;
105
+ icon?: string;
106
+ };
107
+ }
108
+ /**
109
+ * Configuration for the robots.txt file.
110
+ */
111
+ type BoltdocsRobotsConfig = string | {
112
+ /** User-agent rules */
113
+ rules?: Array<{
114
+ userAgent: string;
115
+ /** Paths allowed to be crawled */
116
+ allow?: string | string[];
117
+ /** Paths disallowed to be crawled */
118
+ disallow?: string | string[];
119
+ }>;
120
+ /** Sitemaps to include in the robots.txt */
121
+ sitemaps?: string[];
122
+ };
123
+ /**
124
+ * Configuration for internationalization (i18n).
125
+ */
126
+ interface BoltdocsI18nConfig {
127
+ /** The default locale (e.g., 'en') */
128
+ defaultLocale: string;
129
+ /** Available locales and their display names (e.g., { en: 'English', es: 'Español' }) */
130
+ locales: Record<string, string>;
131
+ }
132
+ /**
133
+ * Configuration for documentation versioning.
134
+ */
135
+ interface BoltdocsVersionsConfig {
136
+ /** The default version (e.g., 'v2') */
137
+ defaultVersion: string;
138
+ /** Available versions and their display names (e.g., { v1: 'Version 1.x', v2: 'Version 2.x' }) */
139
+ versions: Record<string, string>;
140
+ }
141
+ /**
142
+ * Defines a Boltdocs plugin that can extend the build process and client-side functionality.
143
+ */
144
+ interface BoltdocsPlugin {
145
+ /** A unique name for the plugin */
146
+ name: string;
147
+ /** Whether to run this plugin before or after default ones (optional) */
148
+ enforce?: 'pre' | 'post';
149
+ /** Optional remark plugins to add to the MDX pipeline */
150
+ remarkPlugins?: unknown[];
151
+ /** Optional rehype plugins to add to the MDX pipeline */
152
+ rehypePlugins?: unknown[];
153
+ /** Optional Vite plugins to inject into the build process */
154
+ vitePlugins?: Plugin[];
155
+ /** Optional custom React components to register in MDX. Map of Name -> Module Path. */
156
+ components?: Record<string, string>;
157
+ }
158
+ /**
159
+ * Configuration for external integrations (e.g., CodeSandbox).
160
+ */
161
+ interface BoltdocsIntegrationsConfig {
162
+ /** CodeSandbox integration settings */
163
+ sandbox?: {
164
+ /** Whether to enable the "Open in Sandbox" button in CodeBlocks */
165
+ enable?: boolean;
166
+ /** Default options for the sandbox (files, dependencies, etc.) */
167
+ config?: Record<string, unknown>;
168
+ };
169
+ }
170
+ /**
171
+ * The root configuration object for Boltdocs.
172
+ */
173
+ interface BoltdocsConfig {
174
+ /** The base URL of the site, used for generating the sitemap */
175
+ siteUrl?: string;
176
+ /** The root directory containing markdown documentation files (default: 'docs') */
177
+ docsDir?: string;
178
+ /** Path to a custom HomePage component */
179
+ homePage?: string;
180
+ /** Configuration pertaining to the UI and appearance */
181
+ theme?: BoltdocsThemeConfig;
182
+ /** Configuration for internationalization */
183
+ i18n?: BoltdocsI18nConfig;
184
+ /** Configuration for documentation versioning */
185
+ versions?: BoltdocsVersionsConfig;
186
+ /** Custom plugins for extending functionality */
187
+ plugins?: BoltdocsPlugin[];
188
+ /** Map of custom external route paths to component file paths */
189
+ external?: Record<string, string>;
190
+ /** External integrations configuration */
191
+ integrations?: BoltdocsIntegrationsConfig;
192
+ /** Configuration for the robots.txt file */
193
+ robots?: BoltdocsRobotsConfig;
194
+ /** Low-level Vite configuration overrides */
195
+ vite?: vite.InlineConfig;
196
+ /** @deprecated Use theme instead */
197
+ themeConfig?: BoltdocsThemeConfig;
198
+ }
199
+
200
+ /**
201
+ * Metadata provided by the server for a specific route.
202
+ * Maps closely to the `RouteMeta` type in the Node environment.
203
+ */
204
+ interface ComponentRoute {
205
+ /** The final URL path */
206
+ path: string;
207
+ /** The absolute filesystem path of the source file */
208
+ componentPath: string;
209
+ /** The page title */
210
+ title: string;
211
+ /** Explicit order in the sidebar */
212
+ sidebarPosition?: number;
213
+ /** The relative path from the docs directory */
214
+ filePath: string;
215
+ /** The group directory name */
216
+ group?: string;
217
+ /** The display title of the group */
218
+ groupTitle?: string;
219
+ /** Explicit order of the group in the sidebar */
220
+ groupPosition?: number;
221
+ /** Extracted markdown headings for search indexing */
222
+ headings?: {
223
+ level: number;
224
+ text: string;
225
+ id: string;
226
+ }[];
227
+ /** The page summary or description */
228
+ description?: string;
229
+ /** The locale this route belongs to, if i18n is configured */
230
+ locale?: string;
231
+ /** The version this route belongs to, if versioning is configured */
232
+ version?: string;
233
+ /** Optional icon to display (Lucide icon name or raw SVG) */
234
+ icon?: string;
235
+ /** The tab this route belongs to, if tabs are configured */
236
+ tab?: string;
237
+ /** Optional badge to display next to the sidebar item */
238
+ badge?: string | {
239
+ text: 'updated' | 'new' | 'deprecated';
240
+ expires?: string;
241
+ };
242
+ /** Optional icon for the route's group */
243
+ groupIcon?: string;
244
+ /** The extracted plain-text content of the page for search indexing */
245
+ _content?: string;
246
+ /** The raw markdown content of the page */
247
+ _rawContent?: string;
248
+ }
249
+ /**
250
+ * Site configuration provided by the server.
251
+ */
252
+ type SiteConfig = BoltdocsConfig;
253
+ /**
254
+ * Configuration options for initializing the Boltdocs client app.
255
+ */
256
+ interface CreateBoltdocsAppOptions {
257
+ /** CSS selector for the DOM element where the app should mount (e.g. '#root') */
258
+ target: string;
259
+ /** Initial routes generated by the Vite plugin (`virtual:boltdocs-routes`) */
260
+ routes: ComponentRoute[];
261
+ /** The name of the documentation directory (e.g. 'docs') */
262
+ docsDirName: string;
263
+ /** Site configuration (`virtual:boltdocs-config`) */
264
+ config: SiteConfig;
265
+ /** Dynamic import mapping from `import.meta.glob` for the documentation pages */
266
+ modules: Record<string, () => Promise<{
267
+ default: React__default.ComponentType<any>;
268
+ }>>;
269
+ /** The `import.meta.hot` instance necessary for fast refresh/HMR updates */
270
+ hot?: {
271
+ accept: (cb?: (mod: any) => void) => void;
272
+ dispose: (cb: (data: any) => void) => void;
273
+ on: (event: string, cb: (data: any) => void) => void;
274
+ data: any;
275
+ };
276
+ /** Optional custom React component to render when visiting the root path ('/') */
277
+ homePage?: React__default.ComponentType;
278
+ /** Custom external pages mapped by their route path */
279
+ externalPages?: Record<string, React__default.ComponentType>;
280
+ /** Optional custom MDX components provided by plugins */
281
+ components?: Record<string, React__default.ComponentType>;
282
+ }
283
+ /**
284
+ * Types for CodeSandbox integration.
285
+ */
286
+ interface SandboxFile {
287
+ content: string | object;
288
+ isBinary?: boolean;
289
+ }
290
+ type SandboxFiles = Record<string, SandboxFile>;
291
+ interface SandboxOptions {
292
+ files?: SandboxFiles;
293
+ dependencies?: Record<string, string>;
294
+ devDependencies?: Record<string, string>;
295
+ title?: string;
296
+ description?: string;
297
+ template?: string;
298
+ /** The file path to open by default in the editor (e.g. `"src/App.tsx"`). */
299
+ entry?: string;
300
+ /** Options for the embedded iframe view, used by `embedSandbox()`. */
301
+ embed?: SandboxEmbedOptions;
302
+ /** Custom scripts for the package.json (e.g. `{ "start": "vite" }`). */
303
+ scripts?: Record<string, string>;
304
+ /** Optional default theme configuration for the sandbox project. */
305
+ themeConfig?: Record<string, unknown>;
306
+ }
307
+ interface SandboxEmbedOptions {
308
+ /** Which panel to display: `"editor"`, `"preview"`, or `"split"`. */
309
+ view?: 'editor' | 'preview' | 'split';
310
+ /** Color theme: `"dark"` or `"light"`. */
311
+ theme?: 'dark' | 'light';
312
+ /** Whether to hide the navigation bar in the embed. */
313
+ hideNavigation?: boolean;
314
+ }
315
+ /**
316
+ * Tab configuration for the documentation site.
317
+ */
318
+ interface BoltdocsTab {
319
+ id: string;
320
+ text: string;
321
+ icon?: string;
322
+ }
323
+ /**
324
+ * Props for the OnThisPage (TOC) component.
325
+ */
326
+ interface OnThisPageProps {
327
+ headings?: {
328
+ level: number;
329
+ text: string;
330
+ id: string;
331
+ }[];
332
+ editLink?: string;
333
+ communityHelp?: string;
334
+ filePath?: string;
335
+ }
336
+ /**
337
+ * Props for user-defined layout components (layout.tsx).
338
+ */
339
+ interface LayoutProps {
340
+ children: React__default.ReactNode;
341
+ }
342
+ /**
343
+ * Unified type for navbar links.
344
+ */
345
+ interface NavbarLink {
346
+ label: string;
347
+ href: string;
348
+ active: boolean;
349
+ /** Optional icon or string for external link indication */
350
+ to?: string;
351
+ /** Nested items for NavigationMenu */
352
+ items?: NavbarLink[];
353
+ }
354
+
355
+ export type { BoltdocsConfig as B, ComponentRoute as C, LayoutProps as L, NavbarLink as N, OnThisPageProps as O, SandboxOptions as S, BoltdocsSocialLink as a, BoltdocsTab as b, CreateBoltdocsAppOptions as c, BoltdocsThemeConfig as d, SandboxEmbedOptions as e, SandboxFile as f, SandboxFiles as g };