@stacksjs/bunpress 0.2.1 → 0.2.2

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.
@@ -35,4 +35,4 @@ var W=import.meta.require;var Q={"search.placeholder":"Search documentation","to
35
35
  }
36
36
  })();
37
37
  `.trim()}
38
- export{W as $,Z as aa,$ as ba,j as ca,X as da,z as ea,C as fa,A as ga,E as ha,F as ia};
38
+ export{W as aa,Z as ba,$ as ca,j as da,X as ea,z as fa,C as ga,A as ha,E as ia,F as ja};
@@ -29,4 +29,4 @@ ${Q.map((V)=>{return` <sitemap>
29
29
  </sitemap>`}).join(`
30
30
  `)}
31
31
  </sitemapindex>`,$=z.join(J,K);await T.promises.writeFile($,_,"utf-8")}function p(H){return(typeof H==="string"?new Date(H):H).toISOString().split("T")[0]}function d(H,J){let j=[];for(let K=0;K<H.length;K+=J)j.push(H.slice(K,K+J));return j}
32
- export{R as v,u as w,g as x,l as y,a as z};
32
+ export{R as w,u as x,g as y,l as z,a as A};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{w as w4,x as C4,z as v4}from"./chunk-qzhr4d2q.js";import{B as b4,C as z,E as o,H as I4,I as L4,J as x4,Y as k4,_ as P4}from"./chunk-zkdm5pr7.js";import{$ as F}from"./chunk-em1tv2bw.js";var{Glob:h4}=globalThis.Bun;import{copyFile as I6,mkdir as m4,readdir as L6,rename as x6,rm as t}from"fs/promises";import{existsSync as E6}from"fs";import{join as D,resolve as S6}from"path";import S from"process";import{CLI as F6}from"@stacksjs/clapp";var f="0.2.1";var{Glob:n4}=globalThis.Bun;import{dirname as i4,relative as s4,resolve as d,sep as X4}from"path";import{mkdir as r4}from"fs/promises";function Y4(K){return X4==="/"?K:K.split(X4).join("/")}function o4(K){let Z=new Bun.CryptoHasher("sha256");return Z.update(K),Z.digest("hex")}async function q4(K,Z,Q){let $=d(K),N=Q?Y4(s4($,d(Q))):void 0,X=[],q=new n4("**/*");for await(let j of q.scan({cwd:$,onlyFiles:!0})){let _=Y4(j);if(_===N)continue;X.push(_)}X.sort((j,_)=>j.localeCompare(_));let Y=[],W=new Bun.CryptoHasher("sha256");for(let j of X){let _=new Uint8Array(await Bun.file(d($,j)).arrayBuffer()),R=o4(_);Y.push({path:j,bytes:_.byteLength,sha256:R}),W.update(`${j}\x00${_.byteLength}\x00${R}
2
+ import{A as v4,x as w4,y as C4}from"./chunk-5cxb3t2e.js";import{$ as P4,C as b4,D as z,F as o,I as I4,J as L4,K as x4,Z as k4}from"./chunk-he00q0q4.js";import{aa as F}from"./chunk-3f29kjd8.js";var{Glob:h4}=globalThis.Bun;import{copyFile as I6,mkdir as m4,readdir as L6,rename as x6,rm as t}from"fs/promises";import{existsSync as E6}from"fs";import{join as D,resolve as S6}from"path";import S from"process";import{CLI as F6}from"@stacksjs/clapp";var f="0.2.2";var{Glob:n4}=globalThis.Bun;import{dirname as i4,relative as s4,resolve as d,sep as X4}from"path";import{mkdir as r4}from"fs/promises";function Y4(K){return X4==="/"?K:K.split(X4).join("/")}function o4(K){let Z=new Bun.CryptoHasher("sha256");return Z.update(K),Z.digest("hex")}async function q4(K,Z,Q){let $=d(K),N=Q?Y4(s4($,d(Q))):void 0,X=[],q=new n4("**/*");for await(let j of q.scan({cwd:$,onlyFiles:!0})){let _=Y4(j);if(_===N)continue;X.push(_)}X.sort((j,_)=>j.localeCompare(_));let Y=[],W=new Bun.CryptoHasher("sha256");for(let j of X){let _=new Uint8Array(await Bun.file(d($,j)).arrayBuffer()),R=o4(_);Y.push({path:j,bytes:_.byteLength,sha256:R}),W.update(`${j}\x00${_.byteLength}\x00${R}
3
3
  `)}return{schema_version:1,generator:"bunpress",generator_version:Z,outputs:Y,tree_sha256:W.digest("hex")}}async function H4(K,Z,Q){let $=await q4(K,Q,Z);return await r4(i4(d(Z)),{recursive:!0}),await Bun.write(Z,`${JSON.stringify($,null,2)}
4
4
  `),$}function N4(K){return new Map(K.outputs.map((Z)=>[Z.path,Z]))}async function _4(K,Z,Q){let $=await Bun.file(Z).json();if($.schema_version!==1||$.generator!=="bunpress"||!Array.isArray($.outputs))throw Error(`Unsupported or malformed BunPress build manifest: ${Z}`);let N=await q4(K,Q,Z);if(JSON.stringify(N)===JSON.stringify($))return N;let X=N4($),q=N4(N),Y=N.outputs.filter((R)=>!X.has(R.path)).map((R)=>R.path),W=$.outputs.filter((R)=>!q.has(R.path)).map((R)=>R.path),j=N.outputs.filter((R)=>{let G=X.get(R.path);return G&&(G.bytes!==R.bytes||G.sha256!==R.sha256)}).map((R)=>{let G=X.get(R.path);return`${R.path} [bytes ${G.bytes} -> ${R.bytes}; sha256 ${G.sha256} -> ${R.sha256}]`}),_=[$.generator_version!==N.generator_version?`generator ${$.generator_version} -> ${N.generator_version}`:"",Y.length?`added: ${Y.join(", ")}`:"",W.length?`removed: ${W.join(", ")}`:"",j.length?`changed: ${j.join(", ")}`:""].filter(Boolean);throw Error(`BunPress output does not match ${Z}: ${_.join("; ")||"tree hash changed"}`)}import{existsSync as t4}from"fs";import{rm as e4}from"fs/promises";import{join as K6}from"path";var L={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m"};function O(K,Z){return`${L[Z]}${K}${L.reset}`}function T(K){console.log(`${L.green}\u2713${L.reset} ${K}`)}function U(K){console.error(`${L.red}\u2717${L.reset} ${K}`)}function p(K){console.warn(`${L.yellow}\u26A0${L.reset} ${K}`)}function M(K){console.log(`${L.blue}\u2139${L.reset} ${K}`)}function b(K){if(K===0)return"0 B";let Z=1024,Q=["B","KB","MB","GB"],$=Math.floor(Math.log(K)/Math.log(Z));return`${Number.parseFloat((K/Z**$).toFixed(2))} ${Q[$]}`}function a(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var W4=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class v{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(K){this.text=K}start(){if(W4){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let K=this.frames[this.index];process.stdout.write(`\r${L.cyan}${K}${L.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(K){this.stop(),T(K||this.text)}fail(K){this.stop(),U(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!W4)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function c(K,Z=!1){let Q=Z?"Y/n":"y/N";process.stdout.write(`${L.cyan}?${L.reset} ${K} ${L.dim}(${Q})${L.reset}: `);let $=Bun.file("/dev/stdin").stream().getReader(),N=new TextDecoder,{value:X}=await $.read(),q=N.decode(X).trim().toLowerCase();if(!q)return Z;return q==="y"||q==="yes"}function m(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let N of Z)Q[N]=Math.max(N.length,...K.map((X)=>String(X[N]).length));let $=Z.map((N)=>N.padEnd(Q[N])).join(" ");console.log(O($,"bold")),console.log("\u2500".repeat($.length));for(let N of K){let X=Z.map((q)=>String(N[q]).padEnd(Q[q])).join(" ");console.log(X)}}async function l(K){try{return Bun.file(K).size}catch{return 0}}async function Q6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let N of Q.scan(K)){let X=`${K}/${N}`,q=await l(X);$+=q}return $}catch{return 0}}async function R4(K={}){let Z=await z,Q=K.outdir||Z.outDir||"./dist",$=K6(Q,".bunpress"),N=K.force||!1,X=K.verbose||!1;try{if(!t4($))return M(`Directory "${$}" does not exist, nothing to clean`),!0;let Y=await Q6($);if(X)M(`Found "${$}" (${b(Y)})`);if(!N){if(!await c(`Delete "${$}" directory? (${b(Y)})`,!1))return M("Clean cancelled"),!1}let W=process.env.VITEST==="true"||!1,j=null;if(!W&&!X)j=new v("Cleaning build artifacts..."),j.start();if(await e4($,{recursive:!0,force:!0}),j)j.succeed(`Cleaned ${b(Y)} from "${$}"`);else if(X||W)T(`Cleaned ${b(Y)} from "${$}"`);return!0}catch(q){return U(`Failed to clean directory: ${q}`),!1}}import{existsSync as n}from"fs";import{join as i}from"path";async function j4(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let N of Z){let X=i(process.cwd(),N);if(n(X)){Q=X;break}}if(!Q)return U("No configuration file found"),M('Run "bunpress config init" to create one'),!1;T(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(O("Configuration:","bold")),console.log($),!0}catch(Z){return U(`Failed to show configuration: ${Z}`),!1}}async function G4(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let Y of Q){let W=i(process.cwd(),Y);if(n(W)){$=W;break}}if(!$)return U("No configuration file found"),!1;if(Z)M(`Validating ${$}...`);let X=(await import($)).default;if(!X)return U("Configuration file does not export a default object"),!1;let q=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")q.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")q.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))q.push("nav should be an array");else for(let[Y,W]of X.nav.entries())if(!W.text||!W.link)q.push(`nav[${Y}] is missing required fields (text, link)`)}if(X.sitemap){if(!X.sitemap.hostname)q.push("sitemap.hostname is required for SEO")}if(q.length>0){U("Configuration validation failed:");for(let Y of q)console.log(` \u2022 ${Y}`);return!1}return T("Configuration is valid \u2713"),!0}catch(Q){return U(`Failed to validate configuration: ${Q}`),!1}}async function U4(K={}){let Z=i(process.cwd(),"bunpress.config.ts");if(n(Z))return U("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
5
5
 
@@ -290,8 +290,8 @@ ${Z}`}async function U6(K){let Z=[];async function Q($){let N=await w.promises.r
290
290
  `)){let X=N.match(/^#{1,6}\s+(.*)$/);if(!X)continue;let q=X[1].trim(),Y=q.match(/\{#([\w-]+)\}\s*$/),W=Y?Y[1]:L4(I4(q));if(!W)continue;x4(W,Q)}}catch{}return O4.set(K,Q),Q}function B6(K){let Z=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,$;while(($=Q.exec(K))!==null){let N=$[1],X=$[2];if(!N||N.trim()==="")Z.push(X)}return Z}function T6(K){if(console.log(""),M("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${O(K.totalPages.toString(),"blue")}`),console.log(`Passed: ${O(K.passed.toString(),"green")}`),console.log(`Errors: ${O(K.errors.length.toString(),K.errors.length>0?"red":"green")}`),console.log(`Warnings: ${O(K.warnings.length.toString(),K.warnings.length>0?"yellow":"green")}`),console.log(""),K.errors.length>0){U(`\u2717 ${K.errors.length} errors found:`),console.log("");let Z=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));m(Z),console.log("")}if(K.warnings.length>0){p(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let Z=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));m(Z),console.log("")}if(K.errors.length===0&&K.warnings.length===0)T("\u2713 All SEO checks passed!");else if(K.errors.length===0)T("\u2713 No errors found (only warnings)")}import{join as z6}from"path";async function O6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
291
291
  `),$=0,N=!1,X=[];for(let j of Q){if(j.trim().startsWith("```")){N=!N;continue}if(!N)X.push(j)}$=X.join(" ").split(/\s+/).filter((j)=>j.length>0).length;let Y=Q.filter((j)=>j.match(/^#{1,6}\s+/)).length,W=(Z.match(/```/g)||[]).length/2;return{path:K,size:await l(K),lines:Q.length,words:$,headings:Y,codeBlocks:Math.floor(W)}}async function y4(K={}){let Z=await z,Q=K.dir||Z.docsDir||"./docs",$=K.verbose||!1;try{console.log(O(`
292
292
  Analyzing documentation...
293
- `,"bold"));let{Glob:N}=awaitPromise.resolve(globalThis.Bun),X=new N("**/*.md"),q=[];for await(let A of X.scan(Q)){let V=z6(Q,A),g=await O6(V);q.push(g)}if(q.length===0)return U("No markdown files found"),!1;let Y=q.reduce((A,V)=>A+V.size,0),W=q.reduce((A,V)=>A+V.lines,0),j=q.reduce((A,V)=>A+V.words,0),_=q.reduce((A,V)=>A+V.headings,0),R=q.reduce((A,V)=>A+V.codeBlocks,0);if(console.log(O("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${q.length}`),console.log(`Total size: ${b(Y)}`),console.log(`Total lines: ${W.toLocaleString()}`),console.log(`Total words: ${j.toLocaleString()}`),console.log(`Headings: ${_}`),console.log(`Code blocks: ${R}`),console.log(),$){console.log(O("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let A=q.map((V)=>({File:V.path.replace(`${Q}/`,""),Size:b(V.size),Lines:V.lines,Words:V.words,Headings:V.headings,"Code Blocks":V.codeBlocks}));m(A),console.log()}let G=Y/q.length,B=W/q.length,H=j/q.length;console.log(O("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${b(G)}`),console.log(`Lines: ${Math.round(B)}`),console.log(`Words: ${Math.round(H)}`),console.log();let x=[...q].sort((A,V)=>V.size-A.size).slice(0,5);if(x.length>0){console.log(O("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let A of x){let V=A.path.replace(`${Q}/`,"");console.log(` ${V.padEnd(40)} ${b(A.size)}`)}console.log()}let E=Math.ceil(j/200);return M(`Estimated reading time: ${E} minutes`),!0}catch(N){return U(`Failed to generate statistics: ${N}`),!1}}var I=new F6("bunpress"),J={outdir:z.outDir||"./dist",docsdir:z.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:z.verbose};async function g4(K){let Z=new h4("**/*.md"),Q=[];for await(let $ of Z.scan(K))Q.push(D(K,$));return Q}async function y6(K,Z,Q=!1){let $=`${Z}/public`;try{await L6($);let N=new h4("**/*");for await(let X of N.scan($)){let q=D($,X),Y=D(K,X);await m4(D(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await I6(q,Y)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}function D6(K,Z,Q){let $=Z.replace(/^\.\//,""),N=(_)=>_.replace(/^\.\//,"").replace($,"").replace(/^\//,"").replace(/\.md$/,"");if(!Q.enabled)return K.map((_)=>({sourceFile:_,relativePath:N(_),locale:Q.defaultLocale}));let X=Q.locales,q=new Set(X),Y=new Map;for(let _ of X)Y.set(_,new Map);let W=new Set;for(let _ of K){let R=N(_),G=R.split("/");if(G.length>1&&q.has(G[0])&&G[0]!==Q.defaultLocale){let H=G.slice(1).join("/");Y.get(G[0]).set(H,_),W.add(H);continue}let B=R.match(/^(.*)\.([A-Za-z-]+)$/);if(B&&q.has(B[2])){Y.get(B[2]).set(B[1],_),W.add(B[1]);continue}Y.get(Q.defaultLocale).set(R,_),W.add(R)}let j=[];for(let _ of X)for(let R of W){let G=Y.get(_).get(R)??Y.get(Q.defaultLocale).get(R);if(!G)continue;j.push({sourceFile:G,relativePath:R,locale:_})}return j}async function b6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let N=await P4(K,Q);if(await Bun.write(D(Z,k4.replace(/^\//,"")),JSON.stringify(N)),$)console.log(`Indexed ${N.length} sections for search.`)}catch(N){if($)console.error("Error generating search index:",N)}}async function w6(K,Z,Q){try{let $=await z;if($.sitemap?.enabled!==!1&&$.sitemap?.baseUrl)await v4(K,Z,$);if($.robots?.enabled!==!1)await C4(Z,$);if($.rss?.enabled)await w4(K,Z,$,$.rss)}catch($){if(Q)console.error("Error generating SEO files:",$)}}async function C6(K={}){let Z=await z;if(!K.config)return Z;let Q=S6(S.cwd(),K.config);if(!E6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),N=$.default??$;return b4({...Z,...N})}async function D4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await C6(K),Q=K.outdir||Z.outDir||J.outdir,$=D(Q,".bunpress"),N=`${$}.tmp-${S.pid}`,X=K.dir||Z.docsDir||J.docsdir,q=K.verbose??J.verbose,Y=K.minify??!1,W=K.sourcemap??!1,j=performance.now(),_=new v("Building documentation...");if(!q)_.start();await t(N,{recursive:!0,force:!0}),await m4(N,{recursive:!0});let R=await g4(X);if(R.length===0){if(!q)_.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(q)console.log(`Found ${R.length} markdown files:`),R.forEach((G)=>console.log(`- ${G}`));try{let{markdownToHtml:G,wrapInLayout:B}=await import("./chunk-desvs9bx.js"),{loadI18nTranslations:H,resolveI18nConfig:x}=await import("./chunk-yfwm5337.js"),{mkdir:E,writeFile:A}=await import("fs/promises"),V=await H(x(Z),Z);if(q)console.log("Transforming markdown to HTML...");let g=D6(R,X,V);for(let C of g){let u4=await Bun.file(C.sourceFile).text(),{html:f4,frontmatter:Q4}=await G(u4,X),h=C.relativePath,d4=`/${h}`,p4=Q4.layout||"doc",c4=await B(f4,Z,d4,p4,Q4,{i18n:V,locale:C.locale,sourceFile:C.sourceFile,docsDir:X}),l4=h==="index"||h.endsWith("/index"),Z4=C.locale&&C.locale!==V.defaultLocale&&V.enabled?D(N,C.locale):N,u=l4?D(Z4,`${h}.html`):D(Z4,h,"index.html"),$4=u.substring(0,u.lastIndexOf("/"));if($4)await E($4,{recursive:!0});if(await A(u,c4),q)console.log(`Generated: ${u}`)}if(q)console.log(`Processed ${R.length} markdown files into ${g.length} pages.`);if(await y6(N,X,q),await k6(N),await v6(N,Z),K.searchIndex!==!1)await b6(X,N,Z,q||!1);if(await w6(X,N,q||!1),K.checkManifest)await _4(N,K.checkManifest,f);if(await t($,{recursive:!0,force:!0}),await x6(N,$),K.manifest)await H4($,K.manifest,f);let K4=performance.now()-j;if(!q)_.succeed(`Built ${R.length} pages to HTML in ${a(K4)}`);else T(`Build completed in ${a(K4)}`),console.log(`
294
- Generated ${R.length} HTML files in ${$}`);return!0}catch(G){if(await t(N,{recursive:!0,force:!0}),!q)_.fail("Build failed");return console.error("Error during build:",G),!1}}async function v6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-desvs9bx.js"),X=`
293
+ `,"bold"));let{Glob:N}=awaitPromise.resolve(globalThis.Bun),X=new N("**/*.md"),q=[];for await(let A of X.scan(Q)){let V=z6(Q,A),g=await O6(V);q.push(g)}if(q.length===0)return U("No markdown files found"),!1;let Y=q.reduce((A,V)=>A+V.size,0),W=q.reduce((A,V)=>A+V.lines,0),j=q.reduce((A,V)=>A+V.words,0),_=q.reduce((A,V)=>A+V.headings,0),R=q.reduce((A,V)=>A+V.codeBlocks,0);if(console.log(O("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${q.length}`),console.log(`Total size: ${b(Y)}`),console.log(`Total lines: ${W.toLocaleString()}`),console.log(`Total words: ${j.toLocaleString()}`),console.log(`Headings: ${_}`),console.log(`Code blocks: ${R}`),console.log(),$){console.log(O("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let A=q.map((V)=>({File:V.path.replace(`${Q}/`,""),Size:b(V.size),Lines:V.lines,Words:V.words,Headings:V.headings,"Code Blocks":V.codeBlocks}));m(A),console.log()}let G=Y/q.length,B=W/q.length,H=j/q.length;console.log(O("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${b(G)}`),console.log(`Lines: ${Math.round(B)}`),console.log(`Words: ${Math.round(H)}`),console.log();let x=[...q].sort((A,V)=>V.size-A.size).slice(0,5);if(x.length>0){console.log(O("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let A of x){let V=A.path.replace(`${Q}/`,"");console.log(` ${V.padEnd(40)} ${b(A.size)}`)}console.log()}let E=Math.ceil(j/200);return M(`Estimated reading time: ${E} minutes`),!0}catch(N){return U(`Failed to generate statistics: ${N}`),!1}}var I=new F6("bunpress"),J={outdir:z.outDir||"./dist",docsdir:z.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:z.verbose};async function g4(K){let Z=new h4("**/*.md"),Q=[];for await(let $ of Z.scan(K))Q.push(D(K,$));return Q}async function y6(K,Z,Q=!1){let $=`${Z}/public`;try{await L6($);let N=new h4("**/*");for await(let X of N.scan($)){let q=D($,X),Y=D(K,X);await m4(D(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await I6(q,Y)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}function D6(K,Z,Q){let $=Z.replace(/^\.\//,""),N=(_)=>_.replace(/^\.\//,"").replace($,"").replace(/^\//,"").replace(/\.md$/,"");if(!Q.enabled)return K.map((_)=>({sourceFile:_,relativePath:N(_),locale:Q.defaultLocale}));let X=Q.locales,q=new Set(X),Y=new Map;for(let _ of X)Y.set(_,new Map);let W=new Set;for(let _ of K){let R=N(_),G=R.split("/");if(G.length>1&&q.has(G[0])&&G[0]!==Q.defaultLocale){let H=G.slice(1).join("/");Y.get(G[0]).set(H,_),W.add(H);continue}let B=R.match(/^(.*)\.([A-Za-z-]+)$/);if(B&&q.has(B[2])){Y.get(B[2]).set(B[1],_),W.add(B[1]);continue}Y.get(Q.defaultLocale).set(R,_),W.add(R)}let j=[];for(let _ of X)for(let R of W){let G=Y.get(_).get(R)??Y.get(Q.defaultLocale).get(R);if(!G)continue;j.push({sourceFile:G,relativePath:R,locale:_})}return j}async function b6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let N=await P4(K,Q);if(await Bun.write(D(Z,k4.replace(/^\//,"")),JSON.stringify(N)),$)console.log(`Indexed ${N.length} sections for search.`)}catch(N){if($)console.error("Error generating search index:",N)}}async function w6(K,Z,Q){try{let $=await z;if($.sitemap?.enabled!==!1&&$.sitemap?.baseUrl)await v4(K,Z,$);if($.robots?.enabled!==!1)await C4(Z,$);if($.rss?.enabled)await w4(K,Z,$,$.rss)}catch($){if(Q)console.error("Error generating SEO files:",$)}}async function C6(K={}){let Z=await z;if(!K.config)return Z;let Q=S6(S.cwd(),K.config);if(!E6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),N=$.default??$;return b4({...Z,...N})}async function D4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await C6(K),Q=K.outdir||Z.outDir||J.outdir,$=D(Q,".bunpress"),N=`${$}.tmp-${S.pid}`,X=K.dir||Z.docsDir||J.docsdir,q=K.verbose??J.verbose,Y=K.minify??!1,W=K.sourcemap??!1,j=performance.now(),_=new v("Building documentation...");if(!q)_.start();await t(N,{recursive:!0,force:!0}),await m4(N,{recursive:!0});let R=await g4(X);if(R.length===0){if(!q)_.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(q)console.log(`Found ${R.length} markdown files:`),R.forEach((G)=>console.log(`- ${G}`));try{let{markdownToHtml:G,wrapInLayout:B}=await import("./chunk-pbdzef6w.js"),{loadI18nTranslations:H,resolveI18nConfig:x}=await import("./chunk-m6pshd6t.js"),{mkdir:E,writeFile:A}=await import("fs/promises"),V=await H(x(Z),Z);if(q)console.log("Transforming markdown to HTML...");let g=D6(R,X,V);for(let C of g){let u4=await Bun.file(C.sourceFile).text(),{html:f4,frontmatter:Q4}=await G(u4,X),h=C.relativePath,d4=`/${h}`,p4=Q4.layout||"doc",c4=await B(f4,Z,d4,p4,Q4,{i18n:V,locale:C.locale,sourceFile:C.sourceFile,docsDir:X}),l4=h==="index"||h.endsWith("/index"),Z4=C.locale&&C.locale!==V.defaultLocale&&V.enabled?D(N,C.locale):N,u=l4?D(Z4,`${h}.html`):D(Z4,h,"index.html"),$4=u.substring(0,u.lastIndexOf("/"));if($4)await E($4,{recursive:!0});if(await A(u,c4),q)console.log(`Generated: ${u}`)}if(q)console.log(`Processed ${R.length} markdown files into ${g.length} pages.`);if(await y6(N,X,q),await k6(N),await v6(N,Z),K.searchIndex!==!1)await b6(X,N,Z,q||!1);if(await w6(X,N,q||!1),K.checkManifest)await _4(N,K.checkManifest,f);if(await t($,{recursive:!0,force:!0}),await x6(N,$),K.manifest)await H4($,K.manifest,f);let K4=performance.now()-j;if(!q)_.succeed(`Built ${R.length} pages to HTML in ${a(K4)}`);else T(`Build completed in ${a(K4)}`),console.log(`
294
+ Generated ${R.length} HTML files in ${$}`);return!0}catch(G){if(await t(N,{recursive:!0,force:!0}),!q)_.fail("Build failed");return console.error("Error during build:",G),!1}}async function v6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-pbdzef6w.js"),X=`
295
295
  <style>
296
296
  .NotFound {
297
297
  padding: 64px 24px 96px;
@@ -370,7 +370,7 @@ Generated ${R.length} HTML files in ${$}`);return!0}catch(G){if(await t(N,{recur
370
370
  </div>
371
371
  `,q=await $(X,Z,"/404","doc");await Bun.write(D(K,"404.html"),q)}async function k6(K){let Z=D(K,"index.html");try{if(!await Bun.file(Z).exists())console.error("Warning: No index.html found at root")}catch(Q){console.error("Error checking root index.html:",Q)}}I.command("build","Build the documentation site").option("--outdir <outdir>","Output directory").option("--dir <dir>","Documentation directory").option("--config <config>","Path to config file").option("--minify","Minify output files",{default:!1}).option("--sourcemap","Generate source maps",{default:!1}).option("--manifest <path>","Write a deterministic rendered-tree manifest").option("--check-manifest <path>","Fail unless the rendered tree matches a checked manifest").option("--search-index","Write the client search index (on by default; --no-search-index skips it)",{default:!0}).option("--watch","Watch for changes and rebuild",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await D4(K))S.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await z,N=K.dir||$.docsDir||"./docs";console.log(`
372
372
  Watching for changes...`),Q(N,{recursive:!0},async(X,q)=>{if(q&&q.endsWith(".md"))console.log(`
373
- Detected change in ${q}, rebuilding...`),await D4(K)}),await new Promise(()=>{})}});I.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:J.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:J.watch}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{let Z=await z,Q=K.port||J.port,$=K.dir||Z.docsDir||J.docsdir,N=K.watch??J.watch,X=K.verbose??J.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:N,verbose:X});let{serveCLI:q}=await import("./chunk-desvs9bx.js");await q({port:Q,root:$,watch:N,config:Z})});async function P6(K={}){let Z=await z,Q=K.dir||Z.docsDir||J.docsdir,$=K.output||"./docs.md",N=K.full??!1,X=K.verbose??J.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${N}`);let q=await g4(Q);if(q.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${q.length} markdown files`);q.sort();let Y=`# Documentation
373
+ Detected change in ${q}, rebuilding...`),await D4(K)}),await new Promise(()=>{})}});I.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:J.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:J.watch}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{let Z=await z,Q=K.port||J.port,$=K.dir||Z.docsDir||J.docsdir,N=K.watch??J.watch,X=K.verbose??J.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:N,verbose:X});let{serveCLI:q}=await import("./chunk-pbdzef6w.js");await q({port:Q,root:$,watch:N,config:Z})});async function P6(K={}){let Z=await z,Q=K.dir||Z.docsDir||J.docsdir,$=K.output||"./docs.md",N=K.full??!1,X=K.verbose??J.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${N}`);let q=await g4(Q);if(q.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${q.length} markdown files`);q.sort();let Y=`# Documentation
374
374
 
375
375
  `;Y+=`Generated: ${new Date().toISOString()}
376
376
 
@@ -389,5 +389,5 @@ Detected change in ${q}, rebuilding...`),await D4(K)}),await new Promise(()=>{})
389
389
  `}Y+=`---
