@stacksjs/bunpress 0.1.6 → 0.1.8

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{e as a,f as b}from"../chunk-7z6wzjev.js";import"../chunk-8mywpq4a.js";import"../chunk-43fsk0jg.js";export{a as findMarkdownFiles,b as buildDocs};
3
+ import{e as a,f as b}from"../chunk-tby3xzw7.js";import"../chunk-xrf6702j.js";import"../chunk-43fsk0jg.js";export{a as findMarkdownFiles,b as buildDocs};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{H as a,I as b,J as c,K as d,L as e,M as f}from"./chunk-xrf6702j.js";import"./chunk-43fsk0jg.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{a as $,b as I,c as f,d as h,f as x}from"./chunk-7z6wzjev.js";import{h as _}from"./chunk-8mywpq4a.js";import"./chunk-43fsk0jg.js";import{join as D}from"path";var Y="@stacksjs/ts-cloud";function E(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 v(j={}){let A=await _,k=A.cloud||{},m=j.verbose??A.verbose??!1,w=j.region||k.region||"us-east-1",J=j.domain||k.domain,M=j.subdomain||k.subdomain,N=j.baseDomain||k.baseDomain,O=j.bucket||k.bucket,P=j.stackName||k.stackName,U=j.hostedZoneId||k.hostedZoneId,Q=j.certificateArn||k.certificateArn,V=k.cacheControl||"max-age=31536000, public",B;if(J)B=J;else if(M&&N)B=`${M}.${N}`;let K=B?.replace(/\./g,"-")||"bunpress-site",G=null;try{G=E(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(`
2
+ import{a as $,b as I,c as f,d as h,f as x}from"./chunk-tby3xzw7.js";import{h as _}from"./chunk-xrf6702j.js";import"./chunk-43fsk0jg.js";import{join as D}from"path";var Y="@stacksjs/ts-cloud";function E(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 v(j={}){let A=await _,k=A.cloud||{},m=j.verbose??A.verbose??!1,w=j.region||k.region||"us-east-1",J=j.domain||k.domain,M=j.subdomain||k.subdomain,N=j.baseDomain||k.baseDomain,O=j.bucket||k.bucket,P=j.stackName||k.stackName,U=j.hostedZoneId||k.hostedZoneId,Q=j.certificateArn||k.certificateArn,V=k.cacheControl||"max-age=31536000, public",B;if(J)B=J;else if(M&&N)B=`${M}.${N}`;let K=B?.replace(/\./g,"-")||"bunpress-site",G=null;try{G=E(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(`
3
3
  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(`
4
4
  Deploying with CloudFormation...`),L)console.log(`Using external DNS provider: ${G.provider}`);let q;if(L&&B){let R={siteName:K,region:w,domain:B,bucket:O,stackName:P,certificateArn:Q,cacheControl:V,defaultRootObject:"index.html",errorDocument:"404.html",sourceDir:X,dnsProvider:G,tags:{Project:"BunPress",Environment:k.environment||"production"},onProgress:Z(z,m)},{deployStaticSiteWithExternalDnsFull:T}=await import(Y);q=await T(R)}else{let R={siteName:K,region:w,bucket:O,domain:B,subdomain:M,baseDomain:N,stackName:P,hostedZoneId:U,certificateArn:Q,cacheControl:V,defaultRootObject:"index.html",errorDocument:"404.html",sourceDir:X,tags:{Project:"BunPress",Environment:k.environment||"production"},onProgress:Z(z,m)},{deployStaticSiteFull:T}=await import(Y);q=await T(R)}if(!q.success){if(!m)z.fail("Deployment failed");return I(q.message),!1}if(console.log(`
5
5
  `+"=".repeat(50)),$("Deployment complete!"),console.log("=".repeat(50)),console.log(`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{M as z6,h as L}from"./chunk-8mywpq4a.js";import{N as v}from"./chunk-43fsk0jg.js";var{Glob:L6}=globalThis.Bun;import{copyFile as A4,mkdir as I6,readdir as J4}from"fs/promises";import{join as y}from"path";import E from"process";import{CLI as M4}from"@stacksjs/clapp";var e="0.1.6";import*as K6 from"fs";import*as Q6 from"path";async function Z6(K,$){let Q=$.robots;if(Q?.enabled===!1)return;let Z=Q?.filename||"robots.txt",Y=D6($),N=Q6.join(K,Z);if(await K6.promises.writeFile(N,Y,"utf-8"),$.verbose)console.log(`\u2705 Robots.txt generated: ${N}`)}function D6(K){let $=K.robots,Q=[];if($?.rules&&$.rules.length>0)for(let Z of $.rules)Q.push(...k6(Z)),Q.push("");else Q.push("User-agent: *"),Q.push("Allow: /"),Q.push("");if($?.host)Q.push(`Host: ${$.host}`),Q.push("");if($?.sitemaps&&$.sitemaps.length>0){for(let Z of $.sitemaps)Q.push(`Sitemap: ${Z}`);Q.push("")}else if(K.sitemap?.enabled!==!1&&K.sitemap?.baseUrl){let Z=K.sitemap.filename||"sitemap.xml",Y=`${K.sitemap.baseUrl.replace(/\/$/,"")}/${Z}`;Q.push(`Sitemap: ${Y}`),Q.push("")}if($?.customContent)Q.push($.customContent),Q.push("");return`${Q.join(`
2
+ import{M as z6,h as L}from"./chunk-xrf6702j.js";import{N as v}from"./chunk-43fsk0jg.js";var{Glob:L6}=globalThis.Bun;import{copyFile as A4,mkdir as I6,readdir as J4}from"fs/promises";import{join as y}from"path";import E from"process";import{CLI as M4}from"@stacksjs/clapp";var e="0.1.8";import*as K6 from"fs";import*as Q6 from"path";async function Z6(K,$){let Q=$.robots;if(Q?.enabled===!1)return;let Z=Q?.filename||"robots.txt",Y=D6($),N=Q6.join(K,Z);if(await K6.promises.writeFile(N,Y,"utf-8"),$.verbose)console.log(`\u2705 Robots.txt generated: ${N}`)}function D6(K){let $=K.robots,Q=[];if($?.rules&&$.rules.length>0)for(let Z of $.rules)Q.push(...k6(Z)),Q.push("");else Q.push("User-agent: *"),Q.push("Allow: /"),Q.push("");if($?.host)Q.push(`Host: ${$.host}`),Q.push("");if($?.sitemaps&&$.sitemaps.length>0){for(let Z of $.sitemaps)Q.push(`Sitemap: ${Z}`);Q.push("")}else if(K.sitemap?.enabled!==!1&&K.sitemap?.baseUrl){let Z=K.sitemap.filename||"sitemap.xml",Y=`${K.sitemap.baseUrl.replace(/\/$/,"")}/${Z}`;Q.push(`Sitemap: ${Y}`),Q.push("")}if($?.customContent)Q.push($.customContent),Q.push("");return`${Q.join(`
3
3
  `).trim()}
4
4
  `}function k6(K){let $=[];if($.push(`User-agent: ${K.userAgent}`),K.allow&&K.allow.length>0)for(let Q of K.allow)$.push(`Allow: ${Q}`);if(K.disallow&&K.disallow.length>0)for(let Q of K.disallow)$.push(`Disallow: ${Q}`);if(K.crawlDelay!==void 0)$.push(`Crawl-delay: ${K.crawlDelay}`);return $}var{YAML:C6}=globalThis.Bun;import*as p from"fs";import*as m from"path";async function $6(K,$,Q,Z){if(!Z?.enabled)return;let Y=Q.sitemap?.baseUrl;if(!Y){if(Q.verbose)console.warn("\u26A0\uFE0F RSS feed generation skipped: baseUrl not configured");return}let N=Z.title||Q.title||Q.markdown?.title||"Documentation Feed",H=Z.description||Q.description||Q.markdown?.meta?.description||"Documentation updates",X=Z.author||"Documentation Team",W=Z.email||"",q=Z.language||"en-us",V=Z.filename||"feed.xml",j=Z.maxItems||20,G=Z.fullContent||!1,_=await P6(K,Y,G);_.sort((A,J)=>J.pubDate.getTime()-A.pubDate.getTime());let M=_.slice(0,j),O=d6({title:N,description:H,link:Y,language:q,author:X,email:W,items:M}),x=m.join($,V);if(await p.promises.writeFile(x,O,"utf-8"),Q.verbose)console.log(`\u2705 RSS feed generated: ${x} (${M.length} items)`)}async function P6(K,$,Q){let Z=[],Y=await h6(K);for(let N of Y){let H=await p.promises.readFile(N,"utf-8"),{frontmatter:X,markdown:W}=m6(H);if(!X.date||!X.title)continue;let V=m.relative(K,N).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!V.startsWith("/"))V=`/${V}`;if(V.endsWith("/")&&V!=="/")V=V.slice(0,-1);let j=`${$.replace(/\/$/,"")}${V}`,G=X.description||g6(W),_=new Date(X.date),M=X.author;Z.push({title:X.title,link:j,description:G,pubDate:_,author:M,content:Q?W:void 0})}return Z}async function h6(K){let $=[];async function Q(Z){let Y=await p.promises.readdir(Z,{withFileTypes:!0});for(let N of Y){let H=m.join(Z,N.name);if(N.isDirectory()){if(!N.name.startsWith(".")&&N.name!=="node_modules")await Q(H)}else if(N.isFile()&&N.name.endsWith(".md"))$.push(H)}}return await Q(K),$}function m6(K){let $=/^---\n([\s\S]*?)\n---\n?/,Q=K.match($);if(!Q)return{frontmatter:{},markdown:K};let Z=Q[1],Y=K.slice(Q[0].length);try{return{frontmatter:C6.parse(Z),markdown:Y}}catch{return{frontmatter:{},markdown:K}}}function g6(K,$=200){let Q=K.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(),Z=Q.split(`
5
5
 
@@ -316,8 +316,8 @@ ${H}`;await F.promises.writeFile(K,_,"utf-8")}if(!W)Q.passed++}async function H4
316
316
  `)[0]||Q;if(Z.length>$)return`${Z.slice(0,$)}...`;return Z||"Documentation page"}function V4(K,$,Q){let Z=[],Y=/\[([^\]]+)\]\(([^)]+)\)/g,N;while((N=Y.exec(K))!==null){let H=N[2];if(H.startsWith("http://")||H.startsWith("https://"))continue;if(H.startsWith("#"))continue;let X=w.dirname(Q),W=w.resolve(X,H),q=W.endsWith(".md")?W:`${W}.md`;if(!F.existsSync(q)&&!F.existsSync(W))Z.push(H)}return Z}function j4(K){let $=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,Z;while((Z=Q.exec(K))!==null){let Y=Z[1],N=Z[2];if(!Y||Y.trim()==="")$.push(N)}return $}function q4(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){B(`\u2717 ${K.errors.length} errors found:`),console.log("");let $=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g($),console.log("")}if(K.warnings.length>0){u(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let $=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g($),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 B4}from"path";async function G4(K){let $=await Bun.file(K).text(),Q=$.split(`
317
317
  `),Z=0,Y=!1,N=[];for(let q of Q){if(q.trim().startsWith("```")){Y=!Y;continue}if(!Y)N.push(q)}Z=N.join(" ").split(/\s+/).filter((q)=>q.length>0).length;let X=Q.filter((q)=>q.match(/^#{1,6}\s+/)).length,W=($.match(/```/g)||[]).length/2;return{path:K,size:await f(K),lines:Q.length,words:Z,headings:X,codeBlocks:Math.floor(W)}}async function O6(K={}){let $=await L,Q=K.dir||$.docsDir||"./docs",Z=K.verbose||!1;try{console.log(z(`
318
318
  Analyzing documentation...
319
- `,"bold"));let{Glob:Y}=awaitPromise.resolve(globalThis.Bun),N=new Y("**/*.md"),H=[];for await(let A of N.scan(Q)){let J=B4(Q,A),l=await G4(J);H.push(l)}if(H.length===0)return B("No markdown files found"),!1;let X=H.reduce((A,J)=>A+J.size,0),W=H.reduce((A,J)=>A+J.lines,0),q=H.reduce((A,J)=>A+J.words,0),V=H.reduce((A,J)=>A+J.headings,0),j=H.reduce((A,J)=>A+J.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${H.length}`),console.log(`Total size: ${b(X)}`),console.log(`Total lines: ${W.toLocaleString()}`),console.log(`Total words: ${q.toLocaleString()}`),console.log(`Headings: ${V}`),console.log(`Code blocks: ${j}`),console.log(),Z){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let A=H.map((J)=>({File:J.path.replace(`${Q}/`,""),Size:b(J.size),Lines:J.lines,Words:J.words,Headings:J.headings,"Code Blocks":J.codeBlocks}));g(A),console.log()}let G=X/H.length,_=W/H.length,M=q/H.length;console.log(z("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${b(G)}`),console.log(`Lines: ${Math.round(_)}`),console.log(`Words: ${Math.round(M)}`),console.log();let O=[...H].sort((A,J)=>J.size-A.size).slice(0,5);if(O.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let A of O){let J=A.path.replace(`${Q}/`,"");console.log(` ${J.padEnd(40)} ${b(A.size)}`)}console.log()}let x=Math.ceil(q/200);return U(`Estimated reading time: ${x} minutes`),!0}catch(Y){return B(`Failed to generate statistics: ${Y}`),!1}}var I=new M4("bunpress"),R={outdir:L.outDir||"./dist",docsdir:L.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:L.verbose};async function x6(K){let $=new L6("**/*.md"),Q=[];for await(let Z of $.scan(K))Q.push(y(K,Z));return Q}async function R4(K,$,Q=!1){let Z=`${$}/public`;try{await J4(Z);let Y=new L6("**/*");for await(let N of Y.scan(Z)){let H=y(Z,N),X=y(K,N);await I6(y(K,N.split("/").slice(0,-1).join("/")),{recursive:!0}),await A4(H,X)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function U4(K,$,Q){try{let Z=await L;if(Z.sitemap?.enabled!==!1&&Z.sitemap?.baseUrl)await N6(K,$,Z);if(Z.robots?.enabled!==!1)await Z6($,Z);if(Z.rss?.enabled)await $6(K,$,Z,Z.rss)}catch(Z){if(Q)console.error("Error generating SEO files:",Z)}}async function T6(K={}){let $=await L,Q=K.outdir||$.outDir||R.outdir,Z=y(Q,".bunpress"),Y=K.dir||$.docsDir||R.docsdir,N=K.verbose??R.verbose,H=K.minify??!1,X=K.sourcemap??!1,W=performance.now(),q=new k("Building documentation...");if(!N)q.start();await I6(Z,{recursive:!0});let V=await x6(Y);if(V.length===0){if(!N)q.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(N)console.log(`Found ${V.length} markdown files:`),V.forEach((j)=>console.log(`- ${j}`));try{let{markdownToHtml:j,wrapInLayout:G}=await import("./chunk-3kj1ps9z.js"),{mkdir:_,writeFile:M}=await import("fs/promises");if(N)console.log("Transforming markdown to HTML...");for(let A of V){let J=await Bun.file(A).text(),{html:l,frontmatter:S6}=await j(J,Y),E6=A.replace(/^\.\//,""),b6=Y.replace(/^\.\//,""),o=E6.replace(b6,"").replace(/^\//,"").replace(/\.md$/,""),v6=`/${o}`,F6=S6.layout||"doc",w6=await G(l,$,v6,F6),d=y(Z,o+".html"),t=d.substring(0,d.lastIndexOf("/"));if(t)await _(t,{recursive:!0});if(await M(d,w6),N)console.log(`Generated: ${d}`)}if(N)console.log(`Processed ${V.length} markdown files.`);await R4(Z,Y,N),await T4(Z),await O4(Z,$),await U4(Y,Z,N||!1);let x=performance.now()-W;if(!N)q.succeed(`Built ${V.length} pages to HTML in ${n(x)}`);else T(`Build completed in ${n(x)}`),console.log(`
320
- Generated ${V.length} HTML files in ${Z}`);return!0}catch(j){if(!N)q.fail("Build failed");return console.error("Error during build:",j),!1}}async function O4(K,$){let{wrapInLayout:Q}=await import("./chunk-3kj1ps9z.js"),Z=`
319
+ `,"bold"));let{Glob:Y}=awaitPromise.resolve(globalThis.Bun),N=new Y("**/*.md"),H=[];for await(let A of N.scan(Q)){let J=B4(Q,A),l=await G4(J);H.push(l)}if(H.length===0)return B("No markdown files found"),!1;let X=H.reduce((A,J)=>A+J.size,0),W=H.reduce((A,J)=>A+J.lines,0),q=H.reduce((A,J)=>A+J.words,0),V=H.reduce((A,J)=>A+J.headings,0),j=H.reduce((A,J)=>A+J.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${H.length}`),console.log(`Total size: ${b(X)}`),console.log(`Total lines: ${W.toLocaleString()}`),console.log(`Total words: ${q.toLocaleString()}`),console.log(`Headings: ${V}`),console.log(`Code blocks: ${j}`),console.log(),Z){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let A=H.map((J)=>({File:J.path.replace(`${Q}/`,""),Size:b(J.size),Lines:J.lines,Words:J.words,Headings:J.headings,"Code Blocks":J.codeBlocks}));g(A),console.log()}let G=X/H.length,_=W/H.length,M=q/H.length;console.log(z("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${b(G)}`),console.log(`Lines: ${Math.round(_)}`),console.log(`Words: ${Math.round(M)}`),console.log();let O=[...H].sort((A,J)=>J.size-A.size).slice(0,5);if(O.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let A of O){let J=A.path.replace(`${Q}/`,"");console.log(` ${J.padEnd(40)} ${b(A.size)}`)}console.log()}let x=Math.ceil(q/200);return U(`Estimated reading time: ${x} minutes`),!0}catch(Y){return B(`Failed to generate statistics: ${Y}`),!1}}var I=new M4("bunpress"),R={outdir:L.outDir||"./dist",docsdir:L.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:L.verbose};async function x6(K){let $=new L6("**/*.md"),Q=[];for await(let Z of $.scan(K))Q.push(y(K,Z));return Q}async function R4(K,$,Q=!1){let Z=`${$}/public`;try{await J4(Z);let Y=new L6("**/*");for await(let N of Y.scan(Z)){let H=y(Z,N),X=y(K,N);await I6(y(K,N.split("/").slice(0,-1).join("/")),{recursive:!0}),await A4(H,X)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function U4(K,$,Q){try{let Z=await L;if(Z.sitemap?.enabled!==!1&&Z.sitemap?.baseUrl)await N6(K,$,Z);if(Z.robots?.enabled!==!1)await Z6($,Z);if(Z.rss?.enabled)await $6(K,$,Z,Z.rss)}catch(Z){if(Q)console.error("Error generating SEO files:",Z)}}async function T6(K={}){let $=await L,Q=K.outdir||$.outDir||R.outdir,Z=y(Q,".bunpress"),Y=K.dir||$.docsDir||R.docsdir,N=K.verbose??R.verbose,H=K.minify??!1,X=K.sourcemap??!1,W=performance.now(),q=new k("Building documentation...");if(!N)q.start();await I6(Z,{recursive:!0});let V=await x6(Y);if(V.length===0){if(!N)q.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(N)console.log(`Found ${V.length} markdown files:`),V.forEach((j)=>console.log(`- ${j}`));try{let{markdownToHtml:j,wrapInLayout:G}=await import("./chunk-2sy3vk92.js"),{mkdir:_,writeFile:M}=await import("fs/promises");if(N)console.log("Transforming markdown to HTML...");for(let A of V){let J=await Bun.file(A).text(),{html:l,frontmatter:S6}=await j(J,Y),E6=A.replace(/^\.\//,""),b6=Y.replace(/^\.\//,""),o=E6.replace(b6,"").replace(/^\//,"").replace(/\.md$/,""),v6=`/${o}`,F6=S6.layout||"doc",w6=await G(l,$,v6,F6),d=y(Z,o+".html"),t=d.substring(0,d.lastIndexOf("/"));if(t)await _(t,{recursive:!0});if(await M(d,w6),N)console.log(`Generated: ${d}`)}if(N)console.log(`Processed ${V.length} markdown files.`);await R4(Z,Y,N),await T4(Z),await O4(Z,$),await U4(Y,Z,N||!1);let x=performance.now()-W;if(!N)q.succeed(`Built ${V.length} pages to HTML in ${n(x)}`);else T(`Build completed in ${n(x)}`),console.log(`
320
+ Generated ${V.length} HTML files in ${Z}`);return!0}catch(j){if(!N)q.fail("Build failed");return console.error("Error during build:",j),!1}}async function O4(K,$){let{wrapInLayout:Q}=await import("./chunk-2sy3vk92.js"),Z=`
321
321
  <style>
322
322
  .NotFound {
323
323
  padding: 64px 24px 96px;
@@ -492,5 +492,5 @@ Detected change in ${H}, rebuilding...`),await T6(K)}),await new Promise(()=>{})
492
492
  `}X+=`---
493
493
 
494
494
  `}return await Bun.write(Z,X),console.log(`
495
- LLM markdown generated successfully: ${Z}`),console.log(`Total size: ${(X.length/1024).toFixed(2)} KB`),!0}I.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory",{default:"./docs"}).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:R.verbose}).action(async(K)=>{if(!await z4(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 B6(K))E.exit(1)});I.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:R.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{await M6(K)});I.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:R.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await _6(K))E.exit(1)});I.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await q6(K))E.exit(1)});I.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await W6(K))E.exit(1)});I.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await V6(K))E.exit(1)});I.command("config:init","Initialize configuration file").action(async(K)=>{if(!await j6(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:R.verbose}).action(async(K,$)=>{if(!await A6(K,$))E.exit(1)});I.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await O6(K))E.exit(1)});I.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await U6(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:R.verbose}).action(async(K)=>{let{deployCommand:$}=await import("./chunk-eqw9bzek.js");if(!await $(K))E.exit(1)});I.help();I.version(e);I.parse();
495
+ LLM markdown generated successfully: ${Z}`),console.log(`Total size: ${(X.length/1024).toFixed(2)} KB`),!0}I.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory",{default:"./docs"}).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:R.verbose}).action(async(K)=>{if(!await z4(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 B6(K))E.exit(1)});I.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:R.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{await M6(K)});I.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:R.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await _6(K))E.exit(1)});I.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await q6(K))E.exit(1)});I.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await W6(K))E.exit(1)});I.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await V6(K))E.exit(1)});I.command("config:init","Initialize configuration file").action(async(K)=>{if(!await j6(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:R.verbose}).action(async(K,$)=>{if(!await A6(K,$))E.exit(1)});I.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--verbose","Enable verbose logging",{default:R.verbose}).action(async(K)=>{if(!await O6(K))E.exit(1)});I.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await U6(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:R.verbose}).action(async(K)=>{let{deployCommand:$}=await import("./chunk-pp1a3jkp.js");if(!await $(K))E.exit(1)});I.help();I.version(e);I.parse();
496
496
  export{T as a,B as b,U as c,k as d,x6 as e,T6 as f};