@stacksjs/bunpress 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{t as a,u as b,v as c}from"../chunk-9jjcffx1.js";import"../chunk-bxyvmqbx.js";import"../chunk-mp1mg7s9.js";import"../chunk-vyk71xvd.js";export{b as resolveConfig,a as findMarkdownFiles,c as buildDocs};
3
+ import{t as a,u as b,v as c}from"../chunk-yc9h0jst.js";import"../chunk-s7tcgrb6.js";import"../chunk-kvkhq8vp.js";import"../chunk-4r44z49z.js";export{b as resolveConfig,a as findMarkdownFiles,c as buildDocs};
@@ -0,0 +1,38 @@
1
+ // @bun
2
+ var j=import.meta.require;function X(q){return(q.sitemap?.baseUrl||q.url||"").replace(/\/$/,"")}var Y={"search.placeholder":"Search documentation","toc.title":"On this page","nav.menu":"Menu","search.noResults":"No results for","theme.toggle":"Toggle dark mode"};function O(q){let B=q?.i18n,H=(B?.locales??[]).filter(Boolean),J=B?.defaultLocale||H[0]||q?.lang||"en",K=(B?.enabled??H.length>1)&&H.length>0;return{enabled:K,locales:K?H:[J],defaultLocale:J,fallbackLocale:B?.fallbackLocale??J,localePath:B?.localePath??"./locales",detectLocale:B?.detectLocale===!0,localeNames:B?.localeNames??{},localeConfig:B?.localeConfig??{},translate:(M)=>Y[M]??M}}async function A(q,B){if(!q.enabled)return q;try{let{createTranslator:H,loadTranslations:J}=await import("@stacksjs/ts-i18n"),K=await J({translationsDir:q.localePath,defaultLocale:q.defaultLocale,fallbackLocale:q.fallbackLocale,sources:B?.i18n?.sources??["ts","yaml","json"],optional:!0,verbose:!1}),M=H(K,{defaultLocale:q.defaultLocale,fallbackLocale:q.fallbackLocale}),V=new Set;for(let N of Object.values(K))for(let P of Object.keys(N??{}))V.add(P);let Z=[...V].sort((N,P)=>N==="theme"?-1:P==="theme"?1:N.localeCompare(P));return{...q,translate:(N,P,$)=>{for(let W of[N,...Z.map((Q)=>`${Q}.${N}`)])try{let Q=M(W,P,$);if(typeof Q==="string"&&Q&&Q!==W)return Q}catch{}return Y[N]??N}}}catch(H){return console.warn("[bunpress] i18n translations could not be loaded; falling back to defaults \u2014",H instanceof Error?H.message:H),q}}function E(q,B){if(!q.enabled)return{locale:q.defaultLocale,path:B};let H=B.match(/^\/([^/]+)(\/.*)?$/);if(H&&q.locales.includes(H[1])&&H[1]!==q.defaultLocale)return{locale:H[1],path:H[2]||"/"};return{locale:q.defaultLocale,path:B}}function x(q,B,H){if(!q.enabled||B===q.defaultLocale)return H||"/";return`/${B}${H==="/"?"":H}`||`/${B}`}function I(q,B,H,J){let K=J==="/"?"/index":J,M=[];if(q.enabled&&H!==q.defaultLocale)M.push(`${B}/${H}${K}.md`),M.push(`${B}/${H}${K}/index.md`),M.push(`${B}${K}.${H}.md`);if(M.push(`${B}${K}.md`),M.push(`${B}${K}/index.md`),q.enabled)M.push(`${B}${K}.${q.defaultLocale}.md`);return M}function _(q,B,H){let J=B.localeConfig[H];if(!J)return q;return{...q,...J,themeConfig:J.themeConfig?{...q.themeConfig,...J.themeConfig}:q.themeConfig,markdown:J.markdown?{...q.markdown,...J.markdown}:q.markdown}}function D(q,B){return q.localeNames[B]??B}function F(q,B,H){if(!q.enabled)return"";let J=X(B);if(!J)return"";let K=q.locales.map((M)=>{let V=`${J}${x(q,M,H==="/index"?"/":H)}`;return`<link rel="alternate" hreflang="${M}" href="${V}">`});return K.push(`<link rel="alternate" hreflang="x-default" href="${J}${H==="/index"?"/":H}">`),K.join(`
3
+ `)}function R(q){if(!q.enabled||!q.detectLocale)return"";return`
4
+ (function () {
5
+ var LOCALES = ${JSON.stringify(q.locales)};
6
+ var DEFAULT = ${JSON.stringify(q.defaultLocale)};
7
+ var KEY = 'bunpress-locale';
8
+
9
+ try {
10
+ var current = location.pathname.split('/')[1];
11
+ if (LOCALES.indexOf(current) !== -1) {
12
+ // Reading a non-default locale is itself a choice; remember it.
13
+ localStorage.setItem(KEY, current);
14
+ return;
15
+ }
16
+ if (localStorage.getItem(KEY)) return;
17
+
18
+ var preferred = (navigator.languages || [navigator.language || ''])
19
+ .map(function (tag) { return String(tag).toLowerCase(); });
20
+
21
+ for (var i = 0; i < preferred.length; i++) {
22
+ var tag = preferred[i];
23
+ var exact = LOCALES.indexOf(tag) !== -1 ? tag : null;
24
+ // 'en-GB' should match an 'en' locale.
25
+ var base = exact || (LOCALES.indexOf(tag.split('-')[0]) !== -1 ? tag.split('-')[0] : null);
26
+ if (base && base !== DEFAULT) {
27
+ localStorage.setItem(KEY, base);
28
+ location.replace(\`/\${base}\${location.pathname}\${location.search}\${location.hash}\`);
29
+ return;
30
+ }
31
+ if (base === DEFAULT) return;
32
+ }
33
+ } catch (_) {
34
+ // Storage or history unavailable: leave the reader where they are.
35
+ }
36
+ })();
37
+ `.trim()}
38
+ export{j as aa,X as ba,O as ca,A as da,E as ea,x as fa,I as ga,_ as ha,D as ia,F as ja,R as ka};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{j as a,k as b,l as c,m as d,n as e,o as f}from"./chunk-tjkfq43b.js";import"./chunk-mp1mg7s9.js";import"./chunk-vyk71xvd.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-c53y7rmn.js";import"./chunk-kvkhq8vp.js";import"./chunk-4r44z49z.js";export{c as wrapInLayout,b as stripConfiguredBasePath,e as startServer,f as serveCLI,d as markdownToHtml,a as getConfiguredBasePath};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$ as pQ,B as DQ,D as P,G as WJ,H as SQ,I as kQ,J as xJ,K as vJ,M as xQ,N as vQ,O as CQ,Q as bQ,Z as zJ,_ as fQ}from"./chunk-mp1mg7s9.js";import{aa as l,ba as r,ca as SJ,da as kJ,ea as TQ,fa as AQ,ga as LQ,ha as HQ,ia as yJ,ja as PQ,ka as yQ}from"./chunk-vyk71xvd.js";var{Glob:NQ,YAML:RQ}=globalThis.Bun;import{stat as MQ}from"fs/promises";import{join as KJ}from"path";import s from"process";var{Glob:QZ}=globalThis.Bun;import{join as dJ,resolve as ZZ}from"path";import $Z from"process";var e=new Map;function YZ(J,Z,Q){let Y=Z.split("."),$=J;for(let X=0;X<Y.length-1;X++){let q=Y[X];if(typeof $[q]!=="object"||$[q]===null)$[q]={};$=$[q]}$[Y[Y.length-1]]=Q}async function mJ(J,Z){let Q=Z?ZZ($Z.cwd(),Z):dJ(J,".data");if(e.has(Q))return e.get(Q);let Y={};try{let $=new QZ("**/*.json");for await(let X of $.scan({cwd:Q,absolute:!1}))try{let q=await Bun.file(dJ(Q,X)).text(),W=X.replace(/\.json$/,"").replace(/[/\\]/g,".");YZ(Y,W,JSON.parse(q))}catch{}}catch{}return e.set(Q,Y),Y}function cJ(){e.clear()}import{createHighlighter as XZ,highlight as qZ,listLanguages as WZ}from"ts-syntax-highlighter";var d=null;function x0(){d=null}async function lJ(){if(d)return d;return d=await XZ({theme:"github-light",cache:!0}),d}var wJ=null;function sJ(){if(wJ)return wJ;let J=new Map;try{for(let Z of WZ()){J.set(Z.id.toLowerCase(),Z.id);for(let Q of Z.aliases??[])J.set(Q.toLowerCase(),Z.id)}}catch{}return wJ=J,J}var JJ={};function rJ(J){JJ={};for(let[Z,Q]of Object.entries(J??{}))JJ[Z.toLowerCase().trim()]=Q.toLowerCase().trim()}function iJ(J){let Z=J.toLowerCase().trim(),Q=JJ[Z]??Z;return sJ().get(Q)??Q}function oJ(J){let Z=J.toLowerCase().trim();return sJ().has(JJ[Z]??Z)}function QJ(J){return J.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function zZ(J,Z){let Q=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,Y=[],$;while(($=Q.exec(Z))!==null){let W=$[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;/g,"'");if(W)Y.push({text:W,span:$[0]})}if(Y.length===0)return Z;let X="",q=0;for(let W=0;W<Y.length;W++){let{text:K,span:V}=Y[W],z=J.indexOf(K,q);if(z===-1){X+=V;continue}if(z>q){let _=J.substring(q,z);if(/^\s+$/.test(_))X+=_}X+=V,q=z+K.length}return X}async function ZJ(J,Z,Q="github-light"){let Y=iJ(Z);if(!oJ(Y))return J.split(`
2
+ import{$ as pQ,B as DQ,D as P,G as WJ,H as SQ,I as kQ,J as xJ,K as vJ,M as xQ,N as vQ,O as CQ,Q as bQ,Z as zJ,_ as fQ}from"./chunk-kvkhq8vp.js";import{aa as l,ba as r,ca as SJ,da as kJ,ea as TQ,fa as AQ,ga as LQ,ha as HQ,ia as yJ,ja as PQ,ka as yQ}from"./chunk-4r44z49z.js";var{Glob:NQ,YAML:RQ}=globalThis.Bun;import{stat as MQ}from"fs/promises";import{join as KJ}from"path";import s from"process";var{Glob:QZ}=globalThis.Bun;import{join as dJ,resolve as ZZ}from"path";import $Z from"process";var e=new Map;function YZ(J,Z,Q){let Y=Z.split("."),$=J;for(let X=0;X<Y.length-1;X++){let q=Y[X];if(typeof $[q]!=="object"||$[q]===null)$[q]={};$=$[q]}$[Y[Y.length-1]]=Q}async function mJ(J,Z){let Q=Z?ZZ($Z.cwd(),Z):dJ(J,".data");if(e.has(Q))return e.get(Q);let Y={};try{let $=new QZ("**/*.json");for await(let X of $.scan({cwd:Q,absolute:!1}))try{let q=await Bun.file(dJ(Q,X)).text(),W=X.replace(/\.json$/,"").replace(/[/\\]/g,".");YZ(Y,W,JSON.parse(q))}catch{}}catch{}return e.set(Q,Y),Y}function cJ(){e.clear()}import{createHighlighter as XZ,highlight as qZ,listLanguages as WZ}from"ts-syntax-highlighter";var d=null;function x0(){d=null}async function lJ(){if(d)return d;return d=await XZ({theme:"github-light",cache:!0}),d}var wJ=null;function sJ(){if(wJ)return wJ;let J=new Map;try{for(let Z of WZ()){J.set(Z.id.toLowerCase(),Z.id);for(let Q of Z.aliases??[])J.set(Q.toLowerCase(),Z.id)}}catch{}return wJ=J,J}var JJ={};function rJ(J){JJ={};for(let[Z,Q]of Object.entries(J??{}))JJ[Z.toLowerCase().trim()]=Q.toLowerCase().trim()}function iJ(J){let Z=J.toLowerCase().trim(),Q=JJ[Z]??Z;return sJ().get(Q)??Q}function oJ(J){let Z=J.toLowerCase().trim();return sJ().has(JJ[Z]??Z)}function QJ(J){return J.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function zZ(J,Z){let Q=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,Y=[],$;while(($=Q.exec(Z))!==null){let W=$[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;/g,"'");if(W)Y.push({text:W,span:$[0]})}if(Y.length===0)return Z;let X="",q=0;for(let W=0;W<Y.length;W++){let{text:K,span:V}=Y[W],z=J.indexOf(K,q);if(z===-1){X+=V;continue}if(z>q){let _=J.substring(q,z);if(/^\s+$/.test(_))X+=_}X+=V,q=z+K.length}return X}async function ZJ(J,Z,Q="github-light"){let Y=iJ(Z);if(!oJ(Y))return J.split(`
3
3
  `).map((X)=>`<span class="line">${QJ(X)}</span>`).join(`
4
4
  `);try{let $=J.split(`
5
5
  `);return(await Promise.all($.map(async(q)=>{if(!q.trim())return`<span class="line">${q}</span>`;let K=(await qZ(q,Y,{theme:Q})).html;if(K=K.replace(/<div[^>]*class="syntax-wrapper"[^>]*>/g,""),K=K.replace(/<\/div>\s*$/g,""),K=K.replace(/<pre[^>]*>/g,""),K=K.replace(/<\/pre>/g,""),K=K.replace(/<code[^>]*>/g,""),K=K.replace(/<\/code>/g,""),K=zZ(q,K.trim()),!K.startsWith('<span class="line">'))K=`<span class="line">${K}</span>`;return K}))).join(`
@@ -21,12 +21,16 @@ pre:not([data-lang]):not([class*='language-']) {
21
21
  }
22
22
 
23
23
  /* Code is scrolled, never wrapped: wrapping mid-token destroys indentation
24
- * and makes line highlighting/diff markers line up with the wrong rows. */
24
+ * and makes line highlighting/diff markers line up with the wrong rows. And it
25
+ * is never centred or justified: a code block nested in a centred container
26
+ * (ASCII art in \`<div align="center">\`, say) would otherwise have each line
27
+ * centred on its own, which is exactly what the alignment was carrying. */
25
28
  pre code {
26
29
  font-family: var(--bp-font-family-mono, 'Consolas', 'Monaco', 'Courier New', monospace);
27
30
  line-height: 1.6;
28
31
  color: inherit;
29
32
  white-space: pre;
33
+ text-align: left;
30
34
  }
31
35
 
32
36
  /* Token spans inherit color from parent or use their inline styles */
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{p as $,q as I,r as f,s as h,v as x}from"./chunk-9jjcffx1.js";import"./chunk-bxyvmqbx.js";import{D as _}from"./chunk-mp1mg7s9.js";import"./chunk-vyk71xvd.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-yc9h0jst.js";import"./chunk-s7tcgrb6.js";import{D as _}from"./chunk-kvkhq8vp.js";import"./chunk-4r44z49z.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;if(k.driver&&k.driver!=="aws")return I(`Unsupported cloud driver: ${k.driver}. Only 'aws' is implemented.`),!1;let 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,5 +1,5 @@
1
1
  // @bun
2
- import{ca as m,fa as O}from"./chunk-vyk71xvd.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{ca as m,fa as D}from"./chunk-4r44z49z.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
 
@@ -53,6 +53,10 @@ import{ca as m,fa as O}from"./chunk-vyk71xvd.js";import{loadConfig as u}from"bun
53
53
  .bp-doc pre {
54
54
  position: relative;
55
55
  background-color: #f6f6f7 !important;
56
+ /* The panel owns the foreground and the code element inherits it. Set
57
+ * here rather than on the code element so a theme that repaints the
58
+ * panel repaints the text along with it. */
59
+ color: #24292f;
56
60
  border-radius: 8px;
57
61
  margin: 16px 0;
58
62
  overflow-x: auto;
@@ -68,9 +72,19 @@ import{ca as m,fa as O}from"./chunk-vyk71xvd.js";import{loadConfig as u}from"bun
68
72
  background: transparent !important;
69
73
  font-size: 14px;
70
74
  line-height: 1.7;
71
- color: #24292f;
75
+ /* Inherited from the panel, not hard-coded: a theme is free to paint code
76
+ * blocks dark in BOTH colour modes, and this rule used to force the
77
+ * light-mode foreground on top of that. Highlighted blocks survived it
78
+ * because every token carries an inline colour \u2014 but a fence with no
79
+ * language has no tokens, so #24292f landed on a dark panel and the code
80
+ * became near-black on near-black. */
81
+ color: inherit;
72
82
  /* Scroll, never wrap: wrapped code loses its indentation. */
73
83
  white-space: pre;
84
+ /* Code is never centred or justified, whatever it is nested in. ASCII art
85
+ * inside <div align="center"> was having every line centred individually,
86
+ * which destroys the alignment that makes it art. */
87
+ text-align: left;
74
88
  /* fit-content + min-width lets a long line extend the scroll width. */
75
89
  width: fit-content;
76
90
  min-width: 100%;
@@ -84,8 +98,10 @@ import{ca as m,fa as O}from"./chunk-vyk71xvd.js";import{loadConfig as u}from"bun
84
98
  background-color: #161618 !important;
85
99
  }
86
100
 
87
- html.dark pre code,
88
- html.dark pre[data-lang] code {
101
+ html.dark pre,
102
+ html.dark pre[data-lang],
103
+ html.dark article pre,
104
+ html.dark .bp-doc pre {
89
105
  color: #e6edf3;
90
106
  }
91
107
 
@@ -1220,19 +1236,19 @@ if (typeof document !== 'undefined') {
1220
1236
  }
1221
1237
  });
1222
1238
  }
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(`
1239
+ `],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 c(V.length>0)}async function c(Q){let V=["docs","documentation","site"],W=["bunpress.config.ts","bunpress.config.js","docs.config.ts"];for(let X of V)for(let Z of W){let $=`${X}/${Z}`;if(!await Bun.file($).exists())continue;let j=Q?`merge it into the config at the project root, or pass --config ${$}`:`move it to ./${Z}, or pass --config ${$}`;console.warn(`[bunpress] ${$} is never loaded: config is discovered from the working directory, not the docs directory. To use it, ${j}.`);return}}await d();var l=g(await u({name:"bunpress",alias:"docs",defaultConfig:h}));async function KQ(){return l}function U(){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=U();return Q.split(`
1224
1240
  `).filter((W)=>!V(W)).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(`
1241
+ `)}function L(Q){return`\x00BPCODE${Q}\x00`}var s=/\u0000BPCODE(\d+)\u0000/g;function i(Q){let V=[],W=U(),X=[],Z=null,$=()=>{if(!Z)return;V.push(Z.join(`
1226
1242
  `)),X.push(L(V.length-1)),Z=null};for(let j of Q.split(`
1227
1243
  `)){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(`
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}">
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}">
1230
- <a href="#${z.id}" class="toc-link" title="${z.text.replace(/<[^>]*>/g,"")}">${B}</a>
1231
- ${M}
1244
+ `),restore:(j)=>j.replace(s,(J,G)=>V[Number(G)]??J)}}async function zQ(Q,V){let{masked:W,restore:X}=i(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 b(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(b(Q),V)}function o(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 G=J.includes("<code>"),z=w(y(j),W);V.push({level:$,text:J,id:z,children:[],hasCode:G})}return V}function r(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 n(Q,V){let{minDepth:W=2,maxDepth:X=6,exclude:Z=[]}=V,$=(j)=>{let J=[];for(let G of j){if(Z.some((K)=>{if(K.startsWith("/")&&K.endsWith("/"))return new RegExp(K.slice(1,-1)).test(G.text);else return G.text===K}))continue;if(G.level>X)continue;let z=$(G.children);if(G.level>=W&&G.level<=X)J.push({...G,children:z});else J.push(...z)}return J};return $(Q)}function E(Q){let{items:V,title:W,config:X}=Q,{className:Z,collapsible:$}=X,j=(J,G=0)=>{if(J.length===0)return"";let z=G===0?"toc-list":"toc-sublist",K=G===0?"toc-item":"toc-subitem";return`<ul class="${z}">
1245
+ ${J.map((q)=>{let B=q.children.length>0,Y=B&&$?"toc-expand":"",R=B?j(q.children,G+1):"",H=50,I=q.text.length>50?`${q.text.substring(0,50)}...`:q.text,N=q.text.length>50?"toc-truncate":"";return`<li class="${q.hasCode?"toc-code":""} ${Y} ${K} ${N}">
1246
+ <a href="#${q.id}" class="toc-link" title="${q.text.replace(/<[^>]*>/g,"")}">${I}</a>
1247
+ ${R}
1232
1248
  </li>`}).join(`
1233
1249
  `)}
1234
1250
  </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(`
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`
1251
+ `)}function C(Q){return E(Q).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function t(Q){return E(Q).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function e(Q){return E(Q).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function QQ(Q,V={}){let W={...V};if(typeof W.position==="string")W.position=[W.position];let X={...a,...W},Z=o(Q),$=r(Z),j=n($,X);return{title:X.title,items:j,config:X}}function IQ(Q,V={}){let W=QQ(Q,V);return(Array.isArray(V.position)?V.position:[V.position||"sidebar"]).map((Z)=>{let $;switch(Z){case"inline":$=C(W);break;case"sidebar":$=t(W);break;case"floating":$=e(W);break;default:$=E(W)}return{position:Z,data:W,html:$}})}function NQ(Q,V){let W=C(V);return Q.replace(/\[\[toc\]\]/gi,W)}function MQ(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 RQ(){return`
1236
1252
  .table-of-contents {
1237
1253
  position: sticky;
1238
1254
  top: 60px; /* Match navbar height */
@@ -1362,7 +1378,7 @@ html {
1362
1378
  max-width: 250px;
1363
1379
  }
1364
1380
  }
1365
- `}function RQ(Q={}){let V=Q.smoothScroll!==!1,W=Q.activeHighlight!==!1,X=Q.collapsible!==!1;return`
1381
+ `}function UQ(Q={}){let V=Q.smoothScroll!==!1,W=Q.activeHighlight!==!1,X=Q.collapsible!==!1;return`
1366
1382
  function initToc() {
1367
1383
  const tocLinks = document.querySelectorAll('.toc-link')
1368
1384
 
@@ -1464,7 +1480,7 @@ if (document.readyState === 'loading') {
1464
1480
  else {
1465
1481
  initToc()
1466
1482
  }
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(`
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(`
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 $};
1483
+ `}var{Glob:S,YAML:VQ}=globalThis.Bun;import{join as WQ}from"path";var HQ="/search-index.json",M={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{...M,...V,include:V.include??M.include,exclude:V.exclude??M.exclude,searchFields:V.searchFields??M.searchFields,maxResults:V.maxResults??Q?.maxResults??M.maxResults,boost:{...M.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 XQ(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 k(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:XQ(W?.shortcut)},result:{showDescription:Z.showDescription!==!1,descriptionLength:Z.descriptionLength??180,highlightMatches:Z.highlightMatches!==!1,showPath:Z.showPath!==!1},tokenizeSource:k(W?.options?.tokenize),onSearchSource:k(W?.onSearch),locale:null}}function v(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 ZQ(Q){let V=Q.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!V)return{body:Q,data:{}};let W={};try{W=VQ.parse(V[1])??{}}catch{W={}}return{body:Q.slice(V[0].length),data:W}}function $Q(Q){let V=Q.replace(/\.md$/,"");if(V==="index")return"/";if(V.endsWith("/index"))return`/${V.slice(0,-6)}`;return`/${V}`}function jQ(Q,V,W){let{body:X,data:Z}=ZQ(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=$Q(Q),G=X.split(`
1484
+ `),z=X.match(/^#\s+(.+)$/m),K=$.title||Z.title||(z?z[1].trim():J),q=[],B=new Set,Y={title:K,anchor:"",level:1,buffer:[]},R=()=>{let I=v(Y.buffer.join(`
1485
+ `)).slice(0,W.maxContentLength);if(!I&&!Y.title)return;let N={url:Y.anchor?`${J}#${Y.anchor}`:J,page:K,title:v(Y.title)||K,text:I,level:Y.level};if(j.length)N.keywords=j;q.push(N)},H=U();for(let I of G){let N=H(I)?null:I.match(/^(#{1,6})\s+(.+?)\s*$/);if(!N){Y.buffer.push(I);continue}let _=N[1].length,O=N[2].replace(/\s*\{#([\w-]+)\}\s*$/,""),F=N[2].match(/\{#([\w-]+)\}\s*$/),p=A(F?F[1]:b(y(O)),B);if(_===1){Y.buffer.push("");continue}R(),Y={title:O,anchor:p,level:_,buffer:[]}}return R(),q.filter((I)=>I.text||I.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 YQ(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 FQ(Q,V){let W=V?.search??V?.markdown?.search,X=f(W),Z=m(V),$=X.exclude.map((z)=>new S(z)),j=[],J=new Set,G=new Map;for(let z of Z.locales)G.set(z,new Set);for(let z of X.include){let K=new S(z);for await(let q of K.scan(Q)){let B=q.replace(/\\/g,"/");if($.some((Y)=>Y.match(B)))continue;J.add(B)}}for(let z of[...J].sort())try{let K=await Bun.file(WQ(Q,z)).text(),{locale:q,page:B}=YQ(z,Z);for(let Y of jQ(B,K,X)){if(Z.enabled)Y.locale=q,Y.url=D(Z,q,Y.url);j.push(Y),G.get(q)?.add(T(Y.url))}}catch{}if(Z.enabled){let z=j.filter((K)=>K.locale===Z.defaultLocale);for(let K of Z.locales){if(K===Z.defaultLocale)continue;let q=G.get(K)??new Set;for(let B of z){let Y=D(Z,K,B.url);if(q.has(T(Y)))continue;j.push({...B,url:Y,locale:K})}}}return JQ(j,X)}
1486
+ export{h as B,g as C,l as D,KQ as E,P as F,zQ as G,a as H,y as I,b as J,A as K,w as L,o as M,r as N,n as O,E as P,C as Q,t as R,e as S,QQ as T,IQ as U,NQ as V,MQ as W,RQ as X,UQ as Y,HQ as Z,OQ as _,FQ as $};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ba as B}from"./chunk-vyk71xvd.js";var{YAML:R}=globalThis.Bun;import*as X from"fs";import*as T from"path";async function F(H,J,j){let K=B(J),N=j?.title||J.title||J.markdown?.title||"Documentation Feed",O=j?.description||J.description||J.markdown?.meta?.description||"Documentation updates",Q=j?.author||"Documentation Team",Z=j?.email||"",_=j?.language||"en-us",$=j?.maxItems||20,V=j?.fullContent||!1,W=await w(H,K,V);W.sort((Y,z)=>z.pubDate.getTime()-Y.pubDate.getTime());let G=W.slice(0,$);return P({title:N,description:O,link:K,language:_,author:Q,email:Z,items:G})}async function c(H,J,j,K){if(!K?.enabled)return;if(!B(j)){if(j.verbose)console.warn("\u26A0\uFE0F RSS feed generation skipped: baseUrl not configured");return}let N=await F(H,j,K),O=K.filename||"feed.xml",Q=T.join(J,O);if(await X.promises.writeFile(Q,N,"utf-8"),j.verbose){let Z=(N.match(/<item>/g)||[]).length;console.log(`\u2705 RSS feed generated: ${Q} (${Z} items)`)}}async function w(H,J,j){let K=[],N=await k(H);for(let O of N){let Q=await X.promises.readFile(O,"utf-8"),{frontmatter:Z,markdown:_}=x(Q);if(!Z.date||!Z.title)continue;let V=T.relative(H,O).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!V.startsWith("/"))V=`/${V}`;if(V.endsWith("/")&&V!=="/")V=V.slice(0,-1);let W=`${J.replace(/\/$/,"")}${V}`,G=Z.description||U(_),Y=new Date(Z.date),z=Z.author;K.push({title:Z.title,link:W,description:G,pubDate:Y,author:z,content:j?_:void 0})}return K}async function k(H){let J=[];async function j(K){let N=await X.promises.readdir(K,{withFileTypes:!0});for(let O of N){let Q=T.join(K,O.name);if(O.isDirectory()){if(!O.name.startsWith(".")&&O.name!=="node_modules")await j(Q)}else if(O.isFile()&&O.name.endsWith(".md"))J.push(Q)}}return await j(H),J}function x(H){let J=/^---\n([\s\S]*?)\n---\n?/,j=H.match(J);if(!j)return{frontmatter:{},markdown:H};let K=j[1],N=H.slice(j[0].length);try{return{frontmatter:R.parse(K),markdown:N}}catch{return{frontmatter:{},markdown:H}}}function U(H,J=200){let j=H.replace(/^#{1,6}\s+(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]+`/g,"").replace(/!\[.*?\]\(.*?\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_~]/g,"").trim(),K=j.split(`
2
+ import{ba as B}from"./chunk-4r44z49z.js";var{YAML:R}=globalThis.Bun;import*as X from"fs";import*as T from"path";async function F(H,J,j){let K=B(J),N=j?.title||J.title||J.markdown?.title||"Documentation Feed",O=j?.description||J.description||J.markdown?.meta?.description||"Documentation updates",Q=j?.author||"Documentation Team",Z=j?.email||"",_=j?.language||"en-us",$=j?.maxItems||20,V=j?.fullContent||!1,W=await w(H,K,V);W.sort((Y,z)=>z.pubDate.getTime()-Y.pubDate.getTime());let G=W.slice(0,$);return P({title:N,description:O,link:K,language:_,author:Q,email:Z,items:G})}async function c(H,J,j,K){if(!K?.enabled)return;if(!B(j)){if(j.verbose)console.warn("\u26A0\uFE0F RSS feed generation skipped: baseUrl not configured");return}let N=await F(H,j,K),O=K.filename||"feed.xml",Q=T.join(J,O);if(await X.promises.writeFile(Q,N,"utf-8"),j.verbose){let Z=(N.match(/<item>/g)||[]).length;console.log(`\u2705 RSS feed generated: ${Q} (${Z} items)`)}}async function w(H,J,j){let K=[],N=await k(H);for(let O of N){let Q=await X.promises.readFile(O,"utf-8"),{frontmatter:Z,markdown:_}=x(Q);if(!Z.date||!Z.title)continue;let V=T.relative(H,O).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!V.startsWith("/"))V=`/${V}`;if(V.endsWith("/")&&V!=="/")V=V.slice(0,-1);let W=`${J.replace(/\/$/,"")}${V}`,G=Z.description||U(_),Y=new Date(Z.date),z=Z.author;K.push({title:Z.title,link:W,description:G,pubDate:Y,author:z,content:j?_:void 0})}return K}async function k(H){let J=[];async function j(K){let N=await X.promises.readdir(K,{withFileTypes:!0});for(let O of N){let Q=T.join(K,O.name);if(O.isDirectory()){if(!O.name.startsWith(".")&&O.name!=="node_modules")await j(Q)}else if(O.isFile()&&O.name.endsWith(".md"))J.push(Q)}}return await j(H),J}function x(H){let J=/^---\n([\s\S]*?)\n---\n?/,j=H.match(J);if(!j)return{frontmatter:{},markdown:H};let K=j[1],N=H.slice(j[0].length);try{return{frontmatter:R.parse(K),markdown:N}}catch{return{frontmatter:{},markdown:H}}}function U(H,J=200){let j=H.replace(/^#{1,6}\s+(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]+`/g,"").replace(/!\[.*?\]\(.*?\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_~]/g,"").trim(),K=j.split(`
3
3
 
4
4
  `)[0]||j;if(K.length>J)return`${K.slice(0,J)}...`;return K}function P(H){let J=new Date,j=H.items.length>0?H.items[0].pubDate:J,K=H.items.map((N)=>{let O=N.content?`
5
5
  <content:encoded><![CDATA[${N.content}]]></content:encoded>`:"",Q=N.author?`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as a,da as b,ea as c,fa as d,ga as e,ha as f,ia as g,ja as h,ka as i}from"./chunk-vyk71xvd.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{ca as a,da as b,ea as c,fa as d,ga as e,ha as f,ia as g,ja as h,ka as i}from"./chunk-4r44z49z.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,7 +1,7 @@
1
1
  // @bun
2
- import{A as k4,x as C4,y as v4}from"./chunk-bxyvmqbx.js";import{$ as h4,C as b4,D as O,F as t,I as L4,J as x4,K as E4,Z as P4}from"./chunk-mp1mg7s9.js";import{aa as F,ba as a}from"./chunk-vyk71xvd.js";var{Glob:m4}=globalThis.Bun;import{copyFile as L6,mkdir as g4,readdir as x6,rename as E6,rm as e}from"fs/promises";import{existsSync as S6}from"fs";import{join as D,resolve as F6}from"path";import S from"process";import{CLI as y6}from"@stacksjs/clapp";var d="0.2.12";var{Glob:i4}=globalThis.Bun;import{dirname as s4,relative as r4,resolve as p,sep as Y4}from"path";import{mkdir as o4}from"fs/promises";function N4(K){return Y4==="/"?K:K.split(Y4).join("/")}function t4(K){let Z=new Bun.CryptoHasher("sha256");return Z.update(K),Z.digest("hex")}async function H4(K,Z,Q){let $=p(K),Y=Q?N4(r4($,p(Q))):void 0,X=[],q=new i4("**/*");for await(let R of q.scan({cwd:$,onlyFiles:!0})){let W=N4(R);if(W===Y)continue;X.push(W)}X.sort((R,W)=>R.localeCompare(W));let N=[],_=new Bun.CryptoHasher("sha256");for(let R of X){let W=new Uint8Array(await Bun.file(p($,R)).arrayBuffer()),j=t4(W);N.push({path:R,bytes:W.byteLength,sha256:j}),_.update(`${R}\x00${W.byteLength}\x00${j}
3
- `)}return{schema_version:1,generator:"bunpress",generator_version:Z,outputs:N,tree_sha256:_.digest("hex")}}async function _4(K,Z,Q){let $=await H4(K,Q,Z);return await o4(s4(p(Z)),{recursive:!0}),await Bun.write(Z,`${JSON.stringify($,null,2)}
4
- `),$}function q4(K){return new Map(K.outputs.map((Z)=>[Z.path,Z]))}async function W4(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 Y=await H4(K,Q,Z);if(JSON.stringify(Y)===JSON.stringify($))return Y;let X=q4($),q=q4(Y),N=Y.outputs.filter((j)=>!X.has(j.path)).map((j)=>j.path),_=$.outputs.filter((j)=>!q.has(j.path)).map((j)=>j.path),R=Y.outputs.filter((j)=>{let G=X.get(j.path);return G&&(G.bytes!==j.bytes||G.sha256!==j.sha256)}).map((j)=>{let G=X.get(j.path);return`${j.path} [bytes ${G.bytes} -> ${j.bytes}; sha256 ${G.sha256} -> ${j.sha256}]`}),W=[$.generator_version!==Y.generator_version?`generator ${$.generator_version} -> ${Y.generator_version}`:"",N.length?`added: ${N.join(", ")}`:"",_.length?`removed: ${_.join(", ")}`:"",R.length?`changed: ${R.join(", ")}`:""].filter(Boolean);throw Error(`BunPress output does not match ${Z}: ${W.join("; ")||"tree hash changed"}`)}import{existsSync as e4}from"fs";import{rm as K6}from"fs/promises";import{join as Q6}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 z(K,Z){return`${L[Z]}${K}${L.reset}`}function T(K){console.log(`${L.green}\u2713${L.reset} ${K}`)}function V(K){console.error(`${L.red}\u2717${L.reset} ${K}`)}function h(K){console.warn(`${L.yellow}\u26A0${L.reset} ${K}`)}function U(K){console.log(`${L.blue}\u2139${L.reset} ${K}`)}function w(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 n(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var R4=!!(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(R4){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(),V(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!R4)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(),Y=new TextDecoder,{value:X}=await $.read(),q=Y.decode(X).trim().toLowerCase();if(!q)return Z;return q==="y"||q==="yes"}function g(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let Y of Z)Q[Y]=Math.max(Y.length,...K.map((X)=>String(X[Y]).length));let $=Z.map((Y)=>Y.padEnd(Q[Y])).join(" ");console.log(z($,"bold")),console.log("\u2500".repeat($.length));for(let Y of K){let X=Z.map((q)=>String(Y[q]).padEnd(Q[q])).join(" ");console.log(X)}}async function l(K){try{return Bun.file(K).size}catch{return 0}}async function Z6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let Y of Q.scan(K)){let X=`${K}/${Y}`,q=await l(X);$+=q}return $}catch{return 0}}async function j4(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=Q6(Q,".bunpress"),Y=K.force||!1,X=K.verbose||!1;try{if(!e4($))return U(`Directory "${$}" does not exist, nothing to clean`),!0;let N=await Z6($);if(X)U(`Found "${$}" (${w(N)})`);if(!Y){if(!await c(`Delete "${$}" directory? (${w(N)})`,!1))return U("Clean cancelled"),!1}let _=process.env.VITEST==="true"||!1,R=null;if(!_&&!X)R=new v("Cleaning build artifacts..."),R.start();if(await K6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${w(N)} from "${$}"`);else if(X||_)T(`Cleaned ${w(N)} from "${$}"`);return!0}catch(q){return V(`Failed to clean directory: ${q}`),!1}}import{existsSync as i}from"fs";import{join as s}from"path";async function G4(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let Y of Z){let X=s(process.cwd(),Y);if(i(X)){Q=X;break}}if(!Q)return V("No configuration file found"),U('Run "bunpress config init" to create one'),!1;T(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(z("Configuration:","bold")),console.log($),!0}catch(Z){return V(`Failed to show configuration: ${Z}`),!1}}async function V4(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let _ of Q){let R=s(process.cwd(),_);if(i(R)){$=R;break}}if(!$)return V("No configuration file found"),!1;if(Z)U(`Validating ${$}...`);let X=(await import($)).default;if(!X)return V("Configuration file does not export a default object"),!1;let q=[],N=[];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[_,R]of X.nav.entries())if(!R.text||!R.link)q.push(`nav[${_}] is missing required fields (text, link)`)}if(!a(X))N.push("no `url` set: sitemap, RSS, canonical links and Open Graph tags are all skipped without an absolute base URL");if(q.length>0){V("Configuration validation failed:");for(let _ of q)console.log(` \u2022 ${_}`);return!1}for(let _ of N)h(_);return T("Configuration is valid \u2713"),!0}catch(Q){return V(`Failed to validate configuration: ${Q}`),!1}}async function A4(K={}){let Z=s(process.cwd(),"bunpress.config.ts");if(i(Z))return V("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
2
+ import{A as k4,x as C4,y as v4}from"./chunk-s7tcgrb6.js";import{$ as h4,C as b4,D as O,F as e,I as L4,J as x4,K as E4,Z as P4}from"./chunk-kvkhq8vp.js";import{aa as F,ba as a}from"./chunk-4r44z49z.js";var{Glob:m4}=globalThis.Bun;import{copyFile as L6,mkdir as g4,readdir as x6,rename as E6,rm as K4}from"fs/promises";import{existsSync as S6}from"fs";import{join as D,resolve as F6}from"path";import E from"process";import{CLI as y6}from"@stacksjs/clapp";var p="0.2.14";var{Glob:i4}=globalThis.Bun;import{dirname as s4,relative as r4,resolve as c,sep as N4}from"path";import{mkdir as o4}from"fs/promises";function q4(K){return N4==="/"?K:K.split(N4).join("/")}function t4(K){let Z=new Bun.CryptoHasher("sha256");return Z.update(K),Z.digest("hex")}async function _4(K,Z,Q){let $=c(K),Y=Q?q4(r4($,c(Q))):void 0,X=[],q=new i4("**/*");for await(let R of q.scan({cwd:$,onlyFiles:!0})){let _=q4(R);if(_===Y)continue;X.push(_)}X.sort((R,_)=>R.localeCompare(_));let N=[],W=new Bun.CryptoHasher("sha256");for(let R of X){let _=new Uint8Array(await Bun.file(c($,R)).arrayBuffer()),G=t4(_);N.push({path:R,bytes:_.byteLength,sha256:G}),W.update(`${R}\x00${_.byteLength}\x00${G}
3
+ `)}return{schema_version:1,generator:"bunpress",generator_version:Z,outputs:N,tree_sha256:W.digest("hex")}}async function W4(K,Z,Q){let $=await _4(K,Q,Z);return await o4(s4(c(Z)),{recursive:!0}),await Bun.write(Z,`${JSON.stringify($,null,2)}
4
+ `),$}function H4(K){return new Map(K.outputs.map((Z)=>[Z.path,Z]))}async function R4(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 Y=await _4(K,Q,Z);if(JSON.stringify(Y)===JSON.stringify($))return Y;let X=H4($),q=H4(Y),N=Y.outputs.filter((G)=>!X.has(G.path)).map((G)=>G.path),W=$.outputs.filter((G)=>!q.has(G.path)).map((G)=>G.path),R=Y.outputs.filter((G)=>{let V=X.get(G.path);return V&&(V.bytes!==G.bytes||V.sha256!==G.sha256)}).map((G)=>{let V=X.get(G.path);return`${G.path} [bytes ${V.bytes} -> ${G.bytes}; sha256 ${V.sha256} -> ${G.sha256}]`}),_=[$.generator_version!==Y.generator_version?`generator ${$.generator_version} -> ${Y.generator_version}`:"",N.length?`added: ${N.join(", ")}`:"",W.length?`removed: ${W.join(", ")}`:"",R.length?`changed: ${R.join(", ")}`:""].filter(Boolean);throw Error(`BunPress output does not match ${Z}: ${_.join("; ")||"tree hash changed"}`)}import{existsSync as e4}from"fs";import{rm as K6}from"fs/promises";import{join as Q6}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 z(K,Z){return`${L[Z]}${K}${L.reset}`}function T(K){console.log(`${L.green}\u2713${L.reset} ${K}`)}function j(K){console.error(`${L.red}\u2717${L.reset} ${K}`)}function h(K){console.warn(`${L.yellow}\u26A0${L.reset} ${K}`)}function B(K){console.log(`${L.blue}\u2139${L.reset} ${K}`)}function w(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 i(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var G4=!!(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(G4){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(),j(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!G4)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function d(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(),Y=new TextDecoder,{value:X}=await $.read(),q=Y.decode(X).trim().toLowerCase();if(!q)return Z;return q==="y"||q==="yes"}function g(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let Y of Z)Q[Y]=Math.max(Y.length,...K.map((X)=>String(X[Y]).length));let $=Z.map((Y)=>Y.padEnd(Q[Y])).join(" ");console.log(z($,"bold")),console.log("\u2500".repeat($.length));for(let Y of K){let X=Z.map((q)=>String(Y[q]).padEnd(Q[q])).join(" ");console.log(X)}}async function l(K){try{return Bun.file(K).size}catch{return 0}}async function Z6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let Y of Q.scan(K)){let X=`${K}/${Y}`,q=await l(X);$+=q}return $}catch{return 0}}async function V4(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=Q6(Q,".bunpress"),Y=K.force||!1,X=K.verbose||!1;try{if(!e4($))return B(`Directory "${$}" does not exist, nothing to clean`),!0;let N=await Z6($);if(X)B(`Found "${$}" (${w(N)})`);if(!Y){if(!await d(`Delete "${$}" directory? (${w(N)})`,!1))return B("Clean cancelled"),!1}let W=process.env.VITEST==="true"||!1,R=null;if(!W&&!X)R=new v("Cleaning build artifacts..."),R.start();if(await K6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${w(N)} from "${$}"`);else if(X||W)T(`Cleaned ${w(N)} from "${$}"`);return!0}catch(q){return j(`Failed to clean directory: ${q}`),!1}}import{existsSync as s}from"fs";import{join as r}from"path";async function j4(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let Y of Z){let X=r(process.cwd(),Y);if(s(X)){Q=X;break}}if(!Q)return j("No configuration file found"),B('Run "bunpress config init" to create one'),!1;T(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(z("Configuration:","bold")),console.log($),!0}catch(Z){return j(`Failed to show configuration: ${Z}`),!1}}async function A4(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let W of Q){let R=r(process.cwd(),W);if(s(R)){$=R;break}}if(!$)return j("No configuration file found"),!1;if(Z)B(`Validating ${$}...`);let X=(await import($)).default;if(!X)return j("Configuration file does not export a default object"),!1;let q=[],N=[];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[W,R]of X.nav.entries())if(!R.text||!R.link)q.push(`nav[${W}] is missing required fields (text, link)`)}if(!a(X))N.push("no `url` set: sitemap, RSS, canonical links and Open Graph tags are all skipped without an absolute base URL");if(q.length>0){j("Configuration validation failed:");for(let W of q)console.log(` \u2022 ${W}`);return!1}for(let W of N)h(W);return T("Configuration is valid \u2713"),!0}catch(Q){return j(`Failed to validate configuration: ${Q}`),!1}}async function J4(K={}){let Z=r(process.cwd(),"bunpress.config.ts");if(s(Z))return j("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
5
5
 
6
6
  export default {
7
7
  verbose: false,
@@ -54,9 +54,9 @@ export default {
54
54
  hostname: 'https://example.com',
55
55
  },
56
56
  } satisfies BunPressConfig
57
- `;try{return await Bun.write(Z,Q),T(`Created ${Z}`),!0}catch($){return V(`Failed to create configuration: ${$}`),!1}}import{existsSync as k}from"fs";import{join as P}from"path";function J4(){let Z=["bunpress","docs"].flatMap(($)=>[`${$}.config`,`.${$}.config`,$,`.${$}`]),Q=[".ts",".js",".mjs",".cjs",".json"];return Z.flatMap(($)=>Q.map((Y)=>`${$}${Y}`))}async function M4(K={}){let Z=K.verbose||!1,Q=[];console.log(z(`
57
+ `;try{return await Bun.write(Z,Q),T(`Created ${Z}`),!0}catch($){return j(`Failed to create configuration: ${$}`),!1}}import{existsSync as k}from"fs";import{join as P}from"path";function M4(){let Z=["bunpress","docs"].flatMap(($)=>[`${$}.config`,`.${$}.config`,$,`.${$}`]),Q=[".ts",".js",".mjs",".cjs",".json"];return Z.flatMap(($)=>Q.map((Y)=>`${$}${Y}`))}async function U4(K={}){let Z=K.verbose||!1,Q=[];console.log(z(`
58
58
  Running diagnostics...
59
- `,"bold")),Q.push({name:"Bun Runtime",status:"pass",message:`v${Bun.version}`});let $=J4().find((H)=>k(P(process.cwd(),H)));if($)Q.push({name:"Configuration",status:"pass",message:$});else Q.push({name:"Configuration",status:"pass",message:"using defaults (no config file)",detail:`Looked for: ${J4().join(", ")}`});let Y=K.dir||O.docsDir||"./docs",X=P(process.cwd(),Y);if(k(X)){let{Glob:H}=awaitPromise.resolve(globalThis.Bun),x=new H("**/*.md"),E=0;for await(let J of x.scan(X))E++;Q.push({name:"Documentation",status:E>0?"pass":"warn",message:`${E} markdown files in ${Y}`,fix:E>0?void 0:`Add a .md file under ${Y}, or run "bunpress new index"`})}else Q.push({name:"Documentation",status:"fail",message:`${Y} not found`,fix:'Run "bunpress init" to create the docs directory',detail:`Resolved from ${K.dir?"--dir":O.docsDir?"config docsDir":"the default"}`});let q=P(process.cwd(),"package.json");if(k(q)){let H=await Bun.file(q).json(),x=H.scripts?.dev,E=H.scripts?.build;Q.push({name:"Package Scripts",status:x&&E?"pass":"warn",message:`dev: ${x?"\u2713":"\u2717"}, build: ${E?"\u2713":"\u2717"}`,fix:x&&E?void 0:'Add "dev": "bunpress dev" and "build": "bunpress build" to package.json scripts'});let J=H.dependencies?.["@stacksjs/bunpress"]||H.devDependencies?.["@stacksjs/bunpress"];if(H.name==="@stacksjs/bunpress"||k(P(process.cwd(),"packages","bunpress","package.json")))Q.push({name:"BunPress Package",status:"pass",message:"this is the BunPress source repository"});else Q.push({name:"BunPress Package",status:J?"pass":"warn",message:J||"not declared in package.json",fix:J?void 0:'Run "bun add -d @stacksjs/bunpress"'})}else Q.push({name:"Package.json",status:"warn",message:"Not found",fix:'Run "bun init" to create one'});let N=P(process.cwd(),"node_modules");if(k(N))Q.push({name:"Dependencies",status:"pass",message:"node_modules found"});else Q.push({name:"Dependencies",status:"warn",message:"node_modules not found",fix:'Run "bun install"'});let _=P(process.cwd(),".git");if(k(_))Q.push({name:"Git Repository",status:"pass",message:"Initialized"});else Q.push({name:"Git Repository",status:"warn",message:"Not initialized",fix:'Run "git init" \u2014 without it, "last updated" falls back to file timestamps'});let R=P(process.cwd(),"tsconfig.json");if(k(R))Q.push({name:"TypeScript",status:"pass",message:"tsconfig.json found"});else Q.push({name:"TypeScript",status:"warn",message:"tsconfig.json not found",fix:"Only needed for a TypeScript config file \u2014 safe to ignore otherwise"});for(let H of Q){let x=H.status==="pass"?"\u2713":H.status==="fail"?"\u2717":"\u26A0",E=H.status==="pass"?"green":H.status==="fail"?"red":"yellow";if(console.log(` ${z(x,E)} ${H.name}: ${z(H.message,"dim")}`),Z&&H.detail)console.log(` ${z(H.detail,"dim")}`)}console.log();let W=Q.filter((H)=>H.status==="pass").length,j=Q.filter((H)=>H.status==="fail").length,G=Q.filter((H)=>H.status==="warn").length,B=Q.filter((H)=>H.status!=="pass"&&H.fix);if(B.length>0){U("Recommended actions:");for(let H of B)console.log(` \u2022 ${H.fix}`);console.log()}if(j>0)return V(`${j} checks failed, ${G} warnings`),!1;if(G>0)return h(`${W} checks passed, ${G} warnings`),!0;return T(`All ${W} checks passed!`),!0}import{mkdir as r}from"fs/promises";var $6=`import type { BunPressConfig } from '@stacksjs/bunpress'
59
+ `,"bold")),Q.push({name:"Bun Runtime",status:"pass",message:`v${Bun.version}`});let $=M4().find((H)=>k(P(process.cwd(),H)));if($)Q.push({name:"Configuration",status:"pass",message:$});else Q.push({name:"Configuration",status:"pass",message:"using defaults (no config file)",detail:`Looked for: ${M4().join(", ")}`});let Y=K.dir||O.docsDir||"./docs",X=P(process.cwd(),Y);if(k(X)){let{Glob:H}=awaitPromise.resolve(globalThis.Bun),S=new H("**/*.md"),x=0;for await(let J of S.scan(X))x++;Q.push({name:"Documentation",status:x>0?"pass":"warn",message:`${x} markdown files in ${Y}`,fix:x>0?void 0:`Add a .md file under ${Y}, or run "bunpress new index"`})}else Q.push({name:"Documentation",status:"fail",message:`${Y} not found`,fix:'Run "bunpress init" to create the docs directory',detail:`Resolved from ${K.dir?"--dir":O.docsDir?"config docsDir":"the default"}`});let q=P(process.cwd(),"package.json");if(k(q)){let H=await Bun.file(q).json(),S=H.scripts?.dev,x=H.scripts?.build;Q.push({name:"Package Scripts",status:S&&x?"pass":"warn",message:`dev: ${S?"\u2713":"\u2717"}, build: ${x?"\u2713":"\u2717"}`,fix:S&&x?void 0:'Add "dev": "bunpress dev" and "build": "bunpress build" to package.json scripts'});let J=H.dependencies?.["@stacksjs/bunpress"]||H.devDependencies?.["@stacksjs/bunpress"];if(H.name==="@stacksjs/bunpress"||k(P(process.cwd(),"packages","bunpress","package.json")))Q.push({name:"BunPress Package",status:"pass",message:"this is the BunPress source repository"});else Q.push({name:"BunPress Package",status:J?"pass":"warn",message:J||"not declared in package.json",fix:J?void 0:'Run "bun add -d @stacksjs/bunpress"'})}else Q.push({name:"Package.json",status:"warn",message:"Not found",fix:'Run "bun init" to create one'});let N=P(process.cwd(),"node_modules");if(k(N))Q.push({name:"Dependencies",status:"pass",message:"node_modules found"});else Q.push({name:"Dependencies",status:"warn",message:"node_modules not found",fix:'Run "bun install"'});let W=P(process.cwd(),".git");if(k(W))Q.push({name:"Git Repository",status:"pass",message:"Initialized"});else Q.push({name:"Git Repository",status:"warn",message:"Not initialized",fix:'Run "git init" \u2014 without it, "last updated" falls back to file timestamps'});let R=P(process.cwd(),"tsconfig.json");if(k(R))Q.push({name:"TypeScript",status:"pass",message:"tsconfig.json found"});else Q.push({name:"TypeScript",status:"warn",message:"tsconfig.json not found",fix:"Only needed for a TypeScript config file \u2014 safe to ignore otherwise"});for(let H of Q){let S=H.status==="pass"?"\u2713":H.status==="fail"?"\u2717":"\u26A0",x=H.status==="pass"?"green":H.status==="fail"?"red":"yellow";if(console.log(` ${z(S,x)} ${H.name}: ${z(H.message,"dim")}`),Z&&H.detail)console.log(` ${z(H.detail,"dim")}`)}console.log();let _=Q.filter((H)=>H.status==="pass").length,G=Q.filter((H)=>H.status==="fail").length,V=Q.filter((H)=>H.status==="warn").length,U=Q.filter((H)=>H.status!=="pass"&&H.fix);if(U.length>0){B("Recommended actions:");for(let H of U)console.log(` \u2022 ${H.fix}`);console.log()}if(G>0)return j(`${G} checks failed, ${V} warnings`),!1;if(V>0)return h(`${_} checks passed, ${V} warnings`),!0;return T(`All ${_} checks passed!`),!0}import{mkdir as o}from"fs/promises";var $6=`import type { BunPressConfig } from '@stacksjs/bunpress'
60
60
 
61
61
  export default {
62
62
  verbose: false,
@@ -202,7 +202,7 @@ Preview the built site:
202
202
  \`\`\`bash
203
203
  bun run preview
204
204
  \`\`\`
205
- `;async function U4(K={}){try{if(await Bun.file("./docs").exists()&&!K.force){if(!await c("Documentation directory already exists. Continue?",!1))return U("Initialization cancelled"),!1}let Q=new v("Initializing BunPress project...");Q.start(),await r("./docs",{recursive:!0}),await r("./docs/guide",{recursive:!0}),await r("./docs/public",{recursive:!0}),await Bun.write("./bunpress.config.ts",$6),await Bun.write("./docs/index.md",X6),await Bun.write("./docs/guide/index.md",Y6);let $=await Bun.file("./.gitignore").exists();if(!$)await Bun.write("./.gitignore",N6);let Y=await Bun.file("./README.md").exists();if(!Y)await Bun.write("./README.md",q6);let X="./package.json";if(await Bun.file(X).exists()){let N=await Bun.file(X).json();N.scripts=N.scripts||{},N.scripts.dev=N.scripts.dev||"bunpress dev",N.scripts.build=N.scripts.build||"bunpress build",N.scripts.preview=N.scripts.preview||"bunpress preview",await Bun.write(X,JSON.stringify(N,null,2))}if(Q.succeed("BunPress project initialized successfully!"),console.log(),T("Created files:"),console.log(" \u2022 bunpress.config.ts"),console.log(" \u2022 docs/index.md"),console.log(" \u2022 docs/guide/index.md"),console.log(" \u2022 docs/public/"),!$)console.log(" \u2022 .gitignore");if(!Y)console.log(" \u2022 README.md");return console.log(),U("Next steps:"),console.log(" 1. Install BunPress: bun add @stacksjs/bunpress"),console.log(" 2. Start dev server: bun run dev"),console.log(" 3. Edit docs/index.md to customize your home page"),!0}catch(Z){return V(`Failed to initialize project: ${Z}`),!1}}import{mkdir as H6}from"fs/promises";import{dirname as _6,join as W6}from"path";var B4={default:(K)=>`---
205
+ `;async function B4(K={}){try{if(await Bun.file("./docs").exists()&&!K.force){if(!await d("Documentation directory already exists. Continue?",!1))return B("Initialization cancelled"),!1}let Q=new v("Initializing BunPress project...");Q.start(),await o("./docs",{recursive:!0}),await o("./docs/guide",{recursive:!0}),await o("./docs/public",{recursive:!0}),await Bun.write("./bunpress.config.ts",$6),await Bun.write("./docs/index.md",X6),await Bun.write("./docs/guide/index.md",Y6);let $=await Bun.file("./.gitignore").exists();if(!$)await Bun.write("./.gitignore",N6);let Y=await Bun.file("./README.md").exists();if(!Y)await Bun.write("./README.md",q6);let X="./package.json";if(await Bun.file(X).exists()){let N=await Bun.file(X).json();N.scripts=N.scripts||{},N.scripts.dev=N.scripts.dev||"bunpress dev",N.scripts.build=N.scripts.build||"bunpress build",N.scripts.preview=N.scripts.preview||"bunpress preview",await Bun.write(X,JSON.stringify(N,null,2))}if(Q.succeed("BunPress project initialized successfully!"),console.log(),T("Created files:"),console.log(" \u2022 bunpress.config.ts"),console.log(" \u2022 docs/index.md"),console.log(" \u2022 docs/guide/index.md"),console.log(" \u2022 docs/public/"),!$)console.log(" \u2022 .gitignore");if(!Y)console.log(" \u2022 README.md");return console.log(),B("Next steps:"),console.log(" 1. Install BunPress: bun add @stacksjs/bunpress"),console.log(" 2. Start dev server: bun run dev"),console.log(" 3. Edit docs/index.md to customize your home page"),!0}catch(Z){return j(`Failed to initialize project: ${Z}`),!1}}import{mkdir as H6}from"fs/promises";import{dirname as _6,join as W6}from"path";var T4={default:(K)=>`---
206
206
  title: ${K}
207
207
  description:
208
208
  ---
@@ -280,18 +280,18 @@ Post content goes here...
280
280
  ## Section 1
281
281
 
282
282
  Content...
283
- `};async function T4(K,Z={}){try{let Q=K.endsWith(".md")?K:`${K}.md`,$=W6(process.cwd(),"docs",Q);if(await Bun.file($).exists())return V(`File already exists: ${Q}`),!1;let X=Z.title;if(!X)X=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((j)=>j.charAt(0).toUpperCase()+j.slice(1)).join(" ");let q=Z.template||"default",N=B4[q];if(!N)return V(`Unknown template: ${q}`),V(`Available templates: ${Object.keys(B4).join(", ")}`),!1;let _=N(X),R=_6($);return await H6(R,{recursive:!0}),await Bun.write($,_),T(`Created ${Q}`),console.log(),console.log(` Title: ${X}`),console.log(` Template: ${q}`),console.log(` Path: ${$}`),!0}catch(Q){return V(`Failed to create file: ${Q}`),!1}}import{join as z4}from"path";async function O4(K={}){let Z=K.port||3000,Q=await O,$=K.outdir||Q.outDir||"./dist",Y=z4($,".bunpress"),X=K.verbose||!1;try{let{stat:q}=await import("fs/promises");try{if(!(await q(Y)).isDirectory())V(`"${Y}" is not a directory.`),V('Run "bunpress build" first to generate the documentation.'),process.exit(1)}catch{V(`Build directory "${Y}" not found.`),V('Run "bunpress build" first to generate the documentation.'),process.exit(1)}U(`Starting preview server from ${Y}`);try{let N=Bun.serve({port:Z,fetch:async(_)=>{let W=new URL(_.url).pathname;if(W.startsWith("/"))W=W.slice(1);if(W===""||W==="/")W="index.html";let j=z4(Y,W),G=Bun.file(j);if(await G.exists())return new Response(G,{headers:{"Content-Type":R6(W)}});let H=`${j}.html`,x=Bun.file(H);if(await x.exists())return new Response(x,{headers:{"Content-Type":"text/html"}});return new Response("404 - Not Found",{status:404})}});T(`Preview server running at http://localhost:${Z}`),console.log(`Press Ctrl+C to stop
284
- `),await new Promise(()=>{})}catch(N){if(N.message?.includes("EADDRINUSE")||N.code==="EADDRINUSE")V(`Port ${Z} is already in use.`),V("Try running with a different port: bunpress preview --port <port>"),V(`Or stop any processes using port ${Z}`);else V(`Failed to start server: ${N.message||N}`);process.exit(1)}}catch(q){V(`Failed to start preview server: ${q}`),process.exit(1)}}function R6(K){let Z=K.split(".").pop()?.toLowerCase();return{html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",ico:"image/x-icon",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",eot:"application/vnd.ms-fontobject"}[Z||""]||"text/plain"}import*as b from"fs";import*as y from"path";var{YAML:S4}=globalThis.Bun;async function F4(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.fix||!1;if(U("\uD83D\uDD0D Running SEO checks..."),console.log(""),!b.existsSync(Q))V(`Documentation directory not found: ${Q}`),process.exit(1);let Y={totalPages:0,errors:[],warnings:[],passed:0},X=await A6(Q);Y.totalPages=X.length;for(let q of X)await j6(q,Q,Y,$);if(G6(Z,Q,Y),z6(Y),Y.errors.length>0)process.exit(1)}async function j6(K,Z,Q,$){let Y=await b.promises.readFile(K,"utf-8"),{frontmatter:X,markdown:q}=J6(Y),N=y.relative(Z,K),_=!1,R=$&&Object.keys(X).length>0,W={...X},j=X.layout==="home"?X.hero?.text||X.hero?.name:void 0;if(!X.title&&j);else if(!X.title){let H=M6(q);if(!H)Q.errors.push({type:"error",category:"Title",file:N,message:"Missing title in frontmatter"}),_=!0;else if($)W.title=H,R=!0,U(`\u2713 Added title to ${N}: "${H}"`);else Q.warnings.push({type:"warning",category:"Title",file:N,message:`No title in frontmatter (could extract: "${H}")`}),_=!0}else{let H=X.title.length;if(H>60)Q.warnings.push({type:"warning",category:"Title",file:N,message:`Title too long (${H} chars, recommended <60)`}),_=!0;else if(H<10)Q.warnings.push({type:"warning",category:"Title",file:N,message:`Title too short (${H} chars, recommended >10)`}),_=!0}if(!X.description){let H=U6(q);if($)W.description=H,R=!0,U(`\u2713 Added description to ${N}`);else Q.warnings.push({type:"warning",category:"Description",file:N,message:"Missing description in frontmatter"}),_=!0}else{let H=X.description.length;if(H>160)Q.warnings.push({type:"warning",category:"Description",file:N,message:`Description too long (${H} chars, recommended <160)`}),_=!0;else if(H<50)Q.warnings.push({type:"warning",category:"Description",file:N,message:`Description too short (${H} chars, recommended >50)`}),_=!0}let G=B6(q,Z,K);for(let H of G)Q.errors.push({type:"error",category:"Links",file:N,message:`Broken internal link: ${H}`}),_=!0;let B=T6(q);for(let H of B)Q.warnings.push({type:"warning",category:"Images",file:N,message:`Image missing alt text: ${H}`}),_=!0;if(R){let H=V6(W,q);await b.promises.writeFile(K,H,"utf-8")}if(!_)Q.passed++}function G6(K,Z,Q){let $=new Set,Y=(N,_)=>{if(typeof N!=="string"||!N.startsWith("/"))return;let R=`${_}:${N}`;if($.has(R))return;$.add(R);let[W,j]=N.split("#"),G=y4(y.resolve(Z,`.${W}`));if(!G){Q.errors.push({type:"error",category:"Links",file:_,message:`Broken link: ${N}`});return}if(j&&!o(G).has(j))Q.errors.push({type:"error",category:"Links",file:_,message:`Broken anchor: ${N}`})},X=(N,_)=>{if(!Array.isArray(N))return;for(let R of N){if(!R||typeof R!=="object")continue;let W=R;Y(W.link,_),X(W.items,_)}};X(K.nav,"config nav"),X(K.themeConfig?.nav,"themeConfig nav");let q=[[K.markdown?.sidebar,"config sidebar"],[K.themeConfig?.sidebar,"themeConfig sidebar"]];for(let[N,_]of q)if(Array.isArray(N))X(N,_);else if(N&&typeof N==="object")for(let[R,W]of Object.entries(N))X(W,`${_} ${R}`)}function V6(K,Z){return`---
283
+ `};async function z4(K,Z={}){try{let Q=K.endsWith(".md")?K:`${K}.md`,$=W6(process.cwd(),"docs",Q);if(await Bun.file($).exists())return j(`File already exists: ${Q}`),!1;let X=Z.title;if(!X)X=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(" ");let q=Z.template||"default",N=T4[q];if(!N)return j(`Unknown template: ${q}`),j(`Available templates: ${Object.keys(T4).join(", ")}`),!1;let W=N(X),R=_6($);return await H6(R,{recursive:!0}),await Bun.write($,W),T(`Created ${Q}`),console.log(),console.log(` Title: ${X}`),console.log(` Template: ${q}`),console.log(` Path: ${$}`),!0}catch(Q){return j(`Failed to create file: ${Q}`),!1}}import{join as n}from"path";async function O4(K={}){let Z=K.port||3000,Q=await O,$=K.outdir||Q.outDir||"./dist",Y=n($,".bunpress"),X=K.verbose||!1;try{let{stat:q}=await import("fs/promises");try{if(!(await q(Y)).isDirectory())j(`"${Y}" is not a directory.`),j('Run "bunpress build" first to generate the documentation.'),process.exit(1)}catch{j(`Build directory "${Y}" not found.`),j('Run "bunpress build" first to generate the documentation.'),process.exit(1)}B(`Starting preview server from ${Y}`);try{let N=Bun.serve({port:Z,fetch:async(W)=>{let _=new URL(W.url).pathname;if(_.startsWith("/"))_=_.slice(1);if(_===""||_==="/")_="index.html";let G=[_,`${_}.html`,n(_,"index.html")];for(let U of G){let H=Bun.file(n(Y,U));if(await H.exists())return new Response(H,{headers:{"Content-Type":R6(U)}})}let V=Bun.file(n(Y,"404.html"));if(await V.exists())return new Response(V,{status:404,headers:{"Content-Type":"text/html"}});return new Response("404 - Not Found",{status:404})}});T(`Preview server running at http://localhost:${Z}`),console.log(`Press Ctrl+C to stop
284
+ `),await new Promise(()=>{})}catch(N){if(N.message?.includes("EADDRINUSE")||N.code==="EADDRINUSE")j(`Port ${Z} is already in use.`),j("Try running with a different port: bunpress preview --port <port>"),j(`Or stop any processes using port ${Z}`);else j(`Failed to start server: ${N.message||N}`);process.exit(1)}}catch(q){j(`Failed to start preview server: ${q}`),process.exit(1)}}function R6(K){let Z=K.split(".").pop()?.toLowerCase();return{html:"text/html; charset=utf-8",css:"text/css; charset=utf-8",js:"application/javascript; charset=utf-8",mjs:"application/javascript; charset=utf-8",json:"application/json; charset=utf-8",map:"application/json; charset=utf-8",xml:"application/xml; charset=utf-8",txt:"text/plain; charset=utf-8",webmanifest:"application/manifest+json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",svg:"image/svg+xml",ico:"image/x-icon",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject"}[Z||""]||"application/octet-stream"}import*as b from"fs";import*as y from"path";var{YAML:S4}=globalThis.Bun;async function F4(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.fix||!1;if(B("\uD83D\uDD0D Running SEO checks..."),console.log(""),!b.existsSync(Q))j(`Documentation directory not found: ${Q}`),process.exit(1);let Y={totalPages:0,errors:[],warnings:[],passed:0},X=await A6(Q);Y.totalPages=X.length;for(let q of X)await G6(q,Q,Y,$);if(V6(Z,Q,Y),z6(Y),Y.errors.length>0)process.exit(1)}async function G6(K,Z,Q,$){let Y=await b.promises.readFile(K,"utf-8"),{frontmatter:X,markdown:q}=J6(Y),N=y.relative(Z,K),W=!1,R=$&&Object.keys(X).length>0,_={...X},G=X.layout==="home"?X.hero?.text||X.hero?.name:void 0;if(!X.title&&G);else if(!X.title){let H=M6(q);if(!H)Q.errors.push({type:"error",category:"Title",file:N,message:"Missing title in frontmatter"}),W=!0;else if($)_.title=H,R=!0,B(`\u2713 Added title to ${N}: "${H}"`);else Q.warnings.push({type:"warning",category:"Title",file:N,message:`No title in frontmatter (could extract: "${H}")`}),W=!0}else{let H=X.title.length;if(H>60)Q.warnings.push({type:"warning",category:"Title",file:N,message:`Title too long (${H} chars, recommended <60)`}),W=!0;else if(H<10)Q.warnings.push({type:"warning",category:"Title",file:N,message:`Title too short (${H} chars, recommended >10)`}),W=!0}if(!X.description){let H=U6(q);if($)_.description=H,R=!0,B(`\u2713 Added description to ${N}`);else Q.warnings.push({type:"warning",category:"Description",file:N,message:"Missing description in frontmatter"}),W=!0}else{let H=X.description.length;if(H>160)Q.warnings.push({type:"warning",category:"Description",file:N,message:`Description too long (${H} chars, recommended <160)`}),W=!0;else if(H<50)Q.warnings.push({type:"warning",category:"Description",file:N,message:`Description too short (${H} chars, recommended >50)`}),W=!0}let V=B6(q,Z,K);for(let H of V)Q.errors.push({type:"error",category:"Links",file:N,message:`Broken internal link: ${H}`}),W=!0;let U=T6(q);for(let H of U)Q.warnings.push({type:"warning",category:"Images",file:N,message:`Image missing alt text: ${H}`}),W=!0;if(R){let H=j6(_,q);await b.promises.writeFile(K,H,"utf-8")}if(!W)Q.passed++}function V6(K,Z,Q){let $=new Set,Y=(N,W)=>{if(typeof N!=="string"||!N.startsWith("/"))return;let R=`${W}:${N}`;if($.has(R))return;$.add(R);let[_,G]=N.split("#"),V=y4(y.resolve(Z,`.${_}`));if(!V){Q.errors.push({type:"error",category:"Links",file:W,message:`Broken link: ${N}`});return}if(G&&!t(V).has(G))Q.errors.push({type:"error",category:"Links",file:W,message:`Broken anchor: ${N}`})},X=(N,W)=>{if(!Array.isArray(N))return;for(let R of N){if(!R||typeof R!=="object")continue;let _=R;Y(_.link,W),X(_.items,W)}};X(K.nav,"config nav"),X(K.themeConfig?.nav,"themeConfig nav");let q=[[K.markdown?.sidebar,"config sidebar"],[K.themeConfig?.sidebar,"themeConfig sidebar"]];for(let[N,W]of q)if(Array.isArray(N))X(N,W);else if(N&&typeof N==="object")for(let[R,_]of Object.entries(N))X(_,`${W} ${R}`)}function j6(K,Z){return`---
285
285
  ${S4.stringify(K,null,2)}
286
286
  ---
287
287
  ${Z}`}async function A6(K){let Z=[];async function Q($){let Y=await b.promises.readdir($,{withFileTypes:!0});for(let X of Y){let q=y.join($,X.name);if(X.isDirectory()){if(!X.name.startsWith(".")&&X.name!=="node_modules"&&X.name!=="public")await Q(q)}else if(X.isFile()&&X.name.endsWith(".md"))Z.push(q)}}return await Q(K),Z}function J6(K){let Z=/^---\n([\s\S]*?)\n---\n?/,Q=K.match(Z);if(!Q)return{frontmatter:{},markdown:K};let $=Q[1],Y=K.slice(Q[0].length);try{return{frontmatter:S4.parse($),markdown:Y}}catch{return{frontmatter:{},markdown:K}}}function M6(K){let Z=K.match(/^#\s+(.+)$/m);return Z?Z[1].trim():null}function U6(K,Z=155){let Q=K.replace(/^#{1,6}\s+.+$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]+`/g,"").replace(/!\[.*?\]\(.*?\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_~]/g,"").trim(),$=Q.split(`
288
288
 
289
- `)[0]||Q;if($.length>Z)return`${$.slice(0,Z)}...`;return $||"Documentation page"}function B6(K,Z,Q){let $=[],Y=/\[([^\]]+)\]\(([^)]+)\)/g,X=t(K).replace(/`+[^`\n]*`+/g,"").replace(/<!--[\s\S]*?-->/g,""),q;while((q=Y.exec(X))!==null){let N=q[2].trim();if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(N))continue;let _=N.includes("#")?N.slice(N.indexOf("#")+1):"";if(N.startsWith("#")){if(_&&!o(Q).has(_))$.push(N);continue}let R=N.split("#",1)[0].split("?",1)[0];if(!R)continue;let W;try{W=decodeURIComponent(R.replace(/^<|>$/g,""))}catch{$.push(N);continue}let j=W.startsWith("/")?y.resolve(Z,`.${W}`):y.resolve(y.dirname(Q),W),G=y4(j);if(!G){$.push(N);continue}if(_&&!o(G).has(_))$.push(N)}return $}function y4(K){let Z=K.endsWith(".md")?[K]:[K,`${K}.md`,y.join(K,"index.md")];for(let Q of Z)try{if(b.statSync(Q).isFile())return Q}catch{}return null}var I4=new Map;function o(K){let Z=I4.get(K);if(Z)return Z;let Q=new Set;try{let $=t(b.readFileSync(K,"utf8"));for(let Y of $.split(`
290
- `)){let X=Y.match(/^#{1,6}\s+(.*)$/);if(!X)continue;let q=X[1].trim(),N=q.match(/\{#([\w-]+)\}\s*$/),_=N?N[1]:x4(L4(q));if(!_)continue;E4(_,Q)}}catch{}return I4.set(K,Q),Q}function T6(K){let Z=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,$;while(($=Q.exec(K))!==null){let Y=$[1],X=$[2];if(!Y||Y.trim()==="")Z.push(X)}return Z}function z6(K){if(console.log(""),U("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${z(K.totalPages.toString(),"blue")}`),console.log(`Passed: ${z(K.passed.toString(),"green")}`),console.log(`Errors: ${z(K.errors.length.toString(),K.errors.length>0?"red":"green")}`),console.log(`Warnings: ${z(K.warnings.length.toString(),K.warnings.length>0?"yellow":"green")}`),console.log(""),K.errors.length>0){V(`\u2717 ${K.errors.length} errors found:`),console.log("");let Z=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g(Z),console.log("")}if(K.warnings.length>0){h(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let Z=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g(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 O6}from"path";async function I6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
291
- `),$=0,Y=!1,X=[];for(let R of Q){if(R.trim().startsWith("```")){Y=!Y;continue}if(!Y)X.push(R)}$=X.join(" ").split(/\s+/).filter((R)=>R.length>0).length;let N=Q.filter((R)=>R.match(/^#{1,6}\s+/)).length,_=(Z.match(/```/g)||[]).length/2;return{path:K,size:await l(K),lines:Q.length,words:$,headings:N,codeBlocks:Math.floor(_)}}async function D4(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.verbose||!1;try{console.log(z(`
289
+ `)[0]||Q;if($.length>Z)return`${$.slice(0,Z)}...`;return $||"Documentation page"}function B6(K,Z,Q){let $=[],Y=/\[([^\]]+)\]\(([^)]+)\)/g,X=e(K).replace(/`+[^`\n]*`+/g,"").replace(/<!--[\s\S]*?-->/g,""),q;while((q=Y.exec(X))!==null){let N=q[2].trim();if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(N))continue;let W=N.includes("#")?N.slice(N.indexOf("#")+1):"";if(N.startsWith("#")){if(W&&!t(Q).has(W))$.push(N);continue}let R=N.split("#",1)[0].split("?",1)[0];if(!R)continue;let _;try{_=decodeURIComponent(R.replace(/^<|>$/g,""))}catch{$.push(N);continue}let G=_.startsWith("/")?y.resolve(Z,`.${_}`):y.resolve(y.dirname(Q),_),V=y4(G);if(!V){$.push(N);continue}if(W&&!t(V).has(W))$.push(N)}return $}function y4(K){let Z=K.endsWith(".md")?[K]:[K,`${K}.md`,y.join(K,"index.md")];for(let Q of Z)try{if(b.statSync(Q).isFile())return Q}catch{}return null}var I4=new Map;function t(K){let Z=I4.get(K);if(Z)return Z;let Q=new Set;try{let $=e(b.readFileSync(K,"utf8"));for(let Y of $.split(`
290
+ `)){let X=Y.match(/^#{1,6}\s+(.*)$/);if(!X)continue;let q=X[1].trim(),N=q.match(/\{#([\w-]+)\}\s*$/),W=N?N[1]:x4(L4(q));if(!W)continue;E4(W,Q)}}catch{}return I4.set(K,Q),Q}function T6(K){let Z=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,$;while(($=Q.exec(K))!==null){let Y=$[1],X=$[2];if(!Y||Y.trim()==="")Z.push(X)}return Z}function z6(K){if(console.log(""),B("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${z(K.totalPages.toString(),"blue")}`),console.log(`Passed: ${z(K.passed.toString(),"green")}`),console.log(`Errors: ${z(K.errors.length.toString(),K.errors.length>0?"red":"green")}`),console.log(`Warnings: ${z(K.warnings.length.toString(),K.warnings.length>0?"yellow":"green")}`),console.log(""),K.errors.length>0){j(`\u2717 ${K.errors.length} errors found:`),console.log("");let Z=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g(Z),console.log("")}if(K.warnings.length>0){h(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let Z=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g(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 O6}from"path";async function I6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
291
+ `),$=0,Y=!1,X=[];for(let R of Q){if(R.trim().startsWith("```")){Y=!Y;continue}if(!Y)X.push(R)}$=X.join(" ").split(/\s+/).filter((R)=>R.length>0).length;let N=Q.filter((R)=>R.match(/^#{1,6}\s+/)).length,W=(Z.match(/```/g)||[]).length/2;return{path:K,size:await l(K),lines:Q.length,words:$,headings:N,codeBlocks:Math.floor(W)}}async function D4(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.verbose||!1;try{console.log(z(`
292
292
  Analyzing documentation...
293
- `,"bold"));let{Glob:Y}=awaitPromise.resolve(globalThis.Bun),X=new Y("**/*.md"),q=[];for await(let J of X.scan(Q)){let A=O6(Q,J),u=await I6(A);q.push(u)}if(q.length===0)return V("No markdown files found"),!1;let N=q.reduce((J,A)=>J+A.size,0),_=q.reduce((J,A)=>J+A.lines,0),R=q.reduce((J,A)=>J+A.words,0),W=q.reduce((J,A)=>J+A.headings,0),j=q.reduce((J,A)=>J+A.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${q.length}`),console.log(`Total size: ${w(N)}`),console.log(`Total lines: ${_.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${W}`),console.log(`Code blocks: ${j}`),console.log(),$){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let J=q.map((A)=>({File:A.path.replace(`${Q}/`,""),Size:w(A.size),Lines:A.lines,Words:A.words,Headings:A.headings,"Code Blocks":A.codeBlocks}));g(J),console.log()}let G=N/q.length,B=_/q.length,H=R/q.length;console.log(z("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${w(G)}`),console.log(`Lines: ${Math.round(B)}`),console.log(`Words: ${Math.round(H)}`),console.log();let x=[...q].sort((J,A)=>A.size-J.size).slice(0,5);if(x.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let J of x){let A=J.path.replace(`${Q}/`,"");console.log(` ${A.padEnd(40)} ${w(J.size)}`)}console.log()}let E=Math.ceil(R/200);return U(`Estimated reading time: ${E} minutes`),!0}catch(Y){return V(`Failed to generate statistics: ${Y}`),!1}}var I=new y6("bunpress"),M={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function u4(K){let Z=new m4("**/*.md"),Q=[];for await(let $ of Z.scan(K))Q.push(D(K,$));return Q}async function D6(K,Z,Q=!1){let $=`${Z}/public`;try{await x6($);let Y=new m4("**/*");for await(let X of Y.scan($)){let q=D($,X),N=D(K,X);await g4(D(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await L6(q,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}function w6(K,Z,Q){let $=Z.replace(/^\.\//,""),Y=(W)=>W.replace(/^\.\//,"").replace($,"").replace(/^\//,"").replace(/\.md$/,"");if(!Q.enabled)return K.map((W)=>({sourceFile:W,relativePath:Y(W),locale:Q.defaultLocale}));let X=Q.locales,q=new Set(X),N=new Map;for(let W of X)N.set(W,new Map);let _=new Set;for(let W of K){let j=Y(W),G=j.split("/");if(G.length>1&&q.has(G[0])&&G[0]!==Q.defaultLocale){let H=G.slice(1).join("/");N.get(G[0]).set(H,W),_.add(H);continue}let B=j.match(/^(.*)\.([A-Za-z-]+)$/);if(B&&q.has(B[2])){N.get(B[2]).set(B[1],W),_.add(B[1]);continue}N.get(Q.defaultLocale).set(j,W),_.add(j)}let R=[];for(let W of X)for(let j of _){let G=N.get(W).get(j)??N.get(Q.defaultLocale).get(j);if(!G)continue;R.push({sourceFile:G,relativePath:j,locale:W})}return R}async function b6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let Y=await h4(K,Q);if(await Bun.write(D(Z,P4.replace(/^\//,"")),JSON.stringify(Y)),$)console.log(`Indexed ${Y.length} sections for search.`)}catch(Y){if($)console.error("Error generating search index:",Y)}}async function C6(K,Z,Q,$){try{if(Q.sitemap?.enabled!==!1&&a(Q))await k4(K,Z,Q);if(Q.robots?.enabled!==!1)await v4(Z,Q);if(Q.rss?.enabled)await C4(K,Z,Q,Q.rss)}catch(Y){if($)console.error("Error generating SEO files:",Y)}}async function v6(K={}){let Z=await O;if(!K.config)return Z;let Q=F6(S.cwd(),K.config);if(!S6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),Y=$.default??$;return b4({...Z,...Y})}async function w4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await v6(K),Q=K.outdir||Z.outDir||M.outdir,$=D(Q,".bunpress"),Y=`${$}.tmp-${S.pid}`,X=K.dir||Z.docsDir||M.docsdir,q=K.verbose??M.verbose,N=K.minify??!1,_=K.sourcemap??!1,R=performance.now(),W=new v("Building documentation...");if(!q)W.start();await e(Y,{recursive:!0,force:!0}),await g4(Y,{recursive:!0});let j=await u4(X);if(j.length===0){if(!q)W.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 ${j.length} markdown files:`),j.forEach((G)=>console.log(`- ${G}`));try{let{markdownToHtml:G,wrapInLayout:B}=await import("./chunk-68ambtz9.js"),{loadI18nTranslations:H,resolveI18nConfig:x}=await import("./chunk-97v7x3vt.js"),{mkdir:E,writeFile:J}=await import("fs/promises"),A=await H(x(Z),Z);if(q)console.log("Transforming markdown to HTML...");let u=w6(j,X,A);for(let C of u){let f4=await Bun.file(C.sourceFile).text(),{html:d4,frontmatter:Z4}=await G(f4,X),m=C.relativePath,p4=`/${m}`,c4=Z4.layout||"doc",l4=await B(d4,Z,p4,c4,Z4,{i18n:A,locale:C.locale,sourceFile:C.sourceFile,docsDir:X}),a4=m==="index"||m.endsWith("/index"),$4=C.locale&&C.locale!==A.defaultLocale&&A.enabled?D(Y,C.locale):Y,f=a4?D($4,`${m}.html`):D($4,m,"index.html"),X4=f.substring(0,f.lastIndexOf("/"));if(X4)await E(X4,{recursive:!0});if(await J(f,l4),q)console.log(`Generated: ${f}`)}if(q)console.log(`Processed ${j.length} markdown files into ${u.length} pages.`);if(await D6(Y,X,q),await P6(Y),await k6(Y,Z),K.searchIndex!==!1)await b6(X,Y,Z,q||!1);if(await C6(X,Y,Z,q||!1),K.checkManifest)await W4(Y,K.checkManifest,d);if(await e($,{recursive:!0,force:!0}),await E6(Y,$),K.manifest)await _4($,K.manifest,d);let Q4=performance.now()-R;if(!q)W.succeed(`Built ${j.length} pages to HTML in ${n(Q4)}`);else T(`Build completed in ${n(Q4)}`),console.log(`
294
- Generated ${j.length} HTML files in ${$}`);return!0}catch(G){if(await e(Y,{recursive:!0,force:!0}),!q)W.fail("Build failed");return console.error("Error during build:",G),!1}}async function k6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-68ambtz9.js"),X=`
293
+ `,"bold"));let{Glob:Y}=awaitPromise.resolve(globalThis.Bun),X=new Y("**/*.md"),q=[];for await(let J of X.scan(Q)){let A=O6(Q,J),f=await I6(A);q.push(f)}if(q.length===0)return j("No markdown files found"),!1;let N=q.reduce((J,A)=>J+A.size,0),W=q.reduce((J,A)=>J+A.lines,0),R=q.reduce((J,A)=>J+A.words,0),_=q.reduce((J,A)=>J+A.headings,0),G=q.reduce((J,A)=>J+A.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${q.length}`),console.log(`Total size: ${w(N)}`),console.log(`Total lines: ${W.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${_}`),console.log(`Code blocks: ${G}`),console.log(),$){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let J=q.map((A)=>({File:A.path.replace(`${Q}/`,""),Size:w(A.size),Lines:A.lines,Words:A.words,Headings:A.headings,"Code Blocks":A.codeBlocks}));g(J),console.log()}let V=N/q.length,U=W/q.length,H=R/q.length;console.log(z("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${w(V)}`),console.log(`Lines: ${Math.round(U)}`),console.log(`Words: ${Math.round(H)}`),console.log();let S=[...q].sort((J,A)=>A.size-J.size).slice(0,5);if(S.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let J of S){let A=J.path.replace(`${Q}/`,"");console.log(` ${A.padEnd(40)} ${w(J.size)}`)}console.log()}let x=Math.ceil(R/200);return B(`Estimated reading time: ${x} minutes`),!0}catch(Y){return j(`Failed to generate statistics: ${Y}`),!1}}var I=new y6("bunpress"),M={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function f4(K){let Z=new m4("**/*.md"),Q=[];for await(let $ of Z.scan(K))Q.push(D(K,$));return Q}async function D6(K,Z,Q=!1){let $=`${Z}/public`;try{await x6($);let Y=new m4("**/*");for await(let X of Y.scan($)){let q=D($,X),N=D(K,X);await g4(D(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await L6(q,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}function w6(K,Z,Q){let $=Z.replace(/^\.\//,""),Y=(_)=>_.replace(/^\.\//,"").replace($,"").replace(/^\//,"").replace(/\.md$/,"");if(!Q.enabled)return K.map((_)=>({sourceFile:_,relativePath:Y(_),locale:Q.defaultLocale}));let X=Q.locales,q=new Set(X),N=new Map;for(let _ of X)N.set(_,new Map);let W=new Set;for(let _ of K){let G=Y(_),V=G.split("/");if(V.length>1&&q.has(V[0])&&V[0]!==Q.defaultLocale){let H=V.slice(1).join("/");N.get(V[0]).set(H,_),W.add(H);continue}let U=G.match(/^(.*)\.([A-Za-z-]+)$/);if(U&&q.has(U[2])){N.get(U[2]).set(U[1],_),W.add(U[1]);continue}N.get(Q.defaultLocale).set(G,_),W.add(G)}let R=[];for(let _ of X)for(let G of W){let V=N.get(_).get(G)??N.get(Q.defaultLocale).get(G);if(!V)continue;R.push({sourceFile:V,relativePath:G,locale:_})}return R}async function b6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let Y=await h4(K,Q);if(await Bun.write(D(Z,P4.replace(/^\//,"")),JSON.stringify(Y)),$)console.log(`Indexed ${Y.length} sections for search.`)}catch(Y){if($)console.error("Error generating search index:",Y)}}async function C6(K,Z,Q,$){try{if(Q.sitemap?.enabled!==!1&&a(Q))await k4(K,Z,Q);if(Q.robots?.enabled!==!1)await v4(Z,Q);if(Q.rss?.enabled)await C4(K,Z,Q,Q.rss)}catch(Y){if($)console.error("Error generating SEO files:",Y)}}async function v6(K={}){let Z=await O;if(!K.config)return Z;let Q=F6(E.cwd(),K.config);if(!S6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),Y=$.default??$;return b4({...Z,...Y})}async function w4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await v6(K),Q=K.outdir||Z.outDir||M.outdir,$=D(Q,".bunpress"),Y=`${$}.tmp-${E.pid}`,X=K.dir||Z.docsDir||M.docsdir,q=K.verbose??M.verbose,N=K.minify??!1,W=K.sourcemap??!1,R=performance.now(),_=new v("Building documentation...");if(!q)_.start();await K4(Y,{recursive:!0,force:!0}),await g4(Y,{recursive:!0});let G=await f4(X);if(G.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 ${G.length} markdown files:`),G.forEach((V)=>console.log(`- ${V}`));try{let{markdownToHtml:V,wrapInLayout:U}=await import("./chunk-9b1emg4d.js"),{loadI18nTranslations:H,resolveI18nConfig:S}=await import("./chunk-wg17w4a2.js"),{mkdir:x,writeFile:J}=await import("fs/promises"),A=await H(S(Z),Z);if(q)console.log("Transforming markdown to HTML...");let f=w6(G,X,A);for(let C of f){let u4=await Bun.file(C.sourceFile).text(),{html:p4,frontmatter:$4}=await V(u4,X),m=C.relativePath,c4=`/${m}`,d4=$4.layout||"doc",l4=await U(p4,Z,c4,d4,$4,{i18n:A,locale:C.locale,sourceFile:C.sourceFile,docsDir:X}),a4=m==="index"||m.endsWith("/index"),X4=C.locale&&C.locale!==A.defaultLocale&&A.enabled?D(Y,C.locale):Y,u=a4?D(X4,`${m}.html`):D(X4,m,"index.html"),Y4=u.substring(0,u.lastIndexOf("/"));if(Y4)await x(Y4,{recursive:!0});if(await J(u,l4),q)console.log(`Generated: ${u}`)}if(q)console.log(`Processed ${G.length} markdown files into ${f.length} pages.`);if(await D6(Y,X,q),await P6(Y),await k6(Y,Z),K.searchIndex!==!1)await b6(X,Y,Z,q||!1);if(await C6(X,Y,Z,q||!1),K.checkManifest)await R4(Y,K.checkManifest,p);if(await K4($,{recursive:!0,force:!0}),await E6(Y,$),K.manifest)await W4($,K.manifest,p);let Z4=performance.now()-R;if(!q)_.succeed(`Built ${G.length} pages to HTML in ${i(Z4)}`);else T(`Build completed in ${i(Z4)}`),console.log(`
294
+ Generated ${G.length} HTML files in ${$}`);return!0}catch(V){if(await K4(Y,{recursive:!0,force:!0}),!q)_.fail("Build failed");return console.error("Error during build:",V),!1}}async function k6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-9b1emg4d.js"),X=`
295
295
  <style>
296
296
  .NotFound {
297
297
  padding: 64px 24px 96px;
@@ -368,9 +368,9 @@ Generated ${j.length} HTML files in ${$}`);return!0}catch(G){if(await e(Y,{recur
368
368
  </a>
369
369
  </div>
370
370
  </div>
371
- `,q=await $(X,Z,"/404","doc");await Bun.write(D(K,"404.html"),q)}async function P6(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:M.verbose}).action(async(K)=>{if(!await w4(K))S.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await O,Y=K.dir||$.docsDir||"./docs";console.log(`
371
+ `,q=await $(X,Z,"/404","doc");await Bun.write(D(K,"404.html"),q)}async function P6(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:M.verbose}).action(async(K)=>{if(!await w4(K))E.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await O,Y=K.dir||$.docsDir||"./docs";console.log(`
372
372
  Watching for changes...`),Q(Y,{recursive:!0},async(X,q)=>{if(q&&q.endsWith(".md"))console.log(`
373
- Detected change in ${q}, rebuilding...`),await w4(K)}),await new Promise(()=>{})}});I.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:M.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:M.watch}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{let Z=await O,Q=K.port||M.port,$=K.dir||Z.docsDir||M.docsdir,Y=K.watch??M.watch,X=K.verbose??M.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:Y,verbose:X});let{serveCLI:q}=await import("./chunk-68ambtz9.js");await q({port:Q,root:$,watch:Y,config:Z})});async function h6(K={}){let Z=await O,Q=K.dir||Z.docsDir||M.docsdir,$=K.output||"./docs.md",Y=K.full??!1,X=K.verbose??M.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${Y}`);let q=await u4(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 N=`# Documentation
373
+ Detected change in ${q}, rebuilding...`),await w4(K)}),await new Promise(()=>{})}});I.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:M.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:M.watch}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{let Z=await O,Q=K.port||M.port,$=K.dir||Z.docsDir||M.docsdir,Y=K.watch??M.watch,X=K.verbose??M.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:Y,verbose:X});let{serveCLI:q}=await import("./chunk-9b1emg4d.js");await q({port:Q,root:$,watch:Y,config:Z})});async function h6(K={}){let Z=await O,Q=K.dir||Z.docsDir||M.docsdir,$=K.output||"./docs.md",Y=K.full??!1,X=K.verbose??M.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${Y}`);let q=await f4(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 N=`# Documentation
374
374
 
375
375
  `;N+=`Generated: ${new Date().toISOString()}
376
376
 
@@ -378,16 +378,16 @@ Detected change in ${q}, rebuilding...`),await w4(K)}),await new Promise(()=>{})
378
378
 
