@stacksjs/bunpress 0.2.30 → 0.2.32

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{s as b,t as c}from"../chunk-3gfsnj29.js";import"../chunk-5dtz0br7.js";import{ca as a}from"../chunk-778jqyb6.js";import"../chunk-gn1n2yxt.js";export{b as resolveConfig,a as findMarkdownFiles,c as buildDocs};
3
+ import{s as b,t as c}from"../chunk-ebrg03kn.js";import"../chunk-5dtz0br7.js";import{ca as a}from"../chunk-f5ycxw18.js";import"../chunk-gn1n2yxt.js";export{b as resolveConfig,a as findMarkdownFiles,c as buildDocs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{v as f4,w as c4,y as p4}from"./chunk-5dtz0br7.js";import{$ as u4,A as g4,B as O,D as $4,I as w4,J as b4,K as v4,Z as d4,ca as r,da as l4}from"./chunk-778jqyb6.js";import{fa as F,ga as i}from"./chunk-gn1n2yxt.js";var{Glob:g6}=globalThis.Bun;import{copyFile as f6,mkdir as c6,readdir as p6}from"fs/promises";import{existsSync as d6}from"fs";import{join as v,resolve as u6}from"path";import S from"process";import{CLI as l6}from"@stacksjs/clapp";var p="0.2.30";import{randomUUID as e4}from"crypto";import{mkdir as R4,mkdtemp as K6,readFile as Q6,realpath as Z6,rename as o,rm as d,rmdir as $6,writeFile as X6}from"fs/promises";import{basename as Y6,dirname as W4,join as q4,resolve as N6}from"path";var u=new Map;async function H6(K,Z){let Q=u.get(K)??Promise.resolve(),$,Y=new Promise((H)=>{$=H}),X=Q.then(()=>Y);u.set(K,X),await Q;try{return await Z()}finally{if($(),u.get(K)===X)u.delete(K)}}function _6(K){return K!==null&&typeof K==="object"&&"code"in K&&K.code==="ENOENT"}async function G4(K,Z,Q){let $=N6(K);await R4(W4($),{recursive:!0});let Y=q4(await Z6(W4($)),Y6($));return H6(Y,async()=>{let X=`${Y}.lock`;try{await R4(X,{mode:448})}catch(V){if(V!==null&&typeof V==="object"&&"code"in V&&V.code==="EEXIST")throw Error(`Documentation output is locked: ${X}. Verify the recorded owner has stopped before removing a stale lock.`);throw V}let H=JSON.stringify({pid:process.pid,token:e4()}),N=q4(X,"owner.json"),_,R,q=!1,G=!1;try{await X6(N,H,{flag:"wx",mode:384}),_=await K6(`${Y}.tmp-`);let V=await Z(_),U=`${_}.previous`;try{await o(Y,U),R=U}catch(W){if(!_6(W))throw W}if(await o(_,Y),q=!0,await Q?.(),G=!0,R)await d(R,{recursive:!0});return V}catch(V){if(!G&&(q||R))try{if(q)await d(Y,{recursive:!0});if(R)await o(R,Y)}catch(U){throw AggregateError([V,U],`Documentation publication failed; previous output is retained at ${R??Y}`)}throw V}finally{try{if(_)await d(_,{recursive:!0,force:!0})}finally{if(await Q6(N,"utf8").catch(()=>{return})===H)await d(N),await $6(X);else throw Error(`Documentation output lock ownership changed: ${X}`)}}})}var{Glob:R6}=globalThis.Bun;import{dirname as W6,relative as q6,resolve as l,sep as V4}from"path";import{mkdir as G6}from"fs/promises";function A4(K){return V4==="/"?K:K.split(V4).join("/")}function V6(K){let Z=new Bun.CryptoHasher("sha256");return Z.update(K),Z.digest("hex")}async function j4(K,Z,Q){let $=l(K),Y=Q?A4(q6($,l(Q))):void 0,X=[],H=new R6("**/*");for await(let R of H.scan({cwd:$,onlyFiles:!0})){let q=A4(R);if(q===Y)continue;X.push(q)}X.sort((R,q)=>R.localeCompare(q));let N=[],_=new Bun.CryptoHasher("sha256");for(let R of X){let q=new Uint8Array(await Bun.file(l($,R)).arrayBuffer()),G=V6(q);N.push({path:R,bytes:q.byteLength,sha256:G}),_.update(`${R}\x00${q.byteLength}\x00${G}
2
+ import{v as f4,w as c4,y as p4}from"./chunk-5dtz0br7.js";import{$ as u4,A as g4,B as O,D as $4,I as w4,J as b4,K as v4,Z as d4,ca as r,da as l4}from"./chunk-f5ycxw18.js";import{fa as F,ga as i}from"./chunk-gn1n2yxt.js";var{Glob:g6}=globalThis.Bun;import{copyFile as f6,mkdir as c6,readdir as p6}from"fs/promises";import{existsSync as d6}from"fs";import{join as v,resolve as u6}from"path";import S from"process";import{CLI as l6}from"@stacksjs/clapp";var p="0.2.32";import{randomUUID as e4}from"crypto";import{mkdir as R4,mkdtemp as K6,readFile as Q6,realpath as Z6,rename as o,rm as d,rmdir as $6,writeFile as X6}from"fs/promises";import{basename as Y6,dirname as W4,join as q4,resolve as N6}from"path";var u=new Map;async function H6(K,Z){let Q=u.get(K)??Promise.resolve(),$,Y=new Promise((H)=>{$=H}),X=Q.then(()=>Y);u.set(K,X),await Q;try{return await Z()}finally{if($(),u.get(K)===X)u.delete(K)}}function _6(K){return K!==null&&typeof K==="object"&&"code"in K&&K.code==="ENOENT"}async function G4(K,Z,Q){let $=N6(K);await R4(W4($),{recursive:!0});let Y=q4(await Z6(W4($)),Y6($));return H6(Y,async()=>{let X=`${Y}.lock`;try{await R4(X,{mode:448})}catch(V){if(V!==null&&typeof V==="object"&&"code"in V&&V.code==="EEXIST")throw Error(`Documentation output is locked: ${X}. Verify the recorded owner has stopped before removing a stale lock.`);throw V}let H=JSON.stringify({pid:process.pid,token:e4()}),N=q4(X,"owner.json"),_,R,q=!1,G=!1;try{await X6(N,H,{flag:"wx",mode:384}),_=await K6(`${Y}.tmp-`);let V=await Z(_),U=`${_}.previous`;try{await o(Y,U),R=U}catch(W){if(!_6(W))throw W}if(await o(_,Y),q=!0,await Q?.(),G=!0,R)await d(R,{recursive:!0});return V}catch(V){if(!G&&(q||R))try{if(q)await d(Y,{recursive:!0});if(R)await o(R,Y)}catch(U){throw AggregateError([V,U],`Documentation publication failed; previous output is retained at ${R??Y}`)}throw V}finally{try{if(_)await d(_,{recursive:!0,force:!0})}finally{if(await Q6(N,"utf8").catch(()=>{return})===H)await d(N),await $6(X);else throw Error(`Documentation output lock ownership changed: ${X}`)}}})}var{Glob:R6}=globalThis.Bun;import{dirname as W6,relative as q6,resolve as l,sep as V4}from"path";import{mkdir as G6}from"fs/promises";function A4(K){return V4==="/"?K:K.split(V4).join("/")}function V6(K){let Z=new Bun.CryptoHasher("sha256");return Z.update(K),Z.digest("hex")}async function j4(K,Z,Q){let $=l(K),Y=Q?A4(q6($,l(Q))):void 0,X=[],H=new R6("**/*");for await(let R of H.scan({cwd:$,onlyFiles:!0})){let q=A4(R);if(q===Y)continue;X.push(q)}X.sort((R,q)=>R.localeCompare(q));let N=[],_=new Bun.CryptoHasher("sha256");for(let R of X){let q=new Uint8Array(await Bun.file(l($,R)).arrayBuffer()),G=V6(q);N.push({path:R,bytes:q.byteLength,sha256:G}),_.update(`${R}\x00${q.byteLength}\x00${G}
3
3
  `)}return{schema_version:1,generator:"bunpress",generator_version:Z,outputs:N,tree_sha256:_.digest("hex")}}async function M4(K,Z,Q){let $=await j4(K,Q,Z);return await G6(W6(l(Z)),{recursive:!0}),await Bun.write(Z,`${JSON.stringify($,null,2)}
4
4
  `),$}function J4(K){return new Map(K.outputs.map((Z)=>[Z.path,Z]))}async function U4(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 j4(K,Q,Z);if(JSON.stringify(Y)===JSON.stringify($))return Y;let X=J4($),H=J4(Y),N=Y.outputs.filter((G)=>!X.has(G.path)).map((G)=>G.path),_=$.outputs.filter((G)=>!H.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}]`}),q=[$.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}: ${q.join("; ")||"tree hash changed"}`)}import{existsSync as A6}from"fs";import{rm as J6}from"fs/promises";import{join as j6}from"path";var I={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`${I[Z]}${K}${I.reset}`}function T(K){console.log(`${I.green}\u2713${I.reset} ${K}`)}function A(K){console.error(`${I.red}\u2717${I.reset} ${K}`)}function h(K){console.warn(`${I.yellow}\u26A0${I.reset} ${K}`)}function B(K){console.log(`${I.blue}\u2139${I.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 t(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var B4=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class C{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(K){this.text=K}start(){if(B4){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let K=this.frames[this.index];process.stdout.write(`\r${I.cyan}${K}${I.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(K){this.stop(),T(K||this.text)}fail(K){this.stop(),A(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!B4)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function a(K,Z=!1){let Q=Z?"Y/n":"y/N";process.stdout.write(`${I.cyan}?${I.reset} ${K} ${I.dim}(${Q})${I.reset}: `);let $=Bun.file("/dev/stdin").stream().getReader(),Y=new TextDecoder,{value:X}=await $.read(),H=Y.decode(X).trim().toLowerCase();if(!H)return Z;return H==="y"||H==="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((H)=>String(Y[H]).padEnd(Q[H])).join(" ");console.log(X)}}async function n(K){try{return Bun.file(K).size}catch{return 0}}async function M6(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}`,H=await n(X);$+=H}return $}catch{return 0}}async function T4(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=j6(Q,".bunpress"),Y=K.force||!1,X=K.verbose||!1;try{if(!A6($))return B(`Directory "${$}" does not exist, nothing to clean`),!0;let N=await M6($);if(X)B(`Found "${$}" (${w(N)})`);if(!Y){if(!await a(`Delete "${$}" directory? (${w(N)})`,!1))return B("Clean cancelled"),!1}let _=process.env.VITEST==="true"||!1,R=null;if(!_&&!X)R=new C("Cleaning build artifacts..."),R.start();if(await J6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${w(N)} from "${$}"`);else if(X||_)T(`Cleaned ${w(N)} from "${$}"`);return!0}catch(H){return A(`Failed to clean directory: ${H}`),!1}}import{existsSync as e}from"fs";import{join as K4}from"path";async function z4(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let Y of Z){let X=K4(process.cwd(),Y);if(e(X)){Q=X;break}}if(!Q)return A("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 A(`Failed to show configuration: ${Z}`),!1}}async function O4(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let _ of Q){let R=K4(process.cwd(),_);if(e(R)){$=R;break}}if(!$)return A("No configuration file found"),!1;if(Z)B(`Validating ${$}...`);let X=(await import($)).default;if(!X)return A("Configuration file does not export a default object"),!1;let H=[],N=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")H.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")H.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))H.push("nav should be an array");else for(let[_,R]of X.nav.entries())if(!R.text||!R.link)H.push(`nav[${_}] is missing required fields (text, link)`)}if(!i(X))N.push("no `url` set: sitemap, RSS, canonical links and Open Graph tags are all skipped without an absolute base URL");if(H.length>0){A("Configuration validation failed:");for(let _ of H)console.log(` \u2022 ${_}`);return!1}for(let _ of N)h(_);return T("Configuration is valid \u2713"),!0}catch(Q){return A(`Failed to validate configuration: ${Q}`),!1}}async function L4(K={}){let Z=K4(process.cwd(),"bunpress.config.ts");if(e(Z))return A("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
5
5
 
@@ -290,8 +290,8 @@ ${Z}`}async function y6(K){let Z=[];async function Q($){let Y=await b.promises.r
290
290
  `)){let X=Y.match(/^#{1,6}\s+(.*)$/);if(!X)continue;let H=X[1].trim(),N=H.match(/\{#([\w-]+)\}\s*$/),_=N?N[1]:b4(w4(H));if(!_)continue;v4(_,Q)}}catch{}return y4.set(K,Q),Q}function k6(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 P6(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){A(`\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 h6}from"path";async function m6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
291
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 n(K),lines:Q.length,words:$,headings:N,codeBlocks:Math.floor(_)}}async function h4(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"),H=[];for await(let j of X.scan(Q)){let J=h6(Q,j),f=await m6(J);H.push(f)}if(H.length===0)return A("No markdown files found"),!1;let N=H.reduce((j,J)=>j+J.size,0),_=H.reduce((j,J)=>j+J.lines,0),R=H.reduce((j,J)=>j+J.words,0),q=H.reduce((j,J)=>j+J.headings,0),G=H.reduce((j,J)=>j+J.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${H.length}`),console.log(`Total size: ${w(N)}`),console.log(`Total lines: ${_.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${q}`),console.log(`Code blocks: ${G}`),console.log(),$){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let j=H.map((J)=>({File:J.path.replace(`${Q}/`,""),Size:w(J.size),Lines:J.lines,Words:J.words,Headings:J.headings,"Code Blocks":J.codeBlocks}));g(j),console.log()}let V=N/H.length,U=_/H.length,W=R/H.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(W)}`),console.log();let E=[...H].sort((j,J)=>J.size-j.size).slice(0,5);if(E.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let j of E){let J=j.path.replace(`${Q}/`,"");console.log(` ${J.padEnd(40)} ${w(j.size)}`)}console.log()}let x=Math.ceil(R/200);return B(`Estimated reading time: ${x} minutes`),!0}catch(Y){return A(`Failed to generate statistics: ${Y}`),!1}}var L=new l6("bunpress"),M={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function a6(K,Z,Q=!1){let $=`${Z}/public`;try{await p6($);let Y=new g6("**/*");for await(let X of Y.scan($)){let H=v($,X),N=v(K,X);await c6(v(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await f6(H,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function n6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let Y=await u4(K,Q);if(await Bun.write(v(Z,d4.replace(/^\//,"")),JSON.stringify(Y)),$)console.log(`Indexed ${Y.length} sections for search.`)}catch(Y){if($)console.error("Error generating search index:",Y)}}async function i6(K,Z,Q,$){try{if(Q.sitemap?.enabled!==!1&&i(Q))await p4(K,Z,Q);if(Q.robots?.enabled!==!1)await c4(Z,Q);if(Q.rss?.enabled)await f4(K,Z,Q,Q.rss)}catch(Y){if($)console.error("Error generating SEO files:",Y)}}async function s6(K={}){let Z=await O;if(!K.config)return Z;let Q=u6(S.cwd(),K.config);if(!d6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),Y=$.default??$;return g4({...Z,...Y})}async function m4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await s6(K),Q=K.outdir||Z.outDir||M.outdir,$=v(Q,".bunpress"),Y=K.dir||Z.docsDir||M.docsdir,X=K.verbose??M.verbose,H=performance.now(),N=new C("Building documentation...");if(!X)N.start();try{let _=await G4($,async(q)=>{let G=await r(Y);if(G.length===0)throw Error("No markdown files found in docs directory");if(X)console.log(`Found ${G.length} markdown files:`),G.forEach((y)=>console.log(`- ${y}`));let{markdownToHtml:V,wrapInLayout:U}=await import("./chunk-m7jpbnwq.js"),{loadI18nTranslations:W,resolveI18nConfig:E}=await import("./chunk-15vwh1bm.js"),{mkdir:x,writeFile:j}=await import("fs/promises"),J=await W(E(Z),Z);if(X)console.log("Transforming markdown to HTML...");let f=l4(G,Y,J),Y4=f.pages;for(let y of Y4){let a4=await Bun.file(y.sourceFile).text(),{html:n4,frontmatter:N4}=await V(a4,Y,{page:y,catalog:f}),m=y.relativePath,i4=`/${m}`,s4=N4.layout||"doc",r4=await U(n4,Z,i4,s4,N4,{i18n:J,locale:y.locale,sourceFile:y.sourceFile,docsDir:Y}),o4=m==="index"||m.endsWith("/index"),H4=y.locale&&y.locale!==J.defaultLocale&&J.enabled?v(q,y.locale):q,c=o4?v(H4,`${m}.html`):v(H4,m,"index.html"),_4=c.substring(0,c.lastIndexOf("/"));if(_4)await x(_4,{recursive:!0});if(await j(c,r4),X)console.log(`Generated: ${c}`)}if(X)console.log(`Processed ${G.length} markdown files into ${Y4.length} pages.`);if(await a6(q,Y,X),await o6(q),await r6(q,Z),K.searchIndex!==!1)await n6(Y,q,Z,X||!1);if(await i6(Y,q,Z,X||!1),K.checkManifest)await U4(q,K.checkManifest,p);return G.length},async()=>{if(K.manifest)await M4($,K.manifest,p)}),R=performance.now()-H;if(!X)N.succeed(`Built ${_} pages to HTML in ${t(R)}`);else T(`Build completed in ${t(R)}`),console.log(`
294
- Generated ${_} HTML files in ${$}`);return!0}catch(_){if(!X)N.fail("Build failed");return console.error("Error during build:",_),!1}}async function r6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-m7jpbnwq.js"),X=`
293
+ `,"bold"));let{Glob:Y}=awaitPromise.resolve(globalThis.Bun),X=new Y("**/*.md"),H=[];for await(let j of X.scan(Q)){let J=h6(Q,j),f=await m6(J);H.push(f)}if(H.length===0)return A("No markdown files found"),!1;let N=H.reduce((j,J)=>j+J.size,0),_=H.reduce((j,J)=>j+J.lines,0),R=H.reduce((j,J)=>j+J.words,0),q=H.reduce((j,J)=>j+J.headings,0),G=H.reduce((j,J)=>j+J.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${H.length}`),console.log(`Total size: ${w(N)}`),console.log(`Total lines: ${_.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${q}`),console.log(`Code blocks: ${G}`),console.log(),$){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let j=H.map((J)=>({File:J.path.replace(`${Q}/`,""),Size:w(J.size),Lines:J.lines,Words:J.words,Headings:J.headings,"Code Blocks":J.codeBlocks}));g(j),console.log()}let V=N/H.length,U=_/H.length,W=R/H.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(W)}`),console.log();let E=[...H].sort((j,J)=>J.size-j.size).slice(0,5);if(E.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let j of E){let J=j.path.replace(`${Q}/`,"");console.log(` ${J.padEnd(40)} ${w(j.size)}`)}console.log()}let x=Math.ceil(R/200);return B(`Estimated reading time: ${x} minutes`),!0}catch(Y){return A(`Failed to generate statistics: ${Y}`),!1}}var L=new l6("bunpress"),M={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function a6(K,Z,Q=!1){let $=`${Z}/public`;try{await p6($);let Y=new g6("**/*");for await(let X of Y.scan($)){let H=v($,X),N=v(K,X);await c6(v(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await f6(H,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function n6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let Y=await u4(K,Q);if(await Bun.write(v(Z,d4.replace(/^\//,"")),JSON.stringify(Y)),$)console.log(`Indexed ${Y.length} sections for search.`)}catch(Y){if($)console.error("Error generating search index:",Y)}}async function i6(K,Z,Q,$){try{if(Q.sitemap?.enabled!==!1&&i(Q))await p4(K,Z,Q);if(Q.robots?.enabled!==!1)await c4(Z,Q);if(Q.rss?.enabled)await f4(K,Z,Q,Q.rss)}catch(Y){if($)console.error("Error generating SEO files:",Y)}}async function s6(K={}){let Z=await O;if(!K.config)return Z;let Q=u6(S.cwd(),K.config);if(!d6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),Y=$.default??$;return g4({...Z,...Y})}async function m4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await s6(K),Q=K.outdir||Z.outDir||M.outdir,$=v(Q,".bunpress"),Y=K.dir||Z.docsDir||M.docsdir,X=K.verbose??M.verbose,H=performance.now(),N=new C("Building documentation...");if(!X)N.start();try{let _=await G4($,async(q)=>{let G=await r(Y);if(G.length===0)throw Error("No markdown files found in docs directory");if(X)console.log(`Found ${G.length} markdown files:`),G.forEach((y)=>console.log(`- ${y}`));let{markdownToHtml:V,wrapInLayout:U}=await import("./chunk-fy78hg56.js"),{loadI18nTranslations:W,resolveI18nConfig:E}=await import("./chunk-15vwh1bm.js"),{mkdir:x,writeFile:j}=await import("fs/promises"),J=await W(E(Z),Z);if(X)console.log("Transforming markdown to HTML...");let f=l4(G,Y,J),Y4=f.pages;for(let y of Y4){let a4=await Bun.file(y.sourceFile).text(),{html:n4,frontmatter:N4}=await V(a4,Y,{page:y,catalog:f}),m=y.relativePath,i4=`/${m}`,s4=N4.layout||"doc",r4=await U(n4,Z,i4,s4,N4,{i18n:J,locale:y.locale,sourceFile:y.sourceFile,docsDir:Y}),o4=m==="index"||m.endsWith("/index"),H4=y.locale&&y.locale!==J.defaultLocale&&J.enabled?v(q,y.locale):q,c=o4?v(H4,`${m}.html`):v(H4,m,"index.html"),_4=c.substring(0,c.lastIndexOf("/"));if(_4)await x(_4,{recursive:!0});if(await j(c,r4),X)console.log(`Generated: ${c}`)}if(X)console.log(`Processed ${G.length} markdown files into ${Y4.length} pages.`);if(await a6(q,Y,X),await o6(q),await r6(q,Z),K.searchIndex!==!1)await n6(Y,q,Z,X||!1);if(await i6(Y,q,Z,X||!1),K.checkManifest)await U4(q,K.checkManifest,p);return G.length},async()=>{if(K.manifest)await M4($,K.manifest,p)}),R=performance.now()-H;if(!X)N.succeed(`Built ${_} pages to HTML in ${t(R)}`);else T(`Build completed in ${t(R)}`),console.log(`
294
+ Generated ${_} HTML files in ${$}`);return!0}catch(_){if(!X)N.fail("Build failed");return console.error("Error during build:",_),!1}}async function r6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-fy78hg56.js"),X=`
295
295
  <style>
296
296
  .NotFound {
297
297
  padding: 64px 24px 96px;
@@ -322,7 +322,7 @@ Generated ${_} HTML files in ${$}`);return!0}catch(_){if(!X)N.fail("Build failed
322
322
  margin: 24px auto 18px;
323
323
  width: 64px;
324
324
  height: 1px;
325
- background-color: var(--vp-c-divider);
325
+ background-color: var(--bp-c-divider);
326
326
  }
327
327
 
328
328
  .NotFound .quote {
@@ -330,28 +330,33 @@ Generated ${_} HTML files in ${$}`);return!0}catch(_){if(!X)N.fail("Build failed
330
330
  max-width: 256px;
331
331
  font-size: 14px;
332
332
  font-weight: 500;
333
- color: var(--vp-c-text-2);
333
+ color: var(--bp-c-text-2);
334
334
  }
335
335
 
336
336
  .NotFound .action {
337
337
  padding-top: 20px;
338
338
  }
339
339
 
340
+ /* --bp-, not --vp-. These six properties carried VitePress's prefix, which
341
+ * BunPress does not declare, so each one was invalid at computed-value time
342
+ * and silently fell back: the divider drew transparent, the quote inherited,
343
+ * and this link's border drew as currentColor with no colour of its own. The
344
+ * one page a lost reader lands on, and its way out had no outline. */
340
345
  .NotFound .link {
341
346
  display: inline-block;
342
- border: 1px solid var(--vp-c-brand-1);
347
+ border: 1px solid var(--bp-c-brand-1);
343
348
  border-radius: 16px;
344
349
  padding: 3px 16px;
345
350
  font-size: 14px;
346
351
  font-weight: 500;
347
- color: var(--vp-c-brand-1);
352
+ color: var(--bp-c-brand-1);
348
353
  transition: border-color 0.25s, color 0.25s;
349
354
  text-decoration: none;
350
355
  }
351
356
 
352
357
  .NotFound .link:hover {
353
- border-color: var(--vp-c-brand-2);
354
- color: var(--vp-c-brand-2);
358
+ border-color: var(--bp-c-brand-2);
359
+ color: var(--bp-c-brand-2);
355
360
  }
356
361
  </style>
357
362
 
@@ -370,7 +375,7 @@ Generated ${_} HTML files in ${$}`);return!0}catch(_){if(!X)N.fail("Build failed
370
375
  </div>
371
376
  `,H=await $(X,Z,"/404","doc");await Bun.write(v(K,"404.html"),H)}async function o6(K){let Z=v(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)}}L.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 m4(K))S.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await O,Y=K.dir||$.docsDir||"./docs";console.log(`
372
377
  Watching for changes...`),Q(Y,{recursive:!0},async(X,H)=>{if(H&&H.endsWith(".md"))console.log(`
373
- Detected change in ${H}, rebuilding...`),await m4(K)}),await new Promise(()=>{})}});L.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:H}=await import("./chunk-m7jpbnwq.js");await H({port:Q,root:$,watch:Y,config:Z})});async function t6(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 H=await r(Q);if(H.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${H.length} markdown files`);H.sort();let N=`# Documentation
378
+ Detected change in ${H}, rebuilding...`),await m4(K)}),await new Promise(()=>{})}});L.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:H}=await import("./chunk-fy78hg56.js");await H({port:Q,root:$,watch:Y,config:Z})});async function t6(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 H=await r(Q);if(H.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${H.length} markdown files`);H.sort();let N=`# Documentation
374
379
 
375
380
  `;N+=`Generated: ${new Date().toISOString()}
376
381
 
@@ -389,5 +394,5 @@ Detected change in ${H}, rebuilding...`),await m4(K)}),await new Promise(()=>{})
389
394
  `}N+=`---
