@stacksjs/bunpress 0.1.17 → 0.1.18

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{I as a,J as b}from"../chunk-wdshfmqq.js";import"../chunk-ss6yzy9f.js";import"../chunk-e5q66hsy.js";import"../chunk-w6byd4st.js";export{a as findMarkdownFiles,b as buildDocs};
3
+ import{I as a,J as b}from"../chunk-0732cng2.js";import"../chunk-ss6yzy9f.js";import"../chunk-e5q66hsy.js";import"../chunk-w6byd4st.js";export{a as findMarkdownFiles,b as buildDocs};
@@ -5,6 +5,8 @@ export declare function seoCheck(options?: {
5
5
  dir?: string
6
6
  fix?: boolean
7
7
  }): Promise<void>;
8
+ /** Serialize frontmatter in block style with delimiters on their own lines. */
9
+ export declare function serializeFrontmatter(frontmatter: Record<string, unknown>, markdown: string): string;
8
10
  /**
9
11
  * Find broken internal links in markdown
10
12
  */
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{L as W6,M as U6,O as V6}from"./chunk-ss6yzy9f.js";import{Q as O}from"./chunk-e5q66hsy.js";import{S as y}from"./chunk-w6byd4st.js";var{Glob:j6}=globalThis.Bun;import{copyFile as n6,mkdir as A6,readdir as i6}from"fs/promises";import{join as v}from"path";import I from"process";import{CLI as s6}from"@stacksjs/clapp";var s="0.1.17";import{existsSync as z6}from"fs";import{rm as L6}from"fs/promises";import{join as I6}from"path";var z={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 x(K,Z){return`${z[Z]}${K}${z.reset}`}function G(K){console.log(`${z.green}\u2713${z.reset} ${K}`)}function W(K){console.error(`${z.red}\u2717${z.reset} ${K}`)}function g(K){console.warn(`${z.yellow}\u26A0${z.reset} ${K}`)}function B(K){console.log(`${z.blue}\u2139${z.reset} ${K}`)}function S(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 f(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var r=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class D{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(K){this.text=K}start(){if(r){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let K=this.frames[this.index];process.stdout.write(`\r${z.cyan}${K}${z.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(K){this.stop(),G(K||this.text)}fail(K){this.stop(),W(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!r)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function u(K,Z=!1){let Q=Z?"Y/n":"y/N";process.stdout.write(`${z.cyan}?${z.reset} ${K} ${z.dim}(${Q})${z.reset}: `);let $=Bun.file("/dev/stdin").stream().getReader(),q=new TextDecoder,{value:X}=await $.read(),Y=q.decode(X).trim().toLowerCase();if(!Y)return Z;return Y==="y"||Y==="yes"}function h(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let q of Z)Q[q]=Math.max(q.length,...K.map((X)=>String(X[q]).length));let $=Z.map((q)=>q.padEnd(Q[q])).join(" ");console.log(x($,"bold")),console.log("\u2500".repeat($.length));for(let q of K){let X=Z.map((Y)=>String(q[Y]).padEnd(Q[Y])).join(" ");console.log(X)}}async function d(K){try{return Bun.file(K).size}catch{return 0}}async function S6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let q of Q.scan(K)){let X=`${K}/${q}`,Y=await d(X);$+=Y}return $}catch{return 0}}async function e(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=I6(Q,".bunpress"),q=K.force||!1,X=K.verbose||!1;try{if(!z6($))return B(`Directory "${$}" does not exist, nothing to clean`),!0;let N=await S6($);if(X)B(`Found "${$}" (${S(N)})`);if(!q){if(!await u(`Delete "${$}" directory? (${S(N)})`,!1))return B("Clean cancelled"),!1}let _=process.env.VITEST==="true"||!1,R=null;if(!_&&!X)R=new D("Cleaning build artifacts..."),R.start();if(await L6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${S(N)} from "${$}"`);else if(X||_)G(`Cleaned ${S(N)} from "${$}"`);return!0}catch(Y){return W(`Failed to clean directory: ${Y}`),!1}}import{existsSync as p}from"fs";import{join as l}from"path";async function t(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let q of Z){let X=l(process.cwd(),q);if(p(X)){Q=X;break}}if(!Q)return W("No configuration file found"),B('Run "bunpress config init" to create one'),!1;G(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(x("Configuration:","bold")),console.log($),!0}catch(Z){return W(`Failed to show configuration: ${Z}`),!1}}async function o(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let N of Q){let _=l(process.cwd(),N);if(p(_)){$=_;break}}if(!$)return W("No configuration file found"),!1;if(Z)B(`Validating ${$}...`);let X=(await import($)).default;if(!X)return W("Configuration file does not export a default object"),!1;let Y=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")Y.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")Y.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))Y.push("nav should be an array");else for(let[N,_]of X.nav.entries())if(!_.text||!_.link)Y.push(`nav[${N}] is missing required fields (text, link)`)}if(X.sitemap){if(!X.sitemap.hostname)Y.push("sitemap.hostname is required for SEO")}if(Y.length>0){W("Configuration validation failed:");for(let N of Y)console.log(` \u2022 ${N}`);return!1}return G("Configuration is valid \u2713"),!0}catch(Q){return W(`Failed to validate configuration: ${Q}`),!1}}async function K6(K={}){let Z=l(process.cwd(),"bunpress.config.ts");if(p(Z))return W("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
2
+ import{L as W6,M as U6,O as V6}from"./chunk-ss6yzy9f.js";import{Q as O}from"./chunk-e5q66hsy.js";import{S as y}from"./chunk-w6byd4st.js";var{Glob:j6}=globalThis.Bun;import{copyFile as i6,mkdir as A6,readdir as s6}from"fs/promises";import{join as v}from"path";import I from"process";import{CLI as r6}from"@stacksjs/clapp";var s="0.1.18";import{existsSync as z6}from"fs";import{rm as L6}from"fs/promises";import{join as I6}from"path";var z={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 x(K,Z){return`${z[Z]}${K}${z.reset}`}function G(K){console.log(`${z.green}\u2713${z.reset} ${K}`)}function W(K){console.error(`${z.red}\u2717${z.reset} ${K}`)}function g(K){console.warn(`${z.yellow}\u26A0${z.reset} ${K}`)}function B(K){console.log(`${z.blue}\u2139${z.reset} ${K}`)}function S(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 f(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var r=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class D{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(K){this.text=K}start(){if(r){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let K=this.frames[this.index];process.stdout.write(`\r${z.cyan}${K}${z.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(K){this.stop(),G(K||this.text)}fail(K){this.stop(),W(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!r)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function u(K,Z=!1){let Q=Z?"Y/n":"y/N";process.stdout.write(`${z.cyan}?${z.reset} ${K} ${z.dim}(${Q})${z.reset}: `);let $=Bun.file("/dev/stdin").stream().getReader(),q=new TextDecoder,{value:X}=await $.read(),Y=q.decode(X).trim().toLowerCase();if(!Y)return Z;return Y==="y"||Y==="yes"}function h(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let q of Z)Q[q]=Math.max(q.length,...K.map((X)=>String(X[q]).length));let $=Z.map((q)=>q.padEnd(Q[q])).join(" ");console.log(x($,"bold")),console.log("\u2500".repeat($.length));for(let q of K){let X=Z.map((Y)=>String(q[Y]).padEnd(Q[Y])).join(" ");console.log(X)}}async function d(K){try{return Bun.file(K).size}catch{return 0}}async function S6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let q of Q.scan(K)){let X=`${K}/${q}`,Y=await d(X);$+=Y}return $}catch{return 0}}async function e(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=I6(Q,".bunpress"),q=K.force||!1,X=K.verbose||!1;try{if(!z6($))return B(`Directory "${$}" does not exist, nothing to clean`),!0;let N=await S6($);if(X)B(`Found "${$}" (${S(N)})`);if(!q){if(!await u(`Delete "${$}" directory? (${S(N)})`,!1))return B("Clean cancelled"),!1}let _=process.env.VITEST==="true"||!1,R=null;if(!_&&!X)R=new D("Cleaning build artifacts..."),R.start();if(await L6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${S(N)} from "${$}"`);else if(X||_)G(`Cleaned ${S(N)} from "${$}"`);return!0}catch(Y){return W(`Failed to clean directory: ${Y}`),!1}}import{existsSync as p}from"fs";import{join as l}from"path";async function t(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let q of Z){let X=l(process.cwd(),q);if(p(X)){Q=X;break}}if(!Q)return W("No configuration file found"),B('Run "bunpress config init" to create one'),!1;G(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(x("Configuration:","bold")),console.log($),!0}catch(Z){return W(`Failed to show configuration: ${Z}`),!1}}async function o(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let N of Q){let _=l(process.cwd(),N);if(p(_)){$=_;break}}if(!$)return W("No configuration file found"),!1;if(Z)B(`Validating ${$}...`);let X=(await import($)).default;if(!X)return W("Configuration file does not export a default object"),!1;let Y=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")Y.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")Y.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))Y.push("nav should be an array");else for(let[N,_]of X.nav.entries())if(!_.text||!_.link)Y.push(`nav[${N}] is missing required fields (text, link)`)}if(X.sitemap){if(!X.sitemap.hostname)Y.push("sitemap.hostname is required for SEO")}if(Y.length>0){W("Configuration validation failed:");for(let N of Y)console.log(` \u2022 ${N}`);return!1}return G("Configuration is valid \u2713"),!0}catch(Q){return W(`Failed to validate configuration: ${Q}`),!1}}async function K6(K={}){let Z=l(process.cwd(),"bunpress.config.ts");if(p(Z))return W("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
3
3
 
4
4
  export default {
5
5
  verbose: false,
@@ -52,9 +52,9 @@ export default {
52
52
  hostname: 'https://example.com',
53
53
  },
54
54
  } satisfies BunPressConfig
55
- `;try{return await Bun.write(Z,Q),G(`Created ${Z}`),!0}catch($){return W(`Failed to create configuration: ${$}`),!1}}import{existsSync as C}from"fs";import{join as k}from"path";async function Q6(K={}){let Z=K.verbose||!1,Q=[];console.log(x(`
55
+ `;try{return await Bun.write(Z,Q),G(`Created ${Z}`),!0}catch($){return W(`Failed to create configuration: ${$}`),!1}}import{existsSync as w}from"fs";import{join as k}from"path";async function Q6(K={}){let Z=K.verbose||!1,Q=[];console.log(x(`
56
56
  Running diagnostics...
57
- `,"bold"));try{let H=Bun.version;Q.push({name:"Bun Runtime",status:"pass",message:`v${H}`})}catch(H){Q.push({name:"Bun Runtime",status:"fail",message:"Not found"})}let $=["bunpress.config.ts","bunpress.config.js"],q=!1;for(let H of $)if(C(k(process.cwd(),H))){q=!0,Q.push({name:"Configuration",status:"pass",message:H});break}if(!q)Q.push({name:"Configuration",status:"warn",message:"No config file found (using defaults)"});let X=k(process.cwd(),"docs");if(C(X)){let{Glob:H}=awaitPromise.resolve(globalThis.Bun),T=new H("**/*.md"),L=0;for await(let F of T.scan(X))L++;Q.push({name:"Documentation",status:L>0?"pass":"warn",message:`${L} markdown files`})}else Q.push({name:"Documentation",status:"fail",message:"docs/ directory not found"});let Y=k(process.cwd(),"package.json");if(C(Y)){let H=await Bun.file(Y).json(),T=H.scripts?.dev,L=H.scripts?.build;Q.push({name:"Package Scripts",status:T&&L?"pass":"warn",message:`dev: ${T?"\u2713":"\u2717"}, build: ${L?"\u2713":"\u2717"}`});let F=H.dependencies?.["@stacksjs/bunpress"]||H.devDependencies?.["@stacksjs/bunpress"];Q.push({name:"BunPress Package",status:F?"pass":"warn",message:F||"Not installed"})}else Q.push({name:"Package.json",status:"warn",message:"Not found"});let N=k(process.cwd(),"node_modules");if(C(N))Q.push({name:"Dependencies",status:"pass",message:"node_modules found"});else Q.push({name:"Dependencies",status:"warn",message:"node_modules not found (run: bun install)"});let _=k(process.cwd(),".git");if(C(_))Q.push({name:"Git Repository",status:"pass",message:"Initialized"});else Q.push({name:"Git Repository",status:"warn",message:"Not initialized"});let R=k(process.cwd(),"tsconfig.json");if(C(R))Q.push({name:"TypeScript",status:"pass",message:"tsconfig.json found"});else Q.push({name:"TypeScript",status:"warn",message:"tsconfig.json not found"});for(let H of Q){let T=H.status==="pass"?"\u2713":H.status==="fail"?"\u2717":"\u26A0",L=H.status==="pass"?"green":H.status==="fail"?"red":"yellow";console.log(` ${x(T,L)} ${H.name}: ${x(H.message,"dim")}`)}console.log();let U=Q.filter((H)=>H.status==="pass").length,A=Q.filter((H)=>H.status==="fail").length,J=Q.filter((H)=>H.status==="warn").length;if(A>0){if(W(`${A} checks failed, ${J} warnings`),console.log(),B("Recommended actions:"),Q.find((H)=>H.name==="Documentation"&&H.status==="fail"))console.log(' \u2022 Run "bunpress init" to create docs directory');if(Q.find((H)=>H.name==="Dependencies"&&H.status==="warn"))console.log(' \u2022 Run "bun install" to install dependencies');if(Q.find((H)=>H.name==="BunPress Package"&&H.status==="warn"))console.log(' \u2022 Run "bun add @stacksjs/bunpress" to install BunPress');return!1}else if(J>0)return g(`${U} checks passed, ${J} warnings`),!0;else return G(`All ${U} checks passed!`),!0}import{mkdir as a}from"fs/promises";var y6=`import type { BunPressConfig } from '@stacksjs/bunpress'
57
+ `,"bold"));try{let H=Bun.version;Q.push({name:"Bun Runtime",status:"pass",message:`v${H}`})}catch(H){Q.push({name:"Bun Runtime",status:"fail",message:"Not found"})}let $=["bunpress.config.ts","bunpress.config.js"],q=!1;for(let H of $)if(w(k(process.cwd(),H))){q=!0,Q.push({name:"Configuration",status:"pass",message:H});break}if(!q)Q.push({name:"Configuration",status:"warn",message:"No config file found (using defaults)"});let X=k(process.cwd(),"docs");if(w(X)){let{Glob:H}=awaitPromise.resolve(globalThis.Bun),T=new H("**/*.md"),L=0;for await(let F of T.scan(X))L++;Q.push({name:"Documentation",status:L>0?"pass":"warn",message:`${L} markdown files`})}else Q.push({name:"Documentation",status:"fail",message:"docs/ directory not found"});let Y=k(process.cwd(),"package.json");if(w(Y)){let H=await Bun.file(Y).json(),T=H.scripts?.dev,L=H.scripts?.build;Q.push({name:"Package Scripts",status:T&&L?"pass":"warn",message:`dev: ${T?"\u2713":"\u2717"}, build: ${L?"\u2713":"\u2717"}`});let F=H.dependencies?.["@stacksjs/bunpress"]||H.devDependencies?.["@stacksjs/bunpress"];Q.push({name:"BunPress Package",status:F?"pass":"warn",message:F||"Not installed"})}else Q.push({name:"Package.json",status:"warn",message:"Not found"});let N=k(process.cwd(),"node_modules");if(w(N))Q.push({name:"Dependencies",status:"pass",message:"node_modules found"});else Q.push({name:"Dependencies",status:"warn",message:"node_modules not found (run: bun install)"});let _=k(process.cwd(),".git");if(w(_))Q.push({name:"Git Repository",status:"pass",message:"Initialized"});else Q.push({name:"Git Repository",status:"warn",message:"Not initialized"});let R=k(process.cwd(),"tsconfig.json");if(w(R))Q.push({name:"TypeScript",status:"pass",message:"tsconfig.json found"});else Q.push({name:"TypeScript",status:"warn",message:"tsconfig.json not found"});for(let H of Q){let T=H.status==="pass"?"\u2713":H.status==="fail"?"\u2717":"\u26A0",L=H.status==="pass"?"green":H.status==="fail"?"red":"yellow";console.log(` ${x(T,L)} ${H.name}: ${x(H.message,"dim")}`)}console.log();let U=Q.filter((H)=>H.status==="pass").length,A=Q.filter((H)=>H.status==="fail").length,J=Q.filter((H)=>H.status==="warn").length;if(A>0){if(W(`${A} checks failed, ${J} warnings`),console.log(),B("Recommended actions:"),Q.find((H)=>H.name==="Documentation"&&H.status==="fail"))console.log(' \u2022 Run "bunpress init" to create docs directory');if(Q.find((H)=>H.name==="Dependencies"&&H.status==="warn"))console.log(' \u2022 Run "bun install" to install dependencies');if(Q.find((H)=>H.name==="BunPress Package"&&H.status==="warn"))console.log(' \u2022 Run "bun add @stacksjs/bunpress" to install BunPress');return!1}else if(J>0)return g(`${U} checks passed, ${J} warnings`),!0;else return G(`All ${U} checks passed!`),!0}import{mkdir as a}from"fs/promises";var y6=`import type { BunPressConfig } from '@stacksjs/bunpress'
58
58
 
59
59
  export default {
60
60
  verbose: false,
@@ -200,7 +200,7 @@ Preview the built site:
200
200
  \`\`\`bash
201
201
  bun run preview
202
202
  \`\`\`
203
- `;async function Z6(K={}){try{if(await Bun.file("./docs").exists()&&!K.force){if(!await u("Documentation directory already exists. Continue?",!1))return B("Initialization cancelled"),!1}let Q=new D("Initializing BunPress project...");Q.start(),await a("./docs",{recursive:!0}),await a("./docs/guide",{recursive:!0}),await a("./docs/public",{recursive:!0}),await Bun.write("./bunpress.config.ts",y6),await Bun.write("./docs/index.md",E6),await Bun.write("./docs/guide/index.md",F6);let $=await Bun.file("./.gitignore").exists();if(!$)await Bun.write("./.gitignore",v6);let q=await Bun.file("./README.md").exists();if(!q)await Bun.write("./README.md",D6);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(),G("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(!q)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 W(`Failed to initialize project: ${Z}`),!1}}import{mkdir as w6}from"fs/promises";import{dirname as C6,join as k6}from"path";var $6={default:(K)=>`---
203
+ `;async function Z6(K={}){try{if(await Bun.file("./docs").exists()&&!K.force){if(!await u("Documentation directory already exists. Continue?",!1))return B("Initialization cancelled"),!1}let Q=new D("Initializing BunPress project...");Q.start(),await a("./docs",{recursive:!0}),await a("./docs/guide",{recursive:!0}),await a("./docs/public",{recursive:!0}),await Bun.write("./bunpress.config.ts",y6),await Bun.write("./docs/index.md",E6),await Bun.write("./docs/guide/index.md",F6);let $=await Bun.file("./.gitignore").exists();if(!$)await Bun.write("./.gitignore",v6);let q=await Bun.file("./README.md").exists();if(!q)await Bun.write("./README.md",D6);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(),G("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(!q)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 W(`Failed to initialize project: ${Z}`),!1}}import{mkdir as C6}from"fs/promises";import{dirname as w6,join as k6}from"path";var $6={default:(K)=>`---
204
204
  title: ${K}
205
205
  description:
206
206
  ---
@@ -278,16 +278,17 @@ Post content goes here...
278
278
  ## Section 1
279
279
 
280
280
  Content...
281
- `};async function X6(K,Z={}){try{let Q=K.endsWith(".md")?K:`${K}.md`,$=k6(process.cwd(),"docs",Q);if(await Bun.file($).exists())return W(`File already exists: ${Q}`),!1;let X=Z.title;if(!X)X=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(" ");let Y=Z.template||"default",N=$6[Y];if(!N)return W(`Unknown template: ${Y}`),W(`Available templates: ${Object.keys($6).join(", ")}`),!1;let _=N(X),R=C6($);return await w6(R,{recursive:!0}),await Bun.write($,_),G(`Created ${Q}`),console.log(),console.log(` Title: ${X}`),console.log(` Template: ${Y}`),console.log(` Path: ${$}`),!0}catch(Q){return W(`Failed to create file: ${Q}`),!1}}import{join as Y6}from"path";async function N6(K={}){let Z=K.port||3000,Q=await O,$=K.outdir||Q.outDir||"./dist",q=Y6($,".bunpress"),X=K.verbose||!1;try{let{stat:Y}=await import("fs/promises");try{if(!(await Y(q)).isDirectory())W(`"${q}" is not a directory.`),W('Run "bunpress build" first to generate the documentation.'),process.exit(1)}catch{W(`Build directory "${q}" not found.`),W('Run "bunpress build" first to generate the documentation.'),process.exit(1)}B(`Starting preview server from ${q}`);try{let N=Bun.serve({port:Z,fetch:async(_)=>{let U=new URL(_.url).pathname;if(U.startsWith("/"))U=U.slice(1);if(U===""||U==="/")U="index.html";let A=Y6(q,U),J=Bun.file(A);if(await J.exists())return new Response(J,{headers:{"Content-Type":P6(U)}});let T=`${A}.html`,L=Bun.file(T);if(await L.exists())return new Response(L,{headers:{"Content-Type":"text/html"}});return new Response("404 - Not Found",{status:404})}});G(`Preview server running at http://localhost:${Z}`),console.log(`Press Ctrl+C to stop
282
- `),await new Promise(()=>{})}catch(N){if(N.message?.includes("EADDRINUSE")||N.code==="EADDRINUSE")W(`Port ${Z} is already in use.`),W("Try running with a different port: bunpress preview --port <port>"),W(`Or stop any processes using port ${Z}`);else W(`Failed to start server: ${N.message||N}`);process.exit(1)}}catch(Y){W(`Failed to start preview server: ${Y}`),process.exit(1)}}function P6(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 w from"fs";import*as E from"path";var{YAML:q6}=globalThis.Bun;async function H6(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.fix||!1;if(B("\uD83D\uDD0D Running SEO checks..."),console.log(""),!w.existsSync(Q))W(`Documentation directory not found: ${Q}`),process.exit(1);let q={totalPages:0,errors:[],warnings:[],passed:0},X=await m6(Q);q.totalPages=X.length;for(let Y of X)await h6(Y,Q,q,$);if(p6(q),q.errors.length>0)process.exit(1)}async function h6(K,Z,Q,$){let q=await w.promises.readFile(K,"utf-8"),{frontmatter:X,markdown:Y}=g6(q),N=E.relative(Z,K),_=!1,R=!1,U={...X};if(!X.title){let H=u6(Y);if(!H)Q.errors.push({type:"error",category:"Title",file:N,message:"Missing title in frontmatter"}),_=!0;else if($)U.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}")`}),_=!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=d6(Y);if($)U.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"}),_=!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 A=c6(Y,Z,K);for(let H of A)Q.errors.push({type:"error",category:"Links",file:N,message:`Broken internal link: ${H}`}),_=!0;let J=f6(Y);for(let H of J)Q.warnings.push({type:"warning",category:"Images",file:N,message:`Image missing alt text: ${H}`}),_=!0;if(R){let H=`---
283
- ${q6.stringify(U)}---
284
- ${Y}`;await w.promises.writeFile(K,H,"utf-8")}if(!_)Q.passed++}async function m6(K){let Z=[];async function Q($){let q=await w.promises.readdir($,{withFileTypes:!0});for(let X of q){let Y=E.join($,X.name);if(X.isDirectory()){if(!X.name.startsWith(".")&&X.name!=="node_modules"&&X.name!=="public")await Q(Y)}else if(X.isFile()&&X.name.endsWith(".md"))Z.push(Y)}}return await Q(K),Z}function g6(K){let Z=/^---\n([\s\S]*?)\n---\n?/,Q=K.match(Z);if(!Q)return{frontmatter:{},markdown:K};let $=Q[1],q=K.slice(Q[0].length);try{return{frontmatter:q6.parse($),markdown:q}}catch{return{frontmatter:{},markdown:K}}}function u6(K){let Z=K.match(/^#\s+(.+)$/m);return Z?Z[1].trim():null}function d6(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(`
281
+ `};async function X6(K,Z={}){try{let Q=K.endsWith(".md")?K:`${K}.md`,$=k6(process.cwd(),"docs",Q);if(await Bun.file($).exists())return W(`File already exists: ${Q}`),!1;let X=Z.title;if(!X)X=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(" ");let Y=Z.template||"default",N=$6[Y];if(!N)return W(`Unknown template: ${Y}`),W(`Available templates: ${Object.keys($6).join(", ")}`),!1;let _=N(X),R=w6($);return await C6(R,{recursive:!0}),await Bun.write($,_),G(`Created ${Q}`),console.log(),console.log(` Title: ${X}`),console.log(` Template: ${Y}`),console.log(` Path: ${$}`),!0}catch(Q){return W(`Failed to create file: ${Q}`),!1}}import{join as Y6}from"path";async function N6(K={}){let Z=K.port||3000,Q=await O,$=K.outdir||Q.outDir||"./dist",q=Y6($,".bunpress"),X=K.verbose||!1;try{let{stat:Y}=await import("fs/promises");try{if(!(await Y(q)).isDirectory())W(`"${q}" is not a directory.`),W('Run "bunpress build" first to generate the documentation.'),process.exit(1)}catch{W(`Build directory "${q}" not found.`),W('Run "bunpress build" first to generate the documentation.'),process.exit(1)}B(`Starting preview server from ${q}`);try{let N=Bun.serve({port:Z,fetch:async(_)=>{let U=new URL(_.url).pathname;if(U.startsWith("/"))U=U.slice(1);if(U===""||U==="/")U="index.html";let A=Y6(q,U),J=Bun.file(A);if(await J.exists())return new Response(J,{headers:{"Content-Type":P6(U)}});let T=`${A}.html`,L=Bun.file(T);if(await L.exists())return new Response(L,{headers:{"Content-Type":"text/html"}});return new Response("404 - Not Found",{status:404})}});G(`Preview server running at http://localhost:${Z}`),console.log(`Press Ctrl+C to stop
282
+ `),await new Promise(()=>{})}catch(N){if(N.message?.includes("EADDRINUSE")||N.code==="EADDRINUSE")W(`Port ${Z} is already in use.`),W("Try running with a different port: bunpress preview --port <port>"),W(`Or stop any processes using port ${Z}`);else W(`Failed to start server: ${N.message||N}`);process.exit(1)}}catch(Y){W(`Failed to start preview server: ${Y}`),process.exit(1)}}function P6(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 C from"fs";import*as E from"path";var{YAML:q6}=globalThis.Bun;async function H6(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.fix||!1;if(B("\uD83D\uDD0D Running SEO checks..."),console.log(""),!C.existsSync(Q))W(`Documentation directory not found: ${Q}`),process.exit(1);let q={totalPages:0,errors:[],warnings:[],passed:0},X=await g6(Q);q.totalPages=X.length;for(let Y of X)await h6(Y,Q,q,$);if(l6(q),q.errors.length>0)process.exit(1)}async function h6(K,Z,Q,$){let q=await C.promises.readFile(K,"utf-8"),{frontmatter:X,markdown:Y}=u6(q),N=E.relative(Z,K),_=!1,R=$&&Object.keys(X).length>0,U={...X};if(!X.title){let H=d6(Y);if(!H)Q.errors.push({type:"error",category:"Title",file:N,message:"Missing title in frontmatter"}),_=!0;else if($)U.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}")`}),_=!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=c6(Y);if($)U.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"}),_=!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 A=f6(Y,Z,K);for(let H of A)Q.errors.push({type:"error",category:"Links",file:N,message:`Broken internal link: ${H}`}),_=!0;let J=p6(Y);for(let H of J)Q.warnings.push({type:"warning",category:"Images",file:N,message:`Image missing alt text: ${H}`}),_=!0;if(R){let H=m6(U,Y);await C.promises.writeFile(K,H,"utf-8")}if(!_)Q.passed++}function m6(K,Z){return`---
283
+ ${q6.stringify(K,null,2)}
284
+ ---
285
+ ${Z}`}async function g6(K){let Z=[];async function Q($){let q=await C.promises.readdir($,{withFileTypes:!0});for(let X of q){let Y=E.join($,X.name);if(X.isDirectory()){if(!X.name.startsWith(".")&&X.name!=="node_modules"&&X.name!=="public")await Q(Y)}else if(X.isFile()&&X.name.endsWith(".md"))Z.push(Y)}}return await Q(K),Z}function u6(K){let Z=/^---\n([\s\S]*?)\n---\n?/,Q=K.match(Z);if(!Q)return{frontmatter:{},markdown:K};let $=Q[1],q=K.slice(Q[0].length);try{return{frontmatter:q6.parse($),markdown:q}}catch{return{frontmatter:{},markdown:K}}}function d6(K){let Z=K.match(/^#\s+(.+)$/m);return Z?Z[1].trim():null}function c6(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(`
285
286
 
286
- `)[0]||Q;if($.length>Z)return`${$.slice(0,Z)}...`;return $||"Documentation page"}function c6(K,Z,Q){let $=[],q=/\[([^\]]+)\]\(([^)]+)\)/g,X=K.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`+[^`\n]*`+/g,"").replace(/<!--[\s\S]*?-->/g,""),Y;while((Y=q.exec(X))!==null){let N=Y[2].trim();if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(N))continue;if(N.startsWith("#"))continue;let _=N.split("#",1)[0].split("?",1)[0];if(!_)continue;let R;try{R=decodeURIComponent(_.replace(/^<|>$/g,""))}catch{$.push(N);continue}let U=R.startsWith("/")?E.resolve(Z,`.${R}`):E.resolve(E.dirname(Q),R);if(!(U.endsWith(".md")?[U]:[U,`${U}.md`,E.join(U,"index.md")]).some((J)=>w.existsSync(J)))$.push(N)}return $}function f6(K){let Z=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,$;while(($=Q.exec(K))!==null){let q=$[1],X=$[2];if(!q||q.trim()==="")Z.push(X)}return Z}function p6(K){if(console.log(""),B("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${x(K.totalPages.toString(),"blue")}`),console.log(`Passed: ${x(K.passed.toString(),"green")}`),console.log(`Errors: ${x(K.errors.length.toString(),K.errors.length>0?"red":"green")}`),console.log(`Warnings: ${x(K.warnings.length.toString(),K.warnings.length>0?"yellow":"green")}`),console.log(""),K.errors.length>0){W(`\u2717 ${K.errors.length} errors found:`),console.log("");let Z=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));h(Z),console.log("")}if(K.warnings.length>0){g(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let Z=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));h(Z),console.log("")}if(K.errors.length===0&&K.warnings.length===0)G("\u2713 All SEO checks passed!");else if(K.errors.length===0)G("\u2713 No errors found (only warnings)")}import{join as l6}from"path";async function a6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
287
+ `)[0]||Q;if($.length>Z)return`${$.slice(0,Z)}...`;return $||"Documentation page"}function f6(K,Z,Q){let $=[],q=/\[([^\]]+)\]\(([^)]+)\)/g,X=K.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`+[^`\n]*`+/g,"").replace(/<!--[\s\S]*?-->/g,""),Y;while((Y=q.exec(X))!==null){let N=Y[2].trim();if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(N))continue;if(N.startsWith("#"))continue;let _=N.split("#",1)[0].split("?",1)[0];if(!_)continue;let R;try{R=decodeURIComponent(_.replace(/^<|>$/g,""))}catch{$.push(N);continue}let U=R.startsWith("/")?E.resolve(Z,`.${R}`):E.resolve(E.dirname(Q),R);if(!(U.endsWith(".md")?[U]:[U,`${U}.md`,E.join(U,"index.md")]).some((J)=>C.existsSync(J)))$.push(N)}return $}function p6(K){let Z=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,$;while(($=Q.exec(K))!==null){let q=$[1],X=$[2];if(!q||q.trim()==="")Z.push(X)}return Z}function l6(K){if(console.log(""),B("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${x(K.totalPages.toString(),"blue")}`),console.log(`Passed: ${x(K.passed.toString(),"green")}`),console.log(`Errors: ${x(K.errors.length.toString(),K.errors.length>0?"red":"green")}`),console.log(`Warnings: ${x(K.warnings.length.toString(),K.warnings.length>0?"yellow":"green")}`),console.log(""),K.errors.length>0){W(`\u2717 ${K.errors.length} errors found:`),console.log("");let Z=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));h(Z),console.log("")}if(K.warnings.length>0){g(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let Z=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));h(Z),console.log("")}if(K.errors.length===0&&K.warnings.length===0)G("\u2713 All SEO checks passed!");else if(K.errors.length===0)G("\u2713 No errors found (only warnings)")}import{join as a6}from"path";async function n6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
287
288
  `),$=0,q=!1,X=[];for(let R of Q){if(R.trim().startsWith("```")){q=!q;continue}if(!q)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 d(K),lines:Q.length,words:$,headings:N,codeBlocks:Math.floor(_)}}async function _6(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.verbose||!1;try{console.log(x(`
288
289
  Analyzing documentation...
289
- `,"bold"));let{Glob:q}=awaitPromise.resolve(globalThis.Bun),X=new q("**/*.md"),Y=[];for await(let M of X.scan(Q)){let V=l6(Q,M),c=await a6(V);Y.push(c)}if(Y.length===0)return W("No markdown files found"),!1;let N=Y.reduce((M,V)=>M+V.size,0),_=Y.reduce((M,V)=>M+V.lines,0),R=Y.reduce((M,V)=>M+V.words,0),U=Y.reduce((M,V)=>M+V.headings,0),A=Y.reduce((M,V)=>M+V.codeBlocks,0);if(console.log(x("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${Y.length}`),console.log(`Total size: ${S(N)}`),console.log(`Total lines: ${_.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${U}`),console.log(`Code blocks: ${A}`),console.log(),$){console.log(x("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let M=Y.map((V)=>({File:V.path.replace(`${Q}/`,""),Size:S(V.size),Lines:V.lines,Words:V.words,Headings:V.headings,"Code Blocks":V.codeBlocks}));h(M),console.log()}let J=N/Y.length,H=_/Y.length,T=R/Y.length;console.log(x("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${S(J)}`),console.log(`Lines: ${Math.round(H)}`),console.log(`Words: ${Math.round(T)}`),console.log();let L=[...Y].sort((M,V)=>V.size-M.size).slice(0,5);if(L.length>0){console.log(x("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let M of L){let V=M.path.replace(`${Q}/`,"");console.log(` ${V.padEnd(40)} ${S(M.size)}`)}console.log()}let F=Math.ceil(R/200);return B(`Estimated reading time: ${F} minutes`),!0}catch(q){return W(`Failed to generate statistics: ${q}`),!1}}var b=new s6("bunpress"),j={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function M6(K){let Z=new j6("**/*.md"),Q=[];for await(let $ of Z.scan(K))Q.push(v(K,$));return Q}async function r6(K,Z,Q=!1){let $=`${Z}/public`;try{await i6($);let q=new j6("**/*");for await(let X of q.scan($)){let Y=v($,X),N=v(K,X);await A6(v(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await n6(Y,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function e6(K,Z,Q){try{let $=await O;if($.sitemap?.enabled!==!1&&$.sitemap?.baseUrl)await V6(K,Z,$);if($.robots?.enabled!==!1)await U6(Z,$);if($.rss?.enabled)await W6(K,Z,$,$.rss)}catch($){if(Q)console.error("Error generating SEO files:",$)}}async function R6(K={}){let Z=await O,Q=K.outdir||Z.outDir||j.outdir,$=v(Q,".bunpress"),q=K.dir||Z.docsDir||j.docsdir,X=K.verbose??j.verbose,Y=K.minify??!1,N=K.sourcemap??!1,_=performance.now(),R=new D("Building documentation...");if(!X)R.start();await A6($,{recursive:!0});let U=await M6(q);if(U.length===0){if(!X)R.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(X)console.log(`Found ${U.length} markdown files:`),U.forEach((A)=>console.log(`- ${A}`));try{let{markdownToHtml:A,wrapInLayout:J}=await import("./chunk-gxhjya5p.js"),{mkdir:H,writeFile:T}=await import("fs/promises");if(X)console.log("Transforming markdown to HTML...");for(let M of U){let V=await Bun.file(M).text(),{html:c,frontmatter:B6}=await A(V,q),G6=M.replace(/^\.\//,""),J6=q.replace(/^\.\//,""),P=G6.replace(J6,"").replace(/^\//,"").replace(/\.md$/,""),x6=`/${P}`,T6=B6.layout||"doc",O6=await J(c,Z,x6,T6),m=P==="index"||P.endsWith("/index")?v($,`${P}.html`):v($,P,"index.html"),i=m.substring(0,m.lastIndexOf("/"));if(i)await H(i,{recursive:!0});if(await T(m,O6),X)console.log(`Generated: ${m}`)}if(X)console.log(`Processed ${U.length} markdown files.`);await r6($,q,X),await o6($),await t6($,Z),await e6(q,$,X||!1);let F=performance.now()-_;if(!X)R.succeed(`Built ${U.length} pages to HTML in ${f(F)}`);else G(`Build completed in ${f(F)}`),console.log(`
290
- Generated ${U.length} HTML files in ${$}`);return!0}catch(A){if(!X)R.fail("Build failed");return console.error("Error during build:",A),!1}}async function t6(K,Z){let{wrapInLayout:Q}=await import("./chunk-gxhjya5p.js"),$=`
290
+ `,"bold"));let{Glob:q}=awaitPromise.resolve(globalThis.Bun),X=new q("**/*.md"),Y=[];for await(let M of X.scan(Q)){let V=a6(Q,M),c=await n6(V);Y.push(c)}if(Y.length===0)return W("No markdown files found"),!1;let N=Y.reduce((M,V)=>M+V.size,0),_=Y.reduce((M,V)=>M+V.lines,0),R=Y.reduce((M,V)=>M+V.words,0),U=Y.reduce((M,V)=>M+V.headings,0),A=Y.reduce((M,V)=>M+V.codeBlocks,0);if(console.log(x("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${Y.length}`),console.log(`Total size: ${S(N)}`),console.log(`Total lines: ${_.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${U}`),console.log(`Code blocks: ${A}`),console.log(),$){console.log(x("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let M=Y.map((V)=>({File:V.path.replace(`${Q}/`,""),Size:S(V.size),Lines:V.lines,Words:V.words,Headings:V.headings,"Code Blocks":V.codeBlocks}));h(M),console.log()}let J=N/Y.length,H=_/Y.length,T=R/Y.length;console.log(x("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${S(J)}`),console.log(`Lines: ${Math.round(H)}`),console.log(`Words: ${Math.round(T)}`),console.log();let L=[...Y].sort((M,V)=>V.size-M.size).slice(0,5);if(L.length>0){console.log(x("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let M of L){let V=M.path.replace(`${Q}/`,"");console.log(` ${V.padEnd(40)} ${S(M.size)}`)}console.log()}let F=Math.ceil(R/200);return B(`Estimated reading time: ${F} minutes`),!0}catch(q){return W(`Failed to generate statistics: ${q}`),!1}}var b=new r6("bunpress"),j={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function M6(K){let Z=new j6("**/*.md"),Q=[];for await(let $ of Z.scan(K))Q.push(v(K,$));return Q}async function e6(K,Z,Q=!1){let $=`${Z}/public`;try{await s6($);let q=new j6("**/*");for await(let X of q.scan($)){let Y=v($,X),N=v(K,X);await A6(v(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await i6(Y,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function t6(K,Z,Q){try{let $=await O;if($.sitemap?.enabled!==!1&&$.sitemap?.baseUrl)await V6(K,Z,$);if($.robots?.enabled!==!1)await U6(Z,$);if($.rss?.enabled)await W6(K,Z,$,$.rss)}catch($){if(Q)console.error("Error generating SEO files:",$)}}async function R6(K={}){let Z=await O,Q=K.outdir||Z.outDir||j.outdir,$=v(Q,".bunpress"),q=K.dir||Z.docsDir||j.docsdir,X=K.verbose??j.verbose,Y=K.minify??!1,N=K.sourcemap??!1,_=performance.now(),R=new D("Building documentation...");if(!X)R.start();await A6($,{recursive:!0});let U=await M6(q);if(U.length===0){if(!X)R.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(X)console.log(`Found ${U.length} markdown files:`),U.forEach((A)=>console.log(`- ${A}`));try{let{markdownToHtml:A,wrapInLayout:J}=await import("./chunk-gxhjya5p.js"),{mkdir:H,writeFile:T}=await import("fs/promises");if(X)console.log("Transforming markdown to HTML...");for(let M of U){let V=await Bun.file(M).text(),{html:c,frontmatter:B6}=await A(V,q),G6=M.replace(/^\.\//,""),J6=q.replace(/^\.\//,""),P=G6.replace(J6,"").replace(/^\//,"").replace(/\.md$/,""),x6=`/${P}`,T6=B6.layout||"doc",O6=await J(c,Z,x6,T6),m=P==="index"||P.endsWith("/index")?v($,`${P}.html`):v($,P,"index.html"),i=m.substring(0,m.lastIndexOf("/"));if(i)await H(i,{recursive:!0});if(await T(m,O6),X)console.log(`Generated: ${m}`)}if(X)console.log(`Processed ${U.length} markdown files.`);await e6($,q,X),await K4($),await o6($,Z),await t6(q,$,X||!1);let F=performance.now()-_;if(!X)R.succeed(`Built ${U.length} pages to HTML in ${f(F)}`);else G(`Build completed in ${f(F)}`),console.log(`
291
+ Generated ${U.length} HTML files in ${$}`);return!0}catch(A){if(!X)R.fail("Build failed");return console.error("Error during build:",A),!1}}async function o6(K,Z){let{wrapInLayout:Q}=await import("./chunk-gxhjya5p.js"),$=`
291
292
  <style>
292
293
  .NotFound {
293
294
  padding: 64px 24px 96px;
@@ -441,9 +442,9 @@ Generated ${U.length} HTML files in ${$}`);return!0}catch(A){if(!X)R.fail("Build
441
442
  </a>
442
443
  </div>
443
444
  </div>
444
- `,Z,"/404","doc");await Bun.write(v(K,"404.html"),q)}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)}}b.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("--watch","Watch for changes and rebuild",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await R6(K))I.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await O,q=K.dir||$.docsDir||"./docs";console.log(`
445
+ `,Z,"/404","doc");await Bun.write(v(K,"404.html"),q)}async function K4(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)}}b.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("--watch","Watch for changes and rebuild",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await R6(K))I.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await O,q=K.dir||$.docsDir||"./docs";console.log(`
445
446
  Watching for changes...`),Q(q,{recursive:!0},async(X,Y)=>{if(Y&&Y.endsWith(".md"))console.log(`
446
- Detected change in ${Y}, rebuilding...`),await R6(K)}),await new Promise(()=>{})}});b.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:j.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:j.watch}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{let Z=await O,Q=K.port||j.port,$=K.dir||Z.docsDir||j.docsdir,q=K.watch??j.watch,X=K.verbose??j.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:q,verbose:X});let{serveCLI:Y}=await import("./chunk-gxhjya5p.js");await Y({port:Q,root:$,watch:q,config:Z})});async function K4(K={}){let Z=await O,Q=K.dir||Z.docsDir||j.docsdir,$=K.output||"./docs.md",q=K.full??!1,X=K.verbose??j.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${q}`);let Y=await M6(Q);if(Y.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${Y.length} markdown files`);Y.sort();let N=`# Documentation
447
+ Detected change in ${Y}, rebuilding...`),await R6(K)}),await new Promise(()=>{})}});b.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:j.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:j.watch}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{let Z=await O,Q=K.port||j.port,$=K.dir||Z.docsDir||j.docsdir,q=K.watch??j.watch,X=K.verbose??j.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:q,verbose:X});let{serveCLI:Y}=await import("./chunk-gxhjya5p.js");await Y({port:Q,root:$,watch:q,config:Z})});async function Q4(K={}){let Z=await O,Q=K.dir||Z.docsDir||j.docsdir,$=K.output||"./docs.md",q=K.full??!1,X=K.verbose??j.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${q}`);let Y=await M6(Q);if(Y.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${Y.length} markdown files`);Y.sort();let N=`# Documentation
447
448
 
448
449
  `;N+=`Generated: ${new Date().toISOString()}
449
450
 
@@ -462,5 +463,5 @@ Detected change in ${Y}, rebuilding...`),await R6(K)}),await new Promise(()=>{})
462
463
  `}N+=`---