379
379
  `,N+=`---
380
380
 
381
- `;for(let _ of q){let R=_.replace(`${Q}/`,""),W=await Bun.file(_).text();if(X)console.log(`Processing: ${R}`);if(N+=`## File: ${R}
381
+ `;for(let W of q){let R=W.replace(`${Q}/`,""),_=await Bun.file(W).text();if(X)console.log(`Processing: ${R}`);if(N+=`## File: ${R}
382
382
 
383
- `,Y)N+=W,N+=`
383
+ `,Y)N+=_,N+=`
384
384
 
385
- `;else{let j=W.split(`
386
- `),G=!1,B="";for(let H of j){if(H.trim()==="---")if(!G){G=!0;continue}else{if(G=!1,B)N+="**Frontmatter:**\n```yaml\n",N+=B,N+="```\n\n",B="";continue}if(G){B+=`${H}
385
+ `;else{let G=_.split(`
386
+ `),V=!1,U="";for(let H of G){if(H.trim()==="---")if(!V){V=!0;continue}else{if(V=!1,U)N+="**Frontmatter:**\n```yaml\n",N+=U,N+="```\n\n",U="";continue}if(V){U+=`${H}
387
387
  `;continue}if(H.match(/^#{1,6}\s+/))N+=`${H}
388
388
  `}N+=`