390
395
 
391
396
  `}return await Bun.write($,N),console.log(`
392
- LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}L.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 t6(K))S.exit(1)});L.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 E4(K))S.exit(1)});L.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 D4(K)});L.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 T4(K))S.exit(1)});L.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 x4(K))S.exit(1)});L.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await z4(K))S.exit(1)});L.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await O4(K))S.exit(1)});L.command("config:init","Initialize configuration file").action(async(K)=>{if(!await L4(K))S.exit(1)});L.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 F4(K,Z))S.exit(1)});L.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 h4(K))S.exit(1)});L.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 k4(K)});L.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-9sjj447p.js");if(!await Z(K))S.exit(1)});L.help();L.version(p);var X4=Bun.argv[1]||"",e6=X4.endsWith("/bunpress")||X4.endsWith("/cli.ts")||X4.endsWith("/cli.js");if(e6)L.parse();
397
+ LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}L.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 t6(K))S.exit(1)});L.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 E4(K))S.exit(1)});L.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 D4(K)});L.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 T4(K))S.exit(1)});L.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 x4(K))S.exit(1)});L.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await z4(K))S.exit(1)});L.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await O4(K))S.exit(1)});L.command("config:init","Initialize configuration file").action(async(K)=>{if(!await L4(K))S.exit(1)});L.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 F4(K,Z))S.exit(1)});L.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 h4(K))S.exit(1)});L.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 k4(K)});L.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-verdt5gx.js");if(!await Z(K))S.exit(1)});L.help();L.version(p);var X4=Bun.argv[1]||"",e6=X4.endsWith("/bunpress")||X4.endsWith("/cli.ts")||X4.endsWith("/cli.js");if(e6)L.parse();
393
398
  export{T as o,A as p,B as q,C as r,s6 as s,m4 as t};