390
390
 
391
391
  `}return await Bun.write($,Y),console.log(`
392
- LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(Y.length/1024).toFixed(2)} KB`),!0}I.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--output <output>","Output file path",{default:"./docs.md"}).option("--full","Include full content (not just titles and headings)",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await P6(K))S.exit(1)});I.command("init","Initialize a new BunPress project").option("--name <name>","Project name").option("--template <template>","Template to use").option("--force","Overwrite existing files",{default:!1}).action(async(K)=>{if(!await J4(K))S.exit(1)});I.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:J.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{await z4(K)});I.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:J.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await R4(K))S.exit(1)});I.command("doctor","Run diagnostic checks on the project").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await A4(K))S.exit(1)});I.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await j4(K))S.exit(1)});I.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await G4(K))S.exit(1)});I.command("config:init","Initialize configuration file").action(async(K)=>{if(!await U4(K))S.exit(1)});I.command("new <path>","Create a new markdown file").option("--title <title>","Page title").option("--template <template>","Template to use (default, guide, api, blog)",{default:"default"}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K,Z)=>{if(!await B4(K,Z))S.exit(1)});I.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await y4(K))S.exit(1)});I.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await S4(K)});I.command("deploy","Deploy documentation to AWS using CloudFormation (S3 + CloudFront + Route53)").option("--region <region>","AWS region for S3 bucket",{default:"us-east-1"}).option("--bucket <bucket>","S3 bucket name (auto-generated if not provided)").option("--domain <domain>","Custom domain (e.g., docs.example.com)").option("--subdomain <subdomain>","Subdomain (used with --base-domain)").option("--base-domain <baseDomain>","Base domain (e.g., example.com) - must have Route53 hosted zone").option("--stack-name <stackName>","CloudFormation stack name").option("--hosted-zone-id <hostedZoneId>","Route53 hosted zone ID (auto-detected from domain)").option("--certificate-arn <certificateArn>","ACM certificate ARN (auto-created if not provided)").option("--dry-run","Show configuration without deploying",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-y3z183hg.js");if(!await Z(K))S.exit(1)});I.help();I.version(f);var e=Bun.argv[1]||"",h6=e.endsWith("/bunpress")||e.endsWith("/cli.ts")||e.endsWith("/cli.js");if(h6)I.parse();
393
- export{T as o,U as p,M as q,v as r,g4 as s,C6 as t,D4 as u};
392
+ LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(Y.length/1024).toFixed(2)} KB`),!0}I.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--output <output>","Output file path",{default:"./docs.md"}).option("--full","Include full content (not just titles and headings)",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await P6(K))S.exit(1)});I.command("init","Initialize a new BunPress project").option("--name <name>","Project name").option("--template <template>","Template to use").option("--force","Overwrite existing files",{default:!1}).action(async(K)=>{if(!await J4(K))S.exit(1)});I.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:J.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{await z4(K)});I.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:J.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await R4(K))S.exit(1)});I.command("doctor","Run diagnostic checks on the project").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await A4(K))S.exit(1)});I.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await j4(K))S.exit(1)});I.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await G4(K))S.exit(1)});I.command("config:init","Initialize configuration file").action(async(K)=>{if(!await U4(K))S.exit(1)});I.command("new <path>","Create a new markdown file").option("--title <title>","Page title").option("--template <template>","Template to use (default, guide, api, blog)",{default:"default"}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K,Z)=>{if(!await B4(K,Z))S.exit(1)});I.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{if(!await y4(K))S.exit(1)});I.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await S4(K)});I.command("deploy","Deploy documentation to AWS using CloudFormation (S3 + CloudFront + Route53)").option("--region <region>","AWS region for S3 bucket",{default:"us-east-1"}).option("--bucket <bucket>","S3 bucket name (auto-generated if not provided)").option("--domain <domain>","Custom domain (e.g., docs.example.com)").option("--subdomain <subdomain>","Subdomain (used with --base-domain)").option("--base-domain <baseDomain>","Base domain (e.g., example.com) - must have Route53 hosted zone").option("--stack-name <stackName>","CloudFormation stack name").option("--hosted-zone-id <hostedZoneId>","Route53 hosted zone ID (auto-detected from domain)").option("--certificate-arn <certificateArn>","ACM certificate ARN (auto-created if not provided)").option("--dry-run","Show configuration without deploying",{default:!1}).option("--verbose","Enable verbose logging",{default:J.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-mbcjfn27.js");if(!await Z(K))S.exit(1)});I.help();I.version(f);var e=Bun.argv[1]||"",h6=e.endsWith("/bunpress")||e.endsWith("/cli.ts")||e.endsWith("/cli.js");if(h6)I.parse();
393
+ export{T as p,U as q,M as r,v as s,g4 as t,C6 as u,D4 as v};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{aa as m,da as A}from"./chunk-em1tv2bw.js";import{loadConfig as u}from"bunfig";var h={docsDir:"./docs",outDir:"./dist",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics-configuration"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
2
+ import{ba as m,ea as O}from"./chunk-3f29kjd8.js";import{loadConfig as u}from"bunfig";var h={docsDir:"./docs",outDir:"./dist",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics-configuration"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
3
3
  /* Additional BunPress customizations */
4
4
  /* Note: Base styles are provided by the VitePress theme */
5
5
 
@@ -693,6 +693,80 @@ function toggleTheme() {
693
693
  });
694
694
  })();