389
389
  `}N+=`---
390
390
 
391
391
  `}return await Bun.write($,N),console.log(`
392
- LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.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:M.verbose}).action(async(K)=>{if(!await h6(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 U4(K))S.exit(1)});I.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:M.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{await O4(K)});I.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:M.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await j4(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:M.verbose}).action(async(K)=>{if(!await M4(K))S.exit(1)});I.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await G4(K))S.exit(1)});I.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await V4(K))S.exit(1)});I.command("config:init","Initialize configuration file").action(async(K)=>{if(!await A4(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:M.verbose}).action(async(K,Z)=>{if(!await T4(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:M.verbose}).action(async(K)=>{if(!await D4(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 F4(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:M.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-npke9r7g.js");if(!await Z(K))S.exit(1)});I.help();I.version(d);var K4=Bun.argv[1]||"",m6=K4.endsWith("/bunpress")||K4.endsWith("/cli.ts")||K4.endsWith("/cli.js");if(m6)I.parse();
393
- export{T as p,V as q,U as r,v as s,u4 as t,v6 as u,w4 as v};
392
+ LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.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:M.verbose}).action(async(K)=>{if(!await h6(K))E.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 B4(K))E.exit(1)});I.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:M.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{await O4(K)});I.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:M.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await V4(K))E.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:M.verbose}).action(async(K)=>{if(!await U4(K))E.exit(1)});I.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await j4(K))E.exit(1)});I.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await A4(K))E.exit(1)});I.command("config:init","Initialize configuration file").action(async(K)=>{if(!await J4(K))E.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:M.verbose}).action(async(K,Z)=>{if(!await z4(K,Z))E.exit(1)});I.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await D4(K))E.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 F4(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:M.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-kr71zsw7.js");if(!await Z(K))E.exit(1)});I.help();I.version(p);var Q4=Bun.argv[1]||"",m6=Q4.endsWith("/bunpress")||Q4.endsWith("/cli.ts")||Q4.endsWith("/cli.js");if(m6)I.parse();
393
+ export{T as p,j as q,B as r,v as s,f4 as t,v6 as u,w4 as v};
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 A,j as zj,k as Bj,l as Dj,m as Ej,n as Gj,o as Hj}from"../chunk-tjkfq43b.js";import{A as w,w as j,x as k,y as q,z as u}from"../chunk-bxyvmqbx.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-mp1mg7s9.js";import{ca as F,da as R,ea as U,fa as m,ga as x,ha as C,ia as l,ja as h,ka as y}from"../chunk-vyk71xvd.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};
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-c53y7rmn.js";import{A as w,w as j,x as k,y as q,z as u}from"../chunk-s7tcgrb6.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-kvkhq8vp.js";import{ca as F,da as R,ea as U,fa as m,ga as x,ha as C,ia as l,ja as h,ka as y}from"../chunk-4r44z49z.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};
@@ -2,6 +2,7 @@ export declare interface BunPressConfig {
2
2
  verbose?: boolean
3
3
  title?: string
4
4
  description?: string
5
+ lang?: string
5
6
  url?: string
6
7
  head?: Array<[string, Record<string, string | number | boolean>?]>
7
8
  darkMode?: boolean | 'auto' | 'dark' | 'light'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/bunpress",
3
3
  "type": "module",
4
- "version": "0.2.12",
4
+ "version": "0.2.14",
5
5
  "description": "Modern documentation engine. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -1,38 +0,0 @@
1
- // @bun
2
- var j=import.meta.require;function X(q){return(q.sitemap?.baseUrl||q.url||"").replace(/\/$/,"")}var Y={"search.placeholder":"Search documentation","toc.title":"On this page","nav.menu":"Menu","search.noResults":"No results for","theme.toggle":"Toggle dark mode"};function O(q){let B=q?.i18n,H=(B?.locales??[]).filter(Boolean),J=B?.defaultLocale||H[0]||"en",K=(B?.enabled??H.length>1)&&H.length>0;return{enabled:K,locales:K?H:[J],defaultLocale:J,fallbackLocale:B?.fallbackLocale??J,localePath:B?.localePath??"./locales",detectLocale:B?.detectLocale===!0,localeNames:B?.localeNames??{},localeConfig:B?.localeConfig??{},translate:(M)=>Y[M]??M}}async function A(q,B){if(!q.enabled)return q;try{let{createTranslator:H,loadTranslations:J}=await import("@stacksjs/ts-i18n"),K=await J({translationsDir:q.localePath,defaultLocale:q.defaultLocale,fallbackLocale:q.fallbackLocale,sources:B?.i18n?.sources??["ts","yaml","json"],optional:!0,verbose:!1}),M=H(K,{defaultLocale:q.defaultLocale,fallbackLocale:q.fallbackLocale}),V=new Set;for(let N of Object.values(K))for(let P of Object.keys(N??{}))V.add(P);let Z=[...V].sort((N,P)=>N==="theme"?-1:P==="theme"?1:N.localeCompare(P));return{...q,translate:(N,P,$)=>{for(let W of[N,...Z.map((Q)=>`${Q}.${N}`)])try{let Q=M(W,P,$);if(typeof Q==="string"&&Q&&Q!==W)return Q}catch{}return Y[N]??N}}}catch(H){return console.warn("[bunpress] i18n translations could not be loaded; falling back to defaults \u2014",H instanceof Error?H.message:H),q}}function E(q,B){if(!q.enabled)return{locale:q.defaultLocale,path:B};let H=B.match(/^\/([^/]+)(\/.*)?$/);if(H&&q.locales.includes(H[1])&&H[1]!==q.defaultLocale)return{locale:H[1],path:H[2]||"/"};return{locale:q.defaultLocale,path:B}}function x(q,B,H){if(!q.enabled||B===q.defaultLocale)return H||"/";return`/${B}${H==="/"?"":H}`||`/${B}`}function I(q,B,H,J){let K=J==="/"?"/index":J,M=[];if(q.enabled&&H!==q.defaultLocale)M.push(`${B}/${H}${K}.md`),M.push(`${B}/${H}${K}/index.md`),M.push(`${B}${K}.${H}.md`);if(M.push(`${B}${K}.md`),M.push(`${B}${K}/index.md`),q.enabled)M.push(`${B}${K}.${q.defaultLocale}.md`);return M}function _(q,B,H){let J=B.localeConfig[H];if(!J)return q;return{...q,...J,themeConfig:J.themeConfig?{...q.themeConfig,...J.themeConfig}:q.themeConfig,markdown:J.markdown?{...q.markdown,...J.markdown}:q.markdown}}function D(q,B){return q.localeNames[B]??B}function F(q,B,H){if(!q.enabled)return"";let J=X(B);if(!J)return"";let K=q.locales.map((M)=>{let V=`${J}${x(q,M,H==="/index"?"/":H)}`;return`<link rel="alternate" hreflang="${M}" href="${V}">`});return K.push(`<link rel="alternate" hreflang="x-default" href="${J}${H==="/index"?"/":H}">`),K.join(`
3
- `)}function R(q){if(!q.enabled||!q.detectLocale)return"";return`
4
- (function () {
5
- var LOCALES = ${JSON.stringify(q.locales)};
6
- var DEFAULT = ${JSON.stringify(q.defaultLocale)};
7
- var KEY = 'bunpress-locale';
8
-
9
- try {
10
- var current = location.pathname.split('/')[1];
11
- if (LOCALES.indexOf(current) !== -1) {
12
- // Reading a non-default locale is itself a choice; remember it.
13
- localStorage.setItem(KEY, current);
14
- return;
15
- }
16
- if (localStorage.getItem(KEY)) return;
17
-
18
- var preferred = (navigator.languages || [navigator.language || ''])
19
- .map(function (tag) { return String(tag).toLowerCase(); });
20
-
21
- for (var i = 0; i < preferred.length; i++) {
22
- var tag = preferred[i];
23
- var exact = LOCALES.indexOf(tag) !== -1 ? tag : null;
24
- // 'en-GB' should match an 'en' locale.
25
- var base = exact || (LOCALES.indexOf(tag.split('-')[0]) !== -1 ? tag.split('-')[0] : null);
26
- if (base && base !== DEFAULT) {
27
- localStorage.setItem(KEY, base);
28
- location.replace(\`/\${base}\${location.pathname}\${location.search}\${location.hash}\`);
29
- return;
30
- }
31
- if (base === DEFAULT) return;
32
- }
33
- } catch (_) {
34
- // Storage or history unavailable: leave the reader where they are.
35
- }
36
- })();
37
- `.trim()}
38
- export{j as aa,X as ba,O as ca,A as da,E as ea,x as fa,I as ga,_ as ha,D as ia,F as ja,R as ka};