@@ -39,7 +39,7 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
39
39
  .copy-code-button svg {
40
40
  width: 16px;
41
41
  height: 16px;
42
- color: var(--bp-c-text-2, #67676c);
42
+ color: var(--bp-c-text-2, #5c5c62);
43
43
  }
44
44
 
45
45
  .copy-code-button.copied svg {
@@ -228,7 +228,7 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
228
228
  font-size: 13px;
229
229
  font-weight: 600;
230
230
  text-align: left;
231
- color: var(--bp-c-text-2, #67676c);
231
+ color: var(--bp-c-text-2, #5c5c62);
232
232
  border-bottom: 1px solid var(--bp-c-divider, #e2e2e3);
233
233
  white-space: nowrap;
234
234
  }
@@ -294,7 +294,7 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
294
294
  .image-figure figcaption {
295
295
  margin-top: 12px;
296
296
  font-size: 14px;
297
- color: var(--bp-c-text-2, #67676c);
297
+ color: var(--bp-c-text-2, #5c5c62);
298
298
  font-style: italic;
299
299
  text-align: center;
300
300
  }
@@ -368,8 +368,8 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
368
368
  height: 32px;
369
369
  padding: 0 10px;
370
370
  background-color: transparent;
371
- border: 1px solid var(--bp-c-divider, #e2e2e3);
372
- color: var(--bp-c-text-2, #67676c);
371
+ border: 1px solid var(--bp-c-border, #8e8e92);
372
+ color: var(--bp-c-text-2, #5c5c62);
373
373
  font-family: inherit;
374
374
  font-size: 13px;
375
375
  font-weight: 500;
@@ -386,7 +386,7 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
386
386
  .copy-page-button.copy-page-toggle {
387
387
  border-radius: 0 6px 6px 0;
388
388
  padding: 0 6px;
389
- border-left: 1px solid var(--bp-c-divider, #e2e2e3);
389
+ border-left: 1px solid var(--bp-c-border, #8e8e92);
390
390
  }
391
391
 
392
392
  .copy-page-button:hover {
@@ -395,16 +395,16 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
395
395
  }
396
396
 
397
397
  .copy-page-button:focus-visible {
398
- outline: 2px solid var(--bp-c-brand-1, #5672cd);
398
+ outline: 2px solid var(--bp-c-brand-1, #3451b2);
399
399
  outline-offset: 2px;
400
400
  }
401
401
 
402
402
  .copy-page-button-group:hover .copy-page-button {
403
- border-color: var(--bp-c-brand-1, #5672cd);
403
+ border-color: var(--bp-c-brand-1, #3451b2);
404
404
  }
405
405
 
406
406
  .copy-page-button-group:hover .copy-page-toggle {
407
- border-left-color: var(--bp-c-brand-1, #5672cd);
407
+ border-left-color: var(--bp-c-brand-1, #3451b2);
408
408
  }
409
409
 
410
410
  .copy-page-button svg {
@@ -542,7 +542,7 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
542
542
 
543
543
  .copy-page-menu-item .description {
544
544
  font-size: 12px;
545
- color: var(--bp-c-text-2, #67676c);
545
+ color: var(--bp-c-text-2, #5c5c62);
546
546
  margin-top: 2px;
547
547
  }
548
548
 
@@ -595,6 +595,11 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
595
595
  }
596
596
 
597
597
  /* Theme Toggle Button */
598
+ /* Tokens, with the old literals as fallbacks. Six hardcoded greys here
599
+ * were a private copy of the palette: a site that re-themed BunPress got a
600
+ * toggle in someone else's colours, and the three light values were the
601
+ * ones that moved for contrast - so the copy would have been the one place
602
+ * still holding them. */
598
603
  .theme-toggle {
599
604
  display: flex;
600
605
  align-items: center;
@@ -606,24 +611,14 @@ import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadC
606
611
  border: 1px solid transparent;
607
612
  border-radius: 8px;
608
613
  cursor: pointer;
609
- color: #6b7280;
614
+ color: var(--bp-c-text-2, #5c5c62);
610
615
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
611
616
  }
612
617
 
613
618
  .theme-toggle:hover {
614
- color: #3c3c43;
615
- background-color: #f6f6f7;
616
- border-color: #e2e2e3;
617
- }
618
-
619
- html.dark .theme-toggle {
620
- color: #9ca3af;
621
- }
622
-
623
- html.dark .theme-toggle:hover {
624
- color: #e6edf3;
625
- background-color: #2e2e32;
626
- border-color: #3c3f44;
619
+ color: var(--bp-c-text-1, #3c3c43);
620
+ background-color: var(--bp-c-bg-alt, #f6f6f7);
621
+ border-color: var(--bp-c-border, #8e8e92);
627
622
  }
628
623
 
629
624
  .theme-toggle svg {
@@ -666,27 +661,42 @@ function getPreferredTheme() {
666
661
  return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
667
662
  }
668
663
 
669
- function setTheme(theme) {
664
+ // \`remember\` separates a choice from a reading of the machine.
665
+ //
666
+ // It used to always persist, which quietly turned the first page view into an
667
+ // explicit preference: the OS value was written to localStorage, and from then
668
+ // on the listener below - guarded on there being nothing stored - never fired
669
+ // again. A reader who had never touched the toggle stopped following their own
670
+ // machine after one visit.
671
+ //
672
+ // \`data-bp-theme\` records that script has resolved the theme, which stands
673
+ // down the prefers-color-scheme fallback in the stylesheet. Only a resolved
674
+ // choice sets it: left unset, the media query is what answers, which is what
675
+ // should happen when the answer is the machine's anyway.
676
+ function setTheme(theme, remember) {
670
677
  if (theme === 'dark') {
671
678
  document.documentElement.classList.add('dark');
672
679
  }
673
680
  else {
674
681
  document.documentElement.classList.remove('dark');
675
682
  }
676
- localStorage.setItem('bunpress-theme', theme);
683
+ if (remember) {
684
+ localStorage.setItem('bunpress-theme', theme);
685
+ document.documentElement.setAttribute('data-bp-theme', theme);
686
+ }
677
687
  }
678
688
 
679
689
  function toggleTheme() {
680
690
  const currentTheme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
681
691
  const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
682
- setTheme(newTheme);
692
+ setTheme(newTheme, true);
683
693
  }
684
694
 
685
695
  // Initialize theme on page load
686
696
  (function() {
687
697
  const forced = document.documentElement.getAttribute('data-theme-mode');
688
698
  const theme = getPreferredTheme();
689
- setTheme(theme);
699
+ setTheme(theme, Boolean(localStorage.getItem('bunpress-theme')));
690
700
 
691
701
  // A forced theme has no alternate to switch to; hide the toggle so nobody
692
702
  // lands on a broken half-themed page from clicking it.
@@ -704,7 +714,7 @@ function toggleTheme() {
704
714
  if (forced === 'dark' || forced === 'light')
705
715
  return;
706
716
  if (!localStorage.getItem('bunpress-theme')) {
707
- setTheme(e.matches ? 'dark' : 'light');
717
+ setTheme(e.matches ? 'dark' : 'light', false);
708
718
  }
709
719
  });
710
720
  })();
@@ -1272,7 +1282,7 @@ if (typeof document !== 'undefined') {
1272
1282
  font-weight: 600;
1273
1283
  letter-spacing: 0.06em;
1274
1284
  text-transform: uppercase;
1275
- color: var(--bp-c-text-3, #929295);
1285
+ color: var(--bp-c-text-3, #6e6e73);
1276
1286
  }
1277
1287
  /* A message's links are part of its copy, not links out of the docs. */
1278
1288
  .bp-message .external-link-icon {
@@ -1288,7 +1298,7 @@ if (typeof document !== 'undefined') {
1288
1298
  .bp-message dt {
1289
1299
  flex: none;
1290
1300
  min-width: 64px;
1291
- color: var(--bp-c-text-3, #929295);
1301
+ color: var(--bp-c-text-3, #6e6e73);
1292
1302
  }
1293
1303
  .bp-message dd {
1294
1304
  margin: 0;
@@ -1341,12 +1351,12 @@ if (typeof document !== 'undefined') {
1341
1351
  .bp-email-preheader {
1342
1352
  padding: 8px 20px;
1343
1353
  font-size: 13px;
1344
- color: var(--bp-c-text-2, #67676c);
1354
+ color: var(--bp-c-text-2, #5c5c62);
1345
1355
  border-bottom: 1px solid var(--bp-c-divider, #e2e2e3);
1346
1356
  }
1347
1357
  .bp-email-preheader span {
1348
1358
  margin-right: 6px;
1349
- color: var(--bp-c-text-3, #929295);
1359
+ color: var(--bp-c-text-3, #6e6e73);
1350
1360
  }
1351
1361
  .bp-email-body {
1352
1362
  padding: 20px;
@@ -1370,7 +1380,7 @@ if (typeof document !== 'undefined') {
1370
1380
  .bp-email-body blockquote {
1371
1381
  padding: 4px 0 4px 14px;
1372
1382
  border-left: 3px solid var(--bp-c-divider, #e2e2e3);
1373
- color: var(--bp-c-text-2, #67676c);
1383
+ color: var(--bp-c-text-2, #5c5c62);
1374
1384
  }
1375
1385
  .bp-email-body hr {
1376
1386
  margin: 18px 0;
@@ -1379,7 +1389,7 @@ if (typeof document !== 'undefined') {
1379
1389
  }
1380
1390
  .bp-email-body hr ~ p {
1381
1391
  font-size: 13px;
1382
- color: var(--bp-c-text-2, #67676c);
1392
+ color: var(--bp-c-text-2, #5c5c62);
1383
1393
  }
1384
1394
  .bp-email-body a {
1385
1395
  color: var(--bp-c-brand-1, #3451b2);
@@ -1397,7 +1407,7 @@ if (typeof document !== 'undefined') {
1397
1407
  line-height: 1.3;
1398
1408
  text-decoration: none;
1399
1409
  color: var(--bp-button-brand-text, #fff);
1400
- background: var(--bp-button-brand-bg, var(--bp-c-brand-3, #5672cd));
1410
+ background: var(--bp-button-brand-bg, var(--bp-c-brand-1, #3451b2));
1401
1411
  }
1402
1412
  .bp-email-body a.bp-email-button:hover {
1403
1413
  background: var(--bp-button-brand-hover-bg, var(--bp-c-brand-2, #3a5ccc));
@@ -1430,8 +1440,11 @@ if (typeof document !== 'undefined') {
1430
1440
  border-radius: 50%;
1431
1441
  font-size: 14px;
1432
1442
  font-weight: 600;
1433
- color: var(--bp-c-white, #fff);
1434
- background: var(--bp-c-text-3, #929295);
1443
+ /* The initial is text on a fill, so the pair has to invert with the palette:
1444
+ * white on the grey worked in the light theme and gave 3.2:1 in the dark
1445
+ * one, where the greys are the light end of the ramp. */
1446
+ color: var(--bp-c-bg, #fff);
1447
+ background: var(--bp-c-text-2, #5c5c62);
1435
1448
  }
1436
1449
  .bp-sms-who {
1437
1450
  display: flex;
@@ -1446,7 +1459,7 @@ if (typeof document !== 'undefined') {
1446
1459
  }
1447
1460
  .bp-sms-to {
1448
1461
  font-size: 13px;
1449
- color: var(--bp-c-text-2, #67676c);
1462
+ color: var(--bp-c-text-2, #5c5c62);
1450
1463
  }
1451
1464
  .bp-sms-details {
1452
1465
  padding: 8px 16px;
@@ -1483,7 +1496,9 @@ if (typeof document !== 'undefined') {
1483
1496
  .bp-sms-reply .bp-sms-bubble {
1484
1497
  border-radius: 18px 18px 4px 18px;
1485
1498
  color: #fff;
1486
- background: #0b84ff;
1499
+ /* iMessage blue, taken down far enough to read white on. The real
1500
+ * #0b84ff gives 3.65:1, and an SMS preview exists to be read. */
1501
+ background: #0a6cd4;
1487
1502
  }
1488
1503
  .bp-sms-reply .bp-message-var {
1489
1504
  color: #fff;
@@ -1492,7 +1507,7 @@ if (typeof document !== 'undefined') {
1492
1507
  .bp-sms-meta {
1493
1508
  padding-left: 6px;
1494
1509
  font-size: 11px;
1495
- color: var(--bp-c-text-3, #929295);
1510
+ color: var(--bp-c-text-3, #6e6e73);
1496
1511
  }
1497
1512
  `;function i(Z){let Q=[],X=null,$=null;for(let J of Z.split(`
1498
1513
  `)){let V=J.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if($){if(V&&V[1][0]===$.marker[0]&&V[1].length>=$.marker.length&&V[2].trim()===""){let{headers:W,parts:Y}=S($.lines.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{j as c,k as d,l as e,m as f,n as g}from"./chunk-m8wez6xg.js";import{aa as b}from"./chunk-778jqyb6.js";import{ha as a}from"./chunk-gn1n2yxt.js";export{d as wrapInLayout,c as stripConfiguredBasePath,f as startServer,g as serveCLI,e as markdownToHtml,a as getConfiguredBasePath,b as decodeHtmlEntities};
2
+ import{j as c,k as d,l as e,m as f,n as g}from"./chunk-ttas3mc2.js";import{aa as b}from"./chunk-f5ycxw18.js";import{ha as a}from"./chunk-gn1n2yxt.js";export{d as wrapInLayout,c as stripConfiguredBasePath,f as startServer,g as serveCLI,e as markdownToHtml,a as getConfiguredBasePath,b as decodeHtmlEntities};