463
464
 
464
465
  `}return await Bun.write($,N),console.log(`
465
- LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}b.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:j.verbose}).action(async(K)=>{if(!await K4(K))I.exit(1)});b.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 Z6(K))I.exit(1)});b.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:j.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{await N6(K)});b.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:j.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await e(K))I.exit(1)});b.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await Q6(K))I.exit(1)});b.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await t(K))I.exit(1)});b.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await o(K))I.exit(1)});b.command("config:init","Initialize configuration file").action(async(K)=>{if(!await K6(K))I.exit(1)});b.command("new <path>","Create a new markdown file").option("--title <title>","Page title").option("--template <template>","Template to use (default, guide, api, blog)",{default:"default"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K,Z)=>{if(!await X6(K,Z))I.exit(1)});b.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await _6(K))I.exit(1)});b.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 H6(K)});b.command("deploy","Deploy documentation to AWS using CloudFormation (S3 + CloudFront + Route53)").option("--region <region>","AWS region for S3 bucket",{default:"us-east-1"}).option("--bucket <bucket>","S3 bucket name (auto-generated if not provided)").option("--domain <domain>","Custom domain (e.g., docs.example.com)").option("--subdomain <subdomain>","Subdomain (used with --base-domain)").option("--base-domain <baseDomain>","Base domain (e.g., example.com) - must have Route53 hosted zone").option("--stack-name <stackName>","CloudFormation stack name").option("--hosted-zone-id <hostedZoneId>","Route53 hosted zone ID (auto-detected from domain)").option("--certificate-arn <certificateArn>","ACM certificate ARN (auto-created if not provided)").option("--dry-run","Show configuration without deploying",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-0p212j32.js");if(!await Z(K))I.exit(1)});b.help();b.version(s);var n=Bun.argv[1]||"",Q4=n.endsWith("/bunpress")||n.endsWith("/cli.ts")||n.endsWith("/cli.js");if(Q4)b.parse();
466
+ LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}b.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:j.verbose}).action(async(K)=>{if(!await Q4(K))I.exit(1)});b.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 Z6(K))I.exit(1)});b.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:j.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{await N6(K)});b.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:j.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await e(K))I.exit(1)});b.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await Q6(K))I.exit(1)});b.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await t(K))I.exit(1)});b.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await o(K))I.exit(1)});b.command("config:init","Initialize configuration file").action(async(K)=>{if(!await K6(K))I.exit(1)});b.command("new <path>","Create a new markdown file").option("--title <title>","Page title").option("--template <template>","Template to use (default, guide, api, blog)",{default:"default"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K,Z)=>{if(!await X6(K,Z))I.exit(1)});b.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await _6(K))I.exit(1)});b.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 H6(K)});b.command("deploy","Deploy documentation to AWS using CloudFormation (S3 + CloudFront + Route53)").option("--region <region>","AWS region for S3 bucket",{default:"us-east-1"}).option("--bucket <bucket>","S3 bucket name (auto-generated if not provided)").option("--domain <domain>","Custom domain (e.g., docs.example.com)").option("--subdomain <subdomain>","Subdomain (used with --base-domain)").option("--base-domain <baseDomain>","Base domain (e.g., example.com) - must have Route53 hosted zone").option("--stack-name <stackName>","CloudFormation stack name").option("--hosted-zone-id <hostedZoneId>","Route53 hosted zone ID (auto-detected from domain)").option("--certificate-arn <certificateArn>","ACM certificate ARN (auto-created if not provided)").option("--dry-run","Show configuration without deploying",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-1tetp4zz.js");if(!await Z(K))I.exit(1)});b.help();b.version(s);var n=Bun.argv[1]||"",Z4=n.endsWith("/bunpress")||n.endsWith("/cli.ts")||n.endsWith("/cli.js");if(Z4)b.parse();
466
467
  export{G as E,W as F,B as G,D as H,M6 as I,R6 as J};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{E as $,F as I,G as f,H as h,J as x}from"./chunk-wdshfmqq.js";import"./chunk-ss6yzy9f.js";import{Q as _}from"./chunk-e5q66hsy.js";import"./chunk-w6byd4st.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{E as $,F as I,G as f,H as h,J as x}from"./chunk-0732cng2.js";import"./chunk-ss6yzy9f.js";import{Q as _}from"./chunk-e5q66hsy.js";import"./chunk-w6byd4st.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(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/bunpress",
3
3
  "type": "module",
4
- "version": "0.1.17",
4
+ "version": "0.1.18",
5
5
  "description": "Modern documentation engine. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",