695
695
 
696
+ // Nav dropdowns and mega menus.
697
+ //
698
+ // The panels open on :hover and :focus-within in CSS, so they work with no
699
+ // JavaScript and with the keyboard. This adds the two things CSS cannot do:
700
+ // a real click/tap toggle (a touch device has no hover to rely on) and an
701
+ // accurate aria-expanded for screen readers.
702
+ function closeNavGroups(except) {
703
+ document.querySelectorAll('.BPNavBarMenu-group.is-open').forEach(function (group) {
704
+ if (group === except) return;
705
+ group.classList.remove('is-open');
706
+ const button = group.querySelector('.BPNavBarMenu-group-button');
707
+ if (button) button.setAttribute('aria-expanded', 'false');
708
+ });
709
+ }
710
+
711
+ function toggleNavScreen(force) {
712
+ const screen = document.getElementById('bp-nav-screen');
713
+ const toggle = document.querySelector('.BPNavToggle');
714
+ if (!screen) return;
715
+ const open = typeof force === 'boolean' ? force : screen.hasAttribute('hidden');
716
+ if (open) screen.removeAttribute('hidden');
717
+ else screen.setAttribute('hidden', '');
718
+ document.documentElement.classList.toggle('bp-nav-screen-open', open);
719
+ if (toggle) toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
720
+ }
721
+
722
+ (function () {
723
+ document.addEventListener('click', function (event) {
724
+ const button = event.target.closest ? event.target.closest('.BPNavBarMenu-group-button') : null;
725
+ if (button) {
726
+ const group = button.parentElement;
727
+ const open = !group.classList.contains('is-open');
728
+ closeNavGroups(group);
729
+ group.classList.toggle('is-open', open);
730
+ button.setAttribute('aria-expanded', open ? 'true' : 'false');
731
+ return;
732
+ }
733
+ // A click anywhere else dismisses an open panel, including a click on one
734
+ // of its own links (which navigates, but SPA routing keeps the DOM).
735
+ closeNavGroups(null);
736
+ const screen = document.getElementById('bp-nav-screen');
737
+ if (screen && !screen.hasAttribute('hidden') && !event.target.closest('.BPNav')) {
738
+ toggleNavScreen(false);
739
+ }
740
+ });
741
+
742
+ document.addEventListener('keydown', function (event) {
743
+ if (event.key !== 'Escape') return;
744
+ closeNavGroups(null);
745
+ toggleNavScreen(false);
746
+ });
747
+
748
+ // A link inside the stacked nav navigates; leaving the panel open over the
749
+ // new page would hide it.
750
+ document.addEventListener('click', function (event) {
751
+ if (event.target.closest && event.target.closest('.BPNavScreen a')) toggleNavScreen(false);
752
+ });
753
+ })();
754
+
755
+ // Hero code panel tabs. The panels are all server-rendered; this only swaps
756
+ // which one is visible, so the samples are in the HTML with or without JS.
757
+ function switchHeroCodeTab(button, index) {
758
+ const panel = button.closest('.BPHeroCode');
759
+ if (!panel) return;
760
+ panel.querySelectorAll('.BPHeroCode-tab').forEach(function (tab, i) {
761
+ tab.classList.toggle('is-active', i === index);
762
+ tab.setAttribute('aria-selected', i === index ? 'true' : 'false');
763
+ });
764
+ panel.querySelectorAll('.BPHeroCode-panel').forEach(function (body, i) {
765
+ if (i === index) body.removeAttribute('hidden');
766
+ else body.setAttribute('hidden', '');
767
+ });
768
+ }
769
+
696
770
  function switchCodeTab(groupId, panelIndex) {
697
771
  const group = document.getElementById(groupId);
698
772
  if (!group) return;
@@ -1146,19 +1220,19 @@ if (typeof document !== 'undefined') {
1146
1220
  }
1147
1221
  });
