@stacksjs/bunpress 0.1.6 → 0.1.7
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 +1 -1
- package/dist/{chunk-8mywpq4a.js → chunk-6vpj0476.js} +272 -271
- package/dist/{chunk-7z6wzjev.js → chunk-ermd65hf.js} +4 -4
- package/dist/chunk-jd54gjek.js +2 -0
- package/dist/{chunk-eqw9bzek.js → chunk-qbbrq6ra.js} +1 -1
- package/dist/data-loader.d.ts +7 -0
- package/dist/src/index.js +1 -1
- package/dist/stx-components.d.ts +11 -0
- package/dist/templates/features.stx +3 -3
- package/dist/templates/hero.stx +3 -3
- package/dist/templates/layout-doc.stx +19 -19
- package/dist/templates/layout-home.stx +8 -1
- package/dist/templates/layout-page.stx +10 -10
- package/dist/templates/page-toc.stx +8 -8
- package/dist/templates/sidebar-section.stx +4 -4
- package/dist/templates/sidebar.stx +8 -8
- package/dist/themes/vitepress/base.css +1 -1
- package/dist/themes/vitepress/index.d.ts +78 -78
- package/dist/themes/vitepress/index.ts +80 -80
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunk-3kj1ps9z.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M as z6,h as L}from"./chunk-
|
|
2
|
+
import{M as z6,h as L}from"./chunk-6vpj0476.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.7";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-
|
|
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-
|
|
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-jd54gjek.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-jd54gjek.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-
|
|
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-qbbrq6ra.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};
|
|
@@ -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-
|
|
2
|
+
import{a as $,b as I,c as f,d as h,f as x}from"./chunk-ermd65hf.js";import{h as _}from"./chunk-6vpj0476.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(`
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load all JSON data files from `<rootDir>/.data` into a single object.
|
|
3
|
+
* Results are cached per root directory.
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadDataFiles(rootDir: string): Promise<Record<string, unknown>>;
|
|
6
|
+
/** Clear the data cache (used for dev-server hot reloading). */
|
|
7
|
+
export declare function clearDataCache(): void;
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{A as L,B as M,C as N,D as O,E as P,F as Q,G as R,H as S,I as T,J as V,K as W,L as X,M as Y,g as t,h as b,i as e,j as h,k as j,l as k,m as q,n as u,o as v,p as w,q as z,r as B,s as D,t as E,u as F,v as G,w as H,x as I,y as J,z as K}from"../chunk-
|
|
2
|
+
import{A as L,B as M,C as N,D as O,E as P,F as Q,G as R,H as S,I as T,J as V,K as W,L as X,M as Y,g as t,h as b,i as e,j as h,k as j,l as k,m as q,n as u,o as v,p as w,q as z,r as B,s as D,t as E,u as F,v as G,w as H,x as I,y as J,z as K}from"../chunk-6vpj0476.js";import"../chunk-43fsk0jg.js";export{V as wrapInLayout,T as stripConfiguredBasePath,X as startServer,Y as serveCLI,h as resetHighlighter,O as processInlineTocSyntax,w as prewarmHighlighter,j as normalizeLanguage,W as markdownToHtml,k as isLanguageSupported,u as highlightCodeSync,q as highlightCode,v as getSyntaxHighlightingStyles,z as getHighlighterInstance,S as getConfiguredBasePath,e as getConfig,E as generateUniqueSlug,Q as generateTocStyles,R as generateTocScripts,N as generateTocPositions,I as generateTocHtml,M as generateTocData,D as generateSlug,K as generateSidebarTocHtml,J as generateInlineTocHtml,L as generateFloatingTocHtml,H as filterHeadings,F as extractHeadings,P as enhanceHeadingsWithAnchors,B as defaultTocConfig,t as defaultConfig,b as config,G as buildTocHierarchy};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Clear the component cache (used for dev-server hot reloading). */
|
|
2
|
+
export declare function clearComponentCache(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve PascalCase component tags in `content` to rendered HTML.
|
|
5
|
+
*
|
|
6
|
+
* @param content Markdown (or page) source to scan.
|
|
7
|
+
* @param componentsDir Directory holding `.stx` component files.
|
|
8
|
+
* @param context Variables available to bound props and components.
|
|
9
|
+
* @param depth Internal recursion guard for components emitting components.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveStxComponents(content: string, componentsDir: string, context: Record<string, unknown>, depth?: number): Promise<string>;
|
package/dist/templates/hero.stx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="
|
|
1
|
+
<div class="BPHomeHero">
|
|
2
2
|
<div class="hero-container">
|
|
3
3
|
<div class="hero-content">
|
|
4
4
|
{!! name !!}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</div>
|
|
12
12
|
|
|
13
13
|
<style>
|
|
14
|
-
.
|
|
14
|
+
.BPHomeHero {
|
|
15
15
|
position: relative;
|
|
16
16
|
padding: 64px 24px 48px;
|
|
17
17
|
}
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@media (min-width: 960px) {
|
|
42
|
-
.
|
|
42
|
+
.BPHomeHero {
|
|
43
43
|
padding: 80px 64px 56px;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -13,30 +13,30 @@
|
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div class="Layout">
|
|
16
|
-
<!--
|
|
17
|
-
<header class="
|
|
18
|
-
<div class="
|
|
19
|
-
<div class="
|
|
20
|
-
<button class="
|
|
16
|
+
<!-- BPNav - Header -->
|
|
17
|
+
<header class="BPNav">
|
|
18
|
+
<div class="BPNavBar">
|
|
19
|
+
<div class="BPNavBarStart">
|
|
20
|
+
<button class="BPNavBarHamburger" type="button" aria-label="Toggle navigation" onclick="toggleSidebar()">
|
|
21
21
|
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
22
22
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
|
|
23
23
|
</svg>
|
|
24
24
|
</button>
|
|
25
|
-
<a href="/" class="
|
|
26
|
-
<div class="
|
|
27
|
-
<svg class="
|
|
25
|
+
<a href="/" class="BPNavBarTitle">{{ title }}</a>
|
|
26
|
+
<div class="BPNavBarSearch">
|
|
27
|
+
<svg class="BPNavBarSearch-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
28
28
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
|
29
29
|
</svg>
|
|
30
|
-
<input type="text" class="
|
|
31
|
-
<kbd class="
|
|
30
|
+
<input type="text" class="BPNavBarSearch-input" placeholder="Search" />
|
|
31
|
+
<kbd class="BPNavBarSearch-kbd">⌘ K</kbd>
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
|
-
<div class="
|
|
36
|
-
<div class="
|
|
35
|
+
<div class="BPNavBarEnd">
|
|
36
|
+
<div class="BPNavBarMenu">
|
|
37
37
|
{!! nav !!}
|
|
38
38
|
</div>
|
|
39
|
-
<div class="
|
|
39
|
+
<div class="BPSocialLinks">
|
|
40
40
|
<button class="theme-toggle" onclick="toggleTheme()" aria-label="Toggle dark mode" title="Toggle dark mode">
|
|
41
41
|
<svg class="sun-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
42
42
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path>
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
</div>
|
|
56
56
|
</header>
|
|
57
57
|
|
|
58
|
-
<!--
|
|
58
|
+
<!-- BPSidebar -->
|
|
59
59
|
{!! sidebar !!}
|
|
60
60
|
|
|
61
|
-
<!--
|
|
62
|
-
<main class="
|
|
63
|
-
<div class="
|
|
64
|
-
<div class="
|
|
61
|
+
<!-- BPContent - Main content area -->
|
|
62
|
+
<main class="BPContent BPContent--doc">
|
|
63
|
+
<div class="BPDoc">
|
|
64
|
+
<div class="BPDocContent">
|
|
65
65
|
<article class="bp-doc">
|
|
66
66
|
{!! content !!}
|
|
67
67
|
</article>
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
</div>
|
|
153
153
|
</div>
|
|
154
154
|
|
|
155
|
-
<!--
|
|
155
|
+
<!-- BPDocAside - TOC -->
|
|
156
156
|
{!! pageTOC !!}
|
|
157
157
|
</div>
|
|
158
158
|
</body>
|
|
@@ -13,7 +13,14 @@
|
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div class="Layout">
|
|
16
|
-
|
|
16
|
+
<!-- BPNav - Header -->
|
|
17
|
+
<header class="BPNav">
|
|
18
|
+
<div class="BPNavBar">
|
|
19
|
+
{!! nav !!}
|
|
20
|
+
</div>
|
|
21
|
+
</header>
|
|
22
|
+
|
|
23
|
+
<main class="BPHome">
|
|
17
24
|
{!! content !!}
|
|
18
25
|
</main>
|
|
19
26
|
</div>
|
|
@@ -13,23 +13,23 @@
|
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div class="Layout">
|
|
16
|
-
<!--
|
|
17
|
-
<header class="
|
|
18
|
-
<div class="
|
|
19
|
-
<div class="
|
|
20
|
-
<a href="/" class="
|
|
16
|
+
<!-- BPNav - Header -->
|
|
17
|
+
<header class="BPNav">
|
|
18
|
+
<div class="BPNavBar">
|
|
19
|
+
<div class="BPNavBarStart">
|
|
20
|
+
<a href="/" class="BPNavBarTitle">{{ title }}</a>
|
|
21
21
|
</div>
|
|
22
|
-
<div class="
|
|
23
|
-
<div class="
|
|
22
|
+
<div class="BPNavBarEnd">
|
|
23
|
+
<div class="BPNavBarMenu">
|
|
24
24
|
{!! nav !!}
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
</header>
|
|
29
29
|
|
|
30
|
-
<!--
|
|
31
|
-
<main class="
|
|
32
|
-
<div class="
|
|
30
|
+
<!-- BPContent - Full-width content without sidebar -->
|
|
31
|
+
<main class="BPContent BPContent--page">
|
|
32
|
+
<div class="BPPage">
|
|
33
33
|
<article class="bp-doc">
|
|
34
34
|
{!! content !!}
|
|
35
35
|
</article>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<aside class="
|
|
2
|
-
<div class="
|
|
1
|
+
<aside class="BPDocAside">
|
|
2
|
+
<div class="BPDocAsideOutline">
|
|
3
3
|
<p class="outline-title">On this page</p>
|
|
4
4
|
<nav class="page-toc">
|
|
5
5
|
<div class="outline-marker"></div>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</aside>
|
|
10
10
|
|
|
11
11
|
<style>
|
|
12
|
-
.
|
|
12
|
+
.BPDocAside {
|
|
13
13
|
position: fixed;
|
|
14
14
|
top: var(--bp-nav-height, 64px);
|
|
15
15
|
bottom: 0;
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
scrollbar-width: none;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.
|
|
26
|
+
.BPDocAside::-webkit-scrollbar {
|
|
27
27
|
display: none;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.
|
|
30
|
+
.BPDocAsideOutline {
|
|
31
31
|
font-size: 14px;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
|
|
43
43
|
/* Show aside on xl screens and adjust main content */
|
|
44
44
|
@media (min-width: 1280px) {
|
|
45
|
-
.
|
|
45
|
+
.BPDocAside {
|
|
46
46
|
display: block !important;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.
|
|
49
|
+
.BPContent {
|
|
50
50
|
right: max(256px, calc((100vw - var(--bp-layout-max-width, 1440px)) / 2 + 256px)) !important;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -118,7 +118,7 @@ function initPageTOC() {
|
|
|
118
118
|
const marker = document.querySelector('.outline-marker');
|
|
119
119
|
const tocLinks = document.querySelectorAll('.page-toc a');
|
|
120
120
|
const headings = Array.from(document.querySelectorAll('h2[id], h3[id], h4[id], h5[id], h6[id]'));
|
|
121
|
-
const scrollContainer = document.querySelector('.
|
|
121
|
+
const scrollContainer = document.querySelector('.BPContent');
|
|
122
122
|
|
|
123
123
|
if (!tocLinks.length || !headings.length || !scrollContainer || !marker) return;
|
|
124
124
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="
|
|
1
|
+
<div class="BPSidebarItem sidebar-section">
|
|
2
2
|
<button class="sidebar-section-toggle" onclick="toggleSection(this.parentElement)" type="button">
|
|
3
3
|
<span>{{ title }}</span>
|
|
4
4
|
<svg class="chevron" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
transform: rotate(-90deg);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.
|
|
70
|
+
.BPSidebarItem-link {
|
|
71
71
|
display: block;
|
|
72
72
|
padding: 6px 24px;
|
|
73
73
|
color: var(--bp-c-text-2);
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
margin-left: 0;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.
|
|
82
|
+
.BPSidebarItem-link:hover {
|
|
83
83
|
color: var(--bp-c-brand-1);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
.
|
|
86
|
+
.BPSidebarItem-link.is-active {
|
|
87
87
|
color: var(--bp-c-brand-1);
|
|
88
88
|
font-weight: 600;
|
|
89
89
|
border-left-color: var(--bp-c-brand-1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
<nav class="
|
|
1
|
+
<div class="BPSidebar-backdrop" onclick="toggleSidebar(false)"></div>
|
|
2
|
+
<nav class="BPSidebar">
|
|
3
3
|
<div class="sidebar-content">
|
|
4
4
|
{!! sections !!}
|
|
5
5
|
</div>
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
<script>
|
|
9
9
|
function toggleSidebar(forceState) {
|
|
10
|
-
var sb = document.querySelector('.
|
|
11
|
-
var bd = document.querySelector('.
|
|
10
|
+
var sb = document.querySelector('.BPSidebar');
|
|
11
|
+
var bd = document.querySelector('.BPSidebar-backdrop');
|
|
12
12
|
if (!sb) return;
|
|
13
13
|
var nextOpen = typeof forceState === 'boolean' ? forceState : !sb.classList.contains('is-open');
|
|
14
14
|
sb.classList.toggle('is-open', nextOpen);
|
|
@@ -20,14 +20,14 @@ if (!window.__bpSidebarBound) {
|
|
|
20
20
|
// Close drawer when the user clicks a sidebar link on mobile
|
|
21
21
|
document.addEventListener('click', function(e) {
|
|
22
22
|
if (window.matchMedia('(min-width: 960px)').matches) return;
|
|
23
|
-
var a = e.target.closest('.
|
|
23
|
+
var a = e.target.closest('.BPSidebar a');
|
|
24
24
|
if (a) toggleSidebar(false);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<style>
|
|
30
|
-
.
|
|
30
|
+
.BPSidebar {
|
|
31
31
|
position: fixed;
|
|
32
32
|
top: var(--bp-nav-height, 64px);
|
|
33
33
|
bottom: 0;
|
|
@@ -48,7 +48,7 @@ if (!window.__bpSidebarBound) {
|
|
|
48
48
|
|
|
49
49
|
/* At 960px+ (tablet), position sidebar normally */
|
|
50
50
|
@media (min-width: 960px) {
|
|
51
|
-
.
|
|
51
|
+
.BPSidebar {
|
|
52
52
|
left: 0;
|
|
53
53
|
width: var(--bp-sidebar-width, 272px);
|
|
54
54
|
}
|
|
@@ -61,7 +61,7 @@ if (!window.__bpSidebarBound) {
|
|
|
61
61
|
|
|
62
62
|
/* At 1440px+ (ultra-wide), extend sidebar to fill left margin */
|
|
63
63
|
@media (min-width: 1440px) {
|
|
64
|
-
.
|
|
64
|
+
.BPSidebar {
|
|
65
65
|
/* Extend width to include left margin area */
|
|
66
66
|
width: calc((100vw - var(--bp-layout-max-width, 1440px)) / 2 + var(--bp-sidebar-width, 272px));
|
|
67
67
|
/* Padding pushes content to the right position */
|