@stacksjs/bunpress 0.1.13 → 0.1.15
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/bin/commands/seo.d.ts +4 -0
- package/dist/{chunk-h07knheg.js → chunk-b99gqcxe.js} +1 -1
- package/dist/{chunk-pa3gwajr.js → chunk-e5q66hsy.js} +1 -1
- package/dist/{chunk-bqrr0kn9.js → chunk-mch0qmg4.js} +1 -1
- package/dist/chunk-mmergr6m.js +466 -0
- package/dist/chunk-ss6yzy9f.js +33 -0
- package/dist/{chunk-sd994fph.js → chunk-vkxkq2vj.js} +1 -1
- package/dist/{chunk-xenbc8gk.js → chunk-w17epehd.js} +2 -2
- package/dist/{chunk-43fsk0jg.js → chunk-w6byd4st.js} +1 -1
- package/dist/src/index.js +1 -1
- package/package.json +2 -3
- package/dist/chunk-ejcvtq7c.js +0 -496
|
@@ -0,0 +1,466 @@
|
|
|
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.15";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
|
+
|
|
4
|
+
export default {
|
|
5
|
+
verbose: false,
|
|
6
|
+
|
|
7
|
+
markdown: {
|
|
8
|
+
toc: {
|
|
9
|
+
enabled: true,
|
|
10
|
+
position: 'sidebar',
|
|
11
|
+
minDepth: 2,
|
|
12
|
+
maxDepth: 3,
|
|
13
|
+
},
|
|
14
|
+
features: {
|
|
15
|
+
inlineFormatting: true,
|
|
16
|
+
containers: true,
|
|
17
|
+
githubAlerts: true,
|
|
18
|
+
codeBlocks: {
|
|
19
|
+
lineNumbers: true,
|
|
20
|
+
lineHighlighting: true,
|
|
21
|
+
focus: true,
|
|
22
|
+
diff: true,
|
|
23
|
+
errorWarning: true,
|
|
24
|
+
},
|
|
25
|
+
codeGroups: true,
|
|
26
|
+
codeImports: true,
|
|
27
|
+
inlineToc: true,
|
|
28
|
+
customAnchors: true,
|
|
29
|
+
emoji: true,
|
|
30
|
+
badges: true,
|
|
31
|
+
includes: true,
|
|
32
|
+
externalLinks: {
|
|
33
|
+
enabled: true,
|
|
34
|
+
openInNewTab: true,
|
|
35
|
+
addIcon: true,
|
|
36
|
+
},
|
|
37
|
+
imageLazyLoading: true,
|
|
38
|
+
tables: {
|
|
39
|
+
responsive: true,
|
|
40
|
+
striped: true,
|
|
41
|
+
hover: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
nav: [
|
|
47
|
+
{ text: 'Home', link: '/' },
|
|
48
|
+
{ text: 'Guide', link: '/guide/' },
|
|
49
|
+
],
|
|
50
|
+
|
|
51
|
+
sitemap: {
|
|
52
|
+
hostname: 'https://example.com',
|
|
53
|
+
},
|
|
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(`
|
|
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'
|
|
58
|
+
|
|
59
|
+
export default {
|
|
60
|
+
verbose: false,
|
|
61
|
+
|
|
62
|
+
markdown: {
|
|
63
|
+
toc: {
|
|
64
|
+
enabled: true,
|
|
65
|
+
position: 'sidebar',
|
|
66
|
+
minDepth: 2,
|
|
67
|
+
maxDepth: 3,
|
|
68
|
+
},
|
|
69
|
+
features: {
|
|
70
|
+
inlineFormatting: true,
|
|
71
|
+
containers: true,
|
|
72
|
+
githubAlerts: true,
|
|
73
|
+
codeBlocks: {
|
|
74
|
+
lineNumbers: true,
|
|
75
|
+
lineHighlighting: true,
|
|
76
|
+
focus: true,
|
|
77
|
+
diff: true,
|
|
78
|
+
errorWarning: true,
|
|
79
|
+
},
|
|
80
|
+
codeGroups: true,
|
|
81
|
+
codeImports: true,
|
|
82
|
+
inlineToc: true,
|
|
83
|
+
customAnchors: true,
|
|
84
|
+
emoji: true,
|
|
85
|
+
badges: true,
|
|
86
|
+
includes: true,
|
|
87
|
+
externalLinks: {
|
|
88
|
+
enabled: true,
|
|
89
|
+
openInNewTab: true,
|
|
90
|
+
addIcon: true,
|
|
91
|
+
},
|
|
92
|
+
imageLazyLoading: true,
|
|
93
|
+
tables: {
|
|
94
|
+
responsive: true,
|
|
95
|
+
striped: true,
|
|
96
|
+
hover: true,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
nav: [
|
|
102
|
+
{ text: 'Home', link: '/' },
|
|
103
|
+
{ text: 'Guide', link: '/guide/' },
|
|
104
|
+
{ text: 'GitHub', link: 'https://github.com/stacksjs/bunpress' },
|
|
105
|
+
],
|
|
106
|
+
|
|
107
|
+
sitemap: {
|
|
108
|
+
hostname: 'https://example.com',
|
|
109
|
+
},
|
|
110
|
+
} satisfies BunPressConfig
|
|
111
|
+
`,E6=`---
|
|
112
|
+
layout: home
|
|
113
|
+
title: Welcome to My Documentation
|
|
114
|
+
|
|
115
|
+
hero:
|
|
116
|
+
name: My Project
|
|
117
|
+
text: Modern documentation made easy
|
|
118
|
+
tagline: Fast, flexible, and beautiful documentation powered by BunPress
|
|
119
|
+
actions:
|
|
120
|
+
- theme: brand
|
|
121
|
+
text: Get Started
|
|
122
|
+
link: /guide/
|
|
123
|
+
- theme: alt
|
|
124
|
+
text: View on GitHub
|
|
125
|
+
link: https://github.com/yourusername/your-repo
|
|
126
|
+
|
|
127
|
+
features:
|
|
128
|
+
- icon: \u26A1
|
|
129
|
+
title: Lightning Fast
|
|
130
|
+
details: Powered by Bun runtime for incredible build and dev server performance
|
|
131
|
+
- icon: \uD83C\uDFA8
|
|
132
|
+
title: Beautiful by Default
|
|
133
|
+
details: Clean, modern design with dark mode support out of the box
|
|
134
|
+
- icon: \uD83D\uDCDD
|
|
135
|
+
title: Markdown Enhanced
|
|
136
|
+
details: Extended markdown features including containers, code groups, and more
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
# Welcome
|
|
140
|
+
|
|
141
|
+
This is your new BunPress documentation site. Start editing files in the \`docs/\` directory to customize your content.
|
|
142
|
+
`,F6=`# Getting Started
|
|
143
|
+
|
|
144
|
+
Welcome to the getting started guide!
|
|
145
|
+
|
|
146
|
+
## Installation
|
|
147
|
+
|
|
148
|
+
\`\`\`bash
|
|
149
|
+
bun install @stacksjs/bunpress
|
|
150
|
+
\`\`\`
|
|
151
|
+
|
|
152
|
+
## Quick Start
|
|
153
|
+
|
|
154
|
+
Create your first documentation page:
|
|
155
|
+
|
|
156
|
+
\`\`\`bash
|
|
157
|
+
bunpress new my-page
|
|
158
|
+
\`\`\`
|
|
159
|
+
|
|
160
|
+
## Next Steps
|
|
161
|
+
|
|
162
|
+
::: tip
|
|
163
|
+
Check out the [markdown extensions](/guide/markdown) to learn about all the powerful features available.
|
|
164
|
+
:::
|
|
165
|
+
|
|
166
|
+
- Learn about [configuration](/guide/configuration)
|
|
167
|
+
- Explore [advanced features](/guide/advanced)
|
|
168
|
+
- Read the [API reference](/api/)
|
|
169
|
+
`,v6=`node_modules/
|
|
170
|
+
dist/
|
|
171
|
+
.DS_Store
|
|
172
|
+
*.log
|
|
173
|
+
.env
|
|
174
|
+
.env.*
|
|
175
|
+
!.env.example
|
|
176
|
+
`,D6=`# My BunPress Documentation
|
|
177
|
+
|
|
178
|
+
Documentation powered by [BunPress](https://github.com/stacksjs/bunpress).
|
|
179
|
+
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
Start the dev server:
|
|
183
|
+
|
|
184
|
+
\`\`\`bash
|
|
185
|
+
bun run dev
|
|
186
|
+
\`\`\`
|
|
187
|
+
|
|
188
|
+
## Build
|
|
189
|
+
|
|
190
|
+
Build the documentation:
|
|
191
|
+
|
|
192
|
+
\`\`\`bash
|
|
193
|
+
bun run build
|
|
194
|
+
\`\`\`
|
|
195
|
+
|
|
196
|
+
## Preview
|
|
197
|
+
|
|
198
|
+
Preview the built site:
|
|
199
|
+
|
|
200
|
+
\`\`\`bash
|
|
201
|
+
bun run preview
|
|
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)=>`---
|
|
204
|
+
title: ${K}
|
|
205
|
+
description:
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
# ${K}
|
|
209
|
+
|
|
210
|
+
Your content goes here...
|
|
211
|
+
`,guide:(K)=>`---
|
|
212
|
+
title: ${K}
|
|
213
|
+
description: ${K} guide
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
# ${K}
|
|
217
|
+
|
|
218
|
+
## Introduction
|
|
219
|
+
|
|
220
|
+
Brief introduction to the topic.
|
|
221
|
+
|
|
222
|
+
## Getting Started
|
|
223
|
+
|
|
224
|
+
Step-by-step instructions.
|
|
225
|
+
|
|
226
|
+
## Examples
|
|
227
|
+
|
|
228
|
+
\`\`\`typescript
|
|
229
|
+
// Example code
|
|
230
|
+
\`\`\`
|
|
231
|
+
|
|
232
|
+
## Next Steps
|
|
233
|
+
|
|
234
|
+
- [ ] Task 1
|
|
235
|
+
- [ ] Task 2
|
|
236
|
+
`,api:(K)=>`---
|
|
237
|
+
title: ${K}
|
|
238
|
+
description: API reference for ${K}
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
# ${K}
|
|
242
|
+
|
|
243
|
+
## Overview
|
|
244
|
+
|
|
245
|
+
Brief overview of the API.
|
|
246
|
+
|
|
247
|
+
## Methods
|
|
248
|
+
|
|
249
|
+
### \`methodName()\`
|
|
250
|
+
|
|
251
|
+
Description of the method.
|
|
252
|
+
|
|
253
|
+
**Parameters:**
|
|
254
|
+
|
|
255
|
+
- \`param1\` (\`type\`) - Description
|
|
256
|
+
|
|
257
|
+
**Returns:**
|
|
258
|
+
|
|
259
|
+
- \`ReturnType\` - Description
|
|
260
|
+
|
|
261
|
+
**Example:**
|
|
262
|
+
|
|
263
|
+
\`\`\`typescript
|
|
264
|
+
// Example usage
|
|
265
|
+
\`\`\`
|
|
266
|
+
`,blog:(K)=>`---
|
|
267
|
+
title: ${K}
|
|
268
|
+
description:
|
|
269
|
+
date: ${new Date().toISOString().split("T")[0]}
|
|
270
|
+
author:
|
|
271
|
+
tags: []
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
# ${K}
|
|
275
|
+
|
|
276
|
+
Post content goes here...
|
|
277
|
+
|
|
278
|
+
## Section 1
|
|
279
|
+
|
|
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(`
|
|
285
|
+
|
|
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,""),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=!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
|
+
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-b99gqcxe.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-b99gqcxe.js"),$=`
|
|
291
|
+
<style>
|
|
292
|
+
.NotFound {
|
|
293
|
+
padding: 64px 24px 96px;
|
|
294
|
+
text-align: center;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
@media (min-width: 768px) {
|
|
298
|
+
.NotFound {
|
|
299
|
+
padding: 96px 32px 168px;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.NotFound .code {
|
|
304
|
+
line-height: 64px;
|
|
305
|
+
font-size: 64px;
|
|
306
|
+
font-weight: 600;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.NotFound .title {
|
|
310
|
+
padding-top: 12px;
|
|
311
|
+
letter-spacing: 2px;
|
|
312
|
+
line-height: 20px;
|
|
313
|
+
font-size: 20px;
|
|
314
|
+
font-weight: 700;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.NotFound .divider {
|
|
318
|
+
margin: 24px auto 18px;
|
|
319
|
+
width: 64px;
|
|
320
|
+
height: 1px;
|
|
321
|
+
background-color: var(--vp-c-divider);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.NotFound .quote {
|
|
325
|
+
margin: 0 auto;
|
|
326
|
+
max-width: 256px;
|
|
327
|
+
font-size: 14px;
|
|
328
|
+
font-weight: 500;
|
|
329
|
+
color: var(--vp-c-text-2);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.NotFound .action {
|
|
333
|
+
padding-top: 20px;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.NotFound .link {
|
|
337
|
+
display: inline-block;
|
|
338
|
+
border: 1px solid var(--vp-c-brand-1);
|
|
339
|
+
border-radius: 16px;
|
|
340
|
+
padding: 3px 16px;
|
|
341
|
+
font-size: 14px;
|
|
342
|
+
font-weight: 500;
|
|
343
|
+
color: var(--vp-c-brand-1);
|
|
344
|
+
transition: border-color 0.25s, color 0.25s;
|
|
345
|
+
text-decoration: none;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.NotFound .link:hover {
|
|
349
|
+
border-color: var(--vp-c-brand-2);
|
|
350
|
+
color: var(--vp-c-brand-2);
|
|
351
|
+
}
|
|
352
|
+
</style>
|
|
353
|
+
|
|
354
|
+
<div class="NotFound">
|
|
355
|
+
<p class="code">404</p>
|
|
356
|
+
<h1 class="title">PAGE NOT FOUND</h1>
|
|
357
|
+
<div class="divider"></div>
|
|
358
|
+
<blockquote class="quote">
|
|
359
|
+
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
|
|
360
|
+
</blockquote>
|
|
361
|
+
<div class="action">
|
|
362
|
+
<a class="link" href="/docs/" aria-label="go to home">
|
|
363
|
+
Take me home
|
|
364
|
+
</a>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
`,q=await Q(`
|
|
368
|
+
<style>
|
|
369
|
+
.NotFound {
|
|
370
|
+
padding: 64px 24px 96px;
|
|
371
|
+
text-align: center;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
@media (min-width: 768px) {
|
|
375
|
+
.NotFound {
|
|
376
|
+
padding: 96px 32px 168px;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.NotFound .code {
|
|
381
|
+
line-height: 64px;
|
|
382
|
+
font-size: 64px;
|
|
383
|
+
font-weight: 600;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.NotFound .title {
|
|
387
|
+
padding-top: 12px;
|
|
388
|
+
letter-spacing: 2px;
|
|
389
|
+
line-height: 20px;
|
|
390
|
+
font-size: 20px;
|
|
391
|
+
font-weight: 700;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.NotFound .divider {
|
|
395
|
+
margin: 24px auto 18px;
|
|
396
|
+
width: 64px;
|
|
397
|
+
height: 1px;
|
|
398
|
+
background-color: var(--vp-c-divider);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.NotFound .quote {
|
|
402
|
+
margin: 0 auto;
|
|
403
|
+
max-width: 256px;
|
|
404
|
+
font-size: 14px;
|
|
405
|
+
font-weight: 500;
|
|
406
|
+
color: var(--vp-c-text-2);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.NotFound .action {
|
|
410
|
+
padding-top: 20px;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.NotFound .link {
|
|
414
|
+
display: inline-block;
|
|
415
|
+
border: 1px solid var(--vp-c-brand-1);
|
|
416
|
+
border-radius: 16px;
|
|
417
|
+
padding: 3px 16px;
|
|
418
|
+
font-size: 14px;
|
|
419
|
+
font-weight: 500;
|
|
420
|
+
color: var(--vp-c-brand-1);
|
|
421
|
+
transition: border-color 0.25s, color 0.25s;
|
|
422
|
+
text-decoration: none;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.NotFound .link:hover {
|
|
426
|
+
border-color: var(--vp-c-brand-2);
|
|
427
|
+
color: var(--vp-c-brand-2);
|
|
428
|
+
}
|
|
429
|
+
</style>
|
|
430
|
+
|
|
431
|
+
<div class="NotFound">
|
|
432
|
+
<p class="code">404</p>
|
|
433
|
+
<h1 class="title">PAGE NOT FOUND</h1>
|
|
434
|
+
<div class="divider"></div>
|
|
435
|
+
<blockquote class="quote">
|
|
436
|
+
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
|
|
437
|
+
</blockquote>
|
|
438
|
+
<div class="action">
|
|
439
|
+
<a class="link" href="/docs/" aria-label="go to home">
|
|
440
|
+
Take me home
|
|
441
|
+
</a>
|
|
442
|
+
</div>
|
|
443
|
+
</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
|
+
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-b99gqcxe.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
|
+
|
|
448
|
+
`;N+=`Generated: ${new Date().toISOString()}
|
|
449
|
+
|
|
450
|
+
`,N+=`Total files: ${Y.length}
|
|
451
|
+
|
|
452
|
+
`,N+=`---
|
|
453
|
+
|
|
454
|
+
`;for(let _ of Y){let R=_.replace(`${Q}/`,""),U=await Bun.file(_).text();if(X)console.log(`Processing: ${R}`);if(N+=`## File: ${R}
|
|
455
|
+
|
|
456
|
+
`,q)N+=U,N+=`
|
|
457
|
+
|
|
458
|
+
`;else{let A=U.split(`
|
|
459
|
+
`),J=!1,H="";for(let T of A){if(T.trim()==="---")if(!J){J=!0;continue}else{if(J=!1,H)N+="**Frontmatter:**\n```yaml\n",N+=H,N+="```\n\n",H="";continue}if(J){H+=`${T}
|
|
460
|
+
`;continue}if(T.match(/^#{1,6}\s+/))N+=`${T}
|
|
461
|
+
`}N+=`
|
|
462
|
+
`}N+=`---
|
|
463
|
+
|
|
464
|
+
`}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-vkxkq2vj.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
|
+
export{G as E,W as F,B as G,D as H,M6 as I,R6 as J};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var{YAML:w}=globalThis.Bun;import*as I from"fs";import*as T from"path";async function k(H,J,j){let K=J.sitemap?.baseUrl||"",N=j?.title||J.title||J.markdown?.title||"Documentation Feed",O=j?.description||J.description||J.markdown?.meta?.description||"Documentation updates",Q=j?.author||"Documentation Team",Z=j?.email||"",_=j?.language||"en-us",$=j?.maxItems||20,V=j?.fullContent||!1,W=await U(H,K,V);W.sort((G,z)=>z.pubDate.getTime()-G.pubDate.getTime());let B=W.slice(0,$);return D({title:N,description:O,link:K,language:_,author:Q,email:Z,items:B})}async function g(H,J,j,K){if(!K?.enabled)return;if(!j.sitemap?.baseUrl){if(j.verbose)console.warn("\u26A0\uFE0F RSS feed generation skipped: baseUrl not configured");return}let N=await k(H,j,K),O=K.filename||"feed.xml",Q=T.join(J,O);if(await I.promises.writeFile(Q,N,"utf-8"),j.verbose){let Z=(N.match(/<item>/g)||[]).length;console.log(`\u2705 RSS feed generated: ${Q} (${Z} items)`)}}async function U(H,J,j){let K=[],N=await x(H);for(let O of N){let Q=await I.promises.readFile(O,"utf-8"),{frontmatter:Z,markdown:_}=P(Q);if(!Z.date||!Z.title)continue;let V=T.relative(H,O).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!V.startsWith("/"))V=`/${V}`;if(V.endsWith("/")&&V!=="/")V=V.slice(0,-1);let W=`${J.replace(/\/$/,"")}${V}`,B=Z.description||b(_),G=new Date(Z.date),z=Z.author;K.push({title:Z.title,link:W,description:B,pubDate:G,author:z,content:j?_:void 0})}return K}async function x(H){let J=[];async function j(K){let N=await I.promises.readdir(K,{withFileTypes:!0});for(let O of N){let Q=T.join(K,O.name);if(O.isDirectory()){if(!O.name.startsWith(".")&&O.name!=="node_modules")await j(Q)}else if(O.isFile()&&O.name.endsWith(".md"))J.push(Q)}}return await j(H),J}function P(H){let J=/^---\n([\s\S]*?)\n---\n?/,j=H.match(J);if(!j)return{frontmatter:{},markdown:H};let K=j[1],N=H.slice(j[0].length);try{return{frontmatter:w.parse(K),markdown:N}}catch{return{frontmatter:{},markdown:H}}}function b(H,J=200){let j=H.replace(/^#{1,6}\s+(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]+`/g,"").replace(/!\[.*?\]\(.*?\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_~]/g,"").trim(),K=j.split(`
|
|
3
|
+
|
|
4
|
+
`)[0]||j;if(K.length>J)return`${K.slice(0,J)}...`;return K}function D(H){let J=new Date,j=H.items.length>0?H.items[0].pubDate:J,K=H.items.map((N)=>{let O=N.content?`
|
|
5
|
+
<content:encoded><![CDATA[${N.content}]]></content:encoded>`:"",Q=N.author?`
|
|
6
|
+
<dc:creator><![CDATA[${N.author}]]></dc:creator>`:"";return` <item>
|
|
7
|
+
<title><![CDATA[${N.title}]]></title>
|
|
8
|
+
<link>${N.link}</link>
|
|
9
|
+
<guid>${N.link}</guid>
|
|
10
|
+
<description><![CDATA[${N.description}]]></description>
|
|
11
|
+
<pubDate>${N.pubDate.toUTCString()}</pubDate>${Q}${O}
|
|
12
|
+
</item>`}).join(`
|
|
13
|
+
`);return['<?xml version="1.0" encoding="UTF-8"?>','<rss version="2.0"',' xmlns:content="http://purl.org/rss/1.0/modules/content/"',' xmlns:dc="http://purl.org/dc/elements/1.1/"',' xmlns:atom="http://www.w3.org/2005/Atom">'," <channel>",` <title><![CDATA[${H.title}]]></title>`,` <description><![CDATA[${H.description}]]></description>`,` <link>${H.link}</link>`,` <language>${H.language}</language>`,` <lastBuildDate>${j.toUTCString()}</lastBuildDate>`,` <atom:link href="${H.link}/feed.xml" rel="self" type="application/rss+xml"/>`,K," </channel>","</rss>"].join(`
|
|
14
|
+
`)}import*as v from"fs";import*as E from"path";async function l(H,J){let j=J.robots;if(j?.enabled===!1)return;let K=j?.filename||"robots.txt",N=y(J),O=E.join(H,K);if(await v.promises.writeFile(O,N,"utf-8"),J.verbose)console.log(`\u2705 Robots.txt generated: ${O}`)}function y(H){let J=H.robots,j=[];if(J?.rules&&J.rules.length>0)for(let K of J.rules)j.push(...C(K)),j.push("");else j.push("User-agent: *"),j.push("Allow: /"),j.push("");if(J?.host)j.push(`Host: ${J.host}`),j.push("");if(J?.sitemaps&&J.sitemaps.length>0){for(let K of J.sitemaps)j.push(`Sitemap: ${K}`);j.push("")}else if(H.sitemap?.enabled!==!1&&H.sitemap?.baseUrl){let K=H.sitemap.filename||"sitemap.xml",N=`${H.sitemap.baseUrl.replace(/\/$/,"")}/${K}`;j.push(`Sitemap: ${N}`),j.push("")}if(J?.customContent)j.push(J.customContent),j.push("");return`${j.join(`
|
|
15
|
+
`).trim()}
|
|
16
|
+
`}function C(H){let J=[];if(J.push(`User-agent: ${H.userAgent}`),H.allow&&H.allow.length>0)for(let j of H.allow)J.push(`Allow: ${j}`);if(H.disallow&&H.disallow.length>0)for(let j of H.disallow)J.push(`Disallow: ${j}`);if(H.crawlDelay!==void 0)J.push(`Crawl-delay: ${H.crawlDelay}`);return J}import*as A from"fs";import*as Y from"path";async function R(H,J,j){let K=J.sitemap,N=await h(H,j,K?.defaultPriority??0.5,K?.defaultChangefreq||"monthly",K?.exclude||[],K?.priorityMap||{},K?.changefreqMap||{});return K?.transform?N.map((O)=>K.transform(O)).filter(Boolean):N}async function s(H,J){let j=(J.sitemap?.baseUrl||"").replace(/\/$/,""),K=await R(H,J,j);return M(K,j)}async function o(H,J,j){let K=j.sitemap;if(K?.enabled===!1)return;if(!K?.baseUrl){if(j.verbose)console.warn("\u26A0\uFE0F Sitemap generation skipped: baseUrl not configured");return}let N=K.baseUrl.replace(/\/$/,""),O=K.filename||"sitemap.xml",Q=K.maxUrlsPerFile||50000,Z=K.useSitemapIndex||!1,_=await R(H,j,N);if(j.verbose)console.log(`\uD83D\uDCC4 Generated ${_.length} sitemap entries`);if(Z&&_.length>Q)await u(_,J,N,O,Q);else{let $=M(_,N),V=Y.join(J,O);if(await A.promises.writeFile(V,$,"utf-8"),j.verbose)console.log(`\u2705 Sitemap generated: ${V}`)}}async function h(H,J,j,K,N,O,Q){let Z=[],_=await p(H);for(let $ of _){let W=Y.relative(H,$).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!W.startsWith("/"))W=`/${W}`;if(W.endsWith("/")&&W!=="/")W=W.slice(0,-1);if(d(W,N))continue;let G=(await A.promises.stat($)).mtime.toISOString(),z=j;for(let[X,L]of Object.entries(O))if(q(W,X)){z=L;break}let S=K;for(let[X,L]of Object.entries(Q))if(q(W,X)){S=L;break}Z.push({url:W,lastmod:G,changefreq:S,priority:z})}return Z}async function p(H){let J=[];async function j(K){let N=await A.promises.readdir(K,{withFileTypes:!0});for(let O of N){let Q=Y.join(K,O.name);if(O.isDirectory()){if(!O.name.startsWith(".")&&O.name!=="node_modules")await j(Q)}else if(O.isFile()&&O.name.endsWith(".md"))J.push(Q)}}return await j(H),J}function d(H,J){for(let j of J)if(q(H,j))return!0;return!1}function q(H,J){let j=J.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".");return new RegExp(`^${j}$`).test(H)}function M(H,J=""){let j=J.replace(/\/$/,"");return`<?xml version="1.0" encoding="UTF-8"?>
|
|
17
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
18
|
+
${H.map((N)=>{let O=/^https?:\/\//.test(N.url)?N.url:`${j}${N.url}`,Q=N.lastmod?`
|
|
19
|
+
<lastmod>${F(N.lastmod)}</lastmod>`:"",Z=N.changefreq?`
|
|
20
|
+
<changefreq>${N.changefreq}</changefreq>`:"",_=N.priority!==void 0?`
|
|
21
|
+
<priority>${N.priority.toFixed(1)}</priority>`:"";return` <url>
|
|
22
|
+
<loc>${O}</loc>${Q}${Z}${_}
|
|
23
|
+
</url>`}).join(`
|
|
24
|
+
`)}
|
|
25
|
+
</urlset>`}async function u(H,J,j,K,N){let O=m(H,N),Q=[];for(let V=0;V<O.length;V++){let W=`sitemap-${V+1}.xml`,B=M(O[V],j),G=Y.join(J,W);await A.promises.writeFile(G,B,"utf-8"),Q.push(W)}let _=`<?xml version="1.0" encoding="UTF-8"?>
|
|
26
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
27
|
+
${Q.map((V)=>{let W=`${j}/${V}`,B=new Date().toISOString();return` <sitemap>
|
|
28
|
+
<loc>${W}</loc>
|
|
29
|
+
<lastmod>${F(B)}</lastmod>
|
|
30
|
+
</sitemap>`}).join(`
|
|
31
|
+
`)}
|
|
32
|
+
</sitemapindex>`,$=Y.join(J,K);await A.promises.writeFile($,_,"utf-8")}function F(H){return(typeof H==="string"?new Date(H):H).toISOString().split("T")[0]}function m(H,J){let j=[];for(let K=0;K<H.length;K+=J)j.push(H.slice(K,K+J));return j}
|
|
33
|
+
export{k as K,g as L,l as M,s as N,o as O};
|
|
@@ -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-
|
|
2
|
+
import{E as $,F as I,G as f,H as h,J as x}from"./chunk-mmergr6m.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(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{P as lQ,Q as P}from"./chunk-e5q66hsy.js";import{S as x}from"./chunk-w6byd4st.js";var{Glob:fQ,YAML:pQ}=globalThis.Bun;import{stat as mQ}from"fs/promises";import{join as i}from"path";import f from"process";var{Glob:aQ}=globalThis.Bun;import{join as UQ}from"path";var g=new Map;function nQ(Q,Z,$){let Y=Z.split("."),J=Q;for(let O=0;O<Y.length-1;O++){let q=Y[O];if(typeof J[q]!=="object"||J[q]===null)J[q]={};J=J[q]}J[Y[Y.length-1]]=$}async function jQ(Q){if(g.has(Q))return g.get(Q);let Z={},$=UQ(Q,".data");try{let Y=new aQ("**/*.json");for await(let J of Y.scan({cwd:$,absolute:!1}))try{let O=await Bun.file(UQ($,J)).text(),q=J.replace(/\.json$/,"").replace(/[/\\]/g,".");nQ(Z,q,JSON.parse(O))}catch{}}catch{}return g.set(Q,Z),Z}function NQ(){g.clear()}import{createHighlighter as tQ,highlight as eQ}from"ts-syntax-highlighter";var u=null;function G0(){u=null}async function EQ(){if(u)return u;return u=await tQ({theme:"github-light",cache:!0}),u}var QZ={js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",htm:"html",sh:"bash",shell:"bash",zsh:"bash"};function n(Q){let Z=Q.toLowerCase().trim();return QZ[Z]||Z}function RQ(Q){let Z=n(Q);return["javascript","typescript","html","css","json","stx","bash"].includes(Z)}function h(Q){return Q.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ZZ(Q,Z){let $=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,Y=[],J;while((J=$.exec(Z))!==null){let X=J[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;/g,"'");if(X)Y.push({text:X,span:J[0]})}if(Y.length===0)return Z;let O="",q=0,K=Q.match(/^(\s*)/);if(K&&K[1])O+=K[1],q=K[1].length;for(let X=0;X<Y.length;X++){let{text:z,span:V}=Y[X],_=Q.indexOf(z,q);if(_===-1){O+=V;continue}if(_>q){let G=Q.substring(q,_);if(/^\s+$/.test(G))O+=G}O+=V,q=_+z.length}return O}async function t(Q,Z,$="github-light"){let Y=n(Z);if(!RQ(Y))return Q.split(`
|
|
3
3
|
`).map((O)=>`<span class="line">${h(O)}</span>`).join(`
|
|
4
4
|
`);try{let J=Q.split(`
|
|
5
5
|
`);return(await Promise.all(J.map(async(q)=>{if(!q.trim())return`<span class="line">${q}</span>`;let X=(await eQ(q,Y,{theme:$})).html;if(X=X.replace(/<div[^>]*class="syntax-wrapper"[^>]*>/g,""),X=X.replace(/<\/div>\s*$/g,""),X=X.replace(/<pre[^>]*>/g,""),X=X.replace(/<\/pre>/g,""),X=X.replace(/<code[^>]*>/g,""),X=X.replace(/<\/code>/g,""),X=ZZ(q,X.trim()),!X.startsWith('<span class="line">'))X=`<span class="line">${X}</span>`;return X}))).join(`
|
|
@@ -7795,7 +7795,7 @@ ${K}
|
|
|
7795
7795
|
${X}
|
|
7796
7796
|
${o}
|
|
7797
7797
|
${z}
|
|
7798
|
-
${_}`,a=await v("layout-doc",{htmlClass:p,themeMode:S,title:J,description:O,meta:I,customCSS:m,nav:L,sidebar:R,content:H,pageTOC:D});return _Q(qQ(KQ(a,w)),Z)}var s=null,hQ=!1;async function xZ(){if(hQ)return s;hQ=!0;try{s=await import("./chunk-
|
|
7798
|
+
${_}`,a=await v("layout-doc",{htmlClass:p,themeMode:S,title:J,description:O,meta:I,customCSS:m,nav:L,sidebar:R,content:H,pageTOC:D});return _Q(qQ(KQ(a,w)),Z)}var s=null,hQ=!1;async function xZ(){if(hQ)return s;hQ=!0;try{s=await import("./chunk-mch0qmg4.js")}catch{s=null}return s}async function zQ(Q){let Z=await xZ();if(!Z)return"";let Y=new Z.Scanner([]).scanContent(Q);if(Y.size===0)return"";let J=new Z.CSSGenerator(Z.defaultConfig);for(let O of Y)J.generate(O);return J.toCSS(!1,!1)}function CZ(Q){if(!Q.fathom?.enabled||!Q.fathom?.siteId)return"";let Z=Q.fathom.scriptUrl||"https://cdn.usefathom.com/script.js",$=Q.fathom.defer!==!1,Y=Q.fathom.honorDNT||!1,J=Q.fathom.auto!==!1,O=Q.fathom.canonical,q=Q.fathom.spa||!1,K=[`data-site="${Q.fathom.siteId}"`,Y?'data-honor-dnt="true"':"",!J?'data-auto="false"':"",O?`data-canonical="${O}"`:"",q?'data-spa="auto"':""].filter(Boolean).join(" ");return`<script src="${Z}" ${K}${$?" defer":""}></script>`}function uZ(Q){let Z=Q.analytics||Q.selfHostedAnalytics;if(!Z?.enabled||!Z?.siteId)return"";let $=dQ(Z.siteId),Y=Z.apiEndpoint?dQ(Z.apiEndpoint):"",J=Z.honorDNT?`var dnt=n.doNotTrack||w.doNotTrack||n.msDoNotTrack;if(dnt==="1"||dnt==="yes"||dnt===true){l('DNT enabled, skipping');return;}`:"",O=Z.trackHashChanges?"w.addEventListener('hashchange',function(){pv();});":"",q=Z.trackOutboundLinks?`d.addEventListener('click',function(e){try{var a=e.target.closest('a');if(a&&a.hostname&&a.hostname!==location.hostname){t('outbound',{url:a.href,text:(a.textContent||'').slice(0,100)});}}
|
|
7799
7799
|
catch (err){l('Outbound error',err);}});`:"",K=Y?` data-api="${Y}"`:"";return`<!-- ts-analytics: privacy-first analytics -->
|
|
7800
7800
|
<script data-site="${$}"${K} defer>
|
|
7801
7801
|
(function(){
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{A as
|
|
2
|
+
import{A as d,B as f,C as a,D as g,a as O,b as P,c as Q,d as S,e as T,f as V,g as W,h as X,i as Y,j as Z,k as _,l as $,m as b,n as v,o as x,p as A,q as F,r as R,s as U,t as m,u as C,v as h,w as l,x as y,y as p,z as c}from"../chunk-w17epehd.js";import{K as j,L as k,M as q,N as u,O as w}from"../chunk-ss6yzy9f.js";import{P as L,Q as M,R as N}from"../chunk-e5q66hsy.js";import"../chunk-w6byd4st.js";export{d as wrapInLayout,c as stripConfiguredBasePath,a as startServer,g as serveCLI,O as resetHighlighter,C as processInlineTocSyntax,W as prewarmHighlighter,P as normalizeLanguage,f as markdownToHtml,Q as isLanguageSupported,T as highlightCodeSync,S as highlightCode,V as getSyntaxHighlightingStyles,X as getHighlighterInstance,p as getConfiguredBasePath,N as getConfig,_ as generateUniqueSlug,l as generateTocStyles,y as generateTocScripts,m as generateTocPositions,x as generateTocHtml,U as generateTocData,Z as generateSlug,w as generateSitemap,F as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,A as generateInlineTocHtml,R as generateFloatingTocHtml,v as filterHeadings,$ as extractHeadings,h as enhanceHeadingsWithAnchors,Y as defaultTocConfig,L as defaultConfig,M as config,b as buildTocHierarchy,u as buildSitemap,j as buildRssFeed};
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/bunpress",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"
|
|
5
|
-
"version": "0.1.13",
|
|
4
|
+
"version": "0.1.15",
|
|
6
5
|
"description": "Modern documentation engine. Powered by Bun.",
|
|
7
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
8
7
|
"license": "MIT",
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
"dependencies": {
|
|
56
55
|
"@stacksjs/stx": "^0.2.82",
|
|
57
56
|
"@stacksjs/ts-md": "^0.1.1",
|
|
58
|
-
"@stacksjs/ts-cloud": "^0.7.
|
|
57
|
+
"@stacksjs/ts-cloud": "^0.7.26",
|
|
59
58
|
"bunfig": "^0.15.6"
|
|
60
59
|
},
|
|
61
60
|
"devDependencies": {
|