1148
1222
  }
1149
- `],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},search:{enabled:!0,maxResults:12,keyboardShortcuts:!0},themeConfig:{socialLinks:[{icon:"github",link:"https://github.com/stacksjs/bunpress"}]},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}};function g(Q){let V=Q.plugins;if(!Array.isArray(V)||V.length===0)return Q;let W=Q;for(let X of V){if(!X||typeof X!=="object")continue;let Z=X.name||"unnamed plugin";try{if(typeof X.extendConfig==="function")W=X.extendConfig(W)??W}catch($){console.error(`[bunpress] ${Z}: extendConfig failed \u2014`,$)}try{if(typeof X.validateConfig==="function"){let $=X.validateConfig(W);for(let j of $?.warnings??[])console.warn(`[bunpress] ${Z}: ${j}`);for(let j of $?.errors??[])console.error(`[bunpress] ${Z}: ${j}`)}}catch($){console.error(`[bunpress] ${Z}: validateConfig failed \u2014`,$)}}for(let X of V)try{X?.onConfigLoad?.(W)}catch(Z){console.error(`[bunpress] ${X?.name||"unnamed plugin"}: onConfigLoad failed \u2014`,Z)}return W}var d=g(await u({name:"bunpress",alias:"docs",defaultConfig:h}));async function YQ(){return d}function E(){let Q=null;return(V)=>{let W=V.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!W)return Q!==null;let X=W[1];if(Q===null)return Q=X,!0;let Z=X[0]===Q[0],$=X.length>=Q.length;if(Z&&$&&W[2].trim()==="")Q=null;return!0}}function w(Q){let V=E();return Q.split(`
1223
+ `],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},search:{enabled:!0,maxResults:12,keyboardShortcuts:!0},themeConfig:{socialLinks:[{icon:"github",link:"https://github.com/stacksjs/bunpress"}]},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}};function g(Q){let V=Q.plugins;if(!Array.isArray(V)||V.length===0)return Q;let W=Q;for(let X of V){if(!X||typeof X!=="object")continue;let Z=X.name||"unnamed plugin";try{if(typeof X.extendConfig==="function")W=X.extendConfig(W)??W}catch($){console.error(`[bunpress] ${Z}: extendConfig failed \u2014`,$)}try{if(typeof X.validateConfig==="function"){let $=X.validateConfig(W);for(let j of $?.warnings??[])console.warn(`[bunpress] ${Z}: ${j}`);for(let j of $?.errors??[])console.error(`[bunpress] ${Z}: ${j}`)}}catch($){console.error(`[bunpress] ${Z}: validateConfig failed \u2014`,$)}}for(let X of V)try{X?.onConfigLoad?.(W)}catch(Z){console.error(`[bunpress] ${X?.name||"unnamed plugin"}: onConfigLoad failed \u2014`,Z)}return W}async function d(){let Q=["bunpress.config.ts","bunpress.config.js",".config/bunpress.ts","docs.config.ts",".config/docs.ts"],V=[];for(let W of Q)if(await Bun.file(W).exists())V.push(W);if(V.length>1){let[W,...X]=V;console.warn(`[bunpress] Multiple config files found. Using ${W}; ignoring ${X.join(", ")}.`)}}await d();var c=g(await u({name:"bunpress",alias:"docs",defaultConfig:h}));async function GQ(){return c}function E(){let Q=null;return(V)=>{let W=V.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!W)return Q!==null;let X=W[1];if(Q===null)return Q=X,!0;let Z=X[0]===Q[0],$=X.length>=Q.length;if(Z&&$&&W[2].trim()==="")Q=null;return!0}}function P(Q){let V=E();return Q.split(`
1150
1224
  `).filter((W)=>!V(W)).join(`
1151
- `)}function L(Q){return`\x00BPCODE${Q}\x00`}var c=/\u0000BPCODE(\d+)\u0000/g;function l(Q){let V=[],W=E(),X=[],Z=null,$=()=>{if(!Z)return;V.push(Z.join(`
1225
+ `)}function L(Q){return`\x00BPCODE${Q}\x00`}var l=/\u0000BPCODE(\d+)\u0000/g;function s(Q){let V=[],W=E(),X=[],Z=null,$=()=>{if(!Z)return;V.push(Z.join(`
1152
1226
  `)),X.push(L(V.length-1)),Z=null};for(let j of Q.split(`
1153
1227
  `)){if(W(j)){Z??=[],Z.push(j);continue}$(),X.push(j.replace(/(`+)(?:(?!\1)[\s\S])*\1/g,(J)=>{return V.push(J),L(V.length-1)}))}return $(),{masked:X.join(`
1154
- `),restore:(j)=>j.replace(c,(J,Y)=>V[Number(Y)]??J)}}async function KQ(Q,V){let{masked:W,restore:X}=l(Q);return X(await V(W))}var s={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function y(Q){return Q.replace(/\s*<!-- toc-ignore -->\s*/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/<[^>]*>/g,"").trim()}function D(Q){return Q.toLowerCase().trim().replace(/<[^>]*>/g,"").replace(/what's new\?\s*\(v2\.0\)/g,"whats-new-v2-0").replace(/features\s*&\s*benefits/g,"features-benefits").replace(/vue\.js\s*\+\s*typescript\s*=\s*\u2764\uFE0F/g,"vue-js-typescript").replace(/\//g,"-").replace(/\./g,"-").replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function O(Q,V){let W=Q,X=1;while(V.has(Q))Q=`${W}-${X}`,X++;return V.add(Q),Q}function P(Q,V){return O(D(Q),V)}function a(Q){let V=[],W=new Set,X=/^(#{1,6})\s+(.+)$/gm,Z;while((Z=X.exec(Q))!==null){let $=Z[1].length,j=Z[2].trim();if(!j)continue;if(j.includes("toc-ignore"))continue;let J=j.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();J=J.replace(/`([^`]+)`/g,"<code>$1</code>");let Y=J.includes("<code>"),q=P(y(j),W);V.push({level:$,text:J,id:q,children:[],hasCode:Y})}return V}function i(Q){let V=[],W=[];for(let X of Q){while(W.length>0&&W[W.length-1].level>=X.level)W.pop();if(W.length===0)V.push(X);else W[W.length-1].children.push(X);W.push(X)}return V}function o(Q,V){let{minDepth:W=2,maxDepth:X=6,exclude:Z=[]}=V,$=(j)=>{let J=[];for(let Y of j){if(Z.some((G)=>{if(G.startsWith("/")&&G.endsWith("/"))return new RegExp(G.slice(1,-1)).test(Y.text);else return Y.text===G}))continue;if(Y.level>X)continue;let q=$(Y.children);if(Y.level>=W&&Y.level<=X)J.push({...Y,children:q});else J.push(...q)}return J};return $(Q)}function _(Q){let{items:V,title:W,config:X}=Q,{className:Z,collapsible:$}=X,j=(J,Y=0)=>{if(J.length===0)return"";let q=Y===0?"toc-list":"toc-sublist",G=Y===0?"toc-item":"toc-subitem";return`<ul class="${q}">
1228
+ `),restore:(j)=>j.replace(l,(J,Y)=>V[Number(Y)]??J)}}async function qQ(Q,V){let{masked:W,restore:X}=s(Q);return X(await V(W))}var a={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function y(Q){return Q.replace(/\s*<!-- toc-ignore -->\s*/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/<[^>]*>/g,"").trim()}function D(Q){return Q.toLowerCase().trim().replace(/<[^>]*>/g,"").replace(/what's new\?\s*\(v2\.0\)/g,"whats-new-v2-0").replace(/features\s*&\s*benefits/g,"features-benefits").replace(/vue\.js\s*\+\s*typescript\s*=\s*\u2764\uFE0F/g,"vue-js-typescript").replace(/\//g,"-").replace(/\./g,"-").replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function A(Q,V){let W=Q,X=1;while(V.has(Q))Q=`${W}-${X}`,X++;return V.add(Q),Q}function w(Q,V){return A(D(Q),V)}function i(Q){let V=[],W=new Set,X=/^(#{1,6})\s+(.+)$/gm,Z;while((Z=X.exec(Q))!==null){let $=Z[1].length,j=Z[2].trim();if(!j)continue;if(j.includes("toc-ignore"))continue;let J=j.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();J=J.replace(/`([^`]+)`/g,"<code>$1</code>");let Y=J.includes("<code>"),q=w(y(j),W);V.push({level:$,text:J,id:q,children:[],hasCode:Y})}return V}function o(Q){let V=[],W=[];for(let X of Q){while(W.length>0&&W[W.length-1].level>=X.level)W.pop();if(W.length===0)V.push(X);else W[W.length-1].children.push(X);W.push(X)}return V}function r(Q,V){let{minDepth:W=2,maxDepth:X=6,exclude:Z=[]}=V,$=(j)=>{let J=[];for(let Y of j){if(Z.some((G)=>{if(G.startsWith("/")&&G.endsWith("/"))return new RegExp(G.slice(1,-1)).test(Y.text);else return Y.text===G}))continue;if(Y.level>X)continue;let q=$(Y.children);if(Y.level>=W&&Y.level<=X)J.push({...Y,children:q});else J.push(...q)}return J};return $(Q)}function _(Q){let{items:V,title:W,config:X}=Q,{className:Z,collapsible:$}=X,j=(J,Y=0)=>{if(J.length===0)return"";let q=Y===0?"toc-list":"toc-sublist",G=Y===0?"toc-item":"toc-subitem";return`<ul class="${q}">
1155
1229
  ${J.map((z)=>{let I=z.children.length>0,K=I&&$?"toc-expand":"",M=I?j(z.children,Y+1):"",U=50,B=z.text.length>50?`${z.text.substring(0,50)}...`:z.text,N=z.text.length>50?"toc-truncate":"";return`<li class="${z.hasCode?"toc-code":""} ${K} ${G} ${N}">
1156
1230
  <a href="#${z.id}" class="toc-link" title="${z.text.replace(/<[^>]*>/g,"")}">${B}</a>
1157
1231
  ${M}
1158
1232
  </li>`}).join(`
1159
1233
  `)}
1160
1234
  </ul>`};return[`<nav class="${Z}" role="navigation" aria-label="${W}">`,'<div class="toc-container">',` <h2 class="toc-title">${W}</h2>`,` ${j(V)}`,"</div>","</nav>"].join(`
1161
- `)}function C(Q){return _(Q).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function r(Q){return _(Q).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function n(Q){return _(Q).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function t(Q,V={}){let W={...V};if(typeof W.position==="string")W.position=[W.position];let X={...s,...W},Z=a(Q),$=i(Z),j=o($,X);return{title:X.title,items:j,config:X}}function zQ(Q,V={}){let W=t(Q,V);return(Array.isArray(V.position)?V.position:[V.position||"sidebar"]).map((Z)=>{let $;switch(Z){case"inline":$=C(W);break;case"sidebar":$=r(W);break;case"floating":$=n(W);break;default:$=_(W)}return{position:Z,data:W,html:$}})}function BQ(Q,V){let W=C(V);return Q.replace(/\[\[toc\]\]/gi,W)}function IQ(Q){let V=new Set;return Q.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(W,X,Z)=>{let $=P(Z.replace(/<[^>]*>/g,""),V);return`<h${X} id="${$}"><a href="#${$}" class="heading-anchor">#</a>${Z}</h${X}>`})}function NQ(){return`
1235
+ `)}function C(Q){return _(Q).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function n(Q){return _(Q).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function t(Q){return _(Q).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function e(Q,V={}){let W={...V};if(typeof W.position==="string")W.position=[W.position];let X={...a,...W},Z=i(Q),$=o(Z),j=r($,X);return{title:X.title,items:j,config:X}}function BQ(Q,V={}){let W=e(Q,V);return(Array.isArray(V.position)?V.position:[V.position||"sidebar"]).map((Z)=>{let $;switch(Z){case"inline":$=C(W);break;case"sidebar":$=n(W);break;case"floating":$=t(W);break;default:$=_(W)}return{position:Z,data:W,html:$}})}function IQ(Q,V){let W=C(V);return Q.replace(/\[\[toc\]\]/gi,W)}function NQ(Q){let V=new Set;return Q.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(W,X,Z)=>{let $=w(Z.replace(/<[^>]*>/g,""),V);return`<h${X} id="${$}"><a href="#${$}" class="heading-anchor">#</a>${Z}</h${X}>`})}function MQ(){return`
1162
1236
  .table-of-contents {
1163
1237
  position: sticky;
1164
1238
  top: 60px; /* Match navbar height */
@@ -1288,7 +1362,7 @@ html {
1288
1362
  max-width: 250px;
1289
1363
  }
1290
1364
  }
1291
- `}function MQ(Q={}){let V=Q.smoothScroll!==!1,W=Q.activeHighlight!==!1,X=Q.collapsible!==!1;return`
1365
+ `}function RQ(Q={}){let V=Q.smoothScroll!==!1,W=Q.activeHighlight!==!1,X=Q.collapsible!==!1;return`
1292
1366
  function initToc() {
1293
1367
  const tocLinks = document.querySelectorAll('.toc-link')
1294
1368
 
@@ -1390,7 +1464,7 @@ if (document.readyState === 'loading') {
1390
1464
  else {
1391
1465
  initToc()
1392
1466
  }
1393
- `}var{Glob:S,YAML:e}=globalThis.Bun;import{join as QQ}from"path";var DQ="/search-index.json",R={include:["**/*.md"],exclude:["public/**","**/node_modules/**"],searchFields:["title","content","headings","keywords"],maxResults:10,minQueryLength:1,fuzzy:!1,fuzziness:1,stemmer:"none",maxContentLength:800,boost:{title:10,headings:5,content:1}};function f(Q){let V=Q?.options??{};return{...R,...V,include:V.include??R.include,exclude:V.exclude??R.exclude,searchFields:V.searchFields??R.searchFields,maxResults:V.maxResults??Q?.maxResults??R.maxResults,boost:{...R.boost,...V.boost??{}}}}var x=[{key:"k",meta:!0,ctrl:!1,alt:!1,shift:!1},{key:"k",meta:!1,ctrl:!0,alt:!1,shift:!1},{key:"/",meta:!1,ctrl:!1,alt:!1,shift:!1}];function VQ(Q){if(!Q)return x;let V=(Array.isArray(Q)?Q:[Q]).map((Z)=>String(Z).toLowerCase()),W={meta:!1,ctrl:!1,alt:!1,shift:!1},X="";for(let Z of V)if(Z==="meta"||Z==="cmd"||Z==="command")W.meta=!0;else if(Z==="ctrl"||Z==="control")W.ctrl=!0;else if(Z==="alt"||Z==="option")W.alt=!0;else if(Z==="shift")W.shift=!0;else X=Z;if(!X)return x;return[{key:X,...W}]}function v(Q){if(typeof Q!=="function")return null;let V=Function.prototype.toString.call(Q);return V.includes("[native code]")?null:V}function OQ(Q,V){let W=Q?.search??Q?.markdown?.search,X=f(W),Z=W?.resultOptions??{};return{indexUrl:V,placeholder:W?.placeholder??"Search documentation",lazy:W?.lazy!==!1,maxResults:X.maxResults,minQueryLength:X.minQueryLength,searchFields:X.searchFields,boost:{title:X.boost.title??10,headings:X.boost.headings??5,content:X.boost.content??1},fuzzy:X.fuzzy,fuzziness:X.fuzziness,stemmer:X.stemmer,shortcuts:{keyboard:W?.keyboardShortcuts!==!1,keys:VQ(W?.shortcut)},result:{showDescription:Z.showDescription!==!1,descriptionLength:Z.descriptionLength??180,highlightMatches:Z.highlightMatches!==!1,showPath:Z.showPath!==!1},tokenizeSource:v(W?.options?.tokenize),onSearchSource:v(W?.onSearch),locale:null}}function k(Q){return w(Q).replace(/^:::.*$/gm," ").replace(/^\s{0,3}>\s*\[!(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/gim," ").replace(/<[^>]+>/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~]{1,3}([^*_~]+)[*_~]{1,3}/g,"$1").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm," ").replace(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/gm," ").replace(/\|/g," ").replace(/\s+/g," ").trim()}function WQ(Q){let V=Q.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!V)return{body:Q,data:{}};let W={};try{W=e.parse(V[1])??{}}catch{W={}}return{body:Q.slice(V[0].length),data:W}}function XQ(Q){let V=Q.replace(/\.md$/,"");if(V==="index")return"/";if(V.endsWith("/index"))return`/${V.slice(0,-6)}`;return`/${V}`}function ZQ(Q,V,W){let{body:X,data:Z}=WQ(V);if(Z.search===!1)return[];if(Z.layout==="home")return[];let $=typeof Z.search==="object"&&Z.search!==null?Z.search:{},j=Array.isArray($.keywords)?$.keywords.map(String):[],J=XQ(Q),Y=X.split(`
1467
+ `}var{Glob:S,YAML:QQ}=globalThis.Bun;import{join as VQ}from"path";var AQ="/search-index.json",R={include:["**/*.md"],exclude:["public/**","**/node_modules/**"],searchFields:["title","content","headings","keywords"],maxResults:10,minQueryLength:1,fuzzy:!1,fuzziness:1,stemmer:"none",maxContentLength:800,boost:{title:10,headings:5,content:1}};function f(Q){let V=Q?.options??{};return{...R,...V,include:V.include??R.include,exclude:V.exclude??R.exclude,searchFields:V.searchFields??R.searchFields,maxResults:V.maxResults??Q?.maxResults??R.maxResults,boost:{...R.boost,...V.boost??{}}}}var x=[{key:"k",meta:!0,ctrl:!1,alt:!1,shift:!1},{key:"k",meta:!1,ctrl:!0,alt:!1,shift:!1},{key:"/",meta:!1,ctrl:!1,alt:!1,shift:!1}];function WQ(Q){if(!Q)return x;let V=(Array.isArray(Q)?Q:[Q]).map((Z)=>String(Z).toLowerCase()),W={meta:!1,ctrl:!1,alt:!1,shift:!1},X="";for(let Z of V)if(Z==="meta"||Z==="cmd"||Z==="command")W.meta=!0;else if(Z==="ctrl"||Z==="control")W.ctrl=!0;else if(Z==="alt"||Z==="option")W.alt=!0;else if(Z==="shift")W.shift=!0;else X=Z;if(!X)return x;return[{key:X,...W}]}function v(Q){if(typeof Q!=="function")return null;let V=Function.prototype.toString.call(Q);return V.includes("[native code]")?null:V}function OQ(Q,V){let W=Q?.search??Q?.markdown?.search,X=f(W),Z=W?.resultOptions??{};return{indexUrl:V,placeholder:W?.placeholder??"Search documentation",lazy:W?.lazy!==!1,maxResults:X.maxResults,minQueryLength:X.minQueryLength,searchFields:X.searchFields,boost:{title:X.boost.title??10,headings:X.boost.headings??5,content:X.boost.content??1},fuzzy:X.fuzzy,fuzziness:X.fuzziness,stemmer:X.stemmer,shortcuts:{keyboard:W?.keyboardShortcuts!==!1,keys:WQ(W?.shortcut)},result:{showDescription:Z.showDescription!==!1,descriptionLength:Z.descriptionLength??180,highlightMatches:Z.highlightMatches!==!1,showPath:Z.showPath!==!1},tokenizeSource:v(W?.options?.tokenize),onSearchSource:v(W?.onSearch),locale:null}}function k(Q){return P(Q).replace(/^:::.*$/gm," ").replace(/^\s{0,3}>\s*\[!(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/gim," ").replace(/<[^>]+>/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~]{1,3}([^*_~]+)[*_~]{1,3}/g,"$1").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm," ").replace(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/gm," ").replace(/\|/g," ").replace(/\s+/g," ").trim()}function XQ(Q){let V=Q.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!V)return{body:Q,data:{}};let W={};try{W=QQ.parse(V[1])??{}}catch{W={}}return{body:Q.slice(V[0].length),data:W}}function ZQ(Q){let V=Q.replace(/\.md$/,"");if(V==="index")return"/";if(V.endsWith("/index"))return`/${V.slice(0,-6)}`;return`/${V}`}function $Q(Q,V,W){let{body:X,data:Z}=XQ(V);if(Z.search===!1)return[];if(Z.layout==="home")return[];let $=typeof Z.search==="object"&&Z.search!==null?Z.search:{},j=Array.isArray($.keywords)?$.keywords.map(String):[],J=ZQ(Q),Y=X.split(`
1394
1468
  `),q=X.match(/^#\s+(.+)$/m),G=$.title||Z.title||(q?q[1].trim():J),z=[],I=new Set,K={title:G,anchor:"",level:1,buffer:[]},M=()=>{let B=k(K.buffer.join(`
1395
- `)).slice(0,W.maxContentLength);if(!B&&!K.title)return;let N={url:K.anchor?`${J}#${K.anchor}`:J,page:G,title:k(K.title)||G,text:B,level:K.level};if(j.length)N.keywords=j;z.push(N)},U=E();for(let B of Y){let N=U(B)?null:B.match(/^(#{1,6})\s+(.+?)\s*$/);if(!N){K.buffer.push(B);continue}let b=N[1].length,H=N[2].replace(/\s*\{#([\w-]+)\}\s*$/,""),F=N[2].match(/\{#([\w-]+)\}\s*$/),p=O(F?F[1]:D(y(H)),I);if(b===1){K.buffer.push("");continue}M(),K={title:H,anchor:p,level:b,buffer:[]}}return M(),z.filter((B)=>B.text||B.level>1)}function $Q(Q,V){let{storeFields:W}=V;if(!W||!W.length)return Q;let X=new Set(["url",...W]);if(V.searchFields.includes("title"))X.add("title");if(V.searchFields.includes("content"))X.add("text");if(V.searchFields.includes("headings"))X.add("page");if(V.searchFields.includes("keywords"))X.add("keywords");return Q.map((Z)=>{let $={};for(let[j,J]of Object.entries(Z))if(X.has(j)&&J!==void 0)$[j]=J;return $})}function T(Q){return Q.split("#")[0]}function jQ(Q,V){if(!V.enabled)return{locale:V.defaultLocale,page:Q};let W=Q.split("/");if(W.length>1&&V.locales.includes(W[0])&&W[0]!==V.defaultLocale)return{locale:W[0],page:W.slice(1).join("/")};let X=Q.match(/^(.*)\.([A-Za-z-]+)(\.md)$/);if(X&&V.locales.includes(X[2]))return{locale:X[2],page:`${X[1]}${X[3]}`};return{locale:V.defaultLocale,page:Q}}async function AQ(Q,V){let W=V?.search??V?.markdown?.search,X=f(W),Z=m(V),$=X.exclude.map((q)=>new S(q)),j=[],J=new Set,Y=new Map;for(let q of Z.locales)Y.set(q,new Set);for(let q of X.include){let G=new S(q);for await(let z of G.scan(Q)){let I=z.replace(/\\/g,"/");if(J.has(I))continue;if($.some((K)=>K.match(I)))continue;J.add(I);try{let K=await Bun.file(QQ(Q,I)).text(),{locale:M,page:U}=jQ(I,Z);for(let B of ZQ(U,K,X)){if(Z.enabled)B.locale=M,B.url=A(Z,M,B.url);j.push(B),Y.get(M)?.add(T(B.url))}}catch{}}}if(Z.enabled){let q=j.filter((G)=>G.locale===Z.defaultLocale);for(let G of Z.locales){if(G===Z.defaultLocale)continue;let z=Y.get(G)??new Set;for(let I of q){let K=A(Z,G,I.url);if(z.has(T(K)))continue;j.push({...I,url:K,locale:G})}}}return $Q(j,X)}
1396
- export{h as A,g as B,d as C,YQ as D,w as E,KQ as F,s as G,y as H,D as I,O as J,P as K,a as L,i as M,o as N,_ as O,C as P,r as Q,n as R,t as S,zQ as T,BQ as U,IQ as V,NQ as W,MQ as X,DQ as Y,OQ as Z,AQ as _};
1469
+ `)).slice(0,W.maxContentLength);if(!B&&!K.title)return;let N={url:K.anchor?`${J}#${K.anchor}`:J,page:G,title:k(K.title)||G,text:B,level:K.level};if(j.length)N.keywords=j;z.push(N)},U=E();for(let B of Y){let N=U(B)?null:B.match(/^(#{1,6})\s+(.+?)\s*$/);if(!N){K.buffer.push(B);continue}let b=N[1].length,H=N[2].replace(/\s*\{#([\w-]+)\}\s*$/,""),F=N[2].match(/\{#([\w-]+)\}\s*$/),p=A(F?F[1]:D(y(H)),I);if(b===1){K.buffer.push("");continue}M(),K={title:H,anchor:p,level:b,buffer:[]}}return M(),z.filter((B)=>B.text||B.level>1)}function jQ(Q,V){let{storeFields:W}=V;if(!W||!W.length)return Q;let X=new Set(["url",...W]);if(V.searchFields.includes("title"))X.add("title");if(V.searchFields.includes("content"))X.add("text");if(V.searchFields.includes("headings"))X.add("page");if(V.searchFields.includes("keywords"))X.add("keywords");return Q.map((Z)=>{let $={};for(let[j,J]of Object.entries(Z))if(X.has(j)&&J!==void 0)$[j]=J;return $})}function T(Q){return Q.split("#")[0]}function JQ(Q,V){if(!V.enabled)return{locale:V.defaultLocale,page:Q};let W=Q.split("/");if(W.length>1&&V.locales.includes(W[0])&&W[0]!==V.defaultLocale)return{locale:W[0],page:W.slice(1).join("/")};let X=Q.match(/^(.*)\.([A-Za-z-]+)(\.md)$/);if(X&&V.locales.includes(X[2]))return{locale:X[2],page:`${X[1]}${X[3]}`};return{locale:V.defaultLocale,page:Q}}async function HQ(Q,V){let W=V?.search??V?.markdown?.search,X=f(W),Z=m(V),$=X.exclude.map((q)=>new S(q)),j=[],J=new Set,Y=new Map;for(let q of Z.locales)Y.set(q,new Set);for(let q of X.include){let G=new S(q);for await(let z of G.scan(Q)){let I=z.replace(/\\/g,"/");if(J.has(I))continue;if($.some((K)=>K.match(I)))continue;J.add(I);try{let K=await Bun.file(VQ(Q,I)).text(),{locale:M,page:U}=JQ(I,Z);for(let B of $Q(U,K,X)){if(Z.enabled)B.locale=M,B.url=O(Z,M,B.url);j.push(B),Y.get(M)?.add(T(B.url))}}catch{}}}if(Z.enabled){let q=j.filter((G)=>G.locale===Z.defaultLocale);for(let G of Z.locales){if(G===Z.defaultLocale)continue;let z=Y.get(G)??new Set;for(let I of q){let K=O(Z,G,I.url);if(z.has(T(K)))continue;j.push({...I,url:K,locale:G})}}}return jQ(j,X)}
1470
+ export{h as B,g as C,c as D,GQ as E,P as F,qQ as G,a as H,y as I,D as J,A as K,w as L,i as M,o as N,r as O,_ as P,C as Q,n as R,t as S,e as T,BQ as U,IQ as V,NQ as W,MQ as X,RQ as Y,AQ as Z,OQ as _,HQ as $};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{aa as a,ba as b,ca as c,da as d,ea as e,fa as f,ga as g,ha as h,ia as i}from"./chunk-em1tv2bw.js";export{c as splitLocaleFromPath,a as resolveI18nConfig,d as localizeUrl,g as localeLabel,e as localeContentCandidates,b as loadI18nTranslations,i as generateLocaleDetectionScript,h as generateHreflangTags,f as configForLocale};
2
+ import{ba as a,ca as b,da as c,ea as d,fa as e,ga as f,ha as g,ia as h,ja as i}from"./chunk-3f29kjd8.js";export{c as splitLocaleFromPath,a as resolveI18nConfig,d as localizeUrl,g as localeLabel,e as localeContentCandidates,b as loadI18nTranslations,i as generateLocaleDetectionScript,h as generateHreflangTags,f as configForLocale};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{o as $,p as I,q as f,r as h,u as x}from"./chunk-qqn901qf.js";import"./chunk-qzhr4d2q.js";import{C as _}from"./chunk-zkdm5pr7.js";import"./chunk-em1tv2bw.js";import{join as D}from"path";var E="@stacksjs/ts-cloud";async function Y(){try{return await import(E)}catch(j){throw Error(`Deploying requires @stacksjs/ts-cloud, which is an optional dependency.
2
+ import{p as $,q as I,r as f,s as h,v as x}from"./chunk-8b52ry67.js";import"./chunk-5cxb3t2e.js";import{D as _}from"./chunk-he00q0q4.js";import"./chunk-3f29kjd8.js";import{join as D}from"path";var E="@stacksjs/ts-cloud";async function Y(){try{return await import(E)}catch(j){throw Error(`Deploying requires @stacksjs/ts-cloud, which is an optional dependency.
3
3
  Install it with: bun add -d @stacksjs/ts-cloud
4
4
  Original error: ${j instanceof Error?j.message:String(j)}`)}}function W(j,A){let k=A||j?.provider;if(!k||k==="route53")return null;if(k==="porkbun"){let m=j?.apiKey||process.env.PORKBUN_API_KEY,w=j?.secretKey||process.env.PORKBUN_SECRET_KEY;if(!m||!w)throw Error("Porkbun API credentials not found. Set PORKBUN_API_KEY and PORKBUN_SECRET_KEY environment variables, or configure them in bunpress.config.ts under cloud.dnsProvider");return{provider:"porkbun",apiKey:m,secretKey:w}}if(k==="godaddy"){let m=j?.apiKey||process.env.GODADDY_API_KEY,w=j?.secretKey||process.env.GODADDY_API_SECRET,J=j?.environment||process.env.GODADDY_ENVIRONMENT;if(!m||!w)throw Error("GoDaddy API credentials not found. Set GODADDY_API_KEY and GODADDY_API_SECRET environment variables, or configure them in bunpress.config.ts under cloud.dnsProvider");return{provider:"godaddy",apiKey:m,apiSecret:w,environment:J}}throw Error(`Unknown DNS provider: ${k}. Supported: porkbun, godaddy, route53`)}async function F(j={}){let A=await _,k=A.cloud||{},m=j.verbose??A.verbose??!1,w=j.region||k.region||"us-east-1",J=j.domain||k.domain,M=j.subdomain||k.subdomain,N=j.baseDomain||k.baseDomain,O=j.bucket||k.bucket,P=j.stackName||k.stackName,U=j.hostedZoneId||k.hostedZoneId,Q=j.certificateArn||k.certificateArn,V=k.cacheControl||"max-age=31536000, public",B;if(J)B=J;else if(M&&N)B=`${M}.${N}`;let K=B?.replace(/\./g,"-")||"bunpress-site",G=null;try{G=W(k.dnsProvider,j.dnsProvider)}catch(H){return I(H.message),!1}let L=G!==null;if(j.dryRun){if(f("Dry run mode - no changes will be made"),console.log(`
5
5
  Configuration:`),console.log(` Region: ${w}`),console.log(` Site Name: ${K}`),console.log(` Bucket: ${O||"auto-generated"}`),console.log(` Domain: ${B||"not specified"}`),console.log(` Stack Name: ${P||`${K}-static-site`}`),console.log(` DNS Provider: ${G?.provider||"route53 (AWS)"}`),!L)console.log(` Hosted Zone ID: ${U||"auto-detected"}`);return console.log(` Certificate ARN: ${Q||"auto-created"}`),!0}if(!process.env.AWS_ACCESS_KEY_ID||!process.env.AWS_SECRET_ACCESS_KEY)return I("AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables."),!1;let z=new h("Building documentation...");try{if(!m)z.start();if(!await x({verbose:m})){if(!m)z.fail("Build failed");return!1}if(!m)z.succeed("Documentation built successfully");let C=A.outDir||"./dist",X=D(C,".bunpress");if(!m)z.text="Deploying infrastructure with CloudFormation...",z.start();else if(console.log(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{i as a,j as b,k as c,l as d,m as e,n as f}from"./chunk-kfbpnqaw.js";import"./chunk-zkdm5pr7.js";import"./chunk-em1tv2bw.js";export{c as wrapInLayout,b as stripConfiguredBasePath,e as startServer,f as serveCLI,d as markdownToHtml,a as getConfiguredBasePath};
2
+ import{j as a,k as b,l as c,m as d,n as e,o as f}from"./chunk-2vne40yj.js";import"./chunk-he00q0q4.js";import"./chunk-3f29kjd8.js";export{c as wrapInLayout,b as stripConfiguredBasePath,e as startServer,f as serveCLI,d as markdownToHtml,a as getConfiguredBasePath};
@@ -3,6 +3,7 @@ import type { Highlighter as TSHighlighter } from 'ts-syntax-highlighter';
3
3
  * Reset the global highlighter instance (useful when changing themes)
4
4
  */
5
5
  export declare function resetHighlighter(): void;
6
+ export declare function setLanguageAliases(aliases: Record<string, string> | undefined): void;
6
7
  /**
7
8
  * Normalizes a language identifier to its canonical id.
8
9
  * Unknown identifiers are returned as-is so the caller can report them.
package/dist/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{a as W,b as X,c as Y,d as Z,e as _,f as $,g as b,h as v,i as wj,j as zj,k as Bj,l as Dj,m as Ej,n as Gj}from"../chunk-kfbpnqaw.js";import{v as j,w as k,x as q,y as u,z as w}from"../chunk-qzhr4d2q.js";import{A as Q,B as S,C as T,D as V,G as y,H as p,I as f,J as c,K as d,L as g,M as a,N as n,O as o,P as r,Q as t,R as i,S as s,T as e,U as jj,V as kj,W as qj,X as uj,Y as z,Z as B,_ as D}from"../chunk-zkdm5pr7.js";import{aa as A,ba as F,ca as R,da as U,ea as m,fa as x,ga as C,ha as l,ia as h}from"../chunk-em1tv2bw.js";export{Bj as wrapInLayout,zj as stripConfiguredBasePath,Ej as startServer,R as splitLocaleFromPath,Gj as serveCLI,A as resolveI18nConfig,W as resetHighlighter,c as reserveUniqueSlug,jj as processInlineTocSyntax,b as prewarmHighlighter,X as normalizeLanguage,Dj as markdownToHtml,p as markdownHeadingText,U as localizeUrl,C as localeLabel,m as localeContentCandidates,F as loadI18nTranslations,Y as isLanguageSupported,_ as highlightCodeSync,Z as highlightCode,$ as getSyntaxHighlightingStyles,v as getHighlighterInstance,wj as getConfiguredBasePath,V as getConfig,d as generateUniqueSlug,qj as generateTocStyles,uj as generateTocScripts,e as generateTocPositions,o as generateTocHtml,s as generateTocData,f as generateSlug,w as generateSitemap,t as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,h as generateLocaleDetectionScript,r as generateInlineTocHtml,l as generateHreflangTags,i as generateFloatingTocHtml,n as filterHeadings,g as extractHeadings,kj as enhanceHeadingsWithAnchors,y as defaultTocConfig,Q as defaultConfig,x as configForLocale,T as config,a as buildTocHierarchy,u as buildSitemap,B as buildSearchRuntimeConfig,D as buildSearchIndex,j as buildRssFeed,S as applyConfigPlugins,z as SEARCH_INDEX_PATH};
2
+ import{a as W,b as X,c as Y,d as Z,e as _,f as $,g as b,h as v,i as A,j as zj,k as Bj,l as Dj,m as Ej,n as Gj,o as Hj}from"../chunk-2vne40yj.js";import{A as w,w as j,x as k,y as q,z as u}from"../chunk-5cxb3t2e.js";import{$ as D,B as Q,C as S,D as T,E as V,H as p,I as f,J as c,K as d,L as g,M as a,N as n,O as o,P as r,Q as t,R as i,S as s,T as e,U as jj,V as kj,W as qj,X as uj,Y as wj,Z as z,_ as B}from"../chunk-he00q0q4.js";import{ba as F,ca as R,da as U,ea as m,fa as x,ga as C,ha as l,ia as h,ja as y}from"../chunk-3f29kjd8.js";export{Dj as wrapInLayout,Bj as stripConfiguredBasePath,Gj as startServer,U as splitLocaleFromPath,X as setLanguageAliases,Hj as serveCLI,F as resolveI18nConfig,W as resetHighlighter,d as reserveUniqueSlug,kj as processInlineTocSyntax,v as prewarmHighlighter,Y as normalizeLanguage,Ej as markdownToHtml,f as markdownHeadingText,m as localizeUrl,l as localeLabel,x as localeContentCandidates,R as loadI18nTranslations,Z as isLanguageSupported,$ as highlightCodeSync,_ as highlightCode,b as getSyntaxHighlightingStyles,A as getHighlighterInstance,zj as getConfiguredBasePath,V as getConfig,g as generateUniqueSlug,uj as generateTocStyles,wj as generateTocScripts,jj as generateTocPositions,r as generateTocHtml,e as generateTocData,c as generateSlug,w as generateSitemap,i as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,y as generateLocaleDetectionScript,t as generateInlineTocHtml,h as generateHreflangTags,s as generateFloatingTocHtml,o as filterHeadings,a as extractHeadings,qj as enhanceHeadingsWithAnchors,p as defaultTocConfig,Q as defaultConfig,C as configForLocale,T as config,n as buildTocHierarchy,u as buildSitemap,B as buildSearchRuntimeConfig,D as buildSearchIndex,j as buildRssFeed,S as applyConfigPlugins,z as SEARCH_INDEX_PATH};
@@ -68,6 +68,7 @@ export declare interface MarkdownPluginConfig {
68
68
  template?: string
69
69
  css?: string
70
70
  scripts?: string[]
71
+ languageAliases?: Record<string, string>
71
72
  title?: string
72
73
  meta?: Record<string, string>
73
74
  parserOptions?: {
@@ -99,14 +100,33 @@ export declare interface SidebarItem {
99
100
  collapsed?: boolean
100
101
  }
101
102
  /**
102
- * Navigation bar item
103
+ * Navigation bar item.
104
+ *
105
+ * An item with `items` renders a dropdown. The dropdown upgrades itself to a
106
+ * multi-column mega menu as soon as the content asks for one: when any child
107
+ * carries a `description`, when children are nested one level deeper into
108
+ * groups, or when `mega` is set explicitly. A flat list of bare links keeps
109
+ * rendering as the compact flyout it always did.
103
110
  */
104
111
  export declare interface NavItem {
105
112
  text: string
106
113
  link?: string
107
114
  icon?: string
115
+ description?: string
108
116
  items?: NavItem[]
109
117
  activeMatch?: string
118
+ mega?: boolean
119
+ columns?: number
120
+ footer?: NavItemFooter
121
+ }
122
+ /**
123
+ * Footer strip at the bottom of a mega-menu panel. Use it for the "see
124
+ * everything" link that would otherwise be one more item in a column.
125
+ */
126
+ export declare interface NavItemFooter {
127
+ text: string
128
+ link: string
129
+ note?: string
110
130
  }
111
131
  /**
112
132
  * Action link in hero section
@@ -116,6 +136,24 @@ export declare interface HeroAction {
116
136
  text: string
117
137
  link: string
118
138
  }
139
+ /**
140
+ * A code sample rendered as the hero's visual, highlighted by the same
141
+ * highlighter that renders markdown fences.
142
+ */
143
+ export declare interface HeroCode {
144
+ lang?: string
145
+ file?: string
146
+ content: string
147
+ }
148
+ /**
149
+ * Small link above the hero headline: a release note, a launch post, a
150
+ * "what changed" pointer.
151
+ */
152
+ export declare interface HeroAnnouncement {
153
+ text: string
154
+ link: string
155
+ tag?: string
156
+ }
119
157
  /**
120
158
  * Hero section configuration
121
159
  */
@@ -124,6 +162,8 @@ export declare interface Hero {
124
162
  text: string
125
163
  tagline?: string
126
164
  image?: string
165
+ code?: HeroCode | HeroCode[]
166
+ announcement?: HeroAnnouncement
127
167
  actions?: HeroAction[]
128
168
  }
129
169
  /**
@@ -133,6 +173,9 @@ export declare interface Feature {
133
173
  title: string
134
174
  icon?: string
135
175
  details: string
176
+ link?: string
177
+ linkText?: string
178
+ span?: number
136
179
  }
137
180
  /**
138
181
  * Frontmatter structure extracted from markdown files
@@ -1,6 +1,7 @@
1
1
  <div class="BPHomeHero">
2
2
  <div class="hero-container">
3
3
  <div class="hero-content">
4
+ {!! announcement !!}
4
5
  {!! name !!}
5
6
  {!! text !!}
6
7
  {!! tagline !!}
@@ -45,6 +46,15 @@
45
46
  height: auto;
46
47
  }
47
48
 
49
+ /* A code panel is a full column, not a logo slot: it stacks under the copy on
50
+ * narrow screens and takes the right half from 960px up. min-width:0 is what
51
+ * lets its own <pre> scroll instead of stretching the flex row. */
52
+ .hero-container > .BPHeroCode {
53
+ margin-top: 32px;
54
+ min-width: 0;
55
+ width: 100%;
56
+ }
57
+
48
58
  @media (min-width: 960px) {
49
59
  .BPHomeHero {
50
60
  padding: 56px 64px 72px;
@@ -52,6 +62,7 @@
52
62
 
53
63
  .hero-container {
54
64
  flex-direction: row;
65
+ align-items: center;
55
66
  text-align: left;
56
67
  gap: 64px;
57
68
  }
@@ -68,5 +79,16 @@
68
79
  .hero-image img {
69
80
  max-width: 280px;
70
81
  }
82
+
83
+ .hero-container > .BPHeroCode {
84
+ margin-top: 0;
85
+ flex: 0 1 46%;
86
+ }
87
+
88
+ /* Without a visual the copy is the whole hero, so it keeps its measure
89
+ * rather than running the full 1152px. */
90
+ .hero-container > .hero-content:only-child {
91
+ max-width: 780px;
92
+ }
71
93
  }
72
94
  </style>
@@ -22,8 +22,10 @@
22
22
  {!! localeSwitcher !!}
23
23
  {!! socialLinks !!}
24
24
  </div>
25
+ {!! navToggle !!}
25
26
  </div>
26
27
  </div>
28
+ {!! navScreen !!}
27
29
  </header>
28
30
 
29
31
